/* ============================================================
   Weio — QUIET LEDGER theme (imported from Claude Design
   "Weio Kit - Quiet Ledger"). Re-skins the existing token layer +
   key components. Loaded AFTER weio-ui.css / weio-sidebar.css.

   Kit facts (from the .dc.html, which supersedes the older token
   file): accent = terracotta #E05A1F (text-safe; tint #FBEADF),
   Instrument Serif display (w400) / Instrument Sans UI / Spline
   Sans Mono, warm off-whites, 1px #DBDBD2 hairlines, 4–10px radii,
   soft shadows. Light-only here; dark ships with the React build.
   ============================================================ */

:root {
  /* ---- surfaces ---- */
  --paper: #F2F2EE;  --bg: #F2F2EE;
  --card: #FBFBF9;   --surface: #FBFBF9;
  --surface2: #E8E8E2; --surface3: #DBDBD2;

  /* ---- ink / text ---- */
  --ink: #141814;      --text: #141814;
  --ink-soft: #4A5049; --text-soft: #4A5049;
  --ink-muted: #7A8078; --text-sec: #7A8078;
  --ink-faint: #A9AEA6;

  /* ---- borders — quiet 1px hairlines ---- */
  --line: #DBDBD2;        --border: #DBDBD2;
  --border-strong: #C2C2B8; --line-strong: #C2C2B8;

  /* ---- accent = terracotta (text-safe) ---- */
  --accent: #E05A1F;      --accent-h: #C74812;  --accent-hover: #C74812;
  --accent-soft: #FBEADF; --accent-tint: #FBEADF;
  --accent-on-dark: #F0935A;

  /* ---- semantic ---- */
  --success: #1F7A44; --warning: #9A6B15; --error: #A4392E; --danger: #A4392E; --info: #2F5D7A;

  /* ---- type ---- */
  --font-sans: "Instrument Sans", "Helvetica Neue", sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono: "Spline Sans Mono", ui-monospace, monospace;

  /* ---- geometry — soft, calm ---- */
  --radius: 8px; --radius-sm: 5px; --radius-lg: 10px;
  --shadow-sm: 0 1px 4px rgba(20,24,20,.05);
  --shadow-md: 0 2px 10px rgba(20,24,20,.07);
  --shadow-lg: 0 8px 30px rgba(20,24,20,.12);
}

/* Headings use the UI sans. The editorial Instrument Serif is reserved for the
   logo wordmark ONLY (operator decision 2026-07-05 — serif headings felt out of place). */
h1, h2 {
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: -0.01em;
}
h3 { font-weight: 600; letter-spacing: -0.01em; }
/* Wordmark = modern sans (matches the portal), not the editorial serif. */
.nav-brand span, .shell-brand { font-family: var(--font-sans); font-weight: 700; letter-spacing: -0.02em; }

/* Primary action = terracotta fill, off-white text, 6px, soft shadow */
.btn-primary, .shell-newchat {
  background: var(--accent) !important;
  color: #FBFBF9 !important;
  border: none !important;
  border-radius: 6px !important;
  font-weight: 600 !important;
  box-shadow: var(--shadow-sm) !important;
}
.btn-primary:hover, .shell-newchat:hover { background: var(--accent-h) !important; }

/* Secondary buttons = hairline border, raised surface (tokenized → flips in dark) */
.btn-secondary, .btn-google {
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  background: var(--card) !important;
  color: var(--text) !important;
  box-shadow: var(--shadow-sm) !important;
  font-weight: 500 !important;
}
.btn-secondary:hover, .btn-google:hover { border-color: var(--border-strong) !important; }

/* Cards / menus = hairline + soft shadow (tokenized → flips in dark) */
.nav-menu-panel, .shell-ws {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-md) !important;
  background: var(--card) !important;
}

/* Active nav = terracotta tint + terracotta text (kit chip pattern) */
.nav.active, .shell-link.active, .shell-link[aria-current="page"] {
  background: var(--accent-tint) !important;
  color: var(--accent) !important;
  border-radius: 6px !important;
}

/* Unread badge = terracotta */
.shell-badge, .badge { background: var(--accent) !important; color: #FBFBF9 !important; }

/* Focus ring = kit's double ring */
.btn-primary:focus-visible, .btn-secondary:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 2px #FBFBF9, 0 0 0 4px var(--accent) !important;
}

