/* =====================================================================
   Interactive layer: tailoring switch, hero dots, fit check, coating lab,
   test tiles, robot gallery, simulation reel, quick menu, lightbox, toast.
   Loaded after style.css and uses the same colour tokens.
   ===================================================================== */
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); box-shadow: none; }
.btn-ghost svg { width: 16px; height: 16px; transition: transform .2s; }
.btn-ghost:hover svg { transform: translateX(3px); }
.swap { animation: swapIn .45s ease both; }
@keyframes swapIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* progress bar */
.progress { position: fixed; top: 66px; left: 0; right: 0; height: 2px; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); z-index: 70; pointer-events: none; }

/* quick-menu button */
.kbd-btn { width: auto; display: inline-flex; align-items: center; gap: 8px; padding: 0 8px 0 12px; font: inherit; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.kbd-btn:hover { color: var(--text); }
.kbd-btn kbd { margin: 0; }
@media (max-width: 1100px) { .kbd-btn span { display: none; } }
@media (max-width: 600px) { .kbd-btn { width: 38px; padding: 0; justify-content: center; } .kbd-btn kbd { display: none; } }
kbd { font-family: var(--sans); font-size: 11px; line-height: 1.5; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 0 6px; margin-right: 4px; background: var(--surface-2); color: var(--muted); }

/* hero */
.hero { isolation: isolate; }
.hero-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 72% 45%, #000 25%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 80% at 72% 45%, #000 25%, transparent 75%);
}
.eyebrow { align-items: center; }
.lens { display: inline-flex; align-items: center; gap: 2px; padding: 4px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; box-shadow: var(--shadow); }
.lens > span { font-size: 13px; color: var(--muted); padding: 0 8px 0 10px; }
.lens button { font: inherit; font-size: 13.5px; font-weight: 500; border: 0; background: transparent; color: var(--muted); padding: 7px 14px; border-radius: 999px; cursor: pointer; transition: background .25s, color .25s; }
.lens button:hover { color: var(--text); }
.lens button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
@media (max-width: 440px) { .lens > span { display: none; } .lens button { padding: 7px 11px; } }
.id-card .portrait.has-photo { aspect-ratio: 1 / 1.08; background: #86cfe0; }
.id-card .portrait.has-photo img { object-position: 50% 22%; }
@media (max-width: 900px) { .id-card .portrait.has-photo { aspect-ratio: 1 / 1; max-height: 420px; } }
.id-card.in { transition: transform .5s cubic-bezier(.2,.8,.2,1), opacity .7s ease; }
.path.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* marquee */
.marquee { display: flex; align-items: center; gap: 24px; padding: 22px 0 0; }
.marquee small { flex: none; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .14em; font-weight: 600; }
.marquee-track { overflow: hidden; flex: 1; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee-inner { display: flex; width: max-content; animation: marquee 50s linear infinite; }
.marquee-inner .set { display: flex; }
.marquee-inner span { font-family: var(--serif); font-size: 24px; color: var(--muted); white-space: nowrap; padding-right: 44px; }
.marquee:hover .marquee-inner { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
@media (max-width: 700px) { .marquee { flex-direction: column; align-items: flex-start; gap: 10px; } .marquee-track { width: 100%; } .marquee-inner span { font-size: 20px; padding-right: 32px; } }

/* hover spotlight on cards */
.spot { position: relative; }
.spot::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%);
}
.spot:hover::after { opacity: 1; }

/* fit check band */
.band {
  --band-accent: color-mix(in srgb, var(--accent) 60%, var(--bg));
  background: var(--text); color: var(--bg); position: relative; overflow: hidden;
}
.band::before {
  content: ""; position: absolute; width: 640px; height: 640px; left: -220px; top: -260px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%); opacity: .5;
}
.band .wrap { position: relative; }
.band .sec-head .kicker { color: var(--band-accent); }
.band .sec-head p { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.needs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 40px; }
.need {
  font: inherit; font-size: 15px; padding: 10px 18px; border-radius: 999px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center;
  border: 1px solid color-mix(in srgb, var(--bg) 25%, transparent); background: transparent; color: var(--bg); transition: all .2s;
}
.need:hover { border-color: color-mix(in srgb, var(--bg) 60%, transparent); }
.need::before { content: "+"; opacity: .6; width: 10px; text-align: center; }
.need[aria-pressed="true"] { background: var(--bg); color: var(--text); border-color: var(--bg); }
.need[aria-pressed="true"]::before { content: "✓"; opacity: 1; color: var(--accent); }
.fit-out { display: grid; grid-template-columns: 300px 1fr; gap: 48px; border-top: 1px solid color-mix(in srgb, var(--bg) 18%, transparent); padding-top: 36px; }
.fit-score b { display: block; font-family: var(--serif); font-weight: 400; font-size: 96px; line-height: .9; letter-spacing: -.03em; }
.fit-score > span { display: block; margin-top: 8px; color: color-mix(in srgb, var(--bg) 70%, transparent); }
.fit-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.band .btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 30%, transparent); }
.band .btn-primary { background: var(--bg); color: var(--text); border-color: var(--bg); }
.band .btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.evidence { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; align-content: start; }
.evidence li {
  display: grid; grid-template-columns: 150px 1fr auto; gap: 16px; align-items: baseline; padding: 14px 18px; border-radius: 14px;
  background: color-mix(in srgb, var(--bg) 7%, transparent); animation: swapIn .4s ease both;
}
.evidence .tag { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--band-accent); }
.evidence a { color: inherit; opacity: .6; font-size: 13.5px; text-decoration: none; white-space: nowrap; }
.evidence a:hover { opacity: 1; }
.evidence li.fit-empty { display: block; color: color-mix(in srgb, var(--bg) 65%, transparent); }
@media (max-width: 600px) {
  .needs { gap: 8px; margin-bottom: 28px; }
  .need { font-size: 13.5px; padding: 8px 13px; gap: 6px; }
}
@media (max-width: 900px) {
  .fit-out { grid-template-columns: 1fr; gap: 28px; }
  .fit-score b { font-size: 72px; }
  .evidence li { grid-template-columns: 1fr auto; gap: 4px 12px; }
  .evidence .tag { grid-column: 1 / -1; }
}

