/* Carrollton Care: the one theme. Values here only; no hex values elsewhere. */
:root {
  color-scheme: light;

  /* Surfaces and text */
  --ink: #15171c;            /* body text, headings, header background */
  --paper: #fbfaf6;          /* page background (warm cream) */
  --surface: #ffffff;        /* cards, forms, tables, menus */
  --surface-sunk: #f4f3ef;   /* table header, out-of-month days, disabled fills, code blocks */
  --line: #d6d3cb;           /* decorative dividers and card edges only (1.43:1, never a control edge) */
  --field-border: #7d7a72;   /* every control edge: inputs, chips, segmented, switch-off track (>= 3:1) */
  --muted: #5b5e66;          /* secondary text, help, captions, placeholders */

  /* Action colour (Atwood Lake teal): buttons, links, selected states */
  --primary: #0e5f66;
  --primary-strong: #0a464c; /* hover, pressed, visited-safe */
  --primary-tint: #e4f0f1;   /* selected chip, current tab background */
  --on-primary: #ffffff;
  --row-hover: #edf4f5;      /* table row hover */

  /* Header */
  --header: #15171c;
  --header-ink: #ffffff;
  --header-muted: #c9cbd1;   /* secondary header text (e.g. role after the name) */

  /* Focus ring: dark teal on light surfaces; gold on dark surfaces (scoped below) */
  --focus-on-light: #0a464c;
  --focus-on-dark: #f0b429;
  --focus: var(--focus-on-light);
  --focus-halo: #ffffff;

  /* Status: one meaning per colour (section 5.10). Text colour + tint background. */
  --ok: #1f6b3a;       --ok-tint: #e3f1e7;       /* done, approved, on, received, delivered */
  --warn: #7a4f00;     --warn-tint: #fcf0d2;     /* needs attention, partial, waiting, draft */
  --danger: #a3221b;   --danger-tint: #fbe5e2;   /* problem, failed, rejected, urgent, destructive */
  --info: #1d4f8c;     --info-tint: #e3ecf7;     /* new, submitted, in progress, simulator */
  --neutral: #4a4d55;  --neutral-tint: #ebe9e4;  /* off, closed, voided, inactive, not started */

  /* Review-mode tooling (not part of the theme; deliberately unlike any site colour) */
  --review: #3b1d5c;
  --review-ink: #ffffff;
  --review-link: #ffd98a;

  /* Program colours: FALLBACKS ONLY. layout.js overwrites them from cal_categories.color (2.3). */
  --program-giving-tree: #9e1b24;      /* crimson ribbon */
  --program-community-meal: #e8700a;   /* owner-chosen orange (fill/stripe only; text uses -text) */
  --program-community-meal-text: #a34d00;
  --program-meals-on-wheels: #1f6fd1;  /* owner-chosen blue */
  --program-seniors: #5b3f8c;
  --program-community-event: #5b3a8c;
  --program-holiday: #3d4f5c;
  --program: var(--primary);           /* the current page's program; set by [data-program] */

  /* Type */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --font-head: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Noto Serif", Georgia, serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, "Roboto Mono", monospace;

  --text-xs: 0.8125rem;                                   /* 13px: the floor. Badges, credits, meta. */
  --text-sm: 0.875rem;                                    /* 14px: staff tables, staff help, compact controls */
  --text-help: 0.9375rem;                                 /* 15px: public help text and captions */
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);  /* 16px at 360-390, 17px from 720px */
  --text-lg: clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem);  /* 18-20px: lede, h3, card titles */
  --text-xl: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem);    /* 22-28px: h2 */
  --text-2xl: clamp(1.75rem, 1.4rem + 1.6vw, 2.25rem);    /* 28-36px: h1 */
  --text-3xl: clamp(2rem, 1.5rem + 2.5vw, 2.75rem);       /* 32-44px: home hero only */
  --leading-body: 1.55;
  --leading-tight: 1.2;
  --measure: 66ch;                                        /* longest prose line */

  /* Spacing (4px base) */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;
  --gutter: 16px;            /* page side padding on phones */

  /* Controls */
  --tap: 48px;               /* minimum tap target, public */
  --control-h: 48px;         /* button / input height, public */
  --control-h-compact: 32px; /* staff desktop only: grids, toolbars, row actions */
  --row-h: 32px;             /* data grid and tracker rows, header and filter rows included */
  --field-font: 1rem;        /* never below 16px where a phone may tap it (iOS zoom) */

  /* Shape and depth */
  --radius-sm: 4px;          /* inputs, table filter boxes, code chips */
  --radius: 8px;             /* buttons, cards, notices, menus */
  --radius-pill: 999px;      /* badges, chips, switches */
  --shadow-sm: 0 1px 2px rgba(21, 23, 28, 0.08);
  --shadow-lg: 0 8px 24px rgba(21, 23, 28, 0.16);   /* menus, dialogs, dropdowns */
  --shadow-up: 0 -4px 16px rgba(21, 23, 28, 0.08);  /* sticky save bar */

  /* Layers */
  --z-table-head: 2;
  --z-sticky-col: 3;
  --z-sticky-bar: 10;        /* sticky save bar, sticky record panel */
  --z-header: 20;
  --z-dropdown: 30;          /* desktop menus, column picker */
  --z-menu-panel: 40;        /* phone menu panel */
  --z-dialog: 50;            /* reason dialog, undo bar */
  --z-overlay: 100;          /* camera scanner */

  /* Breakpoints: documentation only. CSS custom properties do NOT work inside @media
     conditions, so media queries use these literal numbers and no others:
       480px   small phones: stack actions full width
       760px   phone / desktop switch: phone header + menu panel at or below 760
      1100px   staff record pages become two columns
      1440px   staff wide monitors (no new rules required)  */
}

