/* NORDIC hero viewer. Built by assets/js/viewer.js inside #viewer.
   One accent (tactile yellow): the active module, the slider thumb and focus. */

.viewer--js {
  --viewer-bar-bottom: clamp(20px, 3.4vh, 40px);
  --viewer-bar-h: 44px;
  font-family: var(--font);
  color: var(--on-asphalt);
}
.viewer--js [hidden] { display: none !important; }

.viewer__canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: pan-y;            /* vertical swipes keep scrolling the page */
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  transition: opacity .7s var(--ease);
  outline: none;
}
.viewer--js.is-ready .viewer__canvas { opacity: 1; }
@media (pointer: fine) {
  .viewer--js.is-ready .viewer__canvas { cursor: grab; }
  .viewer--js.is-ready .viewer__canvas.is-dragging { cursor: grabbing; }
}
.viewer__canvas:focus-visible {
  outline: 2px solid var(--tactile);
  outline-offset: -8px;
  border-radius: var(--radius-m);
}

/* ---------- loading and errors ---------- */
.viewer__loading {
  position: absolute; left: 70%; top: 50%;
  transform: translate(-50%, -50%);
  display: grid; justify-items: center; gap: 14px;
  pointer-events: none;
  transition: opacity .35s var(--ease);
}
.viewer__loading.is-done { opacity: 0; }
.viewer__progress {
  position: relative; display: block;
  width: 160px; height: 2px; overflow: hidden;
  background: var(--asphalt-line);
  border-radius: 2px;
}
.viewer__progress-bar {
  position: absolute; inset: 0;
  background: var(--on-asphalt);
  transform-origin: 0 50%;
  transform: scaleX(0.02);
  transition: transform .2s linear;
}
.viewer__loading.is-indeterminate .viewer__progress-bar {
  transform: none; width: 30%;
  animation: viewer-slide 1.3s var(--ease) infinite;
}
@keyframes viewer-slide { from { left: -30%; } to { left: 100%; } }
.viewer__loading-text { font-size: var(--step--1); color: var(--on-asphalt-2); }

.viewer__error, .viewer__fallback {
  position: absolute; left: var(--gutter); bottom: calc(var(--viewer-bar-bottom) + 72px);
  max-width: 34rem; margin: 0;
  color: var(--on-asphalt-2); font-size: var(--step-0);
}
.viewer__error p { margin: 0 0 14px; }
.viewer__fallback { bottom: 32px; z-index: 1; }

/* ---------- bottom bar ---------- */
.viewer__bar {
  position: absolute;
  left: var(--gutter); right: var(--gutter); bottom: var(--viewer-bar-bottom);
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 12px 22px;
  pointer-events: none;            /* the bar's gaps let drags reach the canvas */
  opacity: 0; visibility: hidden;  /* not reachable until the model is there */
  transition: opacity .6s var(--ease) .15s, visibility 0s .15s;
}
.viewer--js.is-ready .viewer__bar { opacity: 1; visibility: visible; }
.viewer__bar > * { pointer-events: auto; }

.viewer__segs {
  display: inline-flex; gap: 2px; padding: 3px;
  border: 1px solid var(--asphalt-line); border-radius: var(--radius-pill);
  background: var(--asphalt);
}
.viewer__seg {
  appearance: none; font: inherit; font-size: var(--step--1); line-height: 1;
  color: var(--on-asphalt-2); background: transparent;
  border: 0; border-radius: var(--radius-pill);
  padding: 9px 15px 10px; cursor: pointer; white-space: nowrap;
  transition: background-color .2s, color .2s;
}
.viewer__seg:hover { color: var(--on-asphalt); }
.viewer__seg[aria-pressed="true"] {
  background: var(--tactile); color: var(--tactile-ink); font-weight: 650;
}

.viewer__explode { display: inline-flex; align-items: center; gap: 12px; }
.viewer__label { font-size: var(--step--1); color: var(--on-asphalt-2); white-space: nowrap; }
.viewer__range {
  --fill: 0%;
  -webkit-appearance: none; appearance: none;
  width: clamp(120px, 12vw, 180px); height: 28px; margin: 0;
  background: transparent; cursor: pointer;
}
.viewer__range::-webkit-slider-runnable-track {
  height: 2px; border-radius: 2px;
  background: linear-gradient(to right, var(--on-asphalt-2) var(--fill), var(--asphalt-line) var(--fill));
}
.viewer__range::-moz-range-track { height: 2px; border-radius: 2px; background: var(--asphalt-line); }
.viewer__range::-moz-range-progress { height: 2px; border-radius: 2px; background: var(--on-asphalt-2); }
.viewer__range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 18px; margin-top: -8px;
  border-radius: 1px; background: var(--tactile); border: 0;
}
.viewer__range::-moz-range-thumb { width: 12px; height: 18px; border-radius: 1px; background: var(--tactile); border: 0; }
.viewer__range:focus-visible { outline: 2px solid var(--tactile); outline-offset: 4px; border-radius: var(--radius-pill); }

