/* Key of Song — warm black studio tool, gold accent */
:root {
  --bg: #0e0d0b;
  --bg-elev: #161410;
  --bg-hover: #1c1a14;
  --line: #2c291f;
  --line-strong: #3d3828;
  --text: #f3efe6;
  --muted: #b7b1a6;
  --faint: #8a8478;
  --accent: #f5c518;
  --accent-ink: #1a1608;
  --danger: #e07a5f;
  --ok: #c6e07a;
  --radius: 18px;
  --font-display: "Syne", "Sora", system-ui, sans-serif;
  --font-body: "Sora", system-ui, sans-serif;
  --font-serif: "Fraunces", "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --header-h: 4.25rem;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

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

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: #ffe48a; }
button, input, select { font: inherit; color: inherit; }

.sr-only, .skip {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.skip:focus {
  position: fixed; left: 1rem; top: 1rem;
  width: auto; height: auto;
  clip: auto; overflow: visible;
  z-index: 20;
  background: var(--accent); color: var(--accent-ink);
  padding: 0.6rem 1rem; border-radius: 8px;
  font-weight: 600; text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
.drop:focus:not(:focus-visible) { outline: none; }

.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  height: var(--header-h);
  padding: 0 1.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.logo {
  display: flex; align-items: center; gap: 0.65rem;
  color: var(--text); text-decoration: none;
}
.logo:hover { color: var(--text); }
.logo-mark { color: var(--accent); flex: none; }
.logo-word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  white-space: nowrap;
}
.nav-short { display: none; }
.nav { display: flex; gap: 1.35rem; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}
.nav a:hover { color: var(--text); }

.hero {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3.25rem 0 4rem;
}
.eyebrow {
  margin: 0 0 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.35rem, 6.4vw, 5.15rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  max-width: 12ch;
}
.lede {
  margin: 1.35rem 0 0;
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.08rem;
}

.tool {
  margin-top: 2.5rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  scroll-margin-top: calc(var(--header-h) + 0.75rem);
}
.tool.has-result .drop {
  min-height: 0;
  flex-direction: row;
  flex-wrap: wrap;
  padding: 0.9rem 1rem;
  gap: 0.35rem 0.85rem;
}
.tool.has-result .drop-visual { display: none; }
.tool.has-result .drop-title { font-size: 1.02rem; }
.tool.has-result #panel-spotify { padding-top: 1rem; padding-bottom: 0.85rem; }
@media (max-width: 800px) {
  .tool.has-result .drop-hint { display: none; }
}
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}
.tab {
  appearance: none;
  background: transparent;
  border: 0;
  margin: 0;
  padding: 0.95rem 1rem;
  color: var(--faint);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); background: var(--bg-hover); }
.tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
  background: transparent;
}
.panel { padding: 1.25rem; }

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 18.5rem;
  padding: 2rem 1.25rem;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  text-align: center;
  cursor: pointer;
  color: var(--accent);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.drop:hover, .drop:focus-visible, .drop.is-dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.drop-wheel { margin-bottom: 0.7rem; color: var(--accent); opacity: 0.9; }
.drop-title {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}
.drop-hint { margin: 0; color: var(--muted); font-size: 0.95rem; max-width: 38rem; }

