:root {
  --m: clamp(20px, 3.4vw, 48px);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: "Montserrat", system-ui, sans-serif;
}

/* Colours from the house itself: anthracite roof steel, crown in brass.
   --outline and --veil are read by app.js to paint the part highlights. */
:root {
  --ground: #1b1b1d;
  --ground-2: #2e2e31;
  --frame-bg: #111112;
  --ink: #ecebe7;
  --muted: #a39f97;
  --accent: #cfaa62;
  --accent-ink: #1b1b1d;
  --button: #cfaa62;
  --logo: #cfaa62;
  --card: #ecebe7;
  --card-ink: #1b1b1d;
  --marker: #ecebe7;
  --outline: 226, 194, 128;
  --veil: 10, 10, 11;
}

* { box-sizing: border-box; margin: 0; }
html { background: var(--ground); color: var(--ink); -webkit-font-smoothing: antialiased; }
body { min-height: 100svh; }
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------------------------------------------------------------- layout */

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  min-height: 100svh;
}

.copy {
  display: flex;
  flex-direction: column;
  padding: 28px var(--m) 28px;
  min-width: 0;
}

.bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
}
/* the crown from the logo, recoloured */
.crown {
  width: 41px;
  height: 30px;
  background: var(--logo);
  -webkit-mask: url("media/crown.png") center / contain no-repeat;
  mask: url("media/crown.png") center / contain no-repeat;
}
.bar nav { display: flex; gap: clamp(16px, 2vw, 32px); }
.bar nav a { font-size: 16px; text-decoration: none; transition: color 0.15s; }
.bar nav a:hover { color: var(--accent); }

.lead { margin: auto 0; padding: 32px 0; }

h1 {
  font-size: clamp(36px, 4.5vw, 72px);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.035em;
  max-width: 11em;
}
.sub {
  margin-top: 32px;
  font-size: clamp(18px, 1.4vw, 20px);
  line-height: 1.5;
  max-width: 38ch;
}

/* build ticker and description share one slot so nothing jumps */
.slot { display: grid; margin-top: 56px; }
.slot > * { grid-area: 1 / 1; }

.track { height: 4px; background: var(--ground-2); max-width: 520px; overflow: hidden; }
.fill { height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }

.stages {
  list-style: none;
  padding: 0;
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(4, max-content);
  gap: 10px 28px;
  font-size: 16px;
}
.stages li { color: color-mix(in srgb, var(--ink) 38%, transparent); transition: color 0.3s; }
.stages li.done { color: var(--ink); }
.stages li.now { color: var(--accent); }

.textbtn {
  background: none;
  border: 0;
  padding: 6px 0;
  font-size: 16px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  cursor: pointer;
  transition: color 0.15s;
}
.textbtn:hover { color: var(--accent); }
.build .textbtn { margin-top: 28px; }

.about h2 {
  font-size: clamp(30px, 2.6vw, 40px);
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1;
}
.about > p:first-of-type { margin-top: 14px; font-size: clamp(18px, 1.4vw, 20px); line-height: 1.5; max-width: 42ch; }

