/*
 * Public site styles.
 * The admin panel has its own stylesheet: resources/css/app.css.
 *
 * Everything brand-related lives in the @theme block below — change a token
 * here and the whole site follows (docs/DESIGN_SYSTEM.md §2). Components
 * never hard-code colours, fonts or radii.
 */
@import 'tailwindcss' source(none);

@source '../views/site.blade.php';
@source '../js/site.tsx';
@source '../js/site';
@source '../js/pages/site';

/* `motion:` — styles that apply only while scroll effects are switched on. */
@custom-variant motion (&:is(.motion-ok *));

/* ------------------------------------------------------------------ */
/* Tokens                                                              */
/* ------------------------------------------------------------------ */

@theme {
    /*
     * Brand colours (logo: public/assets/brand/): navy #1b1869, blue
     * #0782c6, light #fafafa. Navy is the dark stage, #fafafa the light
     * one, blue the accent. Steps in between keep text at ≥ 4.5:1.
     */

    /* Colour — dark stage: brand navy, then raised surfaces */
    --color-ink: #1b1869;
    --color-ink-2: #262370;
    --color-ink-3: #312f78;
    --color-ink-4: #3f3c80;

    /* Colour — light stage: brand light, then dividers */
    --color-bone: #fafafa;
    --color-bone-2: #f2f2f5;
    --color-bone-3: #e6e6ed;
    --color-paper: #ffffff;

    /* Colour — secondary text (contrast ≥ 4.5:1 on its stage) */
    --color-mute: #585a7a; /* on bone */
    --color-haze: #b3b4d4; /* on ink */

    /* Colour — brand blue. As text it is only 4:1, so text uses its tones. */
    --color-brand: #0782c6; /* glows, gradients, fills */
    --color-brand-soft: #5fb6ea; /* accent text and light on dark backgrounds */
    --color-brand-deep: #05659c; /* accent text on light backgrounds */

    /* Colour — cool counterweight inside the aurora glow */
    --color-deep: #0b4a7c;

    /* Colour — form errors (on light backgrounds) */
    --color-danger: #a4301c;

    /* Colour — WhatsApp's own green (chat buttons only), and its hover tone */
    --color-whatsapp: #25d366;
    --color-whatsapp-soft: #55dd88;

    /* Typography */
    /*
     * --font-bricolage-grotesque / --font-onest come from the fonts plugin
     * (vite.config.ts): the web font, then its metric-matched stand-in
     * ("… Fallback", defined further down), then generic fallbacks.
     * Headlines are light (see .font-display below); emphasis inside them
     * is set by weight and colour, not italics (display-em).
     */
    --font-display:
        var(
            --font-bricolage-grotesque,
            'Bricolage Grotesque',
            'Bricolage Grotesque Fallback'
        ),
        ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-sans:
        var(--font-onest, 'Onest', 'Onest Fallback'), ui-sans-serif, system-ui,
        -apple-system, 'Segoe UI', sans-serif;

    --text-display-1: clamp(2.5rem, 1.45rem + 5.2vw, 6.75rem);
    --text-display-1--line-height: 1;
    --text-display-1--letter-spacing: -0.04em;

    --text-display-2: clamp(2.15rem, 1.4rem + 3.6vw, 5rem);
    --text-display-2--line-height: 1.02;
    --text-display-2--letter-spacing: -0.035em;

    --text-display-3: clamp(1.875rem, 1.42rem + 2.1vw, 3.375rem);
    --text-display-3--line-height: 1.06;
    --text-display-3--letter-spacing: -0.03em;

    --text-display-4: clamp(1.5rem, 1.3rem + 0.95vw, 2.125rem);
    --text-display-4--line-height: 1.14;
    --text-display-4--letter-spacing: -0.022em;

    --text-lead: clamp(1.125rem, 1.03rem + 0.48vw, 1.5rem);
    --text-lead--line-height: 1.5;

    --text-eyebrow: 0.75rem;
    --text-eyebrow--line-height: 1.2;
    --text-eyebrow--letter-spacing: 0.2em;

    /* Shape */
    --radius-sm: 0.625rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2.25rem;

    /* Motion */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out-soft: cubic-bezier(0.65, 0, 0.35, 1);

    --animate-rise: rise 1.1s var(--ease-out-expo) both;
    --animate-fade: fade 1.2s ease-out both;
    --animate-drift-a: drift-a 26s var(--ease-in-out-soft) infinite alternate;
    --animate-drift-b: drift-b 32s var(--ease-in-out-soft) infinite alternate;
    --animate-drift-c: drift-c 38s var(--ease-in-out-soft) infinite alternate;
    --animate-pulse-ring: pulse-ring 2.6s ease-out infinite;
    --animate-scroll-cue: scroll-cue 2.2s var(--ease-in-out-soft) infinite;

    @keyframes rise {
        from {
            opacity: 0;
            transform: translate3d(0, 1.75rem, 0);
        }
        to {
            opacity: 1;
            transform: none;
        }
    }

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

    @keyframes marquee {
        to {
            transform: translate3d(-50%, 0, 0);
        }
    }

    @keyframes drift-a {
        from {
            transform: translate3d(-6%, -4%, 0) scale(1);
        }
        to {
            transform: translate3d(8%, 6%, 0) scale(1.18);
        }
    }

    @keyframes drift-b {
        from {
            transform: translate3d(6%, 4%, 0) scale(1.12);
        }
        to {
            transform: translate3d(-10%, -6%, 0) scale(0.94);
        }
    }

    @keyframes drift-c {
        from {
            transform: translate3d(0, 8%, 0) scale(0.96);
        }
        to {
            transform: translate3d(-6%, -8%, 0) scale(1.14);
        }
    }

    @keyframes pulse-ring {
        0% {
            opacity: 0.7;
            transform: scale(0.6);
        }
        100% {
            opacity: 0;
            transform: scale(2.4);
        }
    }

    @keyframes scroll-cue {
        0% {
            transform: translate3d(0, -100%, 0);
        }
        60%,
        100% {
            transform: translate3d(0, 100%, 0);
        }
    }
}

/*
 * Contextual colours. Their values come from the "stage" a section sits on
 * and from the category accent, so the same component works on dark and
 * light backgrounds: text-fg, text-soft, border-line, bg-stage-2, text-accent…
 */
@theme inline {
    /*
     * Animations whose duration is set per element (style="--…-duration").
     * They must be inlined: a theme variable defined on :root would resolve
     * the duration there, once, and ignore the element's own value.
     */
    --animate-marquee: marquee var(--marquee-duration, 48s) linear infinite;

    --color-stage: var(--stage);
    --color-stage-2: var(--stage-2);
    --color-stage-3: var(--stage-3);
    --color-fg: var(--fg);
    --color-soft: var(--fg-soft);
    --color-line: var(--line);
    --color-line-strong: var(--line-strong);
    --color-accent: var(--accent);
    --color-accent-2: var(--accent-2);
    --color-accent-fg: var(--accent-fg);
}

/* ------------------------------------------------------------------ */
/* Category accents — set with data-accent on any ancestor             */
/*   --accent      luminous tone (glows, dark backgrounds)             */
/*   --accent-2    deeper tone (gradients)                             */
/*   --accent-ink  readable as text on light backgrounds               */
/* The default is the brand blue; data-accent="brand" restores it      */
/* inside a section that sits under a category's accent.               */
/* ------------------------------------------------------------------ */

:root,
[data-accent='brand'] {
    --accent: var(--color-brand-soft);
    --accent-2: var(--color-brand);
    --accent-ink: var(--color-brand-deep);
}

[data-accent='champagne'] {
    --accent: #d8b98a;
    --accent-2: #b3875a;
    --accent-ink: #7d5f33;
}

[data-accent='rose'] {
    --accent: #e3a79d;
    --accent-2: #b96f6a;
    --accent-ink: #8f4a47;
}

[data-accent='sage'] {
    --accent: #aec6ab;
    --accent-2: #6f9272;
    --accent-ink: #47664b;
}

[data-accent='sky'] {
    --accent: #9fc2da;
    --accent-2: #5b8aa9;
    --accent-ink: #36617e;
}

[data-accent='citrus'] {
    --accent: #e8c46f;
    --accent-2: #bc8a2c;
    --accent-ink: #7e5a12;
}

[data-accent='slate'] {
    --accent: #a1aecb;
    --accent-2: #62739b;
    --accent-ink: #44527a;
}

[data-accent='emerald'] {
    --accent: #85c9ae;
    --accent-2: #3f8f72;
    --accent-ink: #256650;
}

[data-accent='mauve'] {
    --accent: #c8abd4;
    --accent-2: #8c68a0;
    --accent-ink: #694a7b;
}

