/* ==========================================================================
   FirstLook design system — "Depth of Field"

   People in focus, the machine in the background.
   - Human things (names, photos, words, choices) are sharp, warm and large:
     Instrument Sans for the voice and for reading and doing, Instrument
     Serif Italic for names and the one emphasised word.
   - Machine things (status, scores, steps, analysis chrome) are small, quiet
     and soft: JetBrains Mono, dimmed, at the edges of the frame.
   - Two threads, coral and blue, are the two people. Where they cross is the
     lens — the brand's one geometric motif.
   - One warm light per screen, placed behind whatever deserves attention.

   This file only defines tokens and `fl-` components; it never restyles a
   page on its own. Page skins (css/fl-*.css) map each page onto it.
   Docs: docs/redesign/DESIGN.md
   ========================================================================== */

/* --------------------------------------------------------------------------
   Faces — self-hosted (no third-party requests), all SIL Open Font License
   (free to use, self-host, subset and redistribute; licences in
   css/fonts/LICENSE-*.txt). Chosen in session 5 (owner: Zodiak + Satoshi
   looked "too old school"):
   - 'FL Voice' (--fl-font-voice): Instrument Sans for upright voice text
     (headlines, big numbers) and Instrument Serif Italic for italic voice
     text — names and the one coral word — so people keep a warm signature
     while everything else reads modern. Skins just set italic.
   - 'Instrument Sans' (--fl-font-ui): reading and doing (400–700).
   - 'JetBrains Mono' (--fl-font-machine): the machine layer.
   -------------------------------------------------------------------------- */
