/* ── Fonts ─────────────────────────────────────────────────────────────── */

@font-face {
  font-family: "Google Sans Flex";
  src: url("../fonts/GoogleSansFlex.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/InstrumentSerif-Italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/GeistMono.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ── Tokens ────────────────────────────────────────────────────────────── */

:root {
  --paper: #fff;
  --stage: #f5f5f3;
  --line: #e8e8e3;
  --line-2: #d9d8d3;
  --ink: #000;
  --ink-2: #55554e; /* icons and quiet buttons */
  --ink-3: #888; /* descriptions, labels and counts */
  --accent: #b623af;
  --accent-soft: #fee7fb;
  --part: #a228cc; /* a part pointed out on the model, as the guide colours it */

  --sans: "Google Sans Flex", ui-sans-serif, system-ui, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --shadow-sm: 0 1px 2px rgb(17 17 16 / 0.04), 0 6px 20px -8px rgb(17 17 16 / 0.12);
  --shadow-md: 0 1px 2px rgb(17 17 16 / 0.04), 0 20px 48px -20px rgb(17 17 16 / 0.22);
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  --tile: radial-gradient(85% 110% at 70% 40%, #fff 0%, #f7f7f4 46%, #ecece7 100%);

  color-scheme: light;
}

/* ── Base ──────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

svg {
  display: block;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::selection {
  background: var(--ink);
  color: #fff;
}

.caps {
  font: 400 12px/1.2 var(--sans);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.eyebrow b {
  font-weight: inherit;
}

.eyebrow b::after {
  content: "";
  display: inline-block;
  width: 18px;
  height: 1px;
  margin-left: 10px;
  background: var(--line-2);
  vertical-align: middle;
}

.notice {
  max-width: 46ch;
  margin: 22vh auto 0;
  padding: 0 24px;
  color: var(--ink-2);
  font-size: 17px;
  line-height: 1.5;
  text-align: center;
}

.notice b {
  color: var(--ink);
}

/* ── Home ──────────────────────────────────────────────────────────────── */

.home {
  display: flex;
  flex-direction: column;
  max-width: 1400px;
  min-height: 100svh;
  margin: 0 auto;
  padding: 0 clamp(20px, 4.5vw, 64px);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}

.brand {
  display: inline-flex;
  align-items: center;
}

.brand__logo {
  display: block;
  width: auto;
  height: clamp(34px, 11vw, 46px); /* smaller only on narrow phones, so it stays on one line with the product count */
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 350px);
  align-items: end;
  gap: 22px clamp(24px, 5vw, 80px);
  padding: clamp(32px, 5vw, 72px) 0 clamp(36px, 4.5vw, 64px);
}

.hero .eyebrow {
  grid-column: 1 / -1;
}

.hero .eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.75rem, 7.6vw, 6.75rem);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.hero h1 span,
.hero h1 em {
  display: block;
}

.hero h1 em {
  padding-bottom: 0.1em;
  font-family: var(--serif);
  font-size: 1.07em;
  font-weight: 400;
  letter-spacing: -0.025em;
}

.lead {
  margin: 0 0 0.9em;
  color: var(--ink-3);
  font-size: clamp(1rem, 1.25vw, 1.125rem);
  line-height: 1.5;
}

.index {
  padding-bottom: clamp(56px, 8vw, 112px);
}

.index__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.index__head h2 {
  margin: 0;
  font: inherit;
  color: var(--ink);
}

.empty {
  padding: 64px 0;
  color: var(--ink-2);
  text-align: center;
}

/* Featured project */

.feature {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  min-height: clamp(480px, 44vw, 640px);
  overflow: hidden;
  border-radius: 32px;
  background: var(--tile);
}

.feature + .feature {
  margin-top: 20px;
}

.feature--flipped {
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  background: radial-gradient(85% 110% at 30% 40%, #fff 0%, #f7f7f4 46%, #ecece7 100%);
}

.feature--flipped .feature__art {
  order: -1;
}

.feature__text {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  padding: clamp(24px, 3.2vw, 44px);
}

.feature h3 {
  margin: 0;
  font-size: clamp(2rem, 3.8vw, 3.6rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.feature__desc {
  max-width: 42ch;
  margin: 16px 0 0;
  color: var(--ink-3);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 7px 11px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.6);
  color: var(--ink-2);
  font: 500 11px/1 var(--sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  margin-top: 28px;
  padding: 0 18px 0 24px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 550;
  transition: background 0.3s, gap 0.3s var(--ease);
}

.feature:hover .cta {
  gap: 14px;
  background: var(--accent);
}

.feature__art {
  position: relative;
  min-height: 320px;
}

/* Two faint rings under the product, like the edge of a turntable. */
.feature__art::before,
.feature__art::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 7%;
  width: 58%;
  aspect-ratio: 3.6;
  border: 1px solid rgb(17 17 16 / 0.08);
  border-radius: 50%;
  translate: -50% 0;
}

.feature__art::after {
  bottom: 1%;
  width: 96%;
  border-color: rgb(17 17 16 / 0.045);
}

.feature__art img,
.card__art img {
  position: absolute;
  z-index: 1;
  object-fit: contain;
  transition: transform 0.9s var(--ease);
}

/* Posters stand on the tile's floor line whatever their shape, so the rings sit under each one. */
.feature__art img {
  inset: 6% 6% 7%;
  width: 88%;
  height: 87%;
  object-position: center bottom;
}

.feature:hover .feature__art img {
  transform: scale(1.035) translateY(-1%);
}

.art-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--line-2);
}

.art-empty svg {
  width: 96px;
  height: 96px;
  stroke-width: 0.6;
}

/* A card whose picture is being taken (looks.js): the placeholder breathes, then the picture comes in. */
.is-waiting .art-empty svg {
  animation: waiting 1.1s ease-in-out infinite alternate;
}

.is-new .feature__art img,
.is-new .card__art img {
  animation: arrive 0.8s var(--ease) backwards;
}

@keyframes waiting {
  to {
    opacity: 0.3;
  }
}

@keyframes arrive {
  from {
    opacity: 0;
    scale: 0.94;
  }
}

/* Where models are photographed for their cards: out of sight, but laid out, so the 3D stage has a size. */
.darkroom {
  position: fixed;
  top: 0;
  left: -200vw;
  width: 256px;
  height: 256px;
  visibility: hidden;
  pointer-events: none;
}

/* Other projects */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 20px;
  margin-top: 20px;
}

.card__art {
  position: relative;
  aspect-ratio: 1 / 1.05;
  overflow: hidden;
  border-radius: 24px;
  background: radial-gradient(90% 90% at 50% 40%, #fff 0%, #f7f7f4 50%, #ecece7 100%);
}

.card__art img {
  inset: 10%;
  width: 80%;
  height: 80%;
}

.card:hover .card__art img {
  transform: scale(1.05);
}

.card__meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 2px 12px;
  padding: 16px 6px 0;
}

.card__meta h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 550;
  letter-spacing: -0.02em;
}

.card__cat {
  grid-column: 2;
  color: var(--ink-3);
  font-size: 13.5px;
}

.card__go {
  display: grid;
  grid-row: 1 / span 2;
  grid-column: 3;
  align-self: center;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}

.card:hover .card__go {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding: 26px 0 30px;
  border-top: 1px solid var(--line);
}

@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .lead {
    max-width: 44ch;
  }

  .feature,
  .feature--flipped {
    grid-template-columns: 1fr;
  }

  .feature__text {
    gap: 22px;
  }

  .feature__art {
    order: -1;
    min-height: 72vw;
  }
}

/* ── Viewer ────────────────────────────────────────────────────────────── */

.viewer {
  --panel: 348px;
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--paper);
}

.stage {
  position: absolute;
  inset: 0;
  /* A touch darker than the page, so white products still stand out from it. */
  background: radial-gradient(75% 85% at 60% 44%, #fafaf8 0%, #f0f0ec 48%, #e3e3dd 100%);
}

.stage__canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  opacity: 0;
  cursor: grab;
  transition: opacity 1.1s ease;
}

.stage__canvas:active {
  cursor: grabbing;
}

.viewer[data-state="ready"] .stage__canvas {
  opacity: 1;
}

