/* No Further Delay. Red studio sweep, Gerber texture, liquid glass, film grain. Clean, no blueprint linework. */

:root {
  --red-top: #c91d1a;
  --red-mid: #d5261e;
  --red-hot: #e6402c;
  --red-low: #cf271f;
  --red-deep: #a8161a;
  --red-ink: #9a1216;
  --maroon: rgba(110, 8, 12, 1);

  --ink: #fff6f2;
  --ink-soft: #ffeee8; /* lightest tone that still reads as secondary; clears 4.5:1 on --red-mid */
  --ink-dim: rgba(255, 230, 220, .78);
  --line: rgba(255, 240, 232, .45);
  --line-faint: rgba(255, 240, 232, .22);

  --glass-bg: linear-gradient(180deg, rgba(255,255,255,.34) 0%, rgba(255,255,255,.08) 52%, rgba(255,255,255,.16) 100%);
  --glass-border: 1px solid rgba(255,255,255,.42);
  --glass-shadow: inset 0 1px 1px rgba(255,255,255,.8), inset 0 -10px 18px rgba(255,210,190,.14), 0 12px 32px rgba(90,4,8,.3);
  --glass-blur: blur(14px) saturate(170%);

  --display: 'Archivo', 'Arial Narrow', sans-serif;
  --sans: 'Geologica', system-ui, -apple-system, 'Segoe UI', sans-serif; /* everything but names and headings, which are Archivo wide black caps */

  --ease-out: cubic-bezier(.23, 1, .32, 1);       /* entering, feedback */
  --ease-in-out: cubic-bezier(.77, 0, .175, 1);  /* moving on screen */

  --gutter: clamp(16px, 5vw, 64px);
  --max: 1200px;
}

*, *::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;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-kerning: normal;
  color: var(--ink);
  background-color: var(--red-mid);
  /* flat --red-mid under the stage, so the stage fades into it with no seam, then darker down the page */
  background-image: linear-gradient(180deg, var(--red-mid) 0, var(--red-mid) 1500px, var(--red-deep) 100%);
  overflow-x: hidden;
}

/* film grain on the page background only. z-index -1 keeps it under all content */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .5;
  mix-blend-mode: overlay;
  background: url(../assets/tex/grain.png) 0 0 / 200px 200px;
}

a { color: var(--ink); text-decoration: none; }
/* browser surfaces in the palette: selection, caret, scrollbar */
::selection { background: var(--ink); color: var(--red-ink); }
html { scrollbar-color: rgba(255,240,232,.55) var(--red-deep); caret-color: var(--ink); }
a:hover { color: #fff; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

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

.eyebrow {
  font-size: 13px;
  letter-spacing: 0;
  color: var(--ink-soft);
  font-weight: 500;
}

.glass {
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  background: var(--glass-bg);
  border: var(--glass-border);
  box-shadow: var(--glass-shadow);
}
/* glass that holds reading text: less white and a red underlay, so --ink stays legible on it */
.panel.glass, .contact-card.glass, .cad-panel.glass, .tb-panel.glass, .kv-body.glass, .sm-body.glass {
  background: linear-gradient(180deg, rgba(186, 26, 26, .5) 0%, rgba(150, 12, 16, .5) 52%, rgba(160, 16, 20, .5) 100%); /* the inset highlight in --glass-shadow keeps the glass edge */
}

/* ------------------------------------------------------------------ */
/* Studio sweep backdrop                                               */
/* ------------------------------------------------------------------ */

.stage {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--red-top);
}

