/* vault.css - Buda Capone Maison: 3D Private Jeweler's Vault Showcase (Round 2).
   Dedicated #vault-chapter explosion stage, zero occlusion over THE TURN, post-chapter side/top idle framing,
   zero heavy full-screen backdrop-filter over WebGL (55+ fps target), phone-first (<14,000 px total). */

:root {
  --vault-bg: #0b0908;
  --vault-glass: rgba(14, 11, 9, 0.86);
  --vault-glass-strong: rgba(12, 10, 8, 0.90);
  --vault-border: rgba(201, 164, 76, 0.30);
  --vault-border-soft: rgba(201, 164, 76, 0.18);
  --muted: #c8c0b6; /* crisp >= 7:1 contrast over darker vault glass */
}

html, body {
  background: var(--vault-bg);
  overflow-x: clip;
}

/* Fixed full-viewport 3D Vault stage behind the entire page */
#vault-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: radial-gradient(95% 80% at 50% 44%, #1a1511 0%, #0e0b09 56%, #080605 100%);
}

#vault-stage .vault-still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  opacity: 1;
  transition: opacity 0.85s var(--ease);
}

#vault-stage .vault-gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 0.85s var(--ease);
}

html.vault-live #vault-stage .vault-gl { opacity: 1; }
html.vault-live #vault-stage .vault-still { opacity: 0; }
html.vault-still #vault-stage .vault-still { opacity: 1; }

/* Soft theatre edge vignette — deepens room perimeter while leaving center watch untouched */
#vault-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 68% 72% at 50% 46%, rgba(8, 6, 5, 0) 44%, rgba(6, 5, 4, 0.74) 100%);
}

/* Keep chrome & scrollable content cleanly above the 3D stage */
header.top, main#main, footer {
  position: relative;
  z-index: 2;
}

header.top {
  /* Zero backdrop-filter over WebGL canvas: avoids full-screen GPU readback stalls while staying crisp */
  background: rgba(16, 13, 10, 0.92);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid var(--vault-border-soft);
}

/* Touch-friendly minimum target sizing on phones */
.menu, .btn, .drawer a, form.join input[type=email] {
  min-height: 44px;
}

/* HERO: exact Round 1 hero look (preserved) */
.hero.vault-hero {
  position: relative;
  min-height: calc(100svh - 64px);
  display: grid;
  align-items: end;
  padding: 0;
  overflow: visible;
}

.hero.vault-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(16, 13, 10, 0) 38%, rgba(16, 13, 10, 0.56) 66%, rgba(16, 13, 10, 0.86) 100%);
}

.hero.vault-hero .copy {
  position: relative;
  z-index: 2;
  padding: 24px 18px 46px;
  max-width: var(--wrap);
  margin: 0 auto;
  width: 100%;
}

.hero.vault-hero .hero-inner {
  max-width: 520px;
}

.hero.vault-hero h1 {
  text-shadow: 0 4px 28px rgba(0, 0, 0, 0.55);
}

.hero.vault-hero p {
  color: #f0eadc;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
}

.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  font: 600 0.68rem/1 var(--sans);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold2);
  opacity: 0.9;
}

.scroll-cue::before {
  content: "";
  width: 24px;
  height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
}

@media (min-width: 960px) {
  .hero.vault-hero {
    align-items: center;
  }
  .hero.vault-hero::after {
    background: linear-gradient(90deg, rgba(16, 13, 10, 0.78) 0%, rgba(16, 13, 10, 0.44) 38%, rgba(16, 13, 10, 0) 64%);
  }
  .hero.vault-hero .copy {
    padding: 40px 24px 64px;
  }
}

/* Compact Founders strip sitting cleanly above #vault-chapter */
.founders-strip {
  border-top: none;
  border-bottom: none;
  background: none;
  padding: 28px 0 40px;
}

.founders-strip .vault-panel {
  background: linear-gradient(155deg, rgba(28, 22, 15, 0.88), rgba(16, 13, 10, 0.88));
  border-color: rgba(201, 164, 76, 0.34);
}

/* DEDICATED 282-PART EXPLOSION CHAPTER (#vault-chapter) */
/* Phone: ~550svh (~4,642 px -> total phone page < 13,500 px); Desktop: ~700svh (6,300 px = 7 viewports) */
#vault-chapter {
  position: relative;
  height: 550svh;
  padding: 0;
  pointer-events: none;
}

@media (min-width: 900px) {
  #vault-chapter {
    height: 700svh;
  }
}

#vault-chapter .chapter-sticky {
  position: sticky;
  top: 0;
  height: 100svh;
  width: 100%;
  overflow: hidden;
  pointer-events: none;
}

/* Short chapter caption tags:
   - Phone: <= 80% width, anchored in lower 22% above HUD, max 2 short lines, completely below lifted watch.
   - Desktop: <= 36% width (300px = 21%), anchored bottom-left edge completely outside watchRect.
   - Hidden completely during THE TURN (0.66..0.88) so only sculpture + slim HUD appear! */
