/* Nocturne — design-system tokens and component classes. This file is the source of truth for the system's look; retune it here and see readme.md. */

/* Manrope, the brand's one typeface (Stoma32 brand kit v1), served from this app: no request
   to a font host, no visitor address sent to one. SIL Open Font License — fonts/OFL.txt. */
@font-face {
  font-family: "Manrope";
  src: url("../fonts/Manrope-Variable.ttf") format("truetype");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Role tokens — LIGHT is the default. Dark overrides live in the blocks that
     follow the :root declaration; retune each theme there, not inline here. */
  color-scheme: light;
  /* The Stoma32 palette (brand kit v1, 2026-10-04): neutral surfaces carry the screen, teal
     leads the action, violet gives identity. Before it the app was green. */
  --color-bg: #f8faf9;              /* canvas */
  --color-surface: #ffffff;
  --color-text: #202837;            /* ink — 14.1:1 on the canvas */
  --color-muted: #536174;           /* secondary text — 6.0:1 on the canvas */
  /* Teal: primary actions and what is active. White on it is 4.8:1. */
  --color-accent: #087f80;
  --color-accent-hover: #066567;
  /* Text/icons drawn ON the accent (primary buttons). White in light; in dark the
     accent is too light for white text, so it flips to ink. */
  --color-on-accent: #ffffff;
  /* Violet: identity and accents — the logo's other colour, the focus ring. Not for actions. */
  --color-accent-2: #7064d9;
  --color-focus: #7064d9;
  --color-divider: #dde4e8;
  --color-link-hover: #066567;
  /* Quiet tinted surfaces: mint for what is active or selected, lavender for a secondary area.
     Small text on mint is --color-active-text (6.0:1), never the plain accent. */
  --color-mint: #dff5ef;
  --color-lavender: #eeeafb;
  --color-active-bg: #dff5ef;
  --color-active-text: #066567;
  --color-danger: #b42318;
  --color-warning: #8c5700;
  --color-success: #166344;
  /* The page ground is flat: the brand keeps most surfaces neutral. */
  --bg-wash: none;

  /* Tonal ramps, light (100) to dark (900). */
  --color-neutral-100: #f3f5f7;
  --color-neutral-200: #e6eaee;
  --color-neutral-300: #d3d9df;
  --color-neutral-400: #b3bcc6;
  --color-neutral-500: #8d98a5;
  --color-neutral-600: #6b7786;
  --color-neutral-700: #536174;
  --color-neutral-800: #364152;
  --color-neutral-900: #202837;

  --color-accent-100: #e6f6f5;
  --color-accent-200: #c5ebe9;
  --color-accent-300: #96d9d6;
  --color-accent-400: #5cc0bd;
  --color-accent-500: #2aa3a2;
  --color-accent-600: #0f8f8f;
  --color-accent-700: #087f80;
  --color-accent-800: #066567;
  --color-accent-900: #044a4c;

  --color-accent-2-100: #f3f1fd;
  --color-accent-2-200: #e4e0fa;
  --color-accent-2-300: #cdc7f5;
  --color-accent-2-400: #afa6ee;
  --color-accent-2-500: #9287e6;
  --color-accent-2-600: #7d71de;
  --color-accent-2-700: #7064d9;
  --color-accent-2-800: #5448b3;
  --color-accent-2-900: #3b3285;

  /* Deck section-divider ground. Deck-scale fills only — not interface colors. */
  --color-section: #202837;
  --color-section-glow: #2c3649;
  --color-section-ghost: #536174;

  /* Titles 650–750, text 400–500, labels 600 (brand guide). */
  --font-heading: "Manrope", system-ui, sans-serif;
  --font-heading-weight: 700;
  --font-body: "Manrope", system-ui, sans-serif;
  --font-label-weight: 600;

  /* Spacing in multiples of 4px. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  /* Controls 10px, cards 18px; -sm for what sits inside a control. */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 18px;

  /* Layout: the portal draws its top bar twice — the brand bar over the sidebar and
     the account row over the content — and they only line up while they agree. */
  --topbar-height: 4rem;

  /* Elevation — a hairline and soft ink shadows on the light theme; the dark theme
     swaps these for a hairline edge + ambient darkness (see below). No decorative glow. */
  --shadow-sm: 0 1px 2px rgba(32, 40, 55, 0.04);
  --shadow-md: 0 1px 2px rgba(32, 40, 55, 0.06), 0 8px 22px rgba(32, 40, 55, 0.10);
  --shadow-lg: 0 2px 6px rgba(32, 40, 55, 0.08), 0 20px 48px rgba(32, 40, 55, 0.16);
}

