/* Cardwell Family App, Money planner: design tokens (Iris, 2026-11-15, bead pd-7bg8g.3)
   Copied into the app by Fynn (bead pd-7bg8g.2) with four changes: --ink-faint darker, --line-strong at
   3:1 or better, --personal lightened with an --on-personal text colour, and --fs-label and --fs-tab raised
   to 13px so no text is under 13px.

   Source: Felicia's handoff palette and type (private handoff docs/02, "Extracted tokens"):
   cream ground, coral for actions, green and gold in support, Georgia display, system sans.
   Changes from her values, each for a reason:
   - --ink-soft is darker than her muted grey so small labels pass 4.5 to 1.
   - --coral-ink is a darker coral for button fills and link text (white on it is 5.6 to 1).
     Her coral stays for the large italic phrase and the heavy-month bars.
   - --business (slate) is new. Business must never wear a family member's colour, and her
     prototype's lavender tag is Isabell's.

   Rules for anyone applying this file:
   - Colours only through these variables. No raw hex in component CSS.
   - Type sizes are rem and fluid. Never set a px font size, never change a size per breakpoint.
   - Every amount in a row, table or chart uses --font-ui with --num (tabular, lining figures).
     Georgia is for the one sentence per view and for section titles only.
   - Custom properties cannot be used in media queries. The two breakpoints are written out:
       56.25em (900px)  sidebar replaces the phone tab bar
       70em   (1120px)  the right rail appears beside the main column
*/