@font-face {
    font-family: 'FL Voice';
    src: url('fonts/InstrumentSans-Variable.woff2?v=1') format('woff2');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'FL Voice';
    src: url('fonts/InstrumentSans-Variable-ext.woff2?v=1') format('woff2');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'FL Voice';
    src: url('fonts/InstrumentSerif-Italic.woff2?v=1') format('woff2');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
    size-adjust: 108%;  /* match the sans x-height beside it */
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'FL Voice';
    src: url('fonts/InstrumentSerif-Italic-ext.woff2?v=1') format('woff2');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
    size-adjust: 108%;  /* match the sans x-height beside it */
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Instrument Sans';
    src: url('fonts/InstrumentSans-Variable.woff2?v=1') format('woff2');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Instrument Sans';
    src: url('fonts/InstrumentSans-Variable-ext.woff2?v=1') format('woff2');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Instrument Sans';
    src: url('fonts/InstrumentSans-VariableItalic.woff2?v=1') format('woff2');
    font-weight: 400 700;
    font-style: italic;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Instrument Sans';
    src: url('fonts/InstrumentSans-VariableItalic-ext.woff2?v=1') format('woff2');
    font-weight: 400 700;
    font-style: italic;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'JetBrains Mono';
    src: url('fonts/JetBrainsMono-Variable-latin.woff2?v=1') format('woff2');
    font-weight: 100 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --------------------------------------------------------------------------
   Tokens — night (default) and paper (html.theme-light)
   -------------------------------------------------------------------------- */
:root {
    color-scheme: dark;

    /* Grounds */
    --fl-bg: #09080b;
    --fl-bg-deep: #050406;
    --fl-bg-raised: #0f0d12;
    --fl-surface: #141117;
    --fl-surface-2: #1b171f;
    --fl-surface-3: #241f29;
    --fl-scrim: rgba(5, 4, 6, 0.72);

    /* Ink */
    --fl-ink: #f6f0ea;
    --fl-ink-2: #c4bbb4;
    --fl-ink-3: #8d847e;
    --fl-ink-4: #5d5660;
    --fl-ink-inverse: #0b0a0c;

    /* Hairlines */
    --fl-line: rgba(255, 236, 224, 0.085);
    --fl-line-2: rgba(255, 236, 224, 0.15);
    --fl-line-3: rgba(255, 236, 224, 0.28);
    --fl-highlight: inset 0 1px 0 rgba(255, 245, 238, 0.05);

    /* The two threads + the ember between them */
    --fl-coral: #ff5a78;
    --fl-coral-strong: #fd506f;
    --fl-coral-wash: rgba(253, 80, 111, 0.12);
    --fl-coral-glow: rgba(253, 80, 111, 0.32);
    --fl-blue: #6aa8ff;
    --fl-blue-strong: #4d9fff;
    --fl-blue-wash: rgba(77, 159, 255, 0.12);
    --fl-blue-glow: rgba(77, 159, 255, 0.3);
    --fl-amber: #ffad6b;
    --fl-ember: linear-gradient(100deg, #ff5a78 0%, #ff7468 55%, #ff9a6b 100%);
    --fl-threads: linear-gradient(90deg, #fd506f, #4d9fff);
    --fl-ember-light: radial-gradient(closest-side, rgba(255, 110, 110, 0.16), rgba(255, 140, 100, 0.05) 55%, transparent);

    /* Status */
    --fl-success: #63d6a4;
    --fl-success-wash: rgba(99, 214, 164, 0.12);
    --fl-warning: #ffc46b;
    --fl-danger: #ff5a78;
    --fl-danger-wash: rgba(255, 90, 120, 0.12);

    /* Depth */
    --fl-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
    --fl-shadow-2: 0 2px 6px rgba(0, 0, 0, 0.4), 0 12px 32px -12px rgba(0, 0, 0, 0.7);
    --fl-shadow-3: 0 4px 12px rgba(0, 0, 0, 0.45), 0 32px 80px -24px rgba(0, 0, 0, 0.85);
    --fl-grain-opacity: 0.05;

    /* Type */
    --fl-font-voice: 'FL Voice', 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --fl-font-ui: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --fl-font-machine: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

    --fl-text-display-xl: clamp(2.6rem, 5.2vw + 1rem, 5.25rem);
    --fl-text-display-l: clamp(2.15rem, 3.4vw + 1rem, 3.6rem);
    --fl-text-display-m: clamp(1.7rem, 2vw + 1rem, 2.5rem);
    --fl-text-title: clamp(1.25rem, 0.6vw + 1rem, 1.5rem);
    --fl-text-body-l: 1.125rem;
    --fl-text-body: 1rem;
    --fl-text-small: 0.875rem;
    --fl-text-label: 0.6875rem;
    --fl-text-micro: 0.625rem;

    /* Shape — one corner family, scaled by size */
    --fl-r-xs: 8px;
    --fl-r-sm: 12px;
    --fl-r-md: 16px;
    --fl-r-lg: 22px;
    --fl-r-xl: 30px;
    --fl-r-pill: 999px;

    /* Space (4px grid) */
    --fl-s-1: 4px;
    --fl-s-2: 8px;
    --fl-s-3: 12px;
    --fl-s-4: 16px;
    --fl-s-5: 20px;
    --fl-s-6: 24px;
    --fl-s-7: 32px;
    --fl-s-8: 40px;
    --fl-s-9: 56px;
    --fl-s-10: 72px;
    --fl-s-11: 96px;
    --fl-gutter: clamp(20px, 5vw, 40px);
    --fl-measure: 34rem;

    /* Motion */
    --fl-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --fl-ease-in-out: cubic-bezier(0.7, 0, 0.2, 1);
    --fl-ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
    --fl-ease-in: cubic-bezier(0.5, 0, 0.75, 0);
    --fl-spring: linear(0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%, 1.017 19.4%, 1.077 22%, 1.121 25%, 1.149 28.5%, 1.159 31.7%, 1.154 35%, 1.129 38.6%, 1.051 46%, 1.017 50%, 0.991 54.8%, 0.977 59%, 0.974 63%, 0.975 67%, 0.997 78%, 1.003 86%, 1);
    --fl-spring-gentle: linear(0, 0.06 2.4%, 0.24 5.6%, 0.6 11.6%, 0.86 17.4%, 0.98 22.6%, 1.04 27.8%, 1.06 32.2%, 1.05 38%, 1.01 49%, 0.995 60%, 1);
    --fl-dur-1: 140ms;
    --fl-dur-2: 240ms;
    --fl-dur-3: 420ms;
    --fl-dur-4: 700ms;
    --fl-dur-5: 1100ms;

    /* Line icons: 1.6 stroke, round caps, 24px grid. Draw them in currentColor:
       background: currentColor; mask: var(--fl-i-…) center / contain no-repeat */
    --fl-i-menu: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M4 7h16M4 12h16M4 17h10'/%3E%3C/svg%3E");
    --fl-i-chevron-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    --fl-i-chevron-right: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.5 5.5 16 12l-6.5 6.5'/%3E%3C/svg%3E");
    --fl-i-refresh: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19.5 12.5A7.5 7.5 0 1 1 17 6.4'/%3E%3Cpath d='M19 3.5v4h-4'/%3E%3C/svg%3E");
    --fl-i-expand: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 4.5h5.5V10M10 19.5H4.5V14M19.5 4.5 14 10M4.5 19.5 10 14'/%3E%3C/svg%3E");
    --fl-i-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M6.5 6.5l11 11M17.5 6.5l-11 11'/%3E%3C/svg%3E");

    /* Layers */
    --fl-z-ground: 0;
    --fl-z-content: 1;
    --fl-z-chrome: 50;
    --fl-z-overlay: 900;
    --fl-z-toast: 1000;
}

html.theme-light {
    color-scheme: light;

    --fl-bg: #f6f1ea;
    --fl-bg-deep: #ede6dc;
    --fl-bg-raised: #f1ebe3;
    --fl-surface: #fffcf8;
    --fl-surface-2: #f3ede5;
    --fl-surface-3: #e9e1d6;
    --fl-scrim: rgba(36, 26, 22, 0.42);

    --fl-ink: #1a1519;
    --fl-ink-2: #4c444b;
    --fl-ink-3: #6b6268;  /* ≥ 4.5:1 on every paper ground (was #7a7177: 3.6–4.2) */
    --fl-ink-4: #aea5a2;
    --fl-ink-inverse: #fbf7f2;

    --fl-line: rgba(58, 36, 24, 0.1);
    --fl-line-2: rgba(58, 36, 24, 0.17);
    --fl-line-3: rgba(58, 36, 24, 0.3);
    --fl-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.85);

    /* text-safe on paper (session 5): coral ≥ 4.5:1 on the ground and the
       surface (was #e2365c, 3.8:1), blue ≥ 4.5:1 on every paper ground */
    --fl-coral: #d0294f;
    --fl-coral-strong: #d0294f;
    --fl-coral-wash: rgba(226, 54, 92, 0.09);
    --fl-coral-glow: rgba(226, 54, 92, 0.24);
    --fl-blue: #185fcc;
    --fl-blue-strong: #185fcc;
    --fl-blue-wash: rgba(31, 111, 230, 0.08);
    --fl-blue-glow: rgba(31, 111, 230, 0.22);
    --fl-amber: #e8873a;
    --fl-ember: linear-gradient(100deg, #ff5a78 0%, #ff6f66 55%, #ff9466 100%);
    --fl-threads: linear-gradient(90deg, #e2365c, #1f6fe6);
    --fl-ember-light: radial-gradient(closest-side, rgba(255, 160, 120, 0.3), rgba(255, 190, 150, 0.12) 55%, transparent);

    /* status inks pass 4.5:1 as small text on every paper ground (session 5;
       were #198a5c 3.9, #b86e10 3.5, #d22a52 4.5) */
    --fl-success: #127049;
    --fl-success-wash: rgba(25, 138, 92, 0.09);
    --fl-warning: #925409;
    --fl-danger: #be2247;
    --fl-danger-wash: rgba(210, 42, 82, 0.08);

    --fl-shadow-1: 0 1px 2px rgba(60, 38, 26, 0.08);
    --fl-shadow-2: 0 1px 2px rgba(60, 38, 26, 0.06), 0 10px 28px -10px rgba(60, 38, 26, 0.18);
    --fl-shadow-3: 0 2px 6px rgba(60, 38, 26, 0.06), 0 30px 70px -24px rgba(60, 38, 26, 0.3);
    --fl-grain-opacity: 0.06;
}

/* --------------------------------------------------------------------------
   Type roles
   -------------------------------------------------------------------------- */
.fl-voice,
.fl-display-xl,
.fl-display-l,
.fl-display-m,
.fl-title {
    font-family: var(--fl-font-voice);
    font-optical-sizing: auto;
    font-weight: 400;
    letter-spacing: -0.012em;
    color: var(--fl-ink);
    text-wrap: balance;
    font-synthesis: none;
}

.fl-display-xl { font-size: var(--fl-text-display-xl); line-height: 0.98; letter-spacing: -0.022em; }
.fl-display-l  { font-size: var(--fl-text-display-l);  line-height: 1.02; letter-spacing: -0.018em; }
.fl-display-m  { font-size: var(--fl-text-display-m);  line-height: 1.08; }
.fl-title      { font-size: var(--fl-text-title);      line-height: 1.2; font-weight: 460; }

.fl-voice em,
.fl-display-xl em,
.fl-display-l em,
.fl-display-m em,
.fl-title em,
.fl-name {
    font-style: italic;
    font-weight: inherit;
}

.fl-display-xl em,
.fl-display-l em,
.fl-display-m em { color: var(--fl-coral); }

.fl-lede {
    font-family: var(--fl-font-ui);
    font-size: var(--fl-text-body-l);
    line-height: 1.55;
    color: var(--fl-ink-2);
    max-width: var(--fl-measure);
    text-wrap: pretty;
}

.fl-body {
    font-family: var(--fl-font-ui);
    font-size: var(--fl-text-body);
    line-height: 1.6;
    color: var(--fl-ink-2);
    text-wrap: pretty;
}

/* The machine voice: small, tracked, quiet */
.fl-machine,
.fl-label,
.fl-eyebrow {
    font-family: var(--fl-font-machine);
    font-size: var(--fl-text-label);
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fl-ink-3);
    font-variant-ligatures: none;
}

.fl-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

/* the lens glyph: two small rings crossing, the AI's quiet signature */
.fl-eyebrow::before,
.fl-lens-glyph {
    content: '';
    flex: none;
    width: 15px;
    height: 9px;
    background:
        radial-gradient(circle at 4.5px 50%, transparent 3px, var(--fl-coral) 3.1px, var(--fl-coral) 4.2px, transparent 4.4px),
        radial-gradient(circle at 10.5px 50%, transparent 3px, var(--fl-blue) 3.1px, var(--fl-blue) 4.2px, transparent 4.4px);
    opacity: 0.9;
}

.fl-eyebrow.is-plain::before { content: none; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
[class^="fl-"],
[class*=" fl-"],
[class^="fl-"]::before,
[class*=" fl-"]::before,
[class^="fl-"]::after,
[class*=" fl-"]::after { box-sizing: border-box; }

.fl-btn {
    --_h: 52px;
    --_px: 28px;
    --_bg: var(--fl-ink);
    --_fg: var(--fl-ink-inverse);
    --_bd: transparent;
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: var(--_h);
    padding: 0 var(--_px);
    border: 1px solid var(--_bd);
    border-radius: var(--fl-r-pill);
    background: var(--_bg);
    color: var(--_fg);
    font-family: var(--fl-font-ui);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.005em;
    text-decoration: none;
    text-transform: none;
    white-space: nowrap;
    cursor: pointer;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition:
        transform var(--fl-dur-3) var(--fl-spring),
        background-color var(--fl-dur-2) var(--fl-ease-out),
        border-color var(--fl-dur-2) var(--fl-ease-out),
        color var(--fl-dur-2) var(--fl-ease-out),
        box-shadow var(--fl-dur-3) var(--fl-ease-out),
        opacity var(--fl-dur-2) ease;
}

/* a soft sheet of light that crosses the button on hover */
.fl-btn::after {
    content: '';
    position: absolute;
    inset: -1px;
    z-index: -1;
    border-radius: inherit;
    background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.22) 50%, transparent 70%);
    transform: translateX(-110%);
    pointer-events: none;
}

html.theme-light .fl-btn::after {
    background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%);
}

@media (hover: hover) {
    .fl-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 28px -10px var(--fl-coral-glow); }
    .fl-btn:hover::after { transform: translateX(110%); transition: transform 900ms var(--fl-ease-out); }
}