[data-accent='pearl'] {
    --accent: #a9d8d3;
    --accent-2: #5a9d98;
    --accent-ink: #2f6c69;
}

[data-accent='blush'] {
    --accent: #ecbac4;
    --accent-2: #c27a8b;
    --accent-ink: #934a5d;
}

/* Hair (K37): warmer and redder than champagne and citrus. */
[data-accent='copper'] {
    --accent: #e2a072;
    --accent-2: #b46a3c;
    --accent-ink: #844624;
}

/* ------------------------------------------------------------------ */
/* Stages — a section declares which background it sits on             */
/* ------------------------------------------------------------------ */

:root,
.stage-dark {
    --stage: var(--color-ink);
    --stage-2: var(--color-ink-2);
    --stage-3: var(--color-ink-3);
    --fg: var(--color-bone);
    --fg-soft: var(--color-haze);
    --line: color-mix(in srgb, var(--color-bone) 12%, transparent);
    --line-strong: color-mix(in srgb, var(--color-bone) 26%, transparent);
    --on-light: 0;
    color-scheme: dark;
}

.stage-light {
    --stage: var(--color-bone);
    --stage-2: var(--color-paper);
    --stage-3: var(--color-bone-2);
    --fg: var(--color-ink);
    --fg-soft: var(--color-mute);
    --line: color-mix(in srgb, var(--color-ink) 12%, transparent);
    --line-strong: color-mix(in srgb, var(--color-ink) 28%, transparent);
    --on-light: 1;
    color-scheme: light;
}

/*
 * The accent as text: the luminous tone on dark stages, the readable "ink"
 * tone on light ones. It is declared on every element that sets a stage or
 * an accent — not only on the stage — so that a card with its own
 * [data-accent] is coloured by its own accent, whatever stage it sits on.
 */
:root,
.stage-dark,
.stage-light,
[data-accent] {
    --accent-fg: color-mix(
        in srgb,
        var(--accent-ink) calc(var(--on-light) * 100%),
        var(--accent)
    );
}

/* In the components layer so a utility (bg-transparent, bg-stage-2…) can override it. */
@layer components {
    .stage-dark,
    .stage-light {
        background-color: var(--stage);
        color: var(--fg);
    }
}

/* ------------------------------------------------------------------ */
/* Fallback fonts                                                      */
/* ------------------------------------------------------------------ */

/*
 * Stand-ins shown until the web fonts arrive (and if they never do): local
 * fonts scaled to the web fonts' own metrics, so text keeps its width and
 * line height when the real font swaps in — nothing jumps (CLS).
 *
 * If a font is replaced, measure again (docs/PERFORMANCE.md §2). The
 * families are wired in through `fallbacks` in vite.config.ts.
 *
 * Measured in the browser: widths of Turkish and English sample text set in
 * the web font against local Arial (regular against the light headline
 * weight, bold against the bold weights). Ascent and descent come from the
 * font files and are divided by the size adjustment, as the spec scales them
 * by it. A synthesised bold would be wider than Arial Bold, so the bold
 * weights get their own face.
 */
@font-face {
    font-family: 'Bricolage Grotesque Fallback';
    font-weight: 100 450;
    src:
        local('Arial'), local('ArialMT'), local('Roboto'), local('Arimo'),
        local('Liberation Sans');
    size-adjust: 103.57%;
    ascent-override: 89.79%;
    descent-override: 26.07%;
    line-gap-override: 0%;
}

@font-face {
    font-family: 'Bricolage Grotesque Fallback';
    font-weight: 451 900;
    src:
        local('Arial Bold'), local('Arial-BoldMT'), local('Roboto Bold'),
        local('Arimo Bold'), local('Liberation Sans Bold');
    size-adjust: 99.56%;
    ascent-override: 93.41%;
    descent-override: 27.12%;
    line-gap-override: 0%;
}

@font-face {
    font-family: 'Onest Fallback';
    font-weight: 100 450;
    src:
        local('Arial'), local('ArialMT'), local('Roboto'), local('Arimo'),
        local('Liberation Sans');
    size-adjust: 104.44%;
    ascent-override: 92.88%;
    descent-override: 29.2%;
    line-gap-override: 0%;
}

@font-face {
    font-family: 'Onest Fallback';
    font-weight: 451 900;
    src:
        local('Arial Bold'), local('Arial-BoldMT'), local('Roboto Bold'),
        local('Arimo Bold'), local('Liberation Sans Bold');
    size-adjust: 99.06%;
    ascent-override: 97.92%;
    descent-override: 30.79%;
    line-gap-override: 0%;
}

/* ------------------------------------------------------------------ */
/* Base                                                                */
/* ------------------------------------------------------------------ */

@layer base {
    :root {
        --gutter: clamp(1.25rem, 4vw, 3.5rem);
        --header-h: 4.5rem;
        /* The info strip above the navigation (large screens only). */
        --topbar-h: 0rem;
        /* Distance from the viewport edge to the content column of .shell. */
        --edge: max(var(--gutter), calc(50vw - 42.5rem + var(--gutter)));
    }

    html {
        background-color: var(--color-ink);
        -webkit-text-size-adjust: 100%;
        text-rendering: optimizeLegibility;
        scroll-padding-top: calc(var(--header-h) + 1rem);
    }

    body {
        background-color: var(--color-ink);
        color: var(--color-bone);
        font-size: 1rem;
        line-height: 1.65;
        overflow-x: clip;
    }

    ::selection {
        background-color: var(--color-brand-soft);
        color: var(--color-ink);
    }

    /* The accent as text: readable on whichever stage the element sits. */
    :focus-visible {
        outline: 2px solid var(--accent-fg);
        outline-offset: 3px;
        border-radius: 4px;
    }

    h1,
    h2,
    h3,
    h4 {
        text-wrap: balance;
    }

    /* Headlines are set light; small display text a little heavier. */
    .font-display {
        font-weight: 320;
        font-optical-sizing: auto;
    }

    p {
        text-wrap: pretty;
    }

    a,
    button {
        -webkit-tap-highlight-color: transparent;
    }

    button {
        cursor: pointer;
    }

    /* Targets focused programmatically (skip link) show no ring. */
    [tabindex='-1']:focus {
        outline: none;
    }
}

/* ------------------------------------------------------------------ */
/* Layout helpers                                                      */
/* ------------------------------------------------------------------ */

@utility shell {
    width: 100%;
    max-width: 85rem;
    margin-inline: auto;
    padding-inline: var(--gutter);
}

@utility shell-narrow {
    width: 100%;
    max-width: 56rem;
    margin-inline: auto;
    padding-inline: var(--gutter);
}

@utility section-y {
    padding-block: clamp(5rem, 11vw, 11rem);
}

@utility section-y-sm {
    padding-block: clamp(3.5rem, 7vw, 6.5rem);
}

/* Emphasis inside display headings (<em>…</em>): heavier and in the accent. */
@utility display-em {
    & em {
        font-style: normal;
        font-weight: 560;
        color: var(--accent-fg);
    }
}

/* Hairline grid texture behind hero sections. */
@utility grid-lines {
    background-image:
        linear-gradient(to right, var(--line) 1px, transparent 1px),
        linear-gradient(to bottom, var(--line) 1px, transparent 1px);
    background-size: 5rem 5rem;
    mask-image: radial-gradient(
        ellipse 80% 70% at 50% 40%,
        #000 20%,
        transparent 75%
    );
}

/* Film grain — a tiny inline SVG, no network request. */
@utility grain {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 160px 160px;
    mix-blend-mode: overlay;
    opacity: 0.22;
    pointer-events: none;
}

/* Underline that grows from the start edge on hover / focus. */
@utility link-underline {
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0% 1px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size 0.5s var(--ease-out-expo);

    &:hover,
    &:focus-visible {
        background-size: 100% 1px;
    }
}

/* ------------------------------------------------------------------ */
/* Motion — see docs/ANIMATIONS.md                                     */
/* Content is visible by default; effects only apply under .motion-ok  */
/* (added before first paint when JS runs and motion is not reduced).  */
/* ------------------------------------------------------------------ */

/* <Reveal>: appears once when it enters the viewport. */
.motion-ok [data-reveal] {
    opacity: 0;
    transform: translate3d(var(--reveal-x, 0), var(--reveal-y, 1.75rem), 0)
        scale(var(--reveal-scale, 1));
    transition:
        opacity 0.9s var(--ease-out-expo) var(--reveal-delay, 0ms),
        transform 1.2s var(--ease-out-expo) var(--reveal-delay, 0ms);
    will-change: opacity, transform;
}

.motion-ok [data-reveal][data-revealed] {
    opacity: 1;
    transform: none;
    will-change: auto;
}

