:root {
  --bg: #0a0b0d;
  --bg-2: #111215;
  --line: #24272c;
  --line-2: #3c4046;
  --text: #c8c4bb;
  --text-dim: #8a877f;
  --text-bright: #ece8df;
  --accent: #ff5a36;
  --header-bg: rgba(10, 11, 13, 0.82);
  --ghost-bg: #151619;
  --font: "Literata", Georgia, "Times New Roman", serif;
  --display: "Zodiak", Georgia, serif;
  --mono: "Martian Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1240px;
}

/* day theme: warm paper, charcoal ink */
:root[data-theme="day"] {
  --bg: #f3eee3;
  --bg-2: #ebe5d8;
  --line: #ddd4c4;
  --line-2: #c4b9a6;
  --text: #3d3832;
  --text-dim: #776f63;
  --text-bright: #1d1a17;
  --accent: #e4541f;
  --header-bg: rgba(243, 238, 227, 0.85);
  --ghost-bg: #ebe5d8;
}

/* day / night toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-left: clamp(14px, 2.8vw, 32px);
  padding: 9px 15px;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 13.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.theme-toggle:hover {
  color: var(--text-bright);
  border-color: var(--text-dim);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle .icon-sun,
:root[data-theme="day"] .theme-toggle .icon-moon {
  display: none;
}
:root[data-theme="day"] .theme-toggle .icon-sun {
  display: block;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a {
  color: inherit;
  text-decoration: none;
}
ul {
  list-style: none;
}
::selection {
  background: var(--accent);
  color: var(--bg);
}
:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 3px;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 100;
  background: var(--accent);
  color: var(--bg);
  padding: 6px 10px;
}
.skip:focus {
  left: 8px;
}

/* ---------- header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  border-bottom: 1px solid transparent;
  transition:
    background 0.3s,
    border-color 0.3s;
}
.site-header.scrolled {
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-color: var(--line);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-bright);
}
.brand img {
  image-rendering: pixelated;
}
nav ul {
  display: flex;
  gap: clamp(14px, 3vw, 32px);
}
nav a {
  font-family: var(--mono);
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  transition: color 0.2s;
}
nav a:hover,
nav a.active {
  color: var(--text-bright);
}
nav a.active::before {
  content: "■ ";
  color: var(--accent);
  font-size: 8px;
  vertical-align: 2px;
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding: 120px 0 clamp(64px, 12vh, 120px);
  overflow: hidden;
}
/* sketch-world flythrough lives on the right; soft oval mask fades its edges */
.stage {
  position: absolute;
  top: 64px;
  right: 0;
  bottom: 0;
  width: 64%;
}
.stage::before {
  /* keep the headline readable where it overlaps the scene */
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 30%;
  z-index: 1;
  background: linear-gradient(90deg, var(--bg) 15%, transparent);
  pointer-events: none;
}
#field {
  width: 100%;
  height: 100%;
  display: block;
  -webkit-mask-image: radial-gradient(
    ellipse 56% 56% at 50% 50%,
    #000 66%,
    transparent 100%
  );
  mask-image: radial-gradient(
    ellipse 56% 56% at 50% 50%,
    #000 66%,
    transparent 100%
  );
}
.hero::after {
  /* fade canvas into page */
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 22%;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
}
.hero-copy {
  position: relative;
  z-index: 2;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}