.fl-btn:active {
    transform: scale(0.97);
    transition-duration: var(--fl-dur-1);
    transition-timing-function: var(--fl-ease-out);
}

.fl-btn:disabled,
.fl-btn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 1;
    transform: none;
    box-shadow: none;
    /* one resting look for every disabled button (session 8): the surface, a
       hairline and an ink-3 label - clearly not ready, still readable, in both themes */
    border-color: var(--fl-line-2);
    background: var(--fl-surface-2);
    color: var(--fl-ink-3);
}

.fl-btn:disabled::after { content: none; }

.fl-btn--quiet {
    --_bg: transparent;
    --_fg: var(--fl-ink);
    --_bd: var(--fl-line-3);
}

@media (hover: hover) {
    .fl-btn--quiet:hover { --_bg: var(--fl-surface-2); --_bd: var(--fl-ink-3); box-shadow: none; }
}

.fl-btn--heart {
    --_bg: var(--fl-coral-strong);
    --_fg: #1b0a0f;
    background-image: var(--fl-ember);
    font-weight: 650;
}

.fl-btn--ghost {
    --_bg: transparent;
    --_fg: var(--fl-ink-2);
    --_px: 16px;
}

@media (hover: hover) {
    .fl-btn--ghost:hover { --_fg: var(--fl-ink); --_bg: var(--fl-surface-2); box-shadow: none; }
}