/* ── Dark theme ──────────────────────────────────────────────────────────
   Applied when the OS asks for dark (unless the user forced light), and
   again for the explicit toggle so it wins in both directions. Its own steps of the same
   hues on an ink ground — not the light values inverted: teal and violet are lightened until
   they hold as text, and the tinted surfaces become mixes with the surface. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-bg: #141a24;
    --color-surface: #1d2532;
    --color-text: #e8edf2;
    --color-muted: #a3afbe;
    --color-accent: #4cc2bf;
    --color-accent-hover: #6fd3d0;
    --color-on-accent: #0f1720;
    --color-accent-2: #a59cf0;
    --color-focus: #a59cf0;
    --color-divider: #303a4a;
    --color-link-hover: #8fe0dd;
    --color-mint: color-mix(in srgb, #4cc2bf 16%, #1d2532);
    --color-lavender: color-mix(in srgb, #a59cf0 16%, #1d2532);
    --color-active-bg: color-mix(in srgb, #4cc2bf 16%, #1d2532);
    --color-active-text: #6fd3d0;
    --color-danger: #f08a80;
    --color-warning: #e6b25a;
    --color-success: #5fcf9b;
    --bg-wash: none;
    --shadow-sm: 0 0 0 1px #303a4a;
    --shadow-md: 0 0 0 1px #3a4557, 0 6px 18px rgba(0, 0, 0, 0.55);
    --shadow-lg: 0 0 0 1px #536174, 0 16px 40px rgba(0, 0, 0, 0.65);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #141a24;
  --color-surface: #1d2532;
  --color-text: #e8edf2;
  --color-muted: #a3afbe;
  --color-accent: #4cc2bf;
  --color-accent-hover: #6fd3d0;
  --color-on-accent: #0f1720;
  --color-accent-2: #a59cf0;
  --color-focus: #a59cf0;
  --color-divider: #303a4a;
  --color-link-hover: #8fe0dd;
  --color-mint: color-mix(in srgb, #4cc2bf 16%, #1d2532);
  --color-lavender: color-mix(in srgb, #a59cf0 16%, #1d2532);
  --color-active-bg: color-mix(in srgb, #4cc2bf 16%, #1d2532);
  --color-active-text: #6fd3d0;
  --color-danger: #f08a80;
  --color-warning: #e6b25a;
  --color-success: #5fcf9b;
  --bg-wash: none;
  --shadow-sm: 0 0 0 1px #303a4a;
  --shadow-md: 0 0 0 1px #3a4557, 0 6px 18px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 0 0 1px #536174, 0 16px 40px rgba(0, 0, 0, 0.65);
}

/* The light palette again, so the explicit toggle wins over a dark OS. Keep it in step
   with the bare :root block above. */
