:root {
  --bg: #F2EFE6;
  --paper: #FAF7EF;
  --ink: #111111;
  --ink-2: #3A3A38;
  --ink-3: #8A8A84;
  --hair: rgba(17, 17, 17, 0.14);
  --hair-strong: rgba(17, 17, 17, 0.32);

  --red: #C22118;       /* NERV / Eva title red */
  --red-deep: #8A130C;

  --font-display: "Shippori Mincho B1", "Shippori Mincho", "Kaisei HarunoUmi", "Noto Serif JP", serif;
  --font-jp: "Noto Sans JP", "Noto Serif JP", "Shippori Mincho B1", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-body: "Inter Tight", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ─── Accessibility ─────────────────────────────── */

/* Hard-hide noscript content from JS-enabled browsers (the preview/babel
   environment can render <noscript> children as plain text) */
noscript { display: none !important; }

/* Skip-to-content link — invisible until focused */
.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 10000;
  background: var(--ink);
  color: #FAF7EF;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 10px 14px;
  text-decoration: none;
  border: 2px solid var(--red);
  transition: top 140ms ease;
}
.skip-link:focus,
.skip-link:focus-visible {
  top: 12px;
  outline: none;
}

/* Custom keyboard-focus ring — red, only visible to keyboard users */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
  border-radius: 1px;
}
.hero-video:focus-visible {
  outline-offset: 4px;
}

/* Print stylesheet — clean, ink-saving */
@media print {
  .topbar, .hero-video-figure, .pipeline, .footer .footer-mark { display: none !important; }
  html, body, .page { background: white !important; color: black !important; }
  .hero-name, .hero-name .red { color: black !important; }
  .card { break-inside: avoid; box-shadow: none !important; border: 1px solid #888 !important; }
  a { color: black !important; text-decoration: underline; }
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 10px;
    color: #555;
  }
}

/* subtle paper grain */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(rgba(0,0,0,0.025) 1px, transparent 1px);
  background-size: 3px 3px;
  z-index: 1;
  opacity: 0.5;
}

.mono { font-family: var(--font-mono); letter-spacing: 0.04em; }
.jp   { font-family: var(--font-jp); }
.serif { font-family: var(--font-display); }
.small { font-size: 11px; }
.muted { color: var(--ink-3); }

.page {
  min-height: 100vh;
  padding: 48px 40px 96px;
  position: relative;
  z-index: 2;
}
.page-inner {
  max-width: 1180px;
  margin: 0 auto;
}

/* ---------- TOP BAR ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-bottom: 72px;
  border-bottom: none;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 20px; }
.topbar .live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--red);
}
.topbar .live::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--red);
  animation: blink 1.6s infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Pipeline status — bench → sequence → model → agent → bench */
.pipeline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.pipe-node {
  color: var(--ink-3);
  position: relative;
  padding: 2px 0;
  transition: color 280ms ease;
}
.pipe-node.on {
  color: var(--red);
}
.pipe-node.on::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  width: 5px; height: 5px;
  margin-top: -2.5px;
  background: var(--red);
  border-radius: 50%;
  animation: pipe-pulse 1.4s ease-out infinite;
}
.pipe-arrow {
  color: var(--hair-strong);
  font-size: 10px;
}
@keyframes pipe-pulse {
  0%   { transform: scale(0.6); opacity: 0.4; }
  40%  { transform: scale(1);   opacity: 1; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ---------- HERO ---------- */
.hero {
  padding-bottom: 80px;
  border-bottom: 1px solid var(--ink);
  margin-bottom: 56px;
  position: relative;
}
.hero-lead {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 20px;
}
.hero-lead .rule { display: inline-block; width: 36px; height: 1px; background: var(--red); }

/* Eva-style title — large bold serif, no vertical stretch */
.hero-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(88px, 14vw, 176px);
  line-height: 0.88;
  letter-spacing: -0.025em;
  margin: 0 0 12px;
  color: var(--ink);
  font-feature-settings: "palt";
  display: block;
}
.hero-name .red { color: var(--red); }

/* Hero top row — name on left, looping video on right */
.hero-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.78fr);
  align-items: end;
  gap: 48px;
}
.hero-top .hero-name { margin-bottom: 0; }

