/* ColorChord · colorchord.jonbailey.xyz
   Premium dual-wheel landing: Circle of Fifths = spectrum */

:root {
  --bg: #05010f;
  --bg-elev: #0c0c12;
  --bg-card: rgba(10, 8, 18, 0.78);
  --ink: #f2f2f6;
  --muted: #9a9aab;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --accent: #ff4d6d;
  --accent-2: #5ce1e6;
  --glow: rgba(255, 77, 109, 0.35);
  --chord-hue: 0;
  --chord-glow: hsla(0 85% 55% / 0.18);
  --radius: 18px;
  --radius-sm: 12px;
  --font-display: "Clash Display", "Satoshi", system-ui, sans-serif;
  --font-body: "Satoshi", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --header-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --max: 1120px;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Neon Void Pixel Cosmos - fixed backdrop */
.cosmos-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  pointer-events: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #05010f;
}

/* Center fade: calm reading well; edges keep more starfield */
.cosmos-veil {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 72% 68% at 50% 42%,
      rgba(5, 1, 15, 0.82) 0%,
      rgba(5, 1, 15, 0.55) 38%,
      rgba(5, 1, 15, 0.22) 62%,
      rgba(5, 1, 15, 0.05) 82%,
      transparent 100%
    ),
    radial-gradient(
      ellipse 50% 45% at 50% 42%,
      color-mix(in srgb, var(--chord-glow) 35%, transparent) 0%,
      transparent 70%
    );
  transition: background 0.6s var(--ease);
}

.site-shell {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  overflow-x: clip;
}

@media (prefers-reduced-motion: reduce) {
  .cosmos-bg {
    opacity: 0.55;
  }
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: #fff;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.88em;
  font-variant-numeric: tabular-nums;
}

/* Skip link */
.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: #fff;
  color: #000;
  padding: 0.5rem 0.75rem;
  z-index: 100;
}
.skip:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  background: transparent;
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease), backdrop-filter 0.35s;
}

.site-header.is-scrolled {
  background: rgba(5, 1, 15, 0.72);
  backdrop-filter: blur(16px) saturate(1.2);
  border-bottom-color: var(--line);
}

.header-inner {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}

.brand-island {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.2rem 0.55rem 0.2rem 0.25rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(12, 12, 18, 0.55);
}

.x-follow {
  display: inline-flex;
  align-items: center;
  height: 28px;
  max-height: 28px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  text-decoration: none;
  overflow: hidden;
  color: var(--ink);
}
.x-follow-mark {
  width: 24px;
  height: 24px;
  max-width: 24px;
  max-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}
.x-follow-mark svg {
  width: 11px;
  height: 11px;
  max-width: 11px;
  max-height: 11px;
  fill: currentColor;
}
.x-follow-handle {
  display: none;
  font-size: 0.62rem;
  white-space: nowrap;
  padding-right: 0.45rem;
  color: var(--muted);
}
@media (min-width: 1536px) {
  .x-follow-handle {
    display: inline;
  }
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  padding-right: 0.25rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.nav-link {
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--muted);
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s, background 0.2s;
}
.nav-link:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 640px) {
  .nav-link {
    display: none;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  padding: 0.65rem 1.2rem;
  min-height: 44px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.24);
}
.btn:active {
  transform: translateY(1px);
}
.btn:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

.btn-sm {
  font-size: 0.84rem;
  padding: 0.5rem 0.95rem;
  min-height: 40px;
}

.btn-primary {
  background: linear-gradient(135deg, #ff4d6d, #ff7a45 55%, #ffb347);
  border-color: transparent;
  color: #14060a;
  box-shadow: 0 8px 28px var(--glow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #ff627e, #ff8c5a 55%, #ffc266);
  box-shadow: 0 10px 34px rgba(255, 77, 109, 0.45);
}

.btn-ghost {
  background: transparent;
}

.btn-ghost-solid {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line-strong);
}
.btn-ghost-solid:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Hero */
.hero {
  position: relative;
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  align-items: center;
  overflow: visible;
}

@media (min-width: 960px) {
  .hero {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr);
    min-height: calc(100dvh - var(--header-h) - 1rem);
    padding-top: 0.5rem;
    gap: 2rem;
    /* room for wheel bleed past the card */
    padding-right: 0.5rem;
  }
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 1rem;
}
.kicker::before {
  content: "";
  width: 1.5rem;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.4rem, 5.5vw, 4.1rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 0 0 1rem;
}