/* <ScrollScene>: the scroll engine writes --p (0 → 1) on the scene. */
[data-scene] {
    --p: 0;
}

/* Pinned scene: a tall wrapper with a sticky viewport inside. */
.motion-ok [data-scene='pin'] {
    height: calc(var(--scene-length, 3) * 100svh);
}

.motion-ok [data-scene='pin'] > [data-scene-viewport] {
    position: sticky;
    top: 0;
    height: 100svh;
    overflow: clip;
    container-type: inline-size;
}

/* data-pin-from="lg": on small screens the scene is plain, static content. */
@media (max-width: 63.99rem) {
    .motion-ok [data-scene='pin'][data-pin-from='lg'] {
        height: auto;
    }

    .motion-ok [data-scene='pin'][data-pin-from='lg'] > [data-scene-viewport] {
        position: static;
        height: auto;
        overflow: visible;
    }

    .motion-ok [data-pin-from='lg'] [data-scrub] {
        opacity: 1;
        transform: none;
    }
}

/* <Scrub>: maps scene progress onto [--from, --to], eases it, then tweens. */
.motion-ok [data-scrub] {
    --t: clamp(
        0,
        calc((var(--p) - var(--from, 0)) / (var(--to, 1) - var(--from, 0))),
        1
    );
    --e: calc(1 - pow(1 - var(--t), 3));
    opacity: calc(var(--o0, 1) + (var(--o1, 1) - var(--o0, 1)) * var(--e));
    transform: translate3d(
            calc(var(--x0, 0px) + (var(--x1, 0px) - var(--x0, 0px)) * var(--e)),
            calc(var(--y0, 0px) + (var(--y1, 0px) - var(--y0, 0px)) * var(--e)),
            0
        )
        scale(calc(var(--s0, 1) + (var(--s1, 1) - var(--s0, 1)) * var(--e)));
    will-change: opacity, transform;
}

/*
 * <TextReveal>: words light up one after another as --p advances.
 * Words that are still waiting stay at 48 %: dim enough to read as "not yet",
 * but above the 3:1 contrast that large text needs on both stages — people
 * who read ahead of their scrolling can still read.
 */
.motion-ok [data-text-reveal] > span {
    opacity: clamp(0.48, calc(var(--p) * (var(--words) + 3) - var(--i)), 1);
}

/* <Parallax>: drifts against the scroll while crossing the viewport. */
.motion-ok [data-parallax] {
    transform: translate3d(0, calc((var(--p) - 0.5) * var(--shift, -80px)), 0);
    will-change: transform;
}

/* <HorizontalScroll>: a native swipe row that turns into a scroll-driven track. */
[data-hscroll-track] {
    display: flex;
    gap: var(--hscroll-gap, 1.5rem);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-inline: var(--edge);
    scroll-padding-inline: var(--edge);
    scrollbar-width: none;
}

[data-hscroll-track]::-webkit-scrollbar {
    display: none;
}

[data-hscroll-track] > * {
    scroll-snap-align: start;
    flex: none;
}

@media (min-width: 64rem) {
    .motion-ok [data-scene='pin'] [data-hscroll-track] {
        overflow: visible;
        scroll-snap-type: none;
        width: max-content;
        /* Never moves when the cards already fit (min with 0). */
        transform: translate3d(calc(var(--p) * min(0px, 100cqw - 100%)), 0, 0);
        will-change: transform;
    }
}

/* <DrawPath>: an SVG stroke (pathLength="1") draws itself with the scene. */
.motion-ok [data-draw] {
    stroke-dasharray: 1;
    stroke-dashoffset: calc(
        1 -
            clamp(
                0,
                calc(
                    (var(--p) - var(--from, 0)) /
                        (var(--to, 1) - var(--from, 0))
                ),
                1
            )
    );
}

/* Hero entrance: pure CSS so it never waits for JavaScript (LCP). */
.motion-ok .hero-rise {
    animation: var(--animate-rise);
    animation-delay: var(--delay, 0ms);
}

.motion-ok .hero-fade {
    animation: var(--animate-fade);
    animation-delay: var(--delay, 0ms);
}

/* Ambient loops stop when off screen (data-paused) and without motion. */
[data-ambient][data-paused] * {
    animation-play-state: paused !important;
}

html:not(.motion-ok) [data-ambient] * {
    animation: none !important;
}

/* Cross-fade between pages (View Transitions API). */
@media (prefers-reduced-motion: no-preference) {
    ::view-transition-old(root) {
        animation: 0.2s ease-out both fade reverse;
    }

    ::view-transition-new(root) {
        animation: 0.3s ease-out both fade;
    }
}

/* ------------------------------------------------------------------ */
/* Components that need more than utilities                            */
/* ------------------------------------------------------------------ */

/* FAQ items are native <details>; where supported their height animates. */
:root {
    interpolate-size: allow-keywords;
}

.faq-item::details-content {
    block-size: 0;
    overflow: clip;
    transition:
        block-size 0.5s var(--ease-out-expo),
        content-visibility 0.5s allow-discrete;
}

.faq-item[open]::details-content {
    block-size: auto;
}

/* Treatments mega menu: slides in when its `hidden` attribute is removed. */
.mega-panel {
    transition:
        opacity 0.25s ease-out,
        transform 0.45s var(--ease-out-expo);

    @starting-style {
        opacity: 0;
        transform: translate3d(0, -0.75rem, 0);
    }
}

/* Mobile menu (<dialog>): fades in; the page behind does not scroll. */
.menu-dialog[open] {
    opacity: 1;
    transition: opacity 0.3s ease-out;

    @starting-style {
        opacity: 0;
    }
}

.menu-dialog::backdrop {
    background-color: var(--color-ink);
}

html:has(dialog[open]) {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .faq-item::details-content,
    .mega-panel,
    .menu-dialog[open] {
        transition: none;
    }
}

/* Long-form legal text rendered from Markdown. */
.prose-legal {
    color: var(--fg);
    line-height: 1.8;

    & h2 {
        font-family: var(--font-display);
        font-size: var(--text-display-4);
        line-height: 1.15;
        margin-top: 3rem;
        margin-bottom: 1rem;
    }

    & h3 {
        font-weight: 600;
        font-size: 1.125rem;
        margin-top: 2rem;
        margin-bottom: 0.5rem;
    }

    & p,
    & ul,
    & ol {
        margin-bottom: 1.1rem;
        color: var(--fg-soft);
    }

    & ul {
        list-style: disc;
        padding-inline-start: 1.25rem;
    }

    & ol {
        list-style: decimal;
        padding-inline-start: 1.25rem;
    }

    & li {
        margin-bottom: 0.4rem;
    }

    & a {
        color: var(--accent-fg);
        text-decoration: underline;
        text-underline-offset: 3px;
    }

    & strong {
        color: var(--fg);
        font-weight: 600;
    }

    & blockquote {
        border-inline-start: 2px solid var(--accent-fg);
        padding-inline-start: 1.25rem;
        margin-block: 1.5rem;
        color: var(--fg);
    }
}

/* Blog articles: the same Markdown styles, set a little larger and darker. */
.prose-article {
    font-size: 1.0625rem;

    & > :first-child {
        margin-top: 0;
    }

    & h2,
    & h3 {
        scroll-margin-top: calc(var(--header-h) + 1.5rem);
    }

    & p,
    & ul,
    & ol {
        color: color-mix(in srgb, var(--fg) 80%, var(--stage));
    }
}

/* Language menu (<details>): the list eases in when it opens. */
@keyframes menu-pop {
    from {
        opacity: 0;
        transform: translate3d(0, -0.5rem, 0) scale(0.98);
    }
}

details[open] > .lang-menu {
    animation: menu-pop 0.35s var(--ease-out-expo);
}

@media (prefers-reduced-motion: reduce) {
    details[open] > .lang-menu {
        animation: none;
    }
}

/* ------------------------------------------------------------------ */
/* Home page scenes — see docs/ANIMATIONS.md                           */
/* ------------------------------------------------------------------ */

/*
 * Hero: the WebGL field fades in over the aurora once its first frame is
 * drawn; from then on the aurora underneath has nothing left to show.
 */
.hero-field {
    opacity: 0;
    transition: opacity 1.8s ease-out;
}

.hero-field[data-live] {
    opacity: 1;
}

.hero-backdrop:has(> .hero-field[data-live]) > [data-ambient] {
    visibility: hidden;
    transition: visibility 0s 1.9s;
}

/*
 * Where the text sits, the backdrop (photos, aurora, contour lines) fades
 * into the plain navy stage (K45). On a phone the text spans the whole
 * width: the lines keep some strength above it only. From lg on the text
 * takes the left side and the backdrop opens up towards the right.
 */
