/* Dark by default; light when the visitor picks it (html[data-theme="light"]). */
:root {
  color-scheme: dark;
  --page: #16181b;
  --ink: #e4e7ec;
  --muted: #9aa2ae;
  --rule: #343840;
  --dense: #a3b2ff;     /* blue end of the slicer's density colour map, lifted for dark */
  --sparse: #f0617f;    /* red end */
  --bed: #222428;
  --bed-ink: #d9dce2;
  --text: 40rem;
  --wide: 82rem;
  --gutter: 16px;
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f1f1ee;
  --ink: #1c2230;
  --muted: #586070;
  --rule: #d3d4cf;
  --dense: #3446b0;
  --sparse: #c2304d;
}
@media (min-width: 720px) { :root { --gutter: 40px; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  font-size: 1.125rem;
  line-height: 1.62;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--dense); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--dense); outline-offset: 3px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.text, .wide { margin-left: auto; margin-right: auto; padding-left: var(--gutter); padding-right: var(--gutter); }
/* Text and media share one left edge; media runs wider to the right. */
.text, .wide { max-width: calc(var(--wide) + 2 * var(--gutter)); }
.text > * { max-width: var(--text); }

/* ---------- Hero: the print bed ---------- */
.hero { background: var(--bed); color: var(--bed-ink); }
.bed {
  position: relative;
  height: clamp(340px, 64vh, 640px);
  background-color: var(--bed);
  /* 10 mm grid, the way a slicer draws the bed */
  background-image:
    linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: center;
  overflow: hidden;
}
@media (max-width: 639px) { .bed { height: clamp(280px, 50vh, 420px); } }
.bed canvas { position: absolute; inset: 0; }
.controls {
  display: grid; gap: 22px 40px; align-items: start;
  padding: 26px var(--gutter) 34px;
  max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 0 auto;
  font-size: 0.95rem; color: #a7adb8;
}
/* Wide screens: explanation beside the print box, then V*, H* and the regime readout. */
@media (min-width: 900px) {
  .controls { grid-template-columns: 1fr 1fr minmax(18rem, 1.1fr); }
  .controls .explain { grid-column: 1 / 3; }
  form.print { grid-column: 3; grid-row: 1; }
  #regime { grid-column: 3; grid-row: 2; align-self: start; padding-top: 4px; }
}
.controls .explain { margin: 0; max-width: 64ch; color: var(--bed-ink); font-size: 1.02rem; }
.knob p { margin: 4px 0 0; line-height: 1.45; }
.knob label { display: flex; align-items: baseline; gap: 10px; color: var(--bed-ink); }
.knob label b { font-size: 1.15rem; color: #fff; }
.controls output { font-family: "Atkinson Hyperlegible Mono", ui-monospace, monospace; font-size: 0.95rem; color: #f3d79a; }
#regime { margin: 0; color: #8fd6a4; min-height: 1.45em; }
#regime::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-right: 8px; vertical-align: 1px; }
#regime.warn { color: #f3a35b; }

/* The print box: one field with the button inside it, like a slicer's job bar. */
form.print { display: grid; gap: 8px; justify-items: start; }
form.print > label { color: var(--bed-ink); font-weight: 600; }
.hero :focus-visible { outline-color: #f3d79a; }
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; max-width: 300px; height: 24px; background: transparent; cursor: pointer; margin: 2px 0 0;
}
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--track, linear-gradient(90deg, #7a8cff, #b078d6, #eb4a68)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--track, linear-gradient(90deg, #7a8cff, #b078d6, #eb4a68)); }

/* ---------- Intro ---------- */
.intro { padding-top: 64px; padding-bottom: 24px; }
.lede { font-size: clamp(1.3rem, 2.6vw, 1.65rem); line-height: 1.42; margin: 0; letter-spacing: -0.005em; }
.facts { margin: 22px 0 0; color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 8px 26px; margin: 22px 0 0; padding: 0; list-style: none; font-weight: 600; }

/* ---------- Projects ---------- */
section.project { padding: 96px 0 0; }
h2 {
  font-size: clamp(1.9rem, 4.6vw, 3.1rem);
  line-height: 1.05; letter-spacing: -0.02em; font-weight: 750;
  margin: 0; max-width: 18ch;
}
.meta { margin: 12px 0 0; color: var(--muted); }
.prose { margin-top: 28px; }
.prose p { margin: 0 0 1em; }
.prose ul { margin: 0 0 1em; padding-left: 1.1em; }
.prose li { margin-bottom: 0.5em; }
.prose li::marker { color: var(--sparse); }
.numbers { font-variant-numeric: tabular-nums; }

/* Viewers sit on the page itself, no boxes. */
.viewer {
  position: relative; margin-top: 36px; aspect-ratio: 16 / 9; width: 100%;
  touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none;
}
.viewer.tall { aspect-ratio: 16 / 10; }
.viewer.dragging { cursor: grabbing; }
.viewer canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.viewer .fallback { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: none; }
.no-js .viewer .fallback, .viewer.failed .fallback { display: block; }
.viewer.loading::after {
  content: "Loading the model…"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  color: var(--muted); font-size: 0.95rem;
}
.caption { margin: 10px 0 0; font-size: 0.95rem; color: var(--muted); max-width: var(--text); }

/* Configuration switcher for the game table */
.pair { display: grid; gap: 24px; margin-top: 36px; }
@media (min-width: 760px) { .pair { grid-template-columns: 1fr 1fr; } }
.pair .viewer { margin-top: 0; aspect-ratio: 1 / 1; }
figure { margin: 0; }
.figure { margin-top: 36px; }
.figure img { width: 100%; border-radius: 3px; }

/* ---------- Experience and skills ---------- */
dl.skills { margin: 28px 0 0; display: grid; gap: 14px 28px; }
@media (min-width: 720px) { dl.skills { grid-template-columns: 13rem 1fr; } }
dl.skills dt { font-weight: 700; }
dl.skills dd { margin: 0; color: var(--muted); }

footer { margin-top: 120px; background: var(--bed); color: var(--bed-ink); padding: 56px 0 64px; }
footer h2 { color: #fff; }
footer p { color: #a7adb8; margin: 14px 0 0; }
footer .links a { color: #b9c3ff; }

@media print {
  .hero, .viewer, .configs, .sheet-tabs { display: none; }
  footer { background: none; color: var(--ink); }
}

/* ---------- Two-column sections ----------
   Phones and tablets: one column in reading order (heading, main model, text, then figures).
   Wide screens: text on the left, staying in view while the models and figures scroll past. */
.split { max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); display: flex; flex-direction: column; }
.split .col-text, .split .col-media { display: contents; }
.split .head { order: 1; }
.split .lead-media { order: 2; }
.split .prose { order: 3; max-width: var(--text); }
.split .col-media > :not(.lead-media) { order: 4; }
.split .lead-media.pair { margin-top: 36px; }

@media (min-width: 1100px) {
  .split { display: grid; grid-template-columns: minmax(0, 27rem) minmax(0, 1fr); gap: 0 80px; align-items: start; }
  .split .col-text, .split .col-media { display: block; }
  .split .col-text { position: sticky; top: 40px; }
  .split .col-media > :first-child, .split .col-media > :first-child .viewer { margin-top: 0; }
  .split .prose { margin-top: 24px; }
  /* Text-only sections: heading on the left, text on the right. */
  .split:not(:has(.col-media)) .col-text { display: contents; }
  .split:not(:has(.col-media)) .prose { margin-top: 0; grid-column: 2; }
  .split:not(:has(.col-media)) dl.skills { margin-top: 0; }
  /* Intro and footer: statement on the left, details on the right. */
  .intro.split { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: end; }
  .intro .intro-side .facts { margin-top: 0; }
  footer .split { align-items: end; }
  footer .split p { margin-top: 0; }
}

/* Spacing fixes for the split layout: .split's padding shorthand must not eat the intro's
   top padding, and headings sized for a 27rem column. */
.intro.split { padding-top: 72px; padding-bottom: 24px; }
@media (min-width: 1100px) {
  .split h2 { font-size: clamp(2rem, 2.6vw, 2.5rem); max-width: none; }
  .intro.split { padding-top: 88px; }
}

.hero { position: relative; }

/* ---------- Photography page ---------- */
.photo-top { border-bottom: 1px solid var(--rule); }
.split-bar { max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 0 auto; padding: 14px var(--gutter); display: flex; justify-content: space-between; align-items: center; }
.split-bar .home { color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.split-bar .home::before { content: "\2190\00a0"; color: var(--muted); }
.photo-intro { max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 0 auto; padding: 56px var(--gutter) 8px; }
.photo-intro h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.05; letter-spacing: -0.02em; margin: 0; }
.photo-intro p { max-width: 62ch; color: var(--muted); margin: 14px 0 0; }
/* Column flow keeps each photo's own shape; no cropping. */
.gallery { max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 32px auto 0; padding: 0 var(--gutter); columns: 1; column-gap: 20px; }
@media (min-width: 640px) { .gallery { columns: 2; } }
@media (min-width: 1100px) { .gallery { columns: 3; } }
.shot { break-inside: avoid; margin: 0 0 22px; }
.shot a { display: block; border-radius: 3px; overflow: hidden; background: var(--rule); }
.shot img { width: 100%; height: auto; transition: transform 0.35s ease; }
.shot a:hover img, .shot a:focus-visible img { transform: scale(1.02); }
.shot figcaption { margin-top: 8px; font-size: 0.92rem; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .shot img { transition: none; } }

dialog.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(8, 9, 11, 0.96); color: #e4e7ec; }
dialog.lightbox::backdrop { background: rgba(8, 9, 11, 0.96); }
.photo-section { max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 48px auto 0; padding: 0 var(--gutter); font-size: 1.5rem; letter-spacing: -0.01em; }
.photo-note { max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 6px auto 0; padding: 0 var(--gutter); color: var(--muted); font-size: 0.95rem; }
.stream { max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 24px auto 0; padding: 0 var(--gutter); display: flex; gap: 20px; align-items: flex-start; }
.stream .col { flex: 1; min-width: 0; }
.stream-status { margin-top: 8px; margin-bottom: 0; }
.stream-more { height: 1px; }

.shot figcaption .title { display: block; color: var(--ink); }
.shot figcaption .meta { display: block; font-size: 0.85rem; color: var(--muted); }
.shot a { position: relative; }
.shot .star {
  position: absolute; top: 8px; right: 10px; pointer-events: none;
  font-size: 0.95rem; line-height: 1; color: rgba(255, 255, 255, 0.7); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

/* ---------- Printed parts: drawing sheets ----------
   Each part is a sheet from a drawing package: tabs along the top edge (one balloon number per
   part), the view with its overall dimensions, a layer scale like a slicer's on the right, and a
   title block. Dragging the scale prints the part with the toolpaths from its real G-code. */
:root {
  --sheet: #1c1f23; --sheet-line: #3d424b; --sheet-tab: #16181b; --sheet-ink: #e2e6ec; --sheet-muted: #7f8794;
  --sheet-dim: #93a3ff; --sheet-hot: #f3d79a;
  --path-wall: #f3d79a; --path-skin: #e2e6ec; --path-fill: #93a3ff;
}
:root[data-theme="light"] {
  --sheet: #fbfbf8; --sheet-line: #b9bcc3; --sheet-tab: #ececea; --sheet-ink: #1c2230; --sheet-muted: #7a8190;
  --sheet-dim: #3446b0; --sheet-hot: #b86e0a;
  --path-wall: #c26a00; --path-skin: #1c2230; --path-fill: #3446b0;
}
.sheet { margin-top: 36px; background: var(--sheet); border: 1px solid var(--sheet-line); color: var(--sheet-ink); }
.split .col-media > .lead-media:first-child .sheet { margin-top: 0; }

/* Tabs along the sheet's top edge. The open one joins the drawing below it. */
.sheet-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--sheet-tab); }
.sheet-tabs [role=tab] {
  display: flex; align-items: center; gap: 9px; min-width: 0; text-align: left;
  font: inherit; font-size: 0.92rem; line-height: 1.25; color: var(--sheet-muted);
  background: transparent; border: 0; border-bottom: 1px solid var(--sheet-line); border-right: 1px solid var(--sheet-line);
  padding: 11px 12px 10px; cursor: pointer;
}
.sheet-tabs [role=tab]:last-child { border-right: 0; }
.sheet-tabs [role=tab]:hover { color: var(--sheet-ink); }
.sheet-tabs [role=tab][aria-selected="true"] { color: var(--sheet-ink); background: var(--sheet); border-bottom-color: transparent; font-weight: 700; }
.sheet-tabs [role=tab]:focus-visible { outline-offset: -4px; }
.balloon {
  flex: none; display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%;
  border: 1px solid currentColor; font-size: 0.8rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
[aria-selected="true"] .balloon { border-color: var(--sheet-hot); color: var(--sheet-hot); }
@media (max-width: 560px) {
  .sheet-tabs [role=tab] { flex-direction: column; align-items: flex-start; gap: 5px; padding: 9px 8px 8px; font-size: 0.82rem; }
}

.sheet > .viewer { margin: 0; aspect-ratio: 4 / 3; overflow: hidden; }
@media (min-width: 620px) { .sheet > .viewer { aspect-ratio: 16 / 10; } }
.dims span {
  position: absolute; left: 0; top: 0; padding: 0 4px; white-space: nowrap; pointer-events: none;
  font-size: 0.8rem; font-variant-numeric: tabular-nums; color: var(--sheet-dim); background: var(--sheet);
}

/* The layer scale: a vertical ruler on the right. The marker is the layer being printed. */
.zscale { position: absolute; top: 10%; bottom: 12%; right: 14px; width: 28px; z-index: 2; }
.zscale::before {      /* ruler ticks */
  content: ""; position: absolute; inset: 0 0 0 auto; width: 10px; pointer-events: none;
  background: repeating-linear-gradient(to top, var(--sheet-line) 0 1px, transparent 1px 10%);
  border-right: 1px solid var(--sheet-line);
}
.zscale input[type=range] {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; margin: 0;
  writing-mode: vertical-lr; direction: rtl; cursor: ns-resize; touch-action: none;
}
.zscale input[type=range]::-webkit-slider-runnable-track {
  width: 3px; height: 100%; border-radius: 0; margin-left: 24px;
  background: linear-gradient(to top, var(--sheet-hot) var(--p, 0%), transparent var(--p, 0%));
}
/* Firefox: the track has to be told to run the full height of a vertical slider, or it shrinks to
   a 3 px dot in the middle. Its own progress part draws the printed height. */
.zscale input[type=range]::-moz-range-track { width: 3px; height: 100%; border-radius: 0; background: transparent; }
.zscale input[type=range]::-moz-range-progress { width: 3px; border-radius: 0; background: var(--sheet-hot); }
.zscale input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 6px; margin-left: -13px; border-radius: 1px; border: 0; background: var(--sheet-hot);
}
.zscale input[type=range]::-moz-range-thumb { width: 26px; height: 6px; border-radius: 1px; border: 0; background: var(--sheet-hot); }
.zscale input[type=range]:focus-visible { outline: none; }
.zscale input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--sheet), 0 0 0 5px var(--sheet-hot); }
.zscale input[type=range]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--sheet), 0 0 0 5px var(--sheet-hot); }
.zscale output {
  position: absolute; right: 36px; bottom: calc(var(--p, 0) * 100%); transform: translateY(50%);
  white-space: nowrap; text-align: right; pointer-events: none;
  font-size: 0.78rem; line-height: 1.3; font-variant-numeric: tabular-nums; color: var(--sheet-muted);
  background: var(--sheet); padding: 1px 4px;
}
.zscale output b { display: block; font-size: 0.86rem; color: var(--sheet-ink); }