.specs {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 18px 40px;
  margin-top: 28px;
}
.specs dt { font-size: 15px; color: var(--muted); }
.specs dd { font-size: 26px; font-weight: 600; letter-spacing: -0.015em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.specs .price { grid-column: span 2; }
.specs .price dd { color: var(--accent); }
.specs .price span { font-size: 16px; font-weight: 400; letter-spacing: 0; color: var(--ink); }

.actions { display: flex; align-items: center; gap: 28px; margin-top: 32px; flex-wrap: wrap; }
.btn {
  display: inline-block;
  background: var(--button);
  color: var(--accent-ink);
  font-size: 16px;
  font-weight: 600;
  padding: 15px 26px;
  text-decoration: none;
  transition: transform 0.12s var(--ease-out), background-color 0.15s;
}
.btn:hover { background: var(--ink); }
.btn:active { transform: scale(0.97); }

.hint { margin-top: 24px; font-size: 16px; color: var(--muted); }
.hint-touch { display: none; }
@media (hover: none) {
  .hint-hover { display: none; }
  .hint-touch { display: inline; }
}

.note { font-size: 15px; color: var(--muted); }
.bar-cta { display: none; }
.nw { white-space: nowrap; }

/* ---------------------------------------------------------------- the frame */

.frame {
  height: 100svh;
  width: min(calc(100svh * 0.8), 54vw);
  overflow: hidden;
  background: var(--frame-bg);
  position: sticky;
  top: 0;
}
.frame > video,
.frame > .still,
.layers > canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.layers { position: absolute; inset: 0; pointer-events: none; }
.layers > canvas { opacity: 0; transition: opacity 0.22s ease; }
.layers > canvas.on { opacity: 1; }

.still { opacity: 0; transition: opacity 0.35s ease; }
[data-state="built"] .still { opacity: 1; }
[data-state="built"] .frame { cursor: default; }
[data-state="built"] .frame.over { cursor: pointer; }

/* markers: one per part, placed by app.js */
.markers { position: absolute; inset: 0; pointer-events: none; }
.marker {
  position: absolute;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.3s, transform 0.4s var(--ease-out);
}
.marker::before,
.marker::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--marker);
  background-clip: padding-box;
  border: 3px solid rgba(var(--veil), 0.6);
}
.marker::after { inset: 7px; background: none; border: 2px solid var(--marker); opacity: 0; }
[data-state="built"] .marker { opacity: 1; transform: scale(1); transition-delay: calc(var(--i) * 70ms + 350ms); }
/* the load ping repeats every 6 s so the dots keep saying "these are clickable"; still while a card is open */
[data-state="built"] .marker::after { animation: ping 6s var(--ease-out) calc(var(--i) * 70ms + 600ms) infinite; }
[data-state="built"] .frame.over .marker::after { animation: none; }
[data-state="built"] .marker.dim { opacity: 0.35; transition-delay: 0s; }
[data-state="built"] .marker.active { transform: scale(1.25); transition-delay: 0s; }
@keyframes ping {
  0% { opacity: 1; transform: scale(1); }
  23% { opacity: 0; transform: scale(2.6); } /* 1.4 s of the 6 s cycle, as fast as the first one */
  100% { opacity: 0; transform: scale(2.6); }
}

/* the part card: close-up render, name, three spec rows, guarantee strip; ‹ n/6 › steps through the parts */
.card {
  position: absolute;
  z-index: 2;
  width: min(340px, calc(100% - 24px));
  background: var(--card);
  color: var(--card-ink);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.4); /* taste-skill-ignore: floating popover over the photo */
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.25s var(--ease-out);
  pointer-events: none;
  touch-action: pan-y;
}
.card[hidden] { display: block; visibility: hidden; }
.card.show { opacity: 1; transform: none; visibility: visible; pointer-events: auto; }
.card-media { position: relative; aspect-ratio: 2 / 1; overflow: hidden; background: var(--frame-bg); }
.card-img { display: block; width: 100%; height: 100%; object-fit: cover; transition: opacity 0.2s ease; }
.card-img.swap { opacity: 0; }
.card-body { padding: 16px 20px 16px; }
.card-name { font-size: 20px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.15; }
.card-specs {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 5px 16px;
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.35;
}
.card-specs dt { color: color-mix(in srgb, var(--card-ink) 58%, transparent); }
.card-guarantee {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 12px 20px;
  font-size: 15px;
  line-height: 1.3;
}
.card-guarantee strong { font-size: 16px; font-weight: 700; }

/* controls sit on the picture: step through parts, and close once a card is pinned */
.card-nav, .card-close {
  position: absolute;
  display: flex;
  align-items: center;
  background: rgba(var(--veil), 0.78);
  color: #f2f1ee;
}
.card-nav { right: 0; bottom: 0; font-size: 15px; font-variant-numeric: tabular-nums; }
.card-nav button, .card-close {
  border: 0;
  background: none;
  color: inherit;
  width: 40px;
  height: 36px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s;
}
.card-nav button:hover, .card-close:hover { background: rgba(255, 255, 255, 0.14); }
.card-nav button:active, .card-close:active { background: rgba(255, 255, 255, 0.24); }
.card-count { padding: 0 2px; min-width: 40px; text-align: center; }
.card-close { top: 0; right: 0; justify-content: center; display: none; }
.card.pinned .card-close { display: flex; }

