/* =============================================================
   LLUVIA SONORA — sistema visual
   Liquid Glass + Dark Cinematic
   ============================================================= */

:root {
  --bg: #000000;
  --bg-soft: #050608;
  --fg: #ffffff;
  --fg-dim: rgba(255, 255, 255, 0.6);
  --fg-faint: rgba(255, 255, 255, 0.38);
  --fg-ghost: rgba(255, 255, 255, 0.16);

  --accent: #b8d4ff;      /* azul cielo frío */
  --accent-warm: #ffd9a8; /* sol bajo */
  --accent-storm: #7a8aff;/* tormenta */

  --radius-pill: 9999px;
  --radius-card: 22px;
  --radius-small: 12px;

  --font-heading: 'Instrument Serif', ui-serif, Georgia, serif;
  --font-body: 'Barlow', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --grain-opacity: 0.04;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100dvh;
}

body {
  position: relative;
  padding: clamp(16px, 3vw, 32px);
  padding-bottom: 80px;
}

/* =============================================================
   LIQUID GLASS BASE
   ============================================================= */

.liquid-glass {
  position: relative;
  background: rgba(255, 255, 255, 0.015);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  border-radius: var(--radius-card);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.08),
    0 1px 0 rgba(0, 0, 0, 0.4);
  overflow: hidden;
  isolation: isolate;
}

.liquid-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.40) 0%,
    rgba(255, 255, 255, 0.12) 20%,
    rgba(255, 255, 255, 0) 45%,
    rgba(255, 255, 255, 0) 60%,
    rgba(255, 255, 255, 0.10) 82%,
    rgba(255, 255, 255, 0.35) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  z-index: 1;
}

.liquid-glass-strong {
  position: relative;
  background: rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(40px) saturate(160%);
  -webkit-backdrop-filter: blur(40px) saturate(160%);
  border-radius: var(--radius-card);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.14),
    0 6px 30px rgba(0, 0, 0, 0.5),
    0 2px 6px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  isolation: isolate;
}

.liquid-glass-strong::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.4px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0.18) 20%,
    rgba(255, 255, 255, 0) 45%,
    rgba(255, 255, 255, 0) 60%,
    rgba(255, 255, 255, 0.16) 82%,
    rgba(255, 255, 255, 0.50) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  z-index: 1;
}

/* =============================================================
   ATMOSPHERE (background)
   ============================================================= */

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.atmosphere__gradient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1200px 700px at 70% -10%, rgba(184, 212, 255, 0.10), transparent 60%),
    radial-gradient(900px 600px at 10% 110%, rgba(122, 138, 255, 0.07), transparent 60%),
    linear-gradient(180deg, #02030a 0%, #000000 100%);
  transition: background 1200ms var(--ease-soft);
}

.atmosphere__particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.7;
}

.atmosphere__grain {
  position: absolute;
  inset: 0;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* =============================================================
   TOP BAR
   ============================================================= */

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  animation: fadeUp 800ms var(--ease-out) both;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
}

.logo {
  width: 22px;
  height: 22px;
  color: var(--accent);
  overflow: visible; /* path reaches viewBox edge; stroke would otherwise clip */
  flex-shrink: 0;
}

.topbar__title {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1.15;
  padding-right: 0.05em;
}

.topbar__location {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: var(--fg-dim);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  white-space: nowrap;
  justify-self: center;
}

.topbar__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: pulseDot 2.4s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.25); }
}

.topbar__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar__sep { opacity: 0.4; }

/* =============================================================
   HERO
   ============================================================= */

.hero {
  margin: 56px 0 72px;
  text-align: center;
  animation: fadeUp 1000ms var(--ease-out) 100ms both;
}

