/* Layout: a quiet gallery wall. Text on the left, one framed instrument (a live mel spectrogram) on the right;
   work, a piano-roll course map and music below. Ultramarine and gold are borrowed from Renaissance pigments. */
:root {
  --paper: #f2f3f0;
  --surface: #fbfbf9;
  --ink: #151b2c;
  --muted: #596176;
  --rule: #d6d9df;
  --ultramarine: #2343b0;
  --gold: #b98318;
  --spec-floor: #f2f3f0;
  --spec-mid: #9fb1ea;
  --lane: #e9ebe8;
  --display: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  --body: "Public Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0c1120; --surface: #121a2e; --ink: #e8eaf1; --muted: #98a0b6; --rule: #262e46;
    --ultramarine: #5d7cff; --gold: #e8b74a; --spec-floor: #0c1120; --spec-mid: #2a3f9e; --lane: #101729;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0c1120; --surface: #121a2e; --ink: #e8eaf1; --muted: #98a0b6; --rule: #262e46;
  --ultramarine: #5d7cff; --gold: #e8b74a; --spec-floor: #0c1120; --spec-mid: #2a3f9e; --lane: #101729;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ultramarine); outline-offset: 3px; border-radius: 2px; }

.wrap { max-width: 1120px; margin: 0 auto; padding-inline: clamp(16px, 4vw, 40px); }

/* Top bar */
.bar { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding-block: 22px; flex-wrap: wrap; }
.mark { font-family: var(--display); font-weight: 600; font-size: 1.45rem; letter-spacing: .01em; text-decoration: none; }
.nav { display: flex; gap: clamp(14px, 3vw, 28px); font-size: .92rem; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a:hover { color: var(--ink); }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 64px); align-items: center; padding-block: clamp(28px, 6vw, 72px) clamp(40px, 6vw, 80px); }
.eyebrow { font-family: var(--mono); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 18px; }
h1 { font-family: var(--display); font-weight: 500; font-size: clamp(2.7rem, 6vw, 4.6rem); line-height: 1.02; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h1 em { color: var(--ultramarine); font-style: italic; }
.lede { margin: 22px 0 0; max-width: 34em; color: var(--muted); font-size: 1.04rem; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn { text-decoration: none; font: 500 .95rem/1 var(--body); padding: 13px 18px; border-radius: 999px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); cursor: pointer; display: inline-flex; align-items: center; gap: 10px; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.ghost:hover { border-color: var(--ink); }
.btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.btn[aria-pressed="true"] .dot { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.note { margin: 14px 0 0; font-size: .85rem; color: var(--muted); min-height: 1.4em; }
.quick { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 18px 0 0; font-size: .9rem; }
.quick a { color: var(--muted); text-underline-offset: 3px; text-decoration-color: var(--rule); }
.quick a:hover { color: var(--ink); text-decoration-color: currentColor; }

/* The instrument */
.frame { margin: 0; background: var(--surface); border: 1px solid var(--rule); padding: 14px 14px 10px; }
.scope { position: relative; height: clamp(240px, 32vw, 380px); }
canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.axis { position: absolute; inset: 0; pointer-events: none; font-family: var(--mono); font-size: .66rem; color: var(--muted); }
.axis span { position: absolute; left: 6px; transform: translateY(-50%); background: color-mix(in srgb, var(--surface) 80%, transparent); padding: 0 4px; }
.meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-family: var(--mono); font-size: .7rem; color: var(--muted); }
.meta .live { color: var(--ink); }
.meta .live::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); margin-right: 8px; vertical-align: 1px; }

/* Sections */
section.block { border-top: 1px solid var(--rule); padding-block: clamp(36px, 6vw, 64px); }
.head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 28px; }
h2 { font-family: var(--display); font-weight: 500; font-size: clamp(1.9rem, 3.4vw, 2.5rem); margin: 0; line-height: 1.1; text-wrap: balance; }
.head a, .hint { font-size: .92rem; color: var(--muted); }

