﻿/* Design tokens — from DESIGN_SPEC.md §1 */
@font-face { font-family: 'Baloo 2'; font-weight: 800; font-display: swap; src: url(../assets/fonts/baloo-2-800.woff2) format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 600; font-display: swap; src: url(../assets/fonts/nunito-600.woff2) format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 700; font-display: swap; src: url(../assets/fonts/nunito-700.woff2) format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 800; font-display: swap; src: url(../assets/fonts/nunito-800.woff2) format('woff2'); }

:root {
  /* sky / ground */
  --sky-top: #4ABCE9;        --sky-bottom: #89E0F8;
  --grass-top: #8ACC66;      --grass-bottom: #599E5E;
  --afternoon-top: #FFA36B;  --afternoon-bottom: #F58CA8;
  --evening-top: #F58CA8;    --evening-bottom: #5F3487;
  --night-top: #2E93C9;      --night-bottom: #5F3487;
  --surface: #FFFFFF;
  --surface-veil: rgba(255,255,255,.72);
  --parent-bg: #EEF4F8;      --parent-row: #F7FAFC;

  /* weekdays Mon..Sun */
  --day-0: #FF3046; --day-1: #FFA62E; --day-2: #1878B2; --day-3: #6EC66C;
  --day-4: #FF7D25; --day-5: #4B51AA; --day-6: #5F3487;
  --weekend-panel: rgba(185,168,214,.75);
  /**
   * **THE TWO KNOBS MY WEEK'S BOARD GIVES A THEME, AND THE ONLY TWO.**
   *
   * The GRID is not a taste and ships once for everyone. The INTENSITY is: `--wk-tint` is how much of a day's own
   * colour its column wash carries (`app.css .zone`), and `--wk-card-h` is the big card's picture height.
   *
   * **ONE NUMBER FOR THE TINT, NOT THREE.** Today and the weekend are derived from `--wk-tint` by multiplication
   * (x1.8 and x0.64 in `app.css`), so a theme that wants to be quieter turns one dial and keeps the relationship
   * between the three. `calc()` on a percentage is what makes that work inside `color-mix`.
   *
   * **THESE DEFAULTS ARE COCO'S VALUES, AND THAT IS WHY THE FALLBACK IS TRUSTWORTHY.** Coco's `theme.json` has
   * `"colors": {}` by design, so the default theme — the one nearly every family is on — reaches these lines by the
   * SAME path a theme that forgets to set them would. The fallback is exercised by the default case rather than only
   * by a mistake, so "a theme that omits them still works" is true by construction instead of hoped for.
   *
   * A theme overrides them the way it already overrides `--day-0..6`: name them in `theme.json`'s `colors` map,
   * which `themes.js styleFor()` turns into an inline style string. There is no second mechanism to write.
   */
  --wk-tint: 22%;
  /**
   * **112px IS A CEILING, MEASURED, NOT A SIZE THAT WAS CHOSEN.** It is the largest picture that still leaves TWO
   * big cards standing in a day column at 1280x800 (`tools/test-cdband.mjs` holds the floor; `tools/_budget.mjs`
   * is how it was found). 116 drops the column to one card, and one card per day is a worse screen than a slightly
   * smaller picture - the week has to show the week.
   *
   * **It is 112 and not 124 because the day pill never cost 46px.** The pill was `min-height:46px` with a
   * `margin-top:-14px` tuck under the date circle, so its real cost was 32; plain text in the flow takes 26 of
   * that back, and the wash's own 6px top and bottom spend 12. The cards area measured 304px before this pass and
   * 303 after it, so the honest gain is the 8px of picture below, not the 20 the arithmetic promised.
   */
  --wk-card-h: 112px;
  /* A running span's band across the Week grid (week.js spanBandsHTML). Teal, not the weekend's purple: the two can
     sit one above the other in the same week and must not read as one panel. `--span-row` is the band's own grid row. */
  /* 22px, and the number is measured rather than chosen: it is one row, and it is the whole of what a band costs.
     **This comment used to end "one band leaves 282 and still shows two", and that was wrong by 4px for as long as
     it stood** - two cards need 2x139 PLUS the 8px gap BETWEEN them, which is 286, and a banded column had 281. A
     banded column has shown ONE big card since the band was written; the suite's proxy ignored the gap and so
     passed while the thing it stood for was false. `tools/test-cdband.mjs` asserts the gap now, and is the thing
     to read. (A second band drops the column further still, which is why the cap is two.) */
  --span-band: rgba(77,194,178,.82); --span-row: 22px;
  --today-wash: rgba(255,255,255,.42);
  /* "there is more below" at the foot of a day column (week.js syncMore). The fade is near-white so a dark chevron
     reads over any card, on any day colour and on the weekend's purple; 34px is short enough to soften the last
     card's edge without hiding its label. */
  --more-fade: rgba(255,255,255,.94);

  /* card categories */
  --cat-activities: #FD3B27;   --cat-appointments: #5E6EB5; --cat-routines: #FE5D21;
  --cat-education: #F78EC1;    --cat-holidays: #4DC2B2;     --cat-outings: #FFB93B;
  --cat-marker: #1878B2; --cat-school: #6EC66C; --cat-ink-school: #103193;
  /* label ink: white on four bars, navy on the two light ones (contrast; flagged in spec §1.3) */
  --cat-ink-default: #fff; --cat-ink-education: #103193; --cat-ink-outings: #103193;

  /* text and states */
  --ink: #103193; --ink-blue: #1878B2;
  --ink-muted: rgba(16,49,147,.55); --ink-faint: rgba(16,49,147,.22);
  --done: #6EC66C; --star: #FFA62E;
  --drop-active: #FFA62E; --drop-active-fill: rgba(255,166,46,.10);
  /**
   * `--save` is DARKER than `--done`, although the two were the same green for a long time, and the difference is
   * contrast rather than taste. White on the old #6EC66C is **2.11:1** — under WCAG's 3:1 floor for large bold text —
   * and that green carried every primary button in the app: Save, Close, Done, Add, the wizard's Next and Start, the
   * game's keypad OK. White on #2F8A30 is **4.38:1**, with headroom over the floor so a later nudge cannot quietly
   * drop back under it.
   *
   * **Darkening the token rather than darkening the LABEL was the choice, and two sites decided it**: `.qchip.sg b`
   * and `.gm-typed.right` paint `--save` as TEXT on white, and were 2.11:1 for the same reason. A darker green fixes
   * those as well; a navy label on the old green would have scored higher on the buttons and done nothing for them.
   *
   * `--done` is deliberately left at #6EC66C. A button and a completed card mean different things, and `simple` and
   * `bubbly` already override `--done` on their own while every Save button stays this one colour — so they were
   * never really one token wearing two hats. `tools/test-dialogs.mjs` fails under 3:1.
   */
  --lock: #103193; --save: #2F8A30; --danger: #FF3046;

  /* type */
  --font-head: 'Baloo 2', 'Baloo', system-ui, sans-serif;
  --font-ui: Nunito, system-ui, sans-serif;

  /* radii */
  --radius-slot: 16px; --radius-card: 22px; --radius-chip: 14px; --radius-panel: 26px; --radius-row: 12px;

  /* flat offset shadows */
  --shadow-card: 0 3px 0 rgba(16,49,147,.14);
  --shadow-chip: 0 3px 0 rgba(16,49,147,.18);
  --shadow-routine: 0 5px 0 rgba(16,49,147,.14);
  --shadow-button: 0 5px 0 rgba(16,49,147,.22);
  --shadow-lift: 0 8px 18px rgba(16,49,147,.25);
  --shadow-fold: 0 22px 30px rgba(16,49,147,.25);

  /* ---- responsive: sizes that follow the stage instead of assuming one screen ---- */
  --rt-gap: clamp(8px, 1.4vw, 16px);      /* gap between routine cards */
  --rt-pad: clamp(6px, 1vw, 16px);        /* the row's own side padding, so the first/last card is fully visible */
  --rc-max: 430px;                        /* a routine card never grows past the printed size… */
  --rc-min: 128px;                        /* …and never shrinks below a comfortable, readable touch target */
  --wk-colmin: 96px;                      /* weekly board column */
  --mkb-h: 64px;                          /* Yesterday/Today/Tomorrow band: about half an activity card */
  --mkb-img: 81px;                        /* the artwork is 240x189, so the box keeps its ratio */
  --mkb-h-sm: 46px;                       /* …the 2-4 children board, where the columns are narrower */
  --mkb-img-sm: 58px;
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  --ease-press: cubic-bezier(.2,.7,.3,1);
  --ease-fold: cubic-bezier(.34,1.2,.64,1);

  /* ---- Parent mode redesign (PARENT_MODE_REDESIGN.md §4). Sizes are for the 1280x800 stage. ---- */
  --pm-bar-h: 80px;                       /* top bar */
  --pm-ctl-h: 56px;                       /* every control in the top bar */
  --pm-seg-min: 136px;                    /* one segment of [ Weekly | Routines ], nowrap */
  --pm-seg-track: rgba(255,255,255,.12);
  --pm-div: rgba(255,255,255,.22);
  --pm-lib-w: 292px;                      /* library: 76 rail + 216 grid */
  --pm-lib-wide: 396px;                   /* …with the right panel folded away, the cards get the extra room */
  --pm-rail-w: 76px;
  --pm-form-max: 680px;                   /* a column of form controls stops here rather than stretching with the page */
  --pm-side-w: 336px;                     /* context panel */
  --pm-side-tab: 72px;                    /* …when collapsed */
  --pm-collapse: 220ms cubic-bezier(.2,.8,.2,1);
  --pm-dayhead-h: 60px;
  --pm-slot-h: 56px;                      /* dashed "Add" target */
  --pm-place-h: 64px;                     /* placement chips */
  --pm-daychip-h: 58px;                   /* day chips in the panel */
  --pm-schedchip: 56px;                   /* day chips of a custom schedule */
  --pm-mode-h: 52px;                      /* schedule mode selector */
  --pm-tab-h: 68px;                       /* routine tabs */
  --pm-step-w: 122px;                     /* routine step card */
  --pm-sugg-h: 60px;
  --pm-nav-h: 88px;                       /* wizard nav bar */
  --pm-line: #D3DEEA;                     /* chip and field borders */
  --pm-line-soft: #E1EAF2;
  --pm-fill: #F7FAFC;
  --pm-tint: #EEF4F8;
  --pm-warn: #D81B30;                     /* Clear / Remove */
  --pm-ink-amber: #B86A00;                /* "Add" label on a target slot */
  --pm-veil: rgba(226,233,241,.78);       /* setup: everything outside the step */
  --pm-veil-bar: rgba(16,49,147,.55);
  --pm-ring: 0 0 0 4px var(--drop-active);/* picked library card / just-placed card */
  --pm-ring-sel: 0 0 0 4px var(--ink);    /* selected placed card */
}