.hero-backdrop {
    mask-image: linear-gradient(
        to bottom,
        rgb(0 0 0 / 0.85) 0%,
        rgb(0 0 0 / 0.5) 22%,
        rgb(0 0 0 / 0.3) 45%,
        rgb(0 0 0 / 0.3) 100%
    );
}

@media (width >= 64rem) {
    .hero-backdrop {
        mask-image: linear-gradient(
            to right,
            rgb(0 0 0 / 0.4) 0%,
            rgb(0 0 0 / 0.5) 40%,
            rgb(0 0 0 / 0.9) 75%
        );
    }
}

/* Kinetic band: two lines of oversized type, sliding against each other. */
.kinetic-row {
    display: flex;
    align-items: baseline;
    gap: 0.32em;
    width: max-content;
    font-size: clamp(3.25rem, 10.5vw, 9.5rem);
    line-height: 1.14;
    white-space: nowrap;
}

.kinetic-outline {
    color: transparent;
    -webkit-text-stroke: 1px var(--line-strong);
}

.motion-ok .kinetic-row {
    transform: translate3d(calc(-4vw - var(--p) * 42vw), 0, 0);
    will-change: transform;
}

.motion-ok .kinetic-row-back {
    transform: translate3d(calc(-46vw + var(--p) * 42vw), 0, 0);
}

/*
 * Areas showcase (home page): one panel per area of expertise, all alike
 * in size and parts, each with a drawing of its own (area-scenes.tsx).
 *
 * The clocks. Every panel (li) carries
 *   --enter  0 → 1 while it rises into place
 *   --beat   0 → 1 while it is held and its scene plays
 *   --cover  0 → 1 while the next panel slides over it
 *   --drawn  0 → 1 the base lines of its scene, drawn while it rises
 * and every part that belongs to one beat (class st, --k its index)
 *   --u      0 → 1 across that beat
 *   --on     0 → 1 as the beat starts, and stays
 *   --now    1 only while it is the current beat.
 * Here, in the static form (no JavaScript, reduced motion, very low
 * windows), they all read "finished": a column of panels as tall as their
 * content, every scene complete.
 */
.areas-deck {
    display: grid;
    gap: 1.25rem;
}

.areas-deck > li {
    --enter: 1;
    --beat: 1;
    --cover: 0;
    --drawn: 1;
}

.areas-deck .st {
    --u: 1;
    --on: 1;
    --now: 1;
}

.area-glow {
    position: absolute;
    top: -35%;
    inset-inline-end: -18%;
    z-index: -2;
    width: min(46rem, 90%);
    aspect-ratio: 1;
    background: radial-gradient(closest-side, var(--accent-2), transparent 72%);
    opacity: 0.5;
}

/* The area's name once more, oversized and in outline, behind the text. */
.area-ghost {
    position: absolute;
    bottom: -0.16em;
    inset-inline-start: -0.04em;
    z-index: -1;
    color: transparent;
    font-size: clamp(4.5rem, 14vw, 12.5rem);
    line-height: 1;
    white-space: nowrap;
    -webkit-text-stroke: 1px var(--line);
    pointer-events: none;
    user-select: none;
}

/* The drawing: on phones on top, as tall as the text leaves room for. */
.area-stage {
    display: flex;
    flex: 1 1 11rem;
    min-height: 11rem;
    padding: 1rem 1.25rem 0;
}

@media (min-width: 64rem) {
    .area-stage {
        min-height: 24rem;
        padding: 2.25rem 2.75rem;
    }
}

/* The treatment in turn stands out; the others wait. */
/* The beats waiting their turn stay readable: 55 % is 5.2:1 on the ink ground (45 % was 3.95:1). */
.area-beat {
    opacity: calc(0.55 + var(--now) * 0.45);
}

.area-beat:hover,
.area-beat:focus-within {
    opacity: 1;
}

.area-beat-mark {
    flex: none;
    width: 1.75rem;
    height: 1px;
    background-color: var(--accent-fg);
    transform: scaleX(calc(0.3 + var(--now) * 0.7));
    transform-origin: 0 50%;
}

[dir='rtl'] .area-beat-mark {
    transform-origin: 100% 50%;
}

/* One description at a time needs the clocks: without motion the list says it all. */
.area-captions {
    display: none;
}

/*
 * The drawings. Their parts are styled inline, from the clocks; these are
 * the shared strokes and fills.
 */
