/*
 * Homework Tracker design tokens.
 * Source of truth: docs/DESIGN.md (derived from the "Homework Tracker UX Redesign" canvas).
 * Every colour, radius, shadow and font in the app comes from here. Do not hard-code hex
 * values in templates or component CSS; the only exception is the per-subject colour,
 * which is user data and arrives from the database.
 *
 * tailwind.config.js repeats the colours as daisyUI themes (daisyUI needs literal values at
 * build time). cmd/web/design_test.go fails if the two disagree, so change both together.
 */

/* Self-hosted, not Google Fonts: the Content-Security-Policy only allows same-origin fonts.
   Files and licence: ui/static/fonts/README.md. */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url("../fonts/bricolage-grotesque-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/figtree-latin.woff2") format("woff2");
}

:root {
  color-scheme: light;

  /* Surfaces */
  --bg: #F2F4F7;          /* page ground */
  --surface: #FFFFFF;     /* cards, rows, nav bars */
  --surface2: #E8ECF2;    /* recessed: fold rows, progress track, neutral pills, segmented track */
  --line: #DCE1E9;        /* dividers, input borders, secondary button borders */

  /* Text */
  --ink: #12161C;         /* primary text */
  --ink2: #465162;        /* secondary text, labels, inactive tabs */
  --ink3: #5F6A7A;        /* tertiary: source names, placeholders, done items, chevrons */

  /* Accent: the only brand colour. Actions, selection, progress, done state. */
  --accent: #3445C8;
  --accentInk: #FFFFFF;       /* text/icons on --accent */
  --accentSoft: #E4E7FB;      /* selected chip fill, active sidebar item, avatar fill */
  --accentSoftInk: #2433A5;   /* text on --accentSoft */

  /* Warn: overdue, failed, needs attention, destructive. The only alert colour. */
  --warn: #B13F08;
  --warnSoft: #FCE7DA;

  --shadow: 0 1px 2px rgba(18, 22, 28, .06), 0 6px 18px rgba(18, 22, 28, .05);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, .18);  /* popover menus only */

  /* Type */
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Radii */
  --r-xs: 8px;    /* colour swatch inputs */
  --r-sm: 10px;   /* desktop buttons, sidebar items, menu items */
  --r-md: 12px;   /* inputs, inner fields, flag banners, photo thumbs */
  --r-lg: 14px;   /* secondary mobile buttons, textarea, fold rows */
  --r-xl: 16px;   /* list rows, row groups, primary CTA, callouts */
  --r-2xl: 20px;  /* hero/summary cards, desktop cards, review cards */
  --r-pill: 999px;

  /* Touch targets */
  --tap-min: 44px;     /* absolute minimum for anything interactive */
  --tap-icon: 48px;    /* icon-only buttons (back, close, more, check ring hit area) */
  --tap-cta: 54px;     /* primary full-width CTA, tab bar items */

  /* Layout */
  --gutter-list: 16px;   /* list screens (Home, Family, More) */
  --gutter-form: 20px;   /* form/detail screens (Add, Detail) */
  --content-max: 980px;  /* desktop admin content column */
  --sidebar-w: 248px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E1117;
    --surface: #171B23;
    --surface2: #222936;
    --line: #2A3140;
    --ink: #EEF1F6;
    --ink2: #B6BFCC;
    --ink3: #8E99AA;
    --accent: #8E9CFF;
    --accentInk: #0E1117;
    --accentSoft: #262D5A;
    --accentSoftInk: #C9CFFF;
    --warn: #FF9A62;
    --warnSoft: #3A2317;
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E1117;
  --surface: #171B23;
  --surface2: #222936;
  --line: #2A3140;
  --ink: #EEF1F6;
  --ink2: #B6BFCC;
  --ink3: #8E99AA;
  --accent: #8E9CFF;
  --accentInk: #0E1117;
  --accentSoft: #262D5A;
  --accentSoftInk: #C9CFFF;
  --warn: #FF9A62;
  --warnSoft: #3A2317;
  --shadow: none;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
::placeholder { color: var(--ink3); opacity: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