/* Section labels in mono uppercase (ledger voice) */
.shell-group, .nav-menu-label {
  font-family: var(--font-mono) !important;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 10px;
}

/* ============================================================
   MOTION tokens (Weio Foundations / Motion). Durations + easings;
   reduced-motion zeroes them. Components reference these vars.
   ============================================================ */
:root {
  --motion-fast: 120ms; --motion-base: 180ms; --motion-slow: 280ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-enter:    cubic-bezier(0, 0, 0.2, 1);
  --ease-exit:     cubic-bezier(0.4, 0, 1, 1);
}
@media (prefers-reduced-motion: reduce) {
  :root { --motion-fast: 0ms; --motion-base: 0ms; --motion-slow: 0ms; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
/* Standard interactive transition (calm, per Motion spec) */
.btn, .btn-primary, .btn-secondary, .shell-newchat, .shell-link, .nav, .card,
.chip, .starter-chip, .dash-chip, .fchip, .cp-tab, input, textarea, select {
  transition: background-color var(--motion-fast) var(--ease-standard),
              border-color var(--motion-fast) var(--ease-standard),
              color var(--motion-fast) var(--ease-standard),
              box-shadow var(--motion-fast) var(--ease-standard),
              transform var(--motion-fast) var(--ease-standard);
}

/* ============================================================
   DARK THEME (Weio Foundations). `data-theme` is used by the site
   for ACCENT variants, so dark rides on a separate `data-mode`.
   mode=dark → forced; mode=auto/unset → follows OS via the media
   query; mode=light → neither matches (stays light). Maps the
   Quiet Ledger dark palette onto the site's existing token names.
   ============================================================ */
html[data-mode="dark"],
:root:not([data-mode="light"]):not([data-mode="dark"]) {}

html[data-mode="dark"] {
  --paper: #12100C;  --bg: #12100C;
  --card: #181511;   --surface: #181511;
  --surface2: #211D17; --surface3: #322C24;
  --ink: #EAE7E1;      --text: #EAE7E1;
  --ink-soft: #B0AB9F; --text-soft: #B0AB9F;
  --ink-muted: #756F64; --text-sec: #756F64;
  --ink-faint: #524C42;
  --line: #322C24;      --border: #322C24;
  --border-strong: #453D33; --line-strong: #453D33;
  --accent: #F0935A;   --accent-h: #F5AC7E; --accent-hover: #F5AC7E;
  --accent-soft: #3D2410; --accent-tint: #3D2410; --accent-on-dark: #F0935A;
  --success: #79BD8F; --warning: #D9A94E; --error: #D97A6C; --danger: #D97A6C; --info: #7FAECB;
  --shadow-sm: 0 1px 4px rgba(0,0,0,.35);
  --shadow-md: 0 2px 12px rgba(0,0,0,.45);
  --shadow-lg: 0 10px 34px rgba(0,0,0,.55);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]):not([data-mode="dark"]) {
    --paper: #12100C;  --bg: #12100C;
    --card: #181511;   --surface: #181511;
    --surface2: #211D17; --surface3: #322C24;
    --ink: #EAE7E1;      --text: #EAE7E1;
    --ink-soft: #B0AB9F; --text-soft: #B0AB9F;
    --ink-muted: #756F64; --text-sec: #756F64;
    --ink-faint: #524C42;
    --line: #322C24;      --border: #322C24;
    --border-strong: #453D33; --line-strong: #453D33;
    --accent: #F0935A;   --accent-h: #F5AC7E; --accent-hover: #F5AC7E;
    --accent-soft: #3D2410; --accent-tint: #3D2410; --accent-on-dark: #F0935A;
    --success: #79BD8F; --warning: #D9A94E; --error: #D97A6C; --danger: #D97A6C; --info: #7FAECB;
    --shadow-sm: 0 1px 4px rgba(0,0,0,.35);
    --shadow-md: 0 2px 12px rgba(0,0,0,.45);
    --shadow-lg: 0 10px 34px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}

/* Common hardcoded-light leaks → tokenized so they flip in dark.
   (The interim Jinja CSS has a few literal light fills; the React
   rebuild removes these entirely.) */
html[data-mode="dark"] body,
:root:not([data-mode="light"]):not([data-mode="dark"]) body { background: var(--bg); color: var(--text); }