/* Location tags keep their size on screen, with coloured pointers to the current step's pieces. */
.step-tags {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.step-tags > svg {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: visible;
  stroke: var(--tag-color);
  stroke-width: 1.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.step-tags circle {
  fill: var(--tag-color);
  stroke: white;
}

.step-tag {
  position: absolute;
  left: 0;
  top: 0;
  padding: 4px 10px;
  border: 2px solid var(--tag-color);
  border-radius: 6px;
  background: rgb(255 255 255 / 96%);
  box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
  color: var(--ink);
  font: 600 13px/18px var(--sans);
  white-space: nowrap;
}

/* Everything floating over the stage sits in the area the panel leaves free. */
.stage__ui {
  position: absolute;
  inset: 0 0 0 calc(var(--panel) + 16px);
  pointer-events: none;
  transition: left 0.5s var(--ease);
}

.stage__ui > * {
  pointer-events: auto;
}

.stage__back {
  display: none;
}

/* Brings the side panel back once it has been put away. */
.stage__show {
  position: absolute;
  top: 16px;
  left: 16px;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(255 255 255 / 0.88);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px) saturate(1.4);
  color: var(--ink-2);
  visibility: hidden;
  opacity: 0;
  transition: color 0.2s, opacity 0.3s, visibility 0s 0.3s;
}

.stage__show:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

.hint {
  position: absolute;
  top: 28px;
  left: 16px;
  display: flex;
  margin: 0;
  color: var(--ink-2);
  font-size: 10px;
  letter-spacing: 0.02em;
  pointer-events: none;
  transition: opacity 0.6s, left 0.5s var(--ease);
}

.hint span + span::before {
  content: "•";
  margin: 0 24px;
}

.viewer:not([data-state="ready"]) .hint,
.viewer.is-touched .hint {
  opacity: 0;
}

/* Loading */

.loader {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
  translate: -50% -50%;
  pointer-events: none;
  transition: opacity 0.5s, visibility 0.5s;
}

.viewer[data-state="ready"] .loader {
  visibility: hidden;
  opacity: 0;
}

.loader__num {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  font-size: clamp(64px, 8vw, 104px);
  font-weight: 500;
  line-height: 0.9;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.loader__num b {
  font-weight: inherit;
}

.loader__num i {
  margin-top: 0.5em;
  color: var(--ink-3);
  font: 500 14px/1 var(--sans);
  letter-spacing: 0;
}

.loader__bar {
  width: 200px;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--line);
}

.loader__bar i {
  display: block;
  height: 100%;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.loader.is-busy .loader__bar i {
  animation: busy 1.2s ease-in-out infinite;
}

@keyframes busy {
  0% {
    transform: translateX(-100%) scaleX(0.4);
  }
  100% {
    transform: translateX(100%) scaleX(0.4);
  }
}

.loader__error {
  max-width: 34ch;
  margin: 0;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

/* Tools */

.edit-button {
  position: absolute; /* app.js puts it just below the toolbar */
  top: 230px;
  right: 16px;
  min-width: 48px;
  padding: 11px 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(255 255 255 / 0.94);
  box-shadow: var(--shadow-sm);
  font: 600 11.5px/1 var(--sans);
}
.edit-button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.edit-button[hidden], .edit-panel[hidden], .edit-status[hidden], .edit-panel fieldset[hidden], .edit-panel__empty[hidden] { display: none; }
.viewer:not([data-state="ready"]) .edit-button { visibility: hidden; }
.edit-panel {
  position: absolute;
  top: 70px;
  right: 78px;
  width: 310px;
  max-height: calc(100% - 190px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgb(255 255 255 / 0.97);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  font: 400 13px/1.5 var(--sans);
}
.edit-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.edit-panel__head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.edit-panel__head .caps { color: var(--ink-2); font-size: 10px; }
.edit-panel__step { margin: 10px 0 16px; font-weight: 500; overflow-wrap: anywhere; }
.edit-panel fieldset { display: grid; gap: 8px; border: 0; margin: 0; padding: 0; min-width: 0; }
.edit-panel label { font-weight: 500; }
.edit-panel__legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.edit-panel select, .edit-panel textarea, .edit-pivot input, .edit-curve input, .edit-object input, #edit-body-search {
  width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); font: inherit;
}
.edit-panel textarea { resize: vertical; }
.edit-panel__directions { display: grid; gap: 6px; }
.edit-panel__direction { display: flex; gap: 6px; }
.edit-panel__direction button { width: 32px; flex-shrink: 0; font-size: 20px; border-radius: 8px; background: var(--stage); }
.edit-panel__add { justify-self: start; margin-bottom: 10px; font-weight: 500; }
.edit-panel__check { display: flex; gap: 8px; align-items: start; margin: 7px 0; }
.edit-panel__check input { margin-top: 4px; accent-color: var(--ink); }
.edit-panel__inherit, .edit-panel__help, .edit-panel__empty { margin: 6px 0; color: var(--ink-2); font-size: 12px; }
/* Several pivots: each one's own direction, animation and size (Pivot movement), and its bodies. */
.edit-panel__step-motion { display: contents; }
.edit-panel__step-motion[hidden], .edit-pivot-motion[hidden], .edit-pivot-motion__tabs[hidden], .edit-panel__pivot-animation[hidden] { display: none; }
.edit-panel__pivot-animation { display: grid; gap: 8px; }
.edit-pivot-motion { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--stage); }
.edit-pivot-motion h3 { margin: 0; font-size: 14px; }
.edit-pivot-motion__tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.edit-pivot-motion__tabs button { padding: 7px 10px; border-radius: 8px; background: #fff; border: 1px solid var(--line); font-size: 12px; }
.edit-pivot-motion__tabs button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.edit-pivot-motion__state { margin: 0; font-size: 12px; color: var(--ink-2); }
.edit-pivot__new { display: block; padding: 8px 10px; border-radius: 8px; background: var(--stage); margin-bottom: 8px; font-size: 12px; }
.edit-pivot__body-label { margin: 4px 0; font-size: 12px; font-weight: 500; }
.edit-pivot__body-label[hidden], .edit-pivot__bodies[hidden] { display: none; }
.edit-pivot__bodies { display: grid; gap: 5px; max-height: 150px; overflow: auto; overscroll-behavior: contain; margin-bottom: 10px; }
.edit-pivot__bodies label { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 12px; font-weight: 400; }
.edit-pivot__bodies input[type="checkbox"] { flex: 0 0 auto; width: 14px; height: 14px; padding: 0; margin: 0; accent-color: var(--ink); }
.edit-pivot__owner { margin-left: auto; padding-left: 6px; color: var(--ink-2); font-size: 11px; white-space: nowrap; }
.edit-pivot { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 10px; }
.edit-pivot h3 { margin: 0 0 8px; font-size: 14px; }
.edit-pivot select { margin: 6px 0 10px; }
.edit-pivot select[hidden], .edit-pivot__select-label[hidden] { display: none; }
.edit-pivot__state, .edit-pivot__help { margin: 6px 0 10px; font-size: 12px; color: var(--ink-2); }
.edit-pivot__buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.edit-pivot__buttons button { padding: 8px 10px; border-radius: 8px; background: var(--stage); font-size: 12px; }
.edit-pivot__buttons .edit-pivot__place { background: var(--ink); color: #fff; }
.edit-pivot__values { display: grid; gap: 6px; margin-top: 12px; }
.edit-pivot__values[hidden] { display: none; }
.edit-pivot__coordinates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.edit-pivot__coordinates label { font-size: 11px; }
.edit-pivot__coordinates input { margin-top: 4px; padding: 8px 6px; }
.edit-curve { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 10px; }
.edit-curve[hidden], .edit-pivot[hidden] { display: none; }
.edit-curve h3 { margin: 0 0 8px; font-size: 14px; }
.edit-curve__state, .edit-curve__help { margin: 6px 0 10px; font-size: 12px; color: var(--ink-2); }
.edit-curve__buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.edit-curve__tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.edit-curve__tabs[hidden] { display: none; }
.edit-curve__tabs button { padding: 8px 10px; border-radius: 8px; background: var(--stage); font-size: 12px; }
.edit-curve__tabs button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.edit-curve__buttons button { padding: 8px 10px; border-radius: 8px; background: var(--stage); font-size: 12px; }
.edit-curve__buttons .edit-curve__place { background: var(--ink); color: #fff; }
.edit-curve__coordinates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.edit-curve__coordinates label { font-size: 11px; }
.edit-curve__coordinates input { margin-top: 4px; padding: 8px 6px; }
.edit-panel.is-placing-curve .edit-panel__fields > :not(.edit-curve),
.edit-panel.is-placing-curve .edit-curve > :not(h3):not(.edit-curve__state):not(.edit-curve__buttons),
.edit-panel.is-placing-curve .edit-curve__buttons > :not(.edit-curve__place),
.edit-panel.is-placing-curve .edit-panel__help, .edit-panel.is-placing-curve .edit-panel__count { display: none; }
.edit-panel.is-creating-curve .edit-curve__buttons > :not(.edit-curve__new):not(.edit-curve__finish):not(.edit-curve__undo) { display: none; }
.edit-panel.is-creating-curve .edit-curve__buttons > .edit-curve__new,
.edit-panel.is-creating-curve .edit-curve__buttons > .edit-curve__finish,
.edit-panel.is-creating-curve .edit-curve__buttons > .edit-curve__undo { display: block; }
.edit-curve__buttons .edit-curve__finish { background: var(--ink); color: #fff; }
.edit-panel.is-dragging-curve .edit-panel__fields > :not(.edit-curve),
.edit-panel.is-dragging-curve .edit-curve > :not(h3):not(.edit-curve__state),
.edit-panel.is-dragging-curve .edit-panel__help, .edit-panel.is-dragging-curve .edit-panel__count { display: none; }
.edit-bodies { min-width: 0; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 10px; }
.edit-bodies h3 { margin: 0 0 8px; font-size: 14px; }
.edit-bodies__state, .edit-bodies__help, .edit-bodies__list p { font-size: 12px; color: var(--ink-2); margin: 6px 0 10px; }
.edit-bodies__buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.edit-bodies__buttons button { padding: 8px 10px; border-radius: 8px; background: var(--stage); font-size: 12px; }
.edit-bodies__buttons .edit-bodies__pick { background: var(--ink); color: #fff; }
#edit-body-search { margin: 6px 0; }
.edit-bodies__tree-tools { display: flex; gap: 12px; margin: 2px 0 8px; }
.edit-bodies__tree-tools button { font-size: 11px; color: var(--ink-2); }
.edit-bodies__list { max-height: 280px; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.edit-bodies__tree { list-style: none; margin: 0; padding: 0; }
.edit-bodies__tree .edit-bodies__tree { margin-left: 12px; padding-left: 5px; border-left: 1px solid var(--line); }
.edit-bodies__row { display: flex; align-items: center; gap: 5px; min-height: 28px; padding: 3px 4px; border-radius: 4px; cursor: pointer; font-size: 11px; }
.edit-bodies__row:hover { background: var(--stage); }
.edit-bodies__row.is-selected { background: #edf4ff; }
.edit-bodies__row.is-mixed { background: #f5f8fc; }
.edit-bodies__row:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
summary.edit-bodies__row { list-style: none; }
summary.edit-bodies__row::-webkit-details-marker { display: none; }
.edit-bodies__row::before { content: ''; flex: 0 0 8px; width: 8px; }
summary.edit-bodies__row::before { height: 8px; border-right: 1.5px solid var(--ink-2); border-bottom: 1.5px solid var(--ink-2); transform: scale(.65) rotate(-45deg); }
details[open] > summary.edit-bodies__row::before { transform: scale(.65) rotate(45deg); }
.edit-bodies__row input { flex: 0 0 auto; width: 12px; height: 12px; margin: 0; accent-color: var(--ink); }
.edit-bodies__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The step's own objects can be picked by name for the Move / Rotate / Scale gizmo. */
button.edit-bodies__name { padding: 2px 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.edit-bodies__name:hover { text-decoration: underline; }
.edit-bodies__row.is-object-selected { outline: 2px solid #1a73e8; outline-offset: -2px; }
.edit-bodies__check-space { flex: 0 0 12px; width: 12px; }
.edit-bodies__part-fbx { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.edit-bodies__part-fbx > details > summary .edit-bodies__name { font-weight: 600; }
.edit-bodies__icon { flex: 0 0 12px; width: 12px; height: 12px; color: #b17430; }
.edit-bodies__icon.is-body { clip-path: polygon(0 0, 100% 0, 50% 100%); background: currentColor; }
.edit-bodies__icon.is-group { border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: scale(.8); }
.edit-bodies__icon.is-arrow { color: #fe2fb7; clip-path: polygon(50% 0, 100% 45%, 65% 45%, 65% 100%, 35% 100%, 35% 45%, 0 45%); background: currentColor; }
.edit-bodies__icon.is-tag { color: #fe2fb7; border: 1.5px solid currentColor; border-radius: 3px; transform: scale(.75); }
/* Selected object: Move / Rotate / Scale. */
.edit-object { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 10px; }
.edit-object[hidden] { display: none; }
.edit-object h3 { margin: 0 0 8px; font-size: 14px; overflow-wrap: anywhere; }
.edit-object__tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.edit-object button { padding: 7px 9px; border-radius: 7px; background: var(--stage); font-size: 12px; }
.edit-object__tools button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.edit-object__values > p { margin: 8px 0 4px; font-size: 12px; font-weight: 500; }
.edit-object__values > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.edit-object__values label { min-width: 0; font-size: 11px; }
.edit-object__values input { margin-top: 4px; padding: 7px 5px; }
.edit-object__values input:disabled { color: var(--ink-3); background: var(--stage); }
.edit-object__help { margin: 10px 0; font-size: 12px; color: var(--ink-2); }
.edit-bodies__tally { flex-shrink: 0; font: 400 10px var(--sans); color: var(--ink-2); }
.edit-bodies__list > p { padding: 4px; }
.edit-panel.is-picking-body .edit-panel__fields > :not(.edit-bodies),
.edit-panel.is-picking-body .edit-bodies > :not(h3):not(.edit-bodies__state):not(.edit-bodies__buttons),
.edit-panel.is-picking-body .edit-bodies__buttons > :not(.edit-bodies__pick),
.edit-panel.is-picking-body .edit-panel__help, .edit-panel.is-picking-body .edit-panel__count { display: none; }
.edit-panel.is-placing .edit-panel__fields > :not(.edit-pivot),
.edit-panel.is-placing .edit-pivot__buttons > :not(.edit-pivot__place),
.edit-panel.is-placing .edit-pivot__help, .edit-panel.is-placing .edit-panel__help,
.edit-panel.is-placing .edit-pivot__new, .edit-panel.is-placing .edit-pivot__body-label, .edit-panel.is-placing .edit-pivot__bodies,
.edit-panel.is-placing .edit-panel__count { display: none; }
.edit-panel__count { margin: 16px 0 12px; font-size: 12px; }
.edit-panel footer { display: flex; gap: 8px; justify-content: flex-end; position: sticky; bottom: -20px; padding: 12px 0; background: #fff; }
.edit-panel footer button { padding: 10px 14px; border-radius: 10px; font-weight: 500; background: var(--stage); }
.edit-panel footer .edit-panel__save { background: var(--ink); color: #fff; }
.edit-panel button:disabled { opacity: 0.5; cursor: wait; }
.edit-status {
  position: absolute; top: 284px; right: 16px; max-width: 310px; padding: 12px 16px;
  margin: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  box-shadow: var(--shadow-sm); font: 500 12px/1.5 var(--sans); overflow-wrap: anywhere;
}
.edit-status.is-error { color: #a12c16; border-color: #e5b5ac; }
.edit-panel .edit-status { position: static; margin: 12px 0; max-width: 100%; }
@media (max-width: 900px) {
  .edit-button { top: 226px; right: 12px; }
  .edit-panel { position: fixed; z-index: 5; top: auto; bottom: 12px; right: 12px; width: calc(100% - 24px); max-height: calc(100svh - 110px); padding: 16px; }
  .edit-panel.has-cable-curve { max-height: 42svh; }
  .edit-status { right: 12px; max-width: calc(100% - 24px); }
}

.tools {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(255 255 255 / 0.88);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px) saturate(1.4);
  transition: opacity 0.5s;
}

.viewer:not([data-state="ready"]) .tools,
.viewer:not([data-state="ready"]) .dock {
  opacity: 0;
  pointer-events: none;
}

.tool {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--ink-2);
  transition: background 0.2s, color 0.2s;
}

.tool:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

.tool:disabled { opacity: 0.45; cursor: default; }
.tool[hidden] { display: none; } /* tools a model has no use for: Autoplay without a guide, Full screen on an iPhone */

.tool[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

.tool[aria-expanded="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.tool[aria-expanded="true"]::after {
  display: none;
}

.tool::after {
  content: attr(data-tip);
  position: absolute;
  top: 50%;
  right: calc(100% + 12px);
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font: 500 12px/1 var(--sans);
  white-space: nowrap;
  opacity: 0;
  translate: 4px -50%;
  pointer-events: none;
  transition: opacity 0.15s, translate 0.15s;
}

.tool:hover::after,
.tool:focus-visible::after {
  opacity: 1;
  translate: 0 -50%;
}

/* Playback bar */

.dock {
  position: absolute;
  bottom: 20px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(640px, 100% - 32px);
  padding: 10px 12px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgb(255 255 255 / 0.9);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px) saturate(1.4);
  translate: -50% 0;
  transition: opacity 0.5s;
}

.dock[hidden] {
  display: none;
}

.dock__play {
  display: grid;
  flex: none;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  transition: transform 0.2s var(--ease), background 0.2s;
}

.dock__play:hover {
  transform: scale(1.06);
}

.dock__play:active {
  transform: scale(0.95);
}

.dock__main {
  display: grid;
  flex: 1;
  gap: 7px;
  min-width: 0;
}

.dock__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.dock__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock__time {
  flex: none;
  color: var(--ink-3);
  font: 500 12px/1 var(--sans);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dock__time b {
  color: var(--ink);
  font-weight: 500;
}

.dock__btn {
  display: grid;
  flex: none;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding: 0 8px;
  border-radius: 12px;
  color: var(--ink-2);
  font: 500 12.5px/1 var(--sans);
  transition: background 0.2s, color 0.2s;
}

.dock__btn:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

.dock__btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.dock__btn + .dock__btn {
  margin-left: -10px;
}

.scrub {
  --p: 0%;
  width: 100%;
  height: 14px;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.scrub::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--accent) var(--p), var(--line-2) var(--p));
}

.scrub::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(17 17 16 / 0.2);
  transition: scale 0.15s;
  -webkit-appearance: none;
}

.scrub:hover::-webkit-slider-thumb {
  scale: 1.2;
}

.scrub::-moz-range-track {
  height: 4px;
  border-radius: 4px;
  background: var(--line-2);
}

.scrub::-moz-range-progress {
  height: 4px;
  border-radius: 4px;
  background: var(--accent);
}

.scrub::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: #fff;
}

/* Step-by-step guide: one strip along the top — which way the procedure runs, every step of it, how
   far along, and the way out — with the current step spelled out in the card below. */

.tour {
  position: absolute;
  top: 16px;
  right: 78px;
  left: 16px;
  container: tour / inline-size;
  transition: left 0.5s var(--ease);
}

.tour[hidden] {
  display: none;
}

.tour__strip {
  display: flex;
  align-items: center;
  gap: 4px 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(255 255 255 / 0.88);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px) saturate(1.4);
}

/* Set into the strip, so it needs no outline of its own. */
.tour .seg {
  flex: none;
  border-color: transparent;
  background: var(--stage);
}

.tour__count {
  min-width: 15ch; /* room for "Step 88 of 88", so the steps beside it hold still as the number grows */
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.tour__close {
  display: grid;
  flex: none;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--ink-2);
  transition: background 0.2s, color 0.2s;
}

.tour__close:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

.tour__bar {
  display: flex;
  flex: 1;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Too narrow for one line: the steps drop to a line of their own, under the buttons. */
@container tour (max-width: 860px) {
  .tour__strip {
    flex-wrap: wrap;
  }

  .tour__bar {
    flex-basis: 100%;
    order: 1;
    padding: 0 8px 4px;
  }

  .tour .seg {
    margin-right: auto;
  }
}

.tour__group {
  display: grid;
  flex: 1 1 0;
  gap: 4px;
  min-width: 0;
  container-type: inline-size;
}

.tour__name {
  overflow: hidden;
  color: var(--ink);
  font: 700 10px/1.2 var(--sans);
  letter-spacing: 0.01em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

/* A name that would be cut to a letter or two is better left out. */
@container (max-width: 72px) {
  .tour__name {
    visibility: hidden;
  }
}

.tour__dashes {
  display: flex;
  gap: 3px;
}

.dash {
  position: relative;
  flex: 1;
  min-width: 3px;
  height: 16px;
}

.dash::before {
  content: "";
  position: absolute;
  inset: 6px 0 5px;
  border-radius: 2px;
  background: var(--line-2);
  transition: background 0.2s, inset 0.2s;
}

.dash:hover::before {
  background: var(--ink-3);
}

.dash.is-done::before {
  background: var(--ink);
}

.dash[aria-current]::before {
  inset: 4px 0;
  background: var(--accent);
}

/* The step card is kept low, to leave the room to the model: the step's name on one line, with where
   it belongs and its label beside it, and what to do on the next. It is wide, so that line seldom wraps. */
.guide {
  bottom: 16px;
  gap: 16px;
  width: min(880px, 100% - 32px);
  padding: 9px 10px 9px 20px;
}

.guide .dock__play {
  width: 44px;
  height: 44px;
}

.guide__body {
  flex: 1;
  min-width: 0;
}

.guide__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 16px;
}

.guide__action {
  margin: 0;
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.guide__meta {
  margin: 0;
  font-weight: 600;
}

.guide__text {
  margin: 2px 0 0;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.45;
}

.guide__label {
  margin: 0 0 0 12px;
  padding: 5px 16px;
  border-radius: 8px;
  background: var(--stage);
  font: 500 10.5px/1 var(--sans);
}

.guide__caution {
  margin: 6px 0 2px;
  padding: 6px 10px;
  border-radius: 9px;
  background: #fff5dc;
  color: #6a4800;
  font-size: 12.5px;
  line-height: 1.4;
}

.guide__label[hidden],
.guide__caution[hidden] {
  display: none;
}

.guide__keys {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 6px;
}

.dock__btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* Camera views: the camera tool at the bottom of the toolbar pops up, beside it, a live picture from each
   camera — Focus, close on the step's parts, and Overview, the whole product from above. Picking a
   picture looks through that camera; the one in use is outlined. */
.views__shots {
  position: absolute;
  right: calc(100% + 12px);
  bottom: 0;
  display: flex;
  gap: 12px;
}

.views__shots[hidden] {
  display: none;
}

.views__shots:not([hidden]) {
  animation: views-in 0.18s var(--ease) both;
}

@keyframes views-in {
  from {
    opacity: 0;
    transform: translateX(6px) scale(0.97);
  }
}

.shot {
  position: relative;
  width: 168px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: radial-gradient(75% 85% at 60% 44%, #fafaf8 0%, #f0f0ec 48%, #e3e3dd 100%);
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.shot canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.shot span {
  position: absolute;
  bottom: 6px;
  left: 6px;
  padding: 4px 7px;
  border-radius: 6px;
  background: rgb(255 255 255 / 0.92);
  color: var(--ink);
  font-size: 9.5px;
  font-weight: 700;
}

.shot:hover {
  border-color: var(--ink-3);
}

.shot[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-md);
}

.shot[aria-pressed="true"] span {
  background: var(--accent);
  color: #fff;
}

/* Side panel */

.panel {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  width: var(--panel);
  max-height: calc(100% - 32px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgb(255 255 255 / 0.94);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px);
  transition: translate 0.5s var(--ease), opacity 0.3s;
  animation: panel-in 0.7s var(--ease) both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
}

/* The panel put away: what floats over the stage takes the whole window, leaving a corner for the
   button that brings the panel back. Narrow screens return to the list when the procedure closes. */
@media (min-width: 901px) {
  /* Whichever of the two is leaving stays visible until it has faded; the one arriving shows at once. */
  .viewer.is-panel-off .panel {
    visibility: hidden;
    opacity: 0;
    translate: calc(-100% - 16px) 0;
    transition: translate 0.5s var(--ease), opacity 0.3s, visibility 0s 0.5s;
  }

  .viewer.is-panel-off .stage__ui {
    left: 0;
  }

  .viewer.is-panel-off .stage__show {
    visibility: visible;
    opacity: 1;
    transition: color 0.2s, opacity 0.3s;
  }

  .viewer.is-panel-off .hint,
  .viewer.is-panel-off .tour {
    left: 78px;
  }
}

.panel__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  padding: 12px 12px 4px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px 0 9px;
  border-radius: 12px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 400;
  transition: background 0.2s, color 0.2s;
}

.back:hover,
.pager a:hover,
.panel__hide:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

.pager {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.pager a,
.panel__hide {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--ink-2);
  transition: background 0.2s, color 0.2s;
}

.panel__scroll {
  flex: 1;
  padding: 14px 24px 24px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

.panel h1 {
  margin: 16px 0 0;
  color: var(--accent);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
  max-width: 8.5em; /* a model's long name takes two short lines */
}

.panel__desc {
  margin: 12px 0 0;
  color: var(--ink-3);
  font-size: 15.5px;
  font-weight: 500;
  line-height: 1.4;
}

.section {
  margin-top: 28px;
}

.section__head {
  display: flex;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.rows {
  display: grid;
  gap: 2px;
  margin: 8px -12px 0;
}

.clip,
.layer {
  display: grid;
  align-items: center;
  width: 100%;
  padding: 13px 12px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  transition: background 0.2s, color 0.2s;
}

.clip {
  grid-template-columns: 22px minmax(0, 1fr) 12px auto;
  gap: 10px;
}

.layer {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.clip:hover,
.layer:hover {
  background: var(--stage);
}

/* A pair of either/or buttons: Remove | Install, 3 Cell | 4 Cell. */
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(255 255 255 / 0.9);
}

.seg button {
  height: 32px;
  padding: 0 16px;
  border-radius: 9px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.seg button:hover {
  color: var(--ink);
}

.seg button[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

/* Sits in the list, right under the procedure it belongs to. */
.seg--wide {
  display: flex;
  margin: 4px 12px 8px;
}

.seg--wide button {
  flex: 1;
}

.clip__n,
.clip__time {
  font-variant-numeric: tabular-nums;
}

.clip__n {
  font: 600 15px/1 var(--sans);
}

.clip__time {
  color: var(--ink-3);
  font: 400 13px/1 var(--sans);
}

.clip__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clip[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
}

.clip[aria-pressed="true"] .clip__time {
  color: rgb(255 255 255 / 0.75);
}

.clip[aria-pressed="true"] .eq i {
  background: #fff;
}

.eq {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
  visibility: hidden;
}

.eq i {
  width: 2px;
  height: 100%;
  border-radius: 1px;
  background: var(--accent);
  transform: scaleY(0.35);
  transform-origin: bottom;
}

.clip[aria-pressed="true"] .eq {
  visibility: visible;
}

.clip.is-playing .eq i {
  animation: eq 0.9s ease-in-out infinite;
}

.clip.is-playing .eq i:nth-child(2) {
  animation-delay: -0.3s;
}

.clip.is-playing .eq i:nth-child(3) {
  animation-delay: -0.6s;
}

@keyframes eq {
  0%,
  100% {
    transform: scaleY(0.3);
  }
  50% {
    transform: scaleY(1);
  }
}

.switch {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 20px;
  background: var(--line-2);
  transition: background 0.25s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(17 17 16 / 0.25);
  transition: translate 0.25s var(--ease);
}

.layer[aria-checked="true"] .switch {
  background: var(--accent);
}

.layer[aria-checked="true"] .switch::after {
  translate: 14px 0;
}

/* What could not be built from them */

.note {
  margin: 12px 0 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: #fff5dc;
  color: #6a4800;
  font-size: 13px;
  line-height: 1.45;
}

.note[hidden] {
  display: none;
}

.keys {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 24px 0 0;
  color: var(--ink-3);
  font-size: 12.5px;
}

.keys kbd {
  margin-right: 5px;
  padding: 2px 6px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  color: var(--ink-2);
  font: 500 11px/1.4 var(--mono);
}

@media (pointer: coarse) {
  .keys {
    display: none;
  }
}

/* Narrow screens: the list below the model, with a full-screen stage during a procedure. */
@media (max-width: 900px) {
  .viewer {
    position: static;
    overflow: visible;
  }

  .stage {
    position: relative;
    height: 68svh;
    min-height: 420px;
  }

  .viewer.is-panel-off .panel {
    display: none;
  }

  .viewer.is-panel-off .stage {
    height: 100svh;
    min-height: 0;
  }

  .stage__ui {
    inset: 0;
  }

  .stage__back {
    position: absolute;
    top: 12px;
    left: 12px;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgb(255 255 255 / 0.9);
    box-shadow: var(--shadow-sm);
  }

  .hint,
  .panel .back,
  .panel__hide {
    display: none;
  }

  .tools {
    top: 12px;
    right: 12px;
  }

  .dock {
    bottom: 36px;
    gap: 10px;
    width: calc(100% - 24px);
  }

  .dock__total {
    display: none;
  }

  .tour {
    top: 12px;
    right: 68px;
    left: 68px;
  }

  .tour__count {
    display: none;
  }

  .tour__name {
    display: none;
  }

  .tour__bar {
    gap: 6px;
  }

  .tour__dashes {
    gap: 2px;
  }

  .guide {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px 14px 8px;
  }

  .guide__text {
    font-size: 13.5px;
  }

  .guide__label {
    margin-left: 0;
  }

  .guide__keys {
    align-self: flex-end;
  }

  .views__shots {
    right: calc(100% + 8px);
    gap: 8px;
  }

  .shot {
    width: 112px;
    border-radius: 12px;
  }

  .panel {
    position: relative;
    inset: auto;
    width: auto;
    max-height: none;
    margin-top: -22px;
    border-width: 1px 0 0;
    border-radius: 24px 24px 0 0;
    background: #fff;
    box-shadow: 0 -16px 40px -24px rgb(17 17 16 / 0.25);
    backdrop-filter: none;
    animation: none;
  }

  .panel__nav {
    justify-content: flex-end;
    min-height: 12px;
    padding-bottom: 0;
  }

  .panel__scroll {
    padding: 10px 20px 40px;
    overflow: visible;
  }
}

/* ── Overview ──────────────────────────────────────────────────────────── */

/* The two views of a product with a service guide: its overview and its procedures. */
.views {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 22px;
  padding: 4px;
  border-radius: 14px;
  background: var(--stage);
}

.views__link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  border-radius: 10px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.views__link svg {
  width: 18px;
  height: 18px;
}

.views__link:hover {
  color: var(--ink);
}

.views__link[aria-current="page"] {
  background: #fff;
  box-shadow: var(--shadow-sm);
  color: var(--accent);
}

.views__link[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

.pane__lead {
  margin: 18px 0 0;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.45;
}

/* Only the tools of the view shown: the service guide's own are away in the overview. */
.viewer[data-view="overview"] .edit-button:not(.edit-button--motion) {
  display: none;
}

/* Overall size: width, depth and height side by side. */
.size {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0 0;
}

.size div {
  padding: 10px 12px 11px;
  border-radius: 12px;
  background: var(--stage);
}

.size dt {
  margin-bottom: 5px;
  font-size: 10.5px;
}

.size dd {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* The overview's switches, each with its sign. */
.layer__name {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.layer__name svg {
  flex: none;
  color: var(--ink-2);
  transition: color 0.2s;
}

.layer[aria-checked="true"] .layer__name svg {
  color: var(--accent);
}

.layer:disabled {
  opacity: 0.5;
  cursor: default;
}

.layer:disabled:hover {
  background: none;
}

/* A product's parts: hover to light one up, click to pick it; its arrow opens the parts inside it. */
.part-line {
  display: flex;
  align-items: center;
  border-radius: 12px;
  transition: background 0.2s, color 0.2s;
}

.part-line:hover {
  background: var(--stage);
}

.part-line:has(.part-row[aria-pressed="true"]) {
  background: var(--accent);
  color: #fff;
}

.part-row {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(22px, auto) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
}

.part-row__n,
.part-row__meta {
  font-variant-numeric: tabular-nums;
}

.part-row__n {
  font: 600 15px/1 var(--sans);
}

.part-row__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.part-row__meta {
  color: var(--ink-3);
  font: 400 13px/1 var(--sans);
}

.part-row.is-absent {
  color: var(--ink-3);
}

.part-line:has(.part-row[aria-pressed="true"]) :is(.part-row__meta, .part-row__n, .part-open) {
  color: rgb(255 255 255 / 0.8);
}

/* The parts inside a part: under it, a step in, along a line. */
.part-kids {
  display: grid;
  gap: 2px;
  margin: 2px 0 4px 23px;
  padding-left: 7px;
  border-left: 1px solid var(--line-2);
}

.part-kids[hidden] {
  display: none;
}

.part-kids .part-row {
  padding: 9px 10px;
  font-size: 14px;
  font-weight: 500;
}

.part-kids .part-row__n {
  color: var(--ink-3);
  font: 500 12.5px/1 var(--sans);
}

.part-open,
.part-eye {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-right: 6px;
  border-radius: 9px;
  color: var(--ink-3);
  transition: background 0.15s, color 0.15s;
}

.part-open:hover,
.part-eye:hover {
  background: rgb(0 0 0 / 0.06);
  color: var(--ink);
}

.part-open svg {
  transition: transform 0.2s;
}

.part-open[aria-expanded="true"] svg {
  transform: rotate(90deg);
}

.part-eye + .part-open {
  margin-left: -6px;
}

/* Edit mode: an eye on each part shows it in the list or leaves it out; parts left out stay, faded. */
.part-eye[aria-pressed="true"] {
  color: var(--ink-2);
}

.part-item.is-left-out > .part-line .part-row {
  opacity: 0.4;
}

/* …and the part picked on the model, when it is one in the list. */
.part-line.is-picked {
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

[data-part="parts"] .seg--choice {
  margin: 12px 0 6px;
}

/* Overlays on the model: dimension lines and part tags, drawn at screen size under the stage's tools. */
.dimensions,
.part-tags {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.dimensions[hidden],
.part-tags[hidden] {
  display: none;
}

.dimensions > svg,
.part-tags > svg {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.dimensions__line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.4px;
}

.dimensions__extension {
  fill: none;
  stroke: rgb(17 17 16 / 0.45);
  stroke-width: 1px;
}

.dimensions__arrows {
  fill: var(--ink);
}

.dimensions__label {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0;
  padding: 5px 10px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: rgb(255 255 255 / 0.96);
  box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
  color: var(--ink);
  font: 400 13px/18px var(--sans);
  white-space: nowrap;
}

.dimensions__label[hidden] {
  display: none;
}

.dimensions__label .caps {
  font-size: 10px;
}

.dimensions__label b {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.dimensions__unit {
  color: var(--ink-3);
  font-size: 12px;
}

.part-tags > svg {
  fill: none;
  stroke: rgb(17 17 16 / 0.5);
  stroke-width: 1.25px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.part-tags circle {
  fill: var(--ink);
  stroke: #fff;
  stroke-width: 1.5px;
}

.part-tags g.is-hot {
  stroke: var(--part);
  stroke-width: 2px;
}

.part-tags g.is-hot circle {
  fill: var(--part);
}

.part-tag {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 5px;
  border: 1.5px solid var(--line-2);
  border-radius: 8px;
  background: rgb(255 255 255 / 0.96);
  box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
  color: var(--ink);
  font: 600 13px/18px var(--sans);
  white-space: nowrap;
  pointer-events: auto;
  transition: border-color 0.15s;
}

.part-tag[hidden] {
  display: none;
}

.part-tag__n {
  min-width: 22px;
  padding: 0 4px;
  border-radius: 5px;
  background: var(--stage);
  color: var(--ink-2);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: background 0.15s, color 0.15s;
}

.part-tag:hover,
.part-tag.is-hot {
  border-color: var(--part);
}

.part-tag.is-hot .part-tag__n {
  background: var(--part);
  color: #fff;
}

/* A part out of sight (it stood in front of the one picked): its tag fades. */
.part-tag.is-away,
.part-tags g.is-away {
  opacity: 0.4;
}

/* On a narrow stage: numbers only, the list of parts below being the key — except the part in hand. */
.part-tags.is-compact .part-tag:not(.is-hot) {
  gap: 0;
  padding: 3px;
}

.part-tags.is-compact .part-tag:not(.is-hot) .part-tag__name {
  display: none;
}

/* ── AR ────────────────────────────────────────────────────────────────── */

/* The AR button sits under Edit, or where Edit would be (app.js puts it just below the toolbar). On a
   device that can't show AR, it opens a card beside it: a QR code for a phone, or why AR can't start. */
.ar {
  position: absolute;
  z-index: 6; /* its card opens over the step card */
  top: 230px;
  right: 16px;
}

.viewer:not([data-state="ready"]) .ar {
  visibility: hidden;
}

.ar-button {
  display: grid;
  justify-items: center;
  gap: 3px;
  width: 48px;
  padding: 7px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(255 255 255 / 0.94);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  font: 700 11px/1 var(--sans);
  letter-spacing: 0.04em;
  transition: background 0.2s;
}

.ar-button svg {
  color: var(--accent);
}

.ar-button:hover,
.ar-button[aria-expanded="true"] {
  background: var(--accent-soft);
}

.ar-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.ar-card {
  position: absolute;
  top: 0;
  right: calc(100% + 12px);
  width: 300px;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow-md);
  animation: views-in 0.18s var(--ease) both;
}

.ar-card[hidden] {
  display: none;
}

.ar-card h2 {
  margin: 0 36px 8px 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
}

.ar-card p {
  margin: 0 0 12px;
  color: var(--ink-3);
  font-size: 13.5px;
  line-height: 1.45;
}

.ar-card p:last-child {
  margin-bottom: 0;
}

.ar-card .ar-card__small {
  font-size: 12px;
}

.ar-card b {
  color: var(--ink);
  font-weight: 600;
}

.ar-card .ar-card__error {
  color: #a12c16;
}

.ar-card__close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--ink-2);
}

.ar-card__close:hover {
  background: var(--accent-soft);
  color: var(--ink);
}

.ar-card__code {
  width: 188px;
  aspect-ratio: 1;
  margin: 4px auto 12px;
}

.ar-card__code svg {
  width: 100%;
  height: 100%;
}

.ar-card__link {
  color: var(--ink);
  font-weight: 600;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ar-card__go,
.ar-card__stop {
  display: block;
  width: 100%;
  margin: 2px 0 12px;
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.ar-card__stop {
  margin: 4px 0 0;
  background: var(--stage);
  color: var(--ink);
}

.ar-card__go:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* The tools for the product in the room join the toolbar while AR lasts. */
.tools > [data-tool^="ar-"],
.ar-exit,
.ar-status {
  display: none;
}

.tool--text {
  font: 700 10.5px/1 var(--sans);
}

/* In AR the page shows over the camera picture (WebXR's DOM overlay), filling the screen. The stage's
   own picture and its camera tools step aside; the guide's strip, card and tags stay. */
.viewer.is-ar,
.viewer.is-ar .stage {
  background: transparent;
}

.viewer.is-ar .stage {
  position: absolute;
  inset: 0;
  height: auto;
  min-height: 0;
  touch-action: none; /* fingers move the product (ar.js), not the page */
  -webkit-user-select: none;
  user-select: none;
}

.viewer.is-ar .stage__canvas {
  visibility: hidden;
}

.viewer.is-ar .stage__ui {
  inset: 0;
}

.viewer.is-ar .stage__back,
.viewer.is-ar .stage__show,
.viewer.is-ar .hint,
.viewer.is-ar .loader,
.viewer.is-ar .edit-button,
.viewer.is-ar .edit-panel,
.viewer.is-ar .edit-status,
.viewer.is-ar .ar,
.viewer.is-ar .views__shots,
.viewer.is-ar .tools > [data-tool="rotate"],
.viewer.is-ar .tools > [data-tool="reset"],
.viewer.is-ar .tools > [data-tool="full"],
.viewer.is-ar .tools > [data-tool="views"] {
  display: none;
}

.viewer.is-ar .tools {
  top: 12px;
  right: 12px;
}

.viewer.is-ar .tools > [data-tool^="ar-"] {
  display: grid;
}

.viewer.is-ar .tour {
  top: 12px;
  right: 68px;
  left: 68px;
}

.viewer.is-ar .ar-exit {
  position: absolute;
  top: 12px;
  left: 12px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgb(255 255 255 / 0.92);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}

/* What the phone is doing: looking for the floor, then for a moment, how to move the product. */
.viewer.is-ar .ar-status:not([hidden]) {
  position: absolute;
  top: 45%;
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 10px;
  width: max-content;
  max-width: min(300px, 100% - 48px);
  margin: 0;
  padding: 14px 20px;
  border-radius: 18px;
  background: rgb(17 17 16 / 0.62);
  color: #fff;
  font: 600 14.5px/1.35 var(--sans);
  text-align: center;
  translate: -50% -50%;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.ar-status__phone svg {
  width: 30px;
  height: 30px;
  animation: ar-sweep 2.4s ease-in-out infinite;
}

@keyframes ar-sweep {
  0%,
  100% {
    transform: translateX(-14px) rotate(-10deg);
  }

  50% {
    transform: translateX(14px) rotate(10deg);
  }
}

.viewer[data-ar="placed"] .ar-status:not([hidden]) {
  top: 30%;
}

.viewer[data-ar="placed"] .ar-status__phone {
  display: none;
}

/* Until the product stands on the floor, only the way out and what to do show: nothing that marks the
   product (the overview's dimensions and part tags, a step's tags) floats over the room without it. */
.viewer[data-ar="finding"] .tools,
.viewer[data-ar="finding"] .tour,
.viewer[data-ar="finding"] .dock,
.viewer[data-ar="finding"] .step-tags,
.viewer[data-ar="finding"] .dimensions,
.viewer[data-ar="finding"] .part-tags,
.viewer[data-ar="finding"] .panel {
  visibility: hidden;
}

/* The list (procedures or animations) is a sheet along the bottom, over the camera picture. It keeps
   low, leaving the camera the screen: a handle, then the product's name beside its two views. The
   handle opens the rest (app.js). */
.panel__grip {
  display: none;
}

.viewer.is-ar .panel {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  width: auto;
  max-height: 46%;
  margin: 0;
  padding-bottom: env(safe-area-inset-bottom);
  border-width: 1px 0 0;
  border-radius: 22px 22px 0 0;
  background: #fff;
  box-shadow: 0 -16px 40px -24px rgb(17 17 16 / 0.35);
  opacity: 1;
  translate: none;
  animation: none;
  transition: height 0.28s var(--ease), translate 0.28s var(--ease);
}

/* Following a finger, or starting a slide from where it is. */
.viewer.is-ar.is-sheet-sliding .panel {
  transition: none;
}

/* A finger on the sheet's top (anywhere on it while it is low) slides it, rather than the page. */
.viewer.is-ar .panel__grip,
.viewer.is-ar .panel h1,
.viewer.is-ar .views,
.viewer.is-ar:not(.is-sheet-open) .panel__scroll {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.viewer.is-ar.is-panel-off .panel,
.viewer.is-ar .panel__nav,
.viewer.is-ar .panel .eyebrow,
.viewer.is-ar .panel__desc,
.viewer.is-ar .panel .keys,
.viewer.is-ar:not(.is-sheet-open) .pane {
  display: none;
}

.viewer.is-ar .panel__grip {
  position: relative;
  display: block;
  flex: none;
  width: 100%;
  height: 22px;
  border: 0;
  background: none;
  cursor: grab;
}

.viewer.is-ar .panel__grip::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 50%;
  width: 38px;
  height: 5px;
  border-radius: 3px;
  background: var(--line-2);
  translate: -50% 0;
}

.viewer.is-ar .panel__scroll {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  align-items: center;
  column-gap: 12px;
  padding: 0 16px 12px;
  overflow-y: auto;
}

.viewer.is-ar.is-sheet-open .panel__scroll {
  padding-bottom: 24px;
}

.viewer.is-ar .panel h1 {
  max-width: none;
  margin: 0;
  overflow: hidden;
  font-size: 18px;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}

.viewer.is-ar .views {
  grid-template-columns: auto auto;
  gap: 2px;
  margin: 0;
  padding: 3px;
  border-radius: 12px;
}

.viewer.is-ar .views__link {
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 13px;
}

.viewer.is-ar .views__link svg {
  width: 16px;
  height: 16px;
}

.viewer.is-ar .pane {
  grid-column: 1 / -1;
}

.viewer.is-ar .section {
  margin-top: 14px;
}

/* An animation's player, or a step's card, rides above the sheet. */
.viewer.is-ar:not(.is-panel-off) .dock {
  bottom: calc(var(--sheet, 0px) + 12px);
}

/* On an iPhone or iPad the page shows the camera picture itself (ar-8thwall.js): the engine draws it on a
   canvas under the stage's own, and the page fills the screen as WebXR's overlay does on Android. */
.viewer.is-ar-page {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  background: #000;
}

html:has(.viewer.is-ar-page) {
  overflow: hidden;
}

.viewer.is-ar-page .stage__canvas {
  visibility: visible;
  pointer-events: none; /* fingers reach the stage, which moves the product */
}

.stage__camera {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.viewer.is-ar-page .panel__scroll {
  overscroll-behavior: contain;
}

/* While an iPhone measures the room, the phone in the message moves forward and back. */
.ar-status[data-motion="push"] .ar-status__phone svg {
  animation-name: ar-push;
}

.ar-status[data-motion="none"] .ar-status__phone {
  display: none;
}

@keyframes ar-push {
  0%,
  100% {
    transform: scale(0.8);
  }

  50% {
    transform: scale(1.15);
  }
}

@media (max-width: 900px) {
  .ar {
    right: 12px;
  }

  .ar-card {
    position: fixed;
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
  }
}

/* ── Motion ────────────────────────────────────────────────────────────── */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

.hero > *,
.index {
  animation: rise 0.9s var(--ease) both;
}

.hero h1 {
  animation-delay: 0.06s;
}

.hero .lead {
  animation-delay: 0.14s;
}

.index {
  animation-delay: 0.22s;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* The overview's Edit mode: the product's own animations (mechanism-editor.js). */
.motion-panel {
  position: absolute;
  top: 70px;
  right: 78px;
  width: 330px;
  max-height: calc(100% - 140px);
  overflow: auto;
  padding: 16px 16px 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgb(255 255 255 / 0.97);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
  font: 400 13px/1.45 var(--sans);
  overscroll-behavior: contain;
  /* The model's tree takes the room left, and gives it up first. */
  display: flex;
  flex-direction: column;
}
.motion-panel > * { flex-shrink: 0; }
.motion-panel[hidden], .motion-panel [hidden] { display: none !important; }
.motion-panel button { color: inherit; font: inherit; cursor: pointer; }
.motion-panel button:disabled { opacity: 0.4; cursor: default; }
.mp-head { display: flex; align-items: center; gap: 4px; min-height: 30px; }
.mp-title { flex: 1; min-width: 0; margin: 0; overflow: hidden; font-size: 17px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.mp-title__input {
  width: 100%; padding: 2px 6px; border: 0; border-radius: 7px; outline: 2px solid var(--accent);
  background: #fff; font: inherit;
}
.mp-icon {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 9px; color: var(--ink-2); transition: background 0.15s, color 0.15s;
}
.mp-icon:hover { background: var(--accent-soft); color: var(--accent); }
.mp-icon[aria-pressed="true"] { background: var(--accent); color: #fff; }
.mp-danger:hover, .mp-danger.is-asking { background: #fde4e4; color: #c0222b; }

.mp-anim { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.mp-bar { display: flex; align-items: center; gap: 4px; }
.mp-play { color: var(--ink); }
.mp-rec {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 999px; color: #c0222b; font-weight: 600;
  font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase;
}
.mp-rec:hover { border-color: #c0222b; }
.mp-rec[aria-pressed="true"] { border-color: #e0242f; background: #e0242f; color: #fff; }
.mp-rec[aria-pressed="true"] svg { animation: mp-blink 1s steps(2, start) infinite; }
@keyframes mp-blink { to { visibility: hidden; } }
.mp-tools { display: inline-flex; gap: 2px; padding: 2px; border-radius: 11px; background: var(--stage); }
.mp-clock { min-width: 44px; margin-left: 4px; color: var(--ink-3); font: 500 12px/1 var(--mono); }

.mp-time { position: relative; margin: 10px 0 2px; }
/* The ruler: drag along it to set the time (red while recording, as in Blender and Unity). */
.mp-ruler { display: grid; grid-template-columns: 112px 1fr; gap: 8px; margin-bottom: 5px; }
.mp-ruler__track {
  position: relative; height: 18px; border-radius: 6px; background: var(--stage); cursor: ew-resize; touch-action: none;
}
.mp-ruler__track i { position: absolute; bottom: 0; width: 1px; height: 4px; background: var(--ink-3); opacity: 0.6; pointer-events: none; }
.mp-ruler__track i.is-whole { height: 7px; opacity: 1; }
.mp-ruler__track span { position: absolute; bottom: 7px; left: 3px; color: var(--ink-3); font: 500 9.5px/1 var(--mono); }
.motion-panel.is-recording .mp-ruler__track { background: #fde4e4; }
.motion-panel.is-recording .mp-playhead { background: #e0242f; }
.mp-row__span.is-keys { border-color: transparent; background: color-mix(in srgb, var(--accent) 14%, #fff); cursor: grab; }
.mp-row.is-picked .mp-row__span.is-keys { background: color-mix(in srgb, var(--accent) 26%, #fff); }
.mp-row.is-hit .mp-row__span.is-keys { border-color: #e0242f; }
.mp-key {
  position: absolute; top: 50%; width: 9px; height: 9px; margin: -5px 0 0 -5px; border: 1.5px solid var(--accent);
  border-radius: 2px; background: #fff; transform: rotate(45deg); cursor: ew-resize; z-index: 1;
}
.mp-key:hover { background: color-mix(in srgb, var(--accent) 35%, #fff); }
.mp-key.is-picked { background: var(--accent); }
.mp-rows { display: grid; gap: 5px; }
.mp-row { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 8px; }
.mp-row__name {
  display: flex; align-items: center; gap: 6px; min-width: 0; padding: 3px 6px 3px 2px;
  border-radius: 8px; text-align: left; color: var(--ink-2);
}
.mp-row__name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-row__name svg { flex-shrink: 0; }
.mp-row__name:hover { background: var(--stage); color: var(--ink); }
.mp-row.is-picked .mp-row__name { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.mp-row__track { position: relative; height: 24px; border-radius: 7px; background: var(--stage); cursor: text; }
.mp-row__span {
  position: absolute; top: 3px; bottom: 3px; min-width: 6px; border-radius: 5px;
  border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 22%, #fff); cursor: grab;
}
.mp-row.is-picked .mp-row__span { background: color-mix(in srgb, var(--accent) 55%, #fff); }
.mp-row__span.is-cycle {
  background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--accent) 25%, #fff) 0 5px, #fff 5px 9px);
}
.mp-row.is-hit .mp-row__span { border-color: #e0242f; box-shadow: inset -3px 0 0 #e0242f; }
.mp-row__end { position: absolute; top: -1px; right: -4px; bottom: -1px; width: 8px; cursor: ew-resize; }
.mp-playhead {
  position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px;
  background: var(--ink); pointer-events: none;
}
.mp-empty { margin: 4px 0; color: var(--ink-3); }
.mp-hint { margin: 8px 0 0; color: var(--ink-3); font-size: 12px; }

/* The model's objects, as its file has them (like Blender's outliner). */
.mp-tree {
  position: relative; flex: 0 1 auto; min-height: 96px; overflow: auto; margin: 10px -10px 0; padding: 6px 4px;
  border-top: 1px solid var(--line); overscroll-behavior: contain;
}
.mp-node {
  display: flex; align-items: center; gap: 2px; height: 26px; padding: 0 6px 0 calc(var(--depth) * 14px);
  border-radius: 7px; color: var(--ink-2); white-space: nowrap;
}
.mp-node:hover { background: var(--stage); color: var(--ink); }
.mp-node.is-in { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.mp-node.is-picked { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.mp-node__open { display: inline-grid; place-items: center; width: 20px; height: 20px; flex-shrink: 0; border-radius: 5px; color: var(--ink-3); }
.mp-node__open svg { transition: transform 0.15s; }
.mp-node[aria-expanded="true"] .mp-node__open svg { transform: rotate(90deg); }
.motion-panel .mp-node__open:hover { color: var(--ink); }
.mp-node__name { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; height: 100%; text-align: left; }
.mp-node__name svg { flex-shrink: 0; color: var(--ink-3); }
.mp-node.is-picked .mp-node__name svg { color: var(--accent); }
.mp-node__name span { overflow: hidden; text-overflow: ellipsis; }
.mp-node__motion { display: inline-grid; flex-shrink: 0; color: var(--accent); }
.mp-node__motion svg { width: 14px; height: 14px; }
.mp-tree__all { position: sticky; top: 0; z-index: 1; float: right; width: 26px; height: 26px; margin: 0 2px 0 6px; background: #fff; }
.mp-tree__all[aria-pressed="true"] { background: var(--accent); }

.mp-part { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.mp-part__head { display: flex; align-items: center; gap: 8px; }
.mp-part__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.mp-part__count { flex: 1; color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.mp-types { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 10px 0; }
.mp-types button {
  display: grid; justify-items: center; gap: 3px; padding: 7px 2px 6px; border: 1px solid var(--line);
  border-radius: 11px; color: var(--ink-2); font-size: 11px; transition: border-color 0.15s, background 0.15s;
}
.mp-types button:hover { border-color: var(--accent); color: var(--accent); }
.mp-types button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: #fff; }
.mp-values { display: flex; align-items: center; gap: 6px; }
.mp-amount {
  display: flex; align-items: center; flex: 1; min-width: 0; height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff;
}
.mp-amount:focus-within { border-color: var(--accent); }
.mp-amount input { width: 100%; min-width: 0; border: 0; outline: 0; background: none; font: 500 13px var(--sans); }
.mp-unit { color: var(--ink-3); }
.mp-way { height: 32px; padding: 0 6px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font: inherit; }
.mp-pivot { display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--ink-2); }
.mp-pivot svg { flex-shrink: 0; color: var(--accent); }
.mp-pivot__how { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-pivot button { padding: 5px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.mp-pivot button:hover { border-color: var(--accent); }
.mp-pivot button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: #fff; }
.mp-state { margin: 9px 0 0; padding: 6px 10px; border-radius: 8px; background: var(--stage); color: var(--ink-2); font-weight: 500; }
.mp-state.is-hit { background: #fde8e8; color: #b3121b; }
.mp-state.is-clear { background: #e6f5ea; color: #1d6b35; }
.mp-words { display: flex; align-items: center; gap: 8px; margin-top: 9px; color: var(--ink-3); font-size: 12px; }
.mp-words button { min-width: 0; padding: 4px 8px; border-radius: 7px; background: var(--stage); }
.mp-words button:hover { background: var(--accent-soft); }
.mp-words code { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font: 500 11.5px var(--mono); }
.mp-drop { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 5px 8px; border-radius: 8px; color: var(--ink-3); }
.mp-drop:hover { background: #fde4e4; color: #c0222b; }
.mp-adjust { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.mp-adjust__bar { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.mp-adjust__bar [data-act="adjust-reset"] { margin-left: auto; }
.mp-seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 11px; background: var(--stage); }
.mp-seg button[data-act] { height: 28px; padding: 0 10px; border-radius: 9px; color: var(--ink-2); font-size: 12px; font-weight: 500; }
.mp-seg button[data-act][aria-pressed="true"] { background: #fff; color: var(--accent); box-shadow: 0 1px 2px rgb(0 0 0 / 0.1); }
.mp-seg .mp-icon { width: 28px; height: 28px; }
.mp-seg .mp-icon:disabled { opacity: 0.35; pointer-events: none; }
.mp-xyz { display: grid; grid-template-columns: 56px repeat(3, minmax(0, 1fr)) 16px; align-items: center; gap: 4px; margin-top: 4px; color: var(--ink-3); font-size: 12px; }
.mp-xyz[hidden] { display: none; }
.mp-lines { display: flex; gap: 2px; margin: 0 0 6px; }
.mp-lines[hidden] { display: none; }
.mp-lines .mp-icon { width: 28px; height: 28px; }
.mp-xyz i { font-style: normal; text-align: center; }
.mp-xyz input {
  width: 100%; min-width: 0; height: 28px; padding: 0 6px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; color: var(--ink); font: 500 12px var(--mono);
}
.mp-xyz input:focus { border-color: var(--accent); outline: 0; }
.mp-xyz input { -moz-appearance: textfield; appearance: textfield; }
.mp-xyz input::-webkit-inner-spin-button, .mp-xyz input::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.mp-xyz input[data-axis="0"] { box-shadow: inset 0 -2px 0 #e5484d; }
.mp-xyz input[data-axis="1"] { box-shadow: inset 0 -2px 0 #30a46c; }
.mp-xyz input[data-axis="2"] { box-shadow: inset 0 -2px 0 #3e63dd; }
.mp-foot {
  position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px;
  margin: 14px -16px 0; padding: 12px 16px; border-top: 1px solid var(--line); background: #fff;
}
.mp-foot button { padding: 9px 16px; border-radius: 10px; background: var(--stage); font-weight: 500; }
.mp-foot .mp-save { background: var(--ink); color: #fff; }

/* While editing, the Show switches rest: the editor poses the parts itself. */
.viewer.is-editing-motion [data-part="layers"] { opacity: 0.45; pointer-events: none; }
/* …and the animations come first in the side panel: the one edited is picked there, or a new one started. */
.viewer.is-editing-motion [data-pane="overview"]:not([hidden]) { display: flex; flex-direction: column; }
.viewer.is-editing-motion [data-part="clips"] { order: -1; margin-top: 20px; }
.clip--new { color: var(--accent); }
.clip--new svg { justify-self: center; }

/* Recording: the stage says so all round its edge. */
.stage.is-recording::after {
  content: ""; position: absolute; inset: 0; z-index: 1; border: 3px solid #e0242f; pointer-events: none;
}

/* Each view's own Edit: the guide's in the service view, the animations' in the overview. */
.viewer[data-view="service"] .edit-button--motion { display: none; }

@media (max-width: 900px) {
  .motion-panel { position: fixed; z-index: 5; top: auto; bottom: 12px; right: 12px; width: calc(100% - 24px); max-height: calc(100svh - 110px); }
}
