/*
=====================================================
MIGUEL FERRER — SITE STYLES
Shared by index.html (bento home) and case-study.html.

1. Tokens (light / dark)
2. Base
3. Nav
4. Bento grid + tiles
5. Case study: hero, toggle, article
6. Case study blocks
7. Footer
8. Motion + responsive
=====================================================
*/

/* 1. TOKENS ---------------------------------------- */
:root {
    --bg: #eeece7;
    --surface: #f9f8f5;
    --surface-2: #e5e2db;
    --ink: #15161a;
    --muted: #6a6c73;
    --line: rgba(21, 22, 26, .09);
    --accent: #3346d9;
    --on-accent: #fff;
    --glass: rgba(249, 248, 245, .72);
    --shadow: 0 1px 2px rgba(21, 22, 26, .04), 0 8px 24px rgba(21, 22, 26, .06);
    --card-shadow: 0 1px 2px rgba(21, 22, 26, .05), 0 4px 14px rgba(21, 22, 26, .04);
    --card-edge: rgba(21, 22, 26, .07);

    /* product screens and diagrams always sit on light */
    --paper: #ffffff;
    --paper-ink: #0d0f14;
    --paper-muted: #5b606b;
    --paper-line: rgba(13, 15, 20, .1);
    --paper-soft: #f4f5f8;
    --k-happy: #405ad6;
    --k-error: #c2412d;
    --k-edge: #a8660f;
    --k-ok: #1f7a4d;

    --font-display: 'Space Grotesk', system-ui, sans-serif;
    --font-body: 'DM Sans', system-ui, sans-serif;

    --radius-tile: 28px;
    --radius-md: 16px;
    --radius-card: 20px;
    --gap: 16px;
    --page: 1240px;
    --gutter: 24px;
    --read: 700px;
    --ease: cubic-bezier(.2, .7, .2, 1);

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f1012;
        --surface: #18191c;
        --surface-2: #232428;
        --ink: #f1efea;
        --muted: #9c9da4;
        --line: rgba(255, 255, 255, .08);
        --accent: #8d9cff;
        --on-accent: #0f1012;
        --glass: rgba(24, 25, 28, .72);
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
        --card-shadow: 0 1px 2px rgba(0, 0, 0, .35);
        --card-edge: rgba(255, 255, 255, .07);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0f1012;
    --surface: #18191c;
    --surface-2: #232428;
    --ink: #f1efea;
    --muted: #9c9da4;
    --line: rgba(255, 255, 255, .08);
    --accent: #8d9cff;
    --on-accent: #0f1012;
    --glass: rgba(24, 25, 28, .72);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --card-shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --card-edge: rgba(255, 255, 255, .07);
    color-scheme: dark;
}

/* 2. BASE ------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color .3s var(--ease), color .3s var(--ease);
}

img, video, svg { display: block; max-width: 100%; }

a { color: inherit; }

button { font: inherit; color: inherit; }

h1, h2, h3, h4 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

p { margin: 0; }

::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); color: var(--ink); }
html { scrollbar-color: color-mix(in srgb, var(--ink) 28%, transparent) transparent; accent-color: var(--accent); caret-color: var(--accent); }
h1, h2, h3 { text-wrap: balance; }
.prose p, .block__lede, .case__summary { text-wrap: pretty; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* text links get a soft corner; everything else keeps its own radius */
a:not([class]):focus-visible { border-radius: 4px; }
.tile:focus-visible { outline-width: 3px; outline-offset: 4px; }

.skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    z-index: 100;
    padding: .6rem 1rem;
    border-radius: 999px;
    background: var(--ink);
    color: var(--bg);
    text-decoration: none;
}

.skip-link:focus { top: 16px; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* 3. NAV ------------------------------------------- */
.nav {
    position: fixed;
    inset: 16px var(--gutter) auto;
    z-index: 50;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    max-width: var(--page);
    margin: 0 auto;
    pointer-events: none;
}

.nav > * { pointer-events: auto; }

.nav__logo {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    justify-self: start;
    /* the same glass container as the pill groups beside it */
    align-self: stretch; /* same height as the pill group beside it */
    padding: 0 1rem 0 7px;
    border-radius: 999px;
    background: var(--glass);
    box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    font-family: var(--font-display);
    font-size: .95rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color .2s var(--ease);
}

.nav__logo:hover { background: var(--surface); }

.nav__logo img { width: 26px; height: 26px; }

:root[data-theme="dark"] .nav__logo img { filter: invert(1); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .nav__logo img { filter: invert(1); }
}

.pill-group {
    display: inline-flex;
    gap: 2px;
    padding: 4px;
    border-radius: 999px;
    background: var(--glass);
    box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .95rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font-size: .875rem;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s var(--ease), color .2s var(--ease);
}

.pill:hover { background: var(--line); }

.pill[aria-current="true"],
.pill[aria-selected="true"] {
    background: var(--ink);
    color: var(--bg);
}

.pill svg { width: 16px; height: 16px; }

.nav__end { justify-self: end; }

.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

/* 4. BENTO ----------------------------------------- */
.bento {
    --cols: 4;
    --cell: calc((min(100vw, var(--page)) - 2 * var(--gutter) - (var(--cols) - 1) * var(--gap)) / var(--cols));
    display: grid;
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    grid-auto-rows: var(--cell);
    grid-auto-flow: dense;
    gap: var(--gap);
    max-width: var(--page);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.bento--header { padding-top: 96px; grid-auto-rows: auto; }

.bento--header .tile--intro {
    grid-column: 1 / -1;
    grid-row: auto;
    padding: 2rem 2.25rem;
}

.bento--header .tile--intro img { width: 152px; }
.bento--header .tile--intro > div { flex: 1; min-width: 0; }
.bento--header .intro__hi { font-size: 1.6rem; }
.bento--header .intro__text { font-size: 1.05rem; line-height: 1.6; }

html { scroll-padding-top: 72px; scroll-behavior: smooth; }

.section { margin-top: 72px; }

.section__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .35rem 1rem;
    max-width: var(--page);
    margin: 0 auto;
    padding: 0 calc(var(--gutter) + 4px) 20px;
}

.section__head h2 { font-size: clamp(1.6rem, 3vw, 2.25rem); letter-spacing: -0.03em; }
.section__head p { color: var(--muted); }

.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    border-radius: var(--radius-tile);
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line);
    text-decoration: none;
    transition: opacity .35s var(--ease), transform .35s var(--ease), filter .35s var(--ease);
}

