:root {
  --line-faint: #202020;
  --quiet: #5f5f5f;
}

.hero h1 a {
  color: inherit;
  text-decoration: none;
}

.hero h1 a:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
}

.view-switch--links a {
  display: grid;
  min-width: 4.2rem;
  padding: 0 .55rem;
  place-items: center;
  color: var(--muted);
  font-size: .62rem;
  font-weight: 800;
  text-decoration: none;
}

.view-switch--links a:hover {
  color: #080808;
  background: var(--accent);
}

.mode-link[aria-current="page"] {
  color: #080808;
  background: var(--accent);
}

.waveform-controls__inner {
  display: grid;
  grid-template-columns: minmax(16rem, 1.25fr) minmax(14rem, 1.05fr) minmax(16rem, 1.65fr) minmax(8rem, .65fr);
  align-items: end;
  gap: .55rem;
  width: calc(100% - var(--page-gutter) - var(--page-gutter));
  max-width: var(--content-width);
  margin: auto;
}

.resolution-switch {
  display: grid;
  height: 2.25rem;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  background: var(--panel);
}

.resolution-switch button,
.timeline-actions button {
  display: grid;
  min-width: 0;
  padding: 0 .65rem;
  place-items: center;
  color: var(--muted);
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font: 800 .61rem/1 var(--font-data);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.resolution-switch button {
  grid-template-columns: auto auto;
  gap: .45rem;
}

.resolution-switch button:last-child,
.timeline-actions button:last-child { border-right: 0; }

.resolution-switch button:hover,
.timeline-actions button:hover { color: var(--text); background: rgb(255 255 255 / 6%); }

.resolution-switch button[aria-pressed="true"] { color: #080808; background: var(--accent); }

.resolution-switch button:focus-visible,
.timeline-actions button:focus-visible,
.timeline-viewport:focus-visible { outline: 2px solid var(--signal); outline-offset: -2px; }

.resolution-switch kbd {
  color: var(--quiet);
  font: 700 .48rem/1 var(--font-data);
}

.resolution-switch button[aria-pressed="true"] kbd { color: #555; }

.waveform-status {
  display: grid;
  height: 2.25rem;
  min-width: 0;
  padding: .28rem .65rem;
  align-content: center;
  gap: .2rem;
  border: 1px solid var(--line);
  background: var(--panel);
}

.waveform-status > span {
  color: var(--muted);
  font: 700 .5rem/1 var(--font-data);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.waveform-status > div {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: .45rem;
}

.waveform-status strong {
  color: var(--signal);
  font: 900 .83rem/1 var(--font-data);
}

.waveform-status b {
  overflow: hidden;
  font-size: .66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.waveform-status p {
  overflow: hidden;
  margin: 0;
  color: var(--text);
  font-size: .66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.timeline-result-bar { min-height: 2rem; }

.waveform-layout {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(24rem, 1.08fr) minmax(24rem, .92fr);
  gap: .7rem;
  align-items: stretch;
}

.eyebrow {
  display: block;
  color: var(--muted);
  font: 800 .54rem/1 var(--font-data);
  letter-spacing: .13em;
  text-transform: uppercase;
}

.waveform-panel {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
}

.waveform-panel__header {
  display: flex;
  min-height: 3.7rem;
  padding-left: 1rem;
  align-items: stretch;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.waveform-panel__header > div:first-child {
  display: grid;
  min-width: 8.5rem;
  align-content: center;
  gap: .3rem;
}

.waveform-panel__header h2 { margin: 0; font-size: .9rem; }

.timeline-actions {
  display: grid;
  grid-auto-flow: column;
  border-left: 1px solid var(--line);
}

.timeline-actions button { min-width: 2.55rem; }
.timeline-actions .timeline-action--edge { min-width: 5.6rem; }

.zoom-level {
  display: grid;
  min-width: 5.2rem;
  padding: 0 .55rem;
  place-items: center;
  color: var(--muted);
  border-right: 1px solid var(--line);
  font: 700 .55rem/1 var(--font-data);
  text-transform: uppercase;
}

.waveform-shell { position: relative; min-height: 0; overflow: hidden; }

.timeline-viewport {
  position: absolute;
  inset: 0;
  overflow-x: auto;
  overflow-y: hidden;
  cursor: crosshair;
  overscroll-behavior-inline: contain;
  scrollbar-width: none;
  touch-action: none;
}

.timeline-viewport::-webkit-scrollbar { display: none; }
.timeline-viewport.is-scaling { cursor: ns-resize; user-select: none; }

#timeline-svg {
  display: block;
  height: 100%;
  min-height: 16rem;
  opacity: 1;
  transition: opacity 180ms ease-out;
}

#timeline-svg.is-entering { opacity: .12; }

.wave-transition-layer {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  display: block;
  height: 100%;
  pointer-events: none;
  opacity: 1;
  transition: opacity 180ms ease-out;
}

.wave-transition-layer.is-leaving { opacity: 0; }
.wave-grid { stroke: #272727; stroke-width: 1; vector-effect: non-scaling-stroke; }
.wave-grid--major { stroke: #3b3b3b; }
.wave-axis-label { fill: #777; font: 700 10px var(--font-data); letter-spacing: .08em; }
.wave-baseline { stroke: #575757; stroke-width: 1; stroke-dasharray: 3 6; vector-effect: non-scaling-stroke; }
.wave-samples { fill: none; stroke: #6f6f6f; stroke-width: 1; vector-effect: non-scaling-stroke; }
.wave-area { fill: url("#wave-fill"); }
.wave-reflection { fill: none; stroke: #777; stroke-width: 1; opacity: .38; vector-effect: non-scaling-stroke; }
.wave-line { fill: none; stroke: var(--signal); stroke-width: 1.7; vector-effect: non-scaling-stroke; }
.wave-point { fill: var(--panel); stroke: var(--signal); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.wave-point--pinned { fill: var(--accent); stroke: var(--accent); }
.wave-point--preview { stroke: #888; }
.wave-selection { stroke-width: 1; vector-effect: non-scaling-stroke; }
.wave-selection--pinned { fill: rgb(255 255 255 / 7%); stroke: #e2e2e2; }
.wave-selection--preview { fill: rgb(255 255 255 / 2%); stroke: #777; stroke-dasharray: 3 3; }
.wave-peak-line { stroke: #686868; stroke-width: 1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.wave-peak-label { fill: #aaa; font: 700 9px var(--font-data); letter-spacing: .04em; }
.wave-hit { fill: transparent; pointer-events: all; }

.timeline-tooltip {
  position: absolute;
  z-index: 4;
  top: .8rem;
  display: grid;
  min-width: 10rem;
  padding: .55rem .65rem;
  gap: .22rem;
  pointer-events: none;
  color: var(--text);
  border: 1px solid #777;
  background: rgb(8 8 8 / 94%);
  box-shadow: 7px 7px 0 rgb(0 0 0 / 28%);
  transform: translateX(-50%);
}

.timeline-tooltip strong { font: 800 .7rem/1.2 var(--font-data); }
.timeline-tooltip span { color: var(--muted); font-size: .62rem; }

.timeline-overview {
  position: relative;
  height: .72rem;
  cursor: ew-resize;
  border-top: 1px solid var(--line);
  background: repeating-linear-gradient(90deg, #242424 0 1px, transparent 1px 4px), #111;
}

.timeline-overview span {
  position: absolute;
  inset-block: 0;
  left: 0;
  min-width: 1rem;
  border-inline: 1px solid #f0f0f0;
  background: rgb(255 255 255 / 18%);
  cursor: grab;
  pointer-events: auto;
}

.timeline-overview.is-dragging span { cursor: grabbing; background: rgb(255 255 255 / 28%); }

.period-detail {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
}

.period-detail > * { min-width: 0; padding: 1rem; }
.period-detail > * + * { border-top: 1px solid var(--line); }
.period-detail[data-mode="pinned"] { box-shadow: inset 3px 0 var(--accent); }
.period-detail__mode { display: flex; min-height: 1.25rem; align-items: center; justify-content: space-between; gap: 1rem; }
.period-detail__mode button {
  padding: .2rem .4rem;
  color: var(--muted);
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font: 800 .52rem/1 var(--font-data);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.period-detail__mode button:hover { color: #080808; background: var(--accent); }
.period-detail__mode button:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.period-detail__heading h2 { margin: .45rem 0 .3rem; font-size: 1.15rem; }
.period-detail__heading p { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.45; }
.period-detail__heading a { display: inline-block; margin-top: .65rem; color: var(--text); font: 700 .6rem/1 var(--font-data); text-underline-offset: .18rem; }

.platform-mix { display: grid; align-content: center; gap: .4rem; }
.platform-row { display: grid; grid-template-columns: 6.5rem 1fr 2.2rem; align-items: center; gap: .5rem; }
.platform-row span,
.platform-row strong { font: 700 .55rem/1 var(--font-data); }
.platform-row span { overflow: hidden; color: var(--muted); text-overflow: ellipsis; text-transform: uppercase; }
.platform-row strong { text-align: right; }
.platform-meter { height: 3px; background: #2c2c2c; }
.platform-meter i { display: block; height: 100%; background: var(--accent); }

.period-items {
  margin: 0;
  padding: .75rem 1rem .75rem 2.8rem;
  overflow-y: auto;
  scrollbar-color: var(--accent) #0b0b0b;
  scrollbar-width: thin;
  list-style: decimal-leading-zero;
}

.period-items li { min-width: 0; padding: .35rem 0; color: var(--quiet); font: 700 .52rem/1.2 var(--font-data); }
.period-items a { display: block; overflow: hidden; color: var(--muted); font: 600 .68rem/1.3 var(--font-ui); text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.period-items a:hover { color: var(--text); text-decoration: underline; text-underline-offset: .15rem; }

.timeline-error {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  padding: 2rem;
  place-items: center;
  color: var(--text);
  background: var(--bg);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1100px) {
  .waveform-controls__inner { grid-template-columns: repeat(3, 1fr); }
  .waveform-status--context { display: none; }
  .waveform-layout { grid-template-columns: minmax(20rem, 1fr) minmax(20rem, .9fr); }
  .waveform-panel__header > div:first-child { display: none; }
  .timeline-actions { width: 100%; border-left: 0; }
  .timeline-actions button { width: 100%; }
}

@media (max-width: 700px) {
  .waveform-controls__inner { grid-template-columns: 1fr; }
  .waveform-status--context { display: grid; }
  .timeline-main { display: block; overflow: visible; }
  .timeline-result-bar { padding-inline: 0; }
  .waveform-layout { display: flex; flex-direction: column; }
  .waveform-panel { height: 62vh; min-height: 30rem; }
  .waveform-panel__header { display: grid; min-height: auto; padding-left: 0; }
  .waveform-panel__header > div:first-child { display: grid; min-height: 3.7rem; padding: 0 1rem; }
  .timeline-actions { grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
  .timeline-action--edge { display: none !important; }
  .zoom-level { display: none; }
  .timeline-actions button { min-height: 2.7rem; padding: 0 .45rem; }
  .period-detail { min-height: 24rem; }
}
