/* Starveil listening panel. Same recess, outline and type as the rest of the
   site; the violet comes from the page accent. The decay field is drawn from
   measured data and only moves when the visitor changes the setting. */

.listen-section {
  border-top: 1px solid var(--outline-soft);
}
.listen-heading > p {
  max-width: 52ch;
}
.listen-console {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.4fr);
  grid-template-areas:
    "rack field"
    "transport transport"
    "status status";
  gap: 0;
  overflow: hidden;
}
.listen-rack {
  grid-area: rack;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 28px;
  border-right: 1px solid var(--outline);
}
.listen-group {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.listen-group legend,
.listen-label {
  margin-bottom: 12px;
  padding: 0;
  font:
    500 11px/1.4 "Space Grotesk",
    sans-serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.listen-sources > div {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--outline);
  border-radius: 9px;
  background: var(--obsidian);
}
.listen-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  transition:
    background var(--hover-ms) var(--ease),
    color var(--hover-ms) var(--ease);
}
.listen-pill input,
.listen-setting input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.listen-pill:hover {
  color: var(--text);
}
.listen-pill:has(input:checked) {
  background: color-mix(in srgb, var(--accent) 16%, var(--recess));
  color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}
.listen-pill:has(input:focus-visible),
.listen-setting:has(input:focus-visible) {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.listen-settings > div {
  display: grid;
  gap: 8px;
}
.listen-setting {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr;
  column-gap: 12px;
  row-gap: 2px;
  padding: 13px 16px 14px 14px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition:
    border-color var(--hover-ms) var(--ease),
    background var(--hover-ms) var(--ease);
}
.listen-setting:hover {
  border-color: rgba(255, 255, 255, 0.14);
}
.listen-setting:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 62%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.listen-setting-key {
  grid-row: 1 / span 3;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border: 1px solid var(--outline);
  border-radius: 50%;
  font-size: 11px;
  color: var(--faint);
}
.listen-setting:has(input:checked) .listen-setting-key {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--obsidian);
}
.listen-setting-name {
  font:
    500 16px/1.3 "Space Grotesk",
    sans-serif;
  letter-spacing: -0.01em;
}
.listen-setting-line {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}
.listen-setting-params {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--faint);
}
.listen-setting:has(input:checked) .listen-setting-params {
  color: color-mix(in srgb, var(--accent) 70%, var(--text));
}

