/* ============================================================
   Luke Gargotta — Portfolio
   Shared design system: clean, minimal, Apple-style
   ============================================================ */

/* Fonts: self-hosted copies of the Google Fonts files (same files, same
   subsets and unicode ranges, see assets/fonts/), so the first paint no
   longer waits on a stylesheet from fonts.googleapis.com and a second
   connection to fonts.gstatic.com. The latin files are also preloaded by
   each page's <head>. */
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url(/assets/fonts/bricolage-grotesque-vietnamese.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url(/assets/fonts/bricolage-grotesque-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url(/assets/fonts/bricolage-grotesque-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/assets/fonts/instrument-sans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(/assets/fonts/instrument-sans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --divider: rgba(0, 0, 0, 0.08);
  --card-shadow: 0 2px 24px rgba(0, 0, 0, 0.06);

  --font: "Instrument Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Bricolage Grotesque", "Instrument Sans", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --nav-height: 52px;
  --max-width: 1180px;
}

* { box-sizing: border-box; }

/* The page's width stays the same whether or not a scrollbar is showing, so
   resizing a window never makes the layout flip back and forth. */
html { scroll-behavior: smooth; scrollbar-gutter: stable; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  font-family: var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  /* Let long unbroken strings (emails, URLs) wrap instead of forcing a
     horizontal scroll on narrow screens. */
  overflow-wrap: break-word;
}

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

a { color: inherit; text-decoration: none; }

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

.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 650;
  letter-spacing: -0.025em;
  margin: 0 0 20px 0;
  color: var(--text);
}

h1 { font-size: 56px; line-height: 1.07; font-weight: 600; }
h2 { font-size: 36px; line-height: 1.1; font-weight: 600; }

h1 span, h2 span {
  color: var(--text-secondary);
  font-weight: 600;
}

p.desc {
  font-family: var(--font);
  font-size: 19px;
  line-height: 1.55;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Bio page: the extra paragraphs about what Luke cares about. */
.bio-more {
  margin: 14px 0 0;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.bio-more:first-of-type { margin-top: 18px; }
.bio-baseball { cursor: default; outline-offset: 6px; border-radius: 6px; }

/* Bio page: tools and software. .skill-icon holds a logo image (or initials
   until the logo is added). */
.skills { padding-top: 8px; }
.skills h2 { margin: 0 0 24px; }
.skill-group { margin: 0 0 28px; }
.skill-group h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; color: var(--text-secondary); }
.skill-grid, .skill-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 14px; }
.skill { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 88px; text-align: center; }
.skill-icon {
  display: flex; align-items: center; justify-content: center;
  width: 60px; height: 60px; border-radius: 16px;
  background: var(--bg-alt); box-shadow: var(--card-shadow);
  font-weight: 700; font-size: 17px; color: var(--text-secondary);
}
.skill-icon img { width: 34px; height: 34px; object-fit: contain; }
.skill-name { font-size: 13px; font-weight: 500; color: var(--text); }
.skill-chips li { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 12px; border-radius: 999px; background: var(--bg-alt); font-size: 14px; font-weight: 500; }
.skill-chips svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--text-secondary); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.meta-item .value a { white-space: nowrap; }
.meta-logo { display: inline-block; width: 18px; height: 18px; vertical-align: -3px; margin-right: 4px; }
.meta-seal { width: 22px; height: 22px; vertical-align: -5px; }

/* Bio page: a compact top (no big empty band above the heading) and the
   photo level with the text. */
.section.bio-top { padding: 36px 0 20px; }
.bio-top .stage { align-items: start; }
.bio-top .portrait { margin-top: 6px; }
.skills { scroll-margin-top: calc(var(--nav-height) + 8px); border-top: 1px solid var(--divider); padding-top: 40px; }

/* Contact page */
.contact-card { background: var(--bg-alt); border-radius: 20px; padding: 24px; box-shadow: var(--card-shadow); }
.contact-form { text-align: left; display: flex; flex-direction: column; gap: 14px; }
.contact-form .field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.contact-form input, .contact-form select, .contact-form textarea {
  font: inherit; font-size: 16px; color: var(--text); background: var(--bg);
  border: 1px solid var(--divider); border-radius: 10px; padding: 11px 12px; width: 100%; box-sizing: border-box;
}
.contact-form .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.contact-form textarea { resize: vertical; min-height: 130px; overflow-y: hidden; }
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus { outline: 2px solid var(--text); outline-offset: 1px; }
.contact-form .req { color: #d92d20; font-weight: 700; }
.contact-note { margin: 0; font-size: 12px; color: var(--text-secondary); }
.contact-send { align-self: flex-start; border: 0; cursor: pointer; }
.contact-send:disabled { opacity: 0.6; cursor: default; }
.contact-form .is-invalid { border-color: #d92d20; }
.contact-bot { position: absolute; left: -9999px; height: 0; overflow: hidden; }
.contact-status { margin: 0; min-height: 1.4em; font-size: 14px; color: var(--text-secondary); }
.contact-status.is-ok { color: #1a7f37; }
.contact-status.is-error { color: #b3261e; }

/* Photos shown as circles. The crop is set by custom properties on the img
   (the ?edit photo editor writes them): --cx/--cy is the point of the picture
   kept in the middle of the circle (0 to 1), --z the zoom (1 = the shorter
   side just fills the circle), --r the rotation, --a the picture's width
   divided by its height. */
.crop-circle {
  position: relative; aspect-ratio: 1 / 1; border-radius: 50%; overflow: hidden;
  container-type: size; background: var(--bg-alt); box-shadow: var(--card-shadow);
}
.crop-circle img {
  position: absolute; max-width: none; display: block;
  height: calc(var(--z, 1) * 100cqh);
  width: calc(var(--z, 1) * var(--a, 1) * 100cqh);
  left: calc(50cqw - var(--cx, 0.5) * var(--z, 1) * var(--a, 1) * 100cqh);
  top: calc(50cqh - var(--cy, 0.5) * var(--z, 1) * 100cqh);
  transform-origin: calc(var(--cx, 0.5) * 100%) calc(var(--cy, 0.5) * 100%);
  transform: rotate(var(--r, 0deg));
}
.bio-top .visual { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.bio-portrait-link { width: 100%; max-width: 360px; }
/* The photos are links, but nothing hints at it (no hand cursor, no hover
   effect); only keyboard focus shows an outline, for accessibility. */
.photo-link { display: block; border-radius: 50%; cursor: default; -webkit-tap-highlight-color: transparent; }
.photo-link:focus-visible { outline: 3px solid var(--text); outline-offset: 4px; }
.bio-portrait { width: 100%; }
.bio-baseball-photo { margin: 0; width: 100%; max-width: 230px; text-align: center; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 500;
  color: var(--bg);
  background: var(--text);
  padding: 12px 24px;
  border-radius: 980px;
  transition: background 0.15s ease;
  cursor: pointer;
  border: none;
}

.btn:hover { background: #000; }

.link-accent {
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s ease;
}

.link-accent:hover { color: var(--accent-hover); }

/* ------------------------------------------------------------
   Nav
   ------------------------------------------------------------ */

/* The mount (not the nav inside it) is what sticks: a sticky element only
   stays put within its parent, and the nav's parent is this thin mount. */
#site-nav-mount { min-height: var(--nav-height); position: sticky; top: 0; z-index: 100; }

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--divider);
}

.site-nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.site-nav .brand {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
}

.site-nav .nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav .nav-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease;
}

.site-nav .nav-links a svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

/* Home icon: a house that flips over into home plate (see assets/js/bio.js,
   which adds .home-plate to <html> while the Bio page's baseball paragraph
   is hovered). */
.site-nav .nav-flip {
  position: relative;
  display: inline-block;
  width: 15px;
  height: 15px;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.site-nav .nav-flip svg { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.site-nav .nav-flip .flip-plate { transform: rotateX(180deg); }
.site-nav .nav-links a { perspective: 80px; }
html.home-plate .site-nav .nav-flip { transform: rotateX(180deg); }
@media (prefers-reduced-motion: reduce) { .site-nav .nav-flip { transition: none; } }

.site-nav .nav-links a:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
}

.site-nav .nav-links a.active {
  color: var(--text);
  font-weight: 600;
}

.site-nav .nav-links a .nav-label {
  display: none;
}

@media (min-width: 640px) {
  .site-nav .nav-links a .nav-label { display: inline; }
}

/* ------------------------------------------------------------
   Model stage — full-bleed, no frame
   ------------------------------------------------------------ */

.model-stage {
  position: relative;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}

.model-stage model-viewer {
  width: 100%;
  height: 100%;
  background-color: transparent;
  --poster-color: transparent;
}

/* Vertical scrubber for manually controlling an assembly animation's
   position — top of the track = fully raised/exploded, bottom = fully
   assembled. Uses -webkit-appearance:slider-vertical (Chrome/Safari) so
   the track's real height drives its visual length directly, instead of
   rotating a horizontal slider — rotating one means its length comes from
   `width`, which resolves against the *wrapper's width* even post-
   rotation (transforms don't affect layout), so a narrow wrapper made the
   whole thing tiny regardless of how tall the wrapper itself was.
   writing-mode is the Firefox-compatible fallback. */
.assembly-scrubber-wrap {
  position: absolute;
  right: 4px;
  top: 18%;
  bottom: 18%;
  width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.assembly-scrubber {
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  writing-mode: vertical-lr;
  width: 4px;
  height: 100%;
  /* --fill (0-100%, set in JS on every value change) is how much of the
     track from the bottom is "filled" with the accent color — a custom
     gradient rather than relying on native track-fill rendering, since
     that's inconsistent across browsers for vertical sliders. */
  background: linear-gradient(to top, var(--accent) 0%, var(--accent) var(--fill, 0%), var(--bg-alt) var(--fill, 0%), var(--bg-alt) 100%);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

.assembly-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: grab;
}

.assembly-scrubber::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: grab;
}

/* model-viewer hotspots — clickable squares anchored to a 3D point on the
   model (data-position/data-normal), used for the Miu Miu Sign remote's
   buttons. Sized close to each button's real ~9.8mm footprint (14mm for
   the larger "U" hotspot) rather than an arbitrary dot, and fully
   invisible at rest — no visible UI chrome over the model, just a brief
   pulse on press for confirmation (paired with a click sound in JS). */
.remote-hotspot {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
}

.remote-hotspot.remote-hotspot--large {
  width: 56px;
  height: 56px;
}

.remote-hotspot.is-pressed {
  background: rgba(255, 255, 255, 0.35);
}

.remote-debug {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 40px;
}

.remote-debug-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.model-stage .model-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  padding: 20%;
}

/* The project's cut-out still, shown until the model is drawn (or if it
   can't load). Set by model-loading.js. */
.model-stage .model-placeholder.has-still {
  background-position: center;
  background-repeat: no-repeat;
  background-size: 80% auto;
}

/* Loading overlays added by model-loading.js: a progress bar while a .glb
   downloads (animated "Loading..." label, percentage, time left). */

.model-stage .model-loader {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 15%;
  text-align: center;
}

.model-stage .model-loader { pointer-events: none; }

.model-stage .model-loader[hidden] { display: none; }

.model-loader-track {
  width: 100%;
  max-width: 220px;
  height: 4px;
  border-radius: 2px;
  background: var(--divider);
  overflow: hidden;
}

.model-loader-fill {
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.2s ease-out;
}

.model-loader-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: pre;   /* keeps the dots from shifting the text */
}

.model-loader.is-error .model-loader-track { display: none; }
/* "Couldn't load" message: a readable card, since it sits on the still. */
.model-loader.is-error .model-loader-label {
  white-space: pre-line;
  max-width: 320px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
}

.model-caption {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Side-by-side model comparison (e.g. original vs. an in-progress variant) */

.model-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

.model-compare .model-stage {
  max-width: 480px;
}

.model-compare .model-caption {
  font-weight: 600;
  color: var(--text);
}

@media (max-width: 720px) {
  .model-compare {
    grid-template-columns: 1fr;
    gap: 56px;
  }
}

/* Model carousel (click through a set of models one at a time, so only
   one is ever actively loaded/rendered — for pages with several large
   files that shouldn't all load at once) */

.model-carousel {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.carousel-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 18px;
}

.carousel-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.carousel-btn:hover { background: #e0e0e5; }

.carousel-dots {
  display: flex;
  align-items: center;
  gap: 10px;
}

.carousel-dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--bg-alt);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.carousel-dot:hover { background: #d5d5da; }

.carousel-dot.active {
  background: var(--text);
  transform: scale(1.2);
}

/* Model tab panels — same carousel dots/nav UI as above, but each panel
   is a fully separate model-viewer + its own extra markup (switches,
   hotspots, whatever), rather than one shared viewer with a swapped src.
   Needed when the panels' interactive overlays genuinely can't coexist on
   a single model-viewer instance — see model-tabs.js. */
.model-tab-panel {
  display: none;
  width: 100%;
  flex-direction: column;
  align-items: center;
}

.model-tab-panel.is-active {
  display: flex;
}

/* Spotlight stage — dims just the render area behind a model when its
   power switch is on (opt-in: only applies where a page wraps its
   model-stage in .visual, see model-animation.js's power switch code) */

.visual {
  position: relative;
  border-radius: 24px;
  padding: 24px 0;
  transition: background-color 0.6s ease;
}

.visual.is-on {
  background-color: #0b0b0d;
}

/* The glow lives on its own ::before layer, not .visual's own background,
   specifically so it can be rotated (--glow-rotate, tracking the camera's
   horizontal orbit — see initCameraGlowTracking) independently of the
   model-viewer canvas and text sitting in the same container. Rotating
   .visual itself would spin those too. Always present (not gated by
   .is-lit's presence) so opacity has something to transition between —
   .is-lit just toggles it visible, giving a real fade-in/out instead of a
   hard pop. The gradient uses several color-mix() stops rather than a
   plain two-stop fade specifically to avoid the "Mach band" artifact
   naive radial gradients are known for — a visible ring where the fade
   reads as a hard edge to the eye even though it's mathematically
   continuous — plus a blur for genuinely soft, diffuse edges on top of
   that. color-mix() (not multiple JS-set color variables) is what lets
   these intermediate stops stay in sync with --glow-color even while
   it's changing every frame, as it does on the Autogrill Sign. */
.visual::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  /* --glow-x/-y/-w/-h/-color: see the radial-gradient comment this
     replaced; same knobs, now on the pseudo-element instead of .visual
     directly, with --glow-x added for real horizontal tracking. */
  background: radial-gradient(
    ellipse var(--glow-w, 65%) var(--glow-h, 40%) at var(--glow-x, 50%) var(--glow-y, 82%),
    var(--glow-color, rgba(255, 204, 51, 0.32)) 0%,
    color-mix(in srgb, var(--glow-color, rgba(255, 204, 51, 0.32)) 70%, transparent) 30%,
    color-mix(in srgb, var(--glow-color, rgba(255, 204, 51, 0.32)) 35%, transparent) 55%,
    color-mix(in srgb, var(--glow-color, rgba(255, 204, 51, 0.32)) 10%, transparent) 78%,
    transparent 100%
  );
  transform: rotate(var(--glow-rotate, 0deg));
  transform-origin: var(--glow-x, 50%) var(--glow-y, 82%);
  filter: blur(30px);
}

.visual.is-lit::before {
  opacity: 1;
}

.visual .model-stage,
.visual .model-caption,
.visual .power-switch-row,
.visual .segmented-toggle-wrap {
  position: relative;
  z-index: 1;
}

.visual.is-on .model-caption,
.visual.is-on .power-switch-label {
  color: #9a9a9f;
}

/* Segmented on/off toggle — same sliding-highlight look as .tab-bar,
   used where a smartphone-style pill switch (.power-switch below) reads
   as out of place, e.g. a CAD internals/exterior toggle. Same underlying
   single-button data-power-switch interaction as .power-switch — only
   the markup/CSS differ, model-animation.js doesn't care which is used. */

.segmented-toggle-wrap {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.segmented-toggle {
  position: relative;
  display: inline-flex;
  padding: 3px;
  background: var(--bg-alt);
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.segmented-toggle-option {
  position: relative;
  z-index: 1;
  padding: 8px 18px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.segmented-toggle-highlight {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  background: var(--bg);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease;
}

.segmented-toggle.is-on .segmented-toggle-highlight {
  transform: translateX(100%);
}

.segmented-toggle:not(.is-on) .segmented-toggle-option:first-child,
.segmented-toggle.is-on .segmented-toggle-option:last-child {
  color: var(--text);
}

.segmented-toggle:disabled,
.segmented-toggle.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Power toggle switch (e.g. lamp on/off) */

.power-switch-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}

.power-switch-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.power-switch {
  position: relative;
  width: 44px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: var(--bg-alt);
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.power-switch:hover:not(:disabled) { background: #e0e0e5; }

.power-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}

.power-switch.is-on {
  background: var(--accent);
}

.power-switch.is-on .power-switch-thumb {
  transform: translateX(18px);
}

.power-switch:disabled,
.power-switch.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ------------------------------------------------------------
   Portrait (bio photo)
   ------------------------------------------------------------ */

.portrait {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-alt);
  box-shadow: var(--card-shadow);
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portrait .model-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  padding: 20%;
}

/* ------------------------------------------------------------
   Stage (visual + copy, side by side)
   ------------------------------------------------------------ */

.stage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}

.stage.reverse { grid-template-columns: 1fr 1fr; }
.stage.reverse .copy { order: 2; }
.stage.reverse .visual { order: 1; }

.copy { padding-right: 8px; }

.meta {
  display: flex;
  gap: 40px;
  padding-top: 24px;
  margin-top: 12px;
  border-top: 1px solid var(--divider);
  flex-wrap: wrap;
}

.meta-item .label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 4px;
}

.meta-item .value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

@media (max-width: 860px) {
  .stage, .stage.reverse {
    grid-template-columns: 1fr;
    gap: 48px;
    text-align: center;
  }
  .stage.reverse .copy { order: 1; }
  .stage.reverse .visual { order: 2; }
  .copy { padding-right: 0; }
  p.desc { margin-left: auto; margin-right: auto; }
  .meta { justify-content: center; }
  h1 { font-size: 40px; }
}

/* ------------------------------------------------------------
   Tabs — segmented control
   ------------------------------------------------------------ */

.tab-bar {
  display: inline-flex;
  justify-content: center;
  gap: 2px;
  margin: 0 0 48px 0;
  padding: 3px;
  background: var(--bg-alt);
  border-radius: 10px;
}

.tab-bar button {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-bar button:hover { color: var(--text); }

.tab-bar button.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade-in 0.25s ease; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Image gallery grid (reference / final product tabs) */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 20px;
}

.gallery figure {
  margin: 0;
  background: var(--bg-alt);
  border-radius: 18px;
  overflow: hidden;
}

.gallery img {
  width: 100%;
  height: 260px;
  object-fit: cover;
}

.gallery figcaption {
  padding: 14px 18px;
  font-size: 13px;
  color: var(--text-secondary);
}

.gallery figure.placeholder {
  background: transparent;
  border: 1px dashed var(--divider);
}

.gallery figure.placeholder .ph-box {
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ------------------------------------------------------------
   Page scaffolding
   ------------------------------------------------------------ */

.section {
  padding: 96px 0;
}

.section.alt { background: var(--bg-alt); }

.footer {
  padding: 40px 20px 60px;
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid var(--divider);
}

.footer p { margin: 0; }

.footer .footer-note {
  margin-top: 6px;
  font-size: 11px;
}

/* ------------------------------------------------------------
   Responsive — tablet & phone
   Everything below is scoped to max-width queries so the desktop
   layout is untouched.
   ------------------------------------------------------------ */

/* Control rows that sit under a model can hold several buttons; let them
   wrap rather than overflow on narrow screens. No effect when they fit. */
.carousel-nav,
.power-switch-row {
  flex-wrap: wrap;
}

@media (max-width: 860px) {
  .section { padding: 72px 0; }
  h2 { font-size: 32px; }
}

@media (max-width: 600px) {
  .wrap { padding: 0 20px; }

  .section { padding: 56px 0; }

  h1 { font-size: 34px; line-height: 1.1; }
  h2 { font-size: 28px; }
  p.desc { font-size: 17px; }

  .stage, .stage.reverse { gap: 36px; }
  .meta { gap: 20px 28px; }

  /* Nav: icon-only on phones; keep the brand from wrapping and give each
     icon a comfortable ~44px tap target. */
  .site-nav .brand { white-space: nowrap; }
  .site-nav .nav-links a { padding: 10px 12px; }

  /* Tab bar: stop "CAD Model" / "Final Product" breaking onto two lines;
     stretch to the column width with equal segments instead. */
  .tab-bar { display: flex; max-width: 100%; margin-bottom: 32px; }
  .tab-bar button {
    flex: 1 1 auto;
    white-space: nowrap;
    padding: 8px 12px;
  }

  /* Model areas: never taller than most of the screen (matters in
     landscape and for the taller remote stage), smaller gaps between
     stacked models. */
  .model-stage { max-height: 75vh; max-height: 75svh; }
  .model-compare { gap: 40px; }
  .visual { padding: 16px 0; border-radius: 18px; }
  .visual::before { filter: blur(20px); }

  .portrait { max-width: 280px; }

  .gallery { gap: 16px; }
  .gallery img,
  .gallery figure.placeholder .ph-box { height: 220px; }

  .remote-debug { margin-top: 24px; }

  /* Assembly scrubber (Estathe Lamp): exactly as tall as the model's render
     area and pinned to its right edge, never longer. The wrapper spans the
     stage top to bottom and clips, so whatever length a phone browser gives
     a vertical range input it can't run down the page; the padding keeps
     the thumb whole at both ends. */
  .model-stage > .assembly-scrubber-wrap {
    top: 64px;          /* clear of the full-screen button in the corner */
    bottom: 14px;
    right: 2px;
    width: 44px;        /* a finger-sized strip */
    height: auto;
    padding: 0;
    box-sizing: border-box;
    overflow: visible;
    touch-action: none;
  }
  /* The native slider stays only for the keyboard and screen readers; the
     drawing below (track + round handle, positioned by model-animation.js
     through --fill and --pos) is what is seen and dragged. */
  .model-stage > .assembly-scrubber-wrap .assembly-scrubber {
    height: 100%;
    max-height: 100%;
    margin: 0;
    opacity: 0;
    pointer-events: none;
  }
  .model-stage > .assembly-scrubber-wrap::before {
    content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 6px; margin-left: -3px;
    border-radius: 999px; pointer-events: none;
    background: linear-gradient(to bottom, var(--accent) 0%, var(--accent) var(--fill, 0%), var(--bg-alt) var(--fill, 0%), var(--bg-alt) 100%);   /* filled down to the handle */
  }
  .model-stage > .assembly-scrubber-wrap::after {
    content: ''; position: absolute; left: 50%; width: 20px; height: 20px; margin-left: -10px;
    top: calc((100% - 20px) * var(--pos, 1));
    border-radius: 50%; background: var(--accent); border: 1.5px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); box-sizing: border-box; pointer-events: none;
  }
  /* Full screen: a shorter strip, below the Exit button, clear of the controls under it. */
  .fs-view.is-fullscreen .model-stage > .assembly-scrubber-wrap { top: 76px; bottom: 22%; }

  /* Nightstand Unit kiosk: its panel buttons are a vertical stack beside
     the model and the photo collection is a fixed 140px side column
     (inline styles), which on phones stack into a very tall, mostly empty
     column. Lay the buttons out as one row above the model and the
     collection as a horizontal strip below it. !important is needed to
     override the inline styles. */
  [data-kiosk-nav] {
    flex-direction: row !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px !important;
    width: auto !important;
  }
  [data-kiosk-nav] button {
    padding: 8px 14px !important;
    font-size: 14px !important;
  }
  [data-kiosk-nav] { margin: 0 auto; }
  .visual:has(> div > [data-kiosk-nav]) > div:has(> [data-kiosk-nav]) {
    align-self: stretch !important;
    align-items: center !important;
  }
  .visual:has(> div > [data-kiosk-nav]) > div:has(.model-stage) {
    flex: 1 1 100% !important;
    max-width: 100% !important;
  }
  [data-kiosk-collected-wrap] {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
  }
  [data-kiosk-collected] {
    flex-direction: row !important;
    flex-wrap: wrap;
    justify-content: center;
  }
  [data-kiosk-collected] .kiosk-collected-item { width: 96px; }
}

/* Touch screens have no hover, so the collected-photo remove button would
   be unreachable — keep it visible there. */
@media (hover: none) {
  [data-kiosk-collected] .kiosk-collected-item .kiosk-collected-remove {
    opacity: 1;
  }
}

@media (max-width: 380px) {
  h1 { font-size: 30px; }
  h2 { font-size: 25px; }
  .tab-bar button { padding: 8px 8px; font-size: 12px; }
  .site-nav .nav-links a { padding: 10px 9px; }
}

/* ------------------------------------------------------------
   Keyboard focus
   :focus-visible only matches keyboard (not mouse/touch) focus, so this
   adds a visible ring for keyboard users without changing how anything
   looks when clicked or tapped. (<model-viewer> already draws its own
   focus ring on its internal canvas, so it isn't listed here.)
   ------------------------------------------------------------ */

/* "Skip to content" (added by nav.js): off screen until Tab reaches it. */
.skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 1000;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}
.skip-link:focus { top: 8px; }
main:focus { outline: none; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The assembly scrubber sets outline: none on itself; restore a ring for
   keyboard focus only. */
.assembly-scrubber:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* Remote hotspots are invisible at rest, so give keyboard users a ring
   over the model button they're on. */
.remote-hotspot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

/* "You're leaving this site" dialog (assets/js/external-links.js) */
.leave-dialog {
  border: 0;
  border-radius: 18px;
  padding: 0;
  max-width: min(420px, calc(100vw - 32px));
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.25);
}
.leave-dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.leave-dialog-body { padding: 28px 28px 24px; }
.leave-dialog h2 { font-size: 22px; margin: 0 0 10px; }
.leave-dialog p { margin: 0 0 22px; color: var(--text-secondary); font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.leave-dialog p strong { color: var(--text); font-weight: 600; }
.leave-dialog-actions { display: flex; gap: 10px; justify-content: flex-end; }
.leave-dialog-stay {
  font: inherit; font-size: 15px; padding: 10px 18px; border-radius: 980px;
  border: 1px solid var(--divider); background: var(--bg-alt); color: var(--text); cursor: pointer;
}
.leave-dialog-go { cursor: pointer; }

/* ------------------------------------------------------------
   Touch screens: bigger tap areas for the smallest controls. Where the
   control should keep its look (dots, the light switch, the kiosk "i"),
   an invisible ::after enlarges only the area that takes the tap.
   ------------------------------------------------------------ */
@media (pointer: coarse) {
  .site-nav .nav-links a { min-height: 44px; justify-content: center; }
  .carousel-btn { width: 44px; height: 44px; }
  .carousel-dot,
  [data-kiosk-info-btn] { position: relative; }
  .carousel-dot::after,
  .power-switch::after,
  [data-kiosk-info-btn]::after { content: ""; position: absolute; }
  .carousel-dot::after { inset: -14px -5px; }
  .power-switch::after { inset: -10px -4px; }
  [data-kiosk-info-btn]::after { inset: -14px; }
}
@media (pointer: coarse) and (min-width: 360px) {
  .site-nav .nav-links a { min-width: 40px; }
}