.hero__title {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(48px, 9vw, 112px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin: 0 0 20px;
  padding: 0.08em 0.04em 0.16em; /* breathing room for italic serifs + descenders */
  color: var(--fg);
}

.hero__line {
  display: block;
  padding: 0.02em 0.06em; /* room so italic ascenders/serifs aren't clipped by background-clip */
}

.hero__line--italic {
  font-style: italic;
  background: linear-gradient(180deg, var(--fg) 0%, rgba(255, 255, 255, 0.55) 100%);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  /* without explicit padding the italic 'q', 'l' overshoot the bg-clip box */
  padding: 0.04em 0.1em 0.1em;
  margin: -0.04em -0.1em -0.04em; /* compensate so layout doesn't shift */
}

.hero__subtitle {
  max-width: 560px;
  margin: 0 auto;
  color: var(--fg-dim);
  font-size: clamp(14px, 1.4vw, 16px);
  line-height: 1.55;
  font-weight: 300;
}

/* =============================================================
   CONSOLE
   ============================================================= */

.console {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  animation: fadeUp 1200ms var(--ease-out) 250ms both;
}

/* ----- Visualizer ----- */

.visualizer {
  position: relative;
  aspect-ratio: 21 / 9;
  min-height: 260px;
  overflow: hidden;
}

#vizCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.visualizer__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2;
  pointer-events: none;
  text-align: center;
  padding: 24px;
}

.visualizer__readout {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  font-family: var(--font-heading);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(80px, 14vw, 180px);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--fg);
  padding: 0.06em 0.04em 0.1em; /* italic numbers (3, 7, 9, °) overshoot the box */
}

.visualizer__unit {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 0.18em;
  color: var(--fg-faint);
  margin-top: 0.45em;
  letter-spacing: 0.05em;
}

.visualizer__sub {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-top: 8px;
}

/* ----- Modules grid ----- */

.modules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.module {
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 232px;
  transition: transform 600ms var(--ease-out), box-shadow 600ms var(--ease-out), background 600ms var(--ease-soft);
}

.module:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.025);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.10),
    0 8px 24px rgba(0, 0, 0, 0.35);
}

.module__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start; /* baseline + italic = clipping risk on label descenders */
  gap: 12px;
}

.module__id {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--fg-faint);
  text-transform: uppercase;
}

.module__label {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 18px;
  color: var(--fg);
  line-height: 1.15;
  padding-right: 0.1em; /* italic 'd' / 'd.' overshoot */
}

.module__readout {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: auto;
}

.module__value {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 40px;
  line-height: 1.15;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  padding-right: 0.06em;
  transition: color 700ms var(--ease-soft);
}

.module__unit {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-faint);
  letter-spacing: 0.05em;
}

.module__foot {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--fg-faint);
  text-transform: uppercase;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.module__meta--right { color: var(--fg-dim); }

/* ----- Module: knob (temperature) ----- */

.module__knob {
  display: flex;
  justify-content: center;
  height: 90px;
}

.knob {
  width: 90px;
  height: 90px;
  color: var(--accent);
}

.knob__track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 2;
}

.knob__fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 251.3;
  stroke-dashoffset: 251.3;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 1400ms var(--ease-out), stroke 1400ms var(--ease-soft);
  filter: drop-shadow(0 0 6px currentColor);
}

.knob__pointer {
  stroke: var(--fg);
  stroke-width: 1.5;
  stroke-linecap: round;
  transform-origin: 50px 50px;
  transition: transform 1400ms var(--ease-out);
}

.knob__center {
  fill: var(--fg);
  opacity: 0.85;
}

/* ----- Module: slider (humidity) ----- */

.module__slider {
  height: 90px;
  display: flex;
  align-items: center;
}

.slider {
  width: 100%;
  position: relative;
}

.slider__track {
  position: relative;
  height: 6px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  overflow: visible;
}

.slider__fill {
  position: absolute;
  inset: 0;
  width: 0%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent), var(--accent-warm));
  transition: width 1400ms var(--ease-out);
  box-shadow: 0 0 12px rgba(184, 212, 255, 0.4);
}

.slider__thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--fg);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), 0 4px 18px rgba(255, 255, 255, 0.2);
  transition: left 1400ms var(--ease-out);
}

