/* ============================================================
   Theme toggle — sits inline inside the nav (after nav-links).
   Drives all chrome from CSS vars; dark (0) or light (1).
   ============================================================ */

/* Inline toggle, part of the nav row */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  margin-left: 18px;
  flex-shrink: 0;
  user-select: none;
  font-family: var(--mono, ui-monospace, monospace);
}

.theme-toggle button {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-dim, #a8a59c);
  padding: 0;
  cursor: pointer;
  border-radius: 999px !important;
  transition: color 200ms ease, border-color 200ms ease, background 200ms ease, transform 200ms ease;
}

.theme-toggle button:hover,
.theme-toggle button:focus-visible {
  color: var(--ink, #e9e7e1);
  border-color: var(--rule, rgba(255,255,255,0.10));
  background: var(--glass-bg, rgba(255,255,255,0.035));
}

.theme-toggle button:focus-visible {
  outline: 1px solid var(--ink-faint, #6c6a64);
  outline-offset: 3px;
}

.theme-toggle button:active { transform: translateY(1px); }

.theme-toggle .tt-track {
  position: relative;
  width: 16px;
  height: 16px;
  display: block;
}

.theme-toggle .tt-icon {
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--ink-faint, #6c6a64);
  opacity: 0;
  transition: color 200ms ease, opacity 200ms ease;
}
.theme-toggle .tt-icon svg {
  width: 13px;
  height: 13px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}
.theme-toggle[data-mode="dark"] .tt-sun,
.theme-toggle[data-mode="light"] .tt-moon {
  opacity: 0.68;
  color: var(--ink-dim, #a8a59c);
}
.theme-toggle[data-mode="dark"] button:hover .tt-sun,
.theme-toggle[data-mode="dark"] button:focus-visible .tt-sun,
.theme-toggle[data-mode="light"] button:hover .tt-moon,
.theme-toggle[data-mode="light"] button:focus-visible .tt-moon {
  opacity: 1;
  color: var(--ink, #e9e7e1);
}

/* On narrow viewports, keep the toggle in the first nav row. */
@media (max-width: 760px) {
  .theme-toggle {
    position: static;
    order: 2;
    margin-left: auto;
    z-index: auto;
  }
  .theme-toggle button {
    background: transparent;
  }
}

/* ——— Drive existing chrome from CSS vars set by theme-toggle.js ——— */
.bg {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.025), transparent 260px),
    var(--bg-base, #0b0d10) !important;
}
.bg::after { opacity: var(--grain-opacity, 0.5) !important; }
.nav { background: rgba(var(--bg-rgb, 11,13,16), 0.62) !important; }

/* Smooth color transitions when user drags */
html, body, .nav, .form, .cta, .pub, .person, .three > div, .focus > div,
.hero, h1, h2, h3, p, a, .eyebrow, .mono, label, input, textarea, select, button {
  transition: background-color 240ms ease, color 240ms ease, border-color 240ms ease, opacity 240ms ease;
}
