/* Layout: a drive-datasheet page. Left-aligned editorial column, numbered
   research sections, and project "spec sheets" with mono label/value rows. */
:root {
  --paper: #f4f5f8;
  --surface: #ffffff;
  --ink: #15171c;
  --ink-2: #4a505c;
  --rule: #d8dbe2;
  --crimson: #a51c30;
  --crimson-tint: #f6e6e9;

  --display: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --step--1: 0.8125rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  --step-4: clamp(2.25rem, 1.3rem + 4vw, 4.25rem);

  --gutter: 16px;
  --wrap: 1160px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1014;
    --surface: #161920;
    --ink: #e7e9ee;
    --ink-2: #a2a8b4;
    --rule: #2b303a;
    --crimson: #e35d71;
    --crimson-tint: #351820;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #0e1014;
  --surface: #161920;
  --ink: #e7e9ee;
  --ink-2: #a2a8b4;
  --rule: #2b303a;
  --crimson: #e35d71;
  --crimson-tint: #351820;
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; }

a { color: inherit; text-decoration-color: var(--crimson); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--crimson); }
a:focus-visible, .button:focus-visible { outline: 2px solid var(--crimson); outline-offset: 3px; border-radius: 2px; }

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

h1, h2, h3 {
  font-family: var(--display);
  line-height: 1.1;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0;
}

p { margin: 0; }

.label {
  font-family: var(--mono);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 12px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.wordmark span { font-weight: 400; color: var(--ink-2); }
.wordmark:hover { color: var(--ink); }

.mark { width: 22px; height: 22px; flex: none; }
.mark rect { fill: var(--ink); }
.mark .hot { fill: var(--crimson); }

.site-nav { display: flex; gap: 4px 20px; flex-wrap: wrap; justify-content: flex-end; }
.site-nav a {
  font-family: var(--mono);
  font-size: var(--step--1);
  text-decoration: none;
  color: var(--ink-2);
}
.site-nav a:hover { color: var(--crimson); }

.site-nav a[aria-current="true"] { color: var(--crimson); text-decoration: underline; text-underline-offset: 6px; }

@media (max-width: 760px) {
  html { scroll-padding-top: 104px; }
  .site-header .wrap { flex-wrap: wrap; row-gap: 6px; padding-block: 10px 8px; }
  .site-nav {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 18px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { white-space: nowrap; padding-block: 4px; }
}

/* ---------- Hero ---------- */

.hero { padding-block: clamp(36px, 5.5vw, 72px) 8px; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.25rem, 1.2rem + 2.6vw, 3.25rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.022em;
  margin-block: 16px 22px;
}

.hero .lede { font-size: var(--step-1); line-height: 1.5; max-width: 34em; color: var(--ink); }
.hero .lede + p { margin-top: 16px; max-width: 38em; color: var(--ink-2); }

/* Spec sheet: label/value rows in the style of a drive datasheet. */
.spec {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--ink);
  min-width: 0;
}
.spec header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--rule);
}
.spec dl { margin: 0; }
.spec .group {
  padding: 10px 18px 4px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--crimson);
}
.spec .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 9px 18px;
  border-bottom: 1px dashed var(--rule);
}
.spec .row:last-child { border-bottom: 0; }
.spec dt { font-size: 0.95rem; line-height: 1.35; color: var(--ink-2); min-width: 0; }
.spec dt .sys { font-family: var(--display); font-weight: 600; color: var(--ink); }
.spec dd {
  margin: 0;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.spec footer {
  padding: 10px 18px 14px;
  border-top: 1px solid var(--rule);
  font-size: var(--step--1);
  color: var(--ink-2);
  line-height: 1.45;
}

/* Thrust index */
.thrusts {
  list-style: none;
  margin: clamp(32px, 5vw, 56px) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
}
.thrusts li { border-right: 1px solid var(--rule); min-width: 0; }
.thrusts li:last-child { border-right: 0; }
.thrusts a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  padding: 16px 18px 20px 0;
  margin-left: 18px;
  text-decoration: none;
}
.thrusts li:first-child a { margin-left: 0; }
.thrusts .num { font-family: var(--mono); font-size: var(--step--1); color: var(--crimson); }
.thrusts .tt { font-family: var(--display); font-weight: 600; font-size: 1.12rem; line-height: 1.2; }
.thrusts .d { font-size: 0.95rem; line-height: 1.45; color: var(--ink-2); }
.thrusts .tt::after { content: " ↓"; font-family: var(--mono); font-weight: 400; color: var(--ink-2); transition: color 0.15s; }
.thrusts a:hover .tt, .thrusts a:hover .tt::after { color: var(--crimson); }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .thrusts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .thrusts li:nth-child(2) { border-right: 0; }
  .thrusts li:nth-child(3) a { margin-left: 0; }
  .thrusts li:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
}
@media (max-width: 520px) {
  .thrusts { grid-template-columns: minmax(0, 1fr); }
  .thrusts li { border-right: 0; border-bottom: 1px solid var(--rule); }
  .thrusts a { margin-left: 0; padding-right: 0; }
}

