:root {
  color-scheme: light;
  --paper: #f7f7f2;
  --ink: #202e2b;
  --muted: #637067;
  --line: #dce1d6;
  --accent: #347358;
}

* { box-sizing: border-box; }
body {
  margin: 0 auto;
  max-width: 1080px;
  padding: 0 40px;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.7 system-ui, sans-serif;
}
a { color: inherit; text-underline-offset: 5px; }
a:hover { color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }
.skip { position: absolute; top: -100px; }
.skip:focus { top: 8px; background: var(--paper); padding: 8px; }
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}
.name { font-weight: 600; text-decoration: none; }
.name span { color: var(--accent); }
nav { display: flex; gap: 26px; font-size: 14px; }
nav a { text-decoration: none; }
nav a[aria-current] { color: var(--accent); }
h1 {
  margin: 0;
  font: normal clamp(34px, 5vw, 48px)/1.15 Georgia, serif;
  letter-spacing: -.035em;
}

/* Keep the biography below the portrait and profile links. */
.portfolio { max-width: 820px; margin: 0 auto; }
.profile {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: center;
  gap: 44px;
  padding: 60px 0 30px;
}
.portrait {
  position: relative;
  width: 200px;
  height: 200px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--line);
}
/* Frame the original photo with CSS, leaving the photograph itself untouched. */
.portrait img {
  position: absolute;
  width: 280%;
  height: auto;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -66%);
}
.role { margin: 10px 0 22px; color: var(--muted); font-size: 18px; }
.social-links { display: flex; flex-wrap: wrap; gap: 18px; }
.social-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 44px;
  font-size: 11px;
  text-decoration: none;
}
.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
}
.icon-button svg { width: 22px; height: 22px; }
.social-link:hover .icon-button { border-color: var(--accent); background: #edf1e9; }
.bio { padding-bottom: 54px; font-size: 17px; }
.bio p { margin: 0 0 20px; }
.bio strong { font-weight: 600; }
.text-link { display: inline-block; margin-top: 8px; color: var(--accent); font-weight: 500; }
.text-link span { margin-left: 6px; }

.blog-intro { padding: 58px 0 38px; }
.blog-intro p { color: var(--muted); font-size: 18px; }
.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.project {
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  align-items: center;
  gap: 48px;
  padding: 32px 0 50px;
  border-top: 1px solid var(--line);
}
.project h2 { margin: 0 0 14px; font: normal 42px/1.2 Georgia, serif; }
.project-copy p { max-width: 370px; }
.secondary { color: var(--muted); }
.status { margin-top: 28px; color: var(--muted); font-size: 12px; }
.status span {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.project-image { display: block; }
.project-image img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
footer { padding: 24px 0 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

/* A narrow reading column for the technical article. */
.article { max-width: 740px; margin: 0 auto; padding: 50px 0 48px; }
.article-header { margin-bottom: 42px; }
.article-header .eyebrow { margin-bottom: 16px; }
.article-subtitle { margin: 20px 0 0; color: var(--muted); font-size: 21px; line-height: 1.5; }
.article-byline { margin: 16px 0 0; color: var(--muted); font-size: 14px; }
.article-section { font-size: 18px; line-height: 1.85; }
.article-section h2 { margin: 0 0 22px; font: normal 30px/1.3 Georgia, serif; }
.article-section p { margin: 0 0 24px; }
.article-section a { color: var(--accent); }
.article-section strong { font-weight: 600; }

/* Native disclosure blocks make the signal flow interactive without JavaScript. */
.article-section + .article-section { margin-top: 54px; }
.article-section ul { padding-left: 24px; margin: 0 0 24px; }
.article-section li { padding-left: 4px; margin-bottom: 5px; }
.synth-diagram {
  margin: 32px 0;
  padding: 24px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 14px/1.5 system-ui, sans-serif;
}
.synth-diagram figcaption { text-align: center; margin-bottom: 24px; }
.synth-diagram figcaption strong { display: block; font-size: 16px; }
.synth-diagram figcaption span { color: var(--muted); font-size: 13px; }
.flow-oscillators { display: grid; grid-template-columns: 1fr 1fr; align-items: end; }
.flow-oscillators .signal-node { width: calc(100% - 12px); max-width: 250px; margin: 0 auto; }
.signal-node { padding: 12px; border: 1px solid #c4d2c7; border-radius: 6px; background: #f0f3ec; }
.signal-node summary { display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; list-style: none; text-align: center; font-weight: 600; }
.signal-node summary::-webkit-details-marker { display: none; }
.signal-node summary::after { content: '+'; color: var(--accent); margin-left: 0; flex-shrink: 0; font-weight: 400; }
.signal-node[open] { border-color: var(--accent); background: #e9f0e5; }
.signal-node[open] summary::after { content: '−'; }
.signal-node summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.signal-node p { margin: 12px 0 0; color: var(--ink); font-size: 13px; line-height: 1.6; }
.flow-merge { display: block; width: 100%; height: 32px; color: var(--accent); }
.flow-step { display: flex; justify-content: center; }
.flow-step .signal-node { width: 50%; max-width: 250px; }
.flow-arrow { height: 28px; color: var(--accent); line-height: 28px; text-align: center; font-size: 21px; }
.flow-side-row { display: grid; grid-template-columns: 1fr min(50%, 250px) 1fr; gap: 8px; align-items: center; }
.flow-source, .flow-control { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.flow-source { justify-content: flex-end; }
.flow-source > span:last-child { color: var(--accent); font-size: 22px; }
.flow-control { color: #86672f; }
.flow-control small { font-size: 10px; }
.modulation-arrow { font-size: 24px; }
.flow-output { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; }

/* The sketches are decorative examples; oscillator waveform choices stay independent. */
.signal-sketch { display: block; width: 36px; height: 22px; flex: 0 0 36px; color: var(--accent); }
.signal-node summary span { min-width: 0; }
.flow-label { text-align: center; }
.flow-label .signal-sketch { margin: 0 auto 4px; }
.flow-control .signal-sketch { color: inherit; }

@media (max-width: 650px) {
  body { padding: 0 22px; }
  .site-header { padding: 22px 0; }
  .name { max-width: 160px; line-height: 1.3; }
  nav { gap: 20px; }
  .profile { grid-template-columns: 1fr; justify-items: center; gap: 24px; padding: 36px 0 28px; }
  .profile-heading { text-align: center; }
  .portrait { width: 180px; height: 180px; }
  .social-links { justify-content: center; gap: 16px; }
  .bio { font-size: 16px; padding-bottom: 40px; }
  .blog-intro { padding: 40px 0 24px; }
  .project { grid-template-columns: 1fr; gap: 24px; }
  .project-copy p { max-width: none; }
  .status { margin-top: 20px; }
  .article { padding-top: 36px; }
  .article-section { font-size: 17px; }
  .signal-node summary { gap: 6px; }
  .signal-sketch { width: 30px; height: 20px; flex-basis: 30px; }
}

/* Optional technical notes and small, readable scientific figures. */
.deep-dive > summary { list-style: none; cursor: pointer; border: 1px solid var(--line); border-radius: 8px; padding: 22px 24px; background: #f0f3ec; }
.deep-dive > summary::-webkit-details-marker { display: none; }
.deep-dive > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.deep-dive > summary h3 { margin: 0; font-size: 26px; }
.deep-dive > summary small { display: block; margin-top: 12px; color: var(--muted); font: 13px/1.5 system-ui, sans-serif; }
.deep-dive-body { padding-top: 28px; }
.deep-dive-body h3 { margin: 38px 0 18px; font: normal 25px/1.4 Georgia, serif; }
.deep-dive-body code { font: .82em/1.6 ui-monospace, monospace; }
.deep-dive-body pre { margin: 0 0 26px; padding: 16px 18px; overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: #f0f3ec; font-size: 15px; line-height: 1.7; }
.deep-dive-body pre code { font-size: 13px; }
.deep-dive-body .code-source { margin-bottom: 6px; color: var(--muted); font: 12px/1.5 system-ui, sans-serif; }
.display-math { overflow-x: auto; margin: 24px 0; }
.math { font-size: .95em; }
.waveform-figure, .envelope-figure { margin: 30px 0; }
.waveform-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.waveform-card { margin: 0; border: 1px solid var(--line); border-radius: 6px; padding: 12px; }
.waveform-card figcaption { font: 600 14px/1.5 system-ui, sans-serif; }
.waveform-card img { display: block; width: 100%; height: auto; }
.waveform-figure > figcaption { margin-top: 10px; color: var(--muted); font: 13px/1.6 system-ui, sans-serif; }
.envelope-figure { border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.envelope-figure figcaption { font: 14px/1.6 system-ui, sans-serif; }
.envelope-figure figcaption strong, .envelope-figure figcaption span { display: block; }
.envelope-figure figcaption span { color: var(--muted); margin-top: 5px; }
#envelope-plot { display: block; width: 100%; height: auto; margin: 16px 0; overflow: visible; }
#envelope-grid { fill: var(--muted); font: 12px system-ui, sans-serif; }
#envelope-grid line { stroke: var(--line); stroke-width: 1; }
#envelope-curve { fill: none; stroke: var(--accent); stroke-width: 2.5; }
#envelope-note-off { stroke: #86672f; stroke-width: 1.5; stroke-dasharray: 5 4; }
.envelope-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; font: 13px/1.6 system-ui, sans-serif; }
.envelope-controls label > span { display: flex; justify-content: space-between; gap: 8px; }
.envelope-controls output { color: var(--muted); font-variant-numeric: tabular-nums; }
.envelope-controls input { display: block; width: 100%; margin: 6px 0 0; accent-color: var(--accent); }
@media (max-width: 480px) {
  .waveform-grid, .envelope-controls { grid-template-columns: 1fr; }
  .deep-dive > summary { padding: 18px; }
  .deep-dive > summary h3 { font-size: 23px; }
  .envelope-figure { padding: 14px; }
  #envelope-grid { font-size: 20px; }
}


.deep-dive-body h4 { margin: 32px 0 18px; font: normal 22px/1.4 Georgia, serif; }
.deep-dive-body pre code { font-size: 14px; }
.code-comment { color: #586f61; }
.code-keyword { color: #75418c; font-weight: 600; }
.code-string { color: #914137; }
.code-number { color: #9c461c; }
.code-function { color: #2166a0; }
.code-namespace { color: #75418c; }
.code-operator { color: #795b2b; }

/* Direct-fitting results: three small plots, with raw data available below. */
.recovery-section h3 { margin: 36px 0 18px; font: normal 25px/1.4 Georgia, serif; }
.recovery-figure { margin: 32px 0; }
.recovery-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; margin-bottom: 24px; font-size: 12px; }
.recovery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.recovery-card { text-align: center; }
.recovery-card h4 { margin: 0 0 3px; font-size: 16px; font-weight: 600; }
.recovery-card .recovery-target { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.recovery-card img { display: block; width: 100%; height: auto; }
.recovery-card .recovery-values { margin: 0; font-size: 13px; line-height: 1.8; }
.recovery-seed-a { color: #347358; }
.recovery-seed-b { color: #b4613c; }
.recovery-seed-c { color: #527d9a; }
.recovery-figure figcaption { margin-top: 22px; color: var(--muted); font-size: 13px; line-height: 1.7; }
@media (max-width: 720px) {
  .recovery-grid { grid-template-columns: 1fr; gap: 30px; }
  .recovery-card { max-width: 360px; width: 100%; margin: 0 auto; }
}

.references-section ol { margin: 0; padding-left: 24px; font-size: 15px; line-height: 1.8; }

.phase-example { margin: 30px 0; }
.phase-example > img { display: block; width: 100%; height: auto; }
.phase-audio { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 16px 0; }
.phase-audio p { margin: 0 0 8px; font-size: 14px; }
.phase-audio audio { display: block; width: 100%; }
.phase-example figcaption { color: var(--muted); font-size: 13px; line-height: 1.7; }
@media (max-width: 600px) { .phase-audio { grid-template-columns: 1fr; } }

/* Dataset flow and held-out parameter-supervision results. */
.learning-section h3 { margin: 36px 0 18px; font: normal 25px/1.4 Georgia, serif; }
.data-pipeline, .pretraining-errors { margin: 30px 0; }
.data-flow { display: flex; align-items: stretch; gap: 8px; }
.data-step { flex: 1; min-width: 0; padding: 14px 6px; border: 1px solid var(--line); border-radius: 6px; background: #f0f3ec; text-align: center; font-size: 13px; line-height: 1.6; }
.data-step strong, .data-step span { display: block; }
.data-step span { margin-top: 6px; color: var(--muted); font-size: 12px; }
.data-arrow { align-self: center; color: var(--accent); font-size: 20px; }
.data-pipeline .data-targets { margin: 14px 0; padding: 12px; background: #f0f3ec; border-left: 3px solid var(--accent); font-size: 14px; }
.data-pipeline figcaption, .pretraining-errors figcaption { margin-top: 14px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.pretraining-errors img { display: block; width: 100%; height: auto; }
.pretraining-examples { margin: 28px 0; }
.pretraining-example { border-top: 1px solid var(--line); padding: 20px 0; }
.pretraining-example h4 { margin: 0; font-size: 17px; font-weight: 600; }
.experiment-results { width: 100%; margin: 18px 0 24px; border-collapse: collapse; font-size: 13px; }
.experiment-results th, .experiment-results td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: right; }
.experiment-results th:first-child { text-align: left; }
.experiment-results tbody th { font-weight: 500; }
.preset-comparison { font-size: 13px; color: var(--muted); }
.preset-comparison summary { cursor: pointer; }
.preset-comparison table { width: 100%; margin-top: 12px; border-collapse: collapse; color: var(--ink); font-size: 13px; }
.preset-comparison th, .preset-comparison td { padding: 5px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.preset-comparison th:first-child { text-align: left; font-weight: 500; }
@media (max-width: 720px) {
  .data-flow { flex-direction: column; gap: 6px; }
  .data-step { padding: 10px; }
  .data-arrow { transform: rotate(90deg); }
}

/* Small pipeline sketches and the parameter comparison figure. */
.data-step .pipeline-sketch { margin: 9px auto; }
.pretraining-scatter label { font-size: 14px; }
.pretraining-scatter select { margin: 0 0 14px 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); color: var(--ink); font: inherit; font-size: 14px; }
.pretraining-scatter img { max-width: 480px; margin: auto; }

.reconstruction-audio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 16px 0; }
.reconstruction-audio p { margin: 0 0 8px; font-size: 14px; }
.reconstruction-audio audio { display: block; width: 100%; }
#audio-training-previews .reconstruction-audio { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 600px) { .reconstruction-audio, #audio-training-previews .reconstruction-audio { grid-template-columns: 1fr; } }

/* Keep the contents in the article's reading column. */
.article-contents { display: block; margin: 42px 0 54px; }
.article-contents ol { margin: 0; padding-left: 26px; }
.article-contents li { padding-left: 4px; margin-bottom: 6px; }
.article-contents a:hover { text-decoration: underline; }

/* A compact first listen; the full gallery remains further down the article. */
.quick-examples { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 22px 0; }
.quick-listen .sound-card { padding: 16px; min-width: 0; }
.quick-listen .sound-card h3 { margin: 0; font: 600 16px/1.4 system-ui, sans-serif; }
.quick-listen .sound-card .sound-prompt { min-height: 0; margin: 12px 0 16px; font-size: 14px; line-height: 1.6; }
.quick-listen audio { min-width: 0; }
.article-contents .contents-extra { margin: 16px 0 0; font-size: 15px; }
.deep-dive-section { margin-top: 32px; }
.anchor-alias { display: block; }
.article-section[id], .article-section h2[id], .anchor-alias, #sound-gallery { scroll-margin-top: 24px; }
@media (max-width: 600px) { .quick-examples { grid-template-columns: 1fr; } }