.hero h1 .grad {
  background: linear-gradient(115deg, #ff4d6d 0%, #ffb347 38%, #5ce1e6 72%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.thesis {
  font-size: clamp(1.05rem, 2.1vw, 1.22rem);
  color: #c8c8d8;
  max-width: 32ch;
  margin: 0 0 1.6rem;
  line-height: 1.5;
  letter-spacing: -0.01em;
}
.thesis em {
  font-style: normal;
  display: block;
  color: #fff;
  font-weight: 500;
  margin-bottom: 0.45rem;
  box-shadow: none;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--chord-glow) 55%, transparent) 8%,
    color-mix(in srgb, var(--chord-glow) 55%, transparent) 92%,
    transparent
  );
  background-size: 100% 0.38em;
  background-repeat: no-repeat;
  background-position: 0 92%;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.35rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
  line-height: 1.3;
}
.hero-meta strong {
  color: var(--ink);
  font-weight: 600;
}

/* Wheel: canvas bleeds past the card; dock stays inside */
.wheel-wrap {
  position: relative;
  isolation: isolate;
  min-height: min(74dvh, 680px);
  overflow: visible;
  /* reserve layout space so bleed doesn't crush neighbors */
  margin-inline: clamp(-0.5rem, -3vw, 0);
}

/* Soft glass card - sits under the wheel, does not clip it */
.wheel-card {
  position: absolute;
  z-index: 0;
  inset: 10% 6% 0;
  border-radius: calc(var(--radius) + 6px);
  border: 1px solid color-mix(in srgb, hsl(var(--chord-hue) 70% 55%) 28%, var(--line));
  background:
    radial-gradient(
      ellipse 70% 55% at 50% 38%,
      color-mix(in srgb, var(--chord-glow) 45%, transparent),
      transparent 72%
    ),
    linear-gradient(180deg, rgba(12, 10, 22, 0.42), rgba(6, 4, 14, 0.58));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 80px color-mix(in srgb, var(--chord-glow) 45%, transparent),
    0 30px 80px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  transition: border-color 0.45s var(--ease), box-shadow 0.45s var(--ease);
}

/* 3D stage extends beyond card edges into the cosmos */
.wheel-stage,
#wheel-stage {
  position: absolute;
  z-index: 2;
  /* bleed past the card on all sides */
  left: -16%;
  right: -16%;
  top: -8%;
  bottom: 4.5rem;
  min-height: 0;
  cursor: grab;
  touch-action: none;
  pointer-events: auto;
}

@media (min-width: 960px) {
  .wheel-stage,
  #wheel-stage {
    left: -22%;
    right: -18%;
    top: -12%;
    bottom: 4.25rem;
  }
}

@media (max-width: 599px) {
  .wheel-stage,
  #wheel-stage {
    left: -8%;
    right: -8%;
    top: -4%;
  }
  .wheel-card {
    inset: 8% 2% 0;
  }
}

#wheel-stage:active {
  cursor: grabbing;
}

.wheel-canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  /* soft edge so mesh melts into cosmos, not a hard box */
  -webkit-mask-image: radial-gradient(
    ellipse 72% 70% at 50% 48%,
    #000 0%,
    #000 52%,
    rgba(0, 0, 0, 0.85) 68%,
    rgba(0, 0, 0, 0.35) 84%,
    transparent 100%
  );
  mask-image: radial-gradient(
    ellipse 72% 70% at 50% 48%,
    #000 0%,
    #000 52%,
    rgba(0, 0, 0, 0.85) 68%,
    rgba(0, 0, 0, 0.35) 84%,
    transparent 100%
  );
}