.scene {
    display: block;
    flex: 1 1 0;
    width: 100%;
    min-width: 0;
    min-height: 0;
    overflow: visible;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/*
 * Base line art, the area's colour as line and as fill, text colour, panel
 * colour. The drawings of the inner pages (.art, further down) use them too.
 */
:is(.scene, .art) .ln {
    stroke: color-mix(in srgb, var(--fg) 55%, transparent);
    stroke-width: 1.4;
}

:is(.scene, .art) .ac {
    stroke: var(--accent);
    stroke-width: 1.6;
}

:is(.scene, .art) .af {
    fill: var(--accent);
}

/* …and on light backgrounds, where the luminous tone would be too pale. */
.art .acf {
    stroke: var(--accent-fg);
    stroke-width: 1.6;
}

.art .aff {
    fill: var(--accent-fg);
}

:is(.scene, .art) .fg {
    fill: var(--fg);
}

.scene text {
    font-family: var(--font-sans);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.08em;
}

:is(.scene, .art) .pane {
    fill: var(--stage);
}

/* Scales and turns about the part's own centre. */
:is(.scene, .art) .box {
    transform-box: fill-box;
    transform-origin: 50% 50%;
}

/* A line (pathLength 1) that draws itself as the panel rises. */
.scene .draw {
    stroke-dasharray: 1;
    stroke-dashoffset: calc(1 - var(--drawn));
}

/* An area without a drawing of its own: its mark inside contour rings. */
.area-lens {
    position: relative;
    height: 100%;
    max-height: 22rem;
    aspect-ratio: 1;
    margin: auto;
    overflow: clip;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background-color: color-mix(in srgb, var(--stage-2) 70%, transparent);
}

.area-rings {
    position: absolute;
    inset: 0;
    transform: rotate(calc((1 - var(--enter)) * -80deg + var(--beat) * 90deg))
        scale(calc(0.7 + var(--enter) * 0.3));
}

.area-icon {
    position: absolute;
    inset: 26%;
    width: 48%;
    height: 48%;
    color: var(--fg);
}

.area-icon :is(path, rect, circle) {
    stroke-dasharray: 1;
    stroke-dashoffset: calc(1 - var(--drawn));
}

/*
 * Motion form: the panels stack. Each one sticks below the header, is
 * held there for --dwell panel heights of scrolling (its scene plays) and
 * then the next slides over it. One scroll scene drives them all: its
 * progress (0 → 1 over the deck's whole height, measured at the line the
 * panels stick to) is handed to each panel as its own clock
 *   --q  0 when the panel has just stuck, 1 when the next one has
 *        (progress × n − index, kept within -1…1; written by
 *        areas-showcase.tsx only on the panels whose clock moved);
 *        the hold takes the share --d of that, the covering the rest.
 * The deck is exactly n steps tall — that is what makes the arithmetic
 * true. The sticking line (10svh) is also STICK in areas-showcase.tsx.
 */
@media (min-height: 38rem) {
    .motion-ok .areas-deck {
        --deck-h: clamp(30rem, 70svh, 40rem);
        --dwell: 1;
        display: flow-root;
    }

    .motion-ok .areas-deck > li {
        --d: calc(var(--dwell) / (1 + var(--dwell)));
        /* Until the scene reports: the first panel in place, the others below. */
        --q: max(-1, 0 - var(--i));
        --enter: clamp(0, var(--q) / (1 - var(--d)) + 1, 1);
        --beat: clamp(0, var(--q) / var(--d), 1);
        --cover: clamp(0, (var(--q) - var(--d)) / (1 - var(--d)), 1);
        --drawn: clamp(0, (var(--enter) - 0.3) / 0.6, 1);
        position: sticky;
        top: 10svh;
        height: var(--deck-h);
    }

    /*
     * The room for a hold lies above the next panel and, for the last one,
     * in the deck's after-box — never below a panel: a sticky element
     * stays inside its container together with its margin, so a bottom
     * margin would push the earlier panels out while the last is held.
     * This way the whole stack leaves together, with the page.
     */
    .motion-ok .areas-deck > li + li {
        margin-top: calc(var(--deck-h) * var(--dwell));
    }

    .motion-ok .areas-deck::after {
        display: block;
        height: calc(var(--deck-h) * var(--dwell));
        content: '';
    }

    /* Nothing covers the last panel. */
    .motion-ok .areas-deck > li:last-child {
        --cover: 0;
    }

    .motion-ok .areas-deck .st {
        --u: calc(var(--beat) * var(--beats) - var(--k));
        --on: clamp(0, var(--u) * 2.5, 1);
        --now: clamp(0, 1 - max(0 - var(--u), var(--u) - 1) * 4, 1);
    }

    /* A covered panel steps back: smaller, a little higher, in the shade. */
    .motion-ok .areas-deck .area-panel {
        height: 100%;
        transform: translate3d(0, calc(var(--cover) * -0.75rem), 0)
            scale(calc(1 - var(--cover) * 0.06));
        transform-origin: 50% 0;
        will-change: transform;
    }

    .motion-ok .areas-deck .area-panel::after {
        position: absolute;
        inset: 0;
        z-index: 3;
        background-color: var(--color-ink);
        content: '';
        opacity: calc(var(--cover) * 0.6);
        pointer-events: none;
    }

    .motion-ok .areas-deck .area-stage {
        min-height: 0;
    }

    .motion-ok .areas-deck .area-ghost {
        transform: translate3d(
            calc(
                (1 - var(--enter)) * 24% - var(--beat) * 8% - var(--cover) * 8%
            ),
            0,
            0
        );
        will-change: transform;
    }

    .motion-ok .areas-deck .area-glow {
        opacity: calc(0.15 + var(--enter) * 0.35);
        transform: scale(calc(0.6 + var(--enter) * 0.5));
        will-change: opacity, transform;
    }

    /* The texts rise in one after another (--j: their order). */
    .motion-ok .areas-deck .area-in {
        --t: clamp(0, (var(--enter) - 0.25 - var(--j) * 0.07) * 4, 1);
        opacity: var(--t);
        transform: translate3d(0, calc((1 - var(--t)) * 1.75rem), 0);
        will-change: opacity, transform;
    }
}

/*
 * Where the window is tall enough for it: the description of the treatment
 * in turn. One at a time — each fades out just after its beat and the next
 * fades in once it is gone, so two never overlap; the first is there from
 * the start.
 */
@media (min-height: 46rem) {
    .motion-ok .area-captions {
        display: grid;
        height: 4.75rem;
        margin-top: 0.875rem;
    }

    .motion-ok .area-caption {
        --shown: clamp(0, min((var(--u) - 0.1) * 10, (1.1 - var(--u)) * 10), 1);
        grid-area: 1 / 1;
        align-self: start;
        max-height: 4.95em;
        opacity: var(--shown);
        transform: translate(0, calc((1 - var(--shown)) * 0.5rem));
    }

    .motion-ok .area-caption:first-child {
        --shown: clamp(0, (1.1 - var(--u)) * 10, 1);
    }
}

/* Wide screens: a longer hold. */
@media (min-height: 38rem) and (min-width: 64rem) {
    .motion-ok .areas-deck {
        --dwell: 1.2;
    }
}

/* Wide but not tall: the panel is short, the promise gives way. */
@media (min-height: 38rem) and (max-height: 55.99rem) and (min-width: 64rem) {
    .motion-ok .areas-deck .area-tagline {
        display: none;
    }
}

/* <Tilt>: a card leans towards the mouse; a soft light follows the pointer. */
.tilt {
    position: relative;
    height: 100%;
}

.motion-ok .tilt {
    transform: perspective(60rem) rotateX(var(--tilt-x, 0deg))
        rotateY(var(--tilt-y, 0deg));
    transition: transform 0.5s var(--ease-out-expo);
}

.tilt-glare {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: inherit;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease-out;
}

.tilt-glare::before {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 130%;
    aspect-ratio: 1;
    translate: -50% -50%;
    background: radial-gradient(
        closest-side,
        color-mix(in srgb, var(--accent) 24%, transparent),
        transparent
    );
    content: '';
    transform: translate3d(var(--glare-x, 0%), var(--glare-y, 0%), 0);
}

@media (hover: hover) {
    .motion-ok .tilt:hover .tilt-glare {
        opacity: 1;
    }
}

/* Closing call to action: rings open up, the headline comes closer. */
.cta-ring {
    grid-area: 1 / 1;
    width: calc(22rem + var(--i) * 17rem);
    aspect-ratio: 1;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    opacity: calc(0.55 - var(--i) * 0.15);
}

.motion-ok .cta-ring {
    transform: scale(calc(0.4 + var(--p) * (0.7 + var(--i) * 0.25)));
    will-change: transform;
}

.motion-ok .cta-title {
    transform: scale(calc(0.84 + var(--p) * 0.16));
    will-change: transform;
}

/*
 * Process story (home page): the steps of the process, told by one bundle
 * of lines that keeps changing shape (lib/line-field.ts, K40).
 *
 * The static form comes first — no JavaScript, reduced motion, very low
 * windows: a heading, the steps as cards with their drawings, the call to
 * action.
 *
 * With motion the scene is pinned for a few screens. Its texts ("plates":
 * the heading, one per step, the call) lie on top of each other and take
 * turns; process-story.tsx writes each plate's clock
 *   --c   -1 waiting below → 0 in place → 1 gone upwards
 * and, on every step of the rail, --f: 0 → 1 across that step.
 */
.process-story {
    --scene-length: 5;
}

.process-view {
    position: relative;
    isolation: isolate;
    padding-block: clamp(5rem, 11vw, 11rem);
}

.process-field,
.process-glow,
.process-scrim,
.process-hud,
.process-cue,
.process-motif {
    display: none;
}

.process-stack {
    display: flex;
    flex-direction: column;
    gap: clamp(2.5rem, 5vw, 4rem);
}

.process-intro .process-text,
.process-outro .process-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
    max-width: 44rem;
}

.process-steps {
    display: grid;
    gap: 1.25rem;
}