.tile--wide { grid-column: span 2; }
.tile--tall { grid-row: span 2; }
.tile--large { grid-column: span 2; grid-row: span 2; }

/* intro */
.tile--intro {
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
    padding: 1.75rem;
}

.tile--intro img {
    flex: none;
    width: clamp(88px, 32%, 168px);
    height: auto;
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
}

.intro__hi {
    margin-bottom: .35rem;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.intro__text {
    color: var(--muted);
    font-size: .975rem;
    line-height: 1.5;
}

.intro__text strong { color: var(--ink); font-weight: 600; }

.intro__text a {
    color: var(--ink);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    transition: text-decoration-color .2s var(--ease);
}

.intro__text a:hover { text-decoration-color: var(--accent); }

.intro__stat { margin-top: .6rem; }
.intro__stat strong { color: var(--accent); font-family: var(--font-display); }

.intro__actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }

.btn--sm { padding: .5rem .9rem; font-size: .85rem; }
.btn--sm svg { width: 15px; height: 15px; }
.btn.is-copied { background: var(--k-ok); color: #fff; }

/* project */
.tile--project {
    background: var(--tint, var(--surface-2));
    box-shadow: none;
    color: #fff;
}

.tile--project[data-tone="light"] { color: var(--paper-ink); }

.tile--project img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .6s var(--ease);
}

.tile--project:hover img { transform: scale(1.035); }

/* a hairline edge so light images never melt into the page */
.tile--project::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px var(--card-edge);
    pointer-events: none;
}

.tile--project:active { transform: scale(.992); }

.tile__label {
    position: absolute;
    z-index: 2;
    left: 14px;
    bottom: 14px;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.tile__name {
    display: inline-flex;
    flex-direction: column;
    gap: .1rem;
    padding: .6rem 1rem .65rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, .86);
    box-shadow: 0 1px 2px rgba(13, 15, 20, .08), 0 8px 24px rgba(13, 15, 20, .12);
    color: var(--paper-ink);
    backdrop-filter: blur(14px) saturate(1.5);
    -webkit-backdrop-filter: blur(14px) saturate(1.5);
    line-height: 1.25;
}

.tile__name strong { font-family: var(--font-display); font-size: 1rem; font-weight: 600; }
.tile__name span { font-size: .8rem; color: var(--paper-muted); }

.tile__arrow {
    flex: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .78);
    color: var(--paper-ink);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    transform: translate(-6px, 6px) scale(.9);
    transition: opacity .3s var(--ease), transform .3s var(--ease);
}

.tile__arrow svg { width: 18px; height: 18px; }

/* dark thumbnails get dark glass, so the label reads as part of the image, not a grey patch */
.tile--project[data-tone="dark"] .tile__name,
.tile--project[data-tone="dark"] .tile__arrow,
.tile--project[data-tone="dark"] .tile__lock {
    background: rgba(13, 15, 20, .52);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), 0 8px 24px rgba(0, 0, 0, .22);
}

.tile--project[data-tone="dark"] .tile__name span { color: rgba(255, 255, 255, .74); }

/* no hover on touch: keep the way in visible */
@media (hover: none) {
    .tile__arrow { opacity: 1; transform: none; }
}

.tile--project:hover .tile__arrow,
.tile--project:focus-visible .tile__arrow { opacity: 1; transform: none; }

/* feature: one full-width showcase tile with a reel behind it */
.tile--feature {
    grid-column: 1 / -1;
    grid-row: span 2;
    justify-content: flex-end;
    padding: clamp(1.25rem, 3.5vw, 2.75rem);
    isolation: isolate;
}

.tile--project video {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .8s var(--ease);
}

