/* Hear the storm: the full-screen shell around the Sound lab (soundlab.js).
   Loaded after styles.css / sonification.css / soundlab.css and overrides them where they meet. */

:root {
  --bg: #06080c;
  --ink: #eef1f5;
  --ink-2: #c3cad6;
  --muted: #8a94a6;
  --acid: #c8f25a;
  --acid-hi: #e4ff9a;
  --glass: rgba(14, 17, 22, 0.78);
  --glass-line: rgba(238, 241, 245, 0.1);
  --line: rgba(238, 241, 245, 0.14);
  --mono: "JetBrains Mono", "DM Mono", monospace;
  --display: "Space Grotesk", "DM Sans", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

html,
body.hts {
  height: 100%;
}

body.hts {
  overflow: hidden;
  background: var(--bg);
  font-family: var(--display);
}

.hts button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.hts :focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 3px;
}

/* ---------- Map ---------- */

.hts-stage-wrap {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

.hts .lab-stage {
  width: min(100vw, 200vh);
  border: 0;
  background: var(--bg);
  transition: filter 600ms ease, transform 600ms ease;
}

.hts .lab-canvas:focus-visible {
  outline-offset: -3px;
}

/* The map dims and softens behind the intro and the tutorial. */
.hts.is-intro .lab-stage,
.hts.is-tutorial .lab-stage {
  filter: brightness(0.42) saturate(0.9);
}

.hts.is-intro .lab-stage {
  transform: scale(1.02);
}

.hts-stage-wrap::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 60% at 50% 50%, transparent 55%, rgba(6, 8, 12, 0.55));
}

/* ---------- Top bar ---------- */

.hts-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
  pointer-events: none;
}

.hts-top > * {
  pointer-events: auto;
}

.hts-wordmark {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--ink);
}

.hts-top-actions {
  display: flex;
  gap: 10px;
}

.hts-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(6, 8, 12, 0.45);
  color: var(--ink-2);
  backdrop-filter: blur(10px);
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.hts-icon:hover,
.hts-icon[aria-expanded="true"] {
  border-color: rgba(200, 242, 90, 0.5);
  color: var(--acid);
}

.hts.is-intro .hts-top-actions {
  opacity: 0;
  pointer-events: none;
}

/* ---------- Bottom bar: play + week timeline ---------- */

.hts-bar {
  position: fixed;
  left: 32px;
  right: 32px;
  bottom: 28px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  transition: opacity 400ms ease, right 300ms ease;
}

.hts.is-intro .hts-bar,
.hts.is-tutorial .hts-bar {
  opacity: 0;
  pointer-events: none;
}

.hts.is-drawer .hts-bar {
  right: 452px;
}

.hts-play {
  display: grid;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--acid);
  color: #0a0d10;
  transition: background 160ms ease, transform 160ms ease;
}

.hts-play:not(:disabled):hover {
  background: var(--acid-hi);
}

.hts-play:not(:disabled):active {
  transform: scale(0.96);
}

.hts-play:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Reset sits close to the play button (the bar's gap is wider). */
.hts-reset {
  flex: 0 0 auto;
  margin-left: -12px;
}

.hts-reset:disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.hts-play .button-icon {
  font-size: 16px;
  line-height: 1;
  color: #0a0d10;
}

.hts-timeline {
  display: grid;
  flex: 1;
  gap: 10px;
}

.hts-track {
  position: relative;
  height: 2px;
  border-radius: 2px;
  background: rgba(238, 241, 245, 0.16);
}

.hts-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 2px;
  background: var(--acid);
}

.hts-head {
  position: absolute;
  top: -5px;
  left: 0;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--ink);
}

.hts-ticks {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  color: var(--muted);
  font: 11px var(--mono);
  letter-spacing: 0.12em;
}

.hts-ticks span.is-now {
  color: var(--ink);
}

.hts-kbd,
.hts-cta-kbd {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font: 500 11px var(--mono);
  letter-spacing: 0.1em;
}