.fl-btn--danger {
    --_bg: transparent;
    --_fg: var(--fl-danger);
    --_bd: color-mix(in srgb, var(--fl-danger) 45%, transparent);
}

.fl-btn--sm { --_h: 40px; --_px: 18px; font-size: 0.9375rem; }
.fl-btn--lg { --_h: 58px; --_px: 34px; font-size: 1.0625rem; }
.fl-btn--block { display: flex; width: 100%; }

/* Quiet top-bar pill (Back / Pricing / Home on rebuilt pages) */
.fl-pill {
    position: relative;
    height: 40px;
    padding: 0 18px;
    border: 1px solid var(--fl-line-2);
    border-radius: var(--fl-r-pill);
    background: color-mix(in srgb, var(--fl-bg) 74%, transparent);
    color: var(--fl-ink-2);
    font-family: var(--fl-font-ui);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition:
        background-color var(--fl-dur-2) var(--fl-ease-out),
        border-color var(--fl-dur-2) var(--fl-ease-out),
        color var(--fl-dur-2) var(--fl-ease-out),
        transform var(--fl-dur-3) var(--fl-spring);
}

/* 44px hit area around the 40px pill */
.fl-pill::after {
    content: '';
    position: absolute;
    inset: -3px -2px;
}

@media (hover: hover) {
    .fl-pill:hover {
        background: var(--fl-surface-2);
        border-color: var(--fl-ink-3);
        color: var(--fl-ink);
    }
}

.fl-pill:active {
    transform: scale(0.97);
    transition-duration: var(--fl-dur-1);
}

/* --------------------------------------------------------------------------
   Fields
   -------------------------------------------------------------------------- */
.fl-field {
    display: grid;
    gap: 10px;
    text-align: left;
}

.fl-input,
.fl-select,
.fl-textarea {
    width: 100%;
    min-height: 56px;
    padding: 0 18px;
    border: 1px solid var(--fl-line-2);
    border-radius: var(--fl-r-md);
    background: var(--fl-surface-2);
    color: var(--fl-ink);
    font-family: var(--fl-font-ui);
    font-size: 1.0625rem;
    font-weight: 450;
    letter-spacing: 0.005em;
    line-height: 1.3;
    caret-color: var(--fl-coral);
    outline: none;
    box-shadow: var(--fl-highlight);
    transition: border-color var(--fl-dur-2) var(--fl-ease-out), box-shadow var(--fl-dur-3) var(--fl-ease-out), background-color var(--fl-dur-2) ease;
    -webkit-appearance: none;
    appearance: none;
}

.fl-textarea { padding: 16px 18px; min-height: 140px; resize: vertical; line-height: 1.55; }

.fl-input::placeholder,
.fl-textarea::placeholder { color: var(--fl-ink-3); opacity: 1; }

@media (hover: hover) {
    .fl-input:hover,
    .fl-select:hover,
    .fl-textarea:hover { border-color: var(--fl-line-3); }
}

.fl-input:focus,
.fl-select:focus,
.fl-textarea:focus {
    border-color: color-mix(in srgb, var(--fl-coral) 70%, var(--fl-ink-3));
    background: var(--fl-surface);
    box-shadow: 0 0 0 4px var(--fl-coral-wash), var(--fl-highlight);
}

.fl-input[aria-invalid="true"] { border-color: var(--fl-danger); }

.fl-select {
    padding-right: 48px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238d847e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 20px center;
    cursor: pointer;
}

.fl-hint { font-family: var(--fl-font-ui); font-size: var(--fl-text-small); color: var(--fl-ink-3); line-height: 1.45; }

/* --------------------------------------------------------------------------
   Surfaces
   -------------------------------------------------------------------------- */
.fl-card {
    position: relative;
    background: var(--fl-surface);
    border: 1px solid var(--fl-line);
    border-radius: var(--fl-r-xl);
    box-shadow: var(--fl-highlight), var(--fl-shadow-2);
}

.fl-sheet {
    position: relative;
    background: var(--fl-surface);
    border: 1px solid var(--fl-line);
    border-radius: var(--fl-r-xl);
    box-shadow: var(--fl-highlight), var(--fl-shadow-3);
}

@supports (corner-shape: squircle) {
    .fl-card,
    .fl-sheet {
        corner-shape: superellipse(1.6);
        border-radius: calc(var(--fl-r-xl) * 1.35);
    }
}

.fl-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    border: 1px solid var(--fl-line-2);
    border-radius: var(--fl-r-pill);
    background: var(--fl-surface-2);
    color: var(--fl-ink-2);
    font-family: var(--fl-font-ui);
    font-size: 0.8125rem;
    font-weight: 500;
}

/* Two hairlines, coral and blue, meeting in a small lens */
.fl-rule {
    position: relative;
    height: 9px;
    width: min(100%, 220px);
    margin-inline: auto;
}

.fl-rule::before,
.fl-rule::after {
    content: '';
    position: absolute;
    top: 4px;
    height: 1px;
    width: calc(50% - 14px);
}

.fl-rule::before { left: 0; background: linear-gradient(90deg, transparent, var(--fl-coral)); }
.fl-rule::after { right: 0; background: linear-gradient(270deg, transparent, var(--fl-blue)); }
.fl-rule > i,
.fl-rule-lens {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}

/* Viewfinder: four corner brackets that frame whoever is in focus */
.fl-viewfinder {
    --_c: rgba(255, 255, 255, 0.78);
    --_l: 16px;
    --_w: 1.5px;
    position: relative;
}

.fl-viewfinder::before {
    content: '';
    position: absolute;
    inset: var(--_inset, 14px);
    z-index: 2;
    pointer-events: none;
    background:
        linear-gradient(var(--_c), var(--_c)) top left / var(--_l) var(--_w),
        linear-gradient(var(--_c), var(--_c)) top left / var(--_w) var(--_l),
        linear-gradient(var(--_c), var(--_c)) top right / var(--_l) var(--_w),
        linear-gradient(var(--_c), var(--_c)) top right / var(--_w) var(--_l),
        linear-gradient(var(--_c), var(--_c)) bottom left / var(--_l) var(--_w),
        linear-gradient(var(--_c), var(--_c)) bottom left / var(--_w) var(--_l),
        linear-gradient(var(--_c), var(--_c)) bottom right / var(--_l) var(--_w),
        linear-gradient(var(--_c), var(--_c)) bottom right / var(--_w) var(--_l);
    background-repeat: no-repeat;
    opacity: 0.8;
}

