/* Fliq site tokens. Palette from Victor's booklet (page 34) and social/Fliq Design Pack/01_Brand/Palette/fliq-colours.css;
   roles from docs/review/new-plan.md A5. Phone first: every size is set for a 375 px screen and grows with clamp().
   Nothing in here is page-specific; sections read these and never redefine them.

   Surfaces: each section sits on one flat field and names it with a class from base.css (.surface-flick, -lavender,
   -ice, -deep, -paper). The class sets the field colour and re-points the role tokens below (--text, --head, --muted,
   --rule, --accent, --label, --focus, the button, the field, --error, --done), so shared parts (buttons, the form,
   captions, labels) come out right on any surface without a section restyling them. */

/* ─── Fonts (docs/review/new-plan.md 3.2), self-hosted from the @fontsource-variable packages (scripts/build.mjs):
   Noto Sans for headlines (the booklet's tagline face, page 28, at its bold), Space Grotesk 600 for captions (the logo
   face, pages 26–27), Inter for body and labels (the booklet's primary face, pages 29–30). Latin subset, weight axis;
   Noto Sans and Inter also in Cyrillic for the Russian page. Space Grotesk has no Cyrillic, so in Russian the captions
   are set in Inter at the same weight (--font-caption below). */
@font-face {
  font-family: "Noto Sans";
  src: url("/assets/fonts/noto-sans.woff2") format("woff2");
  font-weight: 100 900; 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 {   /* Cyrillic (the Russian page, 18 Nov): fetched only when the page has Cyrillic text */
  font-family: "Noto Sans";
  src: url("/assets/fonts/noto-sans-cyrillic.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("/assets/fonts/space-grotesk.woff2") format("woff2");
  font-weight: 300 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter.woff2") format("woff2");
  font-weight: 100 900; 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: "Inter";
  src: url("/assets/fonts/inter-cyrillic.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* Metric-matched fallbacks, so the swap to the web font moves nothing. Vertical metrics are the fonts' own (hhea =
   typo, read from the woff2 files; line gap 0 in all three), divided by size-adjust, which scales them too. Widths were
   measured in Chrome on 16 Nov 2026 (canvas measureText at 100 px against Arial, on the page's own strings: the tagline,
   the supporting line, the captions, the labels), one face per weight the page sets, bold against Arial Bold so the
   browser never fakes a bold. Space Grotesk 400 keeps its 13 Nov numbers. */
@font-face {   /* headlines: Noto Sans 700 is 104.3–105.8% of Arial Bold; the tagline 104.8% */
  font-family: "Noto Sans Fallback"; font-weight: 600 900;
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Helvetica Neue Bold"), local("HelveticaNeue-Bold");
  size-adjust: 104.8%; ascent-override: 102%; descent-override: 28%; line-gap-override: 0%;
}
@font-face {
  font-family: "Noto Sans Fallback"; font-weight: 100 500;
  src: local("Arial"), local("ArialMT"), local("Helvetica Neue"), local("Helvetica");
  size-adjust: 105.5%; ascent-override: 101.3%; descent-override: 27.8%; line-gap-override: 0%;
}
@font-face {   /* captions: Space Grotesk 600 is 100.4–102.2% of Arial Bold */
  font-family: "Space Grotesk Fallback"; font-weight: 600 900;
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Helvetica Neue Bold"), local("HelveticaNeue-Bold");
  size-adjust: 101.6%; ascent-override: 96.85%; descent-override: 28.75%; line-gap-override: 0%;
}
@font-face {
  font-family: "Space Grotesk Fallback"; font-weight: 100 500;
  src: local("Arial"), local("ArialMT"), local("Helvetica Neue"), local("Helvetica");
  size-adjust: 108%; ascent-override: 90.7%; descent-override: 26.9%; line-gap-override: 0%;
}
@font-face {   /* body: Inter 400 is 106.3–107.2% of Arial; the supporting line 107.2% */
  font-family: "Inter Fallback"; font-weight: 100 450;
  src: local("Arial"), local("ArialMT"), local("Helvetica Neue"), local("Helvetica");
  size-adjust: 107.1%; ascent-override: 90.45%; descent-override: 22.5%; line-gap-override: 0%;
}
@font-face {   /* labels at 500: 107.2–108.3% of Arial */
  font-family: "Inter Fallback"; font-weight: 451 599;
  src: local("Arial"), local("ArialMT"), local("Helvetica Neue"), local("Helvetica");
  size-adjust: 108.1%; ascent-override: 89.6%; descent-override: 22.3%; line-gap-override: 0%;
}
@font-face {   /* buttons and strong labels at 600–700: 100.7–102.2% of Arial Bold */
  font-family: "Inter Fallback"; font-weight: 600 900;
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Helvetica Neue Bold"), local("HelveticaNeue-Bold");
  size-adjust: 101.2%; ascent-override: 95.7%; descent-override: 23.85%; line-gap-override: 0%;
}

/* The story line's x is a real length (registered), so a script reads it back in px:
   parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--line-x")), or lineX() from site.js. */
@property --line-x { syntax: "<length>"; inherits: true; initial-value: 28px; }
@property --line-w { syntax: "<length>"; inherits: true; initial-value: 6px; }

:root {
  /* ─── Palette (A5). Lime means "for you, now" only: the visitor's city, the ring, the branches, new developments
     and the button. It is never text, and on a light field it always has a deep edge (--lime-edge). */
  --flick: #800080;     /* PurpleFlick: the opening, sign-up, footer, both bars, the story line */
  --lavender: #D3CAFF;  /* the scene's field; the globe's land dots */
  --ice: #CEE7FD;       /* catch-up; AI slips */
  --deep: #320965;      /* labels on light, the bookmark, the mission's night, button text on lime */
  --navy: #11256A;      /* text on ice; the mission's building */
  --lime: #C9FA85;      /* "for you, now" */
  --blush: #FDE1FD;     /* posts; error text on purple */
  --paper: #FFF9FF;     /* off-white: news paper, the backing plate */
  --nova: #667DFF;      /* the mission's world only, sparingly, never text */
  --ink: #14061F;       /* outlets' headlines on paper */
  --white: #FFFFFF;
  --lime-edge: var(--deep);   /* the edge lime needs on any light field (lime on lavender is 1.28:1, on ice 1.06:1) */
  --edge: 1.5px;              /* that edge's width, and the paper's */


  /* ─── Type (3.2) */
  /* Chinese (17 Nov): no CJK web font is shipped. Each stack ends in the system's Traditional Chinese faces, after the
     Latin face and its metric-matched fallback, so Latin, digits and punctuation keep the brand faces and every Han
     character falls through, glyph by glyph, to Noto Sans TC, PingFang HK or Microsoft JhengHei. */
  --font-cjk: "Noto Sans TC", "PingFang HK", "PingFang TC", "Microsoft JhengHei", "Heiti TC", sans-serif;
  --font-head: "Noto Sans", "Noto Sans Fallback", "Helvetica Neue", Arial, var(--font-cjk);
  --font-caption: "Space Grotesk", "Space Grotesk Fallback", "Helvetica Neue", Arial, var(--font-cjk);
  --font-body: "Inter", "Inter Fallback", "Helvetica Neue", Arial, var(--font-cjk);

  /* The tagline: 34 px at 320, 40 at 375 (two lines, A2), 88 at 1440 (A3); the second step is in the media query below. */
  --t-h1: clamp(2.125rem, 10.91vw - 0.056rem, 2.5rem);
  --t-h2: clamp(1.875rem, 1.4rem + 2.6vw, 3.75rem);     /* 30 at 320, 32 at 375, 60 at 1440: a section's one headline */
  --t-h3: clamp(1.375rem, 1.1rem + 1.2vw, 2.25rem);     /* 22 → 36 */
  --t-cap: clamp(1.5rem, 1.1rem + 2vw, 3rem);           /* 24 at 320, 25 at 375, 46 at 1440: a scene's caption */
  --t-lead: clamp(1.125rem, 1rem + 0.6vw, 1.5rem);      /* 18 → 24: the supporting line */
  --t-body: 1rem;                                       /* 16 */
  --t-label: 0.9375rem;                                 /* 15: labels on the scene and catch-up */
  --t-small: 0.9375rem;                                 /* 15 */
  --t-tiny: 0.8125rem;                                  /* 13: "Illustrative", sources, the legal line; the floor */

  --lh-h1: 1.1;  --ls-h1: -0.02em;
  --lh-h2: 1.1;  --ls-h2: -0.018em;
  --lh-h3: 1.15; --ls-h3: -0.012em;
  --lh-cap: 1.12; --ls-cap: -0.015em;

  /* ─── Space */
  --gutter: clamp(1rem, 0.6rem + 2.4vw, 3rem);          /* 17–19 px on a phone, 44 at 1440 */
  --max: 90rem;                                         /* 1440 */
  --measure: 36rem;                                     /* reading width */
  --section: clamp(4.5rem, 3rem + 7vw, 10rem);          /* vertical rhythm for an unpinned section */
  --gap: clamp(1rem, 0.8rem + 1vw, 1.75rem);
  --bar-h: 4rem;                                        /* 64 on phones, 72 from 900 px (below): the lockup keeps half its height clear */
  --bar-top: calc(var(--bar-h) + env(safe-area-inset-top));   /* where a pinned stage's top sits */
  --joinbar-h: calc(3rem + 2 * 0.5rem);                 /* the phone join bar: a 48 px button with 8 px of purple round it */

  /* ─── The story line (2.2, 2.3): one purple line from the scene into catch-up at the same x.
     --line-x is the line's centre, measured from the viewport's left edge; --line-w its stroke. --page-w is the page's
     width without a classic scrollbar (site.js sets it; 100vw until then). --wrap-x and --wrap-w are the content box of
     .wrap, from the same edge. Phones: just inside the gutter. From 900 px: 40% across the content, the left edge of the
     scene's art (captions sit left of it). Use it as `translate: calc(var(--line-x) - var(--line-w) / 2) 0` (left: 0) on an element whose
     containing block starts at the viewport's left edge (a full-bleed section, or a fixed stage). */
  --page-w: 100vw;
  --wrap-x: calc(max(0px, (var(--page-w) - var(--max)) / 2) + var(--gutter));
  --wrap-w: calc(min(var(--page-w), var(--max)) - 2 * var(--gutter));
  --line-x: calc(var(--wrap-x) + 0.75rem);   /* rounded to a whole px below, where the browser has round() */
  --line-w: 6px;

  /* ─── Shape and depth */
  --radius: 14px;
  --radius-lg: 22px;                                    /* the backing plate (A3) */
  --pill: 999px;
  --shadow-paper: 0 1px 1px rgb(20 6 31 / 0.08), 0 10px 24px -12px rgb(20 6 31 / 0.28);
  --shadow-lift: 0 2px 3px rgb(20 6 31 / 0.14), 0 26px 50px -20px rgb(20 6 31 / 0.45);

  /* ─── Motion */
  --ease: cubic-bezier(0.22, 0.9, 0.25, 1);
  --fast: 160ms;
  --mid: 320ms;
  --swap: 400ms;                                        /* a caption swap (A1) */

  /* ─── Texture, for paper objects only (site.js sets the size so each noise pixel is one physical pixel).
     Surfaces are flat (brief rule 1). */
  --grain: url("/assets/grain.png");
  --grain-size: 128px;
  --grain-opacity: 0.5;
  --grain-light: url("/assets/grain-light.png");   /* white specks, for the purple and deep fields */
  --grain-light-opacity: 0.45;

  color-scheme: light;
}

/* ─── Roles, as on the default (off-white paper) surface. The same defaults start every .surface-* (so a paper
   plate inside the purple opening gets ink type again, not the white it would inherit); each .surface-* class in
   base.css then re-points what differs on its field. */
:root, .surface-flick, .surface-lavender, .surface-ice, .surface-deep, .surface-paper {
  --bg: var(--paper);
  --text: var(--ink);
  --head: var(--deep);
  --label: var(--deep);
  --muted: rgb(20 6 31 / 0.66);      /* 6.39:1 on paper */
  --faint: rgb(20 6 31 / 0.5);       /* large text and non-essential marks only */
  --rule: rgb(20 6 31 / 0.14);       /* hairlines */
  --rule-strong: rgb(20 6 31 / 0.28);
  --accent: var(--flick);            /* Fliq's marks: the dateline rule, rings, a claim's state */
  --line: var(--flick);              /* the story line */
  --link: var(--deep);
  --focus: var(--flick);             /* the focus ring: 2 px at a 3 px offset */
  --select-bg: var(--lavender); --select-fg: var(--deep);
  --btn-bg: var(--deep); --btn-fg: var(--white); --btn-hover-bg: var(--flick); --btn-hover-fg: var(--white); --btn-edge: transparent;
  --field-bg: var(--white); --field-text: var(--ink); --field-edge: rgb(20 6 31 / 0.48);   /* 3:1 on white (WCAG 1.4.11) */
  --placeholder: rgb(20 6 31 / 0.6);  /* 5.2:1 on the white field */
  --error: #A3123F;                  /* 7.46:1 on paper, 5.03 on lavender, 6.07 on ice */
  --done: var(--deep);
  --lime-ring: var(--lime-edge);     /* the edge a lime button or mark takes on this field */
  --mine-fg: currentColor; --mine-band: 0.42em; --mine-y: 90%; --mine-pad: 0 0.06em;   /* .mine: lime behind the words */
}

@media (min-width: 30rem) {
  :root { --t-h1: clamp(2.5rem, 1rem + 5vw, 5.5rem); }  /* 40 at 480, 54 at 768, 88 at 1440 */
}
@media (min-width: 56.25rem) {
  :root {
    --bar-h: 4.5rem;                                    /* 72: the 86 × 33 lockup with 19 px clear above and below */
    --line-x: calc(var(--wrap-x) + var(--wrap-w) * 0.4);
    --line-w: 8px;
  }
}
/* The story line's x, rounded to a whole px: with an even stroke its edges then fall on whole px, so the scene's SVG
   line and catch-up's HTML segments are drawn alike, with no soft or doubled edge where they meet on a 1x screen.
   Behind @supports, because a custom property is not checked when it is parsed: in a browser without round() the
   rounded value would be invalid when used and fall back to the registered 28px, not to the plain value above. */
@supports (width: round(nearest, 1px, 1px)) {
  :root { --line-x: round(nearest, calc(var(--wrap-x) + 0.75rem), 1px); }
  @media (min-width: 56.25rem) { :root { --line-x: round(nearest, calc(var(--wrap-x) + var(--wrap-w) * 0.4), 1px); } }
}
