/* ═══════════════════════════════════════════════════════════════════════════
   Foresight Schools, Ikom — inner pages, and the social band on the home page.

   Everything here is drawn by includes/page.php from blocks the school keeps
   in the Admin panel. The block types are a closed set, so the styles are too:
   one section per type, and nothing that depends on a particular page.

   Loaded after base.css and home.css, so it may lean on the tokens they set.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── The band at the top of every inner page ───────────────────────────────
   Maroon, so an inner page announces itself as part of the school rather than
   opening on the same white as the section below it. */
.pagehero {
    position: relative;
    padding-block: clamp(56px, 9vw, 104px);
    background: linear-gradient(150deg, var(--color-primary), var(--maroon-deep, #4d0000));
    color: #fff;
    overflow: hidden;
    isolation: isolate;
}
.pagehero__bg {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; z-index: -2;
}
/* A wash over the photograph. Without it the headline sits on whatever the
   picture happens to be doing at that point, which is never reliable. */
.pagehero--image::after {
    content: ''; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(150deg,
        color-mix(in srgb, var(--color-primary) 88%, transparent),
        color-mix(in srgb, #000 62%, transparent));
}
.pagehero__inner { position: relative; }
.pagehero .eyebrow { color: var(--color-accent); }
.pagehero__title {
    margin: .35rem 0 0;
    font-family: var(--font-display, inherit);
    font-size: clamp(1.9rem, 1.3rem + 2.6vw, 3.1rem);
    font-weight: 800; line-height: 1.1; letter-spacing: -.02em;
}
.pagehero__sub {
    margin: .8rem 0 0; max-width: 62ch;
    font-size: clamp(1rem, .96rem + .2vw, 1.12rem); line-height: 1.65;
    color: color-mix(in srgb, #fff 86%, transparent);
}

/* ── Prose ─────────────────────────────────────────────────────────────────
   Held to a measure. A paragraph running the full width of a desktop screen is
   a paragraph nobody finishes. */
.prose { max-width: 68ch; margin-inline: auto; }
.prose--wide { max-width: none; }
.prose p { margin: 0 0 1.05em; line-height: 1.75; }
.prose p:last-child { margin-bottom: 0; }

/* ── Image beside copy ─────────────────────────────────────────────────── */
.feature { display: grid; gap: clamp(20px, 4vw, 48px); align-items: center; }
@media (min-width: 860px) {
    .feature { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    /* The editor's choice, not a second block type. */
    .feature--flip .feature__media { order: 2; }
}
.feature__media img,
.feature__media .media { border-radius: var(--r-lg, 16px); overflow: hidden; }
.feature__copy p { margin: 0 0 1em; line-height: 1.75; }
.feature__copy .btn { margin-top: .4rem; }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.cardgrid {
    display: grid; gap: clamp(14px, 2vw, 22px);
    grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
}
.pcard {
    display: flex; flex-direction: column;
    background: #fff; border: 1px solid var(--line, #e5e8ec);
    border-radius: var(--r-lg, 16px); overflow: hidden;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.pcard:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--color-secondary) 45%, var(--line, #e5e8ec));
    box-shadow: 0 14px 32px rgba(16, 24, 40, .1);
}
.pcard__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pcard__icon {
    display: grid; place-items: center; width: 46px; height: 46px;
    margin: 20px 20px 0; border-radius: 12px;
    background: var(--teal-tint, #e6f4f3); color: var(--teal-deep, #0f5f5c);
}
.pcard__body { padding: 18px 20px 22px; display: grid; gap: .4rem; }
.pcard__meta {
    margin: 0; font-size: .74rem; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--color-secondary);
}
.pcard__title { margin: 0; font-size: 1.06rem; font-weight: 700; line-height: 1.35; }
.pcard__text { margin: 0; font-size: .93rem; line-height: 1.65; color: var(--ink-70, #525c66); }
.pcard__link {
    margin-top: .3rem; display: inline-flex; align-items: center; gap: .35rem;
    font-size: .88rem; font-weight: 600; color: var(--color-secondary); text-decoration: none;
}
.pcard__link:hover { text-decoration: underline; }

/* ── Numbered steps ─────────────────────────────────────────────────────── */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; max-width: 78ch; margin-inline: auto; }
.steps__item { display: flex; gap: 16px; align-items: flex-start; }
.steps__n {
    flex: 0 0 auto; display: grid; place-items: center;
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--color-primary); color: #fff;
    font-weight: 800; font-size: 1rem;
}
.steps__title { margin: .35rem 0 .2rem; font-size: 1.05rem; font-weight: 700; }
.steps__text { margin: 0; line-height: 1.7; color: var(--ink-70, #525c66); }

/* ── Figures ───────────────────────────────────────────────────────────── */
.pstats {
    display: grid; gap: clamp(14px, 2.4vw, 28px);
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    text-align: center;
}
.pstats__item { display: grid; gap: .2rem; }
.pstats__n {
    font-family: var(--font-display, inherit);
    font-size: clamp(1.9rem, 1.4rem + 2vw, 2.8rem); font-weight: 800;
    color: var(--color-primary); line-height: 1;
}
.pstats__label { font-size: .9rem; color: var(--ink-70, #525c66); }

/* ── Questions and answers ─────────────────────────────────────────────── */
.faqlist { display: grid; gap: 10px; max-width: 78ch; margin-inline: auto; }
.faq {
    background: #fff; border: 1px solid var(--line, #e5e8ec);
    border-radius: var(--r-md, 12px); overflow: hidden;
}
.faq__q {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 15px 18px; cursor: pointer;
    font-weight: 600; list-style: none;
}
.faq__q::-webkit-details-marker { display: none; }
.faq__q:hover { background: var(--line-soft, #f4f6f8); }
.faq__caret { transition: transform .22s ease; flex: 0 0 auto; }
.faq[open] .faq__caret { transform: rotate(180deg); }
.faq[open] .faq__q { border-bottom: 1px solid var(--line, #e5e8ec); }
.faq__a { padding: 15px 18px; }
.faq__a p { margin: 0 0 .9em; line-height: 1.7; }
.faq__a p:last-child { margin-bottom: 0; }

/* ── Gallery ───────────────────────────────────────────────────────────── */
.pgallery {
    display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.pgallery__item { margin: 0; border-radius: var(--r-md, 12px); overflow: hidden; position: relative; }
.pgallery__item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pgallery__item figcaption {
    position: absolute; inset-inline: 0; bottom: 0; padding: 22px 12px 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .68));
    color: #fff; font-size: .82rem;
}

/* ── Pull quote ────────────────────────────────────────────────────────── */
.pquote { margin: 0; max-width: 60ch; margin-inline: auto; text-align: center; }
.pquote blockquote {
    margin: 0; font-family: var(--font-display, inherit);
    font-size: clamp(1.15rem, 1rem + .9vw, 1.6rem); font-weight: 600;
    line-height: 1.5; color: var(--color-primary);
}
.pquote blockquote::before { content: '\201C'; }
.pquote blockquote::after  { content: '\201D'; }
.pquote figcaption {
    margin-top: 1rem; display: flex; align-items: center; justify-content: center; gap: .6rem;
    font-size: .9rem; color: var(--ink-55, #79818b);
}
.pquote__face { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }

/* ── Call to action ────────────────────────────────────────────────────── */
.pcta {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: clamp(16px, 3vw, 32px);
    padding: clamp(24px, 4vw, 42px);
    border-radius: var(--r-lg, 16px);
    background: linear-gradient(140deg, var(--color-primary), var(--maroon-deep, #4d0000));
    color: #fff;
}
.pcta__title { margin: 0; font-size: clamp(1.3rem, 1.1rem + 1vw, 1.9rem); font-weight: 800; }
.pcta__text { margin: .5rem 0 0; max-width: 56ch; line-height: 1.65; color: color-mix(in srgb, #fff 84%, transparent); }

/* ── Contact ───────────────────────────────────────────────────────────── */
.contactgrid { display: grid; gap: clamp(22px, 4vw, 48px); }
@media (min-width: 900px) { .contactgrid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }
.contactgrid__details { display: grid; gap: 18px; align-content: start; }
.contactline { display: flex; gap: 13px; align-items: flex-start; }
.contactline__ico {
    flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px;
    border-radius: 12px; background: var(--teal-tint, #e6f4f3); color: var(--teal-deep, #0f5f5c);
}
.contactline__label {
    margin: 0; font-size: .74rem; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--ink-55, #79818b);
}
.contactline__value { margin: .15rem 0 0; line-height: 1.55; }
.contactline__value a { color: inherit; }
.contactgrid__map img { border-radius: var(--r-lg, 16px); }

.wform { display: grid; gap: 14px; }
.wform__row { display: grid; gap: 14px; }
@media (min-width: 620px) { .wform__row { grid-template-columns: 1fr 1fr; } }
.wform__field { display: grid; gap: .3rem; }
.wform__field label { font-size: .85rem; font-weight: 600; }
.wform__hint { font-weight: 400; color: var(--ink-55, #79818b); }
.wform__field input,
.wform__field textarea {
    width: 100%; padding: 11px 13px; font: inherit; font-size: .95rem;
    border: 1px solid var(--line, #e5e8ec); border-radius: var(--r-md, 12px);
    background: #fff; color: inherit;
}
.wform__field input:focus-visible,
.wform__field textarea:focus-visible {
    outline: 2px solid var(--color-secondary); outline-offset: 1px; border-color: var(--color-secondary);
}
/* The honeypot. Off-screen rather than display:none — a robot that reads the
   stylesheet can spot the second but not so easily the first. */
.wform__trap {
    position: absolute; left: -9999px; width: 1px; height: 1px;
    overflow: hidden;
}
.formnote {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 13px 15px; border-radius: var(--r-md, 12px); margin-bottom: 16px;
}
.formnote p { margin: 0; line-height: 1.55; }
.formnote--ok  { background: #ecfdf3; border: 1px solid #abefc6; color: #067647; }
.formnote--err { background: #fef3f2; border: 1px solid #fecdca; color: #b42318; }


/* ═══════════════════════════════════════════════════════════════════════════
   The social band on the home page
   ═══════════════════════════════════════════════════════════════════════════ */
.socialband__head {
    display: flex; flex-wrap: wrap; gap: 18px;
    align-items: flex-end; justify-content: space-between;
    margin-bottom: clamp(20px, 3vw, 32px);
}
.socialband__links { display: flex; flex-wrap: wrap; gap: 8px; }
.socialchip {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: 8px 14px; border-radius: 999px;
    border: 1px solid var(--line, #e5e8ec); background: #fff;
    font-size: .85rem; font-weight: 600; color: inherit; text-decoration: none;
    transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}
.socialchip:hover { transform: translateY(-2px); color: #fff; }
/* Each platform in its own colour on hover: recognisable at a glance, and quiet
   until somebody reaches for it. */
.socialchip--facebook:hover  { background: #1877F2; border-color: #1877F2; }
.socialchip--instagram:hover { background: linear-gradient(45deg, #F58529, #DD2A7B, #8134AF); border-color: #DD2A7B; }
.socialchip--tiktok:hover    { background: #010101; border-color: #010101; }
.socialchip--x:hover         { background: #000; border-color: #000; }
.socialchip--youtube:hover   { background: #FF0000; border-color: #FF0000; }
.socialchip--linkedin:hover  { background: #0A66C2; border-color: #0A66C2; }

.socialband__embed { display: grid; justify-items: center; }
.socialband__embed iframe { max-width: 100%; border: 0; }
.socialband__none { margin: 0; text-align: center; color: var(--ink-55, #79818b); }


/* ── The mark, once it is an uploaded image rather than the drawn crest ──── */
.crest--img { display: block; }
.crest--img img { display: block; width: 100%; height: 100%; object-fit: contain; }

/* The small print the school adds beside the copyright line. */
.foot__note { display: inline-block; margin-left: .5rem; opacity: .8; }

/* ── The live feeds ────────────────────────────────────────────────────────
   Tabs rather than three columns: each platform's embed has its own fixed
   proportions and forcing them into equal columns leaves two of the three
   either cropped or surrounded by dead space. */
.feedwrap { max-width: 620px; margin-inline: auto; }
.feedtabs {
    display: flex; gap: 6px; justify-content: center;
    margin-bottom: 16px; flex-wrap: wrap;
}
.feedtab {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: 9px 16px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--line, #e5e8ec); background: #fff;
    font: inherit; font-size: .88rem; font-weight: 600; color: var(--ink-70, #525c66);
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.feedtab:hover { border-color: var(--color-secondary); color: var(--color-secondary); }
.feedtab.is-on {
    background: var(--color-primary); border-color: var(--color-primary); color: #fff;
}
.feedtab:focus-visible { outline: 2px solid var(--color-secondary); outline-offset: 2px; }

.feedpanel { min-height: 320px; }
.feedframe {
    display: block; width: 100%; height: 620px;
    border: 1px solid var(--line, #e5e8ec); border-radius: var(--r-lg, 16px);
    background: #fff; overflow: hidden;
}
.feedembed { border-radius: var(--r-lg, 16px); overflow: hidden; }
.feedembed iframe, .feedembed img { max-width: 100%; }

/* The panel for a platform with no embeddable feed. */
.feednone {
    display: grid; justify-items: center; gap: 12px; text-align: center;
    padding: clamp(28px, 5vw, 52px) 20px;
    border: 1px dashed var(--line, #e5e8ec); border-radius: var(--r-lg, 16px);
    background: #fff;
}
.feednone p { margin: 0; max-width: 44ch; line-height: 1.65; color: var(--ink-70, #525c66); }

/* With the script absent every panel shows, one after another. */
.feedwrap:not(.is-tabbed) .feedtabs { display: none; }
.feedwrap:not(.is-tabbed) .feedpanel + .feedpanel { margin-top: 16px; }

@media (max-width: 560px) {
    .feedframe { height: 520px; }
}

/* ── The mark, larger ──────────────────────────────────────────────────────
   The masthead logo was 46px tall, which a wide landscape mark reduces to a
   thin band. These override base.css deliberately, and the header keeps enough
   room because the masthead sizes itself to its tallest child. */
.brand__logo { height: 64px; width: auto; max-width: 260px; object-fit: contain; }
.mast .crest { width: 52px; height: 58px; }

/* The footer mark.
   The drawn crest is upright, so it stays a tall box. An uploaded logo is
   almost always a wide landscape lockup — this one is 767x260 — and fitting
   that inside a square left it 78px wide by 26px tall, which is why it kept
   looking small however much the square grew. The image box is therefore sized
   by its own proportions: wide, with the height doing the limiting. */
.foot .crest { width: 74px; height: 84px; }
.foot .crest--img {
    width: auto; height: auto;
    max-width: 260px; max-height: 92px;
}
.foot .crest--img img {
    display: block;
    width: auto; height: auto;
    max-width: 260px; max-height: 92px;
    object-fit: contain;
}
.foot__brand .brand { align-items: center; gap: 14px; }

@media (max-width: 900px) {
    .brand__logo { height: 52px; max-width: 200px; }
    .mast .crest { width: 44px; height: 49px; }
    .foot .crest { width: 60px; height: 68px; }
    .foot .crest--img, .foot .crest--img img { max-width: 200px; max-height: 72px; }
}



/* ── Action pills ──────────────────────────────────────────────────────────
   The three doors out of the site: Staff Mail, Student Portal, Apply Now.

   One component, three colourways. The shape, the icon disc, the lift and the
   arrow are shared, so the row reads as a set rather than three buttons that
   happen to sit together; only the two colour properties differ. Built as its
   own component rather than as modifiers on .btn — the inner parts have no
   equivalent there, and faking them by overriding custom properties was what
   made the first version read as a disabled button.

   `--pill` is the fill, `--pill-ink` the text. Every other value derives from
   them, so adding a fourth is two lines. */
.actionpill {
    --pill:     var(--color-secondary);
    --pill-ink: #fff;

    position: relative;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 8px 6px 6px;
    border-radius: 999px;
    text-decoration: none;
    background: linear-gradient(135deg, var(--pill), color-mix(in srgb, var(--pill) 72%, #000));
    color: var(--pill-ink);
    font-weight: 600; font-size: .88rem; line-height: 1;
    box-shadow: 0 2px 10px color-mix(in srgb, var(--pill) 34%, transparent);
    transition: transform .22s ease, box-shadow .22s ease, filter .22s ease;
    isolation: isolate;
}
.actionpill:hover {
    transform: translateY(-2px);
    filter: saturate(1.06);
    box-shadow: 0 8px 22px color-mix(in srgb, var(--pill) 46%, transparent);
}
.actionpill:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }

/* The icon in its own disc: the part that reads at a glance when the masthead
   is busy, and what tells the three apart before the label is read. */
.actionpill__ico {
    display: grid; place-items: center;
    width: 28px; height: 28px; flex: none;
    border-radius: 50%;
    /* Tinted from the ink rather than a fixed white, so it holds up on the
       gold pill where the ink is dark. */
    background: color-mix(in srgb, var(--pill-ink) 22%, transparent);
    color: var(--pill-ink);
    transition: background .22s ease, transform .22s ease;
}
.actionpill:hover .actionpill__ico {
    background: color-mix(in srgb, var(--pill-ink) 32%, transparent);
    transform: rotate(-8deg);
}

.actionpill__label { white-space: nowrap; letter-spacing: .01em; }

/* The arrow says where the link goes. It takes no room until it is wanted, so
   three of these in a masthead keep their width. */
.actionpill__go {
    display: grid; place-items: center;
    width: 0; margin-right: 0; overflow: hidden; opacity: 0;
    transition: width .22s ease, opacity .18s ease, margin .22s ease;
}
.actionpill:hover .actionpill__go,
.actionpill:focus-visible .actionpill__go { width: 16px; margin-right: 4px; opacity: .9; }

/* ── The three colourways ── */
.actionpill--staff  { --pill: var(--color-secondary); --pill-ink: #fff; }
.actionpill--apply  { --pill: var(--color-primary);   --pill-ink: #fff; }
/* Gold carries white at about 1.6:1, which is unreadable. The ink is therefore
   a near-black drawn from the gold itself, which measures near 12:1. */
.actionpill--portal {
    --pill:     var(--color-portal, #FFC600);
    --pill-ink: color-mix(in srgb, var(--color-portal, #FFC600) 16%, #140f02);
}

/* ── Full width, for the drawer ── */
.actionpill--wide {
    display: flex; width: 100%;
    padding: 9px 14px 9px 9px;
    font-size: .95rem;
}
.actionpill--wide .actionpill__ico { width: 32px; height: 32px; }
.actionpill--wide .actionpill__label { flex: 1; }
.actionpill--wide .actionpill__go { width: 18px; opacity: .9; margin-right: 0; }
.actionpill--wide:hover { transform: none; }

/* Below the point the masthead gets tight, staff mail is the first to go — it
   is still in the drawer, and the portal and apply buttons matter more. */
@media (max-width: 1180px) { .mast__staff { display: none; } }
/* Tighter still: the labels go before the pills do, leaving three discs. */
@media (max-width: 1040px) {
    .mast__portal .actionpill__label,
    .mast__cta .actionpill__label { display: none; }
    .mast__portal, .mast__cta { padding: 6px; }
}

@media (prefers-reduced-motion: reduce) {
    .actionpill, .actionpill__ico, .actionpill__go { transition: none; }
    .actionpill:hover { transform: none; }
    .actionpill:hover .actionpill__ico { transform: none; }
}

/* ============================================================
   GALLERY
   ------------------------------------------------------------
   The one page whose content is photographs rather than words.
   Everything here is drawn from theme_tokens like the rest of
   the site, so the Appearance screen restyles the gallery along
   with everything else. There is not a literal brand colour in
   this block.
   ============================================================ */

/* -- Filters ------------------------------------------------ */
.gal-filter {
    display: flex; flex-wrap: wrap; gap: 10px;
    justify-content: center;
    margin: 0 0 40px;
}

.gal-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--ink-70);
    font-family: var(--font-text);
    font-size: 14px; font-weight: 600;
    line-height: 1;
    transition: color var(--t), background var(--t), border-color var(--t), transform var(--t);
}
.gal-chip:hover {
    color: var(--color-primary);
    border-color: color-mix(in srgb, var(--color-primary) 40%, transparent);
    transform: translateY(-1px);
}
.gal-chip.is-on {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-surface);
}
.gal-chip:focus-visible {
    outline: 2px solid var(--color-secondary);
    outline-offset: 2px;
}

/* The count sits in its own well, so it reads as a tally rather than as
   part of the album name. */
.gal-chip__n {
    padding: 2px 7px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-slate) 16%, transparent);
    font-size: 11.5px; font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.gal-chip.is-on .gal-chip__n {
    background: color-mix(in srgb, #fff 26%, transparent);
}

/* -- The grid ----------------------------------------------- */
/* Fixed row height with tiles spanning one or two of them: a real masonry
   rhythm without measuring every image after it loads, and without the
   reflow that makes a gallery jump while it is still arriving. */
.gal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    grid-auto-rows: 210px;
    gap: 14px;
}

.gal-tile {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-image);
    background: color-mix(in srgb, var(--color-slate) 12%, transparent);
    box-shadow: var(--shadow-1);
    cursor: zoom-in;
    padding: 0;
    width: 100%; height: 100%;
    transition: box-shadow var(--t), transform var(--t);
}
.gal-tile--tall { grid-row: span 2; }
.gal-tile--wide { grid-column: span 2; }

.gal-tile__img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 600ms var(--ease);
}

.gal-tile:hover { box-shadow: var(--shadow-3); }
.gal-tile:hover .gal-tile__img { transform: scale(1.06); }

.gal-tile:focus-visible {
    outline: 3px solid var(--color-secondary);
    outline-offset: 3px;
}

/* The caption veil, only as tall as its own text: it darkens the foot of
   the photograph rather than the photograph. */
.gal-tile__veil {
    position: absolute; inset: auto 0 0 0;
    display: flex; flex-direction: column; gap: 3px;
    padding: 30px 16px 14px;
    text-align: left;
    background: linear-gradient(
        to top,
        color-mix(in srgb, var(--color-text) 88%, transparent) 0%,
        color-mix(in srgb, var(--color-text) 55%, transparent) 45%,
        transparent 100%);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity var(--t), transform var(--t);
}
.gal-tile:hover .gal-tile__veil,
.gal-tile:focus-visible .gal-tile__veil { opacity: 1; transform: none; }

.gal-tile__title {
    font-family: var(--font-display);
    font-size: 15px; font-weight: 600; line-height: 1.3;
    color: #fff;
}
.gal-tile__album {
    font-family: var(--font-text);
    font-size: 11.5px; font-weight: 700;
    letter-spacing: .1em; text-transform: uppercase;
    color: var(--color-accent);
}

/* A small affordance in the corner, so a tile with no caption still says
   it can be opened. */
.gal-tile__zoom {
    position: absolute; top: 12px; right: 12px;
    display: grid; place-items: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--color-text) 55%, transparent);
    color: #fff;
    opacity: 0; transform: scale(.82);
    transition: opacity var(--t), transform var(--t);
}
.gal-tile:hover .gal-tile__zoom,
.gal-tile:focus-visible .gal-tile__zoom { opacity: 1; transform: none; }

.gal-none {
    margin-top: 34px;
    text-align: center;
    color: var(--ink-55);
    font-size: 15px;
}

/* -- Nothing uploaded yet ----------------------------------- */
.gal-empty {
    max-width: 520px; margin: 0 auto;
    padding: 64px 28px;
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: var(--radius-card);
    background: var(--color-surface);
}
.gal-empty__icon { color: var(--color-slate); margin: 0 auto 16px; }
.gal-empty .h3 { margin-bottom: 8px; }

/* -- Lightbox ----------------------------------------------- */
.gal-locked { overflow: hidden; }

.galbox {
    position: fixed; inset: 0; z-index: 9000;
    display: grid;
    grid-template-rows: 1fr auto;
    place-items: center;
    padding: 68px 24px 20px;
    background: color-mix(in srgb, var(--color-text) 94%, transparent);
    animation: galFade 220ms var(--ease) both;
}
.galbox[hidden] { display: none; }

@keyframes galFade { from { opacity: 0; } to { opacity: 1; } }

.galbox__stage {
    display: flex; flex-direction: column; align-items: center; gap: 16px;
    max-width: 100%; max-height: 100%;
    min-height: 0;
}

.galbox__img {
    max-width: min(1200px, 92vw);
    /* Leaves room for the caption and the counter beneath, so a tall
       photograph pushes neither off the screen. */
    max-height: calc(100vh - 190px);
    width: auto; height: auto;
    object-fit: contain;
    border-radius: var(--radius-image);
    box-shadow: 0 30px 80px -20px rgba(0,0,0,.65);
}

.galbox__cap {
    max-width: 62ch;
    text-align: center;
    color: color-mix(in srgb, #fff 82%, transparent);
    font-family: var(--font-text);
    font-size: 14.5px; line-height: 1.6;
}
.galbox__cap[hidden] { display: none; }

.galbox__count {
    color: color-mix(in srgb, #fff 58%, transparent);
    font-size: 12.5px; font-weight: 600;
    letter-spacing: .1em;
    font-variant-numeric: tabular-nums;
    padding-top: 14px;
}

.galbox__close,
.galbox__nav {
    position: absolute;
    display: grid; place-items: center;
    border-radius: 50%;
    background: color-mix(in srgb, #fff 12%, transparent);
    color: #fff;
    transition: background var(--t), transform var(--t);
}
.galbox__close:hover,
.galbox__nav:hover { background: color-mix(in srgb, #fff 24%, transparent); }
.galbox__close:focus-visible,
.galbox__nav:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }

.galbox__close { top: 18px; right: 20px; width: 46px; height: 46px; }

.galbox__nav { top: 50%; margin-top: -27px; width: 54px; height: 54px; }
.galbox__nav--prev { left: 20px; }
.galbox__nav--next { right: 20px; }
.galbox__nav:hover { transform: scale(1.06); }

/* -- Narrow screens ----------------------------------------- */
@media (max-width: 900px) {
    .gal-grid { grid-auto-rows: 168px; gap: 10px; }
    /* A double-width tile on a two-column grid is a full-width band, which
       breaks the rhythm rather than adding to it. */
    .gal-tile--wide { grid-column: span 1; }
}

@media (max-width: 560px) {
    .gal-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 138px; }
    .gal-filter { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; }
    .gal-chip { flex: none; }

    /* The arrows belong under the thumb on a phone, not beside the picture. */
    .galbox { padding: 60px 12px 16px; }
    .galbox__nav { top: auto; bottom: 18px; margin-top: 0; width: 48px; height: 48px; }
    .galbox__nav--prev { left: 24%; }
    .galbox__nav--next { right: 24%; }
    .galbox__img { max-height: calc(100vh - 230px); }
    .galbox__count { padding-bottom: 58px; }
}

/* The veil and the zoom disc are hover affordances, and a touch screen has
   no hover, so they are simply always on where hovering is not a thing. */
@media (hover: none) {
    .gal-tile__veil { opacity: 1; transform: none; }
    .gal-tile__zoom { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .gal-tile, .gal-tile__img, .gal-tile__veil, .gal-tile__zoom,
    .gal-chip, .galbox__nav, .galbox__close { transition: none; }
    .gal-tile:hover .gal-tile__img { transform: none; }
    .galbox { animation: none; }
}