/* PLM pulses */
@media (prefers-reduced-motion: reduce) { .pulses { display: none; } }

/* coating lab */
.lab { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 16px; }
.lab-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lab-hint { font-size: 13px; color: var(--muted); }
.lab.touched .lab-hint { visibility: hidden; }
.lab svg { flex: 1; min-height: 0; width: 100%; }
.lab-row { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.lab:not(.touched) .lab-row { animation: nudge 2.4s ease-in-out 2.8s infinite; }
@keyframes nudge { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent); } }
.lab-row label { font-size: 13.5px; font-weight: 600; }
.lab-row input { flex: 1; accent-color: var(--accent); cursor: grab; height: 24px; margin: 0; }
.lab-row input:active { cursor: grabbing; }
.lab-row output { font-size: 13px; color: var(--muted); width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.meters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.meter { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; min-width: 0; }
.meter small { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter b { font-size: 15px; font-variant-numeric: tabular-nums; }
.meter i { display: block; height: 4px; border-radius: 4px; background: var(--line); margin-top: 6px; overflow: hidden; }
.meter i::after { content: ""; display: block; height: 100%; width: var(--v, 50%); background: var(--accent); border-radius: inherit; }
.lab-note { margin: 0; font-size: 12px; color: var(--muted); }
.work .media:has(.lab) { min-height: 480px; }
@media (max-width: 900px) { .work .media:has(.lab) { min-height: 560px; } .meters { grid-template-columns: 1fr 1fr; } }

/* test-method tiles */
.tests { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 20px; gap: 12px; }
.tests-hint { margin: 0; font-size: 13px; color: var(--muted); }
.tests-grid { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 10px; }
.test {
  position: relative; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); font: inherit;
  cursor: pointer; overflow: hidden; padding: 0; min-height: 84px; text-align: left;
}
.test > span { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 12px 14px; transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .3s; }
.t-front b { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1; color: var(--accent); }
.t-front small { font-size: 12px; color: var(--muted); margin-top: 6px; }
.t-back { font-size: 13px; line-height: 1.4; background: var(--accent); color: var(--accent-ink); transform: translateY(100%); }
.test:hover .t-back, .test:focus-visible .t-back, .test.on .t-back { transform: none; }
.test:hover .t-front, .test:focus-visible .t-front, .test.on .t-front { opacity: 0; transform: translateY(-20%); }
.work .media:has(.tests) { min-height: 380px; }
@media (max-width: 900px) { .work .media:has(.tests) { min-height: 420px; } }

/* robot gallery */
.gallery { position: absolute; inset: 0; display: grid; grid-template-rows: 1fr auto; gap: 10px; padding: 14px; }
.g-main { position: relative; border: 0; padding: 0; border-radius: 14px; overflow: hidden; cursor: zoom-in; background: var(--surface); min-height: 0; }
.g-main img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .25s, transform .6s ease; }
.g-main:hover img { transform: scale(1.03); }
.g-main img.fading { opacity: 0; }
.g-cap, .g-zoom {
  position: absolute; font-size: 12.5px; font-weight: 500; padding: 5px 11px; border-radius: 999px;
  background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.g-cap { left: 10px; bottom: 10px; max-width: calc(100% - 120px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-zoom { right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px; }
.g-zoom svg { width: 13px; height: 13px; }
.g-thumbs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; scroll-snap-type: x mandatory; }
.g-thumbs button {
  flex: none; width: 74px; height: 54px; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer;
  background: var(--surface); position: relative; scroll-snap-align: start; opacity: .7; transition: opacity .2s, border-color .2s;
}
.g-thumbs button:hover { opacity: 1; }
.g-thumbs button[aria-current="true"] { border-color: var(--accent); opacity: 1; }
.g-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-thumbs .is-video::after { content: "▶"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 14px; text-shadow: 0 1px 6px rgba(0,0,0,.7); }
.work .media:has(.gallery) { min-height: 460px; }
@media (max-width: 900px) { .work .media:has(.gallery) { min-height: 380px; } }

/* AI trio opens in the viewer */
.trio figure { cursor: zoom-in; }

/* simulation reel */
.reel { position: relative; }
.reel-track {
  display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; cursor: grab;
  padding: 4px max(24px, calc((100vw - var(--max)) / 2 + 24px)) 8px;
  scroll-padding-inline: max(24px, calc((100vw - var(--max)) / 2 + 24px));
}
.reel-track::-webkit-scrollbar { display: none; }
.reel-track.dragging { cursor: grabbing; scroll-snap-type: none; }
.reel-track.looped { scroll-snap-type: none; }   /* the endless strip drifts slowly, so no snapping */
.reel-track.dragging * { pointer-events: none; }
.reel-item { flex: none; margin: 0; width: clamp(260px, 34vw, 440px); scroll-snap-align: start; }
.reel-item button { position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; border: 0; padding: 0; border-radius: 18px; overflow: hidden; cursor: zoom-in; background: var(--surface-2); }
.reel-item video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.reel-item button:hover video { transform: scale(1.04); }
.reel-item figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 16px 14px; text-align: left; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.65));
}
.reel-item figcaption b { display: block; font-size: 15.5px; font-weight: 600; }
.reel-item figcaption span { font-size: 13px; opacity: .85; }
.reel-nav { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.reel-nav span { color: var(--muted); font-size: 13.5px; margin-left: 8px; }
.reel-nav .icon-btn { font-size: 22px; line-height: 1; cursor: pointer; }
@media (max-width: 600px) { .reel-track { padding-inline: 16px; scroll-padding-inline: 16px; gap: 12px; } .reel-item { width: 78vw; } }

/* floating CV pill */
.float-cv {
  position: fixed; right: 20px; bottom: 20px; z-index: 45; display: flex; gap: 2px; padding: 5px; border-radius: 999px;
  background: var(--text); box-shadow: 0 12px 34px rgba(0,0,0,.25); visibility: hidden; opacity: 0; transform: translateY(120%);
  transition: transform .45s cubic-bezier(.2,.8,.2,1), opacity .3s, visibility 0s .45s;
}
.float-cv.show { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
.float-cv a { color: var(--bg); text-decoration: none; font-size: 13.5px; font-weight: 500; padding: 9px 14px; border-radius: 999px; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.float-cv a:hover { background: color-mix(in srgb, var(--bg) 15%, transparent); }
.float-cv svg { width: 15px; height: 15px; }
@media (max-width: 600px) {
  .float-cv { right: auto; left: 50%; bottom: 12px; transform: translate(-50%, 120%); }
  .float-cv.show { transform: translate(-50%, 0); }
  .float-cv a { padding: 8px 11px; font-size: 13px; }
  /* phones: the pill sits once at the very bottom of the page instead of floating over the content */
  .float-cv, .float-cv.show { position: static; visibility: visible; opacity: 1; transform: none; transition: none; width: max-content; max-width: calc(100% - 32px); margin: 4px auto 24px; flex-wrap: wrap; justify-content: center; }
}

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 84px; z-index: 90; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  background: var(--accent); color: var(--accent-ink); padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 30px rgba(0,0,0,.25); transition: opacity .25s, transform .25s; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* quick menu */
.cmdk { border: 0; padding: 0; background: transparent; width: min(560px, calc(100% - 32px)); max-width: none; margin: 12vh auto auto; color: var(--text); overflow: visible; }
.cmdk::backdrop { background: rgba(8, 10, 14, .5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.cmdk-box { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.35); overflow: hidden; animation: swapIn .2s ease; }
.cmdk input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; font-size: 17px; padding: 18px 20px; outline: none; }
.cmdk ul { list-style: none; margin: 0; padding: 8px; max-height: min(52vh, 440px); overflow: auto; }
.cmdk li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px; cursor: pointer; font-size: 15px; }
.cmdk li small { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; }
.cmdk li[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.cmdk li.none { color: var(--muted); cursor: default; }
.cmdk-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
@media (max-width: 600px) { .cmdk-foot { display: none; } }

/* lightbox */
.lightbox { border: 0; padding: 0; background: transparent; width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; color: #fff; overflow: hidden; }
.lightbox::backdrop { background: rgba(5, 6, 8, .93); }
.lightbox[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.lb-stage { width: 100%; height: 100%; display: grid; place-items: center; padding: 60px 76px 8px; min-height: 0; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; animation: swapIn .3s ease; }
.lb-stage iframe.lb-yt { border: 0; border-radius: 10px; aspect-ratio: 16 / 9; width: min(100%, calc((100vh - 170px) * 16 / 9)); height: auto; background: #000; }
.g-thumbs .is-yt::after { content: "▶"; background: linear-gradient(transparent 55%, rgba(0,0,0,.4)); }
.g-thumbs .is-yt::before { content: "YouTube"; position: absolute; left: 4px; top: 4px; z-index: 1; font-size: 8.5px; font-weight: 600; letter-spacing: .02em; padding: 1px 4px; border-radius: 3px; background: #e5262b; color: #fff; }
.reel-yt { margin-left: auto; font-size: 14px; }
.reel-yt svg, .contact .btn svg { width: 17px; height: 17px; }
@media (max-width: 600px) { .reel-nav span { display: none; } }
.lb-cap { margin: 0; padding: 12px 20px 22px; font-size: 14.5px; opacity: .85; text-align: center; }
.lb-btn { position: absolute; border: 0; background: rgba(255,255,255,.1); color: #fff; width: 46px; height: 46px; border-radius: 999px; font-size: 26px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.lb-btn:hover { background: rgba(255,255,255,.22); }
.lb-close { top: 14px; right: 14px; font-size: 17px; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) { .lb-stage { padding: 64px 8px 8px; } .lb-prev, .lb-next { top: auto; bottom: 14px; transform: none; } .lb-cap { padding-bottom: 76px; } }

/* publications extras */
.pub-search { position: relative; flex: 1 1 240px; max-width: 340px; display: block; }
.pub-search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.pub-search input { width: 100%; font: inherit; font-size: 14px; padding: 9px 14px 9px 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.pub-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pub-count { font-size: 13.5px; color: var(--muted); margin: -8px 0 12px; }
.pub-empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 14px; }
.pub-actions { display: flex; flex-direction: column; gap: 8px; }
button.doi { font: inherit; font-size: 13.5px; font-weight: 500; background: transparent; color: inherit; cursor: pointer; justify-content: center; }
mark { background: color-mix(in srgb, var(--accent) 24%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
@media (max-width: 700px) { .pub-actions { flex-direction: row; } .pub-search { max-width: none; flex-basis: 100%; } }

@media (prefers-reduced-motion: reduce) {
  .marquee-inner { animation: none; flex-wrap: wrap; width: auto; }
  .marquee-inner .set { flex-wrap: wrap; }
  .marquee-inner .set[aria-hidden] { display: none; }
  .swap, .evidence li, .lb-stage img, .lb-stage video, .cmdk-box { animation: none; }
  .lab:not(.touched) .lab-row { animation: none; }
}
/* the software each reel clip was made with */
.reel-tool { position: absolute; top: 12px; left: 12px; z-index: 1; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; color: #fff;
  background: rgba(0,0,0,.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 4px 10px; pointer-events: none; }