.tile--feature > img { z-index: -2; }
.tile--feature:hover video,
.tile--feature:hover > img { transform: scale(1.025); }

/* password-protected projects say so before the click */
.tile__lock {
    position: absolute;
    z-index: 2;
    top: 14px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem .75rem .4rem .6rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .82);
    color: var(--paper-ink);
    font-size: .78rem;
    font-weight: 600;
    backdrop-filter: blur(14px) saturate(1.5);
    -webkit-backdrop-filter: blur(14px) saturate(1.5);
}

.tile__lock svg { width: 14px; height: 14px; }
.tile--feature .tile__lock { top: clamp(1.25rem, 3.5vw, 2.75rem); right: clamp(1.25rem, 3.5vw, 2.75rem); }

/* a scrim from the bottom-left so the copy holds over any frame of the reel */
.tile--feature::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(to top, rgba(8, 9, 12, .88) 0%, rgba(8, 9, 12, .5) 42%, rgba(8, 9, 12, 0) 72%),
        linear-gradient(to right, rgba(8, 9, 12, .45), rgba(8, 9, 12, 0) 60%);
}

.feature__copy { display: grid; gap: .6rem; max-width: 34rem; color: #fff; }

.feature__title {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 7vw, 5.25rem);
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: .95;
}

.feature__tagline { font-size: clamp(1rem, 1.6vw, 1.2rem); color: rgba(255, 255, 255, .82); }

.feature__brands { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.feature__brands span {
    padding: .3rem .7rem;
    border-radius: 999px;
    font-size: .8rem;
    color: rgba(255, 255, 255, .9);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .32);
}

.feature__cta {
    position: absolute;
    right: clamp(1.25rem, 3.5vw, 2.75rem);
    bottom: clamp(1.25rem, 3.5vw, 2.75rem);
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .7rem 1.1rem;
    border-radius: 999px;
    background: #fff;
    color: var(--paper-ink);
    font-size: .9rem;
    font-weight: 600;
    transition: transform .3s var(--ease);
}

.feature__cta svg { width: 16px; height: 16px; transition: transform .3s var(--ease); }
.tile--feature:hover .feature__cta svg,
.tile--feature:focus-visible .feature__cta svg { transform: translate(2px, -2px); }

/* 5. CASE STUDY ------------------------------------ */
/* password gate */
.gate {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(24px, 5vw, 64px);
    max-width: 1240px;
    min-height: calc(100vh - 220px);
    margin: 0 auto;
    padding: 24px 0 48px;
}

.gate__art { margin: 0; overflow: hidden; border-radius: 28px; background: var(--tint, var(--surface-2)); aspect-ratio: 16 / 9; box-shadow: inset 0 0 0 1px var(--line); }
.gate__art img { width: 100%; height: 100%; object-fit: cover; }

.gate__icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 1.25rem;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line);
    color: var(--accent);
}

.gate__icon svg { width: 22px; height: 22px; }
.gate__title { font-size: clamp(2rem, 4.5vw, 3rem); letter-spacing: -0.035em; }
.gate__lede { margin-top: .9rem; max-width: 46ch; color: var(--muted); font-size: 1.05rem; line-height: 1.6; }

.gate__form { margin-top: 1.75rem; }
.gate__form label { display: block; margin-bottom: .45rem; font-size: .9rem; font-weight: 600; }
.gate__row { display: flex; flex-wrap: wrap; gap: .6rem; }

.gate__row input {
    flex: 1 1 220px;
    min-height: 48px;
    padding: .7rem 1rem;
    border: 0;
    border-radius: 14px;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line);
    color: var(--ink);
    font: inherit;
    transition: box-shadow .2s var(--ease);
}

.gate__row input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.gate__row input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--k-error); }
.gate__row .btn { min-height: 48px; }
.gate__row .btn:disabled { opacity: .6; cursor: progress; }

