/* sortmy.life design tokens and base rules (see docs/brand.md): the one copy. src/global.css imports it for the board,
   and server/signin/auth-pages.ts serves it as is at /auth/tokens.css to the sign-in pages, beside the two fonts. So the font
   urls stay relative: Vite rebases them for the build, and at /auth/ they name /auth/quicksand-*.woff2. Shared classes
   (.btn, .choice) live in components.css beside it. */

/* ---- Breakpoints ----
   Few on purpose: only B1 changes the main layout. The others tune spacing or one component. Every app @media that
   names a width ends with a comment giving its number and why in about five words, like "B2: tighter room padding".
   TypeScript's matchMedia widths do the same. css-guard.test.ts holds the app to these. Ask Joel before adding one.
   Media queries can't read custom properties, so each width is written out where it's used.
   B1 1100px: the main layout. Below it, phone and tablet: the filter chips on top, one room at a time, the ☰ menu.
      From it, the desktop: the left column holds search, Places and Rooms, with the picked room beside it.
      React reads it as NARROW (src/media.ts). Help text picks its version by it (data-layout, components.css).
   B2 700px: phone versus tablet. Up to it, tighter padding, sheets the full width, full-width menus. From 701px, a
      sheet floats as a card and a mouse gets compact rows.
   B3 359px: very small phones, up to 359px. One component squeezes to fit.
   The marketing site (site/site.css) lays out its own sections at its own widths. */

/* ---- Fonts ---- */
/* Quicksand, self-hosted: 400 for buttons, 600 for headings. */
@font-face {
  font-family: Quicksand; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/auth/quicksand-400.woff2?v=GwkscR3xx60g') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Quicksand; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/auth/quicksand-600.woff2?v=icJD5b4YRIz6') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---- Tokens: light ---- */