/* ----- Module: waveform (wind) ----- */

.module__wave {
  height: 90px;
  display: flex;
  align-items: center;
  color: var(--accent);
}

.wave {
  width: 100%;
  height: 60px;
}

#waveWind {
  filter: drop-shadow(0 0 4px currentColor);
  transition: d 1400ms var(--ease-out);
}

/* ----- Module: rain dots ----- */

.module__rain {
  height: 90px;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-small);
}

.rain {
  position: absolute;
  inset: 0;
}

.rain__drop {
  position: absolute;
  top: -10%;
  width: 1.5px;
  height: 14px;
  background: linear-gradient(180deg, transparent, var(--accent));
  border-radius: 1px;
  opacity: 0.7;
  animation: fall linear infinite;
}

@keyframes fall {
  0% { transform: translateY(-20%); opacity: 0; }
  10% { opacity: 0.8; }
  100% { transform: translateY(120%); opacity: 0; }
}

/* ----- Module: sphere (pressure) ----- */

.module__sphere {
  height: 90px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.sphere {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 60%),
    radial-gradient(circle at 70% 70%, rgba(122, 138, 255, 0.5), rgba(122, 138, 255, 0) 70%),
    rgba(255, 255, 255, 0.04);
  box-shadow:
    inset 0 0 24px rgba(255, 255, 255, 0.08),
    0 0 24px rgba(184, 212, 255, 0.15);
  transition: transform 1600ms var(--ease-soft), box-shadow 1600ms var(--ease-soft);
  animation: breathe 7s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(0.95); }
  50% { transform: scale(1.04); }
}

/* ----- Module: cloud bar (veil) ----- */

.module__cloud {
  height: 90px;
  display: flex;
  align-items: center;
}

.cloudbar {
  width: 100%;
  height: 50px;
  border-radius: var(--radius-small);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
  position: relative;
}

.cloudbar__layer {
  position: absolute;
  inset: 0;
  width: 100%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(255, 255, 255, 0.18), transparent 60%),
    radial-gradient(ellipse at 60% 50%, rgba(255, 255, 255, 0.14), transparent 60%),
    radial-gradient(ellipse at 90% 50%, rgba(255, 255, 255, 0.10), transparent 60%);
  filter: blur(8px);
  opacity: 0;
  transition: opacity 1400ms var(--ease-soft);
}

/* =============================================================
   DOCK (master controls)
   ============================================================= */

.dock {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  flex-wrap: wrap;
}

.dock__play {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--fg);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-pill);
  padding: 12px 22px 12px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 200ms var(--ease-soft), opacity 200ms;
  position: relative;
  z-index: 2;
}

.dock__play:hover { transform: translateY(-1px); }
.dock__play:active { transform: translateY(0); }

.dock__icon {
  width: 18px;
  height: 18px;
}

.dock__icon--pause { display: none; }

.dock.is-playing .dock__icon--play { display: none; }
.dock.is-playing .dock__icon--pause { display: block; }

.dock__divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
}

.dock__group {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  z-index: 2;
}

.dock__knob {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.dock__knob input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
}

.dock__knob input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--fg);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(255, 255, 255, 0.3);
}

.dock__knob input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--fg);
  cursor: pointer;
  border: none;
}

.dock__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--fg-dim);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 200ms var(--ease-soft);
}

.dock__btn:hover {
  color: var(--fg);
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.04);
}

.dock__btn svg { width: 12px; height: 12px; }

.dock__btn.is-recording svg circle {
  fill: #ff5555;
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* =============================================================
   INFO
   ============================================================= */

.info {
  max-width: 1280px;
  margin: 32px auto 0;
}

.info__details summary {
  list-style: none;
  cursor: pointer;
}

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

.info__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-dim);
  transition: color 200ms;
}

.info__summary:hover { color: var(--fg); }

.info__summary svg {
  width: 14px;
  height: 14px;
  transition: transform 300ms var(--ease-soft);
}

