/* =========================================================
   Theme overrides — toggle live via [data-theme] on <html>.
   Each theme overrides palette and type vars on .ag26.
   The default render (no [data-theme]) uses Editorial.
   ========================================================= */

/* ---------- Default render · Editorial Press (no attribute) ---------- */
html:not([data-theme]) .ag26,
html[data-theme="editorial"] .ag26 {
  --ag-bg: #f5f1e8;
  --ag-bg-soft: #ffffff;
  --ag-ink: #0d0d0d;
  --ag-ink-dim: #5a564e;
  --ag-line: rgba(13, 13, 13, 0.12);
  --ag-accent: #d6452a;
  --ag-accent-2: #1f3a5f;
  --ag-accent-3: #c89b3c;
  --ag-display: "Source Serif 4", "GT Sectra", "Times New Roman", serif;
  --ag-sans: "Söhne", "Inter", ui-sans-serif, system-ui, sans-serif;
  --ag-mono: "JetBrains Mono", ui-monospace, monospace;
}
html:not([data-theme]) .ag26__mesh,
html[data-theme="editorial"] .ag26__mesh { opacity: 0.18; filter: blur(120px) saturate(110%); }

/* ---------- Saffron · original cream + saffron (the previous default) ---------- */
html[data-theme="saffron"] .ag26 {
  --ag-bg: #0b0b0d;
  --ag-bg-soft: #131316;
  --ag-ink: #f4efe6;
  --ag-ink-dim: #a8a39a;
  --ag-line: rgba(244, 239, 230, 0.08);
  --ag-accent: #ff7a3d;
  --ag-accent-2: #c8b6ff;
  --ag-accent-3: #7df0c5;
  --ag-display: "Instrument Serif", "Times New Roman", serif;
  --ag-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ag-mono: "JetBrains Mono", ui-monospace, monospace;
}
html[data-theme="saffron"] .ag26__mesh { opacity: 0.55; filter: blur(80px) saturate(140%); }

/* ---------- Cream · light cream + saffron + Instrument Serif (the OG Anthropic-style) ---------- */
html[data-theme="cream"] .ag26 {
  --ag-bg: #f4efe6;
  --ag-bg-soft: #ffffff;
  --ag-ink: #0b0b0d;
  --ag-ink-dim: #5a564e;
  --ag-line: rgba(11, 11, 13, 0.10);
  --ag-accent: #ff7a3d;
  --ag-accent-2: #c8b6ff;
  --ag-accent-3: #7df0c5;
  --ag-display: "Instrument Serif", "Times New Roman", serif;
  --ag-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ag-mono: "JetBrains Mono", ui-monospace, monospace;
}
html[data-theme="cream"] .ag26__mesh { opacity: 0.22; filter: blur(110px) saturate(130%); }

/* ---------- Meadow · pastel spring (sage paper, deep forest, peach + sage + butter) ---------- */
html[data-theme="meadow"] .ag26 {
  --ag-bg: #eaf2e6;
  --ag-bg-soft: #f3f8ee;
  --ag-ink: #1a3325;
  --ag-ink-dim: #5d7a68;
  --ag-line: rgba(26, 51, 37, 0.14);
  --ag-accent: #f08e6a;
  --ag-accent-2: #4f9b6f;
  --ag-accent-3: #f0c773;
  --ag-display: "Fraunces", "Source Serif 4", serif;
  --ag-sans: "Geist", "Inter", ui-sans-serif, system-ui, sans-serif;
  --ag-mono: "Geist Mono", "JetBrains Mono", ui-monospace, monospace;
}
html[data-theme="meadow"] .ag26__mesh { opacity: 0.32; filter: blur(120px) saturate(110%); }