/* ---------- Intro ---------- */

.hts-intro {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(6, 8, 12, 0.35), rgba(6, 8, 12, 0.85));
  transition: opacity 500ms ease, visibility 500ms;
}

.hts:not(.is-intro) .hts-intro {
  opacity: 0;
  visibility: hidden;
}

.hts-mark {
  color: var(--acid);
}

.hts-title {
  margin: 0 0 38px;
  font: 500 clamp(56px, 8.5vw, 112px) / 0.95 var(--display);
  letter-spacing: -0.045em;
  text-align: center;
}

.hts-intro-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hts-cta {
  display: flex;
  height: 56px;
  align-items: center;
  gap: 14px;
  padding: 0 22px 0 22px;
  border: 0;
  border-radius: 28px;
  background: var(--acid);
  color: #0a0d10 !important;
  font-size: 16px !important;
  font-weight: 600;
  transition: background 160ms ease;
}

.hts-cta:hover {
  background: var(--acid-hi);
}

.hts-cta .hts-cta-kbd {
  padding: 4px 8px;
  border: 0;
  background: rgba(10, 13, 16, 0.12);
  color: #0a0d10;
}

.hts-voice {
  position: relative;
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 1px solid rgba(238, 241, 245, 0.28);
  border-radius: 50%;
  background: rgba(238, 241, 245, 0.04);
}

.hts-voice:hover {
  border-color: rgba(200, 242, 90, 0.6);
}

.hts-voice-ring,
.hts-bars {
  display: none;
}

.hts-voice[aria-pressed="true"] .hts-voice-icon {
  display: none;
}

.hts-voice[aria-pressed="true"] .hts-bars {
  display: flex;
  align-items: center;
  gap: 3px;
}

.hts-voice[aria-pressed="true"] .hts-voice-ring {
  display: block;
  position: absolute;
  inset: 0;
  border: 1px solid var(--acid);
  border-radius: 50%;
  animation: hts-pulse 2.2s ease-out infinite;
}

.hts-bars i {
  display: block;
  width: 3px;
  height: 18px;
  border-radius: 2px;
  background: var(--acid);
  animation: hts-bar 1s ease-in-out infinite;
}

.hts-bars i:nth-child(2) { animation-delay: 0.15s; }
.hts-bars i:nth-child(3) { animation-delay: 0.3s; }
.hts-bars i:nth-child(4) { animation-delay: 0.45s; }
.hts-bars i:nth-child(5) { animation-delay: 0.6s; }

.hts-skip {
  position: fixed;
  left: 32px;
  bottom: 32px;
  min-height: 44px;
  border: 0;
  background: none;
  color: var(--muted) !important;
  font-size: 14px;
}

.hts-skip:hover {
  color: var(--ink) !important;
}

/* ---------- Cards (tutorial, details) ---------- */

.hts-card {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 30;
  width: min(480px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 32px;
  background: rgba(20, 24, 32, 0.6);
  backdrop-filter: blur(28px) saturate(1.4);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.5);
  color: #f4f6fa;
  font-family: "Inter", var(--display);
  transform: translate(-50%, -50%);
  animation: hts-rise 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.hts-card[hidden] {
  display: none;
}

.hts-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.hts-card-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hts-close {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
}

.hts-close:hover {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.35);
}

.hts-close-lg {
  width: 44px;
  height: 44px;
}

.hts-illus {
  position: relative;
  height: 240px;
  overflow: hidden;
  border-radius: 20px;
  background: radial-gradient(circle at 50% 55%, rgba(155, 227, 58, 0.35), rgba(6, 8, 12, 0.9) 60%);
}

.hts-il {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
}

.hts-illus[data-step="0"] .hts-il-0,
.hts-illus[data-step="1"] .hts-il-1,
.hts-illus[data-step="2"] .hts-il-2,
.hts-illus[data-step="3"] .hts-il-3 {
  display: flex;
}