.sweep {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  /* exact 6a backdrop. Lives here (not on .stage) so the soft-light mottle blends with it */
  background:
    radial-gradient(ellipse 24% 42% at 22% 0%, rgba(255,175,120,.7), transparent 75%),
    radial-gradient(ellipse 26% 46% at 50% 0%, rgba(255,190,135,.8), transparent 75%),
    radial-gradient(ellipse 24% 42% at 78% 0%, rgba(255,175,120,.7), transparent 75%),
    radial-gradient(ellipse 55% 22% at 50% 64%, rgba(255,140,95,.6), transparent 72%),
    linear-gradient(180deg, #c91d1a 0%, #d5261e 40%, #e6402c 60%, #cf271f 72%, #a8161a 100%);
}

.sweep-3d { position: absolute; inset: 0; perspective: 1000px; perspective-origin: 50% 35%; }
.sweep-wall { position: absolute; left: -30%; width: 160%; top: -40px; height: 600px; transform-style: preserve-3d; }
.sweep-cove { position: absolute; left: 0; right: 0; top: 100%; height: 180px; transform-origin: 50% 0; transform: rotateX(42deg); transform-style: preserve-3d; }
.sweep-floor { position: absolute; left: 0; right: 0; top: 100%; height: 1400px; transform-origin: 50% 0; transform: rotateX(40deg); }

.tex {
  position: absolute;
  inset: 0;
  opacity: .5;
  background-image: url(../assets/tex/pcb-texture-v3.png);
  background-size: 1144px 644px;
}
.tex-wall {
  background-position: 50% 0;
  -webkit-mask-image: radial-gradient(ellipse 22% 80% at 32.5% 0%, #000, transparent 85%), radial-gradient(ellipse 24% 85% at 50% 0%, #000, transparent 85%), radial-gradient(ellipse 22% 80% at 67.5% 0%, #000, transparent 85%), linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,.7));
  mask-image: radial-gradient(ellipse 22% 80% at 32.5% 0%, #000, transparent 85%), radial-gradient(ellipse 24% 85% at 50% 0%, #000, transparent 85%), radial-gradient(ellipse 22% 80% at 67.5% 0%, #000, transparent 85%), linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,.7));
}
.tex-cove {
  background-position: 50% -600px;
  -webkit-mask-image: linear-gradient(90deg, rgba(0,0,0,.3), #000 30%, #000 70%, rgba(0,0,0,.3));
  mask-image: linear-gradient(90deg, rgba(0,0,0,.3), #000 30%, #000 70%, rgba(0,0,0,.3));
}
.tex-floor {
  background-position: 50% -780px;
  -webkit-mask-image: radial-gradient(ellipse 40% 60% at 50% 0%, #000, transparent 90%);
  mask-image: radial-gradient(ellipse 40% 60% at 50% 0%, #000, transparent 90%);
}

.beam { position: absolute; top: -20px; width: 31.25%; max-width: 400px; height: 640px; filter: blur(22px); }
.beam::before {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(43% 0, 57% 0, 100% 100%, 0 100%);
  background: linear-gradient(180deg, rgba(255,215,180,.42), rgba(255,180,130,.12) 60%, transparent);
}
.beam-1 { left: 6.4%; }
.beam-2 { left: 50%; transform: translateX(-50%); }
.beam-3 { right: 6.4%; }

.side-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(110,8,12,.55) 0%, rgba(110,8,12,.15) 14%, transparent 26%, transparent 74%, rgba(110,8,12,.15) 86%, rgba(110,8,12,.55) 100%); }
.floor-shade { position: absolute; left: 0; right: 0; bottom: 0; height: 200px; background: linear-gradient(0deg, rgba(120,10,14,.4), transparent); }
.mottle { position: absolute; inset: 0; opacity: .55; mix-blend-mode: soft-light; background: url(../assets/tex/mottle.png) 0 0 / 100% 100%; }
/* grain on the backdrop only, under models, pictures and text */
.sweep::after { content: ""; position: absolute; inset: 0; opacity: .5; mix-blend-mode: overlay; background: url(../assets/tex/grain.png) 0 0 / 200px 200px; }

/* ------------------------------------------------------------------ */
/* Glass nav                                                            */
/* ------------------------------------------------------------------ */

.site-nav {
  position: relative;
  z-index: 20;
  display: flex;
  justify-content: center;
  padding: 22px 16px 0;
}
.nav-pill {
  display: flex;
  align-items: center;
  gap: 30px;
  padding: 10px 26px 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0;
  font-weight: 500;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 40px; width: auto; }
.brand span { font-family: var(--display); font-weight: 700; font-stretch: 115%; font-size: 15px; letter-spacing: .08em; }
.nav-rule { width: 1px; height: 18px; background: rgba(255,255,255,.45); }
.nav-links { display: flex; gap: 22px; }
.nav-links a { position: relative; padding: 4px 0; }
/* invisible hit area: at least 44px tall tap targets without making the pill taller */
.nav-links a::before { content: ""; position: absolute; inset: -10px -8px; }
.brand { position: relative; min-height: 44px; }
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms var(--ease-out);
}
.nav-links a[aria-current="page"]::after { transform: scaleX(1); }
@media (hover: hover) and (pointer: fine) { .nav-links a:hover::after { transform: scaleX(1); } }

@media (max-width: 560px) {
  .nav-pill { gap: 16px; padding: 8px 18px 8px 10px; }
  /* the name stays on phones (the brand is always paired with Adam); the divider makes the room */
  .nav-rule, .nav-links a[href$="#contact"] { display: none; }
  .brand { gap: 8px; }
  .brand span { font-size: 12px; letter-spacing: .06em; white-space: nowrap; }
  .brand img { height: 34px; }
  .nav-links { gap: 16px; }
  .nav-links a { font-size: 12px; letter-spacing: .08em; }
}
@media (max-width: 359px) { .brand span { display: none; } }

/* ------------------------------------------------------------------ */
/* Home                                                                 */
/* ------------------------------------------------------------------ */

.home-stage { min-height: 100vh; display: flex; flex-direction: column; }
@supports (min-height: 100svh) { .home-stage { min-height: 100svh; } }

.hero-title {
  margin-top: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  text-align: center;
  padding: 0 16px;
}
.display {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-stretch: 125%;
  line-height: .9;
  letter-spacing: -.02em;
  text-transform: uppercase;
  text-shadow: 0 20px 50px rgba(110,8,12,.35);
}
.hero-title .display { font-size: clamp(52px, 8.2vw, 104px); }
.hero-title p { margin: 0; font-size: 13.5px; line-height: 1.6; letter-spacing: .02em; color: var(--ink-soft); max-width: 460px; }
/* the brand and the person, always together: NFD is the name Adam builds under */
.hero-title .byline { margin-top: -8px; font-family: var(--display); font-weight: 600; font-stretch: 115%; font-size: clamp(14px, 1.5vw, 19px); letter-spacing: .14em; text-transform: uppercase; color: var(--ink); max-width: none; }
.hero-title .byline strong { font-weight: 800; }

.unit-shadow { position: absolute; bottom: 4px; left: 50%; width: 190px; height: 24px; margin-left: -95px; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(90,4,8,.6), transparent 70%); filter: blur(5px); }

.unit-glow { position: absolute; pointer-events: none; opacity: 0; z-index: 4; }
.unit-glow { left: 50%; top: 50%; width: 300px; height: 240px; margin: -130px 0 0 -150px; background: radial-gradient(ellipse at center, rgba(255,215,185,.5), rgba(255,140,100,.18) 45%, transparent 70%); }
.unit-glow { transition: opacity 200ms ease; }
/* home carousel (js/home-reel.js): slides sit on one ring; JS writes each slide's transform from one
   position, so nothing here transitions transform (that would make the reel trail the finger) */
.reel {
  --w: clamp(240px, 32vw, 440px);
  --h: clamp(210px, 36vh, 360px);
  position: relative; margin: 28px auto 0; width: 100%;
  height: calc(var(--h) + 128px);
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.reel-track { position: absolute; inset: 0; }
.reel-item {
  position: absolute; left: 50%; top: 0; width: var(--w); margin-left: calc(var(--w) / -2);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  color: inherit; text-decoration: none; transform-origin: 50% 40%;
  -webkit-user-drag: none; -webkit-tap-highlight-color: transparent;
  opacity: 0; will-change: transform, opacity;
}
.reel.is-ready .reel-item { cursor: pointer; }
.reel.is-dragging, .reel.is-dragging .reel-item { cursor: grabbing; }
.reel-item:focus-visible { outline: none; }
.reel-item:focus-visible .reel-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.reel-stage { position: relative; width: 100%; height: var(--h); display: flex; align-items: flex-end; justify-content: center; }
.reel .cad-wrap { position: absolute; left: -12%; right: -12%; top: -6%; bottom: 6%; z-index: 5; }
.reel .unit-shadow { width: 62%; left: 19%; margin: 0; }
.reel .unit-glow { width: 120%; height: 90%; left: -10%; top: 5%; margin: 0; }
.reel .unit-box { bottom: 12%; width: 70%; }
@media (hover: hover) and (pointer: fine) { .reel-item.is-active:hover .unit-glow { opacity: 1; } }

/* other work: no model, so the name stands in the studio on its own, set like a title card */
.reel-tile { align-self: center; flex: none; width: min(150%, 600px); display: flex; flex-direction: column; align-items: center; text-align: center; }
.reel-org { font-family: var(--display); font-weight: 900; font-stretch: 125%; text-transform: uppercase; font-size: clamp(26px, 2.6vw, 38px); line-height: 1.02; letter-spacing: -.01em; text-wrap: balance; text-shadow: 0 18px 40px rgba(110,8,12,.35); }
.reel-role { margin-top: 14px; font-size: 18px; font-weight: 500; line-height: 1.3; }
.reel-when { margin-top: 6px; font-size: 15px; color: var(--ink-soft); }
.reel-text .reel-tile { opacity: calc(.5 + .5 * var(--label, 1)); } /* dims when it moves off centre, like the model labels */

.reel-label { width: min(92vw, 760px); display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; opacity: var(--label, 0); pointer-events: none; }
.reel-name { font-family: var(--display); font-weight: 900; font-stretch: 125%; font-size: clamp(20px, 2.2vw, 30px); line-height: 1; text-transform: uppercase; text-wrap: balance; }
.reel-kind { font-size: 15px; color: var(--ink-soft); }

.reel-dots { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 200; display: flex; gap: 6px; }
.reel-dots button { position: relative; width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px; background: rgba(255, 240, 232, .4); cursor: pointer; transition: width 240ms var(--ease-out), background-color 200ms ease; }
.reel-dots button::before { content: ""; position: absolute; inset: -12px -5px; } /* 32px tall tap area without bigger dots */
.reel-dots button[aria-current="true"] { width: 26px; background: var(--ink); }
.reel-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }

@media (max-width: 720px) {
  .reel { --w: min(64vw, 300px); --h: min(52vw, 260px); margin-top: 32px; }
  .reel-org { font-size: 22px; }
  .reel-role { margin-top: 10px; font-size: 15px; }
  .reel-kind { font-size: 13px; }
}

.home-more { display: flex; justify-content: center; margin: 8px 0 72px; }
/* a quiet text link, not a button: the carousel is the main thing on the page */
.more-link { position: relative; display: inline-flex; align-items: center; gap: 10px; padding: 10px 2px; font-size: 16px; font-weight: 500; color: var(--ink); }
.more-link::after { content: ""; position: absolute; left: 2px; right: 2px; bottom: 6px; height: 1px; background: currentColor; opacity: .45; transform-origin: left; transition: opacity 200ms ease, transform 250ms var(--ease-out); }
.more-link svg { transition: transform 200ms var(--ease-out); }
.more-link:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) {
  .more-link:hover { color: #fff; }
  .more-link:hover::after { opacity: 1; }
  .more-link:hover svg { transform: translateX(4px); }
}
/* short laptop screens (1366x768 and similar): fit the hero, the carousel and the button in one view */
@media (min-width: 1101px) and (max-height: 860px) {
  .hero-title { margin-top: 36px; gap: 16px; }
  .hero-title .display { font-size: clamp(52px, min(8.2vw, 12.5vh), 104px); }
  .hero-title p { max-width: 600px; }
  .reel { --h: clamp(200px, 31vh, 300px); margin-top: 12px; }
  .home-more { margin: 4px 0 16px; }
  .stage-foot { height: 44px; }
}

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 18px;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0;
  color: var(--ink);
  cursor: pointer;
  font-weight: 500;
}
.btn.solid { background: var(--ink); color: var(--red-ink); border: 1px solid var(--ink); box-shadow: 0 12px 32px rgba(90,4,8,.3); }
.btn { transition: background-color 150ms ease, border-color 150ms ease, transform 160ms var(--ease-out); }
.btn:active { transform: scale(.97); }
.btn .arrow { display: inline-block; transition: transform 200ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .btn.solid:hover { background: #fff; color: var(--red-ink); }
  .btn:hover .arrow { transform: translateX(3px); }
}

.stage-foot {
  margin-top: auto;
  height: 52px;
  padding: 0 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  font-size: 13px; letter-spacing: 0;
  color: var(--ink-soft);
  font-weight: 500;
}
.stage-foot nav { display: flex; gap: 14px; }

@media (max-width: 720px) {
  .home-stage { min-height: 100vh; }
  .hero-title { margin-top: 72px; }
  .stage-foot { padding: 0 16px; }
}
/* phones: a 2x2 grid of smaller models, so all four and the projects button arrive in about one screen */
@media (max-width: 440px) {
  .hero-title { margin-top: 56px; }
  .home-more { margin: 4px 0 40px; }
}

/* ------------------------------------------------------------------ */
/* CAD side panel (project pages)                                         */
/* ------------------------------------------------------------------ */

.cad-panel {
  padding: 28px;
  border-radius: 20px;
  display: flex; flex-direction: column; gap: 22px;
}
.focus-copy p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--ink-soft); }

.chip.toggle { width: 100%; padding: 12px 8px; font-size: 12px; }
.chip {
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.4);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  letter-spacing: 0;
  cursor: pointer;
  text-align: center;
  font-weight: 500;
}
.chip { transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out); }
.chip:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .chip:hover { border-color: var(--ink); } }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--red-ink); }