.gate__error { min-height: 1.5em; margin-top: .55rem; font-size: .9rem; color: var(--k-error); }
:root[data-theme="dark"] .gate__error { color: #ff8a76; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .gate__error { color: #ff8a76; } }

.gate__ask { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.gate__ask p { margin-bottom: .7rem; font-size: .9rem; color: var(--muted); }
.gate__ask-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.case {
    padding: 88px var(--gutter) 0;
}

.case__hero {
    position: relative;
    max-width: 1080px;
    margin: 0 auto;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 32px;
    background: var(--tint, var(--surface-2));
}

.case__hero img,
.case__hero video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.view-toggle {
    position: sticky;
    top: 68px;
    z-index: 40;
    display: flex;
    justify-content: center;
    margin: 20px 0 0;
    pointer-events: none;
}

.view-toggle .pill-group { pointer-events: auto; }

.case__article {
    max-width: var(--read);
    margin: 0 auto;
    padding: 48px 0 0;
}

.case__title {
    font-size: clamp(2rem, 4.2vw, 3rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

/* project name and tags, under the title rather than as an eyebrow over it */
.case__project {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    margin-top: 1rem;
    font-size: .85rem;
    color: var(--muted);
}

.case__project strong { margin-right: .35rem; font-weight: 600; color: var(--ink); }
.case__project span { padding: .2rem .6rem; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); }

.case__summary {
    margin-top: 1.25rem;
    font-size: 1.15rem;
    line-height: 1.6;
    color: var(--muted);
    text-wrap: pretty;
}

.case__meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem 1.5rem;
    margin: 2rem 0 0;
    padding: 1.25rem 0;
    border-block: 1px solid var(--line);
}

.case__meta dt {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}

.case__meta dd { margin: .25rem 0 0; font-size: .95rem; line-height: 1.45; }

.case__links { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .7rem 1.15rem;
    border: 0;
    border-radius: 999px;
    background: var(--ink);
    color: var(--bg);
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform .2s var(--ease), opacity .2s var(--ease);
}

.btn:hover { transform: translateY(-1px); }
.btn svg { width: 16px; height: 16px; }

.btn--ghost {
    background: transparent;
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--line);
}

.btn--ghost:hover { background: var(--line); }

.case__section { margin-top: 3.5rem; }

.case__h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.prose p + p { margin-top: 1rem; }
.prose p, .prose li { font-size: 1.05rem; line-height: 1.7; }

.prose ul {
    display: grid;
    gap: .6rem;
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
}

.prose li { position: relative; padding-left: 1.4rem; }

.prose li::before {
    content: "";
    position: absolute;
    left: .2rem;
    top: .72em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.impact {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.75rem 2rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.impact li { padding-top: 1rem; border-top: 1px solid var(--line); }
.impact li::before {
    content: "";
    display: block;
    width: 24px;
    height: 2px;
    margin: -1.05rem 0 1rem;
    background: var(--accent);
}

.impact h3 { font-size: 1.1rem; line-height: 1.3; margin-bottom: .35rem; text-wrap: balance; }
.impact p { color: var(--muted); line-height: 1.6; }

/* Detailed-only content hides in TL;DR */
.case[data-view="tldr"] [data-detail] { display: none; }
.case:not([data-view="tldr"]) [data-tldr-only] { display: none; }

.tldr-more {
    display: flex;
    justify-content: center;
    margin-top: 3rem;
}

/* 6. BLOCKS ---------------------------------------- */
.block { margin-top: 3.5rem; }

.block--wide {
    width: min(1080px, 100vw - 2 * var(--gutter));
    margin-left: 50%;
    transform: translateX(-50%);
}

.block__lede {
    max-width: var(--read);
    margin-top: .75rem;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.65;
}

.block__head { max-width: var(--read); margin: 0 auto 1.5rem; }
.block--wide .block__head { margin-left: max(0px, (100% - var(--read)) / 2); }

/* figure */
.figure { margin: 0; }

.figure__media {
    overflow: hidden;
    border-radius: 24px;
    background: var(--surface-2);
}

.figure__media img,
.figure__media video { width: 100%; height: auto; }

.figure figcaption,
.caption {
    margin-top: .75rem;
    text-align: center;
    font-size: .875rem;
    color: var(--muted);
}

/* framed screenshots: a coloured mat, the screen floating on it */
.figure__media--framed {
    padding: clamp(16px, 4vw, 48px);
    background: var(--frame);
    display: grid;
    place-items: center;
}

.figure__media--framed img,
.figure__media--framed video {
    width: auto;
    max-width: 100%;
    max-height: 760px;
    border-radius: 14px;
    box-shadow: 0 2px 6px rgba(13, 15, 20, .12), 0 24px 60px rgba(13, 15, 20, .22);
}

/* split: text beside a screen */
.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: clamp(24px, 4vw, 56px);
    align-items: center;
}

.split--reverse .split__text { order: 2; }
.split .block__head { margin: 0 0 1rem; }

/* journeys: linear flows in the same language as the flow diagrams —
   dark start pill, outlined steps, blue arrows, filled outcome, always on paper */
.journeys {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.journey {
    padding: 1.4rem 1.5rem 1.3rem;
    border-radius: 24px;
    background: var(--paper-soft);
    color: var(--paper-ink);
}

.journey__title {
    display: flex;
    align-items: baseline;
    gap: .6rem;
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.journey__title span {
    font-size: .8rem;
    color: var(--k-happy);
}

.journey__track { overflow-x: auto; padding: 2px 2px 4px; }

.journey__steps {
    display: flex;
    align-items: stretch;
    gap: 34px;
    min-width: min-content;
    margin: 0;
    padding: 0;
    list-style: none;
}

.jstep {
    position: relative;
    flex: 1 0 128px;
    max-width: 200px;
    display: flex;
    align-items: center;
    padding: .8rem .9rem;
    border-radius: 12px;
    background: var(--paper);
    box-shadow: inset 0 0 0 1.6px var(--k-happy);
    font-size: .86rem;
    font-weight: 500;
    line-height: 1.4;
}

.jstep:first-child {
    border-radius: 24px;
    padding-inline: 1.1rem;
    background: var(--paper-ink);
    color: #fff;
    box-shadow: none;
    font-weight: 600;
}

/* the arrow into the next step */
.jstep + .jstep::before {
    content: "";
    position: absolute;
    left: -28px;
    top: 50%;
    width: 22px;
    height: 2px;
    background: var(--k-happy);
}

.jstep + .jstep::after {
    content: "";
    position: absolute;
    left: -11px;
    top: calc(50% - 4px);
    border: 5px solid transparent;
    border-left: 6px solid var(--k-happy);
    border-right: 0;
}

.jstep--end {
    background: var(--k-happy);
    color: #fff;
    box-shadow: none;
    font-weight: 600;
}

.journey__notes {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: .9rem 0 0;
    padding: 0;
    list-style: none;
}

.journey__notes li {
    padding: .4rem .75rem;
    border: 1.4px dashed var(--k-edge);
    border-radius: 999px;
    background: #fbf4e8;
    font-size: .8rem;
    color: var(--paper-ink);
}

.journey__notes li::before { content: "Note · "; font-weight: 600; color: var(--k-edge); }

/* options: alternatives and their trade-offs */
.options {
    display: grid;
    grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr));
    gap: var(--gap);
    margin: 0;
    padding: 0;
    list-style: none;
}

.option {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding: 1.5rem;
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--card-edge), var(--card-shadow);
    line-height: 1.55;
}

/* the options build on each other, so the number carries meaning */
.option__label {
    align-self: flex-start;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 11%, transparent);
}

