/* ------------------------------------------------------------------
   Victoria Rojas — portfolio
   The page is treated as an engineering drawing sheet: a black
   zoned grid on white paper, a title block for contact details,
   and a single "redline" colour (USC cardinal) for interaction.
   ------------------------------------------------------------------ */

:root {
  --paper: #ffffff;
  --ink: #000000;
  --graphite: #5c5c5c;       /* secondary text, 6.9:1 on white */
  --construction: #d9d9d9;   /* faint lines, hatching */
  --redline: #990000;        /* focus, active controls, markup */

  --serif: "Crimson Pro", "Iowan Old Style", Georgia, serif;
  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;

  --line: 1px;
  --gutter: clamp(16px, calc(3 * var(--vw)), 40px);  /* margin that carries zone markers */
  --sheet-max: 1100px;
  /* 1vw, but stops growing past ~1050px windows so large screens keep the same proportions */
  --vw: min(1vw, 10.5px);
  --cols: 8;
  /* width of one square grid cell */
  --cell: calc((min(100vw, var(--sheet-max)) - 2 * var(--gutter) - (var(--cols) + 1) * var(--line)) / var(--cols));

  /* type scale (≈1.25) */
  --t-small: 0.8125rem;
  --t-body: 1.0625rem;
  --t-lead: 1.3125rem;
  --t-h3: 1.625rem;
  --t-h2: clamp(2rem, calc(3.4 * var(--vw)), 2.75rem);
}

@media (max-width: 720px) {
  :root { --cols: 4; }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.55;
  font-variation-settings: "wdth" 100;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--redline); }

:focus-visible { outline: 2px solid var(--redline); outline-offset: 2px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: absolute; left: var(--gutter); top: -40px; z-index: 10;
  background: var(--ink); color: var(--paper); padding: 6px 12px;
}
.skip-link:focus { top: 8px; }

/* page column */
.sheet {
  position: relative;
  max-width: var(--sheet-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ------------------------------------------------------------------
   Grid: black 1px lines are the gaps between white cells
   ------------------------------------------------------------------ */

.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-flow: row dense;
  gap: var(--line);
  background: var(--ink);
  border: var(--line) solid var(--ink);
}
.grid > * { background: var(--paper); min-width: 0; }

.cell { padding: clamp(10px, calc(1.2 * var(--vw)), 18px); }


/* ------------------------------------------------------------------
   Shared chrome: mark + nav (used on every page)
   ------------------------------------------------------------------ */

.mark { display: grid; place-items: center; text-decoration: none; color: var(--ink); }
.monogram { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.5rem; line-height: 1; letter-spacing: 0.02em; }
.mark:hover { color: var(--redline); }

.topnav {
  display: flex; align-items: flex-start; justify-content: flex-end;
  gap: 8px 20px; flex-wrap: wrap; font-size: 0.9375rem;
}
.topnav ul { display: flex; flex-wrap: wrap; gap: 4px 24px; margin: 0; padding: 0; list-style: none; }
.topnav a { text-decoration: none; }
.topnav a:hover, .topnav a[aria-current] { text-decoration: underline; }

/* ------------------------------------------------------------------
   Home: header + hero. Deliberately bare: a name, one line, and
   the grid doing the rest.
   ------------------------------------------------------------------ */

.site-header {
  display: flex; align-items: center; justify-content: space-between;
  height: 88px;
}
.site-header .mark { width: 46px; height: 46px; border: var(--line) solid var(--ink); }
.site-header .monogram { font-size: 1.3rem; padding-right: 2px; }

.hero-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: 1fr 1.25fr 0.9fr;
  height: clamp(520px, calc(100svh - 88px - var(--gutter)), 880px);
}
.hero-name { grid-column: 1 / span 3; grid-row: 2; }
.hero-role { grid-column: 1 / span 2; grid-row: 3; }

.hero-name {
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0 clamp(20px, calc(3 * var(--vw)), 48px) clamp(18px, calc(2.4 * var(--vw)), 36px);
}
.hello {
  margin: 0 0 0.35em;
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(1.25rem, calc(2 * var(--vw)), 1.75rem); color: var(--graphite);
}
.hero-name h1 {
  margin: 0;
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(3.25rem, calc(10.5 * var(--vw)), 9rem);
  line-height: 0.9; letter-spacing: -0.015em;
}
.hero-role {
  margin: 0; display: flex; align-items: flex-end;
  padding: clamp(20px, calc(3 * var(--vw)), 48px);
  font-family: var(--sans); font-weight: 300;
  font-size: clamp(1.25rem, calc(2 * var(--vw)), 1.75rem); line-height: 1.25;
}

