/* Syn-Son · History of Sonification in Synergetics */

:root {
  color-scheme: dark;
  --bg: #0d100f;
  --panel: #151a18;
  --panel-2: #1b211e;
  --panel-3: #222925;
  --text: #ebe1c5;
  --muted: #a9afa5;
  --faint: #717b73;
  --line: #39423d;
  --line-strong: #59645d;
  --brass: #d5bd83;
  --brass-soft: rgba(213, 189, 131, 0.12);
  --copper: #c69b62;
  --green: #9fbca6;
  --moss: #bcc68e;
  --rust: #b77d52;
  --amber: #d78a57;
  --danger: #cb806c;
  --good: #a8c8a9;
  --radius: 15px;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.24);
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% -10%, rgba(159, 188, 166, 0.1), transparent 33rem),
    radial-gradient(circle at 88% 8%, rgba(198, 155, 98, 0.09), transparent 31rem),
    linear-gradient(180deg, #121614, var(--bg) 42rem);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
}

a {
  color: var(--brass);
  text-underline-offset: 0.17em;
}

a:hover {
  color: #ead29b;
}

button,
select,
input {
  font: inherit;
}

button,
select,
input[type="number"] {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
}

button {
  padding: 0.62rem 0.82rem;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    transform 100ms ease;
}

button:hover {
  border-color: var(--brass);
  background: var(--panel-3);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

button[aria-pressed="true"],
button.active {
  border-color: var(--brass);
  background: var(--brass-soft);
}

button.primary {
  border-color: var(--brass);
  background: linear-gradient(135deg, #8f6f40, #b78d54);
  color: #11140f;
  font-weight: 800;
}

button.render {
  border-color: var(--green);
  color: #d8eadb;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.skip-link {
  position: fixed;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 100;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar,
main,
footer {
  width: min(1540px, calc(100% - 2rem));
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem 0 1rem;
}

.identity {
  max-width: 1020px;
}

.eyebrow {
  margin: 0 0 0.38rem;
  color: var(--brass);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 1000px;
  margin-bottom: 0.4rem;
  font-size: clamp(2rem, 5.1vw, 5.2rem);
  line-height: 0.94;
  letter-spacing: -0.055em;
}

h1 span {
  color: var(--brass);
}

h2 {
  margin-bottom: 0.55rem;
  font-size: clamp(1.25rem, 2.4vw, 2.15rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

h3 {
  margin-bottom: 0.42rem;
  color: var(--brass);
  font-size: 0.82rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.lede {
  max-width: 82ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(0.94rem, 1.4vw, 1.1rem);
}

.version-badge,
.status-pill,
.stage-badges span,
.source-status {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(21, 26, 24, 0.88);
}

.version-badge {
  padding: 0.34rem 0.62rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.top-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.top-actions {
  justify-content: flex-end;
  min-width: min(460px, 100%);
}

.boundary-banner {
  margin-bottom: 0.72rem;
  padding: 1rem 1.1rem;
  border: 1px solid rgba(213, 189, 131, 0.35);
  border-left: 4px solid var(--brass);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--brass-soft);
  color: #d7d2bf;
}

.boundary-banner strong {
  color: var(--text);
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.5rem;
}

.status-pill {
  padding: 0.28rem 0.56rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.status-pill[data-state="good"] {
  border-color: rgba(168, 200, 169, 0.45);
  color: var(--good);
}

.status-pill[data-state="warning"] {
  border-color: rgba(203, 128, 108, 0.5);
  color: #e0a695;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(21, 26, 24, 0.92);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
}

.section-heading > p {
  max-width: 64ch;
  margin-bottom: 0.55rem;
  color: var(--muted);
}

.timeline-section {
  margin: 1rem 0 1.4rem;
}

.timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, minmax(135px, 1fr));
  gap: 0.48rem;
  margin-top: 0.75rem;
  padding-top: 1rem;
}

.timeline::before {
  position: absolute;
  top: 0.35rem;
  right: 2%;
  left: 2%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong) 4%, var(--line-strong) 96%, transparent);
  content: "";
}

.timeline-button {
  position: relative;
  min-height: 105px;
  padding: 0.7rem;
  text-align: left;
}

.timeline-button::before {
  position: absolute;
  top: -1.1rem;
  left: 50%;
  width: 0.58rem;
  height: 0.58rem;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--bg);
  content: "";
  transform: translateX(-50%);
}

.timeline-button.active {
  border-color: var(--brass);
  background: var(--brass-soft);
}

.timeline-button.active::before {
  border-color: var(--brass);
  background: var(--brass);
  box-shadow: 0 0 0 5px rgba(213, 189, 131, 0.1);
}

.timeline-year,
.timeline-title {
  display: block;
}

.timeline-year {
  margin-bottom: 0.32rem;
  color: var(--brass);
  font-family: var(--mono);
  font-size: 0.67rem;
  letter-spacing: 0.04em;
}

.timeline-title {
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 720;
  line-height: 1.25;
}

.guided-panel {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border-color: rgba(213, 189, 131, 0.52);
}

.guided-panel[hidden] {
  display: none;
}

.guided-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.guided-grid > div {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 10, 9, 0.36);
}

.guided-grid strong {
  color: var(--brass);
  font-size: 0.84rem;
}

.guided-grid p {
  margin: 0.34rem 0 0;
  color: #ccd1c8;
  font-size: 0.88rem;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.78fr) minmax(330px, 0.66fr);
  gap: 1rem;
  align-items: start;
}

