/* ==========================================================================
   GLIDER 3D DESIGNER — product-page colour designer (Odin Lite)
   Loaded only on product pages whose wing has `design3d` in src/data.js.
   Uses the site's tokens (site.css) so it follows light and dark themes.
   ========================================================================== */
.g3d {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 960px) { .g3d { grid-template-columns: minmax(0, 1fr); } }

.g3d__stage {
  position: sticky; top: calc(var(--nav-h, 72px) + 1rem);
  display: grid; gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(170deg, var(--surface), var(--ink-3));
}
@media (max-width: 960px) { .g3d__stage { position: relative; top: 0; } }
.g3d__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.g3d__views { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.g3d__btn {
  min-height: 40px; padding: 0 0.95rem;
  font: 700 0.74rem/1 var(--body); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); background: var(--ink-3);
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
}
.g3d__btn:hover { color: var(--text); border-color: var(--line-strong); }
.g3d__btn.is-on, .g3d__btn[aria-pressed="true"] { color: var(--on-brand, #04121f); background: var(--cyan); border-color: var(--cyan); }
.g3d__btn:focus-visible { outline: 2px solid var(--cyan-hot); outline-offset: 2px; }

.g3d__canvas {
  position: relative; aspect-ratio: 16 / 11; border-radius: var(--radius);
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 20%, #2a3a52, #121a26);   /* dark mode */
  touch-action: none; cursor: grab;
}
:root[data-theme="light"] .g3d__canvas { background: radial-gradient(120% 90% at 50% 20%, #f4f8fc, #d9e3ee); }
.g3d__canvas:active { cursor: grabbing; }
.g3d__canvas canvas { display: block; width: 100%; height: 100%; }
.g3d__load {
  position: absolute; inset: 0; display: grid; place-items: center; margin: 0;
  font-size: 0.9rem; color: #a9b6c8;
}
:root[data-theme="light"] .g3d__load { color: #4a5a74; }
.g3d__load[hidden] { display: none; }
.g3d__note { margin: 0; font-size: 0.8rem; color: var(--dim); }

.g3d__panel { display: grid; gap: 1rem; }
.g3d__blk {
  margin: 0; padding: 1.1rem 1.1rem 1.2rem;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: linear-gradient(170deg, var(--surface), var(--ink-3));
  display: grid; gap: 0.85rem; min-width: 0;
}
.g3d__blk legend {
  padding: 0 0.4rem;
  font: 700 0.73rem/1 var(--body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan);
}
.g3d__hint { margin: 0; font-size: 0.82rem; color: var(--muted); }

.g3d__ways { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.g3d__way {
  display: grid; justify-items: start; gap: 0.5rem;
  padding: 0.75rem; min-height: 44px; text-align: left;
  font: 700 0.84rem/1.2 var(--body); color: var(--text);
  background: var(--ink-3); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.g3d__way:hover { border-color: var(--line-strong); }
.g3d__way.is-on { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan) inset; }
.g3d__way:focus-visible { outline: 2px solid var(--cyan-hot); outline-offset: 2px; }
.g3d__waydots { display: flex; gap: 3px; }
.g3d__waydots i { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, 0.5); }
.g3d__waydots--custom i { background: conic-gradient(#C32341, #F38032, #E6D56F, #8DC63F, #36B4EC, #5C358D, #C32341); }

.g3d__row { display: grid; gap: 0.45rem; }
.g3d__rowhead { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.g3d__label { font: 700 0.84rem/1.2 var(--body); color: var(--text); }
.g3d__val { font-size: 0.78rem; color: var(--muted); }
.g3d__sws { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 0.35rem; }
.g3d__sw { position: relative; display: block; cursor: pointer; }
.g3d__sw input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.g3d__sw span {
  display: block; aspect-ratio: 1; border-radius: 9px; background: var(--sw);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s var(--ease);
}
.g3d__sw.is-light span { box-shadow: inset 0 0 0 1px rgba(30, 63, 96, 0.3), 0 2px 6px rgba(0, 0, 0, 0.25); }
.g3d__sw:hover span { transform: translateY(-2px); }
.g3d__sw input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--cyan); }
.g3d__sw input:focus-visible + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--cyan-hot); }
.g3d__swname {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.g3d__sizes { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.g3d__size { position: relative; }
.g3d__size input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.g3d__size span {
  display: grid; place-items: center; min-width: 52px; min-height: 44px; padding: 0 0.7rem;
  font: 700 0.86rem/1 var(--body); color: var(--muted);
  background: var(--ink-3); border: 1px solid var(--line); border-radius: 10px;
}
.g3d__size input:checked + span { color: var(--on-brand, #04121f); background: var(--cyan); border-color: var(--cyan); }
.g3d__size input:focus-visible + span { outline: 2px solid var(--cyan-hot); outline-offset: 2px; }

.g3d__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
@media (max-width: 520px) { .g3d__fields { grid-template-columns: minmax(0, 1fr); } }
.g3d__fields label {
  display: grid; gap: 0.35rem; min-width: 0;
  font: 700 0.7rem/1.2 var(--body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
}
.g3d__wide { grid-column: 1 / -1; }
.g3d__fields input, .g3d__fields textarea {
  width: 100%; padding: 0.75rem 0.9rem;
  font: 400 0.94rem/1.4 var(--body); letter-spacing: 0; text-transform: none; color: var(--white);
  background: var(--ink-3); border: 1px solid var(--line); border-radius: 10px;
}
.g3d__fields input:focus, .g3d__fields textarea:focus { outline: none; border-color: var(--cyan); background: var(--surface); }
.g3d__fields .is-missing { border-color: var(--danger); }
.g3d__acts { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.g3d__status {
  padding: 0.85rem 1rem; border-radius: var(--radius); font-size: 0.88rem;
  border: 1px solid var(--line); background: var(--ink-3); color: var(--text);
}
.g3d__status[hidden] { display: none; }
.g3d__status strong { display: block; margin-bottom: 0.2rem; }
.g3d__status.is-ok { border-color: var(--ok); }
.g3d__status.is-error { border-color: var(--danger); }

/* ------------------------------------------------------------ video clips */
.clips {
  display: grid; gap: 1.25rem; align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
.clip { margin: 0; display: grid; gap: 0.6rem; }
.clip video {
  display: block; width: 100%; background: #000;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.clip--portrait video { aspect-ratio: 9 / 16; max-height: 640px; width: auto; max-width: 100%; justify-self: center; }
.clip figcaption { font-weight: 700; font-size: 0.92rem; color: var(--text); text-align: center; }
.clip--yt { align-self: center; }

.clip__box { position: relative; justify-self: center; max-width: 100%; }
.clip__gate {
  position: absolute; inset: 0; display: grid; place-content: center; gap: 0.8rem; padding: 1.2rem;
  text-align: center; color: #fff; background: rgba(5, 8, 15, 0.72); border-radius: var(--radius-lg);
}
.clip__gate[hidden] { display: none; }
.clip__gate p { margin: 0; font-size: 0.85rem; line-height: 1.45; max-width: 26ch; justify-self: center; }
.clip__gate .btn { justify-self: center; }

/* view, spin and download buttons share the bar; the download carries an icon */
.g3d__btn { display: inline-flex; align-items: center; gap: 0.4rem; }
.g3d__btn svg { width: 15px; height: 15px; flex: none; }
.g3d__fee { font-weight: 700; font-size: 0.78em; color: var(--cyan); }