/* ---------- Research sections ---------- */

.section { padding-block: clamp(48px, 7vw, 80px) 0; }

.section-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 24px;
  align-items: baseline;
  border-top: 2px solid var(--ink);
  padding-top: 18px;
  margin-bottom: clamp(28px, 4vw, 44px);
}
.section-head .num {
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--step-3);
  line-height: 1;
  color: var(--crimson);
  font-variant-numeric: tabular-nums;
}
.section-head h2 { font-size: var(--step-3); font-weight: 600; }
.section-head .chip { grid-column: 2; justify-self: start; }

.chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--rule);
  color: var(--ink-2);
  background: var(--surface);
  white-space: nowrap;
}
.chip.accent { border-color: var(--crimson); color: var(--crimson); background: var(--crimson-tint); }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}
@media (max-width: 900px) {
  .split { grid-template-columns: minmax(0, 1fr); }
}

.prose { display: flex; flex-direction: column; gap: 16px; max-width: 38em; min-width: 0; }
.prose .lede { font-size: var(--step-1); line-height: 1.5; }
.prose h3 { font-size: var(--step-1); font-weight: 600; margin-top: 8px; }
.prose.intro { margin-bottom: clamp(32px, 5vw, 48px); }

.findings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.findings li { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px; }
.findings li::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-top: 0.55em;
  background: var(--crimson);
}

.questions { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 8px; }
.questions li::marker { color: var(--crimson); font-family: var(--mono); }

/* Figures */
figure { margin: 0; min-width: 0; }
.figure {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 20px;
}
.figure figcaption {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-2);
}
.figure .label { display: block; margin-bottom: 14px; }

/* Tensor dedup grid */
.tensors { display: flex; flex-direction: column; gap: 12px; }
.tensors .trow { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 12px; }
.tensors .name { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-2); line-height: 1.25; }
.tensors .cells { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; }
.t {
  aspect-ratio: 1;
  max-width: 100%;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
}
.t.base { background: var(--ink); }
.t.dup { border: 1.5px dashed var(--ink-2); color: var(--ink-2); }
.t.delta { background: var(--crimson); color: var(--surface); }
.t.delta.sm { transform: scale(0.82); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; font-size: 0.85rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend .t { width: 16px; font-size: 0.6rem; }

@media (max-width: 420px) {
  .tensors .trow { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

/* Generation pipeline */
.pipeline { display: flex; flex-direction: column; gap: 0; }
.stage {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 4px 16px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  background: var(--paper);
}
.stage .k { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); padding-top: 3px; }
.stage .v { font-family: var(--display); font-weight: 600; font-size: 1.02rem; line-height: 1.3; }
.stage .m { grid-column: 2; font-family: var(--mono); font-size: 0.8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.stage.keep { border: 2px solid var(--crimson); background: var(--crimson-tint); }
.stage.keep .k { color: var(--crimson); }
.stage.costly .v::after { content: " · once"; font-weight: 400; color: var(--ink-2); }
.arrow { display: flex; align-items: center; gap: 10px; height: 30px; padding-left: 56px; font-family: var(--mono); font-size: 0.75rem; color: var(--ink-2); }
.arrow::before { content: ""; width: 1px; height: 100%; background: var(--ink-2); }

@media (max-width: 420px) {
  .stage { grid-template-columns: minmax(0, 1fr); }
  .stage .m { grid-column: 1; }
  .arrow { padding-left: 20px; }
}

/* Flash cell levels */
.cells { display: block; width: 100%; height: auto; }
.cells .lbl { font-family: var(--display); font-weight: 600; font-size: 17px; fill: var(--ink); }
.cells .sub { font-family: var(--mono); font-size: 11.5px; fill: var(--ink-2); }
.cells .axis { stroke: var(--rule); stroke-width: 1; }
.cells .bump { fill: var(--ink-2); opacity: 0.55; }
.cells .bump.q { fill: var(--crimson); opacity: 1; }

/* Project spec sheets */
.projects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: clamp(32px, 5vw, 48px);
}
@media (max-width: 900px) {
  .projects { grid-template-columns: minmax(0, 1fr); }
}

.project {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--ink);
  min-width: 0;
}
.project header { padding: 18px 20px 0; display: flex; flex-direction: column; gap: 8px; }
.project .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.project h3 { font-size: var(--step-2); font-weight: 600; }
.project .subtitle { font-size: 0.98rem; line-height: 1.4; color: var(--ink-2); font-style: italic; }
.project .body { padding: 14px 20px 18px; font-size: 1rem; line-height: 1.6; }
.project dl { margin: auto 0 0; border-top: 1px solid var(--rule); }
.project .row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: baseline;
  padding: 9px 20px;
  border-bottom: 1px dashed var(--rule);
}
.project dt { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); line-height: 1.4; }
.project dd { margin: 0; font-family: var(--mono); font-weight: 500; font-size: 0.95rem; text-align: right; font-variant-numeric: tabular-nums; }
.project dd.hl { color: var(--crimson); }
.project .links { display: flex; gap: 18px; padding: 12px 20px 16px; font-family: var(--mono); font-size: var(--step--1); }

