/* Design tokens: the colour, spacing, radius, shadow and font
   variables every other file reads. Theme presets override these from JS.

   Part of the split style sheet — see index.html for the link order. */
/* ---------- Design tokens (defaults; theme presets override via JS) ---------- */
:root {
  --paper: #F2F5F0;
  --surface: #FFFFFF;
  --surface-2: #FAFBF8;
  --rule: #DCE3D8;
  --rule-strong: #C7D0C2;
  --ink: #1A241F;
  --ink-soft: #57645C;
  --ink-muted: #8B968E;

  --accent: #2B6E55;
  --accent-strong: #1F5442;
  --accent-soft: rgba(43, 110, 85, 0.10);
  --accent-contrast: #FBFDFB;

  --gold: #9C7A1E;
  --gold-soft: #F1E7C8;

  --danger: #B14A3D;
  --danger-soft: #F5DFDA;

  /* "This is fine" — and deliberately NOT the accent.
     The accent is whatever theme someone picked: amber by default, and pink,
     purple or near-black in the presets. A green tick that turns pink with the
     theme stops meaning "good" and starts meaning nothing. Like gold and danger,
     this is absent from every preset and from the theme-import allowlist, so a
     semantic colour stays semantic no matter what anyone imports. */
  --ok: #276E4E;
  --ok-soft: rgba(39, 110, 78, 0.10);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-card: 16px;
  --shadow-sm: 0 1px 2px rgba(20, 30, 24, 0.06);
  --shadow-md: 0 4px 20px rgba(20, 30, 24, 0.08), 0 1px 3px rgba(20, 30, 24, 0.06);
  --shadow-hover: 0 8px 32px rgba(20, 30, 24, 0.12), 0 2px 8px rgba(20, 30, 24, 0.08);

  --transition: all 0.3s ease;

  --glass-bg: color-mix(in srgb, var(--surface) 72%, transparent);
  --glass-border: color-mix(in srgb, var(--rule-strong) 40%, transparent);
  --glass-blur: 16px;

  --font-display: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}

html[data-theme="dark"] {
  --paper: #10140F;
  --surface: #171D18;
  --surface-2: #1D241E;
  --rule: #29332B;
  --rule-strong: #384339;
  --ink: #E9ECE6;
  --ink-soft: #A8B3A9;
  --ink-muted: #6C766D;

  --accent: #57B08C;
  --accent-strong: #6FC29F;
  --accent-soft: rgba(87, 176, 140, 0.14);
  --accent-contrast: #0D1512;

  --gold: #D9A441;
  --gold-soft: #3A2F16;

  --danger: #E3796A;
  --danger-soft: #3A211D;

  --ok: #5FBF95;
  --ok-soft: rgba(95, 191, 149, 0.16);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  transition: var(--transition);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(ellipse at 20% 0%, var(--accent-soft) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, color-mix(in srgb, var(--gold-soft) 60%, transparent) 0%, transparent 50%),
    var(--paper);
  background-size: cover, cover, auto;
  background-position: center, center, center;
  background-attachment: fixed, fixed, fixed;
}

body.has-custom-bg {
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

/* Animated wallpaper: a muted looping video pinned behind the whole app, so
   the glass panels frost over it. pointer-events:none keeps it click-through. */
.bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
  pointer-events: none;
}

/* Glass panel mixin applied via shared class rules */
.glass-panel,
.sidebar,
.detail-pane,
.task-item,
.modal,
.source-card,
.field-row,
.thread-frame-wrap {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
}

/* Custom background intensifies glass transparency */
body.has-custom-bg .sidebar,
body.has-custom-bg .detail-pane,
body.has-custom-bg .task-item,
body.has-custom-bg .modal,
body.has-custom-bg .source-card,
body.has-custom-bg .field-row,
body.has-custom-bg .thread-frame-wrap {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

body.has-custom-bg .sidebar { background: color-mix(in srgb, var(--surface) 55%, transparent); }
body.has-custom-bg .detail-pane,
body.has-custom-bg .task-item,
body.has-custom-bg .modal { background: color-mix(in srgb, var(--surface) 60%, transparent); }
body.has-custom-bg .source-card,
body.has-custom-bg .field-row,
body.has-custom-bg .thread-frame-wrap { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }

button, input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
}

input, select, textarea {
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  width: 100%;
  transition: var(--transition);
}

input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea { resize: vertical; font-family: var(--font-body); }

code {
  font-family: var(--font-mono);
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.92em;
}

.rule {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 20px 0;
}