.work { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: clamp(20px, 3vw, 36px); row-gap: 10px; }
.piece { display: grid; grid-row: span 5; grid-template-rows: subgrid; gap: 10px; min-width: 0; align-content: start; }
.piece > p { align-self: start; }
.piece .k { font-family: var(--mono); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.piece h3 { font-family: var(--display); font-weight: 600; font-size: 1.5rem; line-height: 1.15; margin: 0; }
.piece p { margin: 0; color: var(--muted); }
.piece .fig { font-family: var(--mono); font-size: .8rem; color: var(--ultramarine); border-top: 1px solid var(--rule); padding-top: 10px; }
.piece a { text-decoration: none; }
.piece a:hover h3 { color: var(--ultramarine); }
.mini { margin: 4px 0 0; padding: 12px 12px 10px; border: 1px solid var(--rule); background: var(--surface); align-self: end; }
.mini svg { display: block; width: 100%; height: auto; overflow: visible; }
.mini .ax, .mini .tk line { stroke: var(--rule); stroke-width: 1; }
.mini .tl text { font: 9px var(--mono); fill: var(--muted); text-anchor: middle; }
.mini .tl-l text { text-anchor: end; }
.mini .tl-v text { text-anchor: start; fill: var(--ink); }
.mini .dots-u circle { fill: var(--ultramarine); fill-opacity: .7; }
.mini .dot-g { fill: var(--gold); }
.mini .lb { font: 10px var(--body); fill: var(--muted); text-anchor: middle; }
.mini .lb-g { fill: var(--ink); }
.mini .bar { fill: var(--ultramarine); fill-opacity: .75; }
.mini .bar-g { fill: var(--gold); fill-opacity: 1; }
.mini figcaption { margin-top: 8px; font-size: .78rem; line-height: 1.45; color: var(--muted); }
.flow { list-style: none; margin: 0; padding: 4px 0 2px; display: flex; flex-wrap: wrap; gap: 6px 6px; font: .74rem/1.4 var(--mono); color: var(--ink); }
.flow li::after { content: "→"; margin-left: 6px; color: var(--muted); }
.flow li.end { color: var(--ultramarine); font-weight: 500; }
.flow li.end::after { content: none; }
.more { list-style: none; margin: 32px 0 0; padding: 0; border-top: 1px solid var(--rule); }
.more li { display: flex; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; padding-block: 12px; border-bottom: 1px solid var(--rule); }
.more a { text-decoration: none; font-weight: 500; }
.more a:hover { color: var(--ultramarine); }
.more span { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.now { margin: 24px 0 0; font-size: .95rem; color: var(--muted); }
.now b { color: var(--ink); font-weight: 600; }

/* Piano roll */
.roll-scroll { overflow-x: auto; border: 1px solid var(--rule); background: var(--surface); }
.roll { display: grid; grid-template-columns: 124px repeat(9, minmax(74px, 1fr)) 104px; min-width: 960px; font-size: .78rem; }
.roll .th { font-family: var(--mono); font-size: .66rem; color: var(--muted); padding: 10px 6px 8px; border-bottom: 1px solid var(--rule); text-align: center; }
.roll .th.first { text-align: left; padding-left: 12px; }
.roll .lane-name { font-family: var(--mono); font-size: .62rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--rule); display: flex; align-items: center; }
.roll .cell { padding: 6px 3px; border-bottom: 1px solid var(--rule); border-left: 1px solid var(--rule); display: flex; flex-direction: column; justify-content: center; gap: 4px; background: var(--lane); min-width: 0; }
.roll .lane-odd .cell, .roll .cell.odd { background: var(--surface); }
.note-btn { position: relative; font: 500 .66rem/1.2 var(--body); text-align: left; border: 0; border-radius: 3px; padding: 5px 6px 9px; cursor: pointer; color: var(--paper); background: var(--ink); width: 100%; overflow-wrap: normal; -webkit-hyphens: auto; hyphens: auto; }
.note-btn::after { content: ""; position: absolute; left: 7px; bottom: 4px; height: 2px; width: calc((100% - 14px) * var(--v, 0)); background: var(--gold); border-radius: 1px; }
.note-btn.listen { background: var(--ultramarine); color: #fff; }
.note-btn.capstone { background: var(--gold); color: #1b1404; }
.note-btn.capstone::after, .note-btn.remaining::after { display: none; }
.note-btn.remaining { background: transparent; color: var(--muted); border: 1px dashed var(--muted); }
.note-btn[aria-pressed="true"] { outline: 2px solid var(--gold); outline-offset: 2px; }
.roll .dest { grid-row: 2 / span 4; grid-column: 11; border-left: 1px solid var(--rule); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px; text-align: center; font-family: var(--display); font-style: italic; font-size: 1.25rem; line-height: 1.15; color: var(--ultramarine); }
.roll-hint { display: none; margin: 8px 0 0; font: .72rem var(--mono); color: var(--muted); }
@media (max-width: 1000px) { .roll-hint { display: block; } }
.roll .dest small { display: block; font-family: var(--mono); font-style: normal; font-size: .62rem; color: var(--muted); margin-top: 6px; }

.detail { border: 1px solid var(--rule); border-top: 0; background: var(--surface); padding: 18px 20px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 24px; }
.detail h3 { font-family: var(--display); font-weight: 600; font-size: 1.5rem; margin: 0; line-height: 1.15; }
.detail .grade { font-family: var(--mono); font-size: 1.1rem; color: var(--ultramarine); text-align: right; font-variant-numeric: tabular-nums; }
.detail .sub { color: var(--muted); font-size: .88rem; }
.detail .skills { grid-column: 1 / -1; color: var(--muted); font-size: .92rem; }
.detail ul { grid-column: 1 / -1; margin: 4px 0 0; padding-left: 18px; }
.detail li a { text-decoration-color: var(--rule); }
.detail li a:hover { color: var(--ultramarine); }
.fine { margin: 14px 0 0; font-size: .82rem; color: var(--muted); max-width: 60em; }

/* Music */
.music { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.music p { margin: 0 0 14px; color: var(--muted); max-width: 36em; }
.spotify { width: 100%; border: 0; border-radius: 12px; display: block; margin-top: 6px; }
.small { display: inline-block; margin-top: 10px; font-size: .85rem; color: var(--muted); }

.contact { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.contact p { margin: 0; color: var(--muted); max-width: 36em; }
.mailrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 22px 0 0; }
.mailtext { font-family: var(--mono); font-size: .95rem; color: var(--ink); user-select: all; margin-right: 8px; overflow-wrap: anywhere; }

footer { border-top: 1px solid var(--rule); padding-block: 28px 40px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: .88rem; color: var(--muted); }
footer .mail { font-family: var(--mono); color: var(--ink); text-decoration: none; }

@media (max-width: 820px) {
  .hero, .music, .work, .contact { grid-template-columns: minmax(0, 1fr); }
  .detail { grid-template-columns: minmax(0, 1fr); }
  .piece { margin-bottom: 28px; }
  .detail .grade { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .btn[aria-pressed="true"] .dot { animation: none; }
}