.viewer__btn {
  appearance: none; font: inherit; font-size: var(--step--1); line-height: 1;
  color: var(--on-asphalt); background: var(--asphalt-2);
  border: 1px solid var(--asphalt-line); border-radius: var(--radius-pill);
  padding: 10px 16px 11px; cursor: pointer; white-space: nowrap;
  transition: border-color .15s, background-color .15s;
}
.viewer__btn:hover { border-color: var(--on-asphalt-2); }
.viewer__btn--quiet { background: transparent; }

.viewer__hint { margin: 0; font-size: var(--step--1); color: var(--on-asphalt-2); }

/* idle-turn switch: a quiet pill with a small state mark (filled = turning) */
.viewer__turn { display: inline-flex; align-items: center; gap: 8px; color: var(--on-asphalt-2); }
.viewer__turn[aria-pressed="true"] { color: var(--on-asphalt); }
.viewer__turn-mark {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  border: 1.5px solid currentColor; box-sizing: border-box;
}
.viewer__turn[aria-pressed="true"] .viewer__turn-mark { background: currentColor; }
.viewer__turn--sheet { display: none; }

/* still render, shown when the browser has no WebGL or the model fails to load */
.viewer__poster {
  position: absolute; z-index: 0;
  right: var(--gutter); bottom: 12%;
  width: min(58%, 980px); height: 56%;
  object-fit: contain; object-position: 50% 100%;
  pointer-events: none;
}

.viewer--js :focus-visible { outline: 2px solid var(--tactile); outline-offset: 2px; }

/* ---------- hover label ---------- */
.viewer__tip {
  position: absolute; left: 0; top: 0; z-index: 5;
  padding: 6px 11px 7px;
  font-size: var(--step--1); line-height: 1.1; white-space: nowrap;
  color: var(--on-asphalt); background: var(--asphalt-2);
  border: 1px solid var(--asphalt-line); border-radius: var(--radius-pill);
  pointer-events: none;
  opacity: 0; transition: opacity .12s;
}
.viewer__tip.is-on { opacity: 1; }

/* ---------- info panel (isolated part) ---------- */
.viewer__info {
  position: absolute; z-index: 4;
  right: var(--gutter); top: 50%;
  transform: translateY(-46%);
  width: min(380px, 34vw);
  max-height: calc(100% - 200px);
  overflow: auto;
  padding: 22px 24px 22px;
  background: var(--asphalt-2);
  border: 1px solid var(--asphalt-line);
  border-radius: var(--radius-m);
  animation: viewer-in .45s var(--ease) both;
}
@keyframes viewer-in { from { opacity: 0; } to { opacity: 1; } }
.viewer__info-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.viewer__kind, .viewer__count { margin: 0; font-size: var(--step--1); color: var(--on-asphalt-2); }
.viewer__count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.viewer__name {
  margin: 10px 0 12px;
  font-size: var(--step-2); font-weight: 720; letter-spacing: -0.015em; line-height: 1.08;
}
.viewer__name:focus, .viewer__name:focus-visible { outline: none; } /* not operable: focus only moves the reading position */
.viewer__blurb { margin: 0 0 18px; color: var(--on-asphalt-2); font-size: var(--step-0); line-height: 1.5; }
.viewer__facts { margin: 0 0 20px; padding: 0; border-top: 1px solid var(--asphalt-line); }
.viewer__facts div {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 14px;
  padding: 9px 0; border-bottom: 1px solid var(--asphalt-line);
}
.viewer__facts dt { color: var(--on-asphalt-2); font-size: var(--step--1); padding-top: 1px; }
.viewer__facts dd { margin: 0; font-size: var(--step--1); font-weight: 600; }
.viewer__info-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.viewer__info-nav .viewer__btn { width: 100%; text-align: center; }
.viewer__info-nav .viewer__btn--all { grid-column: 1 / -1; }

/* ---------- parts list ---------- */
.viewer__list {
  position: absolute; z-index: 6;
  left: var(--gutter);
  bottom: calc(var(--viewer-bar-bottom) + var(--viewer-bar-h) + 12px);
  width: min(340px, calc(100% - 2 * var(--gutter)));
  max-height: min(62vh, calc(100% - var(--viewer-bar-h) - 140px));
  display: flex; flex-direction: column;
  background: var(--asphalt-2);
  border: 1px solid var(--asphalt-line);
  border-radius: var(--radius-m);
  animation: viewer-in .25s var(--ease) both;
}
.viewer__list-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 12px 10px 18px;
  border-bottom: 1px solid var(--asphalt-line);
}
.viewer__list-title { margin: 0; font-size: var(--step-0); font-weight: 700; letter-spacing: 0; }
.viewer__list-close { padding: 8px 12px 9px; }
.viewer__list-body { overflow: auto; padding: 4px 8px 10px; overscroll-behavior: contain; }
.viewer__group-title {
  margin: 12px 10px 4px; font-size: 0.8125rem; font-weight: 600; color: var(--on-asphalt-2); letter-spacing: 0;
}
.viewer__group-list { list-style: none; margin: 0; padding: 0; }
.viewer__item {
  appearance: none; display: flex; align-items: center; gap: 10px; width: 100%;
  font: inherit; font-size: var(--step--1); text-align: left; line-height: 1.3;
  color: var(--on-asphalt); background: transparent;
  border: 0; border-radius: var(--radius-s);
  padding: 8px 10px; cursor: pointer;
}
.viewer__item:hover { background: var(--asphalt-line); }
.viewer__item[aria-current="true"] { font-weight: 650; }
.viewer__item[aria-current="true"]::after {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tactile); margin-left: auto;
}
.viewer__item:focus-visible { outline-offset: -2px; }

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

