/* Purpose: Style the fixed-coordinate BeatGain pipeline and its responsive container. */
:root {
  --ink: #142d40;
  --muted: #617487;
  --line: #cfd9e1;
  --paper: #ffffff;
  --page: #edf3f6;
  --blue: #1f6286;
  --blue-soft: #e7f2f7;
  --orange: #c86f11;
  --orange-soft: #fff0db;
  --teal: #087f7a;
  --teal-soft: #dff3f0;
  --purple: #6651a8;
  --purple-soft: #eeeafb;
  --shadow: 0 18px 48px rgba(20, 45, 64, .1);
  --brand-duration: 9s;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(circle at 85% 0%, rgba(31, 98, 134, .11), transparent 30rem), var(--page);
  font-family: Inter, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button { font: inherit; }

.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  border-bottom: 1px solid rgba(185, 204, 215, .9);
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 28px rgba(20, 45, 64, .09);
  backdrop-filter: blur(14px);
}

.site-header-inner {
  display: flex;
  width: min(100% - 32px, 1560px);
  min-height: 74px;
  gap: 20px;
  margin: 0 auto;
  align-items: center;
}

.animated-brand {
  display: block;
  flex: 0 0 220px;
  height: 68px;
  color: var(--ink);
}

.animated-brand svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-wordmark { color: var(--ink); }

.brand-letters {
  fill: currentColor;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
  font-size: 92px;
  font-weight: 700;
  letter-spacing: -.04em;
  transform-box: fill-box;
  transform-origin: center;
  animation: brand-erase-letters var(--brand-duration) ease-in-out 1 forwards;
}

.brand-symbol {
  transform-box: fill-box;
  transform-origin: center;
}

.brand-symbol-b {
  animation: brand-assemble-b var(--brand-duration) cubic-bezier(.6, 0, .2, 1) 1 forwards;
}

.brand-symbol-g {
  animation: brand-assemble-g var(--brand-duration) cubic-bezier(.6, 0, .2, 1) 1 forwards;
}