@media (max-width: 720px) {
  .site-header { height: 72px; }
  .hero-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: 0.6fr auto auto 0.8fr;
    height: auto; min-height: calc(100svh - 72px - var(--gutter));
  }
  .hero-name { grid-column: 1 / span 2; padding: 64px 20px 20px; }
  .hero-role { grid-column: 1 / span 2; padding: 20px; }
}

.section-title {
  margin: 0 0 20px;
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: var(--t-h2); line-height: 1.05;
}
.home .section { margin-top: calc(var(--gutter) * 3.5); }

/* ------------------------------------------------------------------
   Sections
   ------------------------------------------------------------------ */

.section { margin-top: calc(var(--gutter) * 2); }

.section-grid > .section-head { grid-column: 1 / span 2; }
.section-grid > .section-body { grid-column: 3 / span 6; }
@media (max-width: 720px) {
  .section-grid > .section-head,
  .section-grid > .section-body { grid-column: 1 / -1; }
}

h2, .h2 {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: var(--t-h2); line-height: 1.05; margin: 0;
}
h3 {
  font-family: var(--serif); font-weight: 500; font-style: normal;
  font-size: var(--t-h3); line-height: 1.15; margin: 0 0 0.4em;
}
.section-head p { color: var(--graphite); margin: 0.75em 0 0; max-width: 28ch; }

.prose > * { max-width: 66ch; }
p.prose { max-width: 66ch; }
.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }
.lead { font-size: var(--t-lead); line-height: 1.45; }
.muted { color: var(--graphite); }

/* ------------------------------------------------------------------
   Work list (home)
   ------------------------------------------------------------------ */

.work-row {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--line); background: var(--ink);
  text-decoration: none; color: inherit;
}
.work-row > * { background: var(--paper); }
.work-row:hover { color: inherit; }
.work-row:hover .work-title { color: var(--redline); }
.work-row:hover .work-more { text-decoration: underline; }

.work-figure { grid-column: 1 / span 4; min-height: clamp(260px, calc(28 * var(--vw)), 420px); position: relative; overflow: hidden; }
.work-text {
  grid-column: 5 / span 4;
  display: flex; flex-direction: column; gap: 16px;
  padding: clamp(24px, calc(3 * var(--vw)), 48px);
}
.work-meta { margin: 0; font-size: 0.9375rem; color: var(--graphite); }
.work-title { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(2rem, calc(3.2 * var(--vw)), 3rem); line-height: 1.02; margin: 0; transition: color 0.15s; }
.work-text > p:not(.work-meta) { margin: 0; max-width: 46ch; }
.work-more { margin-top: auto; padding-top: 12px; font-size: 0.9375rem; }