.legend { position: absolute; left: 12px; bottom: 10px; display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 0; padding: 0; list-style: none; font-size: 0.78rem; color: var(--sheet-muted); pointer-events: none; }
.legend li { background: var(--sheet); padding-right: 4px; }
.legend li::before { content: ""; display: inline-block; width: 14px; height: 2px; margin-right: 6px; vertical-align: 3px; }
.legend .wall::before { background: var(--path-wall); }
.legend .skin::before { background: var(--path-skin); }
.legend .fill::before { background: var(--path-fill); }

.titleblock { display: grid; border-top: 1px solid var(--sheet-line); }
.tb-main { padding: 10px 12px; }
.tb-main h3 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.tb-main p { margin: 4px 0 0; font-size: 0.92rem; line-height: 1.45; color: var(--muted); max-width: 52ch; }
.tb-fields { display: grid; grid-template-columns: repeat(4, minmax(0, auto)); margin: 0; border-top: 1px solid var(--sheet-line); }
.tb-fields div { padding: 5px 10px 6px; border-right: 1px solid var(--sheet-line); }
.tb-fields div:nth-child(4n) { border-right: 0; }
.tb-fields div:nth-child(-n+4) { border-bottom: 1px solid var(--sheet-line); }
.tb-fields dt { font-size: 0.72rem; color: var(--sheet-muted); }
.tb-fields dd { margin: 0; font-size: 0.86rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 560px) {
  .tb-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-fields div:nth-child(4n) { border-right: 1px solid var(--sheet-line); }
  .tb-fields div:nth-child(2n) { border-right: 0; }
  .tb-fields div:nth-child(-n+6) { border-bottom: 1px solid var(--sheet-line); }
}
@media (min-width: 1100px) {
  .titleblock { grid-template-columns: minmax(0, 1fr) auto; }
  .tb-fields { border-top: 0; border-left: 1px solid var(--sheet-line); }
}