.info__details[open] .info__summary svg {
  transform: rotate(180deg);
}

.info__body {
  padding: 20px 24px;
  color: var(--fg-dim);
  font-size: 14px;
  line-height: 1.65;
  max-width: 700px;
  margin: 0 auto;
}

.info__body em {
  font-family: var(--font-heading);
  font-style: italic;
  color: var(--fg);
  font-size: 1.05em;
}

.info__body strong {
  color: var(--fg);
  font-weight: 500;
}

/* =============================================================
   BOTTOM
   ============================================================= */

.bottom {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-faint);
  pointer-events: none;
  white-space: nowrap;
}

.bottom__sep { opacity: 0.35; }
.bottom__brand { color: var(--fg-dim); font-weight: 500; }
.bottom__name  { color: var(--fg-faint); }
.bottom__version {
  color: var(--fg-faint);
  font-variant-numeric: tabular-nums;
  padding: 2px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  font-size: 9px;
  letter-spacing: 0.15em;
}

/* =============================================================
   TOAST
   ============================================================= */

.toast {
  position: fixed;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg);
  z-index: 100;
  animation: fadeUp 400ms var(--ease-out);
  max-width: 90vw;
  text-align: center;
}

.toast[hidden] { display: none; }

/* =============================================================
   ANIMATIONS
   ============================================================= */

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes valueGlow {
  0% { color: var(--fg); }
  50% { color: var(--accent); text-shadow: 0 0 16px var(--accent); }
  100% { color: var(--fg); text-shadow: none; }
}

.module__value.is-updating {
  animation: valueGlow 1800ms var(--ease-soft);
}

/* =============================================================
   RESPONSIVE
   ============================================================= */

@media (max-width: 768px) {
  body { padding: 14px; padding-bottom: 80px; }

  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
    text-align: center;
  }

  .topbar__location { justify-self: center; }
  .topbar__meta { justify-content: center; }

  .hero { margin: 24px 0 32px; }

  .visualizer { aspect-ratio: 4 / 3; min-height: 220px; }

  .modules {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .module { padding: 14px; min-height: 180px; gap: 10px; }
  .module__value { font-size: 28px; }
  .module__label { font-size: 14px; }

  .knob { width: 70px; height: 70px; }
  .module__knob, .module__slider, .module__wave, .module__rain, .module__sphere, .module__cloud {
    height: 60px;
  }

  .sphere { width: 48px; height: 48px; }

  .dock {
    flex-direction: column;
    align-items: stretch;
  }

  .dock__divider { display: none; }
  .dock__group { justify-content: space-between; }
  .dock__knob input[type="range"] { width: 80px; }
}

@media (max-width: 420px) {
  .modules { grid-template-columns: 1fr 1fr; gap: 8px; }
  .module { min-height: 160px; }
  .module__value { font-size: 24px; }
  .dock__group { flex-direction: column; align-items: stretch; gap: 10px; }
  .dock__knob { justify-content: space-between; }
  .dock__btn { justify-content: center; }
}

/* =============================================================
   PREFERS-REDUCED-MOTION
   ============================================================= */

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

/* =============================================================
   ENTRY OVERLAY
   Single explicit gesture to unlock audio. Fades out on click.
   ============================================================= */

.entry {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: #000;
  opacity: 1;
  visibility: visible;
  transition: opacity 1.4s var(--ease-out), visibility 0s linear 1.4s;
}

.entry.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.entry__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 40%, rgba(184, 212, 255, 0.06), transparent 70%),
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(122, 138, 255, 0.05), transparent 70%),
    #000;
  pointer-events: none;
}

.entry__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(24px, 4vh, 44px);
  padding: clamp(24px, 5vw, 48px);
  text-align: center;
  animation: entryRise 1.6s var(--ease-out) both;
}

.entry__eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--fg-faint);
  font-weight: 500;
}

.entry__title {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: clamp(40px, 7.5vw, 84px);
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--fg);
  padding: 0.06em 0.06em 0.12em;
}