.option h3 { font-size: 1.1rem; }
.option p { color: var(--muted); font-size: .95rem; }
.option strong { display: block; margin-bottom: .15rem; color: var(--ink); font-size: .85rem; }
.option__pro, .option__con { padding-top: .75rem; border-top: 1px solid var(--line); }
.option__pro { margin-top: auto !important; }

/* gallery */
.gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--gap);
}

.gallery--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gallery--3 .figure__media--framed { padding: clamp(12px, 2vw, 22px); }

.gallery .figure__media:not(.figure__media--framed) { aspect-ratio: 16 / 10; }
.gallery .figure__media:not(.figure__media--framed) img,
.gallery .figure__media:not(.figure__media--framed) video { height: 100%; object-fit: cover; }

/* stats */
.stats {
    display: grid;
    grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr));
    margin: 0;
    padding: 0;
    list-style: none;
    overflow: hidden;
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--card-edge), var(--card-shadow);
}

.stats li { padding: 1.4rem 1.5rem 1.5rem; }
.stats li + li { box-shadow: inset 1px 0 0 var(--line); }

.stats strong {
    display: block;
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
}

.stats span { display: block; max-width: 22ch; margin-top: .6rem; font-size: .9rem; line-height: 1.45; color: var(--muted); }

/* quote */
.pullquote {
    margin: 0;
    padding: 2rem 0 2rem 1.5rem;
    border-left: 3px solid var(--accent);
}

.pullquote p { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.35; letter-spacing: -0.01em; }
.pullquote cite { display: block; margin-top: .75rem; font-style: normal; font-size: .9rem; color: var(--muted); }

/* points + steps */
.points {
    display: grid;
    grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr));
    gap: var(--gap);
    margin: 0;
    padding: 0;
    list-style: none;
}

.points li {
    padding: 1.5rem 1.55rem 1.6rem;
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--card-edge), var(--card-shadow);
    color: var(--muted);
    font-size: .95rem;
    line-height: 1.6;
}

/* a short accent rule opens each card, the same mark the Impact list uses */
.points:not(.steps):not(.points--logos) li::before {
    content: "";
    display: block;
    width: 22px;
    height: 2px;
    margin-bottom: 1.1rem;
    border-radius: 2px;
    background: var(--accent);
}

.points strong {
    display: block;
    margin-bottom: .45rem;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 1.08rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
    text-wrap: balance;
}

/* logos are masks filled with the text colour, so they turn black or white with the theme */
.points__logo {
    display: block;
    width: 30px;
    height: 30px;
    margin-bottom: 1.1rem;
    background: var(--ink);
    -webkit-mask: var(--logo) left center / contain no-repeat;
    mask: var(--logo) left center / contain no-repeat;
}

/* client logo wall */
.logos {
    display: grid;
    grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr));
    gap: var(--gap);
    margin: 0;
    padding: 0;
    list-style: none;
}

.logos li {
    display: grid;
    grid-template-rows: 1fr auto;
    justify-items: center;
    gap: 1rem;
    min-height: 168px;
    padding: 1.75rem 1.25rem 1.25rem;
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--card-edge), var(--card-shadow);
}

.logos__mark {
    align-self: center;
    /* `scale` evens out optical size: compact marks need more room than long wordmarks */
    width: min(100%, calc(var(--ratio) * 44px * var(--scale, 1)));
    aspect-ratio: var(--ratio);
    max-height: calc(64px * var(--scale, 1));
    background: var(--ink);
    -webkit-mask: var(--logo) center / contain no-repeat;
    mask: var(--logo) center / contain no-repeat;
}

.logos__note { font-size: .85rem; color: var(--muted); text-align: center; }