.hts-il-l,
.hts-il-r,
.hts-il-u {
  position: absolute;
  color: #c9d2de;
  font: 12px var(--mono);
}

.hts-il-l { left: 24px; top: 50%; }
.hts-il-r { right: 24px; top: 50%; }
.hts-il-u { top: 18px; left: 50%; }

.hts-glide {
  animation: hts-glide 3.2s ease-in-out infinite;
}

.hts-rip {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 2px solid #9fdbff;
  border-radius: 50%;
  animation: hts-ripple 1.8s ease-out infinite;
}

.hts-rip-d {
  animation-delay: 0.6s;
}

.hts-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #9fdbff;
}

.hts-keycap {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 18px;
  background: rgba(244, 246, 250, 0.95);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.18);
  color: #06080c;
  font: 500 24px var(--mono);
  animation: hts-press 1.6s ease-in-out infinite;
}

.hts-tut-copy {
  display: grid;
  gap: 10px;
  padding: 24px 4px 0;
}

.hts-tut-copy h2 {
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.hts-tut-copy p {
  margin: 0;
  color: #b4becc;
  font: 12px var(--mono);
  letter-spacing: 0.1em;
}

.hts-tut-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 4px 0;
}

.hts-tut-progress {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hts-segs {
  display: flex;
  gap: 6px;
}

.hts-seg {
  display: flex;
  width: 32px;
  height: 44px;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
}

.hts-seg i {
  position: relative;
  display: block;
  width: 32px;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(244, 246, 250, 0.22);
}

.hts-seg b {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 2px;
  background: #f4f6fa;
}

.hts-left {
  min-width: 24px;
  color: #b4becc;
  font: 12px var(--mono);
}

.hts-next {
  height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 24px;
  background: #f4f6fa;
  color: #06080c !important;
  font-size: 15px;
  font-weight: 600;
}

.hts-details {
  width: min(520px, calc(100vw - 32px));
}

.hts-details h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.hts-facts {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hts-facts li {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  line-height: 1.35;
}

.hts-facts b {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  color: var(--acid);
  font: 400 16px var(--mono);
}

.hts-facts b.hts-rs {
  font-size: 11px;
  letter-spacing: 0.05em;
}

.hts-foot-note {
  margin: 20px 0 0;
  color: #b4becc;
  font: 11px var(--mono);
  letter-spacing: 0.1em;
}

/* ---------- Controls drawer ---------- */

.hts-drawer {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 25;
  display: flex;
  width: min(420px, calc(100vw - 32px));
  box-sizing: border-box;
  flex-direction: column;
  border: 1px solid var(--glass-line);
  border-radius: 24px;
  background: var(--glass);
  backdrop-filter: blur(24px);
  color: var(--ink);
  font-family: var(--display);
  animation: hts-slide 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
  transition: width 300ms ease;
}

.hts-drawer[hidden] {
  display: none;
}

/* Opening "Advanced mapping" widens the drawer for the mapping table. */
.hts-drawer.is-wide {
  width: min(1180px, calc(100vw - 32px));
}

.hts-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 12px 28px;
}

.hts-drawer-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.hts-drawer-body {
  display: grid;
  align-content: start;
  gap: 24px;
  overflow: auto;
  padding: 8px 28px 28px;
}

.hts-drawer .lab-deck {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0;
}

.hts-drawer .lab-select {
  min-height: 44px;
  border-radius: 12px;
  border-color: var(--line);
  background: rgba(238, 241, 245, 0.04);
  font: 14px var(--display);
}

.hts-drawer .lab-deck-tools {
  gap: 8px;
}

.hts-drawer .button {
  min-height: 36px;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 500;
}

.hts-drawer .button-secondary {
  border-color: var(--line);
  background: transparent;
  color: var(--ink-2);
}

.hts-drawer .button-secondary:not(:disabled):hover {
  border-color: rgba(200, 242, 90, 0.5);
  background: rgba(200, 242, 90, 0.08);
  color: var(--ink);
}

.hts-drawer .lab-globals {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 22px;
}

.hts-drawer .slider-heading,
.hts-drawer .lab-field-label {
  color: var(--ink-2);
  font-size: 13px;
}

.hts-drawer .slider-heading output {
  color: var(--ink);
  font: 12px var(--mono);
}

.hts-drawer .slider-control input {
  height: 2px;
  background: rgba(238, 241, 245, 0.18);
  accent-color: var(--acid);
}

.hts-drawer .slider-control input::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  background: var(--ink);
  box-shadow: 0 0 0 4px rgba(200, 242, 90, 0.25);
}