:root {
  color-scheme: light dark;

  /* Fonts */
  --font-display: Quicksand, system-ui, sans-serif;   /* Quicksand: 600 headings, 400 buttons (--font-button-weight) (the wordmark is its own SVG) */
  --font-button-weight: 400;   /* 600 marks the current/emphasized button */
  --font-body: system-ui, sans-serif;

  /* Color */
  --bg: #f3f1ec;
  --surface: #ffffff;
  --text: #1b2433;          /* also the ink of the logo and the focus ring */
  --muted: #566074;
  --line: #8a92a3;          /* input borders (3:1 on surface) */
  --line-soft: #e4e0d8;     /* card, tile and divider borders */
  /* A .popover: a fill lighter than a card in dark, fading from --surface-raised-top down to --surface-raised, inside a
     firmer edge. In dark the top keeps --muted at 5.2:1 and --line at 3:1. */
  --surface-raised-top: var(--surface);  --surface-raised: var(--surface);  --chip-raised: rgb(0 0 0 / .07);  --chip-raised-line: rgb(0 0 0 / .18);  --line-raised: #d6d1c7;
  --fill-raised: linear-gradient(var(--surface-raised-top), var(--surface-raised));
  /* One step above the raised rail, for what opens over it (search's dropdown; Joel, 2026-11-15, stack-3up.html B). */
  --surface-float-top: #ffffff;  --surface-float: #fbfaf7;
  --fill-float: linear-gradient(var(--surface-float-top), var(--surface-float));
  --primary: #0b6bcb;  --on-primary: #ffffff;  --primary-hover: #08529c;
  --sun: #ffb020;      --sun-tint: #fff3d6;     /* fills only, never text on light */
  --sun-line: color-mix(in srgb, var(--sun) 70%, transparent);  /* the one sun outline: move targets, drag hints, the dark tray edge */
  --on-sun: #1b2433;
  --ok: #0f6b3a;  --warn: #8a5300;
  --danger: #b4231a;   --on-danger: #ffffff;   --danger-hover: #8a1a13;
  --mark-important: #a86b00;  --mark-sentimental: #c03a63;  /* item marks: solid star and heart icons */
  --shadow-sm: 0 1px 2px rgb(27 36 51 / .10), 0 2px 6px rgb(27 36 51 / .12);  /* a bar over scrolling content: the phone's header (Joel, 2026-11-16) */
  --shadow-md: 0 3px 6px rgb(27 36 51 / .18), 0 16px 36px rgb(27 36 51 / .34);  /* a float popover on the phone, smaller than --shadow-float (Joel, 2026-11-16) */
  --shadow-pop: 0 2px 4px rgb(27 36 51 / .12), 0 12px 32px rgb(27 36 51 / .22);  /* dialogs, menus, toasts */
  --shadow-float: 0 4px 8px rgb(27 36 51 / .14), 0 24px 56px rgb(27 36 51 / .30);  /* a float popover, deeper than --shadow-pop */

  /* Tints: every mix used more than once (the guard fails on a repeated hand mix). Light-only: their inputs switch. */
  --hover-row: color-mix(in srgb, var(--sun) 35%, var(--surface));        /* hover on rows, menu items, sort cells */
  --hover-quiet: color-mix(in srgb, var(--text) 8%, transparent);         /* hover on small chrome: ⋯, back, chips */
  --hover-danger: color-mix(in srgb, var(--danger) 14%, var(--surface));  /* hover on delete and remove */
  --hover-plain: color-mix(in srgb, var(--surface) 92%, var(--text));     /* hover on destinations and people */
  --tint-primary: color-mix(in srgb, var(--primary) 12%, var(--surface));        /* the soft blue of secondary buttons */
  --tint-primary-hover: color-mix(in srgb, var(--primary) 20%, var(--surface));  /* ... and its hover */
  --tint-current: color-mix(in srgb, var(--primary) 22%, var(--surface));        /* the current tab or room */
  --line-faint: color-mix(in srgb, var(--text) 18%, transparent);          /* sun rays, the empty sun-panel mark */
  --edge-sun-soft: color-mix(in srgb, var(--sun) 45%, var(--line-soft));   /* welcome and first-thing cards */
  --meter-ok: color-mix(in srgb, var(--ok) 45%, var(--surface));          /* an ok pip of a .meter: faint, so warn and down stand out */

  /* Shape */
  --radius-control: 8px;  --radius-tray: 8px;  --radius-card: 8px;  /* one corner everywhere but pills and circles */  --radius-pill: 999px;
  --border-w: 1px;   /* every plain border */
  --tap: 44px;
  --tap-row: 48px;   /* a row of a list: .choice, .choice-add, .status-row, .result */
  --w-results: 360px;   /* a list of results on the desktop: search's dropdown and the pile (Joel, 2026-11-15) */
  --column-max: 28rem;   /* a cap, never a fixed width: a phone-shaped column on a wider screen (sheet, toast, select bar, admin Invites); always min() or max-width, so phones keep their full width */
  --icon-sm: 16px;  --icon-md: 20px;  --icon-lg: 24px;   /* icons: beside small text, rows and menus, header buttons (src/ui/icon.ts) */
  --focus-color: var(--primary);  --focus-gap: var(--bg);  --focus-reach: 8px;   /* the blue glow; --focus-reach is how far it draws past the edge */

  /* Type */
  --fs-11: 11px;   /* the desktop's build card alone */
  --fs-13: 13px; --fs-16: 16px; --fs-20: 20px; --fs-25: 25px; --fs-31: 31px;
  --fs-h1: var(--fs-25);  --fs-h2: var(--fs-20);   /* each steps down one brand step on smaller screens, below */

  /* Space */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;   /* spacing scale; a .choice row adds 10px of air above and below its text */

  /* Motion */
  --ease: cubic-bezier(.2, .7, .3, 1);
  --fast: 150ms;    /* color fades and pop-ins on small chrome */
  --slow: 250ms;    /* sheets, slides, the sidebar width, pops */
  --linger: 1200ms; /* the highlight on a just-moved item */
  --shimmer: 3s;    /* one pass of the Other field's example shimmer, so each example shows this long */
  --disabled-opacity: .45;

  /* Layers, low to high. */
  --z-raised: 1; --z-sidebar: 5; --z-skip: 10; --z-menu: 50; --z-bar: 60; --z-toast: 100; --z-tooltip: 200;

  /* Board only: trays, tints and outlines only the board draws */
  --surface-subtle: color-mix(in srgb, var(--text) 4%, var(--surface));
  --surface-sunken: color-mix(in srgb, var(--text) 7%, var(--surface));
  --surface-hover: color-mix(in srgb, var(--text) 8%, var(--surface));
  --hover-ring: color-mix(in srgb, var(--primary) 70%, transparent);  /* desktop hover outline on drag handles */
  --drop-fill: color-mix(in srgb, var(--sun) 60%, #ffffff);
  --shadow-lift: 0 2px 4px rgb(27 36 51 / .14), 0 12px 28px rgb(27 36 51 / .26); /* a dragged tile */

  /* Landing only: the display layer, marketing type and section spacing (docs/brand.md) */
  --fs-display: clamp(36px, 5.4vw, 60px);  --fs-section: clamp(26px, 3.4vw, 39px);  --sp-block: 48px;  --sp-section: 72px;
  /* The homepage's locked sizes (docs/brand/landing.md) */
  --fs-web-12: 12px; --fs-web-14: 14px; --fs-web-15: 15px; --fs-web-17: 17px; --fs-web-18: 18px; --fs-web-19: 19px; --fs-web-22: 22px; --fs-web-44: 44px;
  --sp-7: 64px; --sp-8: 96px;
  --sun-glow: color-mix(in srgb, var(--sun) 45%, transparent);   /* the hero's moment of joy on the found row */
  /* Smoked glass over a photo (the landing hero's dock): the same in light and dark, since the photo sets the tone. */
  --glass-deep: rgb(20 18 16 / .5);  --glass-edge: rgb(255 255 255 / .18);  --on-glass: #fff;

  /* Breakpoints (media queries can't read variables, so the guard keeps to this list):
     phone ≤700px (701px up is wider), desktop ≥1100px (≤1099px below it); extras: 359px small phone,
     and 640px / 860px on the landing site only. */
}

/* ---- Tokens: dark (system setting, or forced with data-theme) ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111723;  --surface: #1a2233;  --text: #eef1f7;  --muted: #a3adc2;
    --line: #76819a;  --line-soft: #2e3850;
    --surface-raised-top: #2c374f;  --surface-raised: #252f45;  --chip-raised: rgb(255 255 255 / .10);  --chip-raised-line: rgb(255 255 255 / .22);  --line-raised: #445172;
    --surface-float-top: #34405b;  --surface-float: #2a3550;
    --primary: #7db4ff;  --on-primary: #0a1a33;  --primary-hover: #a6ccff;
    --sun: #ffb84d;  --sun-tint: #2f2a1c;
    --sun-line: color-mix(in srgb, var(--sun) 70%, transparent);
    --ok: #5fd38d;  --warn: #f2b84b;
    --danger: #ff8f85;  --on-danger: #2a0906;  --danger-hover: #d9625a;
    --mark-important: var(--sun);  --mark-sentimental: #f48fb1;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .45), 0 2px 6px rgb(0 0 0 / .5);
    --shadow-md: 0 3px 6px rgb(0 0 0 / .65), 0 16px 36px rgb(0 0 0 / .8);
    --shadow-pop: 0 2px 4px rgb(0 0 0 / .6), 0 12px 32px rgb(0 0 0 / .65);
    --shadow-float: 0 4px 8px rgb(0 0 0 / .6), 0 24px 56px rgb(0 0 0 / .75);
    --shadow-lift: 0 2px 4px rgb(0 0 0 / .6), 0 12px 28px rgb(0 0 0 / .65);
    --drop-fill: color-mix(in srgb, var(--sun) 35%, var(--surface));
  }
}
:root[data-theme="dark"] {
  --bg: #111723;  --surface: #1a2233;  --text: #eef1f7;  --muted: #a3adc2;
  --line: #76819a;  --line-soft: #2e3850;
  --surface-raised-top: #2c374f;  --surface-raised: #252f45;  --chip-raised: rgb(255 255 255 / .10);  --chip-raised-line: rgb(255 255 255 / .22);  --line-raised: #445172;
  --surface-float-top: #34405b;  --surface-float: #2a3550;
  --primary: #7db4ff;  --on-primary: #0a1a33;  --primary-hover: #a6ccff;
  --sun: #ffb84d;  --sun-tint: #2f2a1c;
  --sun-line: color-mix(in srgb, var(--sun) 70%, transparent);
  --ok: #5fd38d;  --warn: #f2b84b;
  --danger: #ff8f85;  --on-danger: #2a0906;  --danger-hover: #d9625a;
  --mark-important: var(--sun);  --mark-sentimental: #f48fb1;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .45), 0 2px 6px rgb(0 0 0 / .5);
  --shadow-md: 0 3px 6px rgb(0 0 0 / .65), 0 16px 36px rgb(0 0 0 / .8);
  --shadow-pop: 0 2px 4px rgb(0 0 0 / .6), 0 12px 32px rgb(0 0 0 / .65);
  --shadow-float: 0 4px 8px rgb(0 0 0 / .6), 0 24px 56px rgb(0 0 0 / .75);
  --shadow-lift: 0 2px 4px rgb(0 0 0 / .6), 0 12px 28px rgb(0 0 0 / .65);
  --drop-fill: color-mix(in srgb, var(--sun) 35%, var(--surface));
}

@media (max-width: 1099px) {   /* B1: smaller page title */
  :root { --fs-h1: var(--fs-20); }
}
@media (max-width: 700px) {   /* B2: smaller section titles */
  :root { --fs-h2: var(--fs-16); }
}