@media (min-width: 40rem) {
    .process-steps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 80rem) {
    .process-steps {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.process-step {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background-color: var(--stage-2);
}

/* Clipped: a drawing must not stretch its frame out of proportion. */
.process-visual {
    aspect-ratio: 16 / 10;
    overflow: hidden;
}

.process-step .process-text {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem 1.5rem 1.75rem;
}

.process-count {
    color: var(--accent-fg);
    font-size: 1.5rem;
    line-height: 1;
}

/* Very low windows: the scene is not pinned. */
@media (max-height: 34.99rem) {
    .motion-ok .process-story[data-scene='pin'] {
        height: auto;
    }

    .motion-ok .process-story > [data-scene-viewport] {
        position: relative;
        height: auto;
        overflow: visible;
    }
}

@media (min-height: 35rem) {
    .motion-ok .process-view {
        padding-block: 0;
    }

    /* The lines: transparent until their first frame is drawn. */
    .motion-ok .process-field {
        position: absolute;
        inset: 0;
        z-index: -1;
        display: block;
        width: 100%;
        height: 100%;
        opacity: 0;
        pointer-events: none;
        transition: opacity 1.4s ease-out;
    }

    .motion-ok .process-field[data-live] {
        opacity: 1;
    }

    /* A glow where the drawing sits: above the text here, beside it on wide screens. */
    .motion-ok .process-glow,
    .motion-ok .process-visual {
        --seat-x: 50%;
        --seat-y: 31%;
    }

    .motion-ok .process-glow {
        --w: min(130vw, 44rem);
        position: absolute;
        top: var(--seat-y);
        inset-inline-start: calc(var(--seat-x) - var(--w) / 2);
        z-index: -2;
        display: block;
        width: var(--w);
        aspect-ratio: 1;
        background: radial-gradient(
            closest-side,
            color-mix(in srgb, var(--accent-2) 36%, transparent),
            transparent 72%
        );
        pointer-events: none;
        translate: 0 -50%;
    }

    .motion-ok .process-scrim {
        position: absolute;
        inset: 0;
        z-index: -1;
        display: block;
        background: linear-gradient(
            to top,
            var(--stage) 8%,
            color-mix(in srgb, var(--stage) 74%, transparent) 36%,
            transparent 58%
        );
        pointer-events: none;
    }

    .motion-ok .process-body {
        position: relative;
        display: grid;
        grid-template-rows: minmax(0, 1fr) auto;
        height: 100%;
        padding-top: calc(var(--header-h) + var(--topbar-h) + 1rem);
        padding-bottom: clamp(1.25rem, 3.5svh, 2.5rem);
    }

    /* The plates share one place. */
    .motion-ok .process-stack {
        display: grid;
        align-items: end;
        gap: 0;
        min-height: 0;
        padding-bottom: clamp(1.25rem, 3svh, 2rem);
    }

    .motion-ok .process-stack > * {
        grid-area: 1 / 1;
        min-width: 0;
    }

    .motion-ok .process-steps {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: end;
        gap: 0;
    }

    .motion-ok .process-steps > li {
        grid-area: 1 / 1;
    }

    .motion-ok .process-plate {
        --c: -1;
        --a: clamp(0, calc(1 - max(var(--c), calc(-1 * var(--c)))), 1);
        pointer-events: none;
    }

    .motion-ok .process-plate[data-on] {
        pointer-events: auto;
    }

    /* The scene opens on its heading. */
    .motion-ok .process-intro {
        --c: 0;
    }

    .motion-ok .process-step {
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: none;
    }

    .motion-ok .process-text {
        opacity: calc(var(--a) * var(--a));
        transform: translate3d(0, calc(var(--c) * -3rem), 0);
        will-change: opacity, transform;
    }

    .motion-ok .process-step .process-text {
        gap: 0.875rem;
        max-width: 31rem;
        padding: 0;
    }

    /* The step's number, large and in outline; it travels a little further than the text. */
    .motion-ok .process-count {
        color: transparent;
        font-size: clamp(3.5rem, 11svh, 7.5rem);
        line-height: 0.9;
        -webkit-text-stroke: 1px var(--accent);
        transform: translate3d(0, calc(var(--c) * -2rem), 0);
    }

    .motion-ok .process-step h3 {
        font-size: var(--text-display-3);
        line-height: var(--text-display-3--line-height);
        letter-spacing: var(--text-display-3--letter-spacing);
    }

    .motion-ok .process-motif {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        margin-top: 0.25rem;
        color: var(--accent-fg);
        font-size: 0.875rem;
        line-height: 1.4;
    }

    .motion-ok .process-motif::before {
        flex: none;
        width: 1.75rem;
        height: 1px;
        background-color: currentColor;
        content: '';
        opacity: 0.6;
    }

    .motion-ok .process-cue {
        display: inline-flex;
        align-items: center;
        gap: 0.875rem;
        color: var(--fg-soft);
        font-size: 0.8125rem;
        letter-spacing: 0.16em;
        text-transform: uppercase;
    }

    .process-cue-line {
        position: relative;
        width: 1px;
        height: 2.75rem;
        overflow: hidden;
        background-color: var(--line-strong);
    }

    .process-cue-line > span {
        position: absolute;
        inset: 0;
        background-color: var(--accent);
        animation: var(--animate-scroll-cue);
    }

    /*
     * Until the lines are drawn (and in data-saver mode, for good) the
     * step's drawing stands where they will be.
     */
    .motion-ok .process-visual {
        --w: min(72vw, 21rem);
        position: absolute;
        top: var(--seat-y);
        inset-inline-start: calc(var(--seat-x) - var(--w) / 2);
        z-index: -1;
        width: var(--w);
        aspect-ratio: 4 / 3;
        overflow: hidden;
        border: 1px solid var(--line);
        border-radius: var(--radius-lg);
        opacity: var(--a);
        transition: opacity 0.5s ease-out;
        translate: 0 -50%;
    }

    .motion-ok
        .process-view:has(.process-field[data-live])
        .process-visual:not([data-photo]) {
        opacity: 0;
    }

    /* A real photo of the step stays, small, with its text (wide screens). */
    .motion-ok .process-visual[data-photo] {
        display: none;
    }

    /* The rail: where the visitor is. It ends before the floating chat button. */
    .motion-ok .process-hud {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        padding-inline-end: 4.5rem;
    }

    .process-hud-label {
        color: var(--accent-fg);
        font-variant-numeric: tabular-nums;
    }

    .process-rail {
        display: grid;
        grid-template-columns: repeat(var(--steps, 4), minmax(0, 1fr));
        gap: 0.5rem;
    }

    .process-rail-bar {
        display: block;
        height: 2px;
        overflow: hidden;
        border-radius: 1px;
        background-color: var(--line-strong);
    }

    .process-rail-fill {
        display: block;
        height: 100%;
        background-color: var(--accent);
        transform: scaleX(var(--f, 0));
        transform-origin: 0 50%;
    }

    [dir='rtl'] .process-rail-fill {
        transform-origin: 100% 50%;
    }

    .process-rail-name {
        display: none;
    }
}

/* Not much height: the text gives way to the drawing. */
@media (min-height: 35rem) and (max-height: 43.99rem) {
    .motion-ok .process-motif {
        display: none;
    }

    .motion-ok .process-count {
        font-size: 3rem;
    }
}

/* …and on a small phone the number goes too: the rail already counts. */
@media (min-height: 35rem) and (max-height: 43.99rem) and (max-width: 63.99rem) {
    .motion-ok .process-count {
        display: none;
    }
}

/* Wide screens: the text on one side, the drawing on the other. */
@media (min-height: 35rem) and (min-width: 64rem) {
    .motion-ok .process-story {
        --scene-length: 5.6;
    }

    /* The same place the lines are drawn at (line-field.ts → seat). */
    .motion-ok .process-glow,
    .motion-ok .process-visual {
        --seat-x: 68%;
        --seat-y: 50%;
    }

    .motion-ok .process-glow {
        --w: min(62vw, 58rem);
    }

    .motion-ok .process-scrim {
        background: linear-gradient(
            to right,
            var(--stage) 4%,
            color-mix(in srgb, var(--stage) 62%, transparent) 30%,
            transparent 54%
        );
    }

    .motion-ok[dir='rtl'] .process-scrim {
        background: linear-gradient(
            to left,
            var(--stage) 4%,
            color-mix(in srgb, var(--stage) 62%, transparent) 30%,
            transparent 54%
        );
    }

    .motion-ok .process-stack,
    .motion-ok .process-steps {
        align-items: center;
    }

    .motion-ok .process-intro .process-text {
        max-width: 40rem;
    }

    .motion-ok .process-copy {
        font-size: 1.125rem;
    }

    /* Narrower than a desktop: a slimmer column leaves the drawing its room. */
    @media (max-width: 79.99rem) {
        .motion-ok .process-step .process-text,
        .motion-ok .process-outro .process-text {
            max-width: 25rem;
        }

        .motion-ok .process-intro .process-text {
            max-width: 30rem;
        }
    }

    .motion-ok .process-visual {
        --w: min(38vw, 33rem);
    }

    .motion-ok .process-visual[data-photo] {
        position: static;
        display: block;
        width: 15rem;
        margin-bottom: 1.5rem;
        aspect-ratio: 16 / 10;
        border-radius: var(--radius-md);
        translate: none;
    }

    .process-rail {
        gap: 1rem;
    }

    /* Here the page's margin already keeps the rail clear of the chat button. */
    @media (min-width: 90rem) {
        .motion-ok .process-hud {
            padding-inline-end: 0;
        }
    }

    .process-rail-name {
        display: flex;
        gap: 0.625rem;
        margin-top: 0.875rem;
        color: var(--fg-soft);
        font-size: 0.8125rem;
        line-height: 1.3;
        transition: color 0.5s ease-out;
    }

    .process-rail [data-active] .process-rail-name {
        color: var(--fg);
    }
}

/* ------------------------------------------------------------------ */
/* Clinic features (2026-11-12)                                        */
/* ------------------------------------------------------------------ */

@media (min-width: 64rem) {
    :root {
        --topbar-h: 2.5rem;
    }
}

/*
 * Header: once the page scrolls, the top bar slides out of view and the
 * navigation stays; scrolling down tucks the whole header away (unless the
 * mega menu is open or something inside has focus).
 */
.site-header {
    translate: 0 var(--header-shift, 0);
}

.site-header[data-scrolled] {
    --header-shift: calc(-1 * var(--topbar-h));
}

.site-header[data-hidden]:not([data-mega]):not(:focus-within) {
    --header-shift: -100%;
}

html {
    scroll-padding-top: calc(var(--header-h) + 1rem);
}

/* Hero backdrop: faint clinic photos fading into one another. */
.hero-photos {
    opacity: 0.8;
}

.hero-photo {
    opacity: 0;
    transition: opacity 2.6s ease-in-out;
}

.hero-photo[data-active] {
    opacity: 1;
}

.motion-ok .hero-photo img {
    transform: scale(1.03);
    transition: transform 11s linear;
    will-change: transform;
}

.motion-ok .hero-photo[data-active] img {
    transform: scale(1.12);
}

/*
 * Clinic gallery: inside a scene the photos drift in their frames while
 * the section scrolls past (a little larger than the frame, so no edge
 * shows); under the mouse a photo comes closer.
 */
.gallery-tile .gallery-image {
    transition: scale 1.2s var(--ease-out-expo);
}

.motion-ok [data-scene='view'] .gallery-image {
    transform: translate3d(0, calc((0.5 - var(--p)) * 7%), 0) scale(1.15);
    will-change: transform;
}

@media (hover: hover) {
    .motion-ok .gallery-tile:hover .gallery-image {
        scale: 1.06;
    }
}

.gallery-dialog::backdrop {
    background-color: color-mix(in srgb, var(--color-ink) 92%, transparent);
}

.gallery-dialog[open] {
    animation: menu-pop 0.4s var(--ease-out-expo);
}

/* Appointment wizard: each step rises in. */
.motion-ok .wizard-step {
    animation: var(--animate-rise);
    animation-duration: 0.7s;
}

/* Floating WhatsApp button: its label fades in beside it. */
.floating-whatsapp-label {
    opacity: 0;
    translate: 0.5rem -50%;
    transition:
        opacity 0.3s ease-out,
        translate 0.4s var(--ease-out-expo);
}

.floating-whatsapp:hover .floating-whatsapp-label,
.floating-whatsapp:focus-visible .floating-whatsapp-label {
    opacity: 1;
    translate: 0 -50%;
}

/* WhatsApp form panel above the floating button: eases in when it opens. */
.whatsapp-panel:not([hidden]) {
    animation: menu-pop 0.35s var(--ease-out-expo);
}

@media (prefers-reduced-motion: reduce) {
    .gallery-dialog[open],
    .floating-whatsapp-label,
    .whatsapp-panel:not([hidden]) {
        animation: none;
        transition: none;
    }
}

/* ------------------------------------------------------------------ */
/* Inner pages: drawings and small scenes (2026-11-16)                 */
/* docs/ANIMATIONS.md §10                                              */
/* ------------------------------------------------------------------ */

/*
 * Line drawings outside the home page's panels — page heroes, principle
 * and fact icons. They use the scenes' strokes and fills (.ln .ac .af .fg
 * .pane .box).
 */
.art {
    display: block;
    overflow: visible;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/*
 * Parts that enter one after another (--i: their turn): a stroke that
 * draws itself (sk; the shape declares pathLength="1"), a part that fades
 * in (so) or pops in about its own centre (sf). In a page's hero they play
 * as the page opens — CSS only, like hero-rise; anywhere else when the
 * <Reveal> around them comes into view. Without motion they are simply
 * there.
 */
@keyframes sketch {
    from {
        stroke-dashoffset: 1;
    }
}

@keyframes appear {
    from {
        opacity: 0;
    }
}

@keyframes pop {
    from {
        opacity: 0;
        transform: scale(0.4);
    }
}

.art .sf {
    transform-box: fill-box;
    transform-origin: 50% 50%;
}

.motion-ok .hero-art :is(.sk, .so, .sf) {
    animation: 1.6s var(--ease-out-expo) both;
    animation-delay: calc(var(--delay, 250ms) + var(--i, 0) * 90ms);
}

.motion-ok .hero-art .sk {
    stroke-dasharray: 1;
    animation-name: sketch;
}

.motion-ok .hero-art .so {
    animation-name: appear;
}

.motion-ok .hero-art .sf {
    animation-name: pop;
}

.motion-ok [data-reveal] :is(.sk, .so, .sf) {
    transition: 1.4s var(--ease-out-expo);
    transition-delay: calc(
        var(--reveal-delay, 0ms) + 200ms + var(--i, 0) * 90ms
    );
}

.motion-ok [data-reveal] .sk {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    transition-property: stroke-dashoffset;
}

.motion-ok [data-reveal] .so {
    opacity: 0;
    transition-property: opacity;
}

.motion-ok [data-reveal] .sf {
    opacity: 0;
    transform: scale(0.4);
    transition-property: opacity, transform;
}

.motion-ok [data-reveal][data-revealed] .sk {
    stroke-dashoffset: 0;
}

/* --o: the part's own opacity (an attribute would lose to these rules). */
.motion-ok [data-reveal][data-revealed] .so {
    opacity: var(--o, 1);
}

.motion-ok [data-reveal][data-revealed] .sf {
    opacity: var(--o, 1);
    transform: none;
}

/* Quiet loops inside a drawing; they stop off screen and without motion ([data-ambient]). */
@keyframes turn {
    to {
        transform: rotate(360deg);
    }
}

@keyframes bob {
    from {
        transform: translate(0, -5px);
    }
    to {
        transform: translate(0, 5px);
    }
}

@keyframes blink {
    0%,
    40% {
        opacity: 1;
    }
    60%,
    100% {
        opacity: 0.2;
    }
}

@keyframes march {
    to {
        stroke-dashoffset: -14;
    }
}

.motion-ok .art-turn {
    animation: turn var(--turn, 120s) linear infinite;
}

.motion-ok .art-bob {
    animation: bob 4.5s var(--ease-in-out-soft) infinite alternate;
}

.motion-ok .art-blink {
    animation: blink 1.5s ease-in-out infinite alternate;
    animation-delay: calc(var(--i, 0) * 0.25s);
}

/* A dashed line whose dashes travel along it. */
.art-march {
    stroke-dasharray: 6 8;
}

.motion-ok .art-march {
    animation: march 1s linear infinite;
}

/* Layers of a drawing lean with the mouse (--mx, --my: -1…1, written by <Spotlight>). */
.motion-ok [data-pointer] [data-depth] {
    transform: translate(
        calc(var(--mx, 0) * var(--depth, 1) * 7px),
        calc(var(--my, 0) * var(--depth, 1) * 7px)
    );
    transition: transform 1.1s var(--ease-out-expo);
}

/*
 * <Spotlight>: on dark sections a soft light follows the mouse and lifts
 * the grid under it. A round lens moves with the pointer (--sx, --sy);
 * the brighter grid inside it moves the opposite way, so it stays in
 * register with the page's grid — transforms only.
 */
.spot {
    position: absolute;
    inset: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.7s ease-out;
    container-type: size;
}

.spot[data-on] {
    opacity: 1;
}

.spot-lens {
    --lens: 34rem;
    position: absolute;
    top: 0;
    left: 0;
    width: var(--lens);
    height: var(--lens);
    overflow: hidden;
    border-radius: 50%;
    mask-image: radial-gradient(closest-side, #000 15%, transparent 100%);
    transform: translate3d(
        calc(var(--sx, 0px) - 50%),
        calc(var(--sy, 0px) - 50%),
        0
    );
    will-change: transform;
}

.spot-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(
        closest-side,
        color-mix(in srgb, var(--accent) 20%, transparent),
        transparent 75%
    );
}

.spot-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100cqw;
    height: 100cqh;
    background-image:
        linear-gradient(to right, var(--line-strong) 1px, transparent 1px),
        linear-gradient(to bottom, var(--line-strong) 1px, transparent 1px);
    background-size: 5rem 5rem;
    transform: translate3d(
        calc(var(--lens) / 2 - var(--sx, 0px)),
        calc(var(--lens) / 2 - var(--sy, 0px)),
        0
    );
    will-change: transform;
}

/*
 * A page's drawing in its hero (PageHero `art`): beside the text on large
 * screens, a faint ornament in the corner on small ones. It is laid over
 * the hero, so the hero keeps the height its text gives it.
 */
.hero-art-slot {
    position: absolute;
    top: calc(var(--header-h) + var(--topbar-h) - 0.5rem);
    inset-inline-end: -4rem;
    width: 17rem;
    aspect-ratio: 1;
    opacity: 0.4;
    pointer-events: none;
}

@media (min-width: 64rem) {
    .hero-art-slot {
        top: calc(var(--header-h) + var(--topbar-h) + 0.5rem);
        bottom: 3.5rem;
        inset-inline-end: var(--edge);
        display: flex;
        align-items: center;
        justify-content: flex-end;
        width: min(32rem, 38vw);
        aspect-ratio: auto;
        opacity: 1;
        pointer-events: auto;
    }

    .hero-art-slot > * {
        width: auto;
        height: 100%;
        max-height: 30rem;
        aspect-ratio: 1;
    }
}

/* ContourArt with `alive`: the rings enter one by one, lean with the mouse and turn slowly. */
.motion-ok .contour-alive .contour-ring {
    animation: appear 1.4s ease-out both;
    animation-delay: calc(var(--delay, 200ms) + var(--i) * 70ms);
    transform: translate(
        calc(var(--mx, 0) * (var(--i) - 6) * 1.1px),
        calc(var(--my, 0) * (var(--i) - 6) * 1.1px)
    );
    transition: transform 1.1s var(--ease-out-expo);
}

.motion-ok .contour-alive .contour-rings {
    animation: turn 160s linear infinite;
}

/* Contact drawing: the pin drops into place once the roads are drawn. */
@keyframes pin-drop {
    from {
        opacity: 0;
        transform: translate(0, -70px);
    }
}

.motion-ok .hero-art .map-pin {
    animation: pin-drop 0.9s cubic-bezier(0.3, 1.45, 0.5, 1) both;
    animation-delay: calc(var(--delay, 250ms) + 1100ms);
}

/*
 * Treatments drawing (AtlasArt): one mark per area on a spiral, each in
 * its own colour. The icons draw themselves after their discs; the mark
 * under the pointer — or the one whose jump link is — lights up.
 */
.atlas-disc {
    fill: var(--stage);
    stroke: var(--accent);
    stroke-width: 1.4;
    transition:
        fill 0.4s ease-out,
        transform 0.6s var(--ease-out-expo);
}

.atlas-glyph {
    stroke: var(--accent);
    stroke-width: 2.5;
    color: var(--accent);
}

.atlas-mark {
    cursor: pointer;
}

.atlas-mark:hover .atlas-disc,
.atlas-mark[data-active] .atlas-disc {
    fill: color-mix(in srgb, var(--accent) 24%, var(--stage));
    transform: scale(1.2);
}

.motion-ok .hero-art .atlas-glyph :is(path, rect, circle) {
    stroke-dasharray: 1;
    animation: sketch 1.4s var(--ease-out-expo) both;
    animation-delay: calc(var(--delay, 250ms) + 500ms + var(--i, 0) * 110ms);
}

/* The face drawing draws itself in a hero (its paths declare pathLength="1"). */
.motion-ok .hero-art .face-lines path {
    stroke-dasharray: 1;
    animation: sketch 2.4s var(--ease-out-expo) both;
    animation-delay: var(--delay, 250ms);
}

/*
 * Treatment story (category page): the area's drawing beside the list of
 * its treatments. The drawing is one of the home page's scenes and reads
 * the same clocks (see "Areas showcase"): --drawn while it comes into
 * view, --beat as the list scrolls past the middle of the window — on
 * large screens, where the drawing is pinned beside the list (--list,
 * written by treatment-story.tsx); on small ones the drawing plays while
 * it crosses the screen itself (--p). Without motion it rests finished.
 */
.story-stage {
    --drawn: 1;
    --beat: 1;
    display: flex;
    width: 100%;
    max-height: 50svh;
    aspect-ratio: 6 / 5;
    padding: 1.25rem 1.5rem;
    overflow: clip;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(
            90% 75% at 50% 112%,
            color-mix(in srgb, var(--accent-2) 30%, transparent),
            transparent 70%
        ),
        color-mix(in srgb, var(--stage-2) 55%, transparent);
}

@media (min-width: 64rem) {
    .story-stage {
        padding: 1.75rem 2.25rem;
    }
}

.story-stage .st {
    --u: 1;
    --on: 1;
    --now: 1;
}

.motion-ok .story-stage {
    --drawn: clamp(0, var(--p) * 2.6, 1);
    --beat: clamp(0, (var(--p) - 0.3) / 0.6, 1);
}

@media (min-width: 64rem) {
    .motion-ok .story-stage {
        --beat: var(--list, 0);
    }
}

.motion-ok .story-stage .st {
    --u: calc(var(--beat) * var(--beats) - var(--k));
    --on: clamp(0, var(--u) * 2.5, 1);
    --now: clamp(0, 1 - max(0 - var(--u), var(--u) - 1) * 4, 1);
}

/*
 * A control that only works once the application runs (the search of the
 * questions page): it keeps its place but stays out of sight until then.
 */
html:not([data-site-ready]) .needs-js {
    visibility: hidden;
}

/* Error page: the status set very large; each zero is a set of contour rings. */
.lost-code {
    font-size: clamp(6.5rem, 23vw, 17rem);
    line-height: 0.92;
    letter-spacing: -0.04em;
}

.lost-zero {
    display: inline-block;
    width: 0.8em;
    height: 0.8em;
    margin-inline: 0.03em;
}

/*
 * An area's icon that draws itself when the <Reveal> around it comes into
 * view (every shape of CategoryIcon declares pathLength="1").
 */
.motion-ok [data-reveal] .icon-draw :is(path, rect, circle) {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    transition: stroke-dashoffset 1.6s var(--ease-out-expo)
        calc(var(--reveal-delay, 0ms) + 250ms);
}

.motion-ok [data-reveal][data-revealed] .icon-draw :is(path, rect, circle) {
    stroke-dashoffset: 0;
}

/* Treatments page: the round seat of an area's icon. */
.area-badge {
    display: grid;
    flex: none;
    place-items: center;
    width: 4.5rem;
    height: 4.5rem;
    border: 1px solid color-mix(in srgb, var(--accent-fg) 45%, transparent);
    border-radius: 50%;
    background: radial-gradient(
        closest-side,
        color-mix(in srgb, var(--accent) 22%, transparent),
        transparent
    );
}

/*
 * <SectionNav>: the links of "On this page" follow the reader as a slim
 * bar under the header — at the very top of the window while the header
 * is tucked away (scrolling down). Hidden, it waits behind the header.
 */
.section-nav {
    position: fixed;
    top: 0;
    inset-inline: 0;
    z-index: 40;
    border-bottom: 1px solid var(--line);
    background-color: color-mix(in srgb, var(--stage) 95%, transparent);
    opacity: 0;
    pointer-events: none;
    translate: 0 calc(var(--header-h) - 100%);
    transition:
        translate 0.5s var(--ease-out-expo),
        opacity 0.3s ease-out;
}

.section-nav[data-shown] {
    opacity: 1;
    pointer-events: auto;
    translate: 0 var(--header-h);
}

html:has(.site-header[data-hidden]:not([data-mega]):not(:focus-within))
    .section-nav[data-shown] {
    translate: 0 0;
}

.section-nav-track {
    display: flex;
    gap: 0.375rem;
    padding-block: 0.625rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.section-nav-track::-webkit-scrollbar {
    display: none;
}

.section-nav-link {
    display: inline-flex;
    align-items: center;
    height: 2rem;
    padding-inline: 0.875rem;
    border-radius: 999px;
    color: var(--fg-soft);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    transition:
        color 0.3s ease-out,
        background-color 0.3s ease-out;
}

.section-nav-link:hover {
    color: var(--fg);
}

.section-nav-link[data-active] {
    background-color: var(--fg);
    color: var(--stage);
}

@media (prefers-reduced-motion: reduce) {
    .section-nav {
        transition: none;
    }
}

/* Contents of a blog post: the entry of the heading being read is marked on the line. */
.toc-entry {
    position: relative;
}

.toc-entry::before {
    position: absolute;
    inset-block: 0;
    inset-inline-start: -1px;
    width: 2px;
    background-color: var(--accent-fg);
    content: '';
    transform: scaleY(0);
    transition: transform 0.5s var(--ease-out-expo);
}

.toc-entry[data-active]::before {
    transform: none;
}

.toc-entry[data-active] > a {
    color: var(--fg);
    font-weight: 500;
}

/*
 * Footer: the clinic's name once more, oversized and in outline; it
 * slides past as the page comes to its end.
 */
.footer-word {
    padding-block: 0.06em 0.02em;
    color: transparent;
    font-size: min(13.5vw, 15rem);
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    -webkit-text-stroke: 1px var(--line-strong);
    user-select: none;
}

.motion-ok .footer-word {
    transform: translate3d(calc(7% - var(--p) * 14%), 0, 0);
    will-change: transform;
}

/*
 * <StickySteps>: on large screens a line runs down beside the steps and
 * fills as they pass the middle of the window (--p of the list); each
 * step has a point on it, filled while the step is the one in turn. The
 * dial beside the heading closes by one step at a time.
 */
.steps-dial {
    transition: stroke-dashoffset 0.9s var(--ease-out-expo);
}

@media (min-width: 64rem) {
    .steps-list {
        position: relative;
        padding-inline-start: 2.75rem;
    }

    .steps-list::before,
    .steps-list::after {
        position: absolute;
        inset-block: 0;
        inset-inline-start: 0;
        width: 1px;
        background-color: var(--line);
        content: '';
    }

    .steps-list::after {
        background-color: var(--accent-fg);
        transform: scaleY(var(--p, 0));
        transform-origin: 50% 0;
    }

    .steps-list > li {
        position: relative;
    }

    .steps-list > li::before {
        position: absolute;
        top: 50%;
        inset-inline-start: -2.75rem;
        z-index: 1;
        width: 0.625rem;
        height: 0.625rem;
        margin: -0.3125rem;
        border: 1px solid var(--accent-fg);
        border-radius: 50%;
        background-color: var(--stage);
        content: '';
        transition:
            background-color 0.5s ease-out,
            transform 0.5s var(--ease-out-expo);
    }

    .steps-list > li[data-active]::before {
        background-color: var(--accent-fg);
        transform: scale(1.5);
    }
}
