/* =========================================================
   1jc — accent palettes + palette switcher
   Loaded last so it can override the base and light themes.
   ========================================================= */

:root,
html[data-palette="amber"] {
  --accent: #8b5cf6;
  --accent-2: #c4b5fd;
  --accent-3: #22d3ee;
  --accent-rgb: 255, 180, 94;
  --accent-2-rgb: 255, 224, 163;
  --accent-3-rgb: 255, 138, 61;
  --accent-contrast: #1a1008;
  --accent-2-contrast: #1a1008;
  --accent-soft: #c4b5fd;
  --accent-2-soft: #ede9fe;
  --accent-ink: #9a5200;
  --accent-2-ink: #8a5a16;
  --accent-fill: #c97a18;
  --accent-fill-contrast: #ffffff;
}

html[data-palette="redline"] {
  --accent: #3b82f6;
  --accent-2: #8b5cf6;
  --accent-3: #7c3aed;
  --accent-rgb: 255, 77, 77;
  --accent-2-rgb: 255, 180, 94;
  --accent-3-rgb: 217, 54, 54;
  --accent-contrast: #ffffff;
  --accent-2-contrast: #1a1008;
  --accent-soft: #ffb3b3;
  --accent-2-soft: #c4b5fd;
  --accent-ink: #a61b1b;
  --accent-2-ink: #8a5a16;
  --accent-fill: #d92d2d;
  --accent-fill-contrast: #ffffff;
}

html[data-palette="acid"] {
  --accent: #d7ff4f;
  --accent-2: #56d9ff;
  --accent-3: #8b5cf6;
  --accent-rgb: 215, 255, 79;
  --accent-2-rgb: 86, 217, 255;
  --accent-3-rgb: 255, 180, 94;
  --accent-contrast: #0a0e13;
  --accent-2-contrast: #061116;
  --accent-soft: #e8ff9e;
  --accent-2-soft: #b9f1ff;
  --accent-ink: #567000;
  --accent-2-ink: #00677a;
  --accent-fill: #8bad1f;
  --accent-fill-contrast: #101b00;
}

html[data-palette="electric"] {
  --accent: #4c8dff;
  --accent-2: #38d9ff;
  --accent-3: #a78bfa;
  --accent-rgb: 76, 141, 255;
  --accent-2-rgb: 56, 217, 255;
  --accent-3-rgb: 167, 139, 250;
  --accent-contrast: #ffffff;
  --accent-2-contrast: #061018;
  --accent-soft: #bdd7ff;
  --accent-2-soft: #bff4ff;
  --accent-ink: #0b4bd3;
  --accent-2-ink: #006d8c;
  --accent-fill: #356be0;
  --accent-fill-contrast: #ffffff;
}

html[data-palette="graphite"] {
  --accent: #f2f6ff;
  --accent-2: #9fb0c7;
  --accent-3: #d7dee9;
  --accent-rgb: 242, 246, 255;
  --accent-2-rgb: 159, 176, 199;
  --accent-3-rgb: 215, 222, 233;
  --accent-contrast: #0a0d12;
  --accent-2-contrast: #0a0d12;
  --accent-soft: #ffffff;
  --accent-2-soft: #d8e2ee;
  --accent-ink: #0a1f3a;
  --accent-2-ink: #43566d;
  --accent-fill: #0a1f3a;
  --accent-fill-contrast: #ffffff;
}

html[data-palette="emerald"] {
  --accent: #43e6a0;
  --accent-2: #b6ffd9;
  --accent-3: #56d9ff;
  --accent-rgb: 67, 230, 160;
  --accent-2-rgb: 182, 255, 217;
  --accent-3-rgb: 86, 217, 255;
  --accent-contrast: #06110d;
  --accent-2-contrast: #06110d;
  --accent-soft: #9bffd0;
  --accent-2-soft: #e2fff0;
  --accent-ink: #047857;
  --accent-2-ink: #006b5a;
  --accent-fill: #059669;
  --accent-fill-contrast: #ffffff;
}

html[data-palette="violet"] {
  --accent: #b18cff;
  --accent-2: #6fe7ff;
  --accent-3: #8b5cf6;
  --accent-rgb: 177, 140, 255;
  --accent-2-rgb: 111, 231, 255;
  --accent-3-rgb: 255, 180, 94;
  --accent-contrast: #0b0716;
  --accent-2-contrast: #061018;
  --accent-soft: #dccbff;
  --accent-2-soft: #c4f8ff;
  --accent-ink: #6d28d9;
  --accent-2-ink: #006d8c;
  --accent-fill: #7c3aed;
  --accent-fill-contrast: #ffffff;
}