.instrument {
  min-width: 0;
  padding: 0.8rem;
}

.stage-wrap {
  position: relative;
  min-height: 500px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b0e0c;
}

#stage {
  display: block;
  width: 100%;
  min-height: 500px;
  aspect-ratio: 16 / 9.5;
  touch-action: none;
}

.stage-badges {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-width: calc(100% - 1.4rem);
  pointer-events: none;
}

.stage-badges span {
  padding: 0.29rem 0.55rem;
  color: #d8d2bd;
  font-family: var(--mono);
  font-size: 0.65rem;
  backdrop-filter: blur(8px);
}

.stage-help {
  position: absolute;
  right: 0.7rem;
  bottom: 0.65rem;
  padding: 0.3rem 0.48rem;
  border-radius: 7px;
  background: rgba(8, 10, 9, 0.72);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.62rem;
  pointer-events: none;
}

.wave-wrap {
  position: relative;
  height: 110px;
  margin-top: 0.62rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0b0e0c;
}

#wave {
  display: block;
  width: 100%;
  height: 100%;
}

.wave-labels {
  position: absolute;
  top: 0.48rem;
  right: 0.55rem;
  left: 0.55rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.6rem;
  pointer-events: none;
}

.transport-status,
.render-status {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.transport-status {
  min-height: 2.4rem;
  margin-top: 0.62rem;
  padding: 0.58rem 0.7rem;
  border: 1px solid rgba(213, 189, 131, 0.22);
  border-radius: 8px;
  background: rgba(213, 189, 131, 0.06);
}

.transport {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.62rem;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(112px, 1fr));
  gap: 0.7rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.control-grid label {
  display: grid;
  align-content: start;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.control-grid label > span:first-child {
  min-height: 1.15rem;
}

output {
  color: var(--brass);
  font-family: var(--mono);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--brass);
}

input[type="number"],
select {
  width: 100%;
  min-height: 2.25rem;
  padding: 0.38rem 0.48rem;
}

.checkbox-label {
  grid-template-columns: auto 1fr !important;
  align-items: center;
  align-content: center !important;
  gap: 0.5rem !important;
  padding-top: 1rem;
}

.checkbox-label input {
  accent-color: var(--brass);
}

.render-status {
  margin-top: 0.7rem;
}

.render-status[data-state="busy"] {
  color: var(--brass);
}

.render-status[data-state="done"] {
  color: var(--good);
}

.render-status[data-state="error"] {
  color: #e0a695;
}

.history-panel {
  position: sticky;
  top: 0.8rem;
  max-height: calc(100vh - 1.6rem);
  overflow: auto;
  padding: 1rem;
}

.history-panel h2 {
  font-size: clamp(1.45rem, 2.5vw, 2.35rem);
}

.history-subtitle {
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.history-panel section {
  margin-top: 1rem;
}

.history-panel section p {
  margin-bottom: 0;
  color: #c8cec5;
  font-size: 0.9rem;
}

.boundary-card {
  padding: 0.75rem;
  border-left: 3px solid var(--brass);
  border-radius: 0 9px 9px 0;
  background: var(--brass-soft);
}

.formula {
  margin-top: 1rem;
  padding: 0.72rem;
  border: 1px solid rgba(213, 189, 131, 0.32);
  border-radius: 9px;
  background: rgba(9, 11, 10, 0.4);
  color: var(--brass);
  font-family: var(--mono);
  font-size: 0.82rem;
}

.source-drawer {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
}

.source-drawer summary {
  color: var(--brass);
  cursor: pointer;
  font-weight: 760;
}

.source-item {
  margin-top: 0.68rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(8, 10, 9, 0.35);
}

.source-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.6rem;
}

.source-head a {
  font-size: 0.84rem;
  font-weight: 720;
}

.source-status {
  flex: 0 0 auto;
  padding: 0.18rem 0.42rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.57rem;
  text-transform: uppercase;
}

.source-status[data-kind="primary"] {
  color: var(--good);
}

.source-status[data-kind="institutional"] {
  color: var(--brass);
}

.source-status[data-kind="legacy"] {
  color: #b7c9a0;
}

.source-status[data-kind="contemporary"] {
  color: #d9a877;
}

.source-status[data-kind="derived"] {
  color: #d99583;
}

.source-item p {
  margin: 0.42rem 0 0;
  color: var(--muted);
  font-size: 0.77rem;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.45rem;
  font-family: var(--mono);
  font-size: 0.65rem;
}

.score-section,
.mapping-section {
  margin-top: 2rem;
}

.table-wrap {
  margin-top: 0.72rem;
  overflow-x: auto;
  box-shadow: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

th,
td {
  padding: 0.58rem 0.68rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td {
  color: #ccd1c8;
}

td.mono {
  color: var(--brass);
  font-family: var(--mono);
  white-space: nowrap;
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.7rem;
  margin-top: 0.72rem;
}

.mapping-card {
  min-height: 190px;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(21, 26, 24, 0.88);
}

.mapping-card .mapping-arrow {
  display: block;
  margin: 0.25rem 0;
  color: var(--brass);
  font-size: 1.4rem;
}

.mapping-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  letter-spacing: 0;
  text-transform: none;
}

.mapping-card .audio-target {
  color: var(--green);
}

.mapping-card p {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.69rem;
}

.mapping-card .derived-tag {
  display: inline-flex;
  margin-top: 0.7rem;
  padding: 0.17rem 0.42rem;
  border: 1px solid rgba(203, 128, 108, 0.42);
  border-radius: 999px;
  color: #d99a88;
  font-family: var(--mono);
  font-size: 0.58rem;
  text-transform: uppercase;
}

.archive-note {
  margin-top: 2rem;
  padding: 1rem;
  box-shadow: none;
}

.archive-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.archive-columns p {
  margin-bottom: 0;
  color: var(--muted);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 2rem;
  padding: 1.3rem 0 2.3rem;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.78rem;
}

footer p {
  max-width: 78ch;
  margin-bottom: 0;
}

.toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  z-index: 80;
  max-width: min(680px, calc(100% - 2rem));
  padding: 0.68rem 0.95rem;
  border: 1px solid var(--brass);
  border-radius: 999px;
  background: #202622;
  color: var(--text);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

body.presenter {
  overflow: hidden;
  background: #080a09;
}

body.presenter .topbar,
body.presenter .boundary-banner,
body.presenter .status-strip,
body.presenter .timeline-section,
body.presenter .guided-panel,
body.presenter .history-panel,
body.presenter .score-section,
body.presenter .mapping-section,
body.presenter .archive-note,
body.presenter footer {
  display: none;
}

body.presenter main {
  width: 100%;
}

body.presenter .workbench {
  display: block;
}

body.presenter .instrument {
  height: 100vh;
  padding: 0;
  border: 0;
  border-radius: 0;
}

body.presenter .stage-wrap,
body.presenter #stage {
  min-height: calc(100vh - 110px);
  border: 0;
  border-radius: 0;
}

body.presenter .wave-wrap {
  height: 110px;
  margin: 0;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
}

body.presenter .transport-status,
body.presenter .transport,
body.presenter .control-grid,
body.presenter .render-status {
  display: none;
}

@media (max-width: 1260px) {
  .timeline {
    grid-template-columns: repeat(4, 1fr);
    row-gap: 1.5rem;
  }

  .timeline::before,
  .timeline-button::before {
    display: none;
  }

  .control-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .mapping-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1060px) {
  .topbar {
    align-items: start;
  }

  .workbench {
    grid-template-columns: 1fr;
  }

  .history-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .topbar,
  .section-heading,
  footer {
    display: block;
  }

  .top-actions {
    justify-content: flex-start;
    margin-top: 1rem;
  }

  .timeline {
    grid-template-columns: repeat(2, 1fr);
  }

  .guided-grid,
  .archive-columns {
    grid-template-columns: 1fr;
  }

  .control-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stage-wrap,
  #stage {
    min-height: 390px;
  }

  .stage-help {
    display: none;
  }
}

@media (max-width: 520px) {
  .topbar,
  main,
  footer {
    width: min(100% - 1rem, 1540px);
  }

  h1 {
    font-size: 2.35rem;
  }

  .timeline,
  .mapping-grid,
  .control-grid {
    grid-template-columns: 1fr;
  }

  .transport button {
    flex: 1 1 44%;
  }

  .stage-wrap,
  #stage {
    min-height: 320px;
  }

  .source-head {
    display: block;
  }

  .source-status {
    margin-top: 0.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  body {
    background: white;
    color: black;
  }

  .top-actions,
  .transport,
  .control-grid,
  .status-strip,
  .stage-help,
  .toast {
    display: none !important;
  }
}
