@font-face {
  font-family: "IBM Plex Sans";
  src: url("assets/fonts/IBMPlexSans-var.woff2") format("woff2");
  font-weight: 100 700;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/fonts/IBMPlexMono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #121110;
  --surface: #1a1816;
  --surface-2: #221f1c;
  --line: #2f2b27;
  --line-2: #45403a;
  --ink: #efeae3;
  --ink-2: #bdb5aa;
  --ink-3: #948b80;
  --accent: #f28c4c;
  --accent-soft: rgba(242, 140, 76, 0.12);
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --wide: 76rem;
  --radius: 0;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  padding-inline: clamp(20px, 4vw, 48px);
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color .2s; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 0; }
h1, h2, h3 { font-weight: 600; line-height: 1.2; letter-spacing: -0.015em; }
main, .footer, .topbar { max-width: var(--wide); margin-inline: auto; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 28px;
  padding-block: 18px 14px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}
.topbar .name { font-weight: 600; text-decoration: none; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-left: auto; font-size: 0.93rem; }
.topbar nav a { text-decoration: none; color: var(--ink-2); position: relative; }
.topbar nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease);
}
.topbar nav a:hover { color: var(--ink); }
.topbar nav a:hover::after, .topbar nav a.active::after { transform: scaleX(1); }
.topbar nav a.active { color: var(--ink); }

.menu-btn { display: none; }
@media (max-width: 700px) {
  .topbar { align-items: center; }
  .menu-btn {
    display: grid; align-content: center; gap: 6px;
    width: 44px; height: 44px; margin-left: auto; padding: 0 11px;
    background: transparent; border: 1px solid var(--line-2); cursor: pointer;
  }
  .menu-btn span { display: block; height: 2px; background: var(--ink); transition: transform .35s var(--ease); }
  .menu-btn[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
  .menu-btn[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }
  .topbar nav {
    flex-basis: 100%; flex-direction: column; gap: 0; margin: 0;
    max-height: 0; overflow: hidden; visibility: hidden;
    transition: max-height .45s var(--ease), visibility 0s .45s;
  }
  .topbar nav.open { max-height: 16rem; visibility: visible; transition: max-height .45s var(--ease); }
  .topbar nav a { padding: 14px 0; font-size: 1.1rem; border-top: 1px solid var(--line); }
  .topbar nav a::after { display: none; }
}

/* ---------- intro ---------- */
.intro { padding-block: clamp(64px, 12vh, 140px) 24px; }
.intro h1 { font-size: clamp(2.2rem, 5.4vw, 4.2rem); margin: 0 0 24px; max-width: 16em; letter-spacing: -0.03em; }
.intro h1 span { color: var(--ink-3); }
.lede { font-size: clamp(1.05rem, 1.5vw, 1.2rem); color: var(--ink-2); margin: 0 0 32px; max-width: 42em; }

/* ---------- sections ---------- */
.band { padding-top: clamp(72px, 10vw, 120px); }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px 32px; margin-bottom: 24px; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0 0 6px; }
.section-note { color: var(--ink-2); margin: 0; font-size: 0.97rem; max-width: 46em; }