.chapter-cap {
  position: absolute;
  left: 50%;
  bottom: 92px;
  transform: translate(-50%, 8px);
  width: min(78vw, 304px);
  padding: 9px 13px;
  background: rgba(16, 13, 10, 0.86);
  border: 1px solid var(--vault-border);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), visibility 0.35s;
}

.chapter-cap.on {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.chapter-cap .eyebrow {
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  margin-bottom: 4px;
}

.chapter-cap p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.35;
  color: #ede6d7;
}

@media (min-width: 900px) {
  .chapter-cap {
    left: 24px;
    bottom: 84px;
    width: auto;
    max-width: min(34vw, 320px);
    transform: translateY(8px);
    padding: 10px 15px;
  }
  .chapter-cap.on {
    transform: translateY(0);
  }
  .chapter-cap p {
    font-size: 0.86rem;
  }
}

/* POST-CHAPTER LIVE SECTIONS (glassy over the idling assembled watch!) */
.vault-section {
  padding: 40px 0;
}

@media (min-width: 960px) {
  .vault-section {
    padding: 56px 0;
  }
}

.vault-panel {
  background: var(--vault-glass);
  border: 1px solid var(--vault-border);
  padding: 24px 18px;
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.42);
}

@media (min-width: 760px) {
  .vault-panel {
    padding: 34px 34px;
  }
  .vault-panel.narrow {
    max-width: 540px;
  }
}

/* Desktop post-chapter framing: keep panels left-biased (~60%) so the ticking watch on the right 40% stays clearly visible! */
@media (min-width: 1020px) {
  .post-left {
    max-width: 61%;
  }
  .post-grid.grid.three {
    grid-template-columns: repeat(2, 1fr);
    max-width: 61%;
  }
}

/* Compact card media on phone so total phone height stays comfortably under 14,000 px */
@media (max-width: 619px) {
  .post-section {
    padding: 32px 0;
  }
  .card .media {
    aspect-ratio: 1 / 1;
  }
  .card .body {
    padding: 14px 15px 16px;
  }
}

.card {
  background: var(--vault-glass-strong);
  border-color: var(--vault-border-soft);
}

.card:hover {
  border-color: var(--gold);
}

.card .body {
  background: rgba(15, 12, 9, 0.72);
}

.rule {
  border-top-color: rgba(201, 164, 76, 0.16);
}

footer {
  background: rgba(14, 11, 9, 0.92);
  border-top: 1px solid var(--vault-border-soft);
  padding: 42px 0 56px;
}

form.join input[type=email] {
  background: rgba(12, 10, 8, 0.76);
  border-color: var(--vault-border);
}

/* Restrained Horological Readout Bar — ONLY visible inside #vault-chapter, hides once chapter ends! */
#vault-hud {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 18;
  max-width: 620px;
  margin: 0 auto;
  padding: 9px 14px 8px;
  background: rgba(16, 13, 10, 0.90);
  border: 1px solid var(--vault-border);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), visibility 0.35s, border-color 0.35s var(--ease);
}

#vault-hud.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
}

#vault-hud.is-turn {
  border-color: var(--gold2);
  background: rgba(20, 16, 11, 0.92);
}

#vault-hud .vh-progress {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: rgba(201, 164, 76, 0.16);
  overflow: hidden;
}

#vault-hud #vh-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #8e6c2a, #e6c470);
  transform-origin: left center;
  transform: scaleX(0);
}

#vault-hud .vh-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

#vault-hud .vh-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

#vault-hud #vh-count {
  font: 600 0.75rem/1 var(--sans);
  letter-spacing: 0.16em;
  color: var(--gold2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#vault-hud #vh-kicker {
  font: 600 0.62rem/1.1 var(--sans);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #cfc6b5;
}

#vault-hud #vh-title {
  font: 500 0.96rem/1.12 var(--serif);
  color: var(--text);
}

#vault-hud #vh-part {
  margin-top: 3px;
  font: 400 0.73rem/1.3 var(--sans);
  color: #c7bfb0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 560px) {
  #vault-hud {
    left: 10px;
    right: 10px;
    padding: 8px 11px 7px;
  }
  #vault-hud #vh-kicker {
    display: none;
  }
  #vault-hud #vh-title {
    font-size: 0.88rem;
  }
  #vault-hud #vh-part {
    font-size: 0.70rem;
  }
}

/* Still / reduced-motion mode: collapse the 3D explosion chapter cleanly */
html.vault-still #vault-chapter {
  display: none !important;
}
html.vault-still .scroll-cue,
html.vault-still #vault-hud {
  display: none !important;
}

/* Clean capture mode (?clean=1) */
html.vault-clean header.top,
html.vault-clean main#main,
html.vault-clean footer,
html.vault-clean #vault-hud {
  display: none !important;
}