.fl-viewfinder.is-locked::before { animation: fl-lock var(--fl-dur-4) var(--fl-ease-out) both; }

/* --------------------------------------------------------------------------
   Rows, switches, status (account, settings, billing)
   .fl-list    a card of rows split by hairlines (add .fl-card for the surface)
   .fl-door    a row that is a door to another page: icon disc, title, one
               quiet line, chevron (.fl-door--danger for the destructive one)
   .fl-seg     a two-way segmented control on the old .theme-switch markup
               (.theme-option ×2 + .theme-slider; the page script toggles
               .active and puts a class on the switch for the second option)
   .fl-state   a status chip: a coloured dot and a mono word (.is-ok/.is-wait/.is-bad)
   -------------------------------------------------------------------------- */
.fl-list {
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.fl-list > * + * { border-top: 1px solid var(--fl-line); }

/* a row that is a door to another page */
.fl-door {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 72px;
    margin: 0;
    padding: 14px 18px 14px 16px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--fl-ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color var(--fl-dur-2) var(--fl-ease-out);
}

.fl-door__icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--fl-surface-2);
    box-shadow: inset 0 0 0 1px var(--fl-line);
    color: var(--fl-ink-2);
    transition: color var(--fl-dur-2) var(--fl-ease-out), background-color var(--fl-dur-2) var(--fl-ease-out);
}

.fl-door__icon::before,
.fl-door__chev {
    content: '';
    width: 20px;
    height: 20px;
    background: currentColor;
    -webkit-mask: var(--_icon) center / contain no-repeat;
    mask: var(--_icon) center / contain no-repeat;
}

.fl-door__text { display: grid; gap: 3px; min-width: 0; }

.fl-door__title {
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 0.002em;
    color: var(--fl-ink);
}

.fl-door__sub {
    font-size: var(--fl-text-small);
    line-height: 1.4;
    color: var(--fl-ink-3);
}

.fl-door__chev {
    width: 18px;
    height: 18px;
    color: var(--fl-ink-4);
    --_icon: var(--fl-i-chevron-right);
    transition: transform var(--fl-dur-3) var(--fl-spring), color var(--fl-dur-2) var(--fl-ease-out);
}

@media (hover: hover) {
    .fl-door:hover { background: var(--fl-surface-2); }
    .fl-door:hover .fl-door__icon { color: var(--fl-ink); background: var(--fl-surface-3); }
    .fl-door:hover .fl-door__chev { color: var(--fl-ink-2); transform: translateX(2px); }
}

.fl-door:active,
.fl-door.active-click { background: var(--fl-surface-2); }

.fl-door:focus:not(:focus-visible) { outline: none; }

.fl-door:focus-visible {
    outline: 2px solid var(--fl-blue) !important;
    outline-offset: -3px !important;
    border-radius: inherit;
}

/* first/last rows follow the card's corners when focused */
.fl-list > .fl-door:first-child { border-top-left-radius: inherit; border-top-right-radius: inherit; }
.fl-list > .fl-door:last-child { border-bottom-left-radius: inherit; border-bottom-right-radius: inherit; }

.fl-door--danger .fl-door__title { color: var(--fl-danger); }
.fl-door--danger .fl-door__icon { color: var(--fl-danger); background: var(--fl-danger-wash); box-shadow: none; }

@media (hover: hover) {
    .fl-door--danger:hover { background: var(--fl-danger-wash); }
    .fl-door--danger:hover .fl-door__icon { color: var(--fl-danger); background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fl-danger) 40%, transparent); }
}

/* Segmented control (the old .theme-switch markup: two .theme-option and a
   .theme-slider; the page script toggles .active and a class on the switch) */
.fl-seg {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 148px;
    height: 44px;
    padding: 3px;
    border: 1px solid var(--fl-line-2);
    border-radius: var(--fl-r-pill);
    background: var(--fl-surface-2);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
    isolation: isolate;
}

.fl-seg .theme-option {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    min-width: 0;
    margin: 0;
    padding: 0 6px;
    border: 0;
    border-radius: var(--fl-r-pill);
    background: transparent;
    color: var(--fl-ink-3);
    font-family: var(--fl-font-ui);
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0.005em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color var(--fl-dur-2) var(--fl-ease-out);
}

.fl-seg .theme-option.active { color: var(--fl-ink); cursor: default; }
.fl-seg .theme-option.disabled { color: var(--fl-ink-4); cursor: not-allowed; }

/* the options are 36px inside the 44px track: an invisible extension over
   the track's padding + border makes the whole 44px height tap */
.fl-seg .theme-option::after {
    content: '';
    position: absolute;
    top: -4px;
    right: 0;
    bottom: -4px;
    left: 0;
    border-radius: inherit;
}

@media (hover: hover) {
    .fl-seg .theme-option:not(.active):not(.disabled):hover { color: var(--fl-ink); }
}

.fl-seg .theme-option:focus:not(:focus-visible) { outline: none; }

.fl-seg .theme-slider {
    position: absolute;
    z-index: 0;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc(50% - 3px);
    border-radius: var(--fl-r-pill);
    background: var(--fl-surface-3);
    box-shadow: inset 0 0 0 1px var(--fl-line-3), var(--fl-highlight);
    transition: transform var(--fl-dur-3) var(--fl-spring-gentle);
    pointer-events: none;
}

html.theme-light .fl-seg .theme-slider {
    background: var(--fl-surface);
    box-shadow: inset 0 0 0 1px var(--fl-line), 0 1px 2px rgba(60, 38, 26, 0.12), 0 4px 12px -4px rgba(60, 38, 26, 0.18);
}