/* ---------- Controls ----------
   One language for every control on the site. Choices (the table's configurations, the theme) are
   words on a hairline, and the chosen one carries the printer's amber bar, the same amber as the
   nozzle, the layer marker and the Print button. Actions are words too, except Print, the one
   button that starts something. */
:root { --amber: #f3d79a; --amber-deep: #a9813f; }
:root[data-theme="light"] { --amber: #b86e0a; --amber-deep: #8a5208; }

/* Range thumbs: a flat bar, like the handle on a slicer's layer slider. */
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 8px; height: 22px; margin-top: -9px; border-radius: 1px; border: 0; background: #f3d79a; }
input[type=range]::-moz-range-thumb { width: 8px; height: 22px; border-radius: 1px; border: 0; background: #f3d79a; }
input[type=range]:hover::-webkit-slider-thumb { background: #fff; }
input[type=range]:hover::-moz-range-thumb { background: #fff; }

/* Hero: site links and the theme switch, top right of the bed. */
/* Site links on the left, the theme switch alone on the right. */
.hero-nav {
  position: absolute; top: 12px; left: var(--gutter); right: var(--gutter); z-index: 3;
  display: flex; align-items: center; justify-content: space-between; gap: 6px 22px; font-size: 0.92rem;
}
.site-links { display: flex; gap: 22px; }
.site-links a { color: var(--bed-ink); text-decoration: none; padding: 6px 0; border-bottom: 1px solid rgba(217, 220, 226, 0.35); }
.site-links a:hover { color: #fff; border-bottom-color: #fff; }

/* Dark / Light */
.theme-switch { display: inline-flex; gap: 12px; }
.theme-switch button {
  font: inherit; font-size: 0.92rem; color: inherit; opacity: 0.62; background: none; border: 0;
  border-bottom: 2px solid transparent; padding: 6px 0 4px; cursor: pointer;
}
.theme-switch button:hover { opacity: 1; }
.theme-switch button[aria-pressed="true"] { opacity: 1; font-weight: 700; border-bottom-color: var(--amber); cursor: default; }
.hero .theme-switch { color: var(--bed-ink); }
.hero .theme-switch button[aria-pressed="true"] { border-bottom-color: #f3d79a; }

/* Print box: you type on a baseline, the way the thread prints along one. */
form.print .field { display: flex; align-items: flex-end; gap: 14px; width: 100%; }
form.print input[type=text] {
  flex: 1; min-width: 0; font: inherit; font-size: 1.1rem; color: #fff; background: transparent;
  border: 0; border-bottom: 1.5px solid #5a616c; border-radius: 0; padding: 8px 0 7px; outline: none;
  transition: border-color 0.15s;
}
form.print input[type=text]:hover { border-bottom-color: #8b929d; }
form.print input[type=text]:focus { border-bottom-color: #f3d79a; }
form.print input[type=text]::placeholder { color: #7d8490; }
form.print .field button {
  font: inherit; font-weight: 700; color: #1a1b1e; background: #f3d79a;
  border: 0; border-radius: 2px; padding: 8px 18px; cursor: pointer;
}
form.print .field button:hover { background: #fff; }
form.print button.quiet {
  font: inherit; font-size: 0.9rem; color: #a7adb8; background: none; border: 0; padding: 2px 0; cursor: pointer;
  border-bottom: 1px solid rgba(167, 173, 184, 0.4);
}
form.print button.quiet:hover { color: var(--bed-ink); border-bottom-color: var(--bed-ink); }

/* Configurations of a model: tabs along the top of the viewer. */
.configs { display: flex; flex-wrap: wrap; gap: 0 22px; margin: 36px 0 0; padding: 0; list-style: none; border-bottom: 1px solid var(--rule); }
.configs button {
  font: inherit; font-size: 0.95rem; color: var(--muted); background: none; border: 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 8px 0 8px; cursor: pointer;
}
.configs button:hover { color: var(--ink); }
.configs button[aria-pressed="true"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--amber); }
.configs + .viewer { margin-top: 8px; }
@media (min-width: 1100px) { .split .col-media > .lead-media:first-child > .configs:first-child { margin-top: 0; } }

/* Photography page: top bar theme switch, and the viewer. */
.split-bar .theme-switch { color: var(--ink); }
/* Phones: the site links get their own strip above the bed, clear of the printed name. */
@media (max-width: 639px) {
  .hero-nav { position: static; padding: 8px var(--gutter) 0; }
}
/* Phones: the layer readout stays in the top corner instead of riding the marker over the part. */
@media (max-width: 560px) {
  .zscale { top: 14%; }
  .zscale output { top: -14%; bottom: auto; right: 0; transform: translateY(-4px); }
  .zscale output b { display: inline; margin-right: 4px; }
  .legend { bottom: 6px; gap: 2px 10px; }
}

/* ---------- Live from the printer ----------
   Another sheet from the same drawing package: a header strip like the tabs, the printhead camera,
   a layer rule like the slicer's scale (laid flat), and title-block fields. Amber means it's live. */
.live { margin-top: 36px; }
.live .sheet { margin-top: 0; }
.live-head {
  display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap;
  padding: 10px 12px 9px; background: var(--sheet-tab); border-bottom: 1px solid var(--sheet-line);
}
.live-head h3 { margin: 0; font-size: 0.92rem; font-weight: 700; line-height: 1.25; display: flex; align-items: center; gap: 9px; }
.live-printer { font-size: 0.82rem; color: var(--sheet-muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sheet-muted); flex: none; }
.live[data-state="printing"] .live-dot { background: var(--amber); animation: live-pulse 2.4s ease-in-out infinite; }
.live[data-state="paused"] .live-dot { background: var(--amber); }
@keyframes live-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .live[data-state="printing"] .live-dot { animation: none; } }

.live-body { display: grid; }
.live-cam { margin: 0; border-bottom: 1px solid var(--sheet-line); background: #0d0e10; }
.live-cam[hidden] { display: none; }
/* Phones: a short landscape crop around the nozzle tip, where the part is. */
.live-cam img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: 50% 85%; }
.live-cam figcaption { padding: 5px 12px 6px; font-size: 0.72rem; color: var(--sheet-muted); background: var(--sheet); border-top: 1px solid var(--sheet-line); }
@media (min-width: 620px) {
  .live-body:has(.live-cam:not([hidden])) { grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); }
  .live-cam { border-bottom: 0; border-right: 1px solid var(--sheet-line); display: flex; flex-direction: column; }
  .live-cam[hidden] { display: none; }
  .live-cam img { flex: 1; aspect-ratio: 384 / 564; object-position: 50% 50%; }
}

.live-info { display: flex; flex-direction: column; min-width: 0; }
.live-name { margin: 0; padding: 12px 12px 4px; font-size: 0.95rem; line-height: 1.4; color: var(--sheet-muted); }
.live-name b { color: var(--sheet-ink); font-size: 1.05rem; }

/* The layer rule: ticks every 10%, amber up to the layer being printed. */
.live-rule { padding: 6px 12px 12px; }
.live-rule p:first-child { display: flex; justify-content: space-between; margin: 0 0 6px; font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.live-rule p:first-child span:last-child { color: var(--sheet-hot); font-weight: 700; }
.live-track {
  position: relative; height: 12px; border-bottom: 1px solid var(--sheet-line);
  background: repeating-linear-gradient(to right, var(--sheet-line) 0 1px, transparent 1px 10%) bottom / 100% 6px no-repeat;
}
.live-track span { position: absolute; left: 0; bottom: -1px; height: 3px; width: 0; background: var(--sheet-hot); transition: width 0.6s ease; }
.live-track span::after { content: ""; position: absolute; right: -1px; bottom: 0; width: 3px; height: 12px; background: var(--sheet-hot); }
@media (prefers-reduced-motion: reduce) { .live-track span { transition: none; } }

/* Title-block fields: one row of four for the last print, two rows of three while printing. */
.live .tb-fields { margin-top: auto; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--sheet-line); border-left: 0; }
.live .tb-fields div { border-bottom: 0; border-right: 1px solid var(--sheet-line); }
.live .tb-fields div:last-child { border-right: 0; }
.live:is([data-state="printing"], [data-state="paused"]) .tb-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.live:is([data-state="printing"], [data-state="paused"]) .tb-fields div:nth-child(3n) { border-right: 0; }
.live:is([data-state="printing"], [data-state="paused"]) .tb-fields div:nth-child(-n+3) { border-bottom: 1px solid var(--sheet-line); }
@media (max-width: 560px) {
  .live .tb-fields, .live:is([data-state="printing"], [data-state="paused"]) .tb-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .live .tb-fields div:nth-child(n) { border-right: 1px solid var(--sheet-line); border-bottom: 1px solid var(--sheet-line); }
  .live .tb-fields div:nth-child(2n) { border-right: 0; }
  .live .tb-fields div:nth-last-child(-n+2):nth-child(odd), .live .tb-fields div:last-child { border-bottom: 0; }
}

/* ---------- Contact ----------
   Resume, LinkedIn and email as a small block of rows, like the title block on the drawing
   sheets: what it is on the left, where it goes on the right. The whole row is the link. */
.contact { list-style: none; margin: 24px 0 0; padding: 0; max-width: 30rem; border-top: 1px solid var(--rule); }
.contact a {
  display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); align-items: baseline; gap: 12px;
  padding: 11px 12px 11px 12px; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none;
  transition: box-shadow 0.15s, background-color 0.15s;
}
.contact .k { font-size: 0.82rem; color: var(--muted); }
.contact .v { font-weight: 600; overflow-wrap: anywhere; }
.contact a:hover, .contact a:focus-visible { background: color-mix(in srgb, var(--ink) 5%, transparent); box-shadow: inset 3px 0 0 var(--amber); }
.contact a:focus-visible { outline-offset: -2px; }
footer .contact { border-top-color: #3a3f47; }
footer .contact a { color: #fff; border-bottom-color: #3a3f47; }
footer .contact .k { color: #8b929d; }
footer .contact a:hover, footer .contact a:focus-visible { background: rgba(255, 255, 255, 0.05); box-shadow: inset 3px 0 0 #f3d79a; }
@media (min-width: 1100px) { .intro .contact, footer .contact { margin-top: 18px; } }

/* ---------- Photography on the home page ----------
   Photos drift across the full width of the screen in the same colour order as the photo page. */
.photo-teaser h2 a { color: inherit; text-decoration: none; background-image: linear-gradient(var(--amber), var(--amber)); background-size: 0 2px; background-position: 0 100%; background-repeat: no-repeat; transition: background-size 0.25s; }
.photo-teaser h2 a:hover, .photo-teaser h2 a:focus-visible { background-size: 100% 2px; }
.drift {
  display: block; margin-top: 30px; height: 210px; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}
@media (max-width: 639px) { .drift { height: 150px; margin-top: 22px; } }
.drift-track { display: flex; height: 100%; width: max-content; animation: drift var(--dur, 600s) linear infinite; animation-play-state: paused; }
.drift.running .drift-track { animation-play-state: running; }
.drift:hover .drift-track, .drift:focus-visible .drift-track { animation-play-state: paused; }
.drift img { height: 100%; width: auto; margin-right: 10px; border-radius: 2px; background: var(--rule); }
@keyframes drift { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .drift { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
  .drift-track { animation: none; }
}

/* ---------- VTP playback ----------
   Top view of the slicer's G-code running: the plate turns under the four-nozzle carriage. */
:root { --bed-plate: #23262b; --nozzle-0: #93a3ff; --nozzle-1: #f3d79a; --nozzle-2: #8fd6a4; --nozzle-3: #f0617f; }
:root[data-theme="light"] { --bed-plate: #e7e8e4; --nozzle-0: #3d55c9; --nozzle-1: #d08a12; --nozzle-2: #2f9256; --nozzle-3: #cf3555; }
.vtpsim { margin: 36px 0 0; }
.vtpsim-stage { position: relative; aspect-ratio: 16 / 11; background: var(--sheet); border: 1px solid var(--sheet-line); }
.vtpsim-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.vtpsim-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 0 0; }
.vtpsim-play {
  flex: none; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer;
  background: none; border: 1px solid var(--rule); border-radius: 2px; color: var(--ink);
}
.vtpsim-play:hover { border-color: var(--ink); }
.vtpsim-play span { width: 10px; height: 12px; border-left: 3px solid currentColor; border-right: 3px solid currentColor; }
.vtpsim-play.paused span { width: 0; height: 0; border-style: solid; border-width: 6px 0 6px 11px; border-color: transparent transparent transparent currentColor; margin-left: 3px; }
.vtpsim-bar input[type=range] { flex: 1 1 160px; max-width: none; --track: linear-gradient(90deg, var(--amber) var(--p, 0%), var(--rule) var(--p, 0%)); }
.vtpsim-read { display: flex; gap: 16px; font-size: 0.86rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.vtpsim-read .l { color: var(--ink); }
@media (max-width: 560px) { .vtpsim-read { width: 100%; justify-content: space-between; } }

/* The printer's status line under the layer rule: what it's doing, then its numbers, read off
   like a title block's fields: hairline-separated, tabular. Heating is amber. */
.live-now { display: flex; flex-wrap: wrap; gap: 2px 0; margin: 9px 0 0; font-size: 0.84rem; line-height: 1.35; color: var(--sheet-muted); font-variant-numeric: tabular-nums; }
.live-now:empty { display: none; }
.live-now span { padding: 0 10px; border-left: 1px solid var(--sheet-line); white-space: nowrap; }
.live-now span:first-child { padding-left: 0; border-left: 0; color: var(--sheet-ink); font-weight: 700; }
.live-now[data-phase="heat"] span:first-child { color: var(--sheet-hot); }

/* ---------- Photography: the gradient ----------
   Rows keep the colour order left to right, top to bottom. The page shades itself toward the
   photos in the middle of the screen, and the spectrum at the top is the whole set in order. */
.photo-page { transition: background-color 0.5s linear; }
.stream { display: block; }
.stream .row { display: flex; gap: 6px; margin-bottom: 6px; }
.stream .shot { flex: none; margin: 0; }
.stream .shot a { height: 100%; border-radius: 0; background: var(--c, var(--rule)); }
.stream .shot img { width: 100%; height: 100%; object-fit: cover; }
.spectrum {
  position: sticky; top: 0; z-index: 4; cursor: pointer; padding: 8px var(--gutter) 6px;
  background: color-mix(in srgb, var(--page) 70%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 16px auto 0; box-sizing: border-box;
}
.spectrum-bar { position: relative; height: 10px; border-radius: 1px; transition: height 0.15s; }
.spectrum:hover .spectrum-bar { height: 18px; }
.spectrum-window {
  position: absolute; top: -3px; bottom: -3px; pointer-events: none; min-width: 4px;
  border: 1.5px solid var(--ink); border-radius: 2px; box-sizing: border-box; transition: left 0.2s, width 0.2s;
}
@media (prefers-reduced-motion: reduce) { .photo-page, .spectrum-bar, .spectrum-window { transition: none; } }

/* ---------- View cube ----------
   On every 3D viewer, like SOLIDWORKS: it turns with the model, so the model reads as something
   you can turn; a face snaps to that view and the house goes back to the start. */
.vcube { position: absolute; top: 12px; left: 12px; z-index: 3; width: 70px; height: 88px; perspective: 360px; touch-action: none; user-select: none; -webkit-user-select: none; }
.vcube-box { position: absolute; left: 9px; top: 9px; width: 52px; height: 52px; transform-style: preserve-3d; }
.vcube-face {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 0; cursor: pointer;
  font: 700 10px/1 "Atkinson Hyperlegible Next", system-ui, sans-serif; color: var(--sheet-ink);
  background: color-mix(in srgb, var(--sheet) 82%, var(--sheet-ink)); border: 1px solid color-mix(in srgb, var(--sheet-ink) 45%, transparent);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.vcube-face:hover, .vcube-face:focus-visible { color: var(--sheet-ink); background: color-mix(in srgb, var(--amber) 30%, var(--sheet)); outline: none; }
.vcube-face.front { transform: translateZ(26px); }
.vcube-face.back { transform: rotateY(180deg) translateZ(26px); }
.vcube-face.right { transform: rotateY(90deg) translateZ(26px); }
.vcube-face.left { transform: rotateY(-90deg) translateZ(26px); }
.vcube-face.top { transform: rotateX(90deg) translateZ(26px); }
.vcube-face.bottom { transform: rotateX(-90deg) translateZ(26px); }
.vcube-home {
  position: absolute; left: 0; bottom: 0; width: 22px; height: 22px; padding: 2px; cursor: pointer;
  color: var(--sheet-muted); background: none; border: 0; border-radius: 2px;
}
.vcube-home svg { width: 100%; height: 100%; display: block; }
.vcube-home:hover, .vcube-home:focus-visible { color: var(--sheet-ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.viewer.failed .vcube, .viewer.loading .vcube, .no-js .vcube { display: none; }

/* Home page: the background eases between the section tints (js/tint.js). */
body { transition: background-color 0.9s ease; }
@media (prefers-reduced-motion: reduce) { body { transition: none; } }

/* ---------- Photo viewer ----------
   The bar along the bottom is the edge of a strip of 35 mm film: sprocket holes, and the camera
   (or film stock) and month in the orange edge-print lettering of a film rebate. */
dialog.lightbox { background: #0a0a0b; color: #e4e7ec; overflow: hidden; }
dialog.lightbox::backdrop { background: #0a0a0b; }
.lb-stage { position: absolute; inset: 0 0 76px 0; display: grid; place-items: center; padding: 28px 72px; }
.lb-frame { position: relative; max-width: 100%; max-height: 100%; line-height: 0; touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }
.lb-frame img { -webkit-user-drag: none; user-select: none; }
.lb-frame.wipe { touch-action: none; }
.lb-img { max-width: 100%; max-height: calc(100vh - 76px - 56px); width: auto; height: auto; display: block; }
.lb-orig { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: none; }
/* Wipe: the original on the left of the line, the edit on the right. */
.lb-frame.wipe { cursor: ew-resize; }
.lb-frame.wipe .lb-orig { display: block; clip-path: inset(0 calc(100% - var(--x, 50%)) 0 0); }
.lb-img.lb-in { animation: lb-fade 0.35s ease both; }
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }
.lb-wipe { position: absolute; inset: 0; display: none; pointer-events: none; }
.lb-frame.wipe .lb-wipe, .lb-frame.fade .lb-wipe { display: block; }
.lb-handle { position: absolute; top: 0; bottom: 0; left: var(--x, 50%); width: 0; border-left: 1.5px solid #fff; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.4); }
.lb-handle::after {
  content: ""; position: absolute; top: 50%; left: 0; width: 30px; height: 30px; transform: translate(-50%, -50%); border-radius: 50%;
  border: 1.5px solid #fff; background: rgba(10, 10, 11, 0.55) center / 16px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 4 2 8l4 4M10 4l4 4-4 4' fill='none' stroke='%23ffffff' stroke-width='1.5'/%3E%3C/svg%3E");
}
.lb-frame.fade .lb-handle { display: none; }
.lb-tag {
  position: absolute; top: 12px; line-height: 1; padding: 5px 8px; border-radius: 2px;
  font: 600 0.72rem/1 "Atkinson Hyperlegible Mono", ui-monospace, monospace; letter-spacing: 0.14em; text-transform: uppercase;
  color: #fff; background: rgba(10, 10, 11, 0.6);
}
.lb-tag-orig { left: 12px; }
.lb-tag-edit { right: 12px; }
.lb-frame.fade .lb-tag-edit { display: none; }

/* Previous / next: the photo's edges. A soft shade and a chevron show on hover. */
.lb-zone {
  position: absolute; top: 0; bottom: 0; width: 22%; padding: 0; border: 0; background: none; cursor: pointer; color: #fff;
  display: flex; align-items: center; opacity: 0; transition: opacity 0.2s;
}
.lb-zone-prev { left: 0; justify-content: flex-start; padding-left: 18px; background: linear-gradient(90deg, rgba(0, 0, 0, 0.45), transparent); }
.lb-zone-next { right: 0; justify-content: flex-end; padding-right: 18px; background: linear-gradient(270deg, rgba(0, 0, 0, 0.45), transparent); }
.lb-zone:hover, .lb-zone:focus-visible { opacity: 1; outline: none; }
.lb-zone svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.comparing .lb-zone { pointer-events: none; }
@media (hover: none) { .lb-zone { opacity: 0.85; background: none; } .lb-zone svg { width: 26px; height: 26px; } }

/* Close: a hairline ring with a drawn cross. */
.lb-close {
  position: absolute; top: 16px; right: 16px; z-index: 2; width: 42px; height: 42px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(10, 10, 11, 0.5); transition: background 0.15s, border-color 0.15s;
}
.lb-close::before, .lb-close::after { content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 1.5px; background: #e4e7ec; }
.lb-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.lb-close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.lb-close:hover, .lb-close:focus-visible { background: #fff; border-color: #fff; outline: none; }
.lb-close:hover::before, .lb-close:hover::after, .lb-close:focus-visible::before, .lb-close:focus-visible::after { background: #0a0a0b; }

/* The film edge. */
.lb-film {
  position: absolute; left: 0; right: 0; bottom: 0; height: 76px; padding: 26px 24px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  background: #141210;
}
.lb-film::before {    /* sprocket holes along the top edge */
  content: ""; position: absolute; left: 0; right: 0; top: 7px; height: 11px;
  background: repeating-linear-gradient(90deg, transparent 0 9px, #0a0a0b 9px 21px, transparent 21px 30px);
}
.lb-edge { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 26px; font: 600 0.8rem/1.2 "Atkinson Hyperlegible Mono", ui-monospace, monospace; letter-spacing: 0.2em; text-transform: uppercase; color: #f6a04d; }
.lb-edge span:empty { display: none; }
.lb-edited { color: #ffd08a; }
/* Before and after: lettering on the film edge like the rest of it, with a square frame mark. */
.lb-compare {
  display: inline-flex; align-items: center; gap: 9px; flex: none; cursor: pointer; padding: 6px 0;
  font: 600 0.8rem/1.2 "Atkinson Hyperlegible Mono", ui-monospace, monospace; letter-spacing: 0.2em; text-transform: uppercase;
  color: rgba(246, 160, 77, 0.7); background: none; border: 0; transition: color 0.15s;
}
.lb-compare[hidden] { display: none; }
.lb-compare svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.lb-compare:hover, .lb-compare:focus-visible { color: #f6a04d; outline: none; }
.lb-compare[aria-pressed="true"] { color: #ffd08a; }
@media (max-width: 639px) {
  .lb-stage { padding: 56px 8px 12px; }
  .lb-film { padding: 26px 14px 0; }
  .lb-edge { gap: 2px 14px; font-size: 0.72rem; letter-spacing: 0.14em; }
  .lb-compare span { display: none; }
}

.vtpsim > .configs { margin-top: 0; }
.vtpsim .configs + .vtpsim-stage { margin-top: 8px; }