/* ---------- experience timeline ---------- */
.tl {
  --dot: 14px;
  position: relative; list-style: none; margin: 0; padding: 0;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 24px;
}
/* the rail, which draws in from the left */
.tl::before {
  content: ""; position: absolute; left: 0; right: 0; top: calc(var(--dot) / 2 - 1px); height: 2px;
  background: linear-gradient(90deg, var(--line-2), var(--accent));
  transform-origin: left; transform: scaleX(0); transition: transform 1.4s var(--ease);
}
.tl.in::before { transform: scaleX(1); }
.stop { position: relative; padding-top: calc(var(--dot) + 20px); padding-right: 12px; }
.stop .dot {
  position: absolute; top: 0; left: 0; width: var(--dot); height: var(--dot);
  background: var(--bg); border: 2px solid var(--ink-3);
  transform: scale(0); transition: transform .5s var(--ease), border-color .3s, background .3s;
}
.stop.current .dot { border-color: var(--accent); background: var(--accent); }
.stop.current .dot::after {
  content: ""; position: absolute; inset: -8px; border: 1px solid var(--accent); opacity: 0;
  animation: ping 2.4s var(--ease) infinite 1.6s;
}
@keyframes ping { 0% { transform: scale(.5); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }
.stop > :not(.dot) { opacity: 0; transform: translateY(10px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.tl.in .stop .dot { transform: scale(1); }
.tl.in .stop > :not(.dot) { opacity: 1; transform: none; }
.tl.in .stop:nth-child(2) > * { transition-delay: .3s; }
.tl.in .stop:nth-child(3) > * { transition-delay: .6s; }
.tl.in .stop:nth-child(4) > * { transition-delay: .9s; }
.tl.in .stop:nth-child(5) > * { transition-delay: 1.2s; }
.tl.in .stop:nth-child(n+6) > * { transition-delay: 1.4s; }
.stop:hover .dot { border-color: var(--accent); }
.stop .when { font: 0.8rem var(--mono); color: var(--ink-3); margin: 0 0 6px; }
.stop.current .when { color: var(--accent); }
.stop h3 { font-size: 1.1rem; margin: 0; }
.stop .org { color: var(--ink-2); margin: 2px 0 0; }
.stop .note { color: var(--ink-2); font-size: 0.9rem; margin: 8px 0 0; }
/* no JS: show everything */
html:not(.js) .tl::before, html:not(.js) .stop .dot { transform: none; }
html:not(.js) .stop > * { opacity: 1; transform: none; }
@media (max-width: 700px) {
  .tl { grid-auto-flow: row; gap: 28px; padding-left: calc(var(--dot) + 18px); }
  .tl::before { left: calc(var(--dot) / 2 - 1px); right: auto; top: 0; bottom: 0; width: 2px; height: auto;
    background: linear-gradient(180deg, var(--line-2), var(--accent)); transform-origin: top; transform: scaleY(0); }
  .tl.in::before { transform: scaleY(1); }
  .stop { padding-top: 0; }
  .stop .dot { left: calc(-1 * (var(--dot) + 18px)); top: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  .tl::before, .stop .dot, .stop > * { transition: none !important; }
  .stop.current .dot::after { animation: none; }
}

/* ---------- carousels ---------- */
.carousel {
  display: flex; align-items: flex-start; gap: 20px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 0;
  list-style: none; margin: 0; padding: 4px 0 8px;
  scrollbar-width: none;
  cursor: grab;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel.dragging { cursor: grabbing; scroll-snap-type: none; user-select: none; }
.carousel.gliding { scroll-snap-type: none; }
.carousel.dragging * { pointer-events: none; }
.slide { scroll-snap-align: start; flex: 0 0 auto; }
.carousel-wrap { position: relative; }
.projects-track { align-items: stretch; }
.hacks-track { align-items: stretch; }
.nav-btn {
  position: absolute; top: 50%; z-index: 2;
  width: 48px; height: 48px; margin-top: -24px;
  display: grid; place-items: center;
  border: 1px solid var(--line-2); border-radius: 0;
  background: color-mix(in srgb, var(--surface-2) 92%, transparent); color: var(--ink);
  font-size: 1.15rem; cursor: pointer;
  backdrop-filter: blur(6px);
  transition: opacity .35s var(--ease), transform .35s var(--ease), border-color .2s, color .2s;
}
.nav-btn.prev { left: -24px; }
.nav-btn.next { right: -24px; }
.nav-btn:hover { border-color: var(--accent); color: var(--accent); }
.nav-btn.prev:active { transform: translateX(-3px); }
.nav-btn.next:active { transform: translateX(3px); }
.nav-btn.hide { opacity: 0; pointer-events: none; }
.nav-btn.prev.hide { transform: translateX(8px); }
.nav-btn.next.hide { transform: translateX(-8px); }

/* position bars under each carousel */
.pager { display: flex; justify-content: center; gap: 6px; margin-top: 22px; }
.pager button {
  width: 22px; height: 4px; padding: 0; border: 0; border-radius: 0;
  background: var(--line-2); cursor: pointer;
  transition: width .45s var(--ease), background .3s;
}
.pager button:hover { background: var(--ink-3); }
.pager button.on { width: 44px; background: var(--accent); }
/* bigger hit area without changing the look */
.pager button { position: relative; }
.pager button::before { content: ""; position: absolute; inset: -10px -3px; }

/* ---------- project slides ---------- */
.project {
  scroll-snap-align: center;
  width: min(84%, 1000px);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(20px, 3vw, 44px);
  padding: clamp(22px, 3vw, 40px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: opacity .5s var(--ease), transform .5s var(--ease), border-color .3s;
}
.projects-track.ready .project:not(.current) { opacity: 0.45; transform: scale(0.97); }
.project:hover { border-color: var(--line-2); }
@media (max-width: 860px) { .project { grid-template-columns: 1fr; width: 88%; } }
@media (max-width: 700px) {
  .nav-btn { display: none; }
  .project { width: 86%; padding: 20px; }
  .projects-track.ready .project:not(.current) { transform: scale(0.96); }
  .hack { width: 78vw; }
  .carousel { margin-inline: calc(-1 * clamp(20px, 4vw, 48px)); padding-inline: clamp(20px, 4vw, 48px); scroll-padding-inline: clamp(20px, 4vw, 48px); }
}
.project .meta { font: 0.8rem var(--mono); color: var(--ink-3); margin: 0 0 8px; }
.project h3 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin: 0 0 14px; }
.project .summary { color: var(--ink-2); margin: 0 0 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 18px; }
.chips li { font: 0.75rem var(--mono); padding: 4px 10px; border-radius: 0; background: var(--surface-2); color: var(--ink-2); }
.project .links { display: flex; flex-wrap: wrap; gap: 8px 20px; font-weight: 500; }
.project-text, .project-side { display: grid; gap: 0; align-content: start; }
.project-text .figure { margin-top: 24px; }
.did-wrap summary { display: none; }
@media (max-width: 700px) { .did-label { display: none; } }
@media (max-width: 700px) {
  .did-wrap { margin-top: 20px; }
  .did-wrap summary {
    display: flex; justify-content: space-between; align-items: center; cursor: pointer; list-style: none;
    padding: 14px 0 4px; border-top: 1px solid var(--line); font-weight: 500; font-size: 0.95rem;
  }
  .did-wrap summary::-webkit-details-marker { display: none; }
  .did-wrap summary::after { content: "+"; font: 1.1rem var(--mono); color: var(--accent); transition: transform .3s var(--ease); }
  .did-wrap[open] summary::after { transform: rotate(45deg); }
  .did-wrap[open] .did { margin-top: 8px; }
}
.did-label { font-size: 0.85rem; color: var(--ink-3); margin: 0 0 10px; }
.did { margin: 0; padding-left: 1.1em; display: grid; gap: 12px; color: var(--ink-2); }
.did li { padding-left: 4px; }
.did li::marker { color: var(--accent); }
@media (min-width: 861px) { .project-side { border-left: 1px solid var(--line); padding-left: clamp(20px, 3vw, 44px); } }

.figure { margin: 0; }
.figure figcaption { font-size: 0.82rem; color: var(--ink-3); margin-top: 10px; }
.figure img { width: 100%; border-radius: 0; }
.figure img.plot { filter: invert(0.9) hue-rotate(180deg); background: #fff; }
.figure canvas.scene { display: block; width: 100%; aspect-ratio: 16 / 9; }
.figure iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 0; }

/* ScoreGen demo */
.demo { border-radius: 0; background: var(--surface-2); overflow: hidden; }
.demo canvas { display: block; width: 100%; height: 190px; }
.demo-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 12px; border-top: 1px solid var(--line); }
.button {
  font: 500 0.9rem var(--sans);
  padding: 7px 14px; border-radius: 0; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: #1c0e04;
  transition: background .2s, color .2s, transform .15s var(--ease);
}
.button:active { transform: scale(0.96); }
.button[aria-pressed="true"] { background: transparent; color: var(--accent); }
.piano { position: relative; display: flex; gap: 2px; height: 44px; }
.piano .white {
  width: 28px; height: 100%; padding: 0 0 4px; display: flex; align-items: end; justify-content: center;
  font: 0.68rem var(--mono); cursor: pointer;
  border: 0; border-radius: 0; background: #e9e3d9; color: #3a342d;
  transition: background .12s;
}
.piano .black {
  position: absolute; top: 0; z-index: 1; width: 18px; height: 60%; padding: 0;
  border: 0; border-radius: 0; background: #1b1916; cursor: pointer;
  box-shadow: 0 0 0 1px var(--surface-2);
  transition: background .12s;
}
/* each black key straddles the gap after the n-th white key (28px key + 2px gap) */
.piano .black[data-after="1"] { left: 20px; }
.piano .black[data-after="2"] { left: 50px; }
.piano .black[data-after="4"] { left: 110px; }
.piano .black[data-after="5"] { left: 140px; }
.piano .black[data-after="6"] { left: 170px; }
.piano .white:hover { background: #fff; }
.piano .black:hover { background: #3a342d; }
.piano button:active, .piano button.down { background: var(--accent); }
.demo .readout { margin-left: auto; font: 0.85rem var(--mono); color: var(--ink-2); min-width: 8ch; text-align: right; }

/* ---------- competition slides ---------- */
.hack {
  align-self: stretch;
  width: clamp(260px, 28vw, 340px);
  display: flex; flex-direction: column; gap: 8px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform .35s var(--ease), border-color .3s, background .3s;
}
.hack:hover { transform: translateY(-6px); border-color: var(--line-2); background: var(--surface-2); }
.hack img {
  width: calc(100% + 44px); max-width: none; margin: -22px -22px 8px;
  aspect-ratio: 4 / 3; object-fit: cover; background: #fff;
  filter: grayscale(1) contrast(1.05) brightness(0.92);
  transition: filter .5s var(--ease);
}
.hack:hover img { filter: none; }
.hack .when { font: 0.75rem var(--mono); color: var(--ink-3); margin: 0; }
.hack h3 { font-size: 1.2rem; margin: 0; }
.hack h3 a { text-decoration: none; }
.hack h3 a::after { content: " ↗"; font-size: 0.8em; color: var(--ink-3); transition: color .2s; }
.hack h3 a:hover::after { color: var(--accent); }
.hack p { margin: 0; color: var(--ink-2); font-size: 0.93rem; }
.hack .award {
  margin-top: auto; align-self: flex-start;
  font: 500 0.78rem var(--mono); color: var(--accent);
  background: var(--accent-soft); border-radius: 0; padding: 4px 10px;
}

/* ---------- footer ---------- */
.footer { padding-block: clamp(96px, 14vw, 180px) calc(48px + env(safe-area-inset-bottom, 0px)); }
.footer h2 { font-size: clamp(2.4rem, 6vw, 4.4rem); margin: 0 0 20px; letter-spacing: -0.03em; }
.footer p { color: var(--ink-2); font-size: 1.1rem; max-width: 40em; }
.colophon { font-size: 0.85rem !important; color: var(--ink-3) !important; margin-top: 48px; }

/* ---------- motion ---------- */
.rise { opacity: 0; transform: translateY(16px); animation: rise .9s var(--ease) forwards; }
.lede.rise { animation-delay: .12s; }
@keyframes rise { to { opacity: 1; transform: none; } }
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }
.carousel .slide.reveal { transition-delay: calc(var(--i, 0) * 70ms); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rise, .js .reveal { opacity: 1; transform: none; animation: none; transition: none; }
  .projects-track.ready .project:not(.current) { transform: none; }
}

/* ---------- post pages ---------- */
.post { max-width: 46rem; margin: 0 auto; padding-block: 56px 96px; }
.post h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin: 28px 0 6px; }
.post .back { font-size: 0.9rem; color: var(--ink-3); text-decoration: none; }
.post time { display: block; font: 0.85rem var(--mono); color: var(--ink-3); margin-bottom: 32px; }
.post .prose { color: var(--ink-2); font-size: 1.05rem; }
.post .prose h2, .post .prose h3 { color: var(--ink); }
.post .prose pre { background: var(--surface); border: 1px solid var(--line); border-radius: 0; padding: 16px; overflow-x: auto; font: 0.85rem var(--mono); }
.post .prose code { font-family: var(--mono); font-size: 0.9em; }
.post .prose img { border-radius: 0; }