html.theme-dark .fl-seg { background: var(--fl-bg-raised); }

/* second option chosen */
.fl-seg:is(.is-second, .light, .request-no, .notification-off, .landing-no) .theme-slider { transform: translateX(100%); }

/* status chip: a coloured dot and a mono word */
.fl-state {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 26px;
    padding: 0 11px 0 9px;
    border-radius: var(--fl-r-pill);
    background: var(--fl-surface-2);
    box-shadow: inset 0 0 0 1px var(--fl-line);
    font-family: var(--fl-font-machine);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--fl-ink-2);
    white-space: nowrap;
}

.fl-state::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--fl-ink-4);
}

.fl-state.is-ok::before { background: var(--fl-success); }
.fl-state.is-wait::before { background: var(--fl-warning); }
.fl-state.is-bad { color: var(--fl-danger); }
.fl-state.is-bad::before { background: var(--fl-danger); }

@media (max-width: 420px) {
    .fl-seg { width: 132px; }
    .fl-door { padding-inline: 14px 16px; gap: 12px; }
}

/* --------------------------------------------------------------------------
   The AI at work: two rings that orbit and cross
   -------------------------------------------------------------------------- */
.fl-lens-loader {
    --_size: 44px;
    position: relative;
    width: calc(var(--_size) * 1.5);
    height: var(--_size);
    display: inline-block;
}

.fl-lens-loader::before,
.fl-lens-loader::after {
    content: '';
    position: absolute;
    top: 0;
    width: var(--_size);
    height: var(--_size);
    border-radius: 50%;
    border: 1.5px solid var(--fl-coral);
    left: 0;
    animation: fl-orbit-a 2.4s var(--fl-ease-in-out) infinite;
    will-change: transform;
}

.fl-lens-loader::after {
    border-color: var(--fl-blue);
    left: auto;
    right: 0;
    animation-name: fl-orbit-b;
}

@keyframes fl-orbit-a {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(calc(var(--_size) * 0.25)); }
}

@keyframes fl-orbit-b {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(calc(var(--_size) * -0.25)); }
}

/* the soft "thinking" dot */
.fl-pulse {
    position: relative;
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--fl-coral);
}

.fl-pulse::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: inherit;
    animation: fl-pulse 2s var(--fl-ease-out) infinite;
}

@keyframes fl-pulse {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(3.2); opacity: 0; }
}

/* --------------------------------------------------------------------------
   Notes: a small centred sheet on a scrim (js/fl-ui.js FL.note builds them)
   -------------------------------------------------------------------------- */
.fl-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--fl-scrim);
    animation: fl-fade var(--fl-dur-2) ease both;
}

.fl-overlay.is-leaving {
    opacity: 0;
    transition: opacity 180ms ease;
}

.fl-overlay > .fl-sheet {
    width: min(380px, 100%);
    padding: 30px 28px 26px;
    text-align: center;
    animation: fl-focus-in var(--fl-dur-3) var(--fl-ease-out) both;
}

.fl-overlay > .fl-sheet:focus,
.fl-overlay > .fl-sheet:focus-visible { outline: none !important; } /* beats theme-variables [tabindex]:focus-visible */
.fl-overlay .fl-display-m { margin: 12px 0 10px; font-size: 1.9rem; }
.fl-overlay .fl-body { margin: 0 0 24px; }
.fl-overlay__actions { display: flex; gap: 10px; }
.fl-overlay__actions > .fl-btn { flex: 1 1 0; min-width: 0; padding-inline: 18px; }
.fl-overlay .fl-body + .fl-body { margin-top: -12px; }
.fl-overlay__small { margin: 16px 0 0; color: var(--fl-ink-3); }

/* --------------------------------------------------------------------------
   Toasts: a quiet pill that confirms and leaves — FL.toast(text, { kind, ms,
   top }) in js/fl-ui.js, or <div class="fl-toast is-success|is-error|is-info">
   appended to <body>. The dot is the status light: green done, coral
   trouble, blue news. Bottom centre (the top is the pill bar); .is-top where
   the bottom is a composer. --fl-toast-ms sets how long it stays (4 s).
   -------------------------------------------------------------------------- */
.fl-toast {
    position: fixed;
    bottom: max(24px, calc(env(safe-area-inset-bottom, 0px) + 16px));
    left: 50%;
    z-index: 10001; /* over legacy page roots (#message-page is 1051) and notes (10000) */
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: max-content; /* left: 50% would otherwise halve its width */
    max-width: min(26rem, calc(100vw - 32px));
    padding: 12px 20px 12px 16px;
    border: 1px solid var(--fl-line-2);
    border-radius: 24px; /* a pill on one line, a soft card on two */
    background: var(--fl-surface);
    box-shadow: var(--fl-highlight), var(--fl-shadow-2);
    color: var(--fl-ink);
    font-family: var(--fl-font-ui);
    font-size: var(--fl-text-small);
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    pointer-events: none;
    animation: fl-toast var(--fl-toast-ms, 4s) var(--fl-ease-out) both;
}

.fl-toast.is-top {
    top: max(80px, calc(env(safe-area-inset-top, 0px) + 72px));
    bottom: auto;
}

.fl-toast::before {
    content: '';
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fl-ink-3);
}

.fl-toast.is-success::before { background: var(--fl-success); }
.fl-toast.is-error::before { background: var(--fl-coral); }
.fl-toast.is-info::before { background: var(--fl-blue); }

@keyframes fl-toast {
    0% { opacity: 0; transform: translate(-50%, 12px); }
    10%, 88% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, 6px); }
}

@keyframes fl-toast-fade {
    0%, 100% { opacity: 0; transform: translateX(-50%); }
    10%, 88% { opacity: 1; transform: translateX(-50%); }
}