.hero-video-figure {
  margin: 0;
  align-self: end;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-video {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0d0d0d;
  border: 1px solid var(--ink);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.hero-video:hover {
  transform: translate(-1px, -1px);
  box-shadow: 6px 6px 0 var(--red);
}
.hero-video video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-video::after {
  content: "";
  position: absolute;
  top: 12px; right: 12px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(194,33,24,0.6);
  animation: hero-rec 1.6s ease-out infinite;
}
@keyframes hero-rec {
  0%   { box-shadow: 0 0 0 0 rgba(194,33,24,0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(194,33,24,0); }
  100% { box-shadow: 0 0 0 0 rgba(194,33,24,0); }
}

.hero-video-caption {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  line-height: 1.45;
}
.hero-video-caption .muted { color: var(--ink-3); }

/* Reduced motion: pause the loop, leave the poster up */
@media (prefers-reduced-motion: reduce) {
  .hero-video video { display: none; }
  .hero-video {
    background: #0d0d0d url("media/lab-runner-poster.jpg") center/cover no-repeat;
  }
  .hero-video::after { animation: none; }
}

@media (max-width: 820px) {
  .hero-top { grid-template-columns: 1fr; gap: 28px; align-items: stretch; }
  .hero-video-figure { display: none; }
}

/* Japanese / Latin transliteration subtitle */
.hero-jp {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(13px, 1.2vw, 15px);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 40px 0 32px;
  padding-left: 2px;
}
.hero-jp .jp {
  font-family: var(--font-jp);
  font-weight: 500;
  font-size: 1.25em;
  letter-spacing: 0.35em;
  text-transform: none;
}

.hero-body {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 56px;
  align-items: start;
  position: relative;
}
.hero-body::before {
  content: "";
  position: absolute;
  top: 4px; bottom: 4px;
  left: calc(60% + 8px);
  width: 1px;
  background: var(--ink);
  opacity: 0.5;
}
@media (max-width: 820px) {
  .hero-body { grid-template-columns: 1fr; gap: 32px; }
  .hero-body::before { display: none; }
}

.hero-bio {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: clamp(17px, 1.5vw, 20px);
  line-height: 1.55;
  color: var(--ink);
  max-width: 620px;
  margin: 0 0 16px;
  text-wrap: pretty;
}
.hero-bio strong {
  font-weight: 600;
  color: var(--red);
  letter-spacing: 0.005em;
}
.hero-bio-secondary {
  font-size: clamp(15px, 1.25vw, 17px);
  color: var(--ink-2);
  margin: 0 0 32px;
  padding-left: 18px;
  border-left: 2px solid var(--hair);
}

.hero-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hero-meta .row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed var(--hair); gap: 24px; }
.hero-meta .label { color: var(--ink-3); }
.hero-meta .val { color: var(--ink); }
.hero-meta .val.red { color: var(--red); }
.hero-meta a { color: var(--red); text-decoration: none; border-bottom: 1px solid var(--red); padding-bottom: 1px; }

.hero-avatar-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.hero-avatar {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 280px;
  border: 1px solid var(--ink);
  object-fit: cover;
  display: block;
}
.hero-avatar-caption {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: flex; justify-content: space-between;
  max-width: 280px;
  padding-top: 4px;
  border-top: 1px solid var(--ink);
}
.hero-avatar-caption .r { color: var(--red); }

/* ---------- SECTION ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 36px;
  gap: 16px;
  padding-top: 8px;
}
.section-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(44px, 5vw, 72px);
  line-height: 0.95;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
  display: flex; align-items: baseline; gap: 18px;
}
.section-head .section-title .ep {
  font-family: var(--font-jp);
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  letter-spacing: 0.16em;
  color: var(--red);
  text-transform: none;
  white-space: nowrap;
}
.section-meta {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13.5px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-2);
}


/* ---------- GRID ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}
@media (max-width: 1000px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .grid { grid-template-columns: 1fr; } }

/* ---------- CARD ---------- */
.card {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--ink);
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.25s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 4px 4px 0 var(--ink);
}

.card-banner {
  position: relative;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}
.card-og {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--paper);
}

.card-cat-tag {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
  background: var(--paper);
  padding: 9px 14px;
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
  line-height: 1;
}
.card-cat-jp {
  font-family: var(--font-jp);
  letter-spacing: 0.12em;
  color: var(--ink-3);
  font-size: 9.5px;
  margin-left: 2px;
}

.card-body {
  padding: 22px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  background: var(--paper);
}
.card-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
  line-height: 1.1;
  word-break: break-word;
}
.card-blurb {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
}
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px dashed var(--hair);
}
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 2px 7px;
  border: 1px solid var(--ink);
  color: var(--ink-2);
  background: transparent;
}
.card-arrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--red);
}

/* ---------- FOOTER ---------- */
.footer {
  margin-top: 88px;
  padding-top: 24px;
  border-top: 1px solid var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.footer .kbd {
  padding: 2px 6px;
  background: var(--bg);
  border: 1px solid var(--ink);
  color: var(--red);
}

/* ---------- density ---------- */
.page[data-density="compact"] { padding: 32px 32px 64px; }
.page[data-density="compact"] .topbar { padding-bottom: 44px; }
.page[data-density="compact"] .hero { padding-bottom: 56px; margin-bottom: 40px; }
.page[data-density="compact"] .hero-jp { margin: 24px 0 20px; }
.page[data-density="compact"] .grid { gap: 18px; }
.page[data-density="compact"] .card-body { padding: 16px 16px 14px; }
.page[data-density="compact"] .section-head { margin-bottom: 24px; }

@media (max-width: 640px) {
  .page { padding: 28px 20px 64px; }
  .topbar { padding-bottom: 44px; flex-wrap: wrap; gap: 12px; }
}