.wheel-fallback {
  display: grid;
  place-items: center;
  min-height: 420px;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
}
.fallback-ring {
  width: min(70vw, 320px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(
    hsl(0 85% 55%),
    hsl(30 85% 55%),
    hsl(60 85% 55%),
    hsl(90 85% 50%),
    hsl(120 85% 48%),
    hsl(150 85% 48%),
    hsl(180 85% 50%),
    hsl(210 85% 55%),
    hsl(240 85% 58%),
    hsl(270 85% 58%),
    hsl(300 85% 55%),
    hsl(330 85% 55%),
    hsl(0 85% 55%)
  );
  mask: radial-gradient(farthest-side, transparent calc(100% - 42px), #000 calc(100% - 40px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 42px), #000 calc(100% - 40px));
  margin-bottom: 1rem;
}

/* Readout dock sits on the card, above the bleeding canvas */
.wheel-dock {
  position: absolute;
  z-index: 3;
  left: 6%;
  right: 6%;
  bottom: 0;
  border-radius: 0 0 calc(var(--radius) + 4px) calc(var(--radius) + 4px);
  border: 1px solid color-mix(in srgb, hsl(var(--chord-hue) 70% 55%) 22%, var(--line));
  border-top: 1px solid var(--line);
  background: rgba(4, 2, 12, 0.72);
  backdrop-filter: blur(14px) saturate(1.15);
  box-shadow: 0 -8px 40px color-mix(in srgb, var(--chord-glow) 25%, transparent);
  overflow: hidden;
}

@media (max-width: 599px) {
  .wheel-dock {
    left: 2%;
    right: 2%;
  }
}

.wheel-chrome {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem 0.35rem;
  background: transparent;
}

.live-readout {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
#mix-swatch {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 24px color-mix(in srgb, var(--chord-glow) 80%, rgba(255, 255, 255, 0.12));
  flex-shrink: 0;
  transition: background 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.readout-text {
  min-width: 0;
}
.readout-text strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.readout-text span {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wheel-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  min-height: 40px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, opacity 0.2s;
}
.sound-toggle:hover {
  background: rgba(255, 255, 255, 0.09);
}
.sound-toggle:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}
.sound-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5dff9a;
  box-shadow: 0 0 10px rgba(93, 255, 154, 0.65);
  flex-shrink: 0;
}
.sound-toggle.is-off .sound-dot {
  background: #666;
  box-shadow: none;
}
.sound-toggle.is-off {
  opacity: 0.72;
  color: var(--muted);
}

.hint {
  font-size: 0.72rem;
  color: var(--muted);
  width: 100%;
  text-align: center;
  padding: 0 1rem 0.75rem;
  margin: 0;
  letter-spacing: 0.01em;
}
.hint kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.05rem 0.28rem;
  margin: 0 0.08rem;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: #c8c8d6;
}

/* Controls strip */
.controls {
  width: min(100% - 2rem, var(--max));
  margin: 0.5rem auto 2.5rem;
  display: grid;
  gap: 0.85rem;
}

@media (min-width: 900px) {
  .controls {
    grid-template-columns: 1.15fr 0.95fr 1.1fr;
    align-items: start;
  }
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-card);
  backdrop-filter: blur(14px) saturate(1.1);
  padding: 1rem 1.05rem 1.1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  transition: border-color 0.3s var(--ease);
}
.panel:focus-within {
  border-color: color-mix(in srgb, hsl(var(--chord-hue) 70% 55%) 35%, var(--line));
}

.panel h2 {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.7rem;
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}
.panel-sub {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.note-chips,
.q-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.note-chip,
.q-btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.82rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  padding: 0.48rem 0.78rem;
  min-height: 40px;
  min-width: 40px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.note-chip {
  border-color: color-mix(in srgb, hsl(var(--h) 80% 55%) 45%, transparent);
}
.note-chip:hover,
.q-btn:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}
.note-chip:active,
.q-btn:active {
  transform: translateY(0);
}
.note-chip.is-active {
  background: color-mix(in srgb, hsl(var(--h) 80% 50%) 28%, transparent);
  border-color: hsl(var(--h) 80% 55%);
  box-shadow: 0 0 18px color-mix(in srgb, hsl(var(--h) 80% 50%) 35%, transparent);
}
.note-chip.is-root {
  outline: 1px solid #fff;
  outline-offset: 1px;
}
.q-btn.is-active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
}
.note-chip:focus-visible,
.q-btn:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.ask-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.15rem;
}
.ask-row input {
  flex: 1 1 140px;
  min-width: 0;
  min-height: 44px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0.62rem 1rem;
}
.ask-row input::placeholder {
  color: rgba(154, 154, 171, 0.75);
}
.ask-row input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent-2) 60%, transparent);
  box-shadow: 0 0 0 3px rgba(92, 225, 230, 0.15);
}
#ask-output {
  margin: 0.65rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  min-height: 1.35em;
  line-height: 1.4;
}