/* ------------------------------------------------------------ decay field */
.listen-field {
  grid-area: field;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 24px 28px 22px;
  min-width: 0;
}
.listen-field-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}
.listen-readout {
  font:
    500 12px/1.4 "Space Grotesk",
    sans-serif;
  letter-spacing: 0.06em;
  color: var(--accent);
  min-height: 1.4em;
}
.listen-chosen {
  display: none;
}
.listen-field-plot {
  position: relative;
  flex: 1;
  min-height: 300px;
  border: 1px solid var(--outline);
  border-radius: 7px;
  background:
    radial-gradient(120% 90% at 50% 110%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 60%),
    var(--obsidian);
  box-shadow: var(--hero-shadow);
  overflow: hidden;
  touch-action: pan-y;
}
.listen-field-plot svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.listen-grid line {
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.listen-axis text {
  font:
    500 10px "Space Grotesk",
    sans-serif;
  letter-spacing: 0.08em;
  fill: var(--faint);
}
.listen-contour {
  fill: none;
  stroke: var(--accent);
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.listen-area {
  fill: url(#listen-fill);
}
.listen-probe line {
  stroke: color-mix(in srgb, var(--accent) 70%, white);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  vector-effect: non-scaling-stroke;
}
.listen-probe circle {
  fill: var(--obsidian);
  stroke: var(--accent);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.listen-rest {
  font:
    500 11px "Space Grotesk",
    sans-serif;
  letter-spacing: 0.18em;
  fill: var(--faint);
  text-anchor: middle;
}
.listen-field-cap {
  margin-top: 12px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--faint);
  max-width: 68ch;
}

/* --------------------------------------------------------------- transport */
.listen-transport {
  grid-area: transport;
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 18px 28px;
  border-top: 1px solid var(--outline);
  background: rgba(255, 255, 255, 0.015);
}
html:not(.has-js) .listen-transport {
  display: none !important;
}
.listen-play,
.listen-stop {
  gap: 10px;
  min-width: 112px;
  flex: none;
}
.listen-play svg,
.listen-stop svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}
.listen-play .i-pause,
.listen-play[data-state="playing"] .i-play {
  display: none;
}
.listen-play[data-state="playing"] .i-pause {
  display: block;
}
.listen-play[data-state="loading"] {
  cursor: progress;
  opacity: 0.8;
}
.listen-stop:disabled {
  opacity: 0.45;
  cursor: default;
}
.listen-wave {
  position: relative;
  flex: 1;
  height: 48px;
  min-width: 120px;
  border-radius: 6px;
  background: var(--obsidian);
  box-shadow: var(--recessed-shadow);
  cursor: pointer;
  touch-action: none;
}
.listen-wave canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.listen-head {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--text);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 80%, transparent);
  pointer-events: none;
}
.listen-time {
  width: 7ch;
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}
.listen-loop {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--outline);
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
  font-size: 13px;
}
.listen-loop[aria-pressed="true"] {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}
.listen-status {
  grid-area: status;
  margin: 0;
  padding: 0 28px;
  font-size: 13px;
  color: var(--muted);
}
.listen-status:not(:empty) {
  padding: 0 28px 16px;
}
.listen-status button {
  margin-left: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-underline-offset: 4px;
  min-height: 44px;
}
.listen-plain {
  grid-column: 1 / -1;
  padding: 18px 28px;
  border-top: 1px solid var(--outline);
  font-size: 14px;
  color: var(--muted);
}
.listen-plain a {
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-underline-offset: 3px;
}
.listen-notes {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 24px 40px;
  align-items: start;
  margin-top: 22px;
}
.listen-notes a:not(.text-link) {
  text-decoration: underline;
  text-decoration-color: var(--outline);
  text-underline-offset: 3px;
}
.listen-notes a:not(.text-link):hover {
  color: var(--text);
  text-decoration-color: var(--gold);
}

/* Stop stays in reach while the panel is scrolled away. */
.listen-dock {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 8px 8px 18px;
  transform: translateX(-50%);
  border: 1px solid var(--outline);
  border-radius: 12px;
  background: color-mix(in srgb, var(--recess) 94%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px #000a;
  max-width: calc(100% - 24px);
}
.listen-dock-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
}
.listen-dock-label {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.listen-dock .button {
  min-height: 44px;
  min-width: 88px;
}

@media (max-width: 1100px) {
  .listen-console {
    grid-template-columns: 1fr;
    grid-template-areas:
      "rack"
      "field"
      "transport"
      "status";
  }
  .listen-rack {
    border-right: 0;
    border-bottom: 1px solid var(--outline);
  }
  .listen-settings > div {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .listen-notes {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 800px) {
  .listen-rack,
  .listen-field {
    padding: 20px 18px;
  }
  .listen-field-plot {
    min-height: 240px;
  }
  .listen-transport {
    flex-wrap: wrap;
    padding: 16px 18px;
  }
  .listen-play,
  .listen-stop {
    flex: 1;
  }
  .listen-wave {
    order: 3;
    flex-basis: 100%;
  }
  .listen-time {
    order: 4;
    width: auto;
    text-align: left;
  }
  .listen-loop {
    order: 5;
    margin-left: auto;
  }
  .listen-status:not(:empty) {
    padding: 0 18px 16px;
  }
}
/* Phones: compact tiles so the picture stays in view while you switch. */
@media (max-width: 800px) {
  .listen-rack {
    gap: 18px;
    padding-bottom: 8px;
    border-bottom: 0;
  }
  .listen-setting {
    grid-template-columns: 20px 1fr;
    align-items: center;
    min-height: 52px;
    padding: 8px 12px 8px 10px;
    column-gap: 10px;
  }
  .listen-setting-key {
    grid-row: auto;
    width: 20px;
    height: 20px;
    margin: 0;
  }
  .listen-setting-name {
    font-size: 14.5px;
  }
  .listen-setting-line,
  .listen-setting-params {
    display: none;
  }
  .listen-field {
    padding-top: 12px;
  }
  .listen-chosen {
    display: block;
    margin: 4px 0 10px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
  }
}
