/* Design tokens, the Maple Weddings look.
 *
 * Anything that is a colour, a radius, a shadow or a font belongs here and nowhere else: every
 * component reads through these variables, which is why dark mode needs no per-component rules.
 * test/contrast.mjs reads THIS file and checks every pairing the app draws, so a value changed
 * here is checked against the WCAG thresholds the next time `npm test` runs.
 *
 * The system in one paragraph. A warm cream page with a trace of aubergine in the ink, lots of
 * room, and thin rules instead of boxes. Four soft blocks (blush, powder blue, sand, sage) for
 * tags and bands. One accent, which each couple chooses (terracotta by default; mulberry, sage,
 * ochre, slate and umber are the others) and which is stamped on the root as data-accent. The
 * accent appears on the primary button, the selected tab, links, focus rings and the countdown,
 * and nowhere else. Green, amber and red mean status and nothing else, always with a word beside
 * them. The display serif is for the couple's own words and numbers only. Dark mode is a neutral
 * charcoal with no colour in the greys: the accent and the soft blocks carry the warmth.
 *
 * Shape: pills for buttons and chips, 12px fields, generous radii wherever a surface remains.
 * Only things you can pick up or tap (stat tiles, colour blocks, the plan, alerts) are surfaces;
 * a section is a serif heading under a thin rule, and a table sits straight on the page.
 *
 * House rules that go with these tokens:
 *   . No em dashes anywhere, in the UI, the docs or the comments. Commas, full stops, colons.
 *   . No block capitals in the UI. Sentence case throughout, emphasis by weight, size, colour.
 *   . Tabular numerals app-wide, so cost columns and counts line up as they change.
 *   . Text is 4.5:1 (3:1 only at 24px and up, or 18.5px bold). The edge of anything you type
 *     into or tap is --control, 3:1 against the page. Nothing is smaller than 12px.
 *
 * The previous look (square, sea glass) is kept in css/tokens.classic.css and the git tag
 * `classic-look`; see "Going back to the classic look" in the README.
 */