/* Hardware sub-columns */
.media {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(28px, 5vw, 64px);
}
@media (max-width: 900px) {
  .media { grid-template-columns: minmax(0, 1fr); }
}
.medium { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.medium h3 { font-size: var(--step-2); font-weight: 600; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }

.mini-spec { margin: 0; border-top: 1px solid var(--ink); }
.mini-spec .row {
  display: grid;
  grid-template-columns: 9.5em minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 0.95rem;
  line-height: 1.45;
}
.mini-spec dt { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); padding-top: 2px; }
.mini-spec dd { margin: 0; }

/* ---------- Caching band ---------- */

.cache-band {
  margin-top: clamp(48px, 7vw, 80px);
  background: var(--ink);
  color: var(--paper);
}
.cache-band .wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px 32px;
  align-items: center;
  padding-block: 36px;
}
.cache-band .num { font-family: var(--display); font-weight: 600; font-size: var(--step-3); line-height: 1; color: var(--crimson); }
.cache-band h2 { font-size: var(--step-2); font-weight: 600; margin-bottom: 6px; }
.cache-band p { color: color-mix(in srgb, var(--paper) 78%, var(--ink)); max-width: 46em; }
.cache-band a:not(.button) { color: var(--paper); }

.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid currentColor;
}
.cache-band .button { color: var(--paper); }
.cache-band .button:hover { background: var(--paper); color: var(--ink); }

@media (max-width: 760px) {
  .cache-band .wrap { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Publications ---------- */

.pubs { display: flex; flex-direction: column; gap: clamp(28px, 4vw, 40px); }
.pub-group { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 12px 40px; }
.pub-group > h3 { font-size: 1.05rem; font-weight: 600; padding-top: 14px; }
@media (max-width: 760px) {
  .pub-group { grid-template-columns: minmax(0, 1fr); }
  .pub-group > h3 { padding-top: 0; }
}
.pub-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.pub {
  display: grid;
  grid-template-columns: 7.5em minmax(0, 1fr);
  gap: 4px 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}
.pub .venue { font-family: var(--mono); font-size: 0.85rem; font-weight: 500; color: var(--crimson); padding-top: 2px; font-variant-numeric: tabular-nums; }
.pub .title { font-weight: 600; line-height: 1.4; }
.pub .title a { text-decoration: none; }
.pub .title a:hover { text-decoration: underline; }
.pub .authors { grid-column: 2; font-size: 0.93rem; color: var(--ink-2); line-height: 1.5; }
.pub .authors b { color: var(--ink); font-weight: 600; }
.pub .award { grid-column: 2; justify-self: start; }
@media (max-width: 520px) {
  .pub { grid-template-columns: minmax(0, 1fr); }
  .pub .authors, .pub .award { grid-column: 1; }
}

/* ---------- People ---------- */

.people-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
@media (max-width: 900px) {
  .people-grid { grid-template-columns: minmax(0, 1fr); }
}
.panel { border-top: 1px solid var(--ink); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.panel h3 { font-size: var(--step-1); font-weight: 600; }
.roster { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.roster li { display: flex; flex-direction: column; }
.roster .who { font-weight: 600; }
.roster .role { font-size: 0.9rem; color: var(--ink-2); }
.panel p { font-size: 1rem; line-height: 1.55; }

/* ---------- Footer ---------- */

.site-footer { margin-top: clamp(56px, 8vw, 88px); border-top: 1px solid var(--rule); }
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 32px;
  padding-block: 28px 40px;
  font-family: var(--mono);
  font-size: var(--step--1);
  color: var(--ink-2);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }

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

/* Open questions under each medium */
.asks { border-top: 1px solid var(--ink); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.asks h4 { margin: 0; }
.asks .questions { font-size: 1rem; line-height: 1.5; }
.asks .questions li { padding-left: 4px; }
.asks .builds { font-size: 0.95rem; line-height: 1.5; color: var(--ink-2); padding-top: 12px; border-top: 1px dashed var(--rule); }