/* connector from the part's dot to the card */
.leader { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.leader line { stroke: var(--marker); stroke-width: 2; opacity: 0; transition: opacity 0.18s ease; }
.leader.on line { opacity: 0.9; }

/* ---------------------------------------------------------------- states */

.build, .about { transition: opacity 0.35s ease, visibility 0.35s; }
[data-state="building"] .about { opacity: 0; visibility: hidden; }
[data-state="built"] .build { opacity: 0; visibility: hidden; }

.rise { animation: rise 0.7s var(--ease-out) both; }
.sub.rise { animation-delay: 80ms; }
@keyframes rise { from { opacity: 0; transform: translateY(20px); } }

.about .in { opacity: 0; transform: translateY(18px); }
[data-state="built"] .about .in {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s ease, transform 0.6s var(--ease-out);
}
[data-state="built"] .about .in:nth-child(2) { transition-delay: 70ms; }
[data-state="built"] .about .in:nth-child(3) { transition-delay: 140ms; }
[data-state="built"] .about .in:nth-child(4) { transition-delay: 210ms; }
[data-state="built"] .about .in:nth-child(5) { transition-delay: 280ms; }

/* ---------------------------------------------------------------- phone and narrow tablet */

/* ---------------------------------------------------------------- full-screen layout */

.scrim { display: none; }

@media (min-width: 861px) {
  .full .hero { display: block; position: relative; height: 100svh; min-height: 680px; overflow: hidden; }
  /* the floor is for the copy, which steps aside for the tour; a big phone turned sideways (932 × 430) gets this layout
     and needs the tour and its controls on one screen */
  .full[data-state="touring"] .hero { min-height: 0; }
  .full .frame { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; --card-top: 104px; }
  .full .bar { position: absolute; z-index: 3; top: 0; left: 0; right: 0; padding: 28px var(--m); }
  /* neutral scrims under the text only: across the top for the nav, in from the left for the copy */
  .full .scrim {
    display: block;
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
      linear-gradient(rgba(var(--veil), 0.72), rgba(var(--veil), 0) 150px), /* taste-skill-ignore: neutral scrim under the nav */
      linear-gradient(90deg, rgba(var(--veil), 0.9) 0%, rgba(var(--veil), 0.7) 30%, rgba(var(--veil), 0) 55%); /* taste-skill-ignore: neutral scrim under the copy */
  }
  .full .lead { padding: 8px 0 24px; }
  .full .slot { margin-top: 44px; }
  .full .copy {
    position: absolute;
    z-index: 2;
    inset: 0 auto 0 0;
    width: min(600px, 42vw);
    padding-top: 104px;
  }
}

@media (max-width: 860px) {
  .full .frame { height: 56.25vw; }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .copy { display: contents; }
  .bar { order: 1; padding: 12px var(--m); align-items: center; }
  .bar nav { display: none; }
  .bar-cta { display: inline-block; font-size: 16px; padding: 12px 18px; }
  .frame { order: 2; position: relative; width: 100%; height: min(125vw, 74svh); }
  .lead { order: 3; padding: 32px var(--m) 24px; margin: 0; }
  .note { order: 4; padding: 0 var(--m) 32px; }
  .slot { margin-top: 36px; }
  .stages { grid-template-columns: repeat(2, max-content); }
  .specs { grid-template-columns: repeat(2, max-content); gap: 16px 32px; }
  .specs dd { font-size: 26px; }
  /* phones: the card becomes a sheet along the bottom of the screen, swipe to step through parts */
  .card { position: fixed; left: 0; right: 0; bottom: 0; width: 100%; z-index: 20; transform: translateY(24px); }
  .card.show { transform: none; }
  .card-media { aspect-ratio: 5 / 2; }
  .card-close { display: flex; }
  .leader { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
}

/* ---------------------------------------------------------------- house picker */

/* the unbuild and the pan are drawn on this canvas; the video takes over for the build */
.switch { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; pointer-events: none; }
[data-state="switching"] .switch { opacity: 1; }
[data-state="switching"] .build,
[data-state="switching"] .about { opacity: 0; visibility: hidden; }

/* the house switch under the house: ‹ name  n / 3 ›. It rests faint; picker.js sets --near (0..1)
   as the pointer comes close, so it rises only when wanted */
.house-switch {
  --rest: 0.6;
  position: absolute;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 4px;
  transform: translate(-50%, -50%);
  font-size: 14px;
  color: var(--marker);
  text-shadow: 0 1px 6px rgba(var(--veil), 0.85);
  white-space: nowrap;
  opacity: calc(var(--rest) + (1 - var(--rest)) * var(--near, 0));
  transition: opacity 0.2s ease;
}
.house-switch button {
  width: 32px;
  height: 36px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out);
}
.house-switch svg { display: block; width: 8px; height: 16px; filter: drop-shadow(0 1px 5px rgba(var(--veil), 0.75)); }
.house-switch .hs-name { font-weight: 600; }
.house-switch .hs-count { margin-left: 6px; font-variant-numeric: tabular-nums; opacity: 0.7; }
.house-switch button:active { transform: scale(0.9); }
.house-switch.busy { opacity: 0.12; pointer-events: none; }
@media (hover: hover) and (pointer: fine) {
  .house-switch:hover { opacity: 1; }
  .hs-prev:hover { transform: translateX(-3px); }
  .hs-next:hover { transform: translateX(3px); }
}
/* touch screens have no pointer to come near, so it stays readable */
@media (hover: none) {
  .house-switch { --rest: 0.8; }
}
/* a pinned part card owns the picture */
:root:has(.card.pinned.show) .house-switch { opacity: 0; pointer-events: none; }

/* the tour: a walk through the house that starts from the hero frame. The page steps aside while it plays. */
.tour-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}
[data-state="touring"] .tour-video { opacity: 1; }
.full .copy, .scrim { transition: opacity 0.35s ease; }
[data-state="touring"] .copy,
[data-state="touring"] .scrim,
[data-state="touring"] .house-switch { opacity: 0; pointer-events: none; }