.focus-copy { display: flex; flex-direction: column; gap: 8px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.3); }
.cad-panel > .focus-copy:first-child { border-top: 0; padding-top: 0; }
.focus-copy h3 { margin: 0; font-size: 13px; font-weight: 500; letter-spacing: 0; }

.parts { margin-top: auto; display: flex; flex-direction: column; gap: 6px; font-size: 13px; letter-spacing: 0; font-weight: 500;}
.parts .eyebrow { font-size: 12px; margin-bottom: 4px; }
.parts div { display: flex; justify-content: space-between; gap: 12px; }
.parts [data-part] { margin: 0 -8px; padding: 3px 8px; border-radius: 6px; cursor: pointer; transition: background-color 120ms ease, color 120ms ease; }
.parts [data-part].is-hot { transition: none; } /* lights up with the mesh, same frame */
.parts [data-part].is-aimed { background: rgba(255, 240, 232, .16); } /* the part the camera is showing */
.parts [data-part]:hover, .parts [data-part]:focus-visible, .parts [data-part].is-hot { background: var(--ink); color: var(--red-ink); outline: none; }
.parts .parts-note { margin: 6px 0 0; font-size: 12px; letter-spacing: .02em; text-transform: none; line-height: 1.5; color: var(--ink-soft); }


/* ------------------------------------------------------------------ */
/* Inner page header                                                    */
/* ------------------------------------------------------------------ */