h1 {
  font-size: clamp(34px, 5.2vw, 68px);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--text-bright);
  max-width: 19ch;
  text-wrap: balance;
}
.hero-sub {
  margin-top: 24px;
  max-width: 52ch;
  color: var(--text-dim);
  font-size: 16px;
}
.hero-sub code {
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--text);
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 13.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 22px;
  background: var(--accent);
  color: var(--bg);
  border: 1px solid var(--accent);
  transition:
    transform 0.15s,
    background 0.2s,
    color 0.2s;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn-ghost {
  background: var(--ghost-bg);
  color: var(--text);
  border-color: var(--line-2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 1px 0 rgba(0, 0, 0, 0.5);
}
.btn-ghost:hover {
  color: var(--text-bright);
  border-color: var(--text-dim);
}
.scroll-hint {
  position: absolute;
  right: var(--gutter);
  bottom: 32px;
  z-index: 2;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  writing-mode: vertical-rl;
}
.scroll-hint::after {
  content: "";
  display: block;
  width: 1px;
  height: 48px;
  margin: 12px auto 0;
  background: linear-gradient(var(--text-dim), transparent);
  animation: drip 2s ease-in-out infinite;
}
@keyframes drip {
  0%,
  100% {
    transform: scaleY(0.4);
    transform-origin: top;
  }
  50% {
    transform: scaleY(1);
  }
}

/* ---------- sections ---------- */
.section {
  padding: clamp(72px, 12vw, 140px) 0;
  border-top: 1px solid var(--line);
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-bottom: 40px;
}
.section-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}
h2 {
  font-size: clamp(28px, 3.6vw, 44px);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-bright);
  line-height: 1.1;
}

/* list rows */
.rows {
  border-top: 1px solid var(--line);
}
.rows li {
  border-bottom: 1px solid var(--line);
}
.row {
  display: grid;
  grid-template-columns: 90px 1fr auto 24px;
  gap: 24px;
  align-items: baseline;
  padding: 24px 0;
  position: relative;
  transition:
    padding 0.25s ease,
    background 0.25s;
}
.row::before {
  /* accent sweep */
  content: "";
  position: absolute;
  left: 0;
  top: -1px;
  height: 1px;
  width: 0;
  background: var(--accent);
  transition: width 0.4s ease;
}
.row:hover {
  padding-left: 12px;
  background: linear-gradient(90deg, rgba(255, 90, 54, 0.05), transparent 60%);
}
.row:hover::before {
  width: 100%;
}
.row-year {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
}
.row-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.row-title {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-bright);
  letter-spacing: -0.01em;
}
.row-desc {
  color: var(--text-dim);
  max-width: 60ch;
}
.row-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.row-tags span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid var(--line-2);
  padding: 2px 8px;
}
.row-arrow {
  color: var(--text-dim);
  transition:
    color 0.2s,
    transform 0.2s;
}
.row:hover .row-arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}
.rows-compact .row {
  padding: 18px 0;
}
.rows-compact .row:hover {
  padding-left: 12px;
}
.rows-compact .row-title {
  font-size: 17px;
}

/* about */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(32px, 6vw, 96px);
}
.about-text p + p {
  margin-top: 16px;
}
.about-text {
  color: var(--text);
  max-width: 62ch;
}
.lead {
  font-size: clamp(19px, 2vw, 24px);
  line-height: 1.4;
  color: var(--text-bright);
}
.lead em {
  color: var(--accent);
  font-style: normal;
}
.facts {
  border-top: 1px solid var(--line);
}
.facts div {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.facts dt {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding-top: 3px;
}
.facts dd {
  color: var(--text-bright);
}
.link {
  color: var(--accent);
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px
    no-repeat;
  transition: background-size 0.3s;
}
.link:hover {
  background-size: 100% 1px;
}

/* contact */
.contact-big {
  font-size: clamp(26px, 4.4vw, 56px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-bright);
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
}
.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-row ul {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-row a,
.footer-row > span {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  transition: color 0.2s;
}
.footer-row a:hover {
  color: var(--text-bright);
}
.footer-row a span {
  margin-left: 3px;
}

/* ---------- grain ---------- */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 50;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(4) infinite;
}
@keyframes grain {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-3%, 2%);
  }
  50% {
    transform: translate(2%, -3%);
  }
  75% {
    transform: translate(-2%, -1%);
  }
}

/* ---------- reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.8s ease,
    transform 0.8s ease;
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .theme-label {
    display: none;
  }
  .stage {
    width: 100%;
    opacity: 0.45;
  }
  nav ul {
    gap: 14px;
  }
  .row {
    grid-template-columns: 1fr 20px;
    gap: 6px 12px;
  }
  .row-year {
    grid-column: 1;
  }
  .row-main {
    grid-column: 1;
  }
  .row-tags {
    grid-column: 1;
    justify-content: flex-start;
    margin-top: 6px;
  }
  .row-arrow {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
  }
  .about-grid {
    grid-template-columns: 1fr;
  }
  .scroll-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .grain,
  .scroll-hint::after {
    animation: none;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* headline: second sentence in the accent colour */
