/* dentatsu's design tokens: the one set of custom properties the site and the web client both use
 * (design/README.md). Plain CSS: no build step needed to read it.
 *
 * Two attributes on <html> choose the colors (design/theme.js keeps the choice):
 *   data-theme="light" | "dark"                  none: follow the system (prefers-color-scheme)
 *   data-palette="slate" | "sand" | "moss" | "plum"  none: slate
 *
 * A palette sets only a neutral hue and saturation and its accent colors; the light and dark blocks below turn them
 * into surfaces, lines and text. Every text and fill pair is checked for WCAG AA by design/check.mjs (CI step
 * design-check), for every palette in both modes.
 */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap;
             src: url(fonts/inter-regular.woff) format("woff"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap;
             src: url(fonts/inter-medium.woff) format("woff"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap;
             src: url(fonts/inter-semibold.woff) format("woff"); }

:root {
  /* ---- type: Inter (SIL OFL 1.1, design/fonts/OFL.txt), three weights; no bold above 600 (quiet chrome) */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --text-2xs: 0.6875rem;   /* 11px: badges, counters */
  --text-xs: 0.75rem;      /* 12px: timestamps, captions */
  --text-sm: 0.8125rem;    /* 13px: chrome, menus, labels */
  --text-base: 0.9375rem;  /* 15px: messages, body */
  --text-md: 1.0625rem;    /* 17px: lead text, room titles */
  --text-lg: 1.25rem;      /* 20px: section headings */
  --text-xl: 1.5rem;       /* 24px: page headings in the app */
  --text-2xl: 2rem;        /* 32px: site headings */
  --text-3xl: 2.75rem;     /* 44px: the landing page's title */
  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading: 1.5;
  --leading-loose: 1.65;   /* long reading (guides) */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-strong: 600;
  --tracking-tight: -0.02em;   /* headings */
  --tracking-wide: 0.04em;     /* small capitals labels */

  /* ---- spacing: a 4px grid */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;

  /* ---- radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;

  /* ---- motion: short and eased out; none under prefers-reduced-motion (below) */
  --dur-instant: 80ms;
  --dur-fast: 120ms;
  --dur: 180ms;
  --dur-slow: 280ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-spring: cubic-bezier(0.34, 1.36, 0.64, 1);   /* a small overshoot: toasts, popovers */

  /* ---- layers */
  --z-sticky: 10;
  --z-menu: 30;
  --z-dialog: 40;
  --z-toast: 50;

  /* ---- sizes */
  --control-sm: 28px;
  --control: 34px;
  --control-lg: 42px;
  --measure: 68ch;          /* the longest line of reading text */

  /* ---- the palette's parameters (slate: cool grey, blue accent) */
  --n-h: 222;               /* neutral hue */
  --n-s: 12%;               /* neutral saturation: low, so the chrome stays quiet */
  --p-accent: #3d5bd9;      /* the accent as a fill (light mode); white text on it */
  --p-accent-hover: #3049b8;
  --p-accent-text: #3451c9; /* the accent as text on the light background */
  --p-accent-dk: #4a64d6;   /* the accent as a fill (dark mode); white text on it */
  --p-accent-dk-hover: #3f58c4;
  --p-accent-dk-text: #93a7fa;
  --p-accent-soft-h: 226;   /* the hue of selections and soft tints */

  /* ---- avatar tones: eight hues for people without a picture (.dt-avatar[data-tone]); the mode sets how light */
  --tone-1: hsl(8 var(--tone-s) var(--tone-l));
  --tone-2: hsl(32 var(--tone-s) var(--tone-l));
  --tone-3: hsl(52 var(--tone-s) var(--tone-l));
  --tone-4: hsl(140 var(--tone-s) var(--tone-l));
  --tone-5: hsl(178 var(--tone-s) var(--tone-l));
  --tone-6: hsl(208 var(--tone-s) var(--tone-l));
  --tone-7: hsl(248 var(--tone-s) var(--tone-l));
  --tone-8: hsl(312 var(--tone-s) var(--tone-l));
}

:root[data-palette="sand"] {
  --n-h: 32; --n-s: 14%;
  --p-accent: #a8481f; --p-accent-hover: #8e3c19; --p-accent-text: #9e441d;
  --p-accent-dk: #a8481f; --p-accent-dk-hover: #963f1a; --p-accent-dk-text: #f0a57e;
  --p-accent-soft-h: 22;
}
:root[data-palette="moss"] {
  --n-h: 150; --n-s: 8%;
  --p-accent: #2b7049; --p-accent-hover: #225c3c; --p-accent-text: #276843;
  --p-accent-dk: #2b7049; --p-accent-dk-hover: #256341; --p-accent-dk-text: #84d1a3;
  --p-accent-soft-h: 146;
}
:root[data-palette="plum"] {
  --n-h: 275; --n-s: 10%;
  --p-accent: #7c3aae; --p-accent-hover: #682f93; --p-accent-text: #7535a5;
  --p-accent-dk: #7c3aae; --p-accent-dk-hover: #6f33a0; --p-accent-dk-text: #cfa8f2;
  --p-accent-soft-h: 278;
}

/* ---- light (the default) */
:root {
  color-scheme: light;
  --bg: hsl(var(--n-h) var(--n-s) 98.5%);          /* the main pane */
  --surface-1: hsl(var(--n-h) var(--n-s) 95.5%);   /* sidebars, the space rail */
  --surface-2: hsl(var(--n-h) var(--n-s) 100%);    /* cards, menus, dialogs */
  --surface-sunken: hsl(var(--n-h) var(--n-s) 100%); /* inputs */
  --hover: hsl(var(--n-h) var(--n-s) 92%);
  --active: hsl(var(--n-h) var(--n-s) 88.5%);
  --line: hsl(var(--n-h) var(--n-s) 88%);
  --line-strong: hsl(var(--n-h) var(--n-s) 76%);
  --control-line: hsl(var(--n-h) var(--n-s) 51%);  /* an input's border: 3:1 against what it sits on */
  --text: hsl(var(--n-h) 14% 12%);
  --text-dim: hsl(var(--n-h) 8% 38%);
  --text-faint: hsl(var(--n-h) 6% 42.5%);
  --accent: var(--p-accent);
  --accent-hover: var(--p-accent-hover);
  --accent-ink: #ffffff;
  --accent-text: var(--p-accent-text);
  --accent-soft: hsl(var(--p-accent-soft-h) 70% 94%);
  --accent-soft-strong: hsl(var(--p-accent-soft-h) 64% 89%);
  --focus: var(--p-accent-text);
  --ok: #1d7a40; --ok-text: #1a6e3a; --ok-soft: #e3f4e8;
  --warn: #9a5b00; --warn-text: #7d4a00; --warn-soft: #fbf0d9;
  --danger: #c0352b; --danger-hover: #a52c23; --danger-text: #b02f26; --danger-soft: #fbe7e5;
  --on-solid: #ffffff;
  --tone-s: 62%; --tone-l: 86%;
  --scrim: hsl(var(--n-h) 20% 10% / 0.42);
  --shadow-color: 222 30% 20%;
  --shadow-1: 0 1px 2px hsl(var(--shadow-color) / 0.08), 0 1px 1px hsl(var(--shadow-color) / 0.04);
  --shadow-2: 0 2px 6px hsl(var(--shadow-color) / 0.08), 0 8px 24px -6px hsl(var(--shadow-color) / 0.12);
  --shadow-3: 0 4px 12px hsl(var(--shadow-color) / 0.1), 0 24px 56px -12px hsl(var(--shadow-color) / 0.24);
  --edge: inset 0 0 0 1px hsl(var(--n-h) var(--n-s) 20% / 0.08);   /* a hairline that shows on any surface */
}

/* ---- dark: the same block twice, once for the system's choice and once for data-theme="dark"
 * (design/check.mjs fails when the two differ) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: hsl(var(--n-h) var(--n-s) 11.5%);
    --surface-1: hsl(var(--n-h) var(--n-s) 9%);
    --surface-2: hsl(var(--n-h) var(--n-s) 15%);
    --surface-sunken: hsl(var(--n-h) var(--n-s) 8%);
    --hover: hsl(var(--n-h) var(--n-s) 18%);
    --active: hsl(var(--n-h) var(--n-s) 22%);
    --line: hsl(var(--n-h) var(--n-s) 20%);
    --line-strong: hsl(var(--n-h) var(--n-s) 28%);
    --control-line: hsl(var(--n-h) var(--n-s) 48%);
    --text: hsl(var(--n-h) 12% 92%);
    --text-dim: hsl(var(--n-h) 8% 68%);
    --text-faint: hsl(var(--n-h) 6% 58%);
    --accent: var(--p-accent-dk);
    --accent-hover: var(--p-accent-dk-hover);
    --accent-ink: #ffffff;
    --accent-text: var(--p-accent-dk-text);
    --accent-soft: hsl(var(--p-accent-soft-h) 30% 20%);
    --accent-soft-strong: hsl(var(--p-accent-soft-h) 32% 26%);
    --focus: var(--p-accent-dk-text);
    --ok: #25784a; --ok-text: #7fd39c; --ok-soft: #173324;
    --warn: #b07a12; --warn-text: #f0c96a; --warn-soft: #3a2f14;
    --danger: #c63d32; --danger-hover: #b3342a; --danger-text: #ff9c90; --danger-soft: #3d1c1a;
    --on-solid: #ffffff;
    --tone-s: 30%; --tone-l: 30%;
    --scrim: hsl(var(--n-h) 20% 3% / 0.62);
    --shadow-color: 222 40% 2%;
    --shadow-1: 0 1px 2px hsl(var(--shadow-color) / 0.4);
    --shadow-2: 0 2px 6px hsl(var(--shadow-color) / 0.35), 0 8px 24px -6px hsl(var(--shadow-color) / 0.5);
    --shadow-3: 0 4px 12px hsl(var(--shadow-color) / 0.4), 0 24px 56px -12px hsl(var(--shadow-color) / 0.7);
    --edge: inset 0 0 0 1px hsl(var(--n-h) var(--n-s) 90% / 0.07);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: hsl(var(--n-h) var(--n-s) 11.5%);
  --surface-1: hsl(var(--n-h) var(--n-s) 9%);
  --surface-2: hsl(var(--n-h) var(--n-s) 15%);
  --surface-sunken: hsl(var(--n-h) var(--n-s) 8%);
  --hover: hsl(var(--n-h) var(--n-s) 18%);
  --active: hsl(var(--n-h) var(--n-s) 22%);
  --line: hsl(var(--n-h) var(--n-s) 20%);
  --line-strong: hsl(var(--n-h) var(--n-s) 28%);
  --control-line: hsl(var(--n-h) var(--n-s) 48%);
  --text: hsl(var(--n-h) 12% 92%);
  --text-dim: hsl(var(--n-h) 8% 68%);
  --text-faint: hsl(var(--n-h) 6% 58%);
  --accent: var(--p-accent-dk);
  --accent-hover: var(--p-accent-dk-hover);
  --accent-ink: #ffffff;
  --accent-text: var(--p-accent-dk-text);
  --accent-soft: hsl(var(--p-accent-soft-h) 30% 20%);
  --accent-soft-strong: hsl(var(--p-accent-soft-h) 32% 26%);
  --focus: var(--p-accent-dk-text);
  --ok: #25784a; --ok-text: #7fd39c; --ok-soft: #173324;
  --warn: #b07a12; --warn-text: #f0c96a; --warn-soft: #3a2f14;
  --danger: #c63d32; --danger-hover: #b3342a; --danger-text: #ff9c90; --danger-soft: #3d1c1a;
  --on-solid: #ffffff;
  --tone-s: 30%; --tone-l: 30%;
  --scrim: hsl(var(--n-h) 20% 3% / 0.62);
  --shadow-color: 222 40% 2%;
  --shadow-1: 0 1px 2px hsl(var(--shadow-color) / 0.4);
  --shadow-2: 0 2px 6px hsl(var(--shadow-color) / 0.35), 0 8px 24px -6px hsl(var(--shadow-color) / 0.5);
  --shadow-3: 0 4px 12px hsl(var(--shadow-color) / 0.4), 0 24px 56px -12px hsl(var(--shadow-color) / 0.7);
  --edge: inset 0 0 0 1px hsl(var(--n-h) var(--n-s) 90% / 0.07);
}

/* ---- no motion for those who ask for none: every duration is zero, so transitions end at once */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-instant: 0ms; --dur-fast: 0ms; --dur: 0ms; --dur-slow: 0ms; }
}