:root {
  /* ---------- Colour: surfaces ---------- */
  --ground: #f7f6f1;        /* page */
  --ground-deep: #eeefe7;   /* sidebar, tab bar, segmented control track, meter track */
  --card: #ffffff;          /* cards, sheets, the rail */
  --field: #fafaf7;         /* input fill */
  --press: #f1f1ea;         /* row hover and press */
  --line: #e8e8df;          /* card borders, row dividers */
  --line-strong: #8a8e84;   /* input borders, chart axis, outlines (3.1 to 1 or better on ground, card and field) */
  --scrim: rgb(39 55 46 / 0.34);

  /* ---------- Colour: text ---------- */
  --ink: #303934;           /* primary text */
  --ink-soft: #5b6159;      /* secondary text, captions, labels (5.9 to 1 on ground) */
  --ink-faint: #6d716a;     /* icons, placeholders, chart labels (5.0 to 1 on white, 4.6 on ground) */
  --on-fill: #ffffff;       /* text on coral-ink, green, business fills */

  /* ---------- Colour: action (coral) ---------- */
  --coral: #c76652;         /* display italic phrase, heavy-month bar, decorative */
  --coral-ink: #a54d3a;     /* primary button fill, links, selected tab label */
  --coral-press: #8f4131;   /* pressed primary button */
  --coral-soft: #f5e2dc;    /* soft button, selected day, heavy-month tint */

  /* ---------- Colour: meaning ---------- */
  --left: #497965;          /* what's left, income, paid (her green) */
  --left-ink: #3b6553;      /* green text on white or on --left-soft */
  --left-soft: #e3eee6;     /* the featured leftover tile, payday ring fill */
  --over: #a8281e;          /* over budget, negative leftover, form errors */
  --over-soft: #fbe8e5;
  --note-bg: #f2ede3;       /* the quiet explainer banner */
  --note-ink: #6b5f4a;

  /* ---------- Colour: scope ----------
     Household gold is Felicia's "shared-family accent". Business slate is the one cool colour.
     Shared is drawn as stripes of both, never a third colour. Always paired with a text label. */
  --personal: #c49b54;      /* fills: bars, dots, the scope strip. --on-personal text on it is 4.6 to 1 */
  --on-personal: #303934;
  --personal-ink: #7a5a1e;  /* text on white or on --personal-soft */
  --personal-soft: #f6f0df;
  --business: #3c5870;
  --business-ink: #3c5870;
  --business-soft: #e3eaf0;
  --shared-stripe: repeating-linear-gradient(135deg, var(--personal) 0 0.25rem, var(--business) 0.25rem 0.5rem);

  /* The view wears its scope. Default is Both (ink). Set data-scope on the app root. */
  --scope: var(--ink);
  --scope-ink: var(--ink);
  --scope-soft: var(--ground-deep);

  /* Family member colours. Money never uses these. Listed so the rest of the app shares one file. */
  --felicia: #c76652;  --felicia-soft: #f5e2dc;
  --terry: #497965;    --terry-soft: #e3eee6;
  --isabell: #9173b3;  --isabell-soft: #eee7f7;

  --focus: #7b5fa8;         /* focus ring, the only purple in Money */

  /* ---------- Type ---------- */
  --font-display: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --num: tabular-nums lining-nums;   /* use as font-variant-numeric: var(--num) */

  --fs-hero: clamp(2.125rem, 1.74rem + 1.57vw, 3rem);       /* 34 to 48: the one sentence */
  --fs-title: clamp(1.375rem, 1.32rem + 0.22vw, 1.5rem);    /* 22 to 24: card and section titles */
  --fs-stat: clamp(1.5rem, 1.39rem + 0.45vw, 1.75rem);      /* 24 to 28: totals in tiles, sans */
  --fs-lead: clamp(1.0625rem, 1.035rem + 0.11vw, 1.125rem); /* 17 to 18: hero support line */
  --fs-body: 1rem;                                          /* rows, inputs (never below 16) */
  --fs-sub: 0.9375rem;                                      /* 15: buttons, tabs, table cells */
  --fs-cap: 0.8125rem;                                      /* 13: meta lines, chart labels */
  --fs-label: 0.8125rem;                                    /* 13: table column heads, chart ticks, chips. Sentence case, never all caps. No text in the app is smaller than this */
  --fs-tab: 0.8125rem;                                      /* 13: phone tab bar labels */

  --lh-tight: 1.1;      /* hero */
  --lh-snug: 1.3;       /* titles, two-line rows */
  --lh-body: 1.5;
  --tr-display: -0.025em;
  --tr-title: -0.015em;
  --tr-label: 0.01em;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-strong: 600;

  /* ---------- Spacing (0.25rem base) ---------- */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;

  /* Breathing room, fluid between phone and laptop */
  --gutter: clamp(1.125rem, 0.6rem + 2.2vw, 2.5rem);        /* page side padding: 18 to 40 */
  --card-pad: clamp(1.125rem, 0.96rem + 0.67vw, 1.5rem);    /* 18 to 24 */
  --stack: clamp(1rem, 0.78rem + 0.9vw, 1.5rem);            /* gap between cards: 16 to 24 */
  --section-gap: clamp(1.75rem, 1.42rem + 1.35vw, 2.5rem);  /* between hero, charts, lists: 28 to 40 */
  --row-pad-y: 0.875rem;                                    /* list rows: 14 */

  /* Layout */
  --sidebar-w: 14rem;       /* 224 */
  --rail-w: 22.5rem;        /* 360: item editor, day detail */
  --content-max: 78rem;
  --tap: 2.75rem;           /* 44: minimum hit target */
  --tabbar-h: 4rem;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  /* ---------- Radius ---------- */
  --r-card: 1rem;           /* cards, sheets on laptop */
  --r-ctl: 0.625rem;        /* buttons, inputs, nav items */
  --r-chip: 0.375rem;       /* tags, day cells */
  --r-bar: 0.25rem;         /* chart bars, meters */
  --r-sheet: 1.25rem;       /* phone sheet top corners */
  --r-pill: 62.5rem;        /* segmented controls, pills */

  /* ---------- Depth: hairlines first, shadow only for things that float ---------- */
  --shadow-thumb: 0 0.125rem 0.375rem rgb(48 57 52 / 0.08);  /* selected segment, active nav */
  --shadow-float: 0 1.25rem 5rem rgb(40 51 43 / 0.19);       /* sheet, dialog */

  /* ---------- Motion ---------- */
  --dur: 200ms;
  --dur-fast: 140ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-scope="personal"] {
  --scope: var(--personal);
  --scope-ink: var(--personal-ink);
  --scope-soft: var(--personal-soft);
}
[data-scope="business"] {
  --scope: var(--business);
  --scope-ink: var(--business-ink);
  --scope-soft: var(--business-soft);
}
[data-scope="both"] {
  --scope: var(--ink);
  --scope-ink: var(--ink);
  --scope-soft: var(--ground-deep);
}

/* Derived from --scope. Declared on every element that sets a scope so they recompute there
   (a var() inside a custom property resolves where it is declared, not where it is used). */
:root,
[data-scope] {
  /* Spending steps for stacked bars: largest group darkest. Colour says "spent", order says which. */
  --step-1: var(--scope);
  --step-2: color-mix(in srgb, var(--scope) 80%, var(--card));
  --step-3: color-mix(in srgb, var(--scope) 62%, var(--card));
  --step-4: color-mix(in srgb, var(--scope) 46%, var(--card));
  --step-5: color-mix(in srgb, var(--scope) 32%, var(--card));
  --step-6: color-mix(in srgb, var(--scope) 20%, var(--card));
  /* Money held back before it can be spent: tax set-aside, sinking funds */
  --setaside-hatch: repeating-linear-gradient(135deg, var(--scope) 0 0.125rem, transparent 0.125rem 0.375rem);
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur: 0ms; --dur-fast: 0ms; }
}