:root {
  color-scheme: light;

  --bg: #FBF7F1;
  --surface: #F3EDE3;
  --card: #FFFDF9;
  /* QR codes (js/ui/qr-codes.js) are black on white in every theme: scanners need the contrast. */
  --qr-light: #FFFFFF;
  --qr-dark: #000000;
  --border: #E6DDD0;
  --border-strong: #D3C7B6;
  --track: #EADFD2;
  /* The edge of anything you type into or tap: 3:1 against the page, so it can be found
     (WCAG 1.4.11). --border and --border-strong are only dividers and never carry that job. */
  --control: #8A7F72;
  --text: #2B2224;
  --muted: #6B5F57;

  /* Soft blocks, each with the ink that sits on it. Tags and bands, never the accent. */
  --blush: #F5E2E2;      --blush-ink: #6E3B41;
  --powder: #DCE9F1;     --powder-ink: #35566B;
  --sand: #EADFD0;       --sand-ink: #5E4A38;
  --sage-tint: #E3EADB;  --sage-ink: #46573C;

  /* Status. Each has a soft fill for badges and alerts. Always with a word beside it. */
  --good: #43623A;       --good-soft: #E4EBDA;
  --warning: #7E5410;    --warning-soft: #F6E9CB;
  --error: #9C3A32;      --error-soft: #F6DFDB;
  --info: #3B5F7C;       --info-soft: #E1EAF0;

  /* The family of tags that are not status: the ceremony, schedule and cost chips, the
     "drop here" highlight on the table plan. Each is an ink on its own soft fill. */
  --purple: #6B4466;     --purple-soft: #F0E3EE;
  --pink: #9C4660;       --pink-soft: #F6E1E6;
  --teal: #2F6B68;       --teal-soft: #DDEBE9;
  --amber: #8A5A0F;      --amber-soft: #F7EBD2;
  --gilt: #7A5A14;       --gilt-soft: #F4E9CF;

  /* Six fixed colours for telling things apart, used for the menu marks on the table plan. They
     are NOT the accent, so a couple's colour choice never changes what a mark means, and every
     one holds 4.5:1 against its ink in its own theme. A number always travels with the colour. */
  --cat-1: #3F6280; --cat-2: #8C5E12; --cat-3: #9C4660;
  --cat-4: #43623A; --cat-5: #6A4C8C; --cat-6: #5E5750;
  --cat-ink: #FFFFFF;

  /* Neutral status (not started, idea, awaiting a reply). The light grey is a dot or a bar
     segment, so it holds 3:1 against the page rather than 4.5:1. */
  --status-gray: #6B5F57;
  --status-gray-light: #8A7F72;
  --status-gray-soft: #EFE9DF;
  /* A mid yellow for "maybe" and "still to pay" in the bars. A fill, 3:1 against the page. */
  --yellow: #A8801A;

  /* Terracotta, the default accent. The presets further down replace these four. */
  --accent: #A5573F;
  --accent-dark: #843F2B;
  --accent-soft: #F6E3DA;
  /* The text colour that sits on a filled accent. A token because white on a dark theme's light
     accent is a contrast failure, and this is what lets that one case differ. */
  --accent-ink: #FFFFFF;

  /* Only what floats above the page casts a shadow: a modal, a menu, a toast. */
  --shadow: 0 1px 2px rgba(43, 34, 36, .06), 0 4px 14px rgba(43, 34, 36, .07);
  --shadow-lg: 0 4px 8px rgba(43, 34, 36, .06), 0 16px 40px rgba(43, 34, 36, .16);

  /* Fields are 12px, buttons and chips are pills, and a surface that remains (a stat tile, the
     table plan, a modal) is 16 to 28px. The bare names keep working for existing components. */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-card: 20px;
  --radius-lg: 24px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  /* Space (owner's request, 1 Dec 2026: "an 8, 16, 32 grid, not random spacing all over the shop"). Every margin,
     padding and gap in the product is one of these steps, and test/spacing.mjs fails on anything else.
       4    only inside small parts: an icon and its word, a pill or a badge's own padding
       8    things that belong together: a label and its field, buttons side by side, a hint under a field
       16   one field and the next, rows in a list, inside a compact card, the page edge on a phone
       24   inside a card, one card and the next
       32   groups within a section, the page edge on a laptop
       48   one section and the next
       64   the largest step, between page-level blocks
     The roles below name the common jobs, so the same job is always the same size. Room left under a bar that
     floats over the page (a clearance) follows that bar's height instead: a multiple of 8 of 72px or more. */
  --space-4: 4px;
  --space-8: 8px;
  --space-16: 16px;
  --space-24: 24px;
  --space-32: 32px;
  --space-48: 48px;
  --space-64: 64px;

  --space-inline: var(--space-8);   /* side by side: an icon and text, buttons and chips in a row */
  --space-label: var(--space-8);    /* a label and its field; a hint under its field */
  --space-field: var(--space-16);   /* one field, row or line item and the next */
  --space-card: var(--space-24);    /* inside a card, and from one card to the next */
  --space-group: var(--space-32);   /* groups inside one section */
  --space-section: var(--space-48); /* one section and the next */
  --space-gutter: var(--space-32);  /* the page's edge */

  /* Figtree does the work. Fraunces is for the monogram, the couple's names, the countdown,
     section headings and page titles: the places the couple's own words and numbers appear. It
     carries real weight (500 here) and a soft, steady upright, with an italic worth keeping for
     one thing only: the ampersand (see .amp in app.css). */
  --font-family: 'Figtree', 'Figtree Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', 'Fraunces Fallback', Georgia, 'Times New Roman', serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --icons: 'Material Symbols Rounded';
}

