/* GILDE · THE GRID CONTRACT
   =========================
   Every number in this site is declared here once. Nothing downstream invents a value.
   If a section needs something not in this file, the answer is either "use the nearest
   token" or "we are adding a token on purpose", never a one-off number.

   Verify with:  python3 tools/grid-check.py
*/

:root{

  /* ---------- SPACING · strict 8px grid ----------
     Allowed sub-grid values: 4px and 2px (hairlines, optical nudges). Nothing else. */
  --space-1:   8px;
  --space-2:  16px;
  --space-3:  24px;
  --space-4:  32px;
  --space-5:  40px;
  --space-6:  48px;
  --space-8:  64px;
  --space-10: 80px;
  --space-12: 96px;

  /* ---------- SECTION RHYTHM ----------
     A section carries HALF its rhythm as padding, top and bottom, so any two
     stacked sections always sum to the full value and reordering stays free. */
  --rhythm-s: 48px;   /* 96 total  */
  --rhythm-m: 64px;   /* 128 total */
  --rhythm-l: 96px;   /* 192 total */

  /* ---------- LAYOUT · the studio grid contract ----------
     These are the studio's numbers, not this project's. This build had drifted:
     a 1140 container, breakpoints at 900/560, and no column count at all. With no
     columns declared, every section placed itself with its own max-width and the
     bloom sat on an arbitrary percentage, so nothing on the page was related to
     anything else. That is the disharmony, and it is structural, not visual. */
  --container-max: 1440px;  /* outer bound of every section           */
  --margin:          64px;  /* outside margin, desktop                */
  --gutter:          24px;  /* space between columns                  */
  --columns:           12;  /* the whole point                        */

  --measure-prose: 784px;   /* centred reading column */
  --radius:         8px;
  --hairline:       1px;

  /* ---------- COLOR · 60 / 30 / 10 ----------
     60 dominant .. ink black / bone paper  (backgrounds)
     30 secondary .. marble / pine          (content)
     10 accent .. gold                      (the pop, used sparingly)

     Measured WCAG ratios in comments. Computed, not eyeballed. */

  /* Delft Deep, and it is measured, not inherited. The old Legacy palette is not
     binding here; this ground was chosen against the asset itself.

     The bloom samples at hue 15deg and the gold at 32deg, so the two are
     ANALOGOUS — only 17deg apart, one warm family. That means they share a
     single complement, near 203deg, and a ground there opposes both at once.
     A warm ground would have put the bloom and the gold in the same family as
     the background and let all three sink together; this one lifts them.

     One dark, not two. There was briefly a second green a shade deeper under the
     footer, which defeated the point: a palette does not get smaller by adding a
     colour nobody can name. The footer is separated by a hairline and by the
     lift, so it does not need a ground of its own. */
  --ink:        #071216;   /* Delft Deep · 195deg · the only dark ground */
  --paper:      #FBFAF4;   /* map section ground                     */
  --paper-pure: #FFFFFF;

  /* Recomputed against Delft Deep. Every pair clears AA, tightest 6.50 — which is
     better than the green ground scored, not a compromise for it. */
  --gold:       #C18D52;   /*  6.50 on ink · PASS                    */
  --gold-light: #E8C37E;   /* 11.33 on ink · PASS                    */
  --marble:     #EEE8B2;   /* 15.19 on ink · PASS                    */
  --pine:       #203B37;   /* 11.53 on paper · PASS                  */
  --graphite:   #0B0B0B;   /* 18.82 on paper · PASS                  */
  --umber:      #8A5E28;   /*  5.41 on paper · PASS (map eyebrow)    */
  --gold-ink:   #3A2A10;   /*  4.74 on gold  · PASS (button label)   */

  /* Text opacity steps. These are the ONLY alphas used on text, because each
     one has been measured. 0.42 was removed: it landed at 3.48 and fails
     small text. The floor for body copy is --alpha-muted. */
  --alpha-strong: 0.82;    /* 12.75 on ink · 11.57 on paper · PASS   */
  --alpha-body:   0.72;    /* 10.04 on ink · PASS                    */
  --alpha-muted:  0.58;    /*  6.77 on ink · PASS                    */

  /* Non-text only. Never put copy on these. */
  --line-gold:  rgba(193,141,82,0.30);
  --line-warm:  rgba(238,232,178,0.20);

  /* ---------- TYPE ----------
     Two families. Fraunces carries display, DM Sans carries everything read.
     Four sizes total, per the locked scale. Anything new argues against this list. */
  /* Three faces, and the third earns it: --font-mark is a logotype, used on one
     word in one place, not part of the running type system.
     Chosen from the live specimen 2026-08-02. Fraunces and DM Sans are out;
     Fraunces was on 23 of our builds and had stopped being a choice. */
  --font-mark:    'Clash Display', Georgia, serif;   /* the GILDE wordmark, once */
  --font-display: 'Zodiak', Georgia, serif;          /* section headings         */
  --font-ui:      'Switzer', system-ui, sans-serif;  /* everything read          */

  --text-label:  11px;                          /* eyebrows, meta, legal     */
  --text-body:   16px;                          /* the reading size          */
  --text-lede:   clamp(16px, 1.4vw, 24px);      /* section intros            */
  --text-title:  clamp(32px, 5vw, 56px);        /* section headings          */
  --text-hero:   clamp(56px, 9.4vw, 168px);     /* the wordmark, once        */

  /* Two display roles the four above cannot carry. Both earn their place:
     the wordmark sublabel has to scale beside a 128px lockup, and the numerals
     are a distinct display register. Everything else uses the four. */
  --text-mark:   clamp(12px, 2vw, 20px);        /* wordmark sublabel         */
  --text-figure: clamp(24px, 3.5vw, 40px);      /* numerals, ledger + meta   */

  --weight-body:  400;
  --weight-mid:   500;   /* SemiBold-ish. We never use 700. */

  --track-tight: -0.02em;   /* the expensive-looking default */
  --track-wide:   0.24em;   /* label spacing only            */
  --track-mark:   0.52em;   /* the wordmark sublabel         */

  /* Lesson 09 (Flux Fundamentals 2): titles at 100% plus or minus 10% so the
     title reads as a solid block; paragraphs at 120 to 140% so they breathe.
     Body was 1.7 here, which is 170% and well outside that range. */
  --leading-title: 1.05;
  --leading-body:  1.4;
  /* Uppercase label lists (footer values, the houses, nav) keep their own wide
     leading on purpose. They are spaced lists, not paragraphs, so the 120-140
     rule does not apply to them. */
  --leading-list:  2;

  /* ---------- STAGE · the scrubbed bloom ----------
     The opening clip is scrubbed by scroll, not played. tulip-SCRUBBABLE.mp4 is
     all-intra (217 of 217 frames are keyframes), which is why seeking it on every
     scroll frame is cheap, and why tulip-loop.mp4 cannot stand in here: that one
     carries a single keyframe and seeking it stutters.

     Composition numbers live here because where the bloom sits is a layout
     decision, not a behaviour one. js/main.js reads --enter-x and nothing else.

     The bloom is PLACED BY THE GRID — it lives in a cell spanning columns 1 to 6
     and is centred in that cell. It used to sit on a -14% transform, which is
     what made the composition read as subtly wrong: a flower answering to no
     line that anything else answered to.

     POSITION comes from the grid, SIZE comes from the viewport. That split is the
     two-tier rule: structure is enforced, expression is free. Sizing the bloom
     off its cell tied it to --container-max, so on any screen wider than 1440 the
     flower simply stopped growing while the screen kept going — which is exactly
     why it looked tiny on the big monitor and merely small on the laptop. The
     clip is centred on its cell, so it stays on the grid while it scales. */
  --bloom-size: clamp(1100px, 108vw, 2400px);

  /* Narrow screens cannot hold a column beside the bloom, so they stack instead:
     the bloom owns a band at the top, the type begins where the band ends, and
     the two never share a pixel. The band is filled with cover rather than a
     zoom factor, because cover adapts to a phone and a tablet on its own and a
     zoom that suits one crops the other. Cropping is free here: what gets cut
     is black field on a black stage. */
  --bloom-band:       52svh;       /* the bloom's share of the first screen     */

  /* The exit. The scene used to end on a razor cut straight through the flower:
     the paper section's top edge sliced a fully lit, fully sharp bloom in half at
     maximum colour contrast. The bloom now defocuses and dissolves across the
     last stretch of its own scroll, so by the time the paper arrives there is
     nothing left to cut. A rack focus, not an edit. */
  --exit-from:         0.80;       /* progress at which the bloom starts leaving */
  --exit-blur:         18px;       /* how soft it goes before it is gone         */

  /* On a phone the bloom used to leave with the first screen, which made every
     section after it a wall of text. It stays now, and scrubs the whole way —
     it just steps back behind the words: dimmed to a floor and blurred, so the
     reading copy keeps its contrast. Measured, not guessed: white at
     --alpha-strong over the dimmed bloom still clears AA. */
  --bloom-behind:      0.26;       /* opacity the bloom rests at behind text     */
  --bloom-behind-blur:  7px;       /* enough to stop it competing with words     */

  /* BREATHING ROOMS. Rather than snapping between panels — which this build tried
     once and rejected, because mandatory snap across sections of different
     heights traps the reader mid-section — the bloom simply comes back to full
     strength in the gaps between text blocks and steps back behind them again.
     Same effect as a snap point, no trapping: you can stop anywhere. */
  --breath:           34svh;       /* gap between stacked blocks, room to open   */
  --breath-reach:     150px;       /* how far from a block the bloom is fully lit */
  --enter-x:       var(--space-8); /* 64px · how far blocks travel in from right */

  /* ---------- MOTION ----------
     Two curves, no more. Everything on the site uses one of these. */
  --ease-out:  cubic-bezier(.16, 1, .3, 1);
  --ease-soft: cubic-bezier(.2, .7, .2, 1);
  --dur-fast:  280ms;
  --dur-mid:   450ms;
  --dur-slow:  1000ms;
}

