/* ============================================================================
   Rowan Environmental Group: design tokens

   The palette is eight colours, each taken from a measured property of the
   rowan tree (Sorbus aucuparia) and contrast-tested to WCAG 2.2 AA, including
   under protanopia and deuteranopia. Do not add a colour. Do not raise a
   saturation.

   Placement rules that keep the palette from reading as Christmas or a flag:
   - Red never sits on green as a meaningful pair. Red lives on cream.
   - Green is a field, red is an incident. Never three colours in equal blocks.
   - Never gold or yellow.
   ========================================================================= */

:root{
  /* --- palette ------------------------------------------------------------ */
  --corymb:      #F2EDE1;   /* the flower heads: ground, never accent        */
  --green:       #20402F;   /* the leaf: the brand field                     */
  --red:         #8F3A2E;   /* the ripe berry: the accent on cream           */
  --berry-light: #C2776D;   /* the berry lifted: the accent on graphite      */
  --glaucous:    #87A096;   /* the leaf underside: structure on green        */
  --bark:        #8E9691;   /* silvery bark: rules, and muted text on graphite */
  --bark-deep:   #5C6360;   /* bark darkened: muted text on cream            */
  --graphite:    #191D1B;   /* bark in shadow: technical surfaces            */

  /* Tested ratios
     green on cream 9.79 · graphite on cream 14.58 · red on cream 6.39
     bark-deep on cream 5.27 · glaucous on graphite 6.08 · bark on graphite 5.61
     berry-light on graphite 4.99
     Non-text only (3:1 and up): glaucous, bark and berry-light on green.
     Never: bark or glaucous as text on cream; green on graphite.            */

  /* --- muted text, one per ground ----------------------------------------- */
  --muted-cream:    var(--bark-deep);               /* 5.27 : 1 */
  --muted-green:    rgba(242,237,225,.74);          /* ~6.1 : 1 */
  --muted-graphite: var(--bark);                    /* 5.61 : 1 */

  /* --- rules ---------------------------------------------------------------
     Hairlines carry the grid. A rule that bounds a CONTROL must reach 3:1
     (WCAG 1.4.11); decorative rules may be fainter.                         */
  --rule-cream:         rgba(32,64,47,.20);
  --rule-cream-soft:    rgba(32,64,47,.10);
  --rule-green:         rgba(242,237,225,.24);
  --rule-green-soft:    rgba(242,237,225,.12);
  --rule-graphite:      rgba(242,237,225,.18);
  --control-cream:      rgba(32,64,47,.66);        /* 3.8 : 1 on cream */
  --control-green:      rgba(242,237,225,.52);     /* 3.8 : 1 on green */

  /* --- type ----------------------------------------------------------------
     Plex Sans decides, navigates and carries every number (tabular where the
     numbers line up). Plex Serif carries sustained reading. Plex Mono appears
     only in the lockup's sub-line.                                           */
  --sans:  'IBM Plex Sans', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --serif: 'IBM Plex Serif', ui-serif, Georgia, 'Times New Roman', serif;
  --mono:  'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Display steps */
  --t-hero:      clamp(44px, 5.4vw, 80px);
  --t-statement: clamp(38px, 4.6vw, 66px);
  --t-section:   clamp(31px, 3.2vw, 46px);
  --t-title:     clamp(22px, 1.9vw, 28px);
  --t-figure:    clamp(64px, 8.2vw, 116px);
  /* Reading steps. Three small sizes and no half-steps between them. */
  --t-lede:  clamp(18px, 1.45vw, 21px);
  --t-body:  17px;
  --t-data:  15px;
  --t-meta:  13px;

  /* --- space: a 4 px base --------------------------------------------------- */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;  --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;  --s10: 128px;

  --gutter:  clamp(20px, 4vw, 56px);
  --measure: 1320px;      /* one content width for every page */

  /* Section rhythm is set by role, never one value for everything. */
  --pad-lead:  clamp(72px, 7.8vw, 120px); /* an argument opens          */
  --pad:       clamp(56px, 6.2vw, 92px);  /* a register or a table      */
  --pad-cont:  clamp(40px, 4vw, 60px);    /* continues on the same ground */

  /* --- chrome ------------------------------------------------------------- */
  --mast-h: 72px;
  --rail-h: 0px;

  /* --- motion --------------------------------------------------------------
     160 ms for hover and focus, 240 ms for anything that moves position.   */
  --ease: cubic-bezier(.2,.6,.3,1);
  --dur: 160ms;
  --dur-move: 240ms;
}

/* Under 900 px the masthead is two rows: the logo row (measured 45 px) over
   the 42 px rail, plus its 1 px rule: 88 px. --mast-h is the logo row's share,
   so that scroll-padding-top lands a section exactly under the bar.
   Re-measure after any masthead change. */
@media (max-width:900px){
  :root{ --mast-h: 46px; --rail-h: 42px; }
}
/* Tablet: between the phone floor and the desktop ramp the display steps
   up, so an 834 px screen is not set in phone sizes. */
@media (min-width:641px) and (max-width:900px){
  :root{
    --t-hero:      clamp(52px, 7.2vw, 64px);
    --t-statement: clamp(46px, 6vw, 56px);
    --t-section:   clamp(34px, 4.4vw, 40px);
  }
}
@media (max-width:640px){
  :root{
    --pad-lead: 64px;
    --pad:      52px;
    --pad-cont: 36px;
  }
}