.detail-grid {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.4;
}
.detail-grid strong {
  color: var(--ink);
  font-weight: 600;
}

/* Sections */
.section {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  padding: 3.25rem 0;
}
.section-tight {
  padding-top: 1.5rem;
}

.section-head {
  max-width: 40rem;
  margin-bottom: 1.75rem;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 3.1vw, 2.25rem);
  letter-spacing: -0.03em;
  line-height: 1.12;
  margin: 0 0 0.65rem;
}
.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
  max-width: 48ch;
}

.equation {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 800px) {
  .equation {
    grid-template-columns: 1fr auto 1fr auto 1fr;
    align-items: stretch;
  }
}

.eq-card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  backdrop-filter: blur(10px);
  padding: 1.25rem 1.3rem;
  min-height: 132px;
  transition: border-color 0.25s, transform 0.25s var(--ease);
}
.eq-card:hover {
  border-color: color-mix(in srgb, hsl(var(--chord-hue) 70% 55%) 30%, var(--line));
}
.eq-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 0.4rem;
  letter-spacing: -0.02em;
}
.eq-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.eq-op {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--muted);
  opacity: 0.7;
}
@media (max-width: 799px) {
  .eq-op {
    padding: 0.15rem 0;
  }
}

.principles {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .principles {
    grid-template-columns: repeat(3, 1fr);
  }
}

.principle {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  padding: 1.2rem 1.2rem 1.25rem 1.3rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s, transform 0.25s var(--ease);
}
.principle:hover {
  border-color: rgba(255, 255, 255, 0.14);
  transform: translateY(-2px);
}
.principle::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: 0.85;
}
.principle .num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.principle h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0.35rem 0 0.5rem;
  letter-spacing: -0.02em;
}
.principle p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Mapping table */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(8, 6, 16, 0.72);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

table.map {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  font-size: 0.9rem;
}
table.map th,
table.map td {
  text-align: left;
  padding: 0.72rem 0.95rem;
  border-bottom: 1px solid var(--line);
}
table.map th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
  position: sticky;
  top: 0;
  z-index: 1;
}
table.map tr {
  cursor: pointer;
  transition: background 0.15s;
}
table.map tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}
table.map tr.is-tone {
  background: rgba(255, 255, 255, 0.045);
}
table.map tr.is-active {
  background: color-mix(in srgb, hsl(var(--chord-hue) 80% 50%) 14%, transparent);
}
table.map tr:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: -2px;
}
table.map tbody tr:last-child td {
  border-bottom: none;
}
.swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: hsl(var(--h) 82% 55%);
  box-shadow: 0 0 12px hsl(var(--h) 82% 45% / 0.55);
  vertical-align: middle;
}
.note-cell {
  font-weight: 600;
}

/* Quote band */
.quote-band {
  width: min(100% - 2rem, var(--max));
  margin: 0.5rem auto 2.5rem;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--line);
  padding: clamp(1.6rem, 3.5vw, 2.5rem);
  background:
    radial-gradient(600px 200px at 20% 0%, color-mix(in srgb, var(--chord-glow) 55%, transparent), transparent 60%),
    radial-gradient(500px 220px at 90% 100%, rgba(92, 225, 230, 0.1), transparent 55%),
    rgba(8, 6, 16, 0.82);
  backdrop-filter: blur(12px);
  text-align: center;
}
.quote-band blockquote {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.8vw, 1.85rem);
  letter-spacing: -0.03em;
  line-height: 1.28;
  max-width: 26ch;
  margin-inline: auto;
}
.quote-band cite {
  display: block;
  margin-top: 0.85rem;
  font-style: normal;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* FAQ */
.faq {
  display: grid;
  gap: 0.65rem;
  max-width: 46rem;
}
.faq details {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(10, 8, 18, 0.7);
  backdrop-filter: blur(10px);
  padding: 0.15rem 1.05rem;
  transition: border-color 0.2s;
}
.faq details[open] {
  border-color: color-mix(in srgb, hsl(var(--chord-hue) 70% 55%) 28%, var(--line));
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  font-family: var(--font-display);
  letter-spacing: -0.015em;
  padding: 0.85rem 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: "+";
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--muted);
  font-size: 1rem;
  flex-shrink: 0;
}
.faq details[open] summary::after {
  content: "−";
}
.faq details[open] summary {
  color: #fff;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.15rem;
}
.faq p {
  margin: 0.65rem 0 0.95rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}