/* ---------- BREAKPOINTS · studio standard ----------
   Design widths are 1440 / 810 / 390. The query boundaries sit above each design
   width so a 390 phone and an 810 tablet each land inside their own band. This
   build had been using 900/560, which put an 810 iPad in the phone band. */
@media (max-width: 1023px){         /* tablet */
  :root{ --margin:32px; --gutter:24px; --columns:6; }
}
@media (max-width: 639px){          /* phone */
  :root{ --margin:24px; --gutter:24px; --columns:4; }
}

/* =========================================================
   LAYOUT PRIMITIVES
   Two of them. Every section uses these. A section that wants a different width
   says `grid-column: span N` — it does NOT get its own margin. Copied from the
   studio contract so this build aligns with Argonaut and the studio site.
   ========================================================= */

.container{
  width:100%;
  max-width:var(--container-max);
  margin-inline:auto;
  padding-inline:var(--margin);
}

.grid-12{
  display:grid;
  grid-template-columns:repeat(var(--columns), 1fr);
  gap:var(--gutter);
}

/* span helpers, desktop. Below the tablet breakpoint the column count drops,
   so spans clamp themselves rather than overflowing. */
.span-2{grid-column:span 2}   .span-3{grid-column:span 3}
.span-4{grid-column:span 4}   .span-5{grid-column:span 5}
.span-6{grid-column:span 6}   .span-7{grid-column:span 7}
.span-8{grid-column:span 8}   .span-9{grid-column:span 9}
.span-12{grid-column:1 / -1}

@media (max-width: 1023px){
  .span-7,.span-8,.span-9{grid-column:1 / -1}
  .span-5,.span-6{grid-column:span 6}
  .span-3,.span-4{grid-column:span 3}
}

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.01ms !important;
    scroll-behavior:auto !important;
  }
}
