/* =============================================================================
   Story Tabletop — Design Tokens
   One brand system, two voices (adult authoring portal + child voice-first reader).
   Mood: warm · wonder-filled · trustworthy. "Storybook that respects the reader."
   Hand-off artifact — CSS custom properties. WCAG AA verified (see notes inline).
   ============================================================================= */
:root {

  /* ---------------------------------------------------------------------------
     1 · COLOR — primitives (ramps)
     --------------------------------------------------------------------------- */
  --persimmon-50:  #FBE7DF;
  --persimmon-200: #F4B39F;
  --persimmon-400: #EF8A6E;
  --persimmon-500: #E86A4C;   /* brand primary */
  --persimmon-700: #C9502F;   /* hover + text-on-color */
  --persimmon-900: #9C3C22;

  --forest-50:  #E1EDE8;
  --forest-200: #A9CCC0;
  --forest-400: #6BA292;
  --forest-500: #3E7C6A;      /* brand secondary */
  --forest-700: #2F6152;
  --forest-900: #1F4438;

  --gold-50:  #FDF3D8;
  --gold-200: #FAE3A6;
  --gold-400: #F7D67F;
  --gold-500: #F4C95D;        /* the "spark" accent */
  --gold-700: #E0AE3A;
  --gold-900: #B5892A;

  --amber-500: #D98032;       /* warning */

  /* Neutrals — warm paper & ink */
  --paper:        #FBF7F0;    /* app background  */
  --paper-2:      #F5EEE2;    /* sunken / header band */
  --surface:      #FFFFFF;    /* cards, inputs, table body */
  --ink:          #2B2724;    /* primary text */
  --soft-ink:     #6B615A;    /* secondary / muted text */
  --line:         #EBE2D6;    /* hairlines, borders */
  --line-strong:  #DCCFBC;    /* stronger dividers */

  /* ---------------------------------------------------------------------------
     COLOR — semantic roles  (what engineering references)
     Contrast notes are vs --paper unless stated (WCAG AA = 4.5:1 text / 3:1 UI).
     --------------------------------------------------------------------------- */
  --bg:              var(--paper);
  --bg-sunken:       var(--paper-2);
  --surface-1:       var(--surface);

  --text:            var(--ink);        /* 13.9:1 — AAA */
  --text-muted:      var(--soft-ink);   /*  5.7:1 — AA  */
  --text-on-color:   #FFFFFF;           /* white on primary-strong = 4.5:1 AA */

  --primary:         var(--persimmon-500); /* fill; white label ≥18px/bold = 3.2:1 AA-Large */
  --primary-hover:   var(--persimmon-700);
  --primary-strong:  var(--persimmon-700); /* use for text/icons on paper (4.5:1) */
  --on-primary:      #FFFFFF;

  --secondary:       var(--forest-500);
  --secondary-hover: var(--forest-700);
  --link:            var(--forest-500);    /* 4.6:1 — AA */
  --link-hover:      var(--forest-700);
  --success:         var(--forest-500);

  --accent:          var(--gold-500);      /* spark — highlights & focus; ink text only (9.4:1) */
  --accent-strong:   var(--gold-700);
  --on-accent:       var(--ink);

  --warning:         var(--amber-500);     /* pills/flags; ink text on fill (5.0:1 AA) */
  --on-warning:      var(--ink);

  --border:          var(--line);
  --border-strong:   var(--line-strong);
  --focus-ring:      var(--gold-500);      /* the gold focus glow */

  /* ---------------------------------------------------------------------------
     2 · TYPOGRAPHY
     --------------------------------------------------------------------------- */
  --font-heading: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body:    "Nunito Sans", system-ui, -apple-system, Segoe UI, sans-serif;

  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;
  --weight-extra:    800;
  --weight-black:    900;

  /* size / line-height / tracking — display & headings use --font-heading */
  --text-display:      64px;  --leading-display: 66px;  --tracking-display: -0.015em;
  --text-h1:           44px;  --leading-h1:      48px;  --tracking-h1:      -0.01em;
  --text-h2:           32px;  --leading-h2:      37px;  --tracking-h2:       0;
  --text-h3:           24px;  --leading-h3:      30px;  --tracking-h3:       0;
  --text-h4:           20px;  --leading-h4:      26px;  --tracking-h4:       0;
  /* body & UI use --font-body */
  --text-body-lg:      18px;  --leading-body-lg: 29px;
  --text-body:         16px;  --leading-body:    26px;
  --text-small:        14px;  --leading-small:   21px;
  --text-caption:      12px;  --leading-caption: 17px;  --tracking-caption:  0.12em; /* uppercase */

  /* ---------------------------------------------------------------------------
     3 · SPACING  (4-based)
     --------------------------------------------------------------------------- */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-6:  24px;
  --space-8:  32px;
  --space-12: 48px;

  /* ---------------------------------------------------------------------------
     4 · RADIUS
     --------------------------------------------------------------------------- */
  --radius-sm:    8px;
  --radius-input: 10px;   /* text/number inputs */
  --radius-card:  16px;   /* cards, panels */
  --radius-pill:  999px;  /* buttons, nav, chips, badges */

  /* ---------------------------------------------------------------------------
     5 · SHADOW  (warm, layered — tinted with ink, not pure black)
     --------------------------------------------------------------------------- */
  --shadow-card: 0 1px 2px rgba(43,39,36,.04), 0 8px 24px -10px rgba(43,39,36,.18);
  --shadow-lift: 0 2px 6px rgba(43,39,36,.06), 0 22px 48px -16px rgba(43,39,36,.28);
  --shadow-focus: 0 0 0 3px rgba(244,201,93,.55); /* gold focus glow */

  /* ---------------------------------------------------------------------------
     6 · MOTION  (subtle, purposeful — always with reduced-motion fallback)
     --------------------------------------------------------------------------- */
  --ease-gentle: cubic-bezier(0.22, 0.61, 0.36, 1);  /* default entrance/UI ease */
  --ease-out:    cubic-bezier(0.16, 1, 0.30, 1);
  --duration-fast:  160ms;   /* hover, focus, small state changes */
  --duration-base:  320ms;   /* entrance fade-up, card lift */
  --duration-slow:  600ms;   /* header spark drift */
  --stagger-step:   60ms;    /* per-item delay in staggered entrances */
}

/* Respect the reader — motion is opt-out. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0ms;
    --duration-base: 0ms;
    --duration-slow: 0ms;
    --stagger-step:  0ms;
  }
}