.page-stage { padding-bottom: 72px; }
.page-stage .sweep-wall { height: 520px; }
.page-head { margin-top: 84px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; padding: 0 16px; }
.page-head .display { font-size: clamp(44px, 7vw, 88px); }
.page-head p { margin: 0; max-width: 620px; font-size: 18px; line-height: 1.65; letter-spacing: .01em; color: var(--ink-soft); }
.page-stage + main { position: relative; }

/* soft fade from the stage into the page body */
.page-stage::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 160px; background: linear-gradient(180deg, rgba(213,38,30,0), var(--red-mid)); pointer-events: none; }
.page-stage > :not(.sweep) { position: relative; z-index: 1; }

/* ------------------------------------------------------------------ */
/* Projects register                                                    */
/* ------------------------------------------------------------------ */

/* ------------------------------------------------------------------ */
/* Project write-up                                                     */
/* ------------------------------------------------------------------ */

/* pictures: never cropped, no frames or figure numbers. Each figure carries its image ratio (--r) and
   pixel width (--w); a gallery row splits its width by ratio, so every picture in a row has the same height */
.figure { margin: 0; min-width: 0; }
.figure img { display: block; width: 100%; height: auto; }
.figure img.on-white { background: #fff; }
.figure figcaption { margin-top: 10px; font-size: 13px; line-height: 1.5; color: var(--ink-soft); text-wrap: pretty; }

.body { max-width: 760px; margin: 0 auto; }
.section { margin-top: 56px; }
.section:first-child { margin-top: 0; }
.section h2 {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 18px;
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 125%;
  font-size: 22px;
  line-height: 1.1;
  text-transform: uppercase;
}
.section p { margin: 0 0 16px; max-width: 68ch; font-size: 15px; line-height: 1.75; text-wrap: pretty; }
.section p a, .text-link { border-bottom: 1px solid var(--line); }
.section p a:hover, .text-link:hover { border-color: var(--ink); }

/* max-width (set per gallery in the page) stops low resolution pictures from being blown up */
.gallery { display: flex; align-items: flex-start; gap: 20px; margin: 28px auto 8px; }
.gallery .figure { flex: var(--r) 1 0; }
@media (max-width: 700px) {
  .gallery { flex-direction: column; }
  .gallery .figure { flex: none; width: 100%; }
}

.spec-table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.spec-table caption { text-align: left; font-size: 13px; letter-spacing: 0; color: var(--ink-soft); padding-bottom: 10px; font-weight: 500;}
.spec-table th, .spec-table td { padding: 10px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.spec-table th { font-weight: 500; font-size: 13px; letter-spacing: 0; background: rgba(255,240,232,.1); }
/* results read at a glance: a filled tag, not just bold text */
.spec-table td.pass { background: var(--ink); color: var(--red-ink); font-weight: 600; font-size: 13px; letter-spacing: 0; vertical-align: middle; }
.table-scroll { overflow-x: auto; }

.note { font-size: 13px !important; color: var(--ink-soft); border: 1px dashed var(--line); padding: 12px 14px; }

/* ------------------------------------------------------------------ */
/* Project page: what it is up top, the model in the studio, then a short body */
/* ------------------------------------------------------------------ */

.proj-stage { padding-bottom: 40px; }
.proj-stage .sweep-wall { height: 700px; } /* the floor sits under the model, not under the title */
.proj-hero {
  width: 100%; max-width: var(--max); margin: 40px auto 0; padding: 0 var(--gutter);
  display: flex; flex-direction: column; align-items: flex-start; /* one column: title, line, facts, tags */
}
.proj-hero .display { align-self: stretch; font-size: clamp(48px, 8vw, 112px); text-wrap: balance; }
.proj-line { margin: 16px 0 0; max-width: 60ch; font-size: 19px; line-height: 1.55; color: var(--ink-soft); text-wrap: pretty; }
.proj-meta { margin: 28px 0 0; display: flex; flex-wrap: wrap; gap: 16px 48px; }
.proj-meta div { min-width: 0; max-width: 320px; }
.proj-hero .proj-tags { margin-top: 24px; }
/* a project logo Adam designed sits on its own dark tile beside the title (it is red on black, so it needs the contrast) */
.proj-hero.has-logo { position: relative; }
.proj-logo { position: absolute; right: var(--gutter); top: 0; width: clamp(180px, 22vw, 300px); height: auto; border-radius: 18px; box-shadow: 0 18px 40px rgba(60, 0, 0, .35); }
.proj-hero.has-logo .display, .proj-hero.has-logo .proj-line { max-width: calc(100% - clamp(180px, 22vw, 300px) - 32px); }
@media (max-width: 760px) {
  .proj-logo { position: static; order: 9; margin-top: 22px; width: 200px; }
  .proj-hero.has-logo .display, .proj-hero.has-logo .proj-line { max-width: none; }
}
.proj-meta dt { font-size: 14px; letter-spacing: 0; color: var(--ink-soft); font-weight: 600;}
.proj-meta dd { margin: 4px 0 0; font-size: 17px; font-weight: 500; line-height: 1.4; }
.proj-tags, .card-tags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.proj-tags li, .card-tags li { padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; }
.proj-model { margin-top: 12px; }
.proj-model-body { margin: 8px 0 32px; } /* a model in the write-up, under the row that talks about it */
/* a real project video under the 3D model (only when a video file exists) */
.proj-video { margin-top: 28px; }
.proj-video .figure { max-width: 1040px; margin: 0 auto; }
.proj-video video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 14px; background: #2a0606; }
.proj-photo .figure { max-width: min(100%, calc(560px * var(--r))); margin: 0 auto; }
.proj-photo figcaption { text-align: center; }
@media (max-width: 860px) {
  .proj-hero { margin-top: 48px; }
  .proj-line { font-size: 17px; }
  .proj-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; margin-top: 22px; width: 100%; }
  .proj-meta div { max-width: none; }
  .proj-meta div:first-child { grid-column: 1 / -1; }
}

/* the model stands in the studio: no box around it, the parts panel floats beside it */
.cad-inline { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 320px; min-height: clamp(540px, 72vh, 720px); }
/* the viewer runs to both screen edges (the stage clips it), so zooming in sends the model off screen
   instead of against a box edge; cad-viewer's bleed keeps the model framed in the column */
.cad-inline .viewer { position: absolute; top: 0; bottom: 0; left: calc(50% - 50vw); width: 100vw;
  /* top and bottom dissolve too, so a zoomed model fades out instead of meeting a hard line */
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 84%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 12%, #000 84%, transparent); }
.cad-inline .viewer-note { position: absolute; left: 0; top: 4px; z-index: 3; pointer-events: none; }
.cad-inline .cad-panel { grid-column: 2; position: relative; z-index: 2; margin: 0; align-self: center; }
.cad-inline.cad-wide { grid-template-columns: minmax(0, 1fr); min-height: 0; }
.cad-wide .viewer { height: min(72vh, 680px); min-height: 420px; }

/* view switch when a project has a demo: a small glass segmented control */
.cad-tabs { display: inline-flex; gap: 4px; margin: 0 0 16px; padding: 4px; border-radius: 999px; background: rgba(120, 10, 14, .3); border: 1px solid var(--line-faint); }
.cad-tabs [role="tab"] {
  padding: 8px 16px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-soft);
  font: inherit; font-size: 13px; letter-spacing: 0; cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out);
  font-weight: 500; white-space: nowrap;
}
@media (max-width: 440px) { .cad-tabs { gap: 2px; } .cad-tabs [role="tab"] { padding: 8px 7px; } }
.cad-tabs [role="tab"]:active { transform: scale(.97); }
.cad-tabs [role="tab"][aria-selected="true"] { background: var(--ink); color: var(--red-ink); }
.cad-tabs [role="tab"]:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .cad-tabs [role="tab"]:not([aria-selected="true"]):hover { color: var(--ink); } }
.cad-view[hidden] { display: none; }

