/* Homepage only; shared tokens, header and footer live in styles.css. */
.home { padding-top: 0; padding-bottom: 96px; }

/* Header */
.head { padding-top: 40px; overflow: hidden; }
.portrait {
  float: right; width: 112px; height: 112px; object-fit: cover; margin: 4px 0 12px 24px;
  border-radius: 2px; filter: grayscale(1) contrast(1.05);
}
.head h1 { font-size: 2.3rem; line-height: 1.15; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.01em; }
.role { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.5; }
.links { display: flex; flex-wrap: wrap; gap: 18px; margin: 14px 0 0; font: 13px/1.4 var(--mono); }
.links a { display: inline-flex; align-items: center; gap: 6px; }
.links svg { width: 15px; height: 15px; flex: none; fill: currentColor; }

/* The console */
.console {
  margin: 32px 0 8px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--rule);
  font: 14px/1.7 var(--mono); overflow-x: auto;
}
.console > div { white-space: pre; }
.console.skills { margin: 0; }
.console.skills .tree { margin-top: 4px; white-space: normal; }
.console.skills .branch { display: grid; grid-template-columns: 4ch 12ch minmax(0, 1fr); white-space: normal; }
.console.skills .twig { color: var(--muted); white-space: pre; }
.console.skills .cat { color: var(--term); }
.console.skills .items span + span::before { content: ', '; color: var(--muted); }
.console .ps1 { color: var(--muted); user-select: none; }
.console .typed { color: var(--term); }
.console .out { color: var(--muted); }
.cursor {
  display: inline-block; width: 0.55em; height: 1.1em; margin-left: 1px;
  vertical-align: text-bottom; background: var(--term);
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Sections */
section { margin-top: 48px; }
h2 { margin: 0 0 16px; padding-bottom: 6px; border-bottom: 1px solid var(--rule); font-size: 1.25rem; font-weight: 600; }
section p { margin: 0 0 14px; }
.lede { font-size: 1.25rem; line-height: 1.45; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 22px; font: 13px/1.6 var(--mono); color: var(--muted); }
.note { font-size: 0.9rem; color: var(--muted); }

/* Publications: a numbered reference list */
.pubs { margin: 0 0 14px; padding: 0; list-style: none; }
.pubs li { display: flex; gap: 16px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--rule); font-size: 0.95rem; line-height: 1.5; }
.pubs li:last-child { border-bottom: 0; }
.pubs .n { flex: none; width: 2.2em; padding-top: 3px; font: 12px var(--mono); color: var(--muted); }
.cite { flex: 1; min-width: 0; }
.authors { color: var(--muted); }
.authors b { color: var(--text); }
.pubs .title { color: var(--text); text-decoration-color: var(--rule); }
.pubs .title:hover { color: var(--link); text-decoration-color: currentColor; }
.doi { display: flex; align-items: center; gap: 6px; max-width: 100%; margin-top: 4px; width: fit-content; font: 12px/1.4 var(--mono); color: var(--muted); text-decoration: none; }
.doi span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doi-mark { flex: none; width: 15px; height: 15px; fill: currentColor; }
.doi-mark text { font: 700 10.5px/1 -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; fill: var(--bg); letter-spacing: -0.02em; }
.doi:hover { color: var(--link); }
.doi:hover span { text-decoration: underline; }
.cofirst { font: 11px var(--mono); color: var(--muted); white-space: nowrap; }
.thumb { flex: none; width: 96px; height: 72px; border: 1px solid var(--rule); background: #fff; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Software */
.software { margin: 0 0 14px; }
.software dt { font-weight: 600; margin-top: 14px; }
.software dt:first-child { margin-top: 0; }
.software dt svg { width: 15px; height: 15px; margin-right: 8px; vertical-align: -2px; fill: currentColor; color: var(--muted); }
.software dt a svg { color: inherit; }
.software dd { margin: 2px 0 0; font-size: 0.95rem; }
.meta { font: 12px var(--mono); color: var(--muted); font-weight: 400; }
.tags { display: block; margin-top: 2px; }
.tags span + span { margin-left: 12px; }

@media (max-width: 560px) {
  .head { padding-top: 16px; }
  .portrait { width: 84px; height: 84px; margin-left: 16px; }
  .head h1 { font-size: 1.9rem; }
  .console { font-size: 12.5px; }
  .pubs li { flex-wrap: wrap; gap: 8px 12px; }
  .cite { flex-basis: calc(100% - 2.2em - 12px); }
  .thumb { width: calc(100% - 2.2em - 12px); height: 140px; margin-left: calc(2.2em + 12px); }
}

/* Large screens: header beside the console, section titles in a margin column. */
@media (min-width: 1100px) {
  .intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: end; padding-top: 40px; }
  .head { padding-top: 0; }
  .console { margin: 0; }
  section { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 32px; margin-top: 64px; }
  h2 { position: sticky; top: 64px; align-self: start; border-bottom: 0; padding-top: 2px; font-size: 1.15rem; }
  .body { border-top: 1px solid var(--rule); padding-top: 16px; }
  .body > p { max-width: 68ch; }
  .thumb { width: 132px; height: 92px; }
}