@media (max-width: 720px) {
  .work-figure { grid-column: 1 / -1; min-height: 220px; }
  .work-text { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------------
   Placeholders: section-view hatching until real media arrives
   ------------------------------------------------------------------ */

.ph {
  position: relative; margin: 0; min-height: 180px; height: 100%;
  background:
    repeating-linear-gradient(135deg, transparent 0 9px, var(--construction) 9px 10px),
    var(--paper);
  display: flex; align-items: flex-end;
}
.ph > span {
  background: var(--paper); border: var(--line) solid var(--ink);
  margin: 12px; padding: 4px 10px; font-size: var(--t-small); line-height: 1.35;
  max-width: calc(100% - 24px);
}
figure.shot { margin: 0; }
figure.shot figcaption { font-size: var(--t-small); color: var(--graphite); margin-top: 8px; max-width: 60ch; }
figure.shot .ph { aspect-ratio: 16 / 10; height: auto; border: var(--line) solid var(--ink); }

/* ------------------------------------------------------------------
   About / experience / skills / awards
   ------------------------------------------------------------------ */

.about-grid > .about-text { grid-column: 1 / span 5; padding: clamp(24px, calc(3 * var(--vw)), 48px); }
.about-grid > .portrait { grid-column: 6 / span 3; padding: 0; min-height: clamp(300px, calc(30 * var(--vw)), 460px); }
@media (max-width: 720px) {
  .about-grid > * { grid-column: 1 / -1 !important; }
  .about-grid > .portrait { min-height: calc(var(--cell) * 3); }
}

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li {
  display: grid; grid-template-columns: minmax(9rem, 1fr) 3fr; gap: 6px 24px;
  padding: 14px 0; border-top: var(--line) solid var(--construction);
}
.rows > li:first-child { border-top: 0; padding-top: 0; }
.rows .when { color: var(--graphite); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.rows .what strong { font-weight: 500; }
.rows .what p { margin: 4px 0 0; color: var(--graphite); max-width: 62ch; }
@media (max-width: 720px) { .rows > li { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------
   Title block (footer / contact)
   ------------------------------------------------------------------ */

.titleblock { margin: calc(var(--gutter) * 2) auto var(--gutter); }
.tb-grid > * { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-height: calc(var(--cell) * 0.7); }
.tb-grid .tb-name { grid-column: 1 / span 3; grid-row: span 2; justify-content: flex-end; }
.tb-grid .tb-name .h2 { font-size: clamp(2.25rem, calc(4 * var(--vw)), 3.5rem); }
.tb-grid .tb-wide { grid-column: span 2; }
.tb-label { font-size: 0.75rem; color: var(--graphite); line-height: 1.2; }
.tb-value { font-size: 1rem; line-height: 1.35; overflow-wrap: anywhere; }
.tb-value a { text-decoration: none; }
.tb-value a:hover { text-decoration: underline; }
@media (max-width: 720px) {
  .tb-grid .tb-name { grid-column: 1 / -1; grid-row: auto; }
  .tb-grid .tb-wide, .tb-grid > * { grid-column: span 2; }
  .tb-grid .tb-name { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------------
   Project pages
   ------------------------------------------------------------------ */

.pagebar { margin-top: var(--gutter); }
.pagebar .mark { grid-column: 1; min-height: calc(var(--cell) * 0.6); }
.pagebar .home { grid-column: 2 / span 4; display: flex; align-items: center; font-family: var(--serif); font-style: italic; font-size: 1.5rem; text-decoration: none; }
.pagebar .topnav { grid-column: 6 / span 3; align-items: center; }
@media (max-width: 720px) {
  .pagebar .home { grid-column: 2 / span 3; }
  .pagebar .topnav { grid-column: 1 / -1; justify-content: flex-start; }
  .pagebar .topnav ul { justify-content: flex-start; }
}

.project-head > .ph-meta { grid-column: 1 / span 2; font-size: 0.9375rem; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; }
.project-head > .ph-meta .muted { font-size: var(--t-small); }
.project-head > .ph-title { grid-column: 3 / span 6; padding-top: calc(var(--cell) * 0.35); padding-bottom: calc(var(--cell) * 0.2); }
.project-head h1 {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(2.5rem, calc(6 * var(--vw)), 5.5rem); line-height: 0.98; margin: 0 0 0.3em; letter-spacing: -0.01em;
}
.project-head .lead { margin: 0; max-width: 56ch; }
.project-head > .kpi { grid-column: span 2; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; }
.kpi .v { font-family: var(--sans); font-weight: 300; font-variation-settings: "wdth" 108; font-size: clamp(1.5rem, calc(2.6 * var(--vw)), 2.25rem); line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi .k { font-size: var(--t-small); color: var(--graphite); line-height: 1.35; }
@media (max-width: 720px) {
  .project-head > .ph-meta, .project-head > .ph-title { grid-column: 1 / -1; }
}

/* 3D viewer */
.viewer-grid > .viewer-stage { grid-column: 1 / span 6; position: relative; padding: 0; min-height: calc(var(--cell) * 3.2); }
.viewer-grid > .viewer-panel { grid-column: 7 / span 2; display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 720px) {
  .viewer-grid > .viewer-stage { grid-column: 1 / -1; min-height: calc(var(--cell) * 4.4); }
  .viewer-grid > .viewer-panel { grid-column: 1 / -1; }
}
.viewer-stage {
  background-color: var(--paper) !important;
  background-image:
    linear-gradient(var(--construction) 1px, transparent 1px),
    linear-gradient(90deg, var(--construction) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
}
.viewer-stage canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; cursor: grab; touch-action: none; }
.viewer-stage canvas:active { cursor: grabbing; }
.viewer-status { position: absolute; left: 12px; bottom: 12px; font-size: var(--t-small); color: var(--graphite); background: var(--paper); padding: 2px 8px; border: var(--line) solid var(--construction); pointer-events: none; }
.viewer-status:empty { display: none; }
.viewer-status[data-kind="error"] { color: var(--redline); border-color: var(--redline); }

.viewer-panel h2 { font-size: 1.75rem; }
.viewer-panel .hint { font-size: var(--t-small); color: var(--graphite); margin: 0; }

.control { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: baseline; }
.control label { font-size: 0.9375rem; }
.control output { font-size: 0.9375rem; font-variant-numeric: tabular-nums; color: var(--graphite); }
.control input[type="range"] { grid-column: 1 / -1; }

.check { display: flex; gap: 10px; align-items: center; font-size: 0.9375rem; }
.check input { accent-color: var(--ink); width: 16px; height: 16px; margin: 0; }

.btn {
  font: inherit; font-size: 0.9375rem; color: var(--ink); background: var(--paper);
  border: var(--line) solid var(--ink); padding: 8px 14px; cursor: pointer; text-align: left;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* range: thin ink track, square thumb, redline when active */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 1px; background: var(--ink); }
input[type="range"]::-moz-range-track { height: 1px; background: var(--ink); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -7px; background: var(--paper); border: 1px solid var(--ink); border-radius: 0; }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; background: var(--paper); border: 1px solid var(--ink); border-radius: 0; }
input[type="range"]:active::-webkit-slider-thumb, input[type="range"]:focus-visible::-webkit-slider-thumb { background: var(--redline); border-color: var(--redline); }
input[type="range"]:active::-moz-range-thumb, input[type="range"]:focus-visible::-moz-range-thumb { background: var(--redline); border-color: var(--redline); }
input[type="range"]:focus-visible { outline-offset: 4px; }

/* case-study chapters */
.chapter > .section-head { position: relative; }
@media (min-width: 721px) {
  .chapter > .section-head h2 { position: sticky; top: 24px; }
}
.chapter .section-body { display: flex; flex-direction: column; gap: 28px; padding-bottom: calc(var(--cell) * 0.35); }
.chapter .section-body.prose { display: block; }
.chapter h2 { font-size: clamp(1.75rem, calc(2.6 * var(--vw)), 2.25rem); }

.two-up { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 720px) { .two-up { grid-template-columns: 1fr; } }

/* root-cause cards: symptom → cause → fix → result */
.finding { border: var(--line) solid var(--ink); }
.finding h3 { padding: 14px 16px 0; font-size: 1.375rem; }
.finding dl { display: grid; grid-template-columns: 7.5rem 1fr; margin: 0; }
.finding dt, .finding dd { margin: 0; padding: 10px 16px; border-top: var(--line) solid var(--construction); }
.finding dt { color: var(--graphite); font-size: 0.9375rem; }
.finding dd { max-width: 60ch; }
.finding dd.result { font-weight: 500; }
@media (max-width: 720px) {
  .finding dl { grid-template-columns: 1fr; }
  .finding dd { border-top: 0; padding-top: 0; }
}

.todo {
  border-left: 2px solid var(--redline); padding: 4px 0 4px 14px;
  color: var(--redline); font-size: 0.9375rem; margin: 0; max-width: 66ch;
}

.pager > a { grid-column: span 4; text-decoration: none; display: flex; flex-direction: column; gap: 6px; min-height: calc(var(--cell) * 0.8); justify-content: space-between; }
.pager > a:last-child { text-align: right; align-items: flex-end; }
.pager .muted { font-size: var(--t-small); }
.pager .t { font-family: var(--serif); font-style: italic; font-size: 1.75rem; line-height: 1.1; }
.pager > a:hover .t { color: var(--redline); }
@media (max-width: 720px) { .pager > a { grid-column: 1 / -1; } .pager > a:last-child { text-align: left; align-items: flex-start; } }

.viewer-status { z-index: 1; }
.controls { display: flex; flex-direction: column; gap: 18px; }

/* ------------------------------------------------------------------
   Reveal on scroll (see assets/js/reveal.js). Only text and whole
   sections fade: fading a single grid cell would expose the black
   grid background behind it.
   ------------------------------------------------------------------ */

.js :is(.hello, .hero-name h1, .hero-role > span, main > .section, .work-text > *, footer.titleblock) {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) var(--delay, 0ms),
    transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) var(--delay, 0ms);
}
.js :is(.hello, .hero-name h1, .hero-role > span, main > .section, .work-text > *, footer.titleblock).is-in {
  opacity: 1;
  transform: none;
}
.hero-role > span { display: block; }
@media (prefers-reduced-motion: reduce) {
  .js :is(.hello, .hero-name h1, .hero-role > span, main > .section, .work-text > *, footer.titleblock) {
    transform: none;
    transition: opacity 0.3s linear;
  }
}
.awards { grid-column: 1 / -1; padding: clamp(24px, calc(3 * var(--vw)), 48px); }
.awards .what p { margin-top: 2px; }

/* film-stack section view (nanofab page) */
.stack svg { width: 100%; height: auto; }
.stack-label text { font-family: var(--sans); font-size: 17px; fill: var(--ink); }
.stack-label text.sub { font-size: 14px; fill: var(--graphite); }

/* numbered process steps: a real sequence */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 20px; }
.steps li { counter-increment: step; border-top: var(--line) solid var(--ink); padding-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.steps li::before { content: counter(step); font-family: var(--serif); font-style: italic; font-size: 1.75rem; line-height: 1; }
.steps strong { font-weight: 500; }
.steps span { color: var(--graphite); font-size: 0.9375rem; }
.work-text > :nth-child(2) { --delay: 80ms; }
.work-text > :nth-child(3) { --delay: 160ms; }
.work-text > :nth-child(4) { --delay: 240ms; }

/* work-card figures */
.work-figure {
  background-image:
    linear-gradient(var(--construction) 1px, transparent 1px),
    linear-gradient(90deg, var(--construction) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: -1px -1px;
}
.work-model { position: absolute; inset: 0; pointer-events: none; }
.work-model canvas { width: 100% !important; height: 100% !important; }
.work-stack { position: absolute; inset: 0; background: var(--paper); }
.work-stack svg { width: 100%; height: 100%; }
.work-meta { display: flex; flex-direction: column; gap: 2px; }
.work-meta strong { color: var(--ink); font-weight: 500; }

/* recognition: year | logo | text */
.awards .rows > li { grid-template-columns: minmax(6rem, 1fr) 96px 5fr; align-items: start; }
.awards .logo { display: flex; align-items: center; justify-content: center; height: 48px; }
.awards .logo img { max-width: 88px; max-height: 40px; width: auto; height: auto; object-fit: contain; }
@media (max-width: 720px) {
  .awards .rows > li { grid-template-columns: 72px 1fr; }
  .awards .rows > li .when { grid-column: 1 / -1; }
  .awards .logo { justify-content: flex-start; height: 36px; }
}
/* logos: each sized by eye so they carry similar visual weight,
   and every column is centred on the row so nothing sits low */
.awards .rows > li { grid-template-columns: minmax(6rem, 1fr) 150px 5fr; align-items: center; }
.awards .logo { height: auto; justify-content: flex-start; }
.awards .logo img { max-width: none; max-height: none; width: auto; }
.awards .logo img[src*="hpvc"] { height: 46px; }
.awards .logo img[src*="jane-street"] { height: 40px; }
.awards .logo img[src*="anthropic"] { width: 92px; height: auto; }
.awards .logo img[src*="usc-viterbi"] { width: 132px; height: auto; }
@media (max-width: 720px) {
  .awards .rows > li { grid-template-columns: 1fr; align-items: start; }
  .awards .logo { margin: 6px 0 2px; }
}

/* About: USC logo on the construction grid */
.about-logo {
  display: grid; place-items: center;
  background-image:
    linear-gradient(var(--construction) 1px, transparent 1px),
    linear-gradient(90deg, var(--construction) 1px, transparent 1px) !important;
  background-size: 40px 40px !important;
  background-position: -1px -1px !important;
}
.about-logo img { width: auto; height: 62%; max-height: 300px; max-width: 70%; object-fit: contain; }
@media (max-width: 720px) { .about-logo img { height: 200px; } }

/* CAD renders and video poster (gantry page) */
.viewer-grid > .render { margin: 0; display: grid; place-items: center; padding: clamp(12px, calc(2 * var(--vw)), 32px); }
.render img { width: 100%; height: auto; } /* transparent cutout sits on the grid */
.render-box { border: var(--line) solid var(--ink); background: var(--paper); aspect-ratio: 1 / 1; display: grid; place-items: center; padding: 12px; }
.render-box img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.video-card { position: relative; display: block; border: var(--line) solid var(--ink); text-decoration: none; }
.video-card img { width: 100%; height: auto; display: block; }
.video-card span { display: block; border-top: var(--line) solid var(--ink); background: var(--paper); padding: 8px 10px; font-size: 0.875rem; line-height: 1.3; }
.video-card span::before { content: ""; display: inline-block; width: 0; height: 0; margin-right: 8px; border-style: solid; border-width: 5px 0 5px 8px; border-color: transparent transparent transparent currentColor; }
.video-card:hover span { background: var(--ink); color: var(--paper); }
.work-render { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 2%; }
.work-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 60%; }
.shot-photo { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border: var(--line) solid var(--ink); display: block; }

/* autoplaying CAD demo */
.viewer-grid > .demo { padding: 0; background: var(--paper) !important; }
.demo video { width: 100%; height: 100%; object-fit: contain; display: block; background: var(--paper); }
.render-thumb { margin: 0; border: var(--line) solid var(--ink); }
.render-thumb img { width: 100%; height: auto; display: block; }

/* data tables (nanofab calibration runs) */
.table-wrap { overflow-x: auto; border: var(--line) solid var(--ink); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
table.data th, table.data td { text-align: left; padding: 10px 14px; border-top: var(--line) solid var(--construction); vertical-align: top; }
table.data thead th { border-top: 0; border-bottom: var(--line) solid var(--ink); font-weight: 500; font-size: var(--t-small); color: var(--graphite); }
table.data td.num { white-space: nowrap; font-weight: 500; }
@media (max-width: 720px) { table.data { min-width: 560px; } }
sub { font-size: 0.72em; line-height: 0; vertical-align: -0.2em; }
.work-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 1%; background: transparent; pointer-events: none; }

/* project header meta: one job per line */
.project-head > .ph-meta { justify-content: space-between; gap: 24px; }
.ph-meta .sheet-no { font-size: var(--t-small); color: var(--graphite); }
.meta-stack { display: flex; flex-direction: column; gap: 4px; }
.meta-stack .org { font-weight: 500; font-size: 1rem; line-height: 1.3; }
.meta-stack .role { font-size: 0.9375rem; line-height: 1.35; }
.meta-stack .dates { margin-top: 12px; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.meta-stack .program { font-size: var(--t-small); color: var(--graphite); line-height: 1.4; }
.work-meta span { color: var(--ink); font-size: 0.9375rem; }
.work-meta .dates { color: var(--graphite); font-variant-numeric: tabular-nums; margin-top: 2px; }
.work-meta .program { color: var(--graphite); font-size: var(--t-small); }

/* verification cards: method label + code excerpt */
.finding .method { margin: 0; padding: 14px 16px 0; font-size: var(--t-small); color: var(--graphite); }
.finding .method + h3 { padding-top: 4px; }
.code-excerpt { margin: 0; border: var(--line) solid var(--ink); }
.code-excerpt figcaption { padding: 10px 14px; border-bottom: var(--line) solid var(--ink); font-size: var(--t-small); color: var(--graphite); }
.code-excerpt pre { margin: 0; padding: 16px; overflow-x: auto; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.8125rem; line-height: 1.6; background: #fafafa; }
.finding dd { max-width: none; padding-right: max(16px, 8%); }

/* spec lists (restored: accidentally removed with the old work-list styles) */
.specs { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 24px; margin: 0; }
.specs div { border-top: var(--line) solid var(--ink); padding-top: 8px; }
.specs dt { font-size: var(--t-small); color: var(--graphite); line-height: 1.35; }
.specs dd { margin: 4px 0 0; font-size: 1.0625rem; font-variant-numeric: tabular-nums; }

/* results stat grid: label column + three stats per row */
.stat-grid { grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 2fr)); }
.stat-grid > .stat-group { margin: 0; font-family: var(--serif); font-style: italic; font-size: 1.375rem; line-height: 1.2; }
.stat-grid > .stat { display: flex; flex-direction: column; justify-content: space-between; gap: 18px; min-height: 150px; padding: clamp(16px, calc(2 * var(--vw)), 28px); }
.stat .v { font-weight: 300; font-variation-settings: "wdth" 108; font-size: clamp(1.5rem, calc(2.4 * var(--vw)), 2.25rem); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .k { font-size: var(--t-small); color: var(--graphite); line-height: 1.4; max-width: 30ch; }
@media (max-width: 720px) {
  .stat-grid { grid-template-columns: 1fr; }
  .stat-grid > .stat { min-height: 0; }
}

/* charts, photos and code on case-study pages */
figure.shot img.chart { width: 100%; height: auto; display: block; border: var(--line) solid var(--ink); background: var(--paper); }
figure.shot.half { max-width: min(100%, 420px); }
.shot-photo.portrait { aspect-ratio: 3 / 4; }
.chapter h3.sub { font-size: 1.375rem; margin: 8px 0 -12px; }
.code-excerpt pre { tab-size: 4; }
.code-excerpt .ln { display: inline-block; width: 3.2em; color: #9a9a9a; user-select: none; }
.code-excerpt .cm { color: var(--graphite); font-style: italic; }
/* height:auto so the img height attribute doesn't override aspect-ratio */
.shot-photo { height: auto; }
.steps.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 720px) { .steps.six { grid-template-columns: 1fr; } }
/* charts need full width for their labels to stay legible */
.two-up:has(img.chart) { grid-template-columns: minmax(0, 1fr); gap: 28px; }

/* 3D stage fallback: the render shows until (unless) the 3D model loads */
.stage-fallback { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }   /* same camera as the 3D view, so the swap lines up */
.is-3d > .stage-fallback { display: none; }
.viewer-panel output { font-variant-numeric: tabular-nums; color: var(--ink); }

/* numbered debugging problems */
.finding .problem-no { margin: 0; padding: 14px 16px 0; font-family: var(--serif); font-style: italic; font-size: 1.125rem; line-height: 1; color: var(--redline); }
.finding .problem-no + .method { padding-top: 6px; }
table.data.parts td:first-child { white-space: nowrap; color: var(--graphite); }
@media (max-width: 720px) { table.data.parts td:first-child { white-space: normal; } }
.shot-photo.bench { aspect-ratio: 1078 / 1400; }
.shot-photo.chuck { aspect-ratio: 1056 / 1400; }
.program-body { display: flex; flex-direction: column; gap: 24px; }
.program-body > p { margin: 0; max-width: 66ch; }
.two-up.photos .shot-photo { aspect-ratio: 4 / 5; }
/* a photo shown whole, as a print on the construction grid (not a full-bleed crop) */
.work-photo.framed { object-fit: contain; padding: 7%; filter: drop-shadow(0 0 0.5px #000); }

/* nanofab: credentials, process flow, cross-link */
.creds { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.creds li { border: var(--line) solid var(--ink); padding: 12px 14px; font-size: 0.9375rem; line-height: 1.3; }
.flow { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.flow li { counter-increment: step; display: grid; grid-template-columns: 2.4rem 7rem 1fr; grid-template-areas: "n t d" "n t k"; gap: 2px 16px; padding: 14px 0; border-top: var(--line) solid var(--construction); }
.flow li:first-child { border-top: var(--line) solid var(--ink); }
.flow li::before { content: counter(step); grid-area: n; font-family: var(--serif); font-style: italic; font-size: 1.5rem; line-height: 1.1; }
.flow strong { grid-area: t; font-weight: 500; }
.flow span { grid-area: d; max-width: 60ch; }
.flow em { grid-area: k; font-style: normal; font-size: var(--t-small); color: var(--graphite); }
@media (max-width: 720px) {
  .flow li { grid-template-columns: 2.2rem 1fr; grid-template-areas: "n t" "n d" "n k"; }
}
.link-card { display: inline-flex; flex-direction: column; gap: 4px; border: var(--line) solid var(--ink); padding: 12px 16px; text-decoration: none; }
.link-card .muted { font-size: var(--t-small); }
.link-card .t { font-family: var(--serif); font-style: italic; font-size: 1.375rem; line-height: 1.15; }
.link-card:hover { background: var(--ink); color: var(--paper); }
.link-card:hover .muted { color: var(--paper); }
.creds { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 720px) { .creds { grid-template-columns: 1fr 1fr; } }
table.data td:first-child { white-space: nowrap; }
@media (max-width: 720px) { table.data td:first-child { white-space: normal; } }
@media (max-width: 720px) { .creds li:first-child { grid-column: 1 / -1; } }
.work-render.wafer { padding: 12% 16%; }
@media (max-width: 720px) { .work-render.wafer { padding: 8%; } }