/* the way in to the tour: a frame from inside the house, so it pulls with a picture. It ranks under "Request a quote"
   but well over the house switch, with "— · —" between the two (picker.js places all three under the house) */
.tour-sep {
  position: absolute;
  z-index: 4;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 7px;
  opacity: 0.55;
  pointer-events: none;
  filter: drop-shadow(0 1px 4px rgba(var(--veil), 0.9));
  transition: opacity 0.35s ease;
}
.tour-sep i { width: 12px; height: 1px; background: var(--marker); }
.tour-sep b { width: 3px; height: 3px; border-radius: 50%; background: var(--marker); }

/* picker.js sets --tour-thumb per house */
.tour-thumb {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 76px;
  height: 48px;
  border-radius: 7px;
  background: var(--tour-thumb, url("media/picker/tour-a.jpg")) center / cover;
}
.tour-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(var(--veil), 0.25);
  transition: background-color 0.2s ease;
}
.tour-thumb svg {
  position: relative;
  z-index: 1;
  width: 13px;
  height: 13px;
  color: var(--marker);
  filter: drop-shadow(0 1px 3px rgba(var(--veil), 0.6));
  transition: transform 0.2s var(--ease-out);
}
.tour-txt { display: flex; flex-direction: column; gap: 3px; text-align: left; }
.tour-len { font-weight: 400; opacity: 0.7; font-variant-numeric: tabular-nums; }

.tour-btn {
  position: absolute;
  z-index: 4;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 6px 20px 6px 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 75%, transparent);
  border-radius: 12px;
  background: rgba(var(--veil), 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 24px rgba(var(--veil), 0.35);
  color: var(--marker);
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity 0.35s ease, background-color 0.2s ease, border-color 0.2s ease, transform 0.16s var(--ease-out);
}
.tour-btn .tour-len { font-size: 13px; }
.tour-btn:active { transform: translate(-50%, -50%) scale(0.97); }
:root:not([data-state="built"]) :is(.tour-btn, .tour-sep),
:root:has(.card.pinned.show) :is(.tour-btn, .tour-sep) { opacity: 0; pointer-events: none; }
@media (hover: hover) and (pointer: fine) {
  .tour-btn:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, rgba(var(--veil), 0.55)); }
  .tour-btn:hover .tour-thumb::after { background: transparent; }
  .tour-btn:hover .tour-thumb svg { transform: scale(1.15); }
}

.tour-ui {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  width: min(760px, calc(100% - 32px));
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: end;
  gap: 16px;
  color: var(--marker);
  text-shadow: 0 1px 6px rgba(var(--veil), 0.85);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
[data-state="touring"] .tour-ui { opacity: 1; pointer-events: auto; transition-delay: 0.3s; }
.tour-ui > button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--marker) 40%, transparent);
  border-radius: 50%;
  background: rgba(var(--veil), 0.3);
  color: inherit;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.16s var(--ease-out);
}
.tour-ui > button svg { width: 12px; height: 12px; }
.tour-ui > button:active { transform: scale(0.94); }
.tour-pause .i-play, .tour-paused .tour-pause .i-pause { display: none; }
.tour-paused .tour-pause .i-play { display: inline; }
.tour-chapters { display: flex; justify-content: space-between; gap: 8px; }
.tour-chapters button {
  padding: 4px 0;
  border: 0;
  background: none;
  color: inherit;
  font-size: 13px;
  opacity: 0.6;
  cursor: pointer;
  transition: opacity 0.2s ease, color 0.2s ease;
}
.tour-chapters button.now { opacity: 1; color: var(--accent); }
.tour-track { position: relative; height: 3px; margin: 8px 0 16px; background: color-mix(in srgb, var(--marker) 25%, transparent); cursor: pointer; }
.tour-track::before { content: ""; position: absolute; inset: -10px 0; } /* a taller hit area than the line */
.tour-fill { height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }
.tour-track i { position: absolute; top: -3px; width: 1px; height: 9px; background: color-mix(in srgb, var(--marker) 60%, transparent); }
@media (hover: hover) and (pointer: fine) {
  .tour-chapters button:hover { opacity: 1; }
  .tour-ui > button:hover { background: rgba(var(--veil), 0.6); }
}