h1 em {
  font-style: normal;
  color: var(--accent);
  white-space: nowrap; /* keep the orange phrase on one line */
}
.header-row nav {
  margin-left: auto;
}

/* project rows: title links to the demo (or repo), plus explicit Code / Live demo buttons */
.row-project {
  grid-template-columns: 90px 1fr auto;
}
.row-project .row-title {
  width: fit-content;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.3s, color 0.2s;
}
.row-project .row-title:hover {
  color: var(--accent);
  background-size: 100% 1px;
}
.row-project .row-tags {
  justify-content: flex-start;
  margin-top: 10px;
}
.row-links {
  display: flex;
  gap: 8px;
  align-self: center;
}
.row-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.row-link:hover {
  color: var(--text-bright);
  border-color: var(--text-dim);
}
.row-link-demo {
  border-color: var(--accent);
  color: var(--accent);
}
.row-link-demo:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.more-link {
  display: inline-block;
  margin-top: 28px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
@media (max-width: 760px) {
  .row-project {
    grid-template-columns: 1fr;
  }
  .row-project .row-links {
    grid-column: 1;
    grid-row: auto;
    margin-top: 12px;
  }
}

/* ---------- multi-page: current page in the nav ---------- */
nav a[aria-current="page"] {
  color: var(--text-bright);
}
nav a[aria-current="page"]::before {
  content: "■ ";
  color: var(--accent);
  font-size: 8px;
  vertical-align: 2px;
}

/* ---------- sub-pages ---------- */
body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
body > main {
  flex: 1;
}
.page-section {
  border-top: 0;
  padding-top: clamp(130px, 18vh, 190px);
}
.page-head {
  margin-bottom: clamp(40px, 6vw, 72px);
  max-width: 760px;
}
.page-title {
  font-size: clamp(44px, 7vw, 88px);
  max-width: none;
  margin-bottom: 18px;
}
.page-intro {
  color: var(--text-dim);
  font-size: clamp(16px, 1.5vw, 19px);
  max-width: 60ch;
}
.sub-head {
  font-size: clamp(22px, 2.4vw, 30px);
  margin: clamp(56px, 8vw, 96px) 0 24px;
}
.home .hero {
  min-height: calc(100svh - 70px);
}

@media (max-width: 760px) {
  nav ul {
    gap: 12px;
  }
  nav a {
    font-size: 12px;
  }
  /* phones: menu drops to its own full-width row so every page stays reachable */
  .header-row {
    flex-wrap: wrap;
    height: auto;
    padding-top: 12px;
    padding-bottom: 10px;
    row-gap: 10px;
  }
  .header-row nav {
    order: 3;
    width: 100%;
    margin-left: 0;
  }
  .header-row nav ul {
    justify-content: space-between;
  }
  .theme-toggle {
    margin-left: auto;
  }
}

/* about: lowercase bio */
.bio p {
  font-size: clamp(16px, 1.35vw, 18px);
  line-height: 1.75;
  color: var(--text);
}
.bio p + p {
  margin-top: 20px;
}

/* pages that should fit in one screen (About): sizes scale with viewport height, no scrolling */
.page-fit .page-section {
  padding-top: calc(clamp(84px, 13vh, 130px) * var(--fit, 1));
  padding-bottom: calc(clamp(24px, 4vh, 48px) * var(--fit, 1));
}
.page-fit .page-head {
  margin-bottom: calc(clamp(18px, 3.5vh, 40px) * var(--fit, 1));
}
.page-fit .page-title {
  font-size: calc(clamp(38px, min(6vw, 8vh), 76px) * var(--fit, 1));
  margin-bottom: clamp(6px, 1.2vh, 14px);
}
.page-fit .page-intro {
  font-size: clamp(14px, 1.9vh, 17px);
}
.page-fit .bio p {
  font-size: calc(clamp(14px, min(1.25vw, 1.95vh), 17px) * var(--fit, 1));
  line-height: 1.6;
}
.page-fit .bio p + p {
  margin-top: clamp(10px, 1.8vh, 18px);
}
.page-fit .facts div {
  padding: clamp(8px, 1.4vh, 14px) 0;
}
.page-fit + .site-footer {
  padding: 18px 0;
}

/* ---------- type: Zodiak for display, Literata for reading, Martian Mono for labels ---------- */
body {
  font-size: 17px;
  line-height: 1.6;
}
h1,
h2,
.page-title,
.row-title,
.contact-big,
.lead,
.brand span {
  font-family: var(--display);
  font-optical-sizing: auto;
}
h1,
.page-title {
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.04;
}
h2,
.contact-big {
  font-weight: 400;
  letter-spacing: -0.015em;
}
.row-title {
  font-weight: 500;
  letter-spacing: -0.005em;
}
.brand span {
  font-weight: 500;
  letter-spacing: 0;
}
h1 em,
.lead em {
  font-style: italic;
}
.hero-sub {
  font-style: italic;
  font-size: clamp(17px, 1.5vw, 20px);
}

/* ---------- research: poster ---------- */
:root {
  --s1: #e8572a; /* spiking net (validated pair, light + dark) */
  --s2: #3f97c0; /* ResNet-8 */
}
.poster {
  margin: 0;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  padding: clamp(20px, 3vw, 40px);
}
.poster-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
  margin-bottom: 24px;
}
.poster-kicker {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.poster-title {
  font-size: clamp(26px, 3.4vw, 44px);
  max-width: 24ch;
  line-height: 1.08;
}
.poster-by {
  margin-top: 10px;
  color: var(--text-dim);
  font-style: italic;
}
.poster-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(20px, 3vw, 40px);
}
.poster-col h3 {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-bright);
  margin: 22px 0 10px;
}
.poster-col h3:first-child {
  margin-top: 0;
}
.poster-col h3 span {
  color: var(--accent);
  margin-right: 6px;
}
.poster-col p {
  font-size: 15.5px;
  color: var(--text);
}
.poster-col p.small {
  font-size: 14px;
  color: var(--text-dim);
  margin-top: 8px;
}
.poster-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.poster-stats div {
  border: 1px solid var(--line);
  padding: 10px;
  background: var(--bg);
}
.poster-stats b {
  display: block;
  font-family: var(--display);
  font-weight: 500;
  font-size: 22px;
  color: var(--text-bright);
  line-height: 1.1;
}
.poster-stats span {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.35;
  display: block;
  margin-top: 4px;
}
.chart-cap {
  font-family: var(--mono);
  font-size: 11px !important;
  letter-spacing: 0.04em;
  color: var(--text-dim) !important;
  margin: 14px 0 4px;
}
.chart-cap i {
  font-style: normal;
  opacity: 0.75;
}
.chart,
.diagram {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
.chart text,
.diagram text {
  font-family: var(--mono);
  font-size: 10.5px;
  fill: var(--text);
}
.chart .ax {
  fill: var(--text-dim);
}
.chart .val,
.chart .lbl {
  fill: var(--text-bright);
}
.chart .grid {
  stroke: var(--line);
  stroke-width: 1;
}
.chart rect.s1,
.chart .pt.s1 {
  fill: var(--s1);
}
.chart rect.s2,
.chart .pt.s2 {
  fill: var(--s2);
}
.chart .pt {
  stroke: var(--bg-2);
  stroke-width: 2;
  r: 3;
  cursor: default;
}
.chart .pt:hover {
  r: 5;
}
.chart .line {
  fill: none;
  stroke-width: 2;
}
.chart .line.s1 {
  stroke: var(--s1);
}
.chart .line.s2 {
  stroke: var(--s2);
}
.chart rect:hover {
  opacity: 0.8;
}
.diagram .box rect {
  fill: var(--bg);
  stroke: var(--line-2);
}
.diagram .box.hot rect {
  stroke: var(--accent);
}
.diagram .sm {
  font-size: 9px;
  fill: var(--text-dim);
}
.diagram .muted {
  font-style: italic;
}
.diagram .s2t {
  fill: var(--s2);
}
.diagram .arrow {
  stroke: var(--text-dim);
  stroke-width: 1.4;
  fill: none;
  marker-end: none;
}
.diagram .arrow.back {
  stroke: var(--s2);
  stroke-dasharray: 4 3;
}
.legend {
  font-family: var(--mono);
  font-size: 11px !important;
  color: var(--text-dim) !important;
  margin-top: 8px;
}
.legend .key {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin: 0 6px 0 12px;
  vertical-align: -1px;
}
.legend .key:first-child {
  margin-left: 0;
}
.legend .key.s1 {
  background: var(--s1);
}
.legend .key.s2 {
  background: var(--s2);
}
.poster-list {
  list-style: none;
  font-size: 15px;
  color: var(--text);
}
.poster-list li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 8px;
}
.poster-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--accent);
}
.poster-foot {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}
.chart-tip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: var(--bg);
  border: 1px solid var(--line-2);
  color: var(--text-bright);
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 9px;
  opacity: 0;
  transition: opacity 0.12s;
}
.chart-tip.on {
  opacity: 1;
}