:root[data-theme="dark"] { color-scheme: dark; }   /* a forced theme also themes form controls and scrollbars */
:root[data-theme="light"] { color-scheme: light; }

/* ---- Base ---- */
body { margin: 0; background: var(--bg); color: var(--text); font: var(--fs-16) var(--font-body);
  transition: background-color var(--slow) ease, color var(--slow) ease; }   /* a theme switch fades the page instead of flashing it (Joel, 2026-11-16) */
h1, h2, h3, p { margin: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; }

/* Focus: the blue glow everywhere, never removed. Defined per element, so a control can set its own --focus-gap (the
   color behind it) or --focus-color (red on an invalid field). The transparent outline is what forced-colors mode
   shows, since it drops box-shadows. --focus-ring: filled controls, with a gap. --focus-ring-field: fields, round their
   own border. --focus-ring-inset: rows inside clipped lists. */
:where(*) {
  --focus-ring: 0 0 0 2px var(--focus-gap), 0 0 0 4px var(--focus-color), 0 0 0 8px color-mix(in srgb, var(--focus-color) 35%, transparent);
  --focus-ring-field: 0 0 0 2px var(--focus-color), 0 0 0 6px color-mix(in srgb, var(--focus-color) 35%, transparent);
  --focus-ring-inset: inset 0 0 0 2px var(--focus-color), inset 0 0 0 6px color-mix(in srgb, var(--focus-color) 35%, transparent);
}
:focus-visible { outline: 2px solid transparent; outline-offset: 2px; box-shadow: var(--focus-ring); }
input:not([type=radio], [type=checkbox]):focus-visible, select:focus-visible, textarea:focus-visible {
  border-color: var(--focus-color); box-shadow: var(--focus-ring-field);
}
[aria-invalid=true] { --focus-color: var(--danger); }   /* a wrong field glows red */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