.faq a {
  color: var(--accent-2);
  text-decoration: none;
}
.faq a:hover {
  text-decoration: underline;
}

/* CTA */
.cta {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto 3.5rem;
  padding: clamp(1.5rem, 3.5vw, 2.25rem);
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid color-mix(in srgb, hsl(var(--chord-hue) 70% 55%) 25%, var(--line-strong));
  background:
    linear-gradient(135deg, rgba(255, 77, 109, 0.12), rgba(92, 225, 230, 0.08)),
    rgba(8, 6, 16, 0.65);
  backdrop-filter: blur(12px);
  display: grid;
  gap: 1.15rem;
  align-items: center;
}
@media (min-width: 720px) {
  .cta {
    grid-template-columns: 1fr auto;
  }
}
.cta h2 {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  letter-spacing: -0.03em;
  margin: 0 0 0.35rem;
}
.cta p {
  margin: 0;
  color: var(--muted);
  max-width: 42ch;
  line-height: 1.5;
}
.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.75rem 0 2.25rem;
  margin-top: 0.5rem;
}
.footer-inner {
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  justify-content: space-between;
  align-items: flex-start;
  color: var(--muted);
  font-size: 0.86rem;
}
.footer-brand {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: -0.02em;
}
.footer-meta {
  margin-top: 0.2rem;
  opacity: 0.85;
}
.footer-by {
  margin-top: 0.4rem;
}
.footer-by a {
  color: #c8c8d6;
  text-decoration: none;
}
.footer-by a:hover {
  color: #fff;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
}
.footer-links a {
  text-decoration: none;
  color: var(--muted);
  padding: 0.25rem 0;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.footer-links a:hover {
  color: #fff;
}

/* Spectrum top rail */
.spectrum-bar {
  height: 2px;
  width: 100%;
  background: linear-gradient(
    90deg,
    hsl(0 85% 55%),
    hsl(30 85% 55%),
    hsl(60 85% 52%),
    hsl(90 80% 48%),
    hsl(120 80% 48%),
    hsl(150 80% 48%),
    hsl(180 85% 50%),
    hsl(210 85% 55%),
    hsl(240 85% 58%),
    hsl(270 85% 58%),
    hsl(300 85% 55%),
    hsl(330 85% 55%),
    hsl(0 85% 55%)
  );
  opacity: 0.9;
}

/* Reveal */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.65s var(--ease), transform 0.65s var(--ease);
}
.reveal.is-in {
  opacity: 1;
  transform: none;
}

/* Readability on very small phones */
@media (max-width: 420px) {
  .hero h1 {
    font-size: clamp(2.1rem, 11vw, 2.6rem);
  }
  .thesis {
    max-width: none;
  }
  .wheel-wrap {
    min-height: min(68dvh, 560px);
  }
  .readout-text span {
    white-space: normal;
  }
}

/* Spectrum bar decorative */
.spectrum-bar {
  height: 3px;
  width: 100%;
  background: linear-gradient(
    90deg,
    hsl(0 85% 55%),
    hsl(30 85% 55%),
    hsl(60 85% 52%),
    hsl(90 80% 48%),
    hsl(120 80% 48%),
    hsl(150 80% 48%),
    hsl(180 85% 50%),
    hsl(210 85% 55%),
    hsl(240 85% 58%),
    hsl(270 85% 58%),
    hsl(300 85% 55%),
    hsl(330 85% 55%),
    hsl(0 85% 55%)
  );
  opacity: 0.85;
}

/* FAQ */
.faq {
  display: grid;
  gap: 0.75rem;
}
.faq details {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(12, 12, 18, 0.55);
  padding: 0.9rem 1.1rem;
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq details[open] summary {
  margin-bottom: 0.5rem;
  color: #fff;
}
.faq p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