/* --------------------------------------------------------------------------
   Empty / ended / error states, in place of a list that has nothing in it:
   <div class="fl-empty [is-error]">
     <span class="fl-eyebrow">Messages</span>
     <h2 class="fl-display-m">No conversations <em>yet.</em></h2>
     <p class="fl-body">…</p>
     <div class="fl-empty__actions"><button class="fl-btn">…</button></div>
   </div>
   Pages put it inside their legacy grids/containers: it spans every column.
   -------------------------------------------------------------------------- */
.fl-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 36rem;
    margin: clamp(24px, 8vh, 88px) auto 48px;
    padding: 0 var(--fl-gutter);
    text-align: center;
    color: var(--fl-ink);
}

.fl-empty::before {
    content: '';
    width: 34px;
    height: 20px;
    margin-bottom: 6px;
    background:
        radial-gradient(circle at 10px 50%, transparent 7.2px, var(--fl-coral) 7.4px, var(--fl-coral) 8.6px, transparent 8.9px),
        radial-gradient(circle at 24px 50%, transparent 7.2px, var(--fl-blue) 7.4px, var(--fl-blue) 8.6px, transparent 8.9px);
    opacity: 0.85;
}

.fl-empty.is-error::before { filter: grayscale(1); opacity: 0.4; }
.fl-empty .fl-eyebrow::before { content: none; }
.fl-empty .fl-display-m { margin: 0; text-wrap: balance; }
.fl-empty .fl-body { max-width: 30rem; margin: 0; color: var(--fl-ink-2); text-wrap: pretty; }

.fl-empty__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
}

/* Text for screen readers only (session 8): e.g. "Not included" beside a dash */
.fl-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* --------------------------------------------------------------------------
   Motion: the focus pull — content arrives soft and settles sharp
   -------------------------------------------------------------------------- */
@keyframes fl-focus-in {
    from { opacity: 0; filter: blur(10px); transform: translateY(10px) scale(1.012); }
    to { opacity: 1; filter: blur(0); transform: none; }
}

@keyframes fl-rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

@keyframes fl-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fl-lock {
    0% { transform: scale(1.08); opacity: 0; }
    55% { opacity: 1; }
    100% { transform: none; opacity: 0.8; }
}

@keyframes fl-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-2px); }
    80% { transform: translateX(1px); }
}

.fl-in { animation: fl-focus-in var(--fl-dur-4) var(--fl-ease-out) both; animation-delay: calc(var(--i, 0) * 70ms + var(--fl-delay, 0ms)); }
.fl-rise { animation: fl-rise var(--fl-dur-4) var(--fl-ease-out) both; animation-delay: calc(var(--i, 0) * 60ms + var(--fl-delay, 0ms)); }
.fl-shake { animation: fl-shake 420ms var(--fl-ease-out); }

/* --------------------------------------------------------------------------
   Grounds: grain + the one warm light
   -------------------------------------------------------------------------- */
.fl-grain::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: var(--fl-z-toast);
    pointer-events: none;
    opacity: var(--fl-grain-opacity);
    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='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 1.4 -0.3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 160px 160px;
}

.fl-ember {
    position: absolute;
    pointer-events: none;
    background: var(--fl-ember-light);
    border-radius: 50%;
}

/* --------------------------------------------------------------------------
   Page to page: a short soft cross-fade, the old page easing out of focus
   -------------------------------------------------------------------------- */
@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation: fl-vt-out 260ms var(--fl-ease-in) both;
}

::view-transition-new(root) {
    animation: fl-vt-in 380ms var(--fl-ease-out) both;
}

@keyframes fl-vt-out {
    to { opacity: 0; filter: blur(3px); }
}

@keyframes fl-vt-in {
    from { opacity: 0; }
}

/* a theme switch is its own view transition — the lens opening or closing
   at the switch — styled and driven by js/fl-theme-shift.js (html.fl-shift) */

/* --------------------------------------------------------------------------
   Global refinements (safe on every page)
   -------------------------------------------------------------------------- */
::selection { background: color-mix(in srgb, var(--fl-coral) 32%, transparent); color: inherit; }

:focus-visible {
    outline: 2px solid var(--fl-blue);
    outline-offset: 3px;
}

/* text fields show focus with their own coral halo, not a second ring */
:is(.fl-input, .fl-select, .fl-textarea):focus-visible { outline: none; }

@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }
    .fl-in,
    .fl-rise,
    .fl-shake,
    .fl-viewfinder.is-locked::before { animation: fl-fade 1ms both; }
    .fl-lens-loader::before,
    .fl-lens-loader::after,
    .fl-pulse::after { animation: none; }
    .fl-toast { animation-name: fl-toast-fade; }
    .fl-btn,
    .fl-btn::after,
    .fl-seg .theme-slider,
    .fl-door__chev { transition: none; }
}

/* ---------------------------------------------------------------------------
   Honeypot (session 6) - the field bots fill and people never see.
   Off-screen rather than display:none (form-filling bots skip hidden fields);
   tabindex=-1 + aria-hidden on the markup keep keyboards and screen readers out.
   --------------------------------------------------------------------------- */