@keyframes brand-erase-letters {
  0%, 40% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes brand-assemble-b {
  0%, 51% { transform: translateX(0); }
  67%, 100% { transform: translateX(100px); }
}

@keyframes brand-assemble-g {
  0%, 51% { transform: translateX(0); }
  67%, 100% { transform: translateX(-85px); }
}

.site-navigation {
  display: flex;
  flex: 1;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  overflow-x: auto;
  scrollbar-width: none;
}

.site-navigation::-webkit-scrollbar { display: none; }

.site-navigation a {
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 800;
  letter-spacing: .035em;
  text-decoration: none;
  white-space: nowrap;
  transition: color .18s ease, background-color .18s ease;
}

.site-navigation a:hover,
.site-navigation a:focus-visible {
  color: var(--teal);
  background: var(--teal-soft);
  outline: none;
}

.page-shell {
  width: min(100% - 32px, 1560px);
  margin: 0 auto;
}

.page-intro {
  max-width: 980px;
  margin: 0 auto;
  padding: 58px 18px 34px;
  text-align: center;
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}

h1, h2, h3 { margin: 0; color: var(--ink); }

h1, h2 {
  font-family: Georgia, "Times New Roman", serif;
}

h1 {
  font-size: clamp(2.35rem, 5.2vw, 4.6rem);
  line-height: 1.03;
}

h2 { font-size: clamp(1.55rem, 3.2vw, 2.5rem); }
h3 { font-size: 1.05rem; }

.page-intro > p:last-child {
  max-width: 760px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.navigation-target { scroll-margin-top: 88px; }

.future-section {
  min-height: 190px;
  margin-top: 28px;
  padding: 34px 36px;
  border: 1px dashed #aebfca;
  border-radius: 18px;
  background: rgba(255, 255, 255, .68);
}

.future-section > p:last-child {
  max-width: 700px;
  margin: 12px 0 0;
  color: var(--muted);
}

.pipeline-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.pipeline-heading {
  display: flex;
  gap: 24px;
  padding: 26px 32px 20px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.interaction-hint {
  margin: 0;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
}

.diagram-viewport {
  position: relative;
  height: 820px;
  overflow: hidden;
  background:
    linear-gradient(rgba(31, 98, 134, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 98, 134, .035) 1px, transparent 1px),
    #fcfeff;
  background-size: 32px 32px;
}

.diagram-canvas {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1600px;
  height: 820px;
  transform: translateX(-50%) scale(var(--diagram-scale, 1));
  transform-origin: top center;
}

.connector-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.connector-layer path {
  fill: none;
  stroke: #506779;
  stroke-width: 2.5;
  marker-end: url(#arrow);
  pointer-events: stroke;
}

.connector-layer .junction {
  fill: #506779;
  stroke: none;
}

.connector-layer .gain-path { stroke: var(--orange); }
.connector-layer marker path { fill: #506779; }

.connector-layer path:hover,
.connector-layer path.is-highlighted {
  stroke: var(--teal);
  stroke-width: 4;
  outline: none;
}

.connector-layer .gain-path:hover,
.connector-layer .gain-path.is-highlighted { stroke: var(--orange); }

.diagram-block,
.multiplier,
.sum-node,
.signal-label {
  position: absolute;
  z-index: 2;
  border: 2px solid #46677e;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

.diagram-block,
.signal-label {
  display: grid;
  place-items: center;
  text-align: center;
}

.signal-label {
  display: flex;
  align-items: center;
  justify-content: center;
}

.diagram-block {
  min-height: 66px;
  padding: 8px 14px;
  border-radius: 5px;
  font-size: 17px;
  font-weight: 700;
}

.diagram-block span {
  color: var(--muted);
  font-size: .84em;
  font-weight: 700;
}

.spleeter {
  top: 60px;
  left: 220px;
  width: 1160px;
  min-height: 62px;
  border-color: var(--blue);
  background: var(--blue-soft);
}

.spleeter span {
  margin-left: .28em;
}

.beatthis {
  top: 185px;
  left: 30px;
  width: 170px;
  min-height: 72px;
  border-color: var(--purple);
  background: var(--purple-soft);
}

.interpolation {
  top: 420px;
  left: 30px;
  width: 170px;
  min-height: 72px;
  border-color: var(--purple);
  background: var(--purple-soft);
}

.gain-calculation {
  top: 735px;
  left: 220px;
  width: 1160px;
  min-height: 62px;
  border-color: var(--orange);
  background: var(--orange-soft);
}

.stem-column {
  position: absolute;
  top: 142px;
  width: 200px;
  height: 500px;
}

.vocals { left: 220px; }
.bass { left: 500px; }
.drums { left: 900px; }
.others { left: 1180px; }

.stem-label {
  top: 0;
  left: 8px;
  width: 86px;
  border: 0;
  background: transparent;
  font-family: Georgia, serif;
  font-size: 18px;
  justify-content: flex-end;
}

.stem-column .hpss {
  top: 43px;
  left: 25px;
  width: 150px;
  min-height: 66px;
  border-color: var(--teal);
  background: var(--teal-soft);
}

.component-pair {
  position: absolute;
  inset: 0;
}

.multiplier {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  place-items: center;
  background: #fff;
  font-family: Georgia, serif;
}

.multiplier span { font-size: 24px; line-height: 1; }
.multiplier small {
  position: absolute;
  color: var(--muted);
  font-family: "Cambria Math", Georgia, serif;
  font-size: 15px;
  font-style: italic;
  white-space: nowrap;
  background: rgba(252, 254, 255, .86);
}

.multiplier.beta { top: 176px; }
.multiplier.beta-h { left: 43px; }
.multiplier.beta-p { left: 113px; }
.multiplier.beta-h small { top: 9px; right: 49px; }
.multiplier.beta-p small { top: 9px; left: 49px; }

.multiplier.gain { border-color: var(--orange); background: var(--orange-soft); }
.multiplier.gain small { top: 25px; color: #9d5105; }

.vocals .gain-h { top: 401px; left: 128px; }
.vocals .gain-p { top: 341px; left: 188px; }
.bass .gain-h { top: 301px; left: 88px; }
.bass .gain-p { top: 261px; left: 158px; }
.drums .gain-h { top: 261px; left: -2px; }
.drums .gain-p { top: 301px; left: 68px; }
.others .gain-h { top: 341px; left: -32px; }
.others .gain-p { top: 401px; left: 28px; }

.vocals .gain small,
.bass .gain small { left: 50px; right: auto; }

.drums .gain small,
.others .gain small { right: 50px; left: auto; }

.component-note {
  position: absolute;
  top: 139px;
  font-family: Georgia, serif;
  font-family: "Cambria Math", Georgia, serif;
  font-size: 15px;
  font-style: italic;
}

.component-note.harmonic { left: 25px; }
.component-note.percussive { right: 20px; }

.sum-node {
  top: 464px;
  left: 764px;
  display: grid;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  place-items: center;
  border-color: var(--blue);
  background: var(--blue-soft);
  font-family: Georgia, serif;
  font-size: 39px;
}

.signal-label {
  border: 0;
  background: transparent;
  font-family: Georgia, serif;
  font-size: 23px;
}

.input-label { top: 42px; left: 12px; width: 90px; }
.output-label { top: 650px; left: 755px; width: 90px; }
.metrical-label { top: 735px; left: 100px; width: 135px; color: var(--orange); font-size: 18px; }

.diagram-block:hover,
.diagram-block:focus-visible,
.multiplier:hover,
.multiplier:focus-visible,
.sum-node:hover,
.sum-node:focus-visible,
.signal-label:hover,
.signal-label:focus-visible,
.diagram-block.is-selected,
.multiplier.is-selected,
.sum-node.is-selected,
.signal-label.is-selected {
  z-index: 3;
  outline: 4px solid rgba(8, 127, 122, .26);
  outline-offset: 4px;
  filter: saturate(1.15) brightness(.98);
}

.detail-panel {
  min-height: 164px;
  padding: 22px 32px 25px;
  border-top: 1px solid var(--line);
  background: #f8fbfc;
}

.detail-panel p { margin: 7px 0 0; color: var(--muted); }

.detail-panel dl {
  display: flex;
  gap: 16px;
  margin: 14px 0 0;
  flex-wrap: wrap;
}

.detail-panel dl div {
  padding: 5px 10px;
  border-radius: 5px;
  background: var(--paper);
  color: var(--muted);
  font-size: .76rem;
}

.detail-panel dt { display: inline; color: var(--ink); font-weight: 850; }
.detail-panel dd { display: inline; margin: 0 0 0 4px; }

.gain-figure-card {
  margin-top: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.gain-figure-heading {
  display: flex;
  gap: 26px;
  padding: 26px 32px 20px;
  align-items: stretch;
  flex-direction: column;
  border-bottom: 1px solid var(--line);
}

.gain-reference {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.gain-legend {
  display: flex;
  gap: 14px;
  align-items: center;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  flex-direction: column;
  text-align: center;
}

.legend-item {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.legend-item i {
  display: block;
  width: 30px;
  border-top: 3px solid var(--blue);
}

.legend-item.comparison i {
  border-color: var(--orange);
  border-top-style: dashed;
}

.gain-table-wrap {
  min-width: 520px;
  padding-left: 22px;
  border-left: 1px solid var(--line);
  text-align: center;
}

.gain-table-title {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.gain-table {
  margin: 0 auto;
  border-collapse: collapse;
  color: var(--muted);
  font: 13px "Cambria Math", Georgia, serif;
}

.gain-table th,
.gain-table td {
  min-width: 27px;
  height: 25px;
  padding: 0 4px;
  border: 1px solid #dbe5eb;
  text-align: center;
}

.gain-table th {
  padding: 0 9px;
  color: var(--ink);
  background: #f4f8fa;
  font-weight: 700;
}

.gain-table .gain-values td {
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 700;
}

.gain-table .metric-values th { border-left: 3px solid var(--blue); }

.gain-table .alternative-values th {
  border-left: 3px dashed var(--orange);
  color: #9d5105;
}

.gain-table .alternative-values td {
  color: #9d5105;
  background: var(--orange-soft);
  font-weight: 700;
}

.gain-table sub { font-size: .72em; }

.gain-figure {
  margin: 0;
  padding: 28px 32px 26px;
}

.gain-plot {
  width: min(100%, 1080px);
  margin: 0 auto;
}

.gain-plot svg {
  display: block;
  width: 100%;
  height: auto;
}

.gain-figure figcaption {
  max-width: 850px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: .92rem;
  text-align: center;
}

.gain-plot .plot-frame { fill: #fff; stroke: var(--line); }
.gain-plot .plot-grid { stroke: #dce5eb; stroke-width: 1; }
.gain-plot .plot-boundary { stroke: #8fa2b0; stroke-width: 1.4; }
.gain-plot .plot-label { fill: var(--ink); font: 18px Georgia, serif; }
.gain-plot .plot-tick { fill: var(--muted); font: 13px Inter, "Segoe UI", sans-serif; }
.gain-plot .plot-position { fill: var(--ink); font: 14px Georgia, serif; }
.gain-plot .plot-title { fill: var(--ink); font: 17px Georgia, serif; }
.gain-plot .standard-gain { fill: none; stroke: var(--blue); stroke-width: 3.5; }
.gain-plot .comparison-gain { fill: none; stroke: var(--orange); stroke-width: 3.5; stroke-dasharray: 9 7; }

.instrumental-figure-card {
  margin-top: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.instrumental-figure-heading {
  display: flex;
  gap: 24px;
  padding: 26px 32px 20px;
  align-items: end;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.instrumental-legend { display: flex; flex-wrap: wrap; gap: 16px 22px; justify-content: flex-end; }
.instrumental-legend .legend-item { color: var(--ink); }
.instrumental-legend i {
  display: inline;
  width: auto;
  border: 0;
}
.instrumental-legend .legend-swatch {
  display: block;
  width: 30px;
  border-top: 3px solid var(--blue);
}
.instrumental-legend .mixing .legend-swatch { border-top-style: dashed; }
.instrumental-legend .beatgain .legend-swatch { border-color: var(--orange); }

.instrumental-figure { margin: 0; padding: 28px 32px 26px; }
.instrumental-plot { width: min(100%, 1100px); margin: 0 auto; }
.instrumental-plot svg { display: block; width: 100%; height: auto; }
.instrumental-figure figcaption {
  max-width: 940px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: .9rem;
  text-align: center;
}

.instrumental-plot .instrumental-frame { fill: #fbfdfe; stroke: #d7e1e8; }
.instrumental-plot .instrumental-grid { stroke: #dce5eb; stroke-width: 1; }
.instrumental-plot .instrumental-boundary { stroke: #71808c; stroke-width: 1.4; }
.instrumental-plot .instrumental-mixing { fill: none; stroke: var(--blue); stroke-width: 3.4; stroke-dasharray: 9 7; }
.instrumental-plot .instrumental-beatgain { fill: none; stroke: var(--orange); stroke-width: 3.4; }
.instrumental-plot .instrumental-title { fill: var(--ink); font: 700 20px Georgia, serif; }
.instrumental-plot .instrumental-tick { fill: var(--muted); font: 13px Inter, "Segoe UI", sans-serif; }
.instrumental-plot .instrumental-label { fill: var(--ink); font: 14px Inter, "Segoe UI", sans-serif; }

.preference-figure-card {
  margin-top: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.preference-figure-heading {
  display: flex;
  gap: 24px;
  padding: 26px 32px 20px;
  align-items: end;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.preference-figure-heading > p {
  max-width: 440px;
  margin: 0;
  color: var(--muted);
  font-size: .88rem;
  text-align: right;
}

.preference-figure {
  position: relative;
  margin: 0;
  padding: 28px 32px 26px;
}

.preference-plot {
  width: min(100%, 1100px);
  margin: 0 auto;
}

.preference-plot svg {
  display: block;
  width: 100%;
  height: auto;
}

.preference-figure figcaption {
  max-width: 900px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: .9rem;
  text-align: center;
}

.preference-plot .preference-grid { stroke: #dce5eb; stroke-width: 1; }
.preference-plot .preference-reference { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 5 5; }
.preference-plot .preference-bar { fill: var(--blue); }
.preference-plot .preference-bar-beatgain { fill: var(--orange); }
.preference-plot .preference-label { fill: var(--ink); font: 15px Inter, "Segoe UI", sans-serif; }
.preference-plot .preference-value { fill: #fff; font: 14px Inter, "Segoe UI", sans-serif; font-weight: 800; }
.preference-plot .preference-star { fill: #9d5105; font: 19px Georgia, serif; font-weight: 700; }
.preference-plot .preference-title { fill: var(--ink); font: 700 20px Georgia, serif; }
.preference-plot .preference-axis { fill: var(--muted); font: 13px Inter, "Segoe UI", sans-serif; }

.preference-tooltip {
  position: fixed;
  z-index: 10;
  max-width: 260px;
  padding: 9px 11px;
  border: 1px solid #b8c9d5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(27, 58, 79, .16);
  color: var(--ink);
  font-size: .84rem;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.preference-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1500px) {
  .gain-figure-heading { align-items: flex-start; flex-direction: column; }
  .gain-reference { width: 100%; align-items: center; flex-direction: column; }
  .gain-table-wrap { width: auto; max-width: 100%; min-width: 0; padding: 12px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .gain-table th,
  .gain-table td { min-width: 0; }
  .instrumental-figure-heading { align-items: flex-start; flex-direction: column; }
  .instrumental-legend { justify-content: flex-start; }
}

@media (max-width: 760px) {
  .preference-figure-heading { padding: 20px 18px 16px; align-items: flex-start; flex-direction: column; }
  .preference-figure-heading > p { max-width: none; text-align: left; }
  .preference-figure { padding: 20px 12px 22px; }
  .preference-figure figcaption { padding: 0 8px; font-size: .84rem; }
  .preference-tooltip { max-width: 220px; font-size: .8rem; }
  .instrumental-figure-heading { padding: 20px 18px 16px; }
  .instrumental-figure { padding: 20px 12px 22px; }
  .instrumental-figure figcaption { padding: 0 8px; font-size: .84rem; }
}

footer {
  padding: 26px 6px 42px;
  color: var(--muted);
  font-size: .8rem;
  text-align: center;
}

@media (max-width: 760px) {
  html { scroll-padding-top: 68px; }
  .site-header-inner { width: min(100% - 18px, 1560px); min-height: 64px; gap: 8px; }
  .animated-brand { flex-basis: 142px; height: 60px; }
  .site-navigation { justify-content: flex-start; }
  .site-navigation a { padding: 6px 8px; font-size: .78rem; }
  .navigation-target { scroll-margin-top: 68px; }
  .page-shell { width: min(100% - 18px, 1560px); }
  .page-intro { padding: 36px 10px 24px; }
  .pipeline-heading { padding: 20px 18px 16px; align-items: flex-start; flex-direction: column; }
  .interaction-hint { white-space: normal; }
  .detail-panel { padding: 20px 18px 22px; }
  .gain-figure-heading { padding: 20px 18px 16px; align-items: flex-start; flex-direction: column; }
  .gain-figure { padding: 20px 12px 22px; }
  .gain-legend { gap: 10px; }
  .gain-table { font-size: 11px; }
  .gain-table th,
  .gain-table td { min-width: 0; padding: 0 2px; }
  .gain-figure figcaption { padding: 0 8px; font-size: .85rem; }
  .future-section { min-height: 160px; padding: 26px 20px; }
}
