/* ============================================================
   RoofVitals intro film overlay
   Loaded only on the homepage. Plays automatically (muted) on
   load; the gold button restarts the film with sound; every run
   ends with the same transition into the website.
   ============================================================ */

#rv-intro {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #05070B;
  overflow: hidden;
  font-family: 'Barlow', sans-serif;
  /* CSS-only failsafe: if the JS engine never runs, the overlay
     retires itself so the site is never trapped behind it. */
  animation: rvi-failsafe 0.8s ease 90s forwards;
}
@keyframes rvi-failsafe { to { opacity: 0; visibility: hidden; } }

#rv-intro video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #05070B;
  transition: filter 0.9s ease;
}

/* legibility gradients */
.rvi-shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(5,7,11,0.55) 0%, rgba(5,7,11,0) 22%),
    linear-gradient(0deg, rgba(5,7,11,0.72) 0%, rgba(5,7,11,0.25) 26%, rgba(5,7,11,0) 48%);
}

/* ---------- HUD ---------- */
.rvi-brand {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  left: 24px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 1px 10px rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.8s ease 0.3s;
}
.rvi-brand span { color: var(--gold2, #F0A030); }
.rv-live .rvi-brand { opacity: 0.95; }

.rvi-skip {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: 20px;
  background: rgba(13,17,23,0.35);
  border: 1px solid rgba(255,255,255,0.28);
  color: rgba(255,255,255,0.85);
  font-family: 'Barlow', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.rvi-skip:hover, .rvi-skip:focus-visible { background: rgba(255,255,255,0.14); color: #fff; border-color: rgba(255,255,255,0.55); }

.rvi-mute {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: 148px;
  display: none;
  align-items: center;
  gap: 7px;
  background: rgba(13,17,23,0.35);
  border: 1px solid rgba(255,255,255,0.28);
  color: rgba(255,255,255,0.85);
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.rvi-mute:hover, .rvi-mute:focus-visible { background: rgba(255,255,255,0.14); color:#fff; }
.rv-sound-on .rvi-mute { display: inline-flex; }

/* ---------- The sound button (deliberately unmissable) ---------- */
.rvi-sound {
  position: absolute;
  left: 50%;
  bottom: calc(max(64px, 9vh) + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--gold, #D4821A), var(--gold2, #F0A030));
  color: #0D1117;
  border: none;
  border-radius: 999px;
  padding: 17px 34px;
  min-height: 56px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(240,160,48,0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.4s ease;
  animation: rvi-pulse 2.2s ease-out infinite;
  white-space: nowrap;
}
.rvi-sound:hover, .rvi-sound:focus-visible { transform: translateX(-50%) scale(1.05); box-shadow: 0 10px 38px rgba(240,160,48,0.5); }
.rvi-sound .rvi-play-ico {
  width: 0; height: 0;
  border-left: 13px solid #0D1117;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}
@keyframes rvi-pulse {
  0%   { outline: 0 solid rgba(240,160,48,0.55); }
  70%  { outline: 16px solid rgba(240,160,48,0); }
  100% { outline: 16px solid rgba(240,160,48,0); }
}
.rv-sound-on .rvi-sound { opacity: 0; pointer-events: none; animation: none; }

/* ---------- Caption cues ---------- */
.rvi-cues { position: absolute; inset: 0; pointer-events: none; }
.rvi-cue {
  position: absolute;
  left: clamp(20px, 8vw, 120px);
  right: clamp(20px, 8vw, 120px);
  bottom: 22vh;
  max-width: 780px;
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s cubic-bezier(0.2,0.7,0.2,1), transform 0.55s cubic-bezier(0.2,0.7,0.2,1);
}
.rvi-cue.on { opacity: 1; transform: translateY(0); }
.rvi-cue.off { opacity: 0; transform: translateY(-10px); transition-duration: 0.35s; }
.rvi-cue .k {
  display: block;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: clamp(12px, 1.4vw, 15px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold2, #F0A030);
  margin-bottom: 10px;
  text-shadow: 0 1px 8px rgba(0,0,0,0.6);
}
.rvi-cue .l {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: clamp(30px, 4.6vw, 58px);
  line-height: 1.04;
  letter-spacing: -0.01em;
  color: rgba(255,255,255,0.96);
  text-shadow: 0 2px 22px rgba(0,0,0,0.65), 0 1px 4px rgba(0,0,0,0.7);
}
.rvi-cue .l em { font-style: normal; color: var(--gold2, #F0A030); }

/* ---------- End card ---------- */
.rvi-endcard {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 0 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}
.rv-endcard-on .rvi-endcard { opacity: 1; }
.rv-endcard-on video { filter: brightness(0.5) saturate(0.85) blur(3px); }
.rvi-endcard .ec-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: clamp(52px, 9vw, 110px);
  line-height: 0.95;
  letter-spacing: 0.01em;
  color: #fff;
  text-shadow: 0 4px 40px rgba(0,0,0,0.6);
  transform: scale(0.94);
  transition: transform 1.1s cubic-bezier(0.16,0.8,0.24,1);
}
.rv-endcard-on .ec-name { transform: scale(1); }
.rvi-endcard .ec-name span { color: var(--gold2, #F0A030); }
.rvi-endcard .ec-rule {
  width: 0; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--gold, #D4821A), var(--gold2, #F0A030));
  margin: 22px 0 18px;
  transition: width 1s cubic-bezier(0.2,0.7,0.2,1) 0.25s;
}
.rv-endcard-on .ec-rule { width: min(340px, 52vw); }
.rvi-endcard .ec-tag {
  font-family: 'Barlow', sans-serif;
  font-weight: 400;
  font-size: clamp(17px, 2.4vw, 25px);
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.02em;
}

/* ---------- Progress hairline ---------- */
.rvi-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(255,255,255,0.14);
}
.rvi-progress span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--gold, #D4821A), var(--gold2, #F0A030));
}

/* ---------- Leaving transition into the website ---------- */
#rv-intro.rv-leaving {
  transition: opacity 0.95s cubic-bezier(0.5,0,0.3,1), transform 0.95s cubic-bezier(0.5,0,0.3,1), filter 0.95s ease;
  opacity: 0;
  transform: scale(1.14);
  filter: blur(16px);
  pointer-events: none;
  animation: none;
}
#rv-intro.rv-gone { display: none; }

/* page-side: hero + header rise in as the film lifts */
body.rv-hero-in header { animation: rvi-site-in 0.8s cubic-bezier(0.2,0.7,0.2,1) both; }
body.rv-hero-in .hero > * { animation: rvi-site-rise 0.9s cubic-bezier(0.2,0.7,0.2,1) both; }
body.rv-hero-in .hero > *:nth-child(1) { animation-delay: 0.10s; }
body.rv-hero-in .hero > *:nth-child(2) { animation-delay: 0.20s; }
body.rv-hero-in .hero > *:nth-child(3) { animation-delay: 0.30s; }
body.rv-hero-in .hero > *:nth-child(4) { animation-delay: 0.40s; }
body.rv-hero-in .hero > *:nth-child(5) { animation-delay: 0.48s; }
body.rv-hero-in .hero > *:nth-child(6) { animation-delay: 0.55s; }
@keyframes rvi-site-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes rvi-site-rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }

/* while the intro is live, the page behind does not scroll */
html.rv-lock, html.rv-lock body { overflow: hidden; }

/* ---------- Replay affordance on the page ---------- */
.hero-replay { margin-top: 22px; }
.btn-replay {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(240,160,48,0.08);
  border: 1px solid rgba(240,160,48,0.45);
  color: var(--gold2, #F0A030);
  border-radius: 999px;
  padding: 11px 22px;
  min-height: 46px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.btn-replay:hover, .btn-replay:focus-visible { background: rgba(240,160,48,0.16); border-color: var(--gold2, #F0A030); transform: scale(1.03); }
.btn-replay .rvi-play-ico {
  width: 0; height: 0;
  border-left: 10px solid currentColor;
  border-top: 6.5px solid transparent;
  border-bottom: 6.5px solid transparent;
}
.btn-replay-foot {
  background: none; border: none; padding: 0;
  color: rgba(255,255,255,0.82);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.btn-replay-foot:hover, .btn-replay-foot:focus-visible { color: var(--gold2, #F0A030); }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .rvi-brand { left: 16px; font-size: 20px; }
  .rvi-cue { left: 20px; right: 20px; bottom: 24vh; }
  .rvi-cue .l { font-size: clamp(28px, 8.6vw, 40px); }
  .rvi-sound { font-size: 17px; padding: 15px 26px; bottom: calc(max(56px, 8vh) + env(safe-area-inset-bottom)); }
  .rvi-skip { right: 12px; padding: 9px 13px; font-size: 13px; }
  .rvi-mute { right: 118px; padding: 9px 11px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  #rv-intro { animation: rvi-failsafe 0.8s ease 90s forwards; }
  .rvi-sound { animation: none; }
  .rvi-cue, .rvi-cue.off { transition: opacity 0.3s ease; transform: none; }
  #rv-intro.rv-leaving { transition: opacity 0.4s ease; transform: none; filter: none; }
  .rvi-endcard .ec-name, .rvi-endcard .ec-rule { transition: opacity 0.4s ease; transform: none; }
  body.rv-hero-in header, body.rv-hero-in .hero > * { animation: none; }
}