.steps { counter-reset: step; }
.steps li { counter-increment: step; }
.steps li::before {
    content: counter(step, decimal-leading-zero);
    display: block;
    margin-bottom: .6rem;
    font-family: var(--font-display);
    font-size: .85rem;
    font-weight: 600;
    color: var(--accent);
}

/* compare */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }

.compare__col {
    padding: 1.6rem 1.7rem;
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--card-edge), var(--card-shadow);
}

.compare__col--after { background: var(--ink); color: var(--bg); box-shadow: var(--card-shadow); }

.compare__col h3 {
    margin-bottom: 1rem;
    font-family: var(--font-body);
    font-size: .72rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    opacity: .65;
}

.compare__col ul { display: grid; gap: .8rem; margin: 0; padding: 0; list-style: none; line-height: 1.5; }
.compare__col li { position: relative; padding-left: 1.4rem; }
.compare__col li::before { content: "–"; position: absolute; left: 0; opacity: .5; }
.compare__col--after li::before { content: "→"; opacity: .7; }

/* flow diagram (always on paper) */
.diagram {
    overflow-x: auto;
    padding: 24px;
    border-radius: 24px;
    background: var(--paper-soft);
    color: var(--paper-ink);
}

.diagram svg { width: 100%; min-width: 760px; height: auto; font-family: var(--font-body); }

.legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem 1.25rem;
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
    font-size: .85rem;
    color: var(--muted);
}

.legend li { display: inline-flex; align-items: center; gap: .5rem; }
.legend i { width: 22px; border-top: 2px solid currentColor; }
.legend i.is-dashed { border-top-style: dashed; }
.legend i.is-box { width: 18px; height: 13px; border: 1.5px solid currentColor; border-radius: 4px; }
.legend i.is-filled { background: currentColor; }

/* decision table */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-card);
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--card-edge), var(--card-shadow);
}

.table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: .95rem; line-height: 1.5; }

.table th, .table td { padding: 1rem 1.1rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }

.table thead th {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}

.table tbody tr:last-child > * { border-bottom: 0; }
.table tbody th { font-weight: 600; width: 32%; }
.table td { color: var(--muted); }

.tag {
    display: inline-block;
    margin-bottom: .35rem;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--tag, var(--k-happy));
    background: color-mix(in srgb, var(--tag, var(--k-happy)) 12%, transparent);
}

.k-happy { --tag: var(--k-happy); }
.k-error { --tag: var(--k-error); }
.k-edge { --tag: var(--k-edge); }
.k-recovery { --tag: var(--k-ok); }

/* states — product screens rebuilt with the product's own sign-in
   component (logo over a white card with a status bar), always on paper */
.states {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px var(--gap);
    margin: 0;
    padding: 0;
    list-style: none;
}

.state > .tag { margin-bottom: .6rem; }

.screen {
    --brand-ink: #333a41;
    --brand-muted: #5f6770;
    --brand-primary: #26486b;
    --brand-link: #3b7dc4;
    --brand-bar: #61a85f;
    --brand-icon: var(--brand-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    min-height: 360px;
    padding: 18px 14px 16px;
    border-radius: 20px;
    background: #f9fafb;
    color: var(--brand-ink);
    font-family: 'Nunito Sans', var(--font-body);
    box-shadow: 0 0 0 1px var(--paper-line), 0 10px 30px rgba(13, 15, 20, .06);
}

.k-error .screen { --brand-bar: #c9302c; --brand-icon: #c9302c; }
.k-edge .screen { --brand-bar: #d9962b; --brand-icon: #a8660f; }

.screen__logo { width: auto; height: 34px; }
.screen__brand { font-size: .8rem; font-weight: 700; color: var(--brand-primary); }

.screen__card {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .55rem;
    width: 100%;
    padding: 1.35rem 1.15rem 1.1rem;
    overflow: hidden;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 1px 4px rgba(13, 15, 20, .12);
}

/* state reads from the tag above, the icon colour and, for problems, a tinted outline */
.k-error .screen__card,
.k-edge .screen__card {
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand-bar) 45%, transparent), 0 1px 4px rgba(13, 15, 20, .12);
}

.screen__icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: var(--brand-icon);
    background: color-mix(in srgb, var(--brand-icon) 10%, transparent);
}

.screen__icon svg { width: 19px; height: 19px; }

.screen__spinner {
    width: 32px;
    height: 32px;
    border: 3px solid color-mix(in srgb, var(--brand-primary) 18%, transparent);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.screen h4 {
    font-family: inherit;
    font-size: 1.12rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0;
    color: var(--brand-ink);
}

.screen p { font-size: .85rem; line-height: 1.5; color: var(--brand-muted); }

/* outlined field with the label sitting in the border, as in Caster */
.screen__field {
    position: relative;
    margin-top: .6rem;
    padding: .7rem .75rem;
    border: 1px solid #c4c8cd;
    border-radius: 4px;
    font-size: .88rem;
    color: var(--brand-ink);
}

.screen__label {
    position: absolute;
    top: 0;
    left: .55rem;
    padding: 0 .25rem;
    transform: translateY(-50%);
    background: #fff;
    font-size: .7rem;
    line-height: 1;
    color: var(--brand-muted);
}

.screen__actions {
    display: flex;
    flex-direction: column;
    gap: .55rem;
    margin-top: auto;
    padding-top: .5rem;
}

.screen__btn {
    padding: .6rem .8rem;
    border-radius: 4px;
    background: var(--brand-primary);
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
    text-align: center;
}

.screen__link { font-size: .82rem; color: var(--brand-link); text-align: center; }
.screen p.screen__foot { margin-top: .15rem; font-size: .8rem; color: var(--brand-ink); text-align: center; }

.state__note { margin: .9rem .2rem 0; font-size: .9rem; line-height: 1.5; color: var(--muted); }
.state__note strong { display: block; margin-bottom: .15rem; color: var(--ink); }

/* live prototype: a poster until asked, then the real build scaled to fit */
.proto {
    --proto-scale: .75;
    overflow: hidden;
    border-radius: 24px;
    background: #0d2f49;
    box-shadow: 0 2px 6px rgba(13, 15, 20, .08), 0 24px 60px rgba(13, 15, 20, .18);
}

.proto__frame {
    position: relative;
    aspect-ratio: var(--proto-w) / var(--proto-h);
    overflow: hidden;
}

.proto__poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.proto__start {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: .75rem;
    padding: 1rem;
    background: rgba(13, 47, 73, .55);
    backdrop-filter: blur(2px);
    color: #fff;
    text-align: center;
    transition: opacity .3s var(--ease);
}

.proto__start .btn { background: #fff; color: var(--paper-ink); }
.proto__start p { font-size: .85rem; color: rgba(255, 255, 255, .85); }
.proto__start .btn svg { width: 16px; height: 16px; }
.proto__open { display: none; }

/* too small to use embedded: send phones to the full-screen build instead */
@media (max-width: 640px) {
    .proto__start [data-proto-load] { display: none; }
    .proto__open { display: inline-flex; }
    .proto__bar a { display: none; }
}

.proto__iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: calc(var(--proto-w) * 1px);
    height: calc(var(--proto-h) * 1px);
    border: 0;
    background: #fff;
    transform: scale(var(--proto-scale));
    transform-origin: 0 0;
    opacity: 0;
    transition: opacity .4s var(--ease);
}

.proto.is-loading .proto__start { opacity: .6; pointer-events: none; }
.proto.is-live .proto__iframe { opacity: 1; }
.proto.is-live .proto__start,
.proto.is-live .proto__poster { opacity: 0; pointer-events: none; }

.proto__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1rem;
    padding: .8rem 1.1rem;
    font-size: .85rem;
    color: rgba(255, 255, 255, .78);
}

.proto__bar a { display: inline-flex; align-items: center; gap: .35rem; color: #fff; font-weight: 600; text-decoration: none; }
.proto__bar a:hover { text-decoration: underline; text-underline-offset: 3px; }
.proto__bar svg { width: 15px; height: 15px; }

/* zoom: every still image opens in the lightbox */
.zoom {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: inherit;
    background: none;
    cursor: zoom-in;
}

.figure__media > .zoom { height: 100%; }
.figure__media--framed > .zoom { width: auto; height: auto; max-width: 100%; border-radius: 14px; }
.case__hero > .zoom { position: absolute; inset: 0; }

.zoom img { transition: transform .5s var(--ease), filter .3s var(--ease); }
.zoom:hover img { filter: brightness(1.03); }

/* the ring sits on top of the image, so overflow: hidden can't clip it */
.zoom:focus-visible { outline: none; }
.zoom:focus-visible::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
    box-shadow: inset 0 0 0 3px var(--accent), inset 0 0 0 5px #fff;
}

.lightbox {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(10, 11, 14, .94);
    color: #fff;
}

.lightbox[open] {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    animation: fade-in .2s var(--ease);
}

.lightbox::backdrop { background: transparent; }
html:has(.lightbox[open]) { overflow: hidden; }

.lightbox__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px var(--gutter);
}

.lightbox__count { font-size: .875rem; color: rgba(255, 255, 255, .7); font-variant-numeric: tabular-nums; }

.lightbox__figure {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    place-items: center;
    gap: 14px;
    min-height: 0;
    margin: 0;
    padding: 0 clamp(16px, 8vw, 104px) 28px;
}

.lightbox__figure img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
}

.lightbox figcaption {
    max-width: 70ch;
    text-align: center;
    font-size: .9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, .78);
}

.lightbox__btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    cursor: pointer;
    transition: background-color .15s var(--ease);
}