.entry__title .entry__line {
  display: block;
  padding: 0 0.04em;
}

.entry__title .entry__line--italic {
  font-style: italic;
  color: var(--fg-dim);
}

.entry__play {
  position: relative;
  width: clamp(96px, 16vw, 132px);
  height: clamp(96px, 16vw, 132px);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
  cursor: pointer;
  display: grid;
  place-items: center;
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  transition: transform 0.5s var(--ease-out), background 0.4s var(--ease-soft), border-color 0.4s var(--ease-soft);
  margin: 8px 0;
}

.entry__play:hover,
.entry__play:focus-visible {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.36);
  transform: scale(1.04);
  outline: none;
}

.entry__play:active {
  transform: scale(0.98);
}

.entry__play-icon {
  width: 30%;
  height: 30%;
  position: relative;
  z-index: 2;
  /* Optically center the triangle: its bbox is 1.5px right of the 24px
     viewBox center, so nudge the SVG ~3% left to compensate. */
  transform: translateX(-4%);
}

.entry__play-ring {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  pointer-events: none;
  animation: entryPulse 2.8s var(--ease-out) infinite;
}

.entry__play-ring--2 {
  animation-delay: 1.4s;
}

.entry__hint {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-faint);
  opacity: 0.85;
  animation: entryHintBlink 3s ease-in-out infinite;
}

@keyframes entryRise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes entryPulse {
  0%   { transform: scale(1);    opacity: 0.55; }
  70%  { transform: scale(1.45); opacity: 0; }
  100% { transform: scale(1.45); opacity: 0; }
}

@keyframes entryHintBlink {
  0%, 100% { opacity: 0.45; }
  50%      { opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  .entry__inner { animation: none; }
  .entry__play-ring { animation: none; opacity: 0; }
  .entry__hint { animation: none; }
}

/* =============================================================
   FOCUS & ACCESSIBILITY
   ============================================================= */

button:focus-visible,
input[type="range"]:focus-visible,
.info__summary:focus-visible {
  outline: 2px solid rgba(184, 212, 255, 0.55);
  outline-offset: 3px;
  border-radius: var(--radius-pill);
}

.module:focus-within {
  background: rgba(255, 255, 255, 0.025);
}

/* =============================================================
   RESPONSIVE — topbar collapses on narrow screens
   ============================================================= */

@media (max-width: 640px) {
  .topbar {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "brand meta"
      "loc   loc";
    gap: 12px;
    margin-bottom: 24px;
  }
  .topbar__brand    { grid-area: brand; }
  .topbar__location { grid-area: loc; justify-self: stretch; justify-content: center; }
  .topbar__meta     { grid-area: meta; }

  .hero { margin: 32px 0 48px; }
  .hero__subtitle { padding: 0 8px; }

  .visualizer { aspect-ratio: 16 / 10; min-height: 220px; }
  .dock { padding: 12px; gap: 10px; }
  .dock__group { gap: 10px; }
  .dock__knob input[type="range"] { width: 88px; }
}

@media (max-width: 380px) {
  .module { min-height: auto; padding: 18px 16px 14px; }
  .modules { gap: 12px; }
}

/* =============================================================
   LIVE-DATA PING — subtle pulse on the location dot every refresh
   ============================================================= */

.topbar__location.is-refreshing .topbar__dot {
  animation: refreshPing 900ms var(--ease-out);
}

@keyframes refreshPing {
  0%   { box-shadow: 0 0 0 0 var(--accent); transform: scale(1); }
  60%  { box-shadow: 0 0 0 10px rgba(184, 212, 255, 0); transform: scale(1.6); }
  100% { box-shadow: 0 0 0 0 rgba(184, 212, 255, 0); transform: scale(1); }
}

/* =============================================================
   PLAYING STATE — modules subtly glow when audio is alive
   ============================================================= */

body.is-playing .module {
  border-color: transparent;
}

body.is-playing .module:hover {
  background: rgba(255, 255, 255, 0.035);
}

body.is-playing .visualizer {
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.18),
    0 12px 40px rgba(0, 0, 0, 0.5),
    0 0 60px rgba(184, 212, 255, 0.06);
}