.spotify-form {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}
.url-input {
  flex: 1 1 16rem;
  min-width: 0;
  height: 3.15rem;
  padding: 0 1rem;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-size: 16px; /* prevent iOS zoom */
}
.url-input::placeholder { color: var(--faint); }
.url-input:hover { border-color: #534d3a; }
.btn {
  appearance: none;
  border: 0;
  height: 3.15rem;
  padding: 0 1.25rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  letter-spacing: -0.02em;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #ffd34a; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.form-hint, .status {
  margin: 0.9rem 0 0;
  color: var(--faint);
  font-size: 0.9rem;
}
.status { min-height: 1.4em; padding: 0 1.25rem 1.1rem; }
.status:empty { display: none; }
.status.is-error { color: var(--danger); padding-bottom: 1.25rem; }
.panel .status { padding-left: 0; padding-right: 0; }

.result {
  border-top: 1px solid var(--line);
  padding: 1.5rem 1.25rem 1.6rem;
  scroll-margin-top: calc(var(--header-h) + 0.75rem);
}
.result-grid {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  gap: 1.5rem 2rem;
  align-items: center;
}
.wheel-wrap { display: flex; justify-content: center; }
.wheel { width: min(280px, 100%); height: auto; }
.wheel-label { font-family: var(--font-mono); font-size: 8px; fill: var(--faint); }
.wheel-label.is-on { fill: var(--accent-ink); font-weight: 500; }
.wheel-center-code {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.04em;
  fill: var(--text);
  text-anchor: middle;
}
.wheel-center-sub {
  font-family: var(--font-mono);
  font-size: 7px;
  fill: var(--faint);
  text-anchor: middle;
}

.track-meta {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.track-meta strong { color: var(--text); font-weight: 600; }
.key-name {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 560;
  font-style: italic;
  font-size: clamp(2.6rem, 5vw, 4.2rem);
  line-height: 1;
  letter-spacing: -0.03em;
  word-spacing: 0.12em;
}
.pills { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 1.15rem; }
.pill {
  display: inline-flex; align-items: center;
  height: 2rem;
  padding: 0 0.75rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid var(--line-strong);
  color: var(--text);
}
.pill-camelot { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.confidence { margin: 0 0 0.85rem; }
.confidence-row {
  display: flex; justify-content: space-between; gap: 1rem;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.4rem;
}
.bar {
  height: 6px;
  background: var(--line);
  border-radius: 99px;
  overflow: hidden;
}
.bar > span {
  display: block; height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: inherit;
}
.runner, .hint, .disclaimer {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.disclaimer { color: var(--faint); font-size: 0.88rem; max-width: 36rem; }
.hint { color: var(--text); }

.section {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 3.5rem;
  border-top: 1px solid var(--line);
}
.section h2 {
  margin: 2.4rem 0 1.4rem;
  font-family: var(--font-display);
  font-weight: 750;
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  letter-spacing: -0.04em;
}
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.steps li {
  padding: 1.25rem 1.15rem 1.35rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.step-n {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.08em;
}
.steps h3 {
  margin: 0.45rem 0 0.4rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: -0.03em;
}
.steps p, .prose p, .faq p { margin: 0; color: var(--muted); }
.steps p + p, .prose p + p { margin-top: 0.9rem; }
.prose { max-width: 42rem; }
.prose strong { color: var(--text); font-weight: 600; }

.faq { max-width: 42rem; }
.faq details {
  border-top: 1px solid var(--line);
  padding: 0.9rem 0;
}
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 400;
}
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0.6rem 0 0.3rem; }

.site-footer {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.88rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.6rem 1.5rem;
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }
.footer-links { display: flex; gap: 0.55rem; align-items: center; }

.page-body { width: min(40rem, calc(100% - 2rem)); margin: 0 auto; padding: 3rem 0 4rem; }
.page-body h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  max-width: none;
  margin-bottom: 1.2rem;
}
.page-body h2 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  margin: 2rem 0 0.6rem;
  font-size: 1.3rem;
}
.page-body p { color: var(--muted); }

@media (max-width: 800px) {
  .steps { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .wheel { width: min(240px, 80vw); margin: 0 auto; }
  .site-header { padding: 0 1rem; }
  .nav { gap: 0.85rem; }
  .hero { padding-top: 2.2rem; }
  .drop { min-height: 15rem; }
  .spotify-form { flex-direction: column; }
  .btn, .url-input { width: 100%; }
  .site-footer { flex-direction: column; }
}

@media (max-width: 640px) {
  .nav-long { display: none; }
  .nav-short { display: inline; }
  .nav { gap: 0.85rem; flex: none; }
  .site-header { padding: 0 1rem; }
}
@media (max-width: 520px) {
  .nav a { font-size: 0.85rem; }
  h1 { font-size: 2.35rem; }
}