/* ---------- research: lab notes ---------- */
.notes {
  list-style: none;
  border-left: 1px solid var(--line-2);
  margin-left: 6px;
}
.note {
  position: relative;
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 24px;
  padding: 0 0 36px 28px;
}
.note::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 6px;
  width: 9px;
  height: 9px;
  background: var(--accent);
}
.note time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  padding-top: 3px;
}
.note h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 22px;
  color: var(--text-bright);
  margin-bottom: 8px;
}
.note-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--line-2);
  padding: 1px 7px;
  margin-left: 8px;
  vertical-align: 3px;
}
.note p {
  color: var(--text);
  max-width: 68ch;
}
.note p + p {
  margin-top: 10px;
}

/* ---------- research: next experiments ---------- */
.small-intro {
  margin: -12px 0 20px;
  font-size: 15px;
}
.plans {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.plan {
  border: 1px dashed var(--line-2);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plan h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 19px;
  color: var(--text-bright);
}
.plan p {
  color: var(--text-dim);
  font-size: 15px;
  flex: 1;
}
.plan-status {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.row-static {
  grid-template-columns: 220px 1fr;
}
.row-static:hover {
  padding-left: 0;
  background: none;
}
.row-static:hover::before {
  width: 0;
}

@media (max-width: 960px) {
  .poster-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .note {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .poster-stats {
    grid-template-columns: 1fr;
  }
  .row-static {
    grid-template-columns: 1fr;
  }
}

/* research list + poster page */
.tag-status {
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}
.back-link {
  display: inline-block;
  margin-bottom: 24px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.back-link:hover {
  color: var(--accent);
}


/* research: briefing panel + proposal tables */
button.row-link {
  background: transparent;
  cursor: pointer;
}
button.row-link[aria-expanded="true"] {
  color: var(--text-bright);
  border-color: var(--text-dim);
}
.brief {
  margin: 0 0 24px 114px;
  padding: 16px 20px;
  border-left: 2px solid var(--accent);
  background: var(--bg-2);
  display: grid;
  gap: 8px;
  max-width: 760px;
}
.brief div {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 16px;
}
.brief dt {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-top: 4px;
}
.brief dd {
  color: var(--text);
  font-size: 16px;
}
.poster-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 4px;
}
.poster-table th,
.poster-table td {
  border-bottom: 1px solid var(--line);
  padding: 7px 6px;
  text-align: left;
  font-weight: 400;
}
.poster-table thead th {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.poster-table tbody th {
  color: var(--text);
}
.poster-table td {
  color: var(--text-dim);
  font-family: var(--mono);
  text-align: center;
}
@media (max-width: 760px) {
  .brief {
    margin-left: 0;
  }
  .brief div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
.brief[hidden] {
  display: none;
}

/* ---------- interactive graphics (fx.js) ---------- */
.fx-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 70;
}
main.page {
  position: relative;
}
.fx-field {
  position: absolute;
  top: 84px;
  right: var(--gutter);
  width: min(48vw, 620px);
  height: min(380px, 48vh);
  pointer-events: none;
  opacity: 0.8;
  z-index: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 18%);
  mask-image: linear-gradient(90deg, transparent 0, #000 18%);
}
main.page > .page-section {
  position: relative;
  z-index: 1;
}
@media (max-width: 760px) {
  .fx-field {
    width: 100%;
    opacity: 0.4;
  }
}

.poster-table.ref td {
  font-family: var(--font);
  color: var(--text);
  text-align: left;
}
.poster-foot {
  line-height: 1.7;
}

/* poster stat tiles: one per row, big number + label (reads well in narrow columns) */
.poster-stats {
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 14px;
}
.poster-stats div {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: baseline;
  gap: 12px;
  padding: 10px 12px;
}
.poster-stats span {
  margin-top: 0;
}
.poster-table td {
  white-space: nowrap;
}

/* signal line under inner-page titles (fx.js) */
.fx-signal {
  display: block;
  width: 100%;
  height: 40px;
  margin-top: 26px;
  pointer-events: none;
}
.fx-field {
  display: none;
}
.page-head .fx-signal {
  width: calc(min(var(--max), 100vw) - 2 * var(--gutter));
  max-width: none;
}

/* interdimensional portal (fx.js): top-right of inner pages, links to a random page */
.portal {
  position: absolute;
  top: clamp(110px, 15vh, 160px);
  right: var(--gutter);
  width: clamp(110px, 13vw, 170px);
  aspect-ratio: 1;
  display: block;
  z-index: 2;
  border-radius: 50%;
}
.portal canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.portal:focus-visible {
  outline-offset: 6px;
}
.fx-signal,
.fx-overlay {
  display: none;
}
@media (max-width: 760px) {
  .portal {
    width: 84px;
    top: 120px;
  }
}
.page-fit .portal {
  top: clamp(80px, 11vh, 110px);
  width: clamp(100px, 10vw, 140px);
}

/* interdimensional travel strip (fx.js): across the top of inner pages, behind nothing clickable */
.portal {
  display: none;
}
.fx-travel {
  position: absolute;
  top: clamp(70px, 10vh, 110px);
  left: 0;
  width: 100%;
  height: 240px;
  pointer-events: none;
  z-index: 0;
}
.page-section > .wrap {
  position: relative;
  z-index: 1; /* text stays above the travel strip */
}

/* living spiking network (fx.js): behind the title on inner pages */
.fx-travel {
  display: none;
}
.fx-net {
  position: absolute;
  top: 64px;
  right: 0;
  width: min(60vw, 820px);
  height: min(500px, 60vh);
  pointer-events: none;
  z-index: 0;
  -webkit-mask-image: radial-gradient(ellipse 65% 65% at 62% 46%, #000 45%, transparent 100%);
  mask-image: radial-gradient(ellipse 65% 65% at 62% 46%, #000 45%, transparent 100%);
}
@media (max-width: 760px) {
  .fx-net {
    width: 100%;
    opacity: 0.45;
  }
}
.page-fit .fx-net {
  height: min(230px, 26vh);
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 60% 45%, #000 40%, transparent 100%);
  mask-image: radial-gradient(ellipse 60% 70% at 60% 45%, #000 40%, transparent 100%);
}
/* calmer network */
.fx-net {
  opacity: 0.5;
}

/* ---------- everything lowercase ---------- */
html,
body,
body *:not(canvas) {
  text-transform: lowercase !important;
}
/* units keep their case so numbers stay correct (mW vs mw, M = million) */
.poster-stats b,
.poster-table td,
.chart .val {
  text-transform: none !important;
}

/* bigger footer links */
.footer-row ul {
  gap: 28px;
}
.footer-row ul a {
  font-size: 15px;
  padding: 6px 0;
}

/* Zodiak / Literata / Martian Mono tuning */
h1,
.page-title {
  letter-spacing: -0.01em;
}
nav a,
.theme-toggle,
.btn,
.row-link,
.eyebrow,
.row-tags span {
  font-weight: 350;
  letter-spacing: 0.02em;
}
body {
  font-size: 16.5px;
}

/* ---------- font set: Gloock + Brygada 1918 + Spline Sans Mono (chosen) ---------- */
:root {
  --display: "Gloock", Georgia, serif;
  --font: "Brygada 1918", Georgia, serif;
  --mono: "Spline Sans Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
h1,
.page-title,
h2,
.poster-title,
.contact-big {
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.04;
}
.row-title,
.note h3,
.plan h3,
.brand span {
  font-family: "Brygada 1918", Georgia, serif;
  font-weight: 600;
  letter-spacing: 0;
}
nav a,
.theme-toggle,
.btn,
.row-link,
.eyebrow,
.row-tags span {
  font-weight: 400;
  letter-spacing: 0.02em;
}
body {
  font-size: 17px;
}
.hero-sub {
  font-style: italic;
}
/* end font set */

/* ---------- writing: generated article pages (scripts/sync-notion.mjs) ---------- */
.empty-note {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-dim);
}
.article-head {
  max-width: 760px;
  margin-bottom: clamp(32px, 5vw, 56px);
}
.prose {
  max-width: 68ch;
  font-size: 18px;
  line-height: 1.75;
  color: var(--text);
}
.prose > * + * {
  margin-top: 1.1em;
}
.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--display);
  font-weight: 400;
  color: var(--text-bright);
  line-height: 1.2;
  margin-top: 1.8em;
}
.prose h2 { font-size: 30px; }
.prose h3 { font-size: 24px; }
.prose h4 { font-size: 20px; }
.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.prose ul,
.prose ol {
  padding-left: 1.3em;
}
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: 0.35em; }
.prose blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 18px;
  font-style: italic;
  color: var(--text-bright);
}
.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--bg-2);
  padding: 1px 5px;
}
.prose pre {
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 16px;
  overflow-x: auto;
}
.prose pre code {
  background: none;
  padding: 0;
  text-transform: none !important;
}
.prose figure img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--line);
}
.prose figcaption {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2em 0;
}
.prose .callout {
  display: flex;
  gap: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 14px 16px;
}
.prose details summary {
  cursor: pointer;
  color: var(--text-bright);
}