/* =============================================================
   PER-MODULE ACCENTS
   Each weather dimension gets its own colour so the grid reads as
   six distinct instruments, not six clones of the same card.
   ============================================================= */

.module {
  --m-accent: var(--accent);
  --m-accent-soft: rgba(184, 212, 255, 0.18);
}
.module[data-module="temp"]     { --m-accent: #ffd9a8; --m-accent-soft: rgba(255, 217, 168, 0.20); }
.module[data-module="humidity"] { --m-accent: #b8d4ff; --m-accent-soft: rgba(184, 212, 255, 0.20); }
.module[data-module="wind"]     { --m-accent: #a8e6df; --m-accent-soft: rgba(168, 230, 223, 0.18); }
.module[data-module="rain"]     { --m-accent: #cfe0ff; --m-accent-soft: rgba(207, 224, 255, 0.18); }
.module[data-module="pressure"] { --m-accent: #b3a8ff; --m-accent-soft: rgba(179, 168, 255, 0.20); }
.module[data-module="cloud"]    { --m-accent: #e8e4dd; --m-accent-soft: rgba(232, 228, 221, 0.16); }

/* Apply the per-module accent to the visualisation elements inside each card. */
.module .knob              { color: var(--m-accent); }
.module .knob__fill        { stroke: var(--m-accent); }
.module .module__wave      { color: var(--m-accent); }
.module .rain__drop        { background: linear-gradient(180deg, transparent, var(--m-accent)); }
.module .slider__fill      { background: linear-gradient(90deg, var(--m-accent), var(--fg)); box-shadow: 0 0 12px var(--m-accent-soft); }
.module[data-module="pressure"] .sphere {
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 60%),
    radial-gradient(circle at 70% 70%, var(--m-accent-soft), transparent 70%),
    rgba(255, 255, 255, 0.04);
  box-shadow:
    inset 0 0 24px rgba(255, 255, 255, 0.08),
    0 0 28px var(--m-accent-soft);
}

/* The module id chip picks up a faint colour wash too. */
.module__id {
  color: var(--fg-faint);
  position: relative;
  padding-left: 12px;
}
.module__id::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--m-accent);
  box-shadow: 0 0 8px var(--m-accent-soft);
  opacity: 0.7;
}

/* On hover, the colour cue intensifies slightly. */
.module:hover .module__id::before {
  opacity: 1;
  transform: translateY(-50%) scale(1.2);
  transition: transform 240ms var(--ease-out), opacity 240ms;
}

/* Value typography refinement — tabular nums + tight ligatures. */
.module__value {
  font-feature-settings: "tnum", "lnum", "ss01";
}

/* When audio is alive, each module's value softly glows in its own accent. */
body.is-playing .module__value {
  text-shadow: 0 0 24px var(--m-accent-soft);
  transition: text-shadow 700ms var(--ease-soft);
}

/* =============================================================
   LOCATION PICKER
   Click the topbar pill -> dropdown to search + pick a city.
   ============================================================= */

.topbar__location {
  /* upgrade the existing pill into a button */
  border: none;
  cursor: pointer;
  transition: transform 200ms var(--ease-soft), color 200ms;
}

/* Loading shimmer across the pill while geolocation is resolving. */
.topbar__location.is-loading {
  position: relative;
  overflow: hidden;
}
.topbar__location.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 50%,
    transparent 100%
  );
  animation: pillShimmer 1.4s linear infinite;
  pointer-events: none;
}
@keyframes pillShimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}
.topbar__location.is-loading .topbar__dot {
  animation-duration: 0.9s;
}
.topbar__location:hover {
  color: var(--fg);
}
.topbar__location:hover .topbar__caret {
  transform: translateY(1px);
  opacity: 1;
}

