/* ==========================================================================
   Place of Padel — Design Tokens

   Two layers:
   1. Brand palette, in hex, exactly as the printed branding kit specifies.
      These are identity and are not re-derived.
   2. Everything built on top, in OKLCH, tinted toward the forest hue so no
      neutral is ever truly neutral.
   ========================================================================== */

/* ==========================================================================
   Faces

   Self-hosted rather than linked from Google, which cost two extra origins and
   a render-blocking stylesheet before first paint. Both are the variable latin
   subset — one file each covering every weight the page uses, 62KB for the
   pair. The unicode-range is Google's own latin set: it covers the accented
   characters the copy actually needs (café) and the punctuation the type
   system leans on (· — ').

   These live here rather than in a separate fonts.css so they cost no extra
   request: tokens.css is already the first stylesheet in the document.
   ========================================================================== */

@font-face {
  font-family: "Cinzel";
  src: url("../assets/fonts/cinzel-latin-var.woff2") 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: "Montserrat";
  src: url("../assets/fonts/montserrat-latin-var.woff2") format("woff2");
  font-weight: 300 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;
}

/* --------------------------------------------------------------------------
   Metric-matched fallbacks

   Both faces are font-display: swap, so every first view renders in a fallback
   and then reflows. Nothing here uses a metric line-height — every line-height
   on the page is a unitless number — so the swap does not change any line's
   height. What it changes is where lines BREAK: the fallbacks are 6-10% narrower
   per character, so a paragraph set to fall in three lines in Montserrat can
   take four in Arial. The hero body is a centred stack, so one extra line in the
   lede moved the lockup about 14px, and the curtain's mark had to glide to catch
   up with it.

   These faces fix the cause. Each one adopts a specific local font and then
   overrides its metrics to the web font's, so the fallback occupies the same
   space and breaks in the same places. Measured in Chrome with canvas
   TextMetrics at 1000px: average advance over a mixed 74-character sample for
   size-adjust, fontBoundingBox ascent and descent for the overrides, both
   divided by size-adjust because the overrides are read against the adjusted em.

       face                     size-adjust   ascent   descent
       Cinzel / Times New Roman     110.09%    88.66%    33.79%
       Cinzel / Noto Serif          103.83%    94.00%    35.83%
       Montserrat / Arial           107.80%    89.80%    23.28%
       Montserrat / Noto Sans       108.02%    89.61%    23.24%

   Two per face, because one set of numbers only fits one fallback. Arial and
   Times New Roman are metric-compatible with Helvetica and Times, which covers
   Windows, macOS and iOS; the Noto pair covers Android, where naming them in
   local() also picks them over Roboto, which is a font this page cannot measure
   and therefore should not pretend to have matched.

   The size-adjust is measured at the weight each face actually carries most of
   the page in: 600 for Cinzel, which is set semibold in every title but one,
   and 400 for Montserrat, whose multi-line body copy is where the wrapping
   risk is. One value cannot serve every weight — Cinzel against Times New Roman
   is 1.1200 at 400 and 1.1009 at 600 — so it is set where it does the most good
   rather than averaged into fitting nowhere.

   line-gap-override is 0% on all four. Every line-height on this page is a
   unitless number, so the line gap contributes nothing to layout; declaring it
   keeps the fallback from inheriting the local font's own gap and is one less
   variable across platforms.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: "Cinzel Fallback";
  src: local("Times New Roman"), local("Times"), local("Liberation Serif");
  size-adjust: 110.09%;
  ascent-override: 88.66%;
  descent-override: 33.79%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Cinzel Fallback Noto";
  src: local("Noto Serif");
  size-adjust: 103.83%;
  ascent-override: 94.00%;
  descent-override: 35.83%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Montserrat Fallback";
  src: local("Arial"), local("Helvetica"), local("Liberation Sans");
  size-adjust: 107.80%;
  ascent-override: 89.80%;
  descent-override: 23.28%;
  line-gap-override: 0%;
}

@font-face {
  font-family: "Montserrat Fallback Noto";
  src: local("Noto Sans");
  size-adjust: 108.02%;
  ascent-override: 89.61%;
  descent-override: 23.24%;
  line-gap-override: 0%;
}

:root {
  /* ---- 1. Brand palette (identity, from the branding kit) ----
     Kept complete even where this page doesn't use every entry: these are the
     brand's colours, not this page's. ---- */
  --pop-forest: #113E32;   /* primary brand green */
  --pop-pine:   #0B2A22;   /* darkest green, near-black backgrounds */
  --pop-sage:   #4A6B53;   /* muted mid green */
  --pop-mist:   #D8E3D7;   /* pale green tint */
  --pop-cream:  #F2EFE9;   /* warm off-white, primary light surface */
  --pop-brass:  #C2A35B;   /* metallic gold accent */
  --pop-lime:   #CBD96A;   /* bright chartreuse highlight (sparingly) */

  /* ---- 2. Derived, in OKLCH ---- */

  /* Grounds. The page steps between these rather than sitting on one flat
     colour — each band gets its own footing. */
  --ground-deep:   oklch(0.22 0.035 165);   /* below pine: hero base, footer */
  --ground-base:   oklch(0.26 0.040 165);   /* pine */
  --ground-light:  oklch(0.95 0.010 92);    /* cream, kept for the feed mounts */

  /* Three grounds, not one. The page ran --ground-deep from the club band all
     the way to the footer, which put a single value under a five-chapter
     narrative. The scale is the kit's own greens, and it finally spends the
     two the page had defined and never used:

       deep   pine, below the kit's darkest green: hero, club, footer
       mid    --pop-forest, the PRIMARY brand green, which appeared nowhere
       invite --pop-mist, the kit's pale green tint, for the one panel that
              inverts. Mist rather than cream on purpose: the brief rejects
              "cream/sand standing in for premium", and this is a green light,
              not a beige one. */
  --ground-mid:    oklch(0.310 0.048 164);
  --ground-invite: oklch(0.895 0.021 148);

  /* Ink. Light type on dark reads lighter than it is, so the muted steps sit
     higher than they would on a light ground. */
  --ink-bright: oklch(0.96 0.012 95);
  --ink-body:   oklch(0.88 0.014 130);
  --ink-muted:  oklch(0.745 0.020 150);     /* ≥4.5:1 on --ground-base */
  --ink-faint:  oklch(0.640 0.020 150);     /* large text and rules only */
  --ink-onlight:       oklch(0.32 0.045 165);
  /* Ink for the invitation panel. Pine at two weights, never a grey: grey type
     on a tinted ground reads as washed out rather than quiet. */
  --ink-oninvite:       oklch(0.30 0.045 164);
  --ink-oninvite-quiet: oklch(0.40 0.035 158);

  --accent-deep: oklch(0.62 0.085 82);

  /* Rules. Brass for structure that carries meaning, cream for quiet division. */
  --rule-brass:       oklch(0.72 0.09 85 / 0.34);
  --rule-brass-firm:  oklch(0.72 0.09 85 / 0.62);
  --rule-quiet:       oklch(0.95 0.01 92 / 0.14);
  --rule-onlight:     oklch(0.32 0.045 165 / 0.18);
  --rule-oninvite:      oklch(0.30 0.045 164 / 0.22);
  --rule-oninvite-firm: oklch(0.52 0.075 82 / 0.60);

  /* Brass at 0.72 is a 2:1 on any light ground. Stepped down in lightness,
     same hue, for labels on the invitation panel. */
  --accent-onlight: oklch(0.45 0.07 80);

  /* Structural tint. Every hairline AND every texture on the page was brass,
     which spent the one accent on things that are not the ask. The textures
     take sage instead, so brass means "this is the invitation" again. */
  --tint-sage:      oklch(0.58 0.050 152 / 0.42);
  --tint-sage-soft: oklch(0.58 0.050 152 / 0.30);

  /* ---- Colour roles ----

     Brass had been doing every job on the page at once: labels, hairlines, the
     CTA fill, the crest, textures, hover, both progress bars and error text.
     A colour that means everything means nothing, which is why an error read
     as a section heading. Three roles now, and each keeps to its own work.

     BRASS   structure and brand. Labels, rules, borders, the CTA, the crest,
             the dot and court-line textures. Unchanged.
     LIME    position and live state: where you are and what is advancing. It
             is also, not coincidentally, the colour a padel court actually is,
             which is why the twelve courts on the floor plan carry it.
     ALERT   something needs attention. Errors only, nothing else, ever. ---- */

  /* Two alerts, because the page has two grounds. Warm, so it stays inside the
     forest/brass/cream temperature rather than importing a foreign crimson,
     and far enough off brass in hue (42 against 85) to be unmistakable.

     Measured against brass, though, --alert-ondark is 1.01:1. That is a hue
     difference and nothing else, so it is invisible to a red-green colour
     blind visitor. Colour therefore never carries the error on its own: the
     field it belongs to also takes an alert-coloured rule, and the message is
     a sentence that was not there a moment ago. Colour reinforces; it does not
     inform. */
  --alert-ondark:  oklch(0.74 0.15 42);
  --alert-onbrass: oklch(0.34 0.14 32);

  /* The one dissonant note.

     The palette is Committed: forest carries the surface, brass carries every
     accent. That is exactly what "premium padel club" predicts, and the page
     was landing on the prediction, with --pop-lime defined in the kit and used
     zero times.

     It is used twice now, and only where it means something: the focus ring,
     and the twelve court fills on the floor plan. Both are instrumentation
     rather than decoration, which is how a chartreuse survives next to brass
     without fighting it. The kit's own note on this colour is "sparingly". */
  --ring-focus: var(--pop-lime);

  /* The dark that type sits on when it sits on a picture. Every scrim in the
     chapters is this one ink at different alphas, rather than each gradient
     inventing a lightness of its own: there were two near-identical values
     doing this job before it was named. The hero keeps its own three-step
     ramp, which is a deliberate ramp rather than drift. */
  --scrim-ink: 0.20 0.035 165;

  /* Brass is a light surface, so it needs its own ink and its own field. The
     page's --ink-* scale is all light-on-dark and none of it works here. */
  --ink-onbrass:  oklch(0.28 0.04 165);
  --field-onbrass: oklch(0.98 0.01 92 / 0.72);
  --field-onbrass-edge: oklch(0.28 0.04 165 / 0.28);

  /* ---- Type ---- */
  /* The matched faces sit directly behind each web font: they ARE the local
     fallbacks, metric-corrected. The raw families stay at the end of each
     stack for anything neither face can adopt. */
  --font-display: "Cinzel", "Cinzel Fallback", "Cinzel Fallback Noto",
                  "Times New Roman", serif;
  --font-body: "Montserrat", "Montserrat Fallback", "Montserrat Fallback Noto",
               "Helvetica Neue", Arial, sans-serif;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* Modular scale, every step ≥1.25 from the last. The hero is deliberately
     far off the top of the scale — it is the one typographic risk on the page. */
  --fs-hero:    clamp(3rem, 10.4vw, 9.25rem);
  --fs-section: clamp(1.75rem, 3.6vw, 3rem);
  --fs-entry:   clamp(1.25rem, 1.9vw, 1.75rem);
  --fs-lede:    clamp(1.0625rem, 1.15vw, 1.25rem);
  --fs-body:    1rem;
  --fs-small:   0.875rem;
  --fs-label:   0.75rem;

  --lh-hero: 0.92;
  --lh-tight: 1.15;
  --lh-body: 1.6;      /* light-on-dark gets the extra breathing room */

  --ls-hero:  0.02em;
  --ls-caps:  0.14em;
  --ls-label: 0.26em;

  /* ---- Space. Fluid, and deliberately uneven: groups bind tight, bands
     separate wide. ---- */
  --gap-hair: 0.5rem;
  --gap-tight: 0.875rem;
  --gap-close: 1.25rem;
  --gap-step: 2rem;
  --gap-wide: clamp(3rem, 6vw, 5.5rem);
  --band-y: clamp(4.5rem, 9vw, 8.5rem);
  --gutter: clamp(1.25rem, 4.2vw, 4.5rem);

  --measure: 46ch;          /* body copy never runs past this */
  --shell: 1320px;

  --radius-sm: 3px;
  --radius-pill: 999px;

  /* ---- Scroll depth. One scale, so a layer's rate is a token rather than a
     number typed into a keyframe. Signed: positive falls behind the scroll,
     negative outruns it, and that sign is the whole of the direction.

     Seeded with the exact rates the page already used, so naming them changed
     nothing. Retuning is a separate, deliberate decision. ---- */
  --depth-hair:  0.030;   /* textures: string dots, court lines */
  --depth-soft:  0.045;   /* a render shifting inside its frame. Unused since
                             the carousel went: kept deliberately, because a
                             scale with its middle rung missing is worse than
                             one rung nothing currently reads. */
  --depth-far:   0.090;   /* the hero footage, falling behind */
  --depth-near: -0.220;   /* the hero words, outrunning it */

  /* The scroll a pinned chapter stage spends before it releases. */
  /* Where a chapter's motion finishes, as a fraction of its pinned window.

     It used to finish at 1.0, which is the frame the sticky stage unsticks: the
     settled composition existed for zero pixels of scroll, and one wheel notch
     carried you from "still moving" straight into the section leaving. Ending
     early leaves the rest of the window as a hold, where the finished thing sits
     still and can be looked at before it goes.

     Two values because the runways differ. At 0.72 a chapter holds about 350px;
     the gallery, whose runway is nearly twice as long, would hold 680px on its
     last plate, which is longer than anyone wants to sit there. 0.86 gives it a
     comparable beat in real scroll rather than a proportional one. */
  --px-hold: 0.72;
  --px-hold-gallery: 0.86;

  --pin-long: 240svh;

  /* The gallery is four screens wide, so its runway is longer: one viewport to
     arrive plus roughly one per image after the first. Change the image count
     and this is the number to change with it. */
  --pin-gallery: 370svh;

  /* How far a chapter plate is overscaled at the top of its runway. It settles
     to rest by the bottom, so the room opens out as you descend into it. Held
     deliberately low: past about 0.2 the softness of an upscaled render starts
     to show, and the movement stops reading as a camera and starts reading as
     an effect. */
  --depth-plate: 0.16;

  /* How far chapter type travels up into place. Short — it arrives early and
     then holds, so it can be read for most of the chapter rather than moving
     the whole time it is on screen. */
  --rise-from: 3rem;

  /* Every moving layer overhangs its clip box by this much, so drift can never
     expose an edge. The renders already use it; it is a token now so the next
     layer doesn't have to rediscover the number. */
  --mask-inset: -6%;

  /* ---- Motion. Exponential ease-out only; nothing overshoots. ---- */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  /* How far a control gives under a press. Small on purpose: the page's motion
     principle is choreographed, not springy, and a button that travels far
     reads as a toy. */
  --press: 1px;

  --dur-fast: 160ms;
  --dur-base: 320ms;
  --dur-slow: 620ms;
}
