/* ============================================================
   GENE HEW v13 - the van in 3D (2026-09-24, entry 2026-09-25)
   The entry is the van as a scale model on a paper plinth, standing on the van photo: it turns,
   drags round, and a tap swaps the photo for the live model in the same frame. Pill controls
   match the site's buttons; pins are the six spec lines. Additive layer, loaded last.
   ============================================================ */

/* ---------- the entry: the van on a plinth ---------- */
.v3d-open, .v3d-ui button { -webkit-tap-highlight-color: transparent; }
.v3d-ui button:active { transform: scale(0.97); }
.v3d-open {
  position: absolute; z-index: 3; right: calc(var(--pad) - 20px); bottom: clamp(128px, 15vw, 206px);
  width: clamp(330px, 31vw, 460px);
  display: grid; justify-items: center; padding: 0; border: 0; background: none; color: var(--on-dark);
  font: inherit; cursor: grab; user-select: none; -webkit-user-select: none;
  transition: opacity var(--dur-base) var(--ease-standard), transform var(--dur-base) var(--ease-standard);
}
.v3d-open.is-turning { cursor: grabbing; }
.v3d-open::before { /* a soft pool of shade so the model reads against the busy photo */
  content: ""; position: absolute; inset: -8% -10% -14%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(11, 20, 16, 0.66), rgba(11, 20, 16, 0.34) 58%, transparent);
}
.v3d-open-stage { position: relative; display: block; width: 100%; aspect-ratio: var(--fr); pointer-events: none; }
.v3d-open-disc { /* a paper model base, like an architect's plinth, drawn in the render's perspective */
  position: absolute; left: var(--ax); top: var(--ay); width: calc(var(--disc) * 1.2); aspect-ratio: 1;
  transform: translate(-50%, -50%) rotateX(55deg); transform-style: preserve-3d; border-radius: 50%;
  background: radial-gradient(circle closest-side, #fbfaf6 0 55%, #f2f0e8 85%, #e8e5da 100%);
  box-shadow: inset 0 0 0 1px rgba(22, 32, 26, 0.12);
}
.v3d-open-disc::before { /* the plinth's edge: the same circle, a little lower */
  content: ""; position: absolute; inset: 0; border-radius: 50%; transform: translateZ(-18px);
  background: linear-gradient(90deg, #b9b5a7, #d8d4c7 45%, #c4c0b2);
  box-shadow: 0 26px 40px 4px rgba(0, 0, 0, 0.5);
}
.v3d-open-ring { position: absolute; inset: 3%; border-radius: 50%; transform: rotate(var(--deg, 0deg)); }
.v3d-open-ring::before { /* degree ticks that turn with the van */
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background:
    repeating-conic-gradient(rgba(22, 32, 26, 0.55) 0 0.8deg, transparent 0.8deg 30deg),
    repeating-conic-gradient(rgba(22, 32, 26, 0.22) 0 0.5deg, transparent 0.5deg 6deg);
  -webkit-mask: radial-gradient(circle closest-side, transparent 0 88%, #000 88.5% 97%, transparent 97.5%);
  mask: radial-gradient(circle closest-side, transparent 0 88%, #000 88.5% 97%, transparent 97.5%);
}
.v3d-open-shade { /* the van's footprint shadow (6.0 x 2.05 m), on the plinth so it turns with the van */
  position: absolute; left: 50%; top: 50%; width: 27.5%; height: 81%; translate: -50% -52.5%;
  transform: rotate(var(--cab, 0deg)); border-radius: 16% / 6%;
  background: rgba(22, 32, 26, 0.5); filter: blur(6px); box-shadow: 0 0 26px 14px rgba(22, 32, 26, 0.18);
}
.v3d-open-van { position: absolute; inset: 0; background-size: 100% 100%; background-repeat: no-repeat; }
.v3d-open-row { position: relative; display: flex; align-items: center; gap: 12px; margin-top: 2%; }
.v3d-open-cta {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 9px; white-space: nowrap;
  padding: 10px 14px 10px 12px; border-radius: 999px; background: var(--green); color: var(--black);
  font: 600 15px/1 var(--font-body); box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.6);
  transition: background var(--dur-feedback) ease, color var(--dur-feedback) ease;
}
.v3d-open-cta::before { /* download progress: a light fill sweeping across the pill, like the site's tab countdown */
  content: ""; position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--p, 0));
  background: rgba(255, 255, 255, 0.34); transition: transform 180ms linear; pointer-events: none;
}
.v3d-open-cta svg { width: 19px; height: 19px; flex: none; transition: transform var(--dur-base) var(--ease-standard); }
.v3d-open-size {
  margin-left: 2px; padding: 3px 7px; border-radius: 999px; background: rgba(11, 20, 16, 0.12);
  font: 600 12px/1 var(--font-body); font-variant-numeric: tabular-nums;
}
.v3d-open-hint {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px 9px 10px; border-radius: 999px;
  font: 600 13.5px/1 var(--font-body); color: var(--on-dark); white-space: nowrap;
  background: rgba(11, 20, 16, 0.62); box-shadow: inset 0 0 0 1px rgba(233, 242, 236, 0.16);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: opacity var(--dur-base) ease;
}
.v3d-open-hint svg { width: 17px; height: 17px; flex: none; }
.v3d-open.is-turning .v3d-open-hint { opacity: 0.5; }
@media (hover: hover) {
  .v3d-open:hover .v3d-open-cta { background: var(--green-deep); color: #fff; }
  .v3d-open:hover .v3d-open-size { background: rgba(255, 255, 255, 0.2); }
  .v3d-open:hover .v3d-open-cta svg { transform: rotate(-30deg); }
}
.v3d-open:focus-visible { outline: none; }
.v3d-open:focus-visible .v3d-open-cta { outline: 3px solid var(--green); outline-offset: 3px; }
.v3d-open[aria-busy="true"] { cursor: progress; }
.v3d-open[aria-busy="true"] .v3d-open-cta svg { animation: v3d-spin 1.1s linear infinite; }
@keyframes v3d-spin { to { transform: rotate(360deg); } }
.van-hero.is-3d-in .v3d-open { opacity: 0; pointer-events: none; transform: translateY(8px); }

/* ---------- 3D mode: the stage takes over the photo's frame ---------- */
.van-hero.is-3d { transition: height var(--dur-slow) var(--ease-standard); }
.v3d-stage {
  position: absolute; inset: 0; z-index: 1; opacity: 0;
  background: radial-gradient(120% 95% at 50% 36%, #25362d 0%, #142019 52%, var(--black) 100%);
  transition: opacity 600ms var(--ease-standard);
}
.v3d-canvas { display: block; width: 100%; height: 100%; outline: none; cursor: grab; }
.v3d-canvas:active { cursor: grabbing; }
.v3d-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--green); }
.van-hero > img { transition: opacity 600ms var(--ease-standard); }
.van-hero.is-3d-in > img { opacity: 0; }
.van-hero.is-3d-in .v3d-stage { opacity: 1; }
/* keep the title legible but let the model breathe; never block the canvas */
.van-hero::after { pointer-events: none; z-index: 2; transition: opacity 600ms ease; }
.van-hero.is-3d-in::after { background: linear-gradient(180deg, rgba(11,20,16,0) 64%, rgba(11,20,16,0.55) 84%, var(--black) 100%); }
/* the section title overlaps the bottom of the frame (the wheels): let drags through to the model */
#van:has(.van-hero.is-3d-in) .sec-head { pointer-events: none; }

.v3d-ui { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; transition: opacity 500ms var(--ease-standard) 200ms; }
.van-hero.is-3d-in .v3d-ui { opacity: 1; }
.v3d-ui > *, .v3d-bar > button, .v3d-bar > .v3d-views { pointer-events: auto; }
.v3d-marks { position: absolute; inset: 0; pointer-events: none; }

/* ---------- top bar: views + close ---------- */
.v3d-bar {
  position: absolute; top: 18px; left: var(--pad); right: var(--pad);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  pointer-events: none;
}
.v3d-views {
  display: inline-flex; gap: 3px; padding: 4px; border-radius: 999px;
  background: #16221b; box-shadow: inset 0 0 0 1px rgba(233, 242, 236, 0.14), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
}
.v3d-views button, .v3d-close {
  min-height: 40px; padding: 8px 16px; border: 0; border-radius: 999px; cursor: pointer;
  font: 600 14px/1 var(--font-body); color: var(--on-dark); background: transparent;
  transition: background var(--dur-feedback) ease, color var(--dur-feedback) ease;
}
.v3d-views button[aria-pressed="true"] { background: var(--green); color: var(--black); }
@media (hover: hover) { .v3d-views button[aria-pressed="false"]:hover { background: rgba(233, 242, 236, 0.12); } }
.v3d-close {
  display: inline-flex; align-items: center; gap: 6px; padding-left: 12px;
  background: #16221b; box-shadow: inset 0 0 0 1px rgba(233, 242, 236, 0.14), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
}
.v3d-close svg { width: 18px; height: 18px; }
@media (hover: hover) { .v3d-close:hover { background: var(--paper); color: var(--ink); } }
/* night lighting toggle: same pill, lit when on */
.v3d-night {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 8px 14px 8px 12px;
  border: 0; border-radius: 999px; cursor: pointer; color: var(--on-dark); background: #16221b;
  font: 600 14px/1 var(--font-body);
  box-shadow: inset 0 0 0 1px rgba(233, 242, 236, 0.14), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  transition: background var(--dur-feedback) ease, color var(--dur-feedback) ease;
}
.v3d-night svg { width: 17px; height: 17px; }
.v3d-night[aria-pressed="true"] { background: #ffe3bd; color: var(--black); box-shadow: 0 0 22px -4px rgba(255, 210, 150, 0.8); }
@media (hover: hover) { .v3d-night[aria-pressed="false"]:hover { background: #22322a; } }
.van-hero.is-night .v3d-stage { background: radial-gradient(120% 95% at 50% 36%, #17231d 0%, #0c1511 55%, #070d0a 100%); }
.v3d-views button:focus-visible, .v3d-close:focus-visible, .v3d-night:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.v3d-hint {
  flex: 1; margin: 0; text-align: right; pointer-events: none;
  color: var(--on-dark-soft); font: 500 14px/1.3 var(--font-body);
  transition: opacity var(--dur-base) ease;
}
.v3d-ui.grabbed .v3d-hint, .v3d-ui[data-view="plan"] .v3d-hint { opacity: 0; }

/* ---------- pins: the six spec lines ---------- */
.v3d-pin {
  position: absolute; left: 0; top: 0; width: 32px; height: 32px; margin: -16px 0 0 -16px;
  display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%;
  background: var(--green); color: var(--black);
  font: 700 14px/1 var(--font-body); font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 3px rgba(247, 246, 241, 0.92), 0 6px 16px -4px rgba(11, 20, 16, 0.6);
  /* no pointer input: drags that start on a pin must reach the model. van3d-boot.js matches a tap
     to the nearest pin (24px, 30px on touch) and lights the one under the mouse (.hover) */
  pointer-events: none; will-change: transform;
  transition: background var(--dur-feedback) ease, color var(--dur-feedback) ease;
}
.v3d-pin[hidden] { display: none; }
.v3d-stage.on-pin .v3d-canvas { cursor: pointer; }
.v3d-pin::before { /* a slow ring so the numbers read as tappable */
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  box-shadow: 0 0 0 2px var(--green); opacity: 0; animation: v3d-ring 2.8s var(--ease-standard) infinite;
}
@keyframes v3d-ring { 0% { transform: scale(1); opacity: 0.7; } 70%, 100% { transform: scale(1.8); opacity: 0; } }
.v3d-pin.on { background: var(--paper); color: var(--ink); }
.v3d-pin.on::before, .v3d-ui.grabbed .v3d-pin::before { animation: none; }
.v3d-pin.hover { background: var(--paper); color: var(--ink); }
.v3d-pin:focus-visible { outline: 2px solid var(--paper); outline-offset: 4px; }

/* floor-plan labels */
.v3d-label {
  position: absolute; left: 0; top: 0; translate: -50% -50%; white-space: nowrap;
  padding: 4px 9px; border-radius: 999px; background: rgba(247, 246, 241, 0.9); color: var(--ink);
  font: 600 12.5px/1.2 var(--font-body); box-shadow: 0 4px 12px -6px rgba(11, 20, 16, 0.5);
  opacity: 0; transition: opacity var(--dur-base) ease; will-change: transform;
}
.v3d-ui[data-view="plan"] .v3d-label { opacity: 1; }

/* ---------- pin card ---------- */
.v3d-card {
  position: absolute; top: 76px; left: var(--pad); width: min(330px, calc(100% - 32px));
  border-radius: 16px; overflow: hidden; background: var(--paper); color: var(--ink);
  box-shadow: 0 2px 2px rgba(11, 20, 16, 0.16), 0 24px 50px -20px rgba(0, 0, 0, 0.7);
  animation: v3d-card-in var(--dur-base) var(--ease-standard);
}
.v3d-card[hidden] { display: none; }
@keyframes v3d-card-in { from { opacity: 0; transform: translateY(8px); } }
.v3d-card img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.v3d-card-body { padding: 14px 18px 18px; }
.v3d-card h3 {
  display: flex; align-items: center; gap: 10px; margin: 0 0 6px;
  font: 600 20px/1.15 var(--font-display); letter-spacing: -0.01em; color: var(--green-deep);
  text-wrap: balance;
}
.v3d-card h3 .n {
  flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--green); color: var(--black); font: 700 12.5px/1 var(--font-body); font-variant-numeric: tabular-nums;
}
.v3d-card p { margin: 0; font: 400 15.5px/1.5 var(--font-body); color: var(--ink-soft); text-wrap: pretty; }
.v3d-card-x {
  position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; display: grid; place-items: center;
  padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(247, 246, 241, 0.92); color: var(--ink); box-shadow: 0 2px 8px rgba(11, 20, 16, 0.25);
}
.v3d-card-x svg { width: 16px; height: 16px; }
.v3d-card-x:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- phones ---------- */
@media (max-width: 620px) {
  /* the model stands centred at the top of the photo, above the section title */
  .v3d-open { left: 50%; right: auto; top: 16px; bottom: auto; width: min(88vw, 400px); translate: -50% 0; }
  .v3d-open-row { gap: 8px; }
  .v3d-open-cta { padding: 10px 13px 10px 11px; font-size: 14.5px; gap: 7px; }
  .v3d-open-cta svg { width: 18px; height: 18px; }
  .v3d-open-hint { padding: 9px 11px 9px 9px; font-size: 13px; }
  .v3d-night { padding: 8px 10px; min-width: 44px; min-height: 44px; justify-content: center; }
  .v3d-night span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .van-hero.is-3d { height: 76vh; }
  .v3d-bar { top: 12px; left: 12px; right: 12px; gap: 8px; }
  .v3d-views { gap: 2px; padding: 3px; }
  .v3d-views button { padding: 8px 11px; font-size: 13px; min-height: 38px; }
  .v3d-close { padding: 8px 10px; min-height: 44px; min-width: 44px; justify-content: center; }
  .v3d-close span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .v3d-hint { position: absolute; left: 4px; top: 54px; flex: none; text-align: left; font-size: 13px; }
  .v3d-pin { width: 30px; height: 30px; margin: -15px 0 0 -15px; font-size: 13px; }
  /* compact card: photo left, words right */
  .v3d-card { top: 62px; left: 12px; right: 12px; width: auto; display: grid; grid-template-columns: 1fr; }
  .v3d-card.has-photo { grid-template-columns: 96px 1fr; }
  .v3d-card img { height: 100%; aspect-ratio: auto; min-height: 96px; }
  .v3d-card-body { padding: 12px 44px 12px 14px; }
  .v3d-card h3 { font-size: 17px; }
  .v3d-card p { font-size: 14px; line-height: 1.45; }
  .v3d-card-x { top: 8px; right: 8px; width: 30px; height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .v3d-pin::before { animation: none; }
  .v3d-stage, .van-hero img, .v3d-ui, .v3d-card, .van-hero.is-3d, .v3d-open, .v3d-open-cta::before { transition: none; animation: none; }
  .van-hero.is-3d-in .v3d-open { transform: none; }
}