/* While a part is on its own, the hero words step back so the part and its
   panel are what you read. (Styles the hero intro from outside the viewer.) */
.stage__intro { transition: opacity .5s var(--ease); }
@media (min-width: 761px) {
  .stage.viewer-isolated .stage__intro,
  .stage.viewer-listing .stage__intro { opacity: 0.07; }
  /* and the viewer comes forward, so the panel and list sit above the faded words */
  .stage.viewer-isolated .viewer--js,
  .stage.viewer-listing .viewer--js { z-index: 4; }
}

/* ---------- narrow screens ---------- */
@media (max-width: 1100px) and (min-width: 761px) {
  .viewer__hint { flex-basis: 100%; }
}
@media (max-width: 760px) {
  .viewer--js { --viewer-bar-bottom: 14px; }
  .viewer__bar { left: 14px; right: 14px; gap: 10px 14px; }
  .viewer__segs { flex: 1 1 100%; }
  .viewer__seg { flex: 1 1 auto; padding: 9px 8px 10px; }
  .viewer__explode { flex: 1 1 auto; min-width: 0; }
  .viewer__range { flex: 1 1 auto; width: auto; min-width: 80px; }
  .viewer__turn { padding: 9px 13px 10px; }
  .viewer__hint { flex: 1 1 150px; min-width: 0; line-height: 1.35; }

  .viewer__info, .viewer__list {
    left: 0; right: 0; bottom: 0; top: auto;
    width: auto; transform: none;
    max-height: 58%;
    border-radius: var(--radius-m) var(--radius-m) 0 0;
    border-bottom: 0;
  }
  .viewer__info { padding: 18px 18px 18px; }
  .viewer__name { font-size: var(--step-1); margin: 6px 0 8px; }
  .viewer__blurb { font-size: var(--step--1); margin-bottom: 12px; }
  .viewer__facts { margin-bottom: 14px; }
  .viewer--js.is-isolated .viewer__bar { visibility: hidden; }
  .viewer__turn--sheet { display: inline-flex; justify-content: center; }
  /* the part's buttons stay in reach while its text scrolls */
  .viewer__info { padding-bottom: 0; }
  .viewer__info-nav {
    position: sticky; bottom: 0;
    margin: 0 -18px; padding: 10px 18px 14px;
    background: var(--asphalt-2);
    border-top: 1px solid var(--asphalt-line);
  }
  .viewer__info-nav .viewer__btn--all { grid-column: auto; }
  .viewer__poster { left: 16px; right: auto; bottom: auto; top: 6%; width: calc(100% - 32px); height: 62%; object-position: 50% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .viewer__canvas, .viewer__bar, .viewer__loading, .stage__intro { transition: none; }
  .viewer__info, .viewer__list { animation: none; }
  .viewer__loading.is-indeterminate .viewer__progress-bar { animation: none; left: 35%; }
}

/* ---------- stealth pass: mono, uppercase controls; selected states in ink, not yellow ---------- */
.viewer__seg, .viewer__btn, .viewer__label, .viewer__hint, .viewer__turn, .viewer__kind, .viewer__count, .viewer__tip {
  font-family: var(--mono); font-size: var(--step--2); letter-spacing: 0.12em; text-transform: uppercase;
}
.viewer__segs { gap: 0; padding: 0; border-color: var(--rule-2); }
.viewer__seg { padding: 10px 14px; border-right: 1px solid var(--asphalt-line); border-radius: 0; }
.viewer__seg:last-child { border-right: 0; }
.viewer__seg[aria-pressed="true"] { background: var(--on-asphalt); color: var(--asphalt); font-weight: 600; }
.viewer__btn { border-color: var(--rule-2); padding: 10px 14px; }
.viewer__name { font-family: var(--display); font-stretch: 112%; font-weight: 700; text-transform: uppercase; letter-spacing: 0.01em; font-size: var(--step-1); }
.viewer__info { border-color: var(--rule-2); background: color-mix(in srgb, var(--asphalt-2) 94%, transparent); }
.viewer__facts dt { font-family: var(--mono); font-size: var(--step--2); letter-spacing: 0.1em; text-transform: uppercase; }