/* Staff area: same colours, desktop density */
.area-staff {
  --text-base: 1rem;         /* 16px */
  --text-lg: 1.25rem;        /* 20px */
  --text-xl: 1.5rem;         /* 24px */
  --text-2xl: 1.75rem;       /* 28px */
  --text-help: 0.875rem;     /* 14px */
  --leading-body: 1.45;
  --measure: 70ch;
  --control-h: 40px;
  --tap: 40px;
}
@media (max-width: 760px) {
  .area-staff { --control-h: 48px; --tap: 48px; } /* staff on a phone gets phone targets */
}

/* Giving Tree pages: the Christmas look (section 1). Only these colour tokens change. */
.theme-christmas {
  --header: #0a2b1d;          /* pine; white 15.26:1, header-muted 9.41:1, gold focus 8.19:1 */
  --primary: #114b32;         /* pine buttons and links; white on it 10.11:1, it on paper 9.68:1 */
  --primary-strong: #0b3322;  /* hover / pressed; 13.31:1 on paper */
  --primary-tint: #e3efe8;    /* selected chip, current tab; pine text on it 8.56:1 */
  --row-hover: #edf5f0;
  --focus-on-light: #0b3322;  /* the focus ring on light surfaces; 13.31:1 */
  --program: var(--program-giving-tree); /* crimson ribbon under the header, from cal_categories (2.3) */
  /* A var() inside a custom property is resolved where it is declared, so --focus is re-derived here
     or it would keep the base theme's teal. */
  --focus: var(--focus-on-light);
}

/* The current program, set on <body data-program="..."> */
[data-program="giving-tree"]      { --program: var(--program-giving-tree); }
[data-program="community-meal"]   { --program: var(--program-community-meal); }
[data-program="meals-on-wheels"]  { --program: var(--program-meals-on-wheels); }
[data-program="seniors"]          { --program: var(--program-seniors); }

/* Dark surfaces get the gold ring, with their own background as the halo */
.site-header, .undo-bar, .toolbar { --focus: var(--focus-on-dark); --focus-halo: var(--header); }
.review-bar { --focus: var(--focus-on-dark); --focus-halo: var(--review); }
/* ...but light panels that open inside the header go back to the teal ring */
.site-header .menu-items, .site-header .nav-panel-body, .site-header .account-menu-items {
  --focus: var(--focus-on-light); --focus-halo: var(--surface);
}
