/* Theme tokens (#282) — the single source of colour for the member shell.
 *
 * The layering rule scripts/lint.sh enforces: colour literals (hex,
 * rgb(), hsl()) appear in this file alone. Every other stylesheet and
 * template rides these tokens, so a palette move or a new theme is a
 * block of overrides here, never a hunt through the tree.
 *
 * Palette A7 "Teal bright" is the platform default and rides :root;
 * the selector's [data-theme="a7"] arm (#309) lets a subtree — the
 * picker's default swatch chip — scope itself back to A7 whatever
 * the page around it paints. Palette A8 "Indigo dusk" overrides the
 * palette tokens under html[data-theme="a8"]; the structure tokens —
 * type scale, spacing, radii, layout — are palette-invariant and
 * live once in :root.
 *
 * Both attributes are server-rendered on <html> by
 * core.common.context_processors.theme, so the first paint is already
 * correct: no flash. The settings picker's instant preview (#293)
 * repaints the attribute between a radio change and the save; the
 * saved value always arrives from the server.
 *
 * Light is declared explicitly (color-scheme) rather than following a
 * prefers-color-scheme query: a dark palette is a future theme the
 * member chooses, not an OS setting the shell half-follows — form
 * controls, scrollbars and forced-colours fallbacks would otherwise
 * render dark inside a light page (decision recorded on #282).
 */

/* The [data-theme="a7"] arm (#309): an element carrying the default
   palette's attribute — the settings picker's default swatch chip —
   scopes its own subtree to A7 whatever the page around it paints.
   One block, both arms: the A7 palette never exists twice. Without
   the arm the chip matched no rule and inherited the active palette,
   so under A8 both chips painted indigo. */
:root,
[data-theme="a7"] {
  color-scheme: light;

  /* ---- Palette A7 — "Teal bright": deep teal accent, airy neutrals ---- */
  --ink: #16302e;
  --muted: #5f7371;
  --line: #e0ecec;
  --line-strong: #c6d8d7;
  --bg: #f7fafa;
  --surface: #ffffff;
  --surface-sunken: #ecf4f4;

  --accent: #0d7a6e;
  --accent-hover: #0a6459;
  --accent-soft: #e2f5f2;
  --accent-ink: #ffffff;

  /* Semantic colours are platform-fixed: they carry meaning (danger,
     information, success, warning) and never move with a palette.
     Their hues must also stay clear of every palette's accent zone,
     so a status surface can never be mistaken for brand chrome (#307)
     — and the separation must read perceptually, not just as a hue
     number (#311): success is a saturated warm green well away from
     the A7 teal, info an ocean blue balanced between the A7 teal and
     the A8 indigo. Check a new palette's accent against these hues
     before offering it. */
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --danger-ink: #8a1c13;
  --info-soft: #e8f2f8;
  --info-ink: #0f5a80;
  /* The vivid base green for success text painted straight on a
     surface — the adjust-balance amount's credit leg (#289) — where
     the darker -ink variants read dull. The most saturated green
     still clearing AA 4.5:1 on --surface (5.1:1); the -ink/-soft
     pair stays the text-on-badge-fill combination. Its hue sits well
     clear of both palettes' accent zones (#307, #311). */
  --success: #1a7f37;
  --success-soft: #e2f2d8;
  --success-ink: #1f5c1c;
  --warn-soft: #fdf3e3;
  --warn-ink: #7a4a12;
  --warn-line: #ecd9b6;
  /* Ink for text on a solid --danger fill (delete-style actions). */
  --on-danger: #ffffff;

  /* Header / brand */
  --header-bg: #ffffff;
  --header-ink: #16302e;
  --header-nav-ink: #0d7a6e;
  --header-muted: #5f7371;
  --brand-bg: #0d7a6e;
  --brand-ink: #ffffff;

  /* Depth: shadows are tinted with the palette's ink, so they are
     palette tokens, not structure tokens. */
  --shadow-sm: 0 1px 2px rgba(22, 48, 46, 0.06);
  --shadow-tabbar: 0 -1px 6px rgba(22, 48, 46, 0.05);

  /* Print substitutes (the print block in base.css): ink on white,
     whatever the screen palette. */
  --print-ink: #000000;
  --print-bg: #ffffff;

  /* ---- Structure tokens: identical across every palette ---- */

  /* Type scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: clamp(1.2rem, 1.1rem + 0.45vw, 1.4rem);
  --text-2xl: clamp(1.45rem, 1.3rem + 0.75vw, 1.85rem);

  /* Spacing scale */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;

  /* Shape */
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  /* Accent hairline a theme may grow on cards; 0 keeps them flat. */
  --card-accent-width: 0px;

  /* Layout: the measure the member pages' main column never exceeds. */
  --measure: 60rem;
}

/* ---- Palette A8 — "Indigo dusk": indigo accent, dusk neutrals ----
   Palette tokens only; the structure tokens above are shared.

   The selector also matches a [data-theme] attribute on any element
   (#293): the settings picker's swatch chips carry it, so a chip
   scopes its own subtree to the palette's real colours without a
   copy of the palette living anywhere. */
html[data-theme="a8"],
[data-theme="a8"] {
  --ink: #1e2233;
  --muted: #61657a;
  --line: #e4e5ee;
  --line-strong: #cdcede;
  --bg: #f5f5fa;
  --surface: #ffffff;
  --surface-sunken: #ededef;

  --accent: #4353b8;
  --accent-hover: #36449a;
  --accent-soft: #eaecf9;
  --accent-ink: #ffffff;

  --header-bg: #ffffff;
  --header-ink: #1e2233;
  --header-nav-ink: #4353b8;
  --header-muted: #61657a;
  --brand-bg: #4353b8;
  --brand-ink: #ffffff;

  --shadow-sm: 0 1px 2px rgba(30, 34, 51, 0.06);
  --shadow-tabbar: 0 -1px 6px rgba(30, 34, 51, 0.05);
}