/* ---------- B · Brutalist Mono (paper white, all monospace, electric blue) ---------- */
html[data-theme="brutalist"] .ag26 {
  --ag-bg: #fafaf7;
  --ag-bg-soft: #ffffff;
  --ag-ink: #000000;
  --ag-ink-dim: #555;
  --ag-line: rgba(0, 0, 0, 0.18);
  --ag-accent: #0033ff;
  --ag-accent-2: #ff0066;
  --ag-accent-3: #00aa55;
  --ag-display: "JetBrains Mono", ui-monospace, monospace;
  --ag-sans: "JetBrains Mono", ui-monospace, monospace;
  --ag-mono: "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 0;
}
html[data-theme="brutalist"] .ag26__mesh { display: none; }
html[data-theme="brutalist"] .ag26 .ag26__display,
html[data-theme="brutalist"] .ag26 h1,
html[data-theme="brutalist"] .ag26 h2 { font-style: normal !important; font-weight: 700; letter-spacing: -0.04em; }
html[data-theme="brutalist"] .ag26 .ag26__btn { border-radius: 0; border-width: 1.5px; border-color: #000; background: #fff; }
html[data-theme="brutalist"] .ag26 a.ag26__btn--primary { background: #000; color: #fff; }
html[data-theme="brutalist"] .ag26 a.ag26__btn--primary:hover { background: var(--ag-accent); color: #fff; border-color: var(--ag-accent); }
html[data-theme="brutalist"] .ag26 .ag26__bento > * { border-radius: 0; }

/* ---------- C · Late-night Studio (deep plum, fraunces, amber+teal) ---------- */
html[data-theme="studio"] .ag26 {
  --ag-bg: #15101e;
  --ag-bg-soft: #1d1729;
  --ag-ink: #e8e4dc;
  --ag-ink-dim: #9b94a8;
  --ag-line: rgba(232, 228, 220, 0.10);
  --ag-accent: #ffb547;
  --ag-accent-2: #5fdcc1;
  --ag-accent-3: #c994ff;
  --ag-display: "Fraunces", "Instrument Serif", serif;
  --ag-sans: "Geist", "Inter", ui-sans-serif, system-ui, sans-serif;
  --ag-mono: "Geist Mono", "JetBrains Mono", ui-monospace, monospace;
}
html[data-theme="studio"] .ag26__mesh { opacity: 0.45; }

/* ---------- D · Field Notes (warm tan paper, navy ink, rust accent) ---------- */
html[data-theme="fieldnotes"] .ag26 {
  --ag-bg: #ece4d3;
  --ag-bg-soft: #f6efde;
  --ag-ink: #0a2540;
  --ag-ink-dim: #54607a;
  --ag-line: rgba(10, 37, 64, 0.18);
  --ag-accent: #a93f1c;
  --ag-accent-2: #2a6f4e;
  --ag-accent-3: #c89b3c;
  --ag-display: "EB Garamond", "Spectral", serif;
  --ag-sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --ag-mono: "IBM Plex Mono", ui-monospace, monospace;
}
html[data-theme="fieldnotes"] .ag26__mesh { opacity: 0.18; filter: blur(140px) saturate(90%); }
html[data-theme="fieldnotes"] .ag26 .ag26__display { font-style: normal; }

/* ---------- Theme switcher UI ---------- */
.ag-theme-switcher {
  position: fixed; right: 18px; bottom: 18px; z-index: 9999;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.ag-theme-switcher.is-revealed {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.ag-theme-switcher__toggle {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: rgba(15, 15, 18, 0.92);
  color: #f4efe6;
  border: 1px solid rgba(244, 239, 230, 0.18);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}
.ag-theme-switcher__toggle::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: #ff7a3d;
}
.ag-theme-switcher__prefix {
  color: rgba(244, 239, 230, 0.55);
  font-weight: 400;
  margin-right: 2px;
}
.ag-theme-switcher__panel {
  position: absolute; right: 0; bottom: calc(100% + 10px);
  display: none; flex-direction: column; gap: 4px;
  min-width: 220px;
  padding: 10px;
  background: rgba(15, 15, 18, 0.96);
  color: #f4efe6;
  border: 1px solid rgba(244, 239, 230, 0.18);
  border-radius: 14px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.ag-theme-switcher.is-open .ag-theme-switcher__panel { display: flex; }
.ag-theme-switcher__opt {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
}
.ag-theme-switcher__opt:hover { background: rgba(244, 239, 230, 0.08); }
.ag-theme-switcher__opt[aria-pressed="true"] { background: rgba(255, 122, 61, 0.18); color: #ff7a3d; }
.ag-theme-switcher__swatch {
  width: 28px; height: 14px; border-radius: 4px;
  border: 1px solid rgba(244, 239, 230, 0.2);
  flex-shrink: 0;
  position: relative; overflow: hidden;
}
.ag-theme-switcher__swatch span {
  position: absolute; right: 0; top: 0; bottom: 0; width: 35%;
}
.ag-theme-switcher__hint {
  display: block; padding: 6px 10px 4px;
  color: #807a70; font-size: 10px;
}
@media print { .ag-theme-switcher { display: none !important; } }