.fl-hp {
    position: absolute !important;
    left: -10000px !important;
    top: auto !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ---------------------------------------------------------------------------
   Session 7: a note sheet's one quiet text link under its buttons
   (FL.note({ link }): "Report Riley" on the Block sheet; "Log out" on the
   quick-update sheet). Layered: legacy pages colour every link and button.
   --------------------------------------------------------------------------- */
@layer fl-skin {
    .fl-overlay .fl-overlay__link {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: max-content !important;
        max-width: 100% !important;
        min-height: 44px !important;
        margin: 10px auto -8px !important;
        padding: 0 14px !important;
        border: 0 !important;
        border-radius: var(--fl-r-pill) !important;
        background: transparent !important;
        box-shadow: none !important;
        color: var(--fl-ink-2) !important;
        font-family: var(--fl-font-ui) !important;
        font-size: 0.875rem !important;
        font-weight: 500 !important;
        letter-spacing: 0.005em !important;
        line-height: 1.3 !important;
        text-transform: none !important;
        text-decoration: underline !important;
        text-decoration-color: var(--fl-line-3) !important;
        text-underline-offset: 3px;
        cursor: pointer;
        transition: color var(--fl-dur-1) var(--fl-ease-out) !important;
    }

    @media (hover: hover) {
        .fl-overlay .fl-overlay__link:hover { color: var(--fl-ink) !important; text-decoration-color: currentColor !important; }
    }

    .fl-overlay .fl-overlay__link:focus:not(:focus-visible) { outline: none !important; }
    .fl-overlay .fl-overlay__link:focus-visible { outline: 2px solid var(--fl-blue) !important; outline-offset: 2px !important; }
}

/* ---------------------------------------------------------------------------
   Product pass session 2: choosing inside a sheet or a card.
   .fl-pick     a list of radio rows - one kind closing line
                (FLChat.closeSheet in js/fl-chat-ritual.js; the sheet gets
                .fl-sheet--pick for a little more width). A person's words to
                another person: the chosen row takes the coral wash.
   .fl-choices  a row of choice chips (.fl-choice) - the private "How did it
                go?" card. Answers for the machine: the chosen chip is ink.
   Both are native radios (arrow keys, screen readers) drawn over. Layered:
   legacy page CSS styles every label and input.
   --------------------------------------------------------------------------- */
@layer fl-skin {
    /* a tall sheet scrolls inside itself on a short phone (the scrim can't scroll) */
    .fl-overlay > .fl-sheet.fl-sheet--pick {
        width: min(460px, 100%);
        max-height: calc(100dvh - 32px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .fl-pick {
        display: grid;
        gap: 8px;
        margin: 2px 0 22px !important;
        text-align: left;
    }

    .fl-pick__row {
        position: relative;
        display: grid !important;
        grid-template-columns: 20px minmax(0, 1fr);
        align-items: start;
        gap: 12px;
        min-height: 52px;
        margin: 0 !important;
        padding: 14px 16px !important;
        border: 1px solid var(--fl-line-2) !important;
        border-radius: var(--fl-r-md) !important;
        background: var(--fl-surface-2) !important;
        color: var(--fl-ink) !important;
        cursor: pointer;
        transition: border-color var(--fl-dur-1) var(--fl-ease-out), background-color var(--fl-dur-1) var(--fl-ease-out) !important;
    }

    html.theme-light .fl-pick__row { background: var(--fl-bg) !important; }

    .fl-pick__input,
    .fl-choice__input {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        opacity: 0;
        pointer-events: none;
    }

    .fl-pick__mark {
        display: grid;
        place-items: center;
        width: 20px;
        height: 20px;
        margin-top: 1px !important;
        border: 1.5px solid var(--fl-line-3) !important;
        border-radius: 50% !important;
        transition: border-color var(--fl-dur-1) var(--fl-ease-out) !important;
    }

    .fl-pick__mark::after {
        content: '';
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: var(--fl-coral);
        transform: scale(0);
        transition: transform var(--fl-dur-2) var(--fl-spring);
    }

    .fl-pick__text {
        font-family: var(--fl-font-ui) !important;
        font-size: 0.9375rem !important;
        font-weight: 400 !important;
        line-height: 1.45 !important;
        letter-spacing: 0 !important;
        text-transform: none !important;
        color: inherit !important;
        text-wrap: pretty;
    }

    @media (hover: hover) {
        .fl-pick__row:hover { border-color: var(--fl-line-3) !important; }
    }

    .fl-pick__row:has(.fl-pick__input:checked) {
        border-color: color-mix(in srgb, var(--fl-coral) 55%, transparent) !important;
        background: color-mix(in srgb, var(--fl-coral) 10%, var(--fl-surface)) !important;
    }

    .fl-pick__input:checked + .fl-pick__mark { border-color: var(--fl-coral) !important; }
    .fl-pick__input:checked + .fl-pick__mark::after { transform: scale(1); }
    .fl-pick__row:has(.fl-pick__input:focus-visible) { outline: 2px solid var(--fl-blue) !important; outline-offset: 2px !important; }

    .fl-pick__error {
        margin: -10px 0 18px !important;
        font-family: var(--fl-font-ui) !important;
        font-size: var(--fl-text-small) !important;
        line-height: 1.45 !important;
        text-align: center;
        color: var(--fl-danger) !important;
    }

    .fl-pick__error[hidden] { display: none !important; }

    .fl-choices {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .fl-choice {
        position: relative;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center;
        min-height: 44px;
        margin: 0 !important;
        padding: 0 18px !important;
        border: 1px solid var(--fl-line-2) !important;
        border-radius: var(--fl-r-pill) !important;
        background: transparent !important;
        color: var(--fl-ink-2) !important;
        cursor: pointer;
        transition: border-color var(--fl-dur-1) var(--fl-ease-out), background-color var(--fl-dur-1) var(--fl-ease-out), color var(--fl-dur-1) var(--fl-ease-out), scale var(--fl-dur-2) var(--fl-spring) !important;
    }

    .fl-choice__text {
        font-family: var(--fl-font-ui) !important;
        font-size: 0.9375rem !important;
        font-weight: 500 !important;
        letter-spacing: 0 !important;
        line-height: 1.2 !important;
        text-transform: none !important;
        color: inherit !important;
    }

    @media (hover: hover) {
        .fl-choice:hover { border-color: var(--fl-line-3) !important; color: var(--fl-ink) !important; }
    }

    .fl-choice:active { scale: 0.97; }

    .fl-choice:has(.fl-choice__input:checked) {
        border-color: var(--fl-ink) !important;
        background: var(--fl-ink) !important;
        color: var(--fl-ink-inverse) !important;
    }

    .fl-choice:has(.fl-choice__input:focus-visible) { outline: 2px solid var(--fl-blue) !important; outline-offset: 3px !important; }
}

@media (prefers-reduced-motion: reduce) {
    .fl-pick__mark::after { transition: none; }
}