/* Dark palette: a neutral charcoal, not tinted. Applied via data-theme, which the boot script
   stamps before first paint so a dark load never flashes white. Soft fills are dimmed towards
   the background rather than made translucent, which keeps chip text at the contrast it has in
   light mode. The greys carry no colour; the accent and the soft blocks carry the warmth. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #171717;
  --surface: #1F1F1F;
  --card: #242424;
  --border: #333333;
  --border-strong: #474747;
  --track: #353535;
  --control: #7A766F;
  --text: #ECE8E2;
  --muted: #A9A49C;

  --blush: #312A2B;      --blush-ink: #E9C7CA;
  --powder: #252D33;     --powder-ink: #B5D0E0;
  --sand: #2E2A25;       --sand-ink: #DCC9B2;
  --sage-tint: #262C25;  --sage-ink: #BBCEAB;

  --good: #A9CC92;       --good-soft: #232A1F;
  --warning: #E6BB68;    --warning-soft: #2F2A1A;
  --error: #EBA098;      --error-soft: #33231F;
  --info: #A3C0D8;       --info-soft: #212A31;

  --purple: #D5B3D1;     --purple-soft: #2E262D;
  --pink: #E7A3B5;       --pink-soft: #33262B;
  --teal: #8CCAC4;       --teal-soft: #212C2B;
  --amber: #E3B05A;      --amber-soft: #2E2819;
  --gilt: #D9BC72;       --gilt-soft: #2D2818;

  --cat-1: #9DBBD6; --cat-2: #E3B968; --cat-3: #E39AB0;
  --cat-4: #A9CC92; --cat-5: #C3A9E0; --cat-6: #BDB6AD;
  --cat-ink: #171717;

  --status-gray: #A9A49C;
  --status-gray-light: #7A766F;
  --status-gray-soft: #2A2A2A;
  --yellow: #D8B650;

  --accent: #E3A78F;
  --accent-dark: #F0C3B0;
  --accent-soft: #302823;
  --accent-ink: #2E1810;

  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 4px 12px rgba(0, 0, 0, .4);
  --shadow-lg: 0 4px 6px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .5);
}

/* ---- accent presets ----
 *
 * The couple's choice, saved in settings.accent and stamped on the root by js/accent.js. Each
 * preset has a light and a dark value, because a colour that reads on cream is too dark to read
 * on charcoal. Terracotta is the default and needs no attribute.
 *
 * The earlier presets keep working: sea, plum, navy and sand are read as sage, mulberry, slate
 * and umber (js/shared/accents.js, and the copy of that map in js/accent-init.js). */
:root[data-accent="terracotta"] { --accent: #A5573F; --accent-dark: #843F2B; --accent-soft: #F6E3DA; --accent-ink: #FFFFFF; }
:root[data-accent="mulberry"]   { --accent: #6A434A; --accent-dark: #4E2F35; --accent-soft: #F3E4E3; --accent-ink: #FFFFFF; }
:root[data-accent="sage"]       { --accent: #5F7355; --accent-dark: #455539; --accent-soft: #E5EBDC; --accent-ink: #FFFFFF; }
:root[data-accent="ochre"]      { --accent: #8F6A22; --accent-dark: #6C4E14; --accent-soft: #F5EAD0; --accent-ink: #FFFFFF; }
:root[data-accent="slate"]      { --accent: #566F82; --accent-dark: #3E5567; --accent-soft: #E2EBF0; --accent-ink: #FFFFFF; }
:root[data-accent="umber"]      { --accent: #735B49; --accent-dark: #56412F; --accent-soft: #EDE4DA; --accent-ink: #FFFFFF; }

:root[data-theme="dark"][data-accent="terracotta"] { --accent: #E3A78F; --accent-dark: #F0C3B0; --accent-soft: #302823; --accent-ink: #2E1810; }
:root[data-theme="dark"][data-accent="mulberry"]   { --accent: #D8AEB6; --accent-dark: #E9C9CE; --accent-soft: #2F2729; --accent-ink: #2A1A1D; }
:root[data-theme="dark"][data-accent="sage"]       { --accent: #B3C6A2; --accent-dark: #CADCBB; --accent-soft: #262B25; --accent-ink: #1D2616; }
:root[data-theme="dark"][data-accent="ochre"]      { --accent: #DDBC70; --accent-dark: #EBD08E; --accent-soft: #2D2819; --accent-ink: #2E2208; }
:root[data-theme="dark"][data-accent="slate"]      { --accent: #A4BFD0; --accent-dark: #BDD3E1; --accent-soft: #232B31; --accent-ink: #14232D; }
:root[data-theme="dark"][data-accent="umber"]      { --accent: #CDB7A2; --accent-dark: #DEC9B6; --accent-soft: #2B2824; --accent-ink: #271C12; }

/* One accent for the whole app. Each tab used to own a colour, twelve of them, which was a
   colour-only code and collided with the status colours. A tab is now found by its label, and
   --tab-accent is kept as a name so components that read it need no change. */
[data-tab-accent] { --tab-accent: var(--accent); --tab-accent-soft: var(--accent-soft); }

/* On a phone the larger jobs step down one size: cards and the page edge to 16, sections to 32. */
@media (max-width: 640px) {
  :root { --space-card: var(--space-16); --space-section: var(--space-32); --space-gutter: var(--space-16); }
}