.lightbox__btn:hover { background: rgba(255, 255, 255, .24); }
.lightbox__btn svg { width: 22px; height: 22px; }
.lightbox :focus-visible { outline-color: #fff; }

.lightbox__nav { position: fixed; top: 50%; transform: translateY(-50%); }
.lightbox__nav--prev { left: max(12px, 2vw); }
.lightbox__nav--next { right: max(12px, 2vw); }
.lightbox.is-single .lightbox__nav { display: none; }
.lightbox.is-single .lightbox__count { visibility: hidden; }

@keyframes fade-in { from { opacity: 0; } }

/* next project + contact */
.case__end {
    max-width: 1080px;
    margin: 6rem auto 0;
}

.case__end .tile { min-height: 340px; }
.case__end .tile--wide { aspect-ratio: 16 / 9; min-height: 0; }
.case__end .tile--feature { aspect-ratio: 2 / 1; min-height: 0; }
.feature__next { font-size: .85rem; font-weight: 600; letter-spacing: .02em; color: rgba(255, 255, 255, .74); }


.not-found {
    max-width: var(--read);
    margin: 0 auto;
    padding: 20vh 0;
    text-align: center;
}

.not-found h1 { font-size: 2rem; margin-bottom: 1rem; }
.not-found p { color: var(--muted); margin-bottom: 1.5rem; }

/* 7. FOOTER ---------------------------------------- */
.footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    max-width: var(--page);
    margin: 0 auto;
    padding: 48px var(--gutter) 40px;
    font-size: .875rem;
    color: var(--muted);
}

.footer a { text-decoration: none; }
.footer a:hover { color: var(--ink); }
.footer nav { display: flex; gap: 1.25rem; }

/* 8. MOTION + RESPONSIVE --------------------------- */
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes rise {
    from { opacity: 0; transform: translateY(14px) scale(.985); }
    to { opacity: 1; transform: none; }
}

.reveal { animation: rise .7s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 45ms); }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-delay: 0s !important;
        transition-duration: .001ms !important;
    }
}

@media (max-width: 980px) {
    .points, .options, .logos { grid-template-columns: repeat(var(--n-md, 2), minmax(0, 1fr)); }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats li + li { box-shadow: none; }
    .stats li:nth-child(even) { box-shadow: inset 1px 0 0 var(--line); }
    .stats li:nth-child(n + 3) { border-top: 1px solid var(--line); }
    .bento { --cols: 2; }
    .tile--intro { grid-column: span 2; }
    .states { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split { grid-template-columns: minmax(0, 1fr); }
    .split--reverse .split__text { order: 0; }
    .gate { grid-template-columns: minmax(0, 1fr); min-height: 0; }
}

@media (max-width: 640px) {
    :root { --gutter: 16px; --gap: 12px; --radius-tile: 22px; }

    .nav { grid-template-columns: auto 1fr auto; gap: .5rem; }
    .nav__name { display: none; }
    .nav .pill { padding: .45rem .6rem; font-size: .8rem; white-space: nowrap; }
    /* About is the top of the page; three section links fit a phone without wrapping */
    .nav .pill[href="#about"] { display: none; }
    .nav__logo { padding: 0 7px; }
    .nav__logo img { flex: none; width: 24px; height: 24px; }

    .bento--header { padding-top: 80px; }
    .bento--header .tile--intro { padding: 1.4rem; }
    .bento--header .tile--intro img { width: 72px; }
    .bento--header .intro__hi { font-size: 1.3rem; }
    .bento--header .intro__text { font-size: .95rem; }
    .section { margin-top: 56px; }
    .tile--intro {
        grid-row: span 2;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: .75rem;
        padding: 1.25rem;
    }
    .tile--intro img { width: 64px; }
    .intro__hi { font-size: 1.1rem; margin-bottom: .25rem; }
    .intro__text { font-size: .9rem; }
    .tile--wide { grid-column: span 2; }
    .tile--large { grid-column: span 2; grid-row: span 2; }
    .tile--feature { grid-row: span 3; }
    /* a still image takes the top of the tile; the copy sits below it, not on it */
    .tile--feature > img { height: 58%; }
    .feature__cta { position: static; align-self: flex-start; margin-top: 1rem; }
    .tile--feature { gap: 0; }
    .case__end .tile--feature { aspect-ratio: auto; min-height: 520px; }
    .impact { grid-template-columns: 1fr; }
    .tile__name strong { font-size: .92rem; }
    .tile__name span { display: none; }
    .tile__label { left: 10px; bottom: 10px; right: 10px; }
    .tile__arrow { display: none; }

    .case { padding-top: 76px; }
    .case__hero { border-radius: 22px; aspect-ratio: 4 / 3; }
    .case__article { padding-top: 36px; }
    .journey__steps { flex-direction: column; gap: 26px; min-width: 0; }
    .jstep { flex: none; max-width: none; }
    .jstep + .jstep::before { left: 50%; top: -21px; width: 2px; height: 16px; }
    .jstep + .jstep::after { left: calc(50% - 4px); top: -9px; border: 5px solid transparent; border-top: 6px solid var(--k-happy); border-bottom: 0; }
    .lightbox__figure { padding-bottom: 84px; }
    .lightbox__nav { top: auto; bottom: 20px; transform: none; }
    .lightbox__nav--prev { left: calc(50% - 56px); }
    .lightbox__nav--next { right: calc(50% - 56px); }
    .split--reverse .split__text { order: 0; }
    .gallery, .gallery--3, .compare, .states, .split, .points, .options { grid-template-columns: 1fr; }
    .logos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .logos li { min-height: 132px; padding: 1.25rem 1rem 1rem; }
    .logos li:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