:root[data-theme="light"] {
  color-scheme: light;
  --color-bg: #f8faf9;
  --color-surface: #ffffff;
  --color-text: #202837;
  --color-muted: #536174;
  --color-accent: #087f80;
  --color-accent-hover: #066567;
  --color-on-accent: #ffffff;
  --color-accent-2: #7064d9;
  --color-focus: #7064d9;
  --color-divider: #dde4e8;
  --color-link-hover: #066567;
  --color-mint: #dff5ef;
  --color-lavender: #eeeafb;
  --color-active-bg: #dff5ef;
  --color-active-text: #066567;
  --color-danger: #b42318;
  --color-warning: #8c5700;
  --color-success: #166344;
  --bg-wash: none;
  --shadow-sm: 0 1px 2px rgba(32, 40, 55, 0.04);
  --shadow-md: 0 1px 2px rgba(32, 40, 55, 0.06), 0 8px 22px rgba(32, 40, 55, 0.10);
  --shadow-lg: 0 2px 6px rgba(32, 40, 55, 0.08), 0 20px 48px rgba(32, 40, 55, 0.16);
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
}
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: var(--font-heading-weight); }

.lighten{mix-blend-mode:lighten;background-color:transparent}

/* ══════════════════════════════════════════════════════════════════════════
   Components — built with the tokens above. Plain CSS
   on plain HTML: no JavaScript, no build step. Each class is documented in
   readme.md and demonstrated in foundations/ and components/.
   ══════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.55; font-weight: 400; }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 var(--space-2);
}
h1 { font-size: 42px; }
h2 { font-size: 32px; }
h3 { font-size: 25px; }
h4 { font-size: 20px; }
h5 { font-size: 16px; }
h6 { font-size: 13px; }
h6 { letter-spacing: 0.08em; text-transform: uppercase; }
p { margin: 0 0 var(--space-3); }
a { color: var(--color-accent); text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
figure { margin: 0; }
figcaption {
  font-size: 11px; margin-top: var(--space-1);
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.text-muted { color: var(--color-muted); }
:focus { outline: none; }
/* The focus ring is violet, so it shows on a teal button as well as on a white field. */
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

/* — rules — */
/* Rules fade to transparent at both ends instead of stopping cleanly — a
   Nocturne signature. The ramp is 48px an end (one deck baseline unit),
   painted from the same divider token. Freestanding rules fade; box
   outlines, in-control separators, and short accent marks stay solid. */
.hr {
  height: 1px; border: 0; margin: var(--space-4) 0;
  background: linear-gradient(to right,
    transparent, var(--color-divider) 48px,
    var(--color-divider) calc(100% - 48px), transparent);
}

/* — buttons — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-heading); font-weight: 650;
  font-size: 14px; line-height: 1.2; color: var(--color-text); /* matches the .input's 14px —
     the pair sits side by side in sign-up rows */
  background: transparent; border: 1px solid transparent;
  padding: var(--space-2) calc(var(--space-3) * 1.2);
  border-radius: var(--radius-md);
}
.btn svg { display: block; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { color: var(--color-accent); border-color: var(--color-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--color-accent) 12%, transparent); }
.btn-primary:active { background: color-mix(in srgb, var(--color-accent) 22%, transparent); }
.btn-secondary { border-color: var(--color-divider); }
.btn-secondary:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.btn-secondary:active { background: color-mix(in srgb, var(--color-text) 14%, transparent); }
.btn-ghost { color: var(--color-accent); padding-inline: var(--space-1); }
.btn-ghost:hover { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.btn-ghost:active { background: color-mix(in srgb, var(--color-accent) 18%, transparent); }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-block { width: 100%; margin-top: var(--space-2); }

/* — forms — */
.field > label {
  display: block; font-size: 12px; margin-bottom: 4px;
  font-weight: var(--font-label-weight);
  color: var(--color-muted);
}
.input {
  width: 100%; min-height: 36px; padding: 6px 10px; font: inherit;
  font-size: 14px; color: var(--color-text); caret-color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.input:focus-visible { border-color: var(--color-accent); outline-offset: 1px; }
textarea.input { min-height: 90px; resize: vertical; }
.radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.radio input, .seg-opt input {
  position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none;
}
.radio .dot {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--color-divider);
}
.radio:hover .dot { border-color: var(--color-accent); }
.radio input:checked + .dot {
  border-color: var(--color-accent); background: var(--color-accent);
  box-shadow: inset 0 0 0 4px var(--color-bg);
}
.radio input:focus-visible + .dot { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.seg {
  display: inline-flex; overflow: hidden;
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
}
.seg-opt {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; font-size: 13px; cursor: pointer;
}
.seg-opt + .seg-opt { border-left: 1px solid var(--color-divider); }
.seg-opt:has(input:checked) { color: var(--color-accent); box-shadow: inset 0 0 0 1px var(--color-accent); }
.seg-opt:not(:has(input:checked)):hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.seg-opt:has(input:focus-visible) { outline: 2px solid var(--color-focus); outline-offset: -2px; }

/* — cards — */
.card {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-surface);
}
.card-kicker { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-accent); }
.card-title {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 17px; line-height: 1.2;
}
.card-body { margin: 0; font-size: 13px; opacity: 0.8; flex: 1; }
.card-meta {
  display: flex; align-items: center; gap: 6px; font-size: 11px;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}
