/* Harmonium Lab — warm acoustic look, mobile-first.
   One small palette: two surfaces, two text tones, one accent in two depths,
   plus the white and black of the keys. Every other shade is derived from
   these with color-mix() or alpha overlays, so the whole site stays on one
   palette instead of drifting into dozens of loose colours. */
:root {
  --bg: #1c1410;
  --bg-soft: #2a1f17;
  --panel: #33251a;
  --line: #4a3626;
  --wood: #5b3d24;
  --wood-hi: #7a5533;
  --ink: #f3e9dc;
  --ink-dim: #c9b49a;
  --accent: #e8a94b;
  --accent-deep: #b97f2e;
  --key-white: #f7f1e3;
  --key-black: #241a12;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  line-height: 1.55;
}

body {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px calc(48px + env(safe-area-inset-bottom));
}

/* ---- Site header / nav ---- */
.site-head {
  border-bottom: 1px solid var(--line);
  margin: 0 -16px 8px;
  padding: 10px 16px 0;
}
.site-head-row {
  max-width: 868px;
  margin: 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: 0.4px;
}
.site-nav { display: flex; gap: 14px; flex-wrap: wrap; }
.site-nav a { color: var(--ink-dim); text-decoration: none; font-size: 0.88rem; }
.site-nav a:hover { color: var(--accent); }

/* ---- Page head (per-page H1 + tagline) ---- */
.page-head { text-align: center; margin: 8px 0 18px; }
.page-head h1 {
  font-size: 1.55rem;
  margin: 0 0 4px;
  letter-spacing: 0.5px;
}
.page-head h1 .accent { color: var(--accent); }
.page-head p.tagline { margin: 0; color: var(--ink-dim); font-size: 0.95rem; }
@media (max-width: 480px) {
  .page-head h1 { font-size: 1.25rem; }
}

/* ---- Stage / keyboard ---- */
.stage {
  background: linear-gradient(180deg, var(--wood-hi), var(--wood));
  border: 2px solid color-mix(in srgb, var(--wood) 70%, var(--key-black));
  border-radius: 14px;
  padding: 14px 12px 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.15);
  position: relative;
}

.hl-keyboard {
  position: relative;
  height: 190px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.key {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 0 0 7px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 10px;
  cursor: pointer;
}

.key.white {
  background: linear-gradient(180deg, var(--key-white) 0%, color-mix(in srgb, var(--key-white) 90%, var(--wood)) 82%, color-mix(in srgb, var(--key-white) 78%, var(--wood)) 100%);
  border: 1px solid color-mix(in srgb, var(--key-white) 60%, var(--wood));
  box-shadow: inset 0 -5px 0 rgba(0,0,0,0.12);
  color: color-mix(in srgb, var(--wood) 80%, var(--key-black));
  z-index: 1;
}

.key.black {
  background: linear-gradient(180deg, color-mix(in srgb, var(--key-black) 62%, var(--wood)) 0%, var(--key-black) 70%, color-mix(in srgb, var(--key-black) 90%, var(--bg)) 100%);
  border: 1px solid var(--key-black);
  height: 60%;
  bottom: auto;
  box-shadow: 0 4px 6px rgba(0,0,0,0.5), inset 0 -4px 0 rgba(255,255,255,0.06);
  color: var(--ink-dim);
  z-index: 2;
}

.key.white.active {
  background: linear-gradient(180deg, color-mix(in srgb, var(--key-white) 82%, var(--wood)) 0%, color-mix(in srgb, var(--key-white) 70%, var(--wood)) 90%);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.15);
  transform: translateY(1px);
}
.key.black.active {
  background: linear-gradient(180deg, color-mix(in srgb, var(--key-black) 55%, var(--wood)) 0%, color-mix(in srgb, var(--key-black) 82%, var(--bg)) 70%);
  transform: translateY(1px);
}

.key .note { font-size: 0.78rem; font-weight: 600; pointer-events: none; }
.key.black .note { font-size: 0.62rem; }
.key .note sup { font-size: 0.62em; }
.key .kbd-hint {
  font-size: 0.6rem;
  color: var(--accent-deep);
  border: 1px solid rgba(0,0,0,0.18);
  border-radius: 4px;
  padding: 0 4px;
  margin-top: 3px;
  pointer-events: none;
}
.key.black .kbd-hint { color: var(--accent); border-color: rgba(255,255,255,0.15); }
.key .sargam {
  font-size: 0.62rem;
  color: var(--accent-deep);
  min-height: 0.9em;
  margin-top: 2px;
  pointer-events: none;
}
.key.black .sargam { color: var(--accent); }
.key.is-sa .sargam { font-weight: 700; }
.key.is-sa.white { box-shadow: inset 0 -5px 0 rgba(0,0,0,0.28); }
.key.is-sa.black { box-shadow: 0 4px 6px rgba(0,0,0,0.5), inset 0 -4px 0 rgba(255,255,255,0.35); }

@media (max-width: 480px) {
  .hl-keyboard { height: 170px; }
  .key .kbd-hint { display: none; } /* no hardware keyboard on the go */
  .key .note { font-size: 0.68rem; }
}


#tap-hint {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  background: rgba(20,12,6,0.82);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.95rem;
  z-index: 5;
  pointer-events: none;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.95; }
  50% { opacity: 0.55; }
}

/* ---- Drone-only stage (tanpura / shruti box) ---- */
.drone-stage { text-align: center; padding: 34px 12px 24px; }
.big-drone {
  font-size: 1.15rem;
  font-weight: 700;
  padding: 18px 42px;
  border-radius: 999px;
}
.drone-stage .status { margin: 12px 0 0; }

/* ---- Controls ---- */
.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.panel h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  margin: 0 0 10px;
}

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.row label, .row .label { font-size: 0.85rem; color: var(--ink-dim); min-width: 84px; }

button.ui {
  background: var(--bg-soft);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.85rem;
  cursor: pointer;
}
button.ui.on {
  background: var(--accent-deep);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
}
button.ui[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 1px; }

.sa-btn { min-width: 38px; }
.sa-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
}

input[type="range"] { flex: 1; min-width: 90px; accent-color: var(--accent); }

.status { font-size: 0.85rem; color: var(--ink-dim); }
.status.ok { color: rgb(159, 206, 145); }
.status.err { color: rgb(224, 138, 122); }
#latency-info { font-size: 0.78rem; color: var(--ink-dim); }
.latency-note { font-size: 0.78rem; color: var(--ink-dim); margin-top: 6px; }
.latency-note a, section.text a { color: var(--accent); }

/* ---- Content sections ---- */
section.text { margin-top: 28px; }
section.text h2 {
  font-size: 1.15rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}
section.text h3 { font-size: 0.98rem; color: var(--accent); margin-bottom: 4px; }
section.text ul, section.text ol { padding-left: 20px; }
section.text li { margin: 6px 0; }

kbd {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 5px;
  padding: 1px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
}

/* Keyboard focus: visible ring for keyboard users, no change for mouse/touch. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.faq details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 8px 0;
  background: var(--bg-soft);
}
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 2px; color: var(--ink-dim); }

footer {
  margin-top: 36px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--ink-dim);
}
footer a { color: var(--accent); }
footer .brand-line { margin: 10px 0 0; font-size: 0.78rem; letter-spacing: 0.4px; color: var(--ink-dim); }