.hts-drawer .slider-control input::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  background: var(--ink);
}

.hts-drawer .slider-scale {
  color: var(--muted);
  font: 10px var(--mono);
}

.hts-drawer .lab-check {
  color: var(--ink-2);
  font-size: 12px;
}

.hts-adv {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.hts-adv summary {
  min-height: 32px;
  color: var(--acid);
  font-size: 14px;
  cursor: pointer;
  list-style: none;
}

.hts-adv summary::-webkit-details-marker {
  display: none;
}

.hts-adv summary::after {
  content: " →";
}

.hts-adv[open] summary::after {
  content: " ↓";
}

.hts-adv .lab-help {
  color: var(--muted);
}

.hts-adv .lab-subhead {
  margin: 24px 0 10px;
  font: 500 11px var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hts-drawer .lab-stage-key {
  position: static;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 0;
  background: none;
  color: var(--muted);
}

.hts-drawer-foot {
  display: grid;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 11px var(--mono);
  letter-spacing: 0.06em;
}

.hts-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.hts-links a {
  color: var(--ink-2);
  text-decoration: none;
}

.hts-links a:hover {
  color: var(--acid);
}

/* The shared demo switcher, quietened to fit the drawer. */
.hts-drawer .gt-switcher {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 12px var(--display);
}

.hts-drawer .gt-switcher a {
  color: var(--acid);
}

.hts-drawer .gt-switcher button {
  border-radius: 14px;
  background: var(--acid);
}

.hts-drawer .gt-switcher .gt-demo-desc {
  display: none;
}

/* The I key in a serif face, so its bars show it is a capital I and not an l. */
.hts-i {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
}

/* ---------- Motion ---------- */

@keyframes hts-pulse {
  0% { transform: scale(1); opacity: 0.55; }
  100% { transform: scale(1.9); opacity: 0; }
}

@keyframes hts-bar {
  0%, 100% { transform: scaleY(0.25); }
  50% { transform: scaleY(1); }
}

@keyframes hts-glide {
  0%, 100% { transform: translate(-60px, 20px); }
  50% { transform: translate(60px, -20px); }
}

@keyframes hts-ripple {
  0% { transform: scale(0.4); opacity: 0.9; }
  100% { transform: scale(2.4); opacity: 0; }
}

@keyframes hts-press {
  0%, 60%, 100% { transform: translateY(0); }
  70% { transform: translateY(4px); }
}

@keyframes hts-rise {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 16px)); }
}

@keyframes hts-slide {
  from { opacity: 0; transform: translateX(24px); }
}

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

/* ---------- Small screens ---------- */

@media (max-width: 720px) {
  .hts-top {
    padding: 16px;
  }

  .hts-bar {
    left: 16px;
    right: 16px;
    bottom: 16px;
    gap: 14px;
  }

  .hts.is-drawer .hts-bar {
    right: 16px;
  }

  .hts-reset {
    margin-left: -6px;
  }

  .hts-kbd {
    display: none;
  }

  .hts-ticks span:not(:first-child):not(:last-child) {
    visibility: hidden;
  }

  .hts-skip {
    left: 16px;
    bottom: 16px;
  }

  .hts-illus {
    height: 180px;
  }
}