/* Figures (drawn by home.js; hidden without JS) */
.fig { margin: 28px 0 32px; }
.fig-plot { border: 1px solid var(--rule); background: var(--bg); }
.fig figcaption { margin-top: 8px; font-size: 0.85rem; line-height: 1.5; color: var(--muted); }
.fig figcaption b { color: var(--text); }
.fig code { font: 0.8rem var(--mono); }
.fig svg { display: block; width: 100%; height: auto; }
.fig svg text { font: 10px var(--mono); fill: var(--muted); }
.fig .axis { stroke: var(--rule); stroke-width: 1; }
.fig .yearband { fill: var(--surface); }
.fig .threshold { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0; transition: opacity .6s ease 1.4s; }
.fig .pt { opacity: 0; transform: scale(0.2); transform-box: fill-box; transform-origin: center; transition: opacity .35s ease, transform .35s ease; transition-delay: var(--d); }
.fig .pt.odd { fill: var(--muted); fill-opacity: .5; }
.fig .pt.even { fill: var(--text); fill-opacity: .55; }
.fig .pt.hit { fill: var(--term); fill-opacity: 1; }
.fig .peak-label { fill: var(--term); opacity: 0; transition: opacity .5s ease 1.5s; }
.fig.play .peak-label { opacity: 1; }
.fig .peak-label.talk { fill: var(--muted); }
.fig.play .pt { opacity: 1; transform: none; }
.fig.play .threshold { opacity: 1; }

.tview { position: relative; padding: 10px 12px; font: 13px/1.45 var(--mono); overflow: hidden; }
.tview .band { position: absolute; top: calc(10px + 2.9em); bottom: 10px; width: 1ch; margin-left: 12px; background: color-mix(in srgb, var(--term) 22%, transparent); }
.tview .row { position: relative; height: 1.45em; white-space: pre; }
.tview .ruler, .tview .ref { color: var(--muted); }
.tview .ref { color: var(--text); }
.tview .var { color: var(--term); font-weight: 500; }
.tview .read { position: absolute; top: 0; overflow: hidden; width: 0; color: var(--muted); transition: width .9s steps(24, end); transition-delay: var(--d); }
.tview.play .read, .fig.play .tview .read { width: var(--w); }
.tview .alt { color: var(--term); font-weight: 500; }
.tview .err { color: var(--link); }
@media (max-width: 560px) {
  .tview { font-size: 11px; }
  .fig svg text { font-size: 17px; }
}

/* Paper peaks and their preview card */
.fig-plot { position: relative; }
.fig .peak { cursor: pointer; outline: none; }
.fig .hit-area { fill: transparent; }
.fig .peak .pt.lead { transition: opacity .35s ease var(--d), transform .25s ease; }
.fig.play .peak:hover .pt.lead, .fig.play .peak:focus-visible .pt.lead { transform: scale(1.6); }
.fig .peak:hover .peak-label, .fig .peak:focus-visible .peak-label { fill: var(--text); }
.peek {
  position: absolute; z-index: 5; width: 250px; padding: 8px;
  background: var(--bg); border: 1px solid var(--rule); box-shadow: 0 8px 28px rgb(0 0 0 / .12);
  color: var(--text); text-decoration: none;
  opacity: 0; transform: translateY(6px) scale(.98); pointer-events: none;
  transition: opacity .22s ease, transform .28s cubic-bezier(.2, .8, .2, 1);
}
.peek.open { opacity: 1; transform: none; pointer-events: auto; }
.peek.glide { transition: opacity .22s ease, transform .28s cubic-bezier(.2, .8, .2, 1), left .3s cubic-bezier(.2, .8, .2, 1), top .3s cubic-bezier(.2, .8, .2, 1); }
.peek img { display: block; width: 100%; height: 130px; object-fit: cover; background: #fff; border: 1px solid var(--rule); }
.peek-meta { display: block; margin-top: 8px; font: 11px var(--mono); color: var(--term); }
.peek-title { display: -webkit-box; margin-top: 2px; font-size: 0.85rem; line-height: 1.35; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.peek:hover .peek-title { text-decoration: underline; }

/* In-page figure viewer */
.viewer {
  max-width: min(960px, 92vw); max-height: 92vh; margin: auto; padding: 16px;
  background: var(--bg); color: var(--text); border: 1px solid var(--rule);
  opacity: 0; transform: translateY(8px) scale(.985);
  transition: opacity .22s ease, transform .28s cubic-bezier(.2, .8, .2, 1);
  cursor: zoom-out;
}
.viewer.open { opacity: 1; transform: none; }
.viewer::backdrop { background: rgb(0 0 0 / 0); transition: background .22s ease; }
.viewer.open::backdrop { background: rgb(0 0 0 / .45); }
.viewer img { display: block; max-width: 100%; max-height: calc(92vh - 90px); margin: 0 auto; background: #fff; }
.viewer p { margin-top: 12px; font-size: 0.9rem; color: var(--muted); }
.viewer-paper { cursor: pointer; white-space: nowrap; }
.pubs .thumb { cursor: zoom-in; }