/* ---------- Switcher ---------- */
.palette-switch { position: relative; z-index: 80; flex: 0 0 auto; }
.palette-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  transition: border-color 0.2s, background 0.2s;
}
.palette-toggle:hover { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.07); }
.palette-swatch {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.13);
}
.palette-name { color: var(--text); font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.02em; }
.palette-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 228px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--surface-2);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.42);
}
.palette-menu[hidden] { display: none; }
.palette-menu > p {
  margin: 2px 5px 7px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.palette-option {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 8px 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}
.palette-option:hover, .palette-option:focus-visible { background: rgba(255, 255, 255, 0.045); border-color: var(--line); }
.palette-option[aria-pressed="true"] { background: rgba(var(--accent-rgb), 0.08); border-color: rgba(var(--accent-rgb), 0.22); }
.palette-option i {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--sw);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06);
}
.palette-option span { color: var(--text); font-size: 0.68rem; font-weight: 650; }
.palette-option small { color: var(--muted-2); font-family: var(--mono); font-size: 0.46rem; }
.palette-option[aria-pressed="true"] small { color: var(--accent); }

html.light .palette-toggle { background: #ffffff; border-color: #cfe0f7; color: #0a1f3a; }
html.light .palette-toggle:hover { border-color: var(--accent-ink); background: #f6f9fd; }
html.light .palette-swatch { border-color: rgba(10, 31, 58, 0.22); }
html.light .palette-name { color: #0a1f3a; }
html.light .palette-menu { background: #ffffff; border-color: #cfe0f7; box-shadow: 0 18px 40px rgba(10, 31, 58, 0.14); }
html.light .palette-option:hover, html.light .palette-option:focus-visible { background: #f4f8ff; border-color: #d8e2ee; }
html.light .palette-option span { color: #0a1f3a; }
html.light .palette-option small { color: #5a6b80; }
html.light .palette-option[aria-pressed="true"] { background: #eef5ff; border-color: #cfe0f7; }
html.light .palette-option[aria-pressed="true"] small { color: var(--accent-ink); }

/* Light theme: keep the selected palette in the main brand surfaces. */
html.light .brand-mark { background: var(--accent-fill); }
html.light .brand-mark .logo-prompt { stroke: var(--accent-fill-contrast); }
html.light .brand-mark .logo-caret { stroke: var(--accent-fill-contrast); opacity: 0.66; }
html.light .brand-mark .logo-dot { fill: var(--accent-fill-contrast); }
html.light .brand-letter-j { color: var(--accent-ink); }
html.light .accent { color: var(--accent-ink); -webkit-text-fill-color: var(--accent-ink); background: none; }
html.light .section-kicker {
  border-color: rgba(var(--accent-rgb), 0.28);
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent-ink);
}
html.light .main-nav a:hover, html.light .main-nav a.is-current { color: var(--accent-ink); }
html.light .main-nav a::after { background: var(--accent-fill); }
html.light .btn-primary {
  --btn-bg: var(--accent-fill);
  --btn-fg: var(--accent-fill-contrast);
  --btn-br: var(--accent-fill);
  color: var(--accent-fill-contrast);
  box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.2);
}
html.light .btn-primary:hover {
  --btn-bg: var(--accent-ink);
  --btn-br: var(--accent-ink);
  box-shadow: 0 6px 16px rgba(var(--accent-rgb), 0.26);
}
html.light .btn-ghost { --btn-fg: var(--accent-ink); --btn-br: var(--accent-fill); }
html.light .btn-ghost:hover { --btn-bg: #f6f9fd; --btn-br: var(--accent-ink); }
html.light .text-link { color: var(--accent-ink); }
html.light .nav-actions .btn { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-fill-contrast); }
html.light .nav-actions .btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
html.light .hero-eyebrow .live-dot,
html.light .hero-board-link .live-dot,
html.light .friendly-pill .live-dot { background: var(--accent-fill); }
html.light .hero-trust .icon,
html.light .hero-board-link { color: var(--accent-ink); }
html.light .filter-btn.is-active { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--accent-fill-contrast); }
html.light .filter-btn.is-active span { color: rgba(255, 255, 255, 0.72); }

@media (max-width: 700px) {
  .palette-name { display: none; }
  .palette-toggle { padding: 0 9px; }
  .palette-menu {
    position: fixed;
    top: 68px;
    right: 12px;
    left: auto;
    width: min(218px, calc(100vw - 24px));
  }
}
