/* ==========================================================================
   THE PERSONAL DESIGN SYSTEM OF JAN LYNNEL BALITAAN
   --------------------------------------------------------------------------
   "The page is the line."

   The mark is one continuous stroke: tail, leg, arch, wing, head. The brand
   book calls it "one line, from root to flight". The site makes that stroke
   its structure: a spine runs the whole length of the page, and every block
   hangs off it on a branch.

   Three systems — type, space, motion — each split the same way, because the
   same rule applies to all three: what sits INSIDE a component is fixed, what
   sits BETWEEN blocks is fluid. One curve per family, so proportions hold at
   any width instead of being tuned at one width and surviving the rest.

   Tokens only. No component styles live in this file.
   ========================================================================== */

:root {
  /* ---- Brand constants (identical in both themes) ---------------------- */
  --brand-mint:  #00D9A3;
  --brand-azure: #3B8EFF;
  --brand-amber: #FFB347;

  --font-display: "Bricolage Grotesque", "Space Grotesk", system-ui, sans-serif;
  --font-body:    "Inter", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, Menlo, monospace;

  /* ---- TYPE -----------------------------------------------------------
     Text that must not move is a fixed step. Display type is one clamp()
     multiplied by fixed ratios, so every heading breathes together and the
     ratios cannot drift apart. */
  --text-xs: 0.75rem;      /* 12 — mono labels, the smallest allowed      */
  --text-sm: 0.875rem;     /* 14 — meta, dates, tags                      */
  --text-md: 1rem;         /* 16 — body; all substantial prose lands here */
  --text-lg: 1.125rem;     /* 18 — lead prose and section ledes           */
  --text-xl: 1.3125rem;    /* 21 — standfirsts                            */

  --d-base: clamp(1.125rem, 0.95rem + 0.75vw, 1.875rem);   /* 18 -> 30 */
  --d-1: var(--d-base);
  --d-2: calc(var(--d-base) * 1.26);
  --d-3: calc(var(--d-base) * 1.59);
  --d-4: calc(var(--d-base) * 1.75);   /* the statement, pull-quote scale  */
  --d-5: calc(var(--d-base) * 2.60);   /* the name, once per page          */

  --lh-hero: 1.0;  --lh-display: 1.08; --lh-statement: 1.16;
  --lh-snug: 1.35; --lh-body: 1.65;    --lh-label: 1.45;

  --track-label:   0.16em;
  --track-text:   -0.01em;
  --track-display:-0.025em;
  --track-hero:   -0.042em;

  /* ---- SPACE ----------------------------------------------------------- */
  --sp-1: .25rem; --sp-2: .5rem;  --sp-3: .75rem; --sp-4: 1rem;
  --sp-5: 1.5rem; --sp-6: 2rem;   --sp-7: 3rem;   --sp-8: 4rem;

  --gap-sec:  clamp(3.25rem, 1.9rem + 4.2vw, 5.75rem);
  --gap-head: clamp(2rem,    1.2rem + 2.6vw, 4rem);
  --gap-row:  clamp(1.5rem,  1rem   + 1.6vw, 2.5rem);
  --gap-col:  clamp(1.5rem,  1rem   + 2.2vw, 3rem);

  --shell: clamp(1600px, 75vw, 1920px);
  --measure: 68ch;
  --gutter: clamp(1.25rem, 3vw, 2.5rem);
  /* The spine and its branches sit in the left margin, and .bay mirrors that
     offset on the right so the column reads as centered. Both floors are kept
     low because on a phone the mirror costs twice as much as it used to. */
  --spine: clamp(0.875rem, 3.4vw, 4rem);
  --branch: clamp(0.875rem, 2.6vw, 3.25rem);

  /* ---- MOTION ---------------------------------------------------------- */
  --ease: cubic-bezier(.22, 1, .36, 1);
  --dur: 240ms;
  --d-mult: 1;
}

/* ==========================================================================
   DARK — the default, and what the site is designed in. Deep ink.
   The theme is written to the root element before first paint by the inline
   script in each page, so this is also what a no-JS visitor gets.
   ========================================================================== */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08121A; --bg-sunken: #060E14;
  --surface: #0D1A23; --surface-2: #122230;
  --line: #1A2C38; --line-strong: #27404F;
  --text: #E9F1F5; --text-muted: #9BB0BC; --text-dim: #758C99;
  /* The whole brand family, not one accent. Each section takes one, so the
     page moves cool to warm as you descend — root to flight, in color. */
  --h-mint: #00D9A3; --h-teal: #2FC6E0; --h-azure: #5A9DFF;
  --h-violet: #B197FC; --h-amber: #FFB347;
  --accent: var(--h-mint); --accent-ink: #04120D;
  --spine-dim: #283847;
  --amber: var(--brand-amber);
  --grain: .035;
  --glow: radial-gradient(110% 70% at 14% -12%, rgba(0,217,163,.08), transparent 58%),
          radial-gradient(90% 65% at 88% 4%, rgba(90,157,255,.07), transparent 60%),
          radial-gradient(80% 60% at 60% 112%, rgba(255,179,71,.055), transparent 62%);
}

/* ==========================================================================
   LIGHT — warm paper rather than cold gray: the dark theme is ink, so the
   light one should be the sheet it was printed on. Each hue is darkened
   independently to hold WCAG AA against that paper.
   ========================================================================== */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #FAF9F5; --bg-sunken: #F1EFE8;
  --surface: #FFFFFF; --surface-2: #F6F4EE;
  --line: #E3E0D7; --line-strong: #C6C2B6;
  --text: #14181B; --text-muted: #4C5760; --text-dim: #687480;
  --h-mint: #00735A; --h-teal: #0F6276; --h-azure: #1E58BF;
  --h-violet: #6341D6; --h-amber: #855000;
  --accent: var(--h-mint); --accent-ink: #FFFFFF;
  --spine-dim: #C6C2B6;
  --amber: #8A5200;
  --grain: .05;
  --glow: radial-gradient(110% 70% at 14% -12%, rgba(0,121,92,.05), transparent 58%),
          radial-gradient(90% 65% at 88% 4%, rgba(26,95,196,.04), transparent 60%),
          radial-gradient(80% 60% at 60% 112%, rgba(138,82,0,.04), transparent 62%);
}

/* Retinting a whole section costs one declaration, because every component
   already draws from var(--accent) rather than from a literal. */
.t-mint   { --accent: var(--h-mint); }
.t-teal   { --accent: var(--h-teal); }
.t-azure  { --accent: var(--h-azure); }
.t-violet { --accent: var(--h-violet); }
.t-amber  { --accent: var(--h-amber); }