.topbar__caret {
  width: 12px;
  height: 12px;
  margin-left: 4px;
  opacity: 0.5;
  transition: transform 200ms var(--ease-soft), opacity 200ms;
}

.topbar__location[aria-expanded="true"] .topbar__caret {
  transform: rotate(180deg) translateY(-1px);
  opacity: 1;
}

/* Native <dialog> picker. The browser handles open/close, focus
   management, escape key, and the ::backdrop pseudo. No hand-rolled
   scrim, no [hidden] juggling. */
dialog.locpicker {
  padding: 10px;
  width: min(400px, calc(100vw - 32px));
  max-height: min(80dvh, 560px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0) 60%),
    #0a0b10;
  color: var(--fg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 24px 64px rgba(0, 0, 0, 0.7),
    0 0 80px rgba(184, 212, 255, 0.04);
  margin: clamp(56px, 8vh, 80px) auto 0;
  overflow: hidden;
  /* Open animation only fires when [open] is set (i.e. showModal called). */
  animation: dialogIn 220ms var(--ease-out);
}

dialog.locpicker::backdrop {
  background:
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0.88) 100%);
  animation: backdropIn 220ms var(--ease-out);
}

@keyframes dialogIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes backdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Subtle hairline inside the dialog so it feels framed, like the
   liquid-glass cards on the page. */
dialog.locpicker::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.30) 0%,
    rgba(255, 255, 255, 0.04) 30%,
    rgba(255, 255, 255, 0) 65%,
    rgba(255, 255, 255, 0.08) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

.locpicker__inputwrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  z-index: 2;
}

.locpicker__inputwrap:focus-within {
  border-color: rgba(184, 212, 255, 0.4);
  background: rgba(255, 255, 255, 0.04);
}

.locpicker__search-icon {
  width: 16px;
  height: 16px;
  color: var(--fg-faint);
  flex-shrink: 0;
}

.locpicker__input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.01em;
  min-width: 0;
}

.locpicker__input::placeholder {
  color: var(--fg-faint);
  font-style: italic;
}

.locpicker__clear {
  background: transparent;
  border: none;
  color: var(--fg-faint);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: 6px;
  transition: color 160ms, background 160ms;
}

.locpicker__clear:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.06);
}

.locpicker__clear svg {
  width: 14px;
  height: 14px;
}

.locpicker__results {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: min(48vh, 360px);
  overflow-y: auto;
  position: relative;
  z-index: 2;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.locpicker__results:empty {
  margin: 0;
}

.locpicker__result {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--fg-dim);
  transition: background 140ms, color 140ms;
}

.locpicker__result:hover,
.locpicker__result.is-active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
}

.locpicker__result-name {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
}

.locpicker__result-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.locpicker__empty {
  padding: 24px 14px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.locpicker__footer {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 8px;
  padding-top: 8px;
  position: relative;
  z-index: 2;
}

.locpicker__auto {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: var(--fg-dim);
  padding: 10px 14px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 160ms, background 160ms;
}

.locpicker__auto:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.04);
}

.locpicker__auto svg {
  width: 13px;
  height: 13px;
  opacity: 0.7;
}

/* Scrollbar styling for webkit */
.locpicker__results::-webkit-scrollbar {
  width: 6px;
}
.locpicker__results::-webkit-scrollbar-track {
  background: transparent;
}
.locpicker__results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}
.locpicker__results::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

@media (max-width: 640px) {
  dialog.locpicker {
    width: calc(100vw - 32px);
    max-width: none;
    margin: calc(env(safe-area-inset-top, 0px) + 80px) 16px 0;
    max-height: 75dvh;
  }
  .locpicker__results {
    max-height: min(45dvh, 320px);
  }
}

/* Picker header — title + close button. */
.locpicker__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 10px;
}
.locpicker__title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.locpicker__close {
  background: transparent;
  border: none;
  color: var(--fg-dim);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: color 160ms, background 160ms;
}
.locpicker__close:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.06);
}
.locpicker__close svg { width: 16px; height: 16px; }