/* test bed demo (vibration monitor page, js/testbed-demo.js): the bed in the studio, readouts on glass */
/* the demo fits one screen with nothing overlapping: 3D test bed over the MATLAB window | Figure 1 | panel */
.tb-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 260px; gap: 14px; align-items: center; }
.tb-mid { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tb-3d { position: relative; height: 440px; }
.tb-canvas { position: absolute; inset: 0;
  -webkit-mask-image: radial-gradient(ellipse 72% 70% at 50% 50%, #000 60%, transparent 100%);
  mask-image: radial-gradient(ellipse 72% 70% at 50% 50%, #000 60%, transparent 100%); }
.tb-panel { display: flex; flex-direction: column; border-radius: 20px; overflow: hidden; }
.tb-panel > * { margin: 0; padding: 16px 22px; border-bottom: 1px solid var(--line-faint); }
.tb-panel .k { display: block; font-size: 13px; letter-spacing: 0; color: var(--ink-soft); font-weight: 500;}
.tb-cond { padding-top: 22px; transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out); }
.tb-cond .v { display: block; margin-top: 6px; font-family: var(--display); font-weight: 900; font-stretch: 125%; font-size: 30px; line-height: 1; text-transform: uppercase; }
.tb-cond[data-state="alert"] { background: var(--ink); color: var(--red-ink); }
.tb-cond[data-state="alert"] .k { color: var(--red-ink); }
.tb-msg { min-height: 60px; font-size: 13px; line-height: 1.55; }
.tb-panel > .tb-msg:has(.ml-box) { padding: 12px 14px; }
.tb-cond[data-state="run"] .v { font-size: 24px; }
/* the 7 runs: a 4 column grid of small readouts */
.tb-runs { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 8px; padding: 14px 22px !important; }
.tb-runs .k { font-size: 12px !important; }
.tb-runs .v { display: block; margin-top: 2px; font-size: 13px; font-variant-numeric: tabular-nums; }
.tb-runs li.is-now .k { color: var(--ink); font-weight: 700; }
.tb-runs li.is-out .v { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; font-weight: 700; }
.tb-panel .tb-pulse { margin: 18px 22px 0; padding: 14px 20px; justify-content: center; border-bottom: 1px solid var(--ink); }
.tb-pulse[disabled] { opacity: .5; cursor: default; }
.tb-limits { border-bottom: 0 !important; padding-bottom: 20px !important; font-size: 12px; line-height: 1.5; color: var(--ink-soft); }

/* MATLAB windows over the test bed: they copy MATLAB's own look on purpose (light grey chrome, white
   panes, monospace Command Window), so the script reads as the real thing */
/* MATLAB windows copy MATLAB's own look on purpose (light grey chrome, white panes, monospace Command
   Window), so the script reads as the real thing */
.ml-win { background: #f0f0f0; color: #1a1a1a; border: 1px solid #a9a9a9; border-radius: 6px; overflow: hidden;
  box-shadow: 0 10px 28px rgba(60, 0, 0, .3); font: 12px/1.4 "Segoe UI", Helvetica, Arial, sans-serif; min-width: 0; }
.ml-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 10px; background: #e6e6e6; border-bottom: 1px solid #c8c8c8; font-weight: 600; font-size: 11.5px; }
.ml-file { font-weight: 400; color: #555; }
.ml-code, .ml-out { margin: 0; padding: 5px 10px; background: #fff; font: 10.5px/1.5 Consolas, "Courier New", monospace; white-space: pre-wrap; overflow: hidden; }
.ml-code { color: #444; min-height: 118px; } /* long lines wrap instead of being cut off */
.ml-code span.out { color: #1a1a1a; }
.ml-code span { display: block; padding: 0 4px; margin: 0 -4px; border-radius: 2px; }
.ml-code span.on { background: #e4f0fb; color: #000; }
.ml-plot { background: #fff; padding: 2px 4px 0; }
.ml-plot svg { display: block; width: 100%; height: auto; font: 8px Helvetica, Arial, sans-serif; fill: #262626; }
.ml-plot .g { stroke: #dedede; stroke-width: .5; }
.ml-plot .t { font-weight: 700; font-size: 9px; }
.ml-wait { margin: 0; display: grid; place-items: center; min-height: 300px; padding: 16px; text-align: center; color: #666; font-size: 12px; }
/* the script's msgbox, inside the panel */
.tb-msg .ml-box { box-shadow: none; }
.ml-box-body { display: flex; gap: 10px; align-items: center; padding: 12px 12px; background: #fff; }
.ml-box-msg { margin: 0; font-size: 12px; line-height: 1.45; }
.ml-icon { flex: none; width: 26px; height: 26px; border-radius: 50%; background: #1e6fd9; position: relative; }
.ml-icon::after { content: "i"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font: 700 15px Georgia, serif; }
.ml-box[data-kind="warn"] .ml-icon { border-radius: 0; width: 28px; height: 25px; background: #f2c200; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.ml-box[data-kind="warn"] .ml-icon::after { content: "!"; padding-top: 7px; font: 700 13px Arial, sans-serif; color: #1a1a1a; }
/* KLEAVOR tank turning demo (js/kleavor-demo.js): 3D view and key panel, then the tank turning code; fits one screen */
.kv-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 600px); gap: 14px; align-items: stretch; padding: 14px; border-radius: 22px; }
.kv-left { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.kv-3d { position: relative; height: 300px; border-radius: 14px; overflow: hidden; background: rgba(60, 0, 0, .18); }
.kv-3d .tb-canvas { -webkit-mask-image: none; mask-image: none; }
/* the controls: one strip under the 3D view (state | keys, then the live values) */
.kv-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 16px; padding: 4px 6px 0; }
.kv-panel .k { display: block; font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.kv-panel .tb-cond { padding: 0; background: none; }
.kv-panel .tb-cond .v { font-size: 20px; }
.kv-keys { display: grid; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(2, 40px); gap: 5px; justify-content: center; }
.kv-key { display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: rgba(80, 0, 0, .22);
  color: var(--ink); font: 700 15px var(--sans); cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
  transition: transform 100ms var(--ease-out), background-color 100ms ease, color 100ms ease; }
.kv-key.up { grid-column: 2; grid-row: 1; } .kv-key.left { grid-column: 1; grid-row: 2; } .kv-key.down { grid-column: 2; grid-row: 2; } .kv-key.right { grid-column: 3; grid-row: 2; }
.kv-key.is-down { background: var(--ink); color: var(--red-ink); transform: scale(.96); }
.kv-key:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.kv-vals { grid-column: 1 / -1; margin: 0; display: grid; grid-template-columns: repeat(4, auto); gap: 4px 18px; font-size: 12px; border-top: 1px solid var(--line-faint); padding-top: 10px; }
.kv-vals div { display: flex; justify-content: space-between; gap: 8px; }
.kv-vals dt { color: var(--ink-soft); }
.kv-vals dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.kv-vals dd.is-high { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.kv-code { margin: 0; display: flex; flex-direction: column; box-shadow: none; }
.kv-code pre { flex: 1; }
.kv-code pre { margin: 0; padding: 6px 0; background: #fff; font: 9.5px/1.5 Consolas, "Courier New", monospace; color: #333; white-space: pre-wrap; overflow: hidden; }
.kv-code span { display: block; padding: 0 8px 0 40px; text-indent: -34px; }
.kv-code span.on { background: #dff3f2; color: #000; }
.kv-code span.fold { color: #b0b0b0; }
.kv-code em { display: inline-block; width: 26px; margin-right: 8px; text-indent: 0; text-align: right; color: #a0a0a0; font-style: normal; }
.kv-code b { font-weight: 400; }
.kv-code b.f { color: #d35400; } .kv-code b.k { color: #00878f; } .kv-code b.t { color: #5b7c00; }
.kv-code i { color: #8a8a8a; font-style: normal; }
@media (max-width: 860px) {
  .kv-body { grid-template-columns: minmax(0, 1fr); }
  .kv-3d { height: 260px; }
  .kv-vals { grid-template-columns: repeat(2, auto); }
  .kv-code pre { font-size: 9.5px; }
}
/* MMRT sensor mount animation (js/mmrt-demo.js): the 3D view, then the steps and both sensors; fits one screen */
.sm-body { display: grid; grid-template-columns: minmax(0, 1fr) 392px; gap: 14px; padding: 14px; border-radius: 22px; }
.sm-3d { position: relative; min-height: 420px; border-radius: 14px; overflow: hidden; background: rgba(48, 0, 4, .46); transition: background-color 240ms var(--ease-out); }
.sm-3d.is-dark { background: rgba(16, 0, 2, .78); }
.sm-3d .tb-canvas { position: absolute; inset: 0; width: 100%; height: 100%; -webkit-mask-image: none; mask-image: none; }
.sm-tag { position: absolute; left: 0; top: 0; z-index: 1; padding: 2px 8px; border-radius: 999px; background: rgba(20, 0, 2, .72); font-size: 12px; font-weight: 600; pointer-events: none; opacity: 0; transition: opacity 160ms var(--ease-out); }
.sm-tag.on { opacity: 1; }
.sm-panel { display: flex; flex-direction: column; gap: 9px; min-width: 0; padding: 2px 4px 0; }
.sm-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sm-head .k { display: block; font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.sm-state { display: block; font-size: 18px; font-weight: 700; line-height: 1.25; }
.sm-play { flex: none; min-width: 100px; }
.sm-steps { margin: 0; padding: 0; list-style: none; }
.sm-steps li { padding: 5px 9px; border-radius: 9px; font-size: 12px; line-height: 1.35; color: var(--ink-soft); transition: background-color 160ms var(--ease-out); }
.sm-steps strong, .sm-steps span { display: block; }
.sm-steps strong { font-size: 13px; color: var(--ink); }
.sm-steps li.on { background: rgba(60, 0, 0, .34); }
.sm-map { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, 52px); align-items: center; justify-items: center; gap: 4px 6px; padding: 8px 9px; border-top: 1px solid var(--line-faint); border-bottom: 1px solid var(--line-faint); font-size: 12px; }
.sm-map b { font-weight: 600; color: var(--ink-soft); }
.sm-lane { justify-self: start; color: var(--ink-soft); }
.sm-tube { box-sizing: border-box; width: 16px; height: 16px; border: 2px solid var(--ink); border-radius: 50%; transition: background-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out); }
.sm-tube.shut { background: var(--ink); }
.sm-tube.now { background: #35ff8a; box-shadow: 0 0 0 3px rgba(53, 255, 138, .3); }
.sm-tube.read { background: rgba(53, 255, 138, .55); }
.sm-sensors { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sm-sensor { display: flex; flex-direction: column; min-width: 0; padding: 8px 9px; border-radius: 10px; background: rgba(50, 0, 0, .25); font-size: 11.5px; line-height: 1.35; color: var(--ink-soft); }
.sm-sensor strong { font-size: 12px; color: var(--ink); }
.sm-sensor svg { width: 100%; height: auto; margin: 4px 0 2px; }
.sm-sensor svg .axis, .sm-sensor svg .tau { fill: none; stroke: var(--line); }
.sm-sensor svg .tau { stroke-dasharray: 2 3; }
.sm-sensor svg .curve { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.sm-sensor svg text { fill: var(--ink-soft); font-size: 10.5px; }
.sm-sensor svg circle { fill: #bfe9ff; }
.sm-leds { flex: 1; min-height: 52px; display: flex; align-items: center; justify-content: space-evenly; }
.sm-leds i { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); opacity: .35; transition: opacity 120ms var(--ease-out); }
.sm-leds i.on { opacity: 1; }
.sm-leds [data-led="0"] { background: #ff3030; } .sm-leds [data-led="1"] { background: #35ff8a; } .sm-leds [data-led="2"] { background: #3a8cff; }
.sm-val { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 860px) {
  .sm-body { grid-template-columns: minmax(0, 1fr); }
  .sm-3d { min-height: 0; height: 270px; }
}
@media (max-width: 440px) {
  .sm-body { padding: 10px; }
  .sm-map { grid-template-columns: minmax(0, 1fr) repeat(3, 40px); }
}
/* Smith machine demo (js/smith-demo.js): one wide 3D view over a status line and the play button */
.sx-body { grid-template-columns: minmax(0, 1fr); gap: 10px; }
.sx-body .sx-3d { min-height: 0; height: clamp(260px, 42vw, 520px); }
.sx-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px 2px 6px; }
.sx-bar .sm-state { font-size: 16px; }
.tb-source { margin: 12px 0 0; max-width: 90ch; font-size: 12px; line-height: 1.6; color: var(--ink-soft); }
@media (max-width: 1100px) { .tb-body { grid-template-columns: minmax(0, 1fr) 260px; } .tb-3d { height: 380px; } .tb-mid { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) {
  .tb-body { grid-template-columns: minmax(0, 1fr); }
  .tb-3d { height: 300px; } .tb-mid { display: flex; }
  .tb-panel { order: 1; } .tb-mid { order: 2; } /* the button stays near the test bed */
  .tb-msg { min-height: 0; }
}

/* body: one label column, one content column, plain rules between rows */
.proj { padding: 16px 0 24px; }
.proj-row { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 12px 48px; padding: 36px 0; border-top: 1px solid var(--line-faint); }
.proj-row:first-child { border-top: 0; }
.proj-row h2 { margin: 0; padding-top: 3px; font-family: var(--sans); font-weight: 600; font-size: 14px; letter-spacing: 0; color: var(--ink-soft); }
.proj-cell { min-width: 0; max-width: 760px; }
.proj-cell p { margin: 0 0 12px; font-size: 17px; line-height: 1.7; text-wrap: pretty; }
.proj-cell p:last-child { margin-bottom: 0; }
.proj-cell .proj-result { font-family: var(--display); font-weight: 700; font-stretch: 112%; font-size: clamp(26px, 3.2vw, 40px); line-height: 1.3; letter-spacing: -.01em; text-wrap: balance; }
.proj-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.proj-list li { position: relative; padding-left: 26px; font-size: 17px; line-height: 1.65; text-wrap: pretty; }
.proj-list li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 6px; height: 6px; background: var(--ink); }
.proj-decisions { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 28px 36px; }
.proj-decisions strong { display: block; margin-bottom: 6px; font-size: 18px; font-weight: 600; line-height: 1.4; }
.proj-decisions span { display: block; font-size: 16px; line-height: 1.6; color: var(--ink-soft); text-wrap: pretty; }
.proj-steps { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.proj-steps li { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; }
.proj-links { margin: 0; padding: 0; list-style: none; }
.proj-links li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; padding: 12px 0; }
.proj-links li:first-child { padding-top: 0; }
.proj-links li + li { border-top: 1px solid var(--line); }
.proj-links a { color: inherit; font-size: 17px; font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.proj-links span { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.proj .gallery { margin: 4px auto 40px; }
.proj .table-scroll { margin-top: 4px; }
@media (max-width: 760px) {
  .proj-row { grid-template-columns: minmax(0, 1fr); padding: 28px 0; }
}

/* ------------------------------------------------------------------ */
/* Projects list                                                        */
/* ------------------------------------------------------------------ */

.list { padding: 48px 0 96px; }
.list-group { margin: 0 0 20px; font-family: var(--display); font-weight: 800; font-stretch: 125%; font-size: clamp(26px, 3vw, 34px); line-height: 1.1; text-transform: uppercase; }
.list-group + .cards { margin-bottom: 64px; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.card {
  display: flex; flex-direction: column; border-radius: 20px; overflow: hidden;
  background: rgba(120, 10, 14, .26); border: 1px solid var(--line-faint);
  transition: transform 200ms var(--ease-out), border-color 150ms ease, background-color 150ms ease;
}
a.card:active { transform: scale(.99); }
@media (hover: hover) and (pointer: fine) { a.card:hover { transform: translateY(-3px); border-color: var(--line); background: rgba(120, 10, 14, .34); } }
.card-img { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 10; background: radial-gradient(ellipse 60% 70% at 50% 55%, rgba(255,165,125,.28), transparent 70%), rgba(90, 6, 10, .3); }
.card-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.card-img img.on-white { background: #fff; }
.card-cad { aspect-ratio: 16 / 11; }
.card-cad cad-viewer { position: absolute; inset: 0; }
.cards-text .card-body, .card.is-text .card-body { padding-top: 28px; }
/* home fallback when 3D fails: a plain box where the model would float */
.unit-box { position: relative; bottom: 30px; width: min(100%, 200px); aspect-ratio: 4 / 3; border-radius: 18px; background: rgba(120, 10, 14, .26); border: 1px solid var(--line-faint); }
.card-img .flag { position: absolute; left: 14px; top: 14px; padding: 4px 10px; border-radius: 999px; background: var(--ink); color: var(--red-ink); font-size: 13px; letter-spacing: 0; font-weight: 500;}
.card-img.nda { aspect-ratio: auto; min-height: 140px; padding: 0 24px; text-align: center; font-size: 13px; letter-spacing: 0; color: var(--ink); font-weight: 500;}
.card-body { display: flex; flex-direction: column; gap: 10px; padding: 22px 24px 26px; flex: 1; }
.card-meta { font-size: 14px; letter-spacing: 0; color: var(--ink-soft); font-weight: 500;}
.card-title { font-family: var(--display); font-weight: 900; font-stretch: 125%; font-size: clamp(28px, 3.4vw, 42px); line-height: 1; text-transform: uppercase; }
.card-desc { font-size: 17px; line-height: 1.55; text-wrap: pretty; }
.card-role { font-size: 15px; color: var(--ink-soft); }
.card-role strong { color: var(--ink); font-weight: 500; }
.card-tags { margin-top: auto; padding-top: 6px; }
@media (max-width: 760px) { .cards { grid-template-columns: minmax(0, 1fr); } }

.cad-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; font-size: 13px; letter-spacing: 0; color: var(--ink-soft); font-weight: 500;}
.cad-failed { padding: 0 24px; text-align: center; text-transform: none; letter-spacing: .01em; font-size: 14px; line-height: 1.6; color: var(--ink); }
@media (max-width: 860px) {
  .cad-inline { grid-template-columns: minmax(0, 1fr); min-height: 0; gap: 16px; }
  .cad-inline { padding-top: 28px; }
  .cad-inline .viewer { position: relative; left: auto; width: auto; margin: 0 calc(50% - 50vw); height: 56vh; min-height: 320px; }
  .cad-inline .cad-panel { grid-column: auto; }
}

/* previous / next at the end of a write-up: plain text over a thin rule, no boxes */
.switch { margin-top: 32px; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding-top: 28px; padding-bottom: 80px; border-top: 1px solid var(--line-faint); }
.switch a { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; color: var(--ink); }
.switch a:active { transform: scale(.99); }
.switch .next { align-items: flex-end; text-align: right; }
.switch .lbl { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.switch .nm { font-family: var(--display); font-weight: 900; font-stretch: 125%; font-size: clamp(22px, 2.6vw, 34px); line-height: 1.05; text-transform: uppercase; text-wrap: balance; transition: color 150ms ease; }
@media (hover: hover) and (pointer: fine) { .switch a:hover .nm { color: #fff; } .switch a:hover .lbl { color: var(--ink); } }
@media (max-width: 560px) { .switch { grid-template-columns: 1fr; gap: 12px; } .switch .next { align-items: flex-start; text-align: left; } }

/* ------------------------------------------------------------------ */
/* About                                                                */
/* ------------------------------------------------------------------ */

.about-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 64px; padding: 56px 0 72px; }
.about-grid .section:first-child { margin-top: 0; }
.panel { padding: 28px; border-radius: 20px; }
.panel + .panel { margin-top: 24px; }
.panel h2 { margin: 0 0 16px; font-size: 13px; font-weight: 500; letter-spacing: 0; }


.kv { list-style: none; margin: 0; padding: 0; }
.kv li { display: grid; grid-template-columns: 76px 1fr; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line-faint); font-size: 13.5px; line-height: 1.5; }
.kv li:first-child { border-top: 0; padding-top: 0; }
.kv li span:first-child { font-size: 13px; letter-spacing: 0; color: var(--ink-soft); padding-top: 2px; font-weight: 500;}

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags span { padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; letter-spacing: 0; font-weight: 500;}

@media (max-width: 860px) { .about-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; } }

/* ------------------------------------------------------------------ */
/* Contact band + footer                                                */
/* ------------------------------------------------------------------ */

.contact { padding-top: 72px; padding-bottom: 72px; } /* keep .wrap's side gutters */
.contact-card { padding: clamp(28px, 5vw, 56px); border-radius: 24px; display: flex; flex-direction: column; gap: 18px; align-items: flex-start; }
.contact-card h2 { margin: 0; font-family: var(--display); font-weight: 900; font-stretch: 125%; font-size: clamp(30px, 4.6vw, 52px); line-height: .95; text-transform: uppercase; }
.contact-card p { margin: 0; max-width: 560px; color: var(--ink-soft); }
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

.site-foot {
  border-top: 1px solid var(--line);
  padding: 18px 0 22px;
  font-size: 13px; letter-spacing: 0; color: var(--ink-soft);
  font-weight: 500;
}
.site-foot .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-foot nav { display: flex; gap: 14px; }

/* ------------------------------------------------------------------ */
/* Motion                                                               */
/* ------------------------------------------------------------------ */

/* page to page: the home model grows into the viewer on its project page (and back).
   Browsers without cross-document view transitions just load the page. */
@view-transition { navigation: auto; }
.cad-inline .viewer { view-transition-name: cad; }
::view-transition-group(cad) { animation-duration: 450ms; animation-timing-function: cubic-bezier(.77, 0, .175, 1); }
::view-transition-old(cad) { animation-duration: 450ms; }
::view-transition-group(root) { animation-duration: 250ms; }
/* home entrance: the title block rises in once, then each model fades in on its first frame (cad-viewer.js) */
@keyframes nfdRise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.hero-title > * { animation: nfdRise 400ms var(--ease-out) both; }
.hero-title > :nth-child(2) { animation-delay: 60ms; }
.hero-title > :nth-child(3) { animation-delay: 110ms; }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
/* Linkshaft Micrometer demos (js/linkshaft-demo.js): the Smith layout plus a pass chip */
.lm-verdict { margin-left: auto; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; font-weight: 600; white-space: nowrap; transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out); }
.lm-verdict:empty { display: none; }
.lm-verdict.ok { background: #35ff8a; border-color: #35ff8a; color: #062a14; }
