/* MIDI-RAE-JEPA supplemental site — single stylesheet */
:root {
  --ink: #1a1a24;
  --muted: #5a5a6e;
  --paper: #ffffff;
  --wash: #f6f6fa;
  --accent: #7b2f8f;      /* plasma mid-purple */
  --accent2: #e8a419;     /* plasma yellow-orange */
  --rule: #e3e3ec;
  --mono: "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}
/* dark mode: swap background/foreground only — header, table-cell shading, and
   figure images keep their own colors */
html[data-theme="dark"] {
  --ink: #e9e7f5;
  --muted: #a49fc4;
  --paper: #12102b;      /* deep plasma-adjacent indigo */
  --wash: #1c1940;
  --rule: #2c2857;
  --accent: #c77bdd;     /* lightened so links stay readable on dark */
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

/* ---- left-rail table of contents ---- */
.toc {
  position: fixed; top: 0; left: 0; bottom: 0; width: 215px; z-index: 50;
  padding: 1.4rem 1rem 2rem 1.4rem; overflow-y: auto;
  background: var(--paper); border-right: 1px solid var(--rule);
  font-size: .92rem;
}
.toc .toc-title {
  font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  font-size: .78rem; color: var(--muted); margin-bottom: .8rem;
  display: flex; align-items: center; justify-content: space-between;
}
.toc a {
  display: block; color: var(--muted); text-decoration: none;
  padding: .28rem .5rem; border-radius: 6px; border-left: 3px solid transparent;
}
.toc a.sub { padding-left: 1.3rem; font-size: .86rem; }
.toc a:hover { color: var(--accent); background: var(--wash); }
.toc a.active {
  color: var(--accent); font-weight: 600;
  border-left-color: var(--accent); background: var(--wash);
}
header, main, footer { margin-left: 215px; }
@media (max-width: 900px) {
  .toc {
    position: sticky; width: auto; bottom: auto; right: 0;
    display: flex; gap: .2rem; flex-wrap: wrap; justify-content: center;
    padding: .5rem .6rem; border-right: none; border-bottom: 1px solid var(--rule);
    background: color-mix(in srgb, var(--paper) 94%, transparent);
    backdrop-filter: blur(6px);
  }
  .toc .toc-title, .toc a.sub { display: none; }
  .toc a { border-left: none; }
  header, main, footer { margin-left: 0; }
}

/* ---- hero: deep plasma-gradient banner with full-spectrum accent strip ---- */
header {
  text-align: center;
  padding: 3.8rem 1rem 2.4rem;
  color: #fff;
  background:
    radial-gradient(1100px 420px at 50% -80px, rgba(240,249,33,.14), transparent 60%),
    linear-gradient(135deg, #0d0887 0%, #46039f 30%, #7201a8 55%, #9c179e 75%, #bd3786 100%);
  border-bottom: 6px solid transparent;
  border-image: linear-gradient(90deg, #0d0887, #7e03a8, #cc4778, #f89441, #f0f921) 1;
}
header h1 {
  font-size: 2.3rem; margin: 0 0 .4rem; letter-spacing: -.01em;
  text-shadow: 0 2px 14px rgba(0,0,0,.35);
}
header .subtitle { color: #e8d9f3; font-size: 1.15rem; margin: 0 0 1.2rem; }
.authors { font-size: 1.05rem; margin: .2rem 0; }
header .authors a { color: #ffd166; text-decoration: none; border-bottom: 1px solid rgba(255,209,102,.5); }
header .authors a:hover { color: #f0f921; }
.affil { color: #cdb6e0; font-size: .95rem; margin: 0 0 1.4rem; }
.badges { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.badges a {
  display: inline-block; padding: .45rem 1.1rem; border-radius: 999px;
  background: rgba(255,255,255,.14); color: #fff; text-decoration: none;
  font-size: .9rem; border: 1px solid rgba(255,255,255,.35);
  transition: background .15s, border-color .15s;
}
.badges a:hover { background: rgba(240,249,33,.25); border-color: #f0f921; }
.badges a.soon { opacity: .45; pointer-events: none; }

/* ---- sections ---- */
/* margin-left must clear the fixed 215px toc rail (margin: 0 auto alone re-centers
   in the full viewport and slides content under it); max() restores centering on
   wide screens */
main { max-width: 1080px; margin: 0 auto; padding: 0 1.2rem 4rem;
       margin-left: max(230px, calc(50% - 540px)); }
@media (max-width: 900px) { main { margin-left: auto; } }
section { padding-top: 2.8rem; }
h2 {
  font-size: 1.5rem; margin: 0 0 1rem;
  border-bottom: 2px solid var(--accent); display: inline-block; padding-bottom: .15rem;
}
h3 { font-size: 1.13rem; margin: 1.6rem 0 .5rem; }
p.note, .placeholder-note { color: var(--muted); font-size: .92rem; }
.callout {
  background: var(--wash); border-left: 4px solid var(--accent);
  padding: .8rem 1rem; border-radius: 0 8px 8px 0; margin: 1rem 0;
}

/* ---- tables (pandas Styler output drops in here) ---- */
.tablewrap { overflow-x: auto; margin: 1rem 0 2rem; }
.tablewrap table {
  border-collapse: collapse; font-size: .88rem; margin: 0 auto;
  font-variant-numeric: tabular-nums;
}
.tablewrap th, .tablewrap td {
  padding: .32rem .6rem; border: 1px solid #fff; text-align: center;
}
.tablewrap thead th, .tablewrap th.row_heading {
  background: var(--wash); color: var(--ink); font-weight: 600;
}
.tablewrap caption { caption-side: top; font-weight: 600; padding-bottom: .4rem; }
table.timing th { background: var(--wash); }
table.timing td { min-width: 7.5rem; }
table.timing .colsub { font-weight: 400; font-size: .8rem; color: var(--muted); }
table.timing .rel { font-size: .78rem; opacity: .85; }
table.legend { font-size: .9rem; }
table.legend td { text-align: left; border: none; border-bottom: 1px solid var(--rule); padding: .45rem .7rem; }
table.legend td:first-child { font-weight: 600; white-space: nowrap; }
table.legend td:nth-child(2) { font-family: var(--mono); font-size: .82rem; white-space: nowrap; }

/* ---- figures ---- */
.figrow { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
figure { margin: 1rem 0; text-align: center; flex: 1 1 460px; max-width: 640px; }
figure img { max-width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 8px; }
figcaption { color: var(--muted); font-size: .88rem; margin-top: .4rem; }

/* ---- midi players ---- */
.player-card {
  background: var(--wash); border: 1px solid var(--rule); border-radius: 10px;
  padding: 1rem 1.2rem; margin: 1rem 0;
}
.player-card h4 { margin: 0 0 .5rem; }
midi-player { width: 100%; display: block; margin: .5rem 0 .6rem; }

/* tabbed players: folder-style tabs attached to the player, after
   PicturesOfMIDI's anchor-container (top-rounded, selected = solid fill) */
.tabbar {
  display: flex; flex-wrap: wrap;
  margin: .4rem 0 .8rem; border-bottom: 1px solid var(--rule);
}
.tabbar .tab {
  font: inherit; font-size: .92rem; cursor: pointer;
  padding: .55rem 1.15rem; margin-bottom: -1px;
  border: 1px solid var(--rule); border-bottom: none;
  border-radius: 10px 10px 0 0;
  background: var(--paper); color: var(--accent);
}
.tabbar .tab.active,
.tabbar .tab:hover { background: var(--accent); color: #fff; }

/* dark/light toggle, pinned top-right */
.themebtn {
  position: fixed; top: 14px; right: 16px; z-index: 90;
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 1px solid var(--rule); background: var(--wash); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
.themebtn:hover { border-color: var(--accent); color: var(--accent); }
.themebtn svg { width: 20px; height: 20px; }
html[data-theme="dark"] .themebtn .icon-moon { display: none; }
html:not([data-theme="dark"]) .themebtn .icon-sun { display: none; }

/* plasma-themed transport bar */
midi-player::part(control-panel) {
  background: linear-gradient(90deg, #1b0b6b, #46039f 60%, #7201a8);
  border: none; border-radius: 8px;
}
midi-player::part(play-button) {
  color: #0d0887; background: #f0f921; border-radius: 50%;
}
midi-player::part(time) { color: #f4e9ff; font-family: var(--mono); }

/* piano roll: purple notes on white, orange while sounding */
midi-visualizer {
  display: block; overflow-x: auto;
  background: #fff; border-radius: 8px; border: 1px solid var(--rule);
}
midi-visualizer .piano-roll-visualizer { background: #fff; }
midi-visualizer svg rect.note {
  fill: #7201a8; stroke: #46039f; stroke-width: .5; opacity: .95;
}
midi-visualizer svg rect.note.active {
  fill: #f89441; stroke: #cc4778; opacity: 1;
}

/* ---- footer ---- */
footer {
  border-top: 1px solid var(--rule); margin-top: 3rem; padding: 1.5rem 1rem 2.5rem;
  text-align: center; color: var(--muted); font-size: .9rem;
}
pre.bibtex {
  text-align: left; max-width: 720px; margin: 1rem auto; padding: 1rem;
  background: var(--wash); border-radius: 8px; font-family: var(--mono);
  font-size: .8rem; overflow-x: auto;
}
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  header h1 { font-size: 1.5rem; }
}