/* ---------- phones: hero text on top, animation in its own block below ---------- */
@media (max-width: 760px) {
  .hero {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-height: auto;
    padding: 132px 0 40px;
  }
  .hero-copy {
    order: 1;
  }
  .stage {
    order: 2;
    position: relative;
    inset: auto;
    width: 100%;
    height: min(62vh, 480px);
    margin-top: 28px;
    opacity: 1;
  }
  .stage::before {
    display: none; /* no fade needed: nothing sits on top of it */
  }
  .hero::after {
    height: 14%;
  }
}

/* phones: About scrolls like other pages, with normal-size text */
@media (max-width: 760px) {
  .page-fit .page-section {
    padding-top: 150px;
    padding-bottom: 48px;
  }
  .page-fit .bio p {
    font-size: 16px;
    line-height: 1.7;
  }
  .page-fit .page-title {
    font-size: 48px;
  }
  .row-link {
    font-size: 13px;
    padding: 10px 14px; /* comfortable tap targets */
  }
  .page-section {
    padding-top: 150px; /* clears the two-row phone header */
  }
  .poster {
    padding: 18px;
  }
}
@media (max-width: 760px) {
  .fx-net {
    top: 120px;
    height: 220px;
    opacity: 0.35;
    -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
    mask-image: linear-gradient(180deg, #000 55%, transparent);
  }
}
@media (max-width: 760px) {
  .poster-stats div {
    grid-template-columns: 118px 1fr;
  }
  .poster-stats b {
    font-size: 19px;
    white-space: nowrap;
  }
}

/* about: résumé button beside the title (phones only) */
.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.resume-btn {
  display: none;
}

@media (max-width: 760px) {
  .resume-btn {
    display: inline-flex;
    flex-shrink: 0;
  }
  .arr {
    display: none; /* no arrow after "download pdf" on phones */
  }

  /* home: headline → animation → buttons */
  .hero-copy {
    display: contents;
  }
  .hero-copy > * {
    order: 1;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
  }
  .hero-copy > .hero-cta {
    order: 3;
    margin-top: 8px;
  }
  .hero-copy > h1 {
    max-width: none;
  }
}
@media (max-width: 760px) {
  .hero-copy > * {
    position: relative;
    z-index: 2; /* stay above the hero's bottom fade */
  }
  .hero-copy > .hero-cta {
    margin-top: 24px;
  }
}