.elev-sm { box-shadow: var(--shadow-sm); }
.elev-md { box-shadow: var(--shadow-md); }
.elev-lg { box-shadow: var(--shadow-lg); }

/* — tags — */
.tag {
  display: inline-flex; align-items: center; font-size: 11px;
  font-weight: var(--font-label-weight);
  letter-spacing: 0.02em; padding: 3px 10px;
  border-radius: 999px;
}
.tag-accent { background: var(--color-accent-800); color: var(--color-accent-100); }
.tag-accent-2 { background: var(--color-accent-2-800); color: var(--color-accent-2-100); }
.tag-neutral { background: var(--color-neutral-800); color: var(--color-neutral-100); }
.tag-outline { border: 1px solid var(--color-accent); color: var(--color-accent); }

/* — navigation — */
.nav {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: none;
}
.nav-brand {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 18px; margin-right: auto;
}
.nav a { color: inherit; text-decoration: none; font-size: 14px; }
.nav a:hover, .nav a[aria-current='page'] { color: var(--color-accent); }

/* — tables — */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  font-weight: var(--font-label-weight);
  color: var(--color-muted);
  padding: var(--space-2); border-bottom: 1px solid transparent; /* keeps layout; the row paints the fading rule */
}
.table td {
  padding: var(--space-2);
  border-bottom: 1px solid transparent;
}
/* Row rules as row-level strips so the end-fade spans the row, not each cell. */
.table thead tr {
  background: linear-gradient(to right,
    transparent, var(--color-divider) 48px,
    var(--color-divider) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}
.table tbody tr {
  background: linear-gradient(to right,
    transparent, color-mix(in srgb, var(--color-text) 8%, transparent) 48px,
    color-mix(in srgb, var(--color-text) 8%, transparent) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}
.table tbody tr:hover {
  /* the hover tint layers over the row rule, which keeps painting */
  background:
    linear-gradient(color-mix(in srgb, var(--color-text) 4%, transparent),
                    color-mix(in srgb, var(--color-text) 4%, transparent)) no-repeat 0 0 / 100% 100%,
    linear-gradient(to right,
      transparent, color-mix(in srgb, var(--color-text) 8%, transparent) 48px,
      color-mix(in srgb, var(--color-text) 8%, transparent) calc(100% - 48px), transparent) no-repeat bottom / 100% 1px;
}

/* — dialog — */
.dialog-backdrop {
  position: fixed; inset: 0; display: grid; place-items: center;
  padding: var(--space-4);
  background: color-mix(in srgb, var(--color-neutral-900) 50%, transparent);
}
.dialog {
  width: min(440px, 100%); display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4); border-radius: var(--radius-lg);
  background: var(--color-surface); box-shadow: var(--shadow-lg);
}
.dialog-title {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 20px;
}
.dialog-body { font-size: 14px; opacity: 0.85; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }

