/* ===========================================================
   RoofWrap Experience, one continuous scroll-driven scene
   =========================================================== */

:root{
  --orange: #f26b3a;
  --orange-deep: #d9502a;
  --ink: #0b0e12;
  --f-head: "Bricolage Grotesque", "Archivo", system-ui, sans-serif;
  --f-body: "Inter", system-ui, sans-serif;
}

*{ box-sizing: border-box; }
.sr-only{
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
html{ -webkit-text-size-adjust: 100%; }
body{
  margin: 0;
  background: var(--ink);
  color: #fff;
  font-family: var(--f-body);
  overflow-x: hidden;
}
a{ color: inherit; text-decoration: none; }

#scroll-space{ width: 1px; height: 1300vh; }

/* ---------- Scene layers ---------- */
#scene{
  position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh;
  display: block; z-index: 1;
}

.photo{
  position: fixed; inset: 0; z-index: 2;
  opacity: 0; pointer-events: none;
  overflow: hidden;
}
.photo img{
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform-origin: 50% 45%;
}

.vignette{
  position: fixed; inset: 0; z-index: 5; pointer-events: none;
  background: radial-gradient(ellipse 118% 96% at 50% 42%, transparent 58%, rgba(4,6,9,.42) 100%);
}
.grain{
  position: fixed; inset: -60px; z-index: 6; pointer-events: none;
  opacity: .085; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 1.1s steps(3) infinite;
}
@keyframes grain-shift{
  0%{ transform: translate(0,0); }
  33%{ transform: translate(-24px,14px); }
  66%{ transform: translate(18px,-20px); }
  100%{ transform: translate(0,0); }
}

/* ---------- Captions ---------- */
#captions{ position: fixed; inset: 0; z-index: 8; pointer-events: none; }
.cap{
  position: absolute; left: 50%; bottom: 14vh;
  transform: translateX(-50%) translateY(24px);
  margin: 0; padding: 0 24px;
  width: 100%; max-width: 1100px; text-align: center;
  font-family: var(--f-head); font-weight: 700;
  font-size: clamp(1.9rem, 4.6vw, 3.9rem);
  line-height: 1.06; letter-spacing: -0.015em;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0,0,0,.55), 0 1px 4px rgba(0,0,0,.5);
  opacity: 0; filter: blur(6px);
  will-change: opacity, transform, filter;
}
.cap--center{ bottom: auto; top: 50%; transform: translate(-50%,-46%); }
.cap--act{
  font-weight: 800; font-size: clamp(2.4rem, 6vw, 5.2rem);
  color: #fff;
}
.cap--act::after{
  content: ""; display: block; width: 64px; height: 4px; border-radius: 2px;
  background: var(--orange); margin: 20px auto 0;
}

/* ---------- Finale ---------- */
.finale{
  position: fixed; inset: 0; z-index: 9;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; padding: 24px; text-align: center;
  opacity: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(6,9,13,.18) 0%, rgba(6,9,13,.55) 100%);
}
.finale.is-live{ pointer-events: auto; }
.finale__logo{ width: min(420px, 74vw); height: auto; filter: drop-shadow(0 4px 24px rgba(0,0,0,.5)); }
.finale__tag{
  margin: 0; font-family: var(--f-head); font-weight: 600;
  font-size: clamp(1.15rem, 2.4vw, 1.7rem); line-height: 1.3;
  color: rgba(255,255,255,.94); text-shadow: 0 2px 14px rgba(0,0,0,.6);
}
.finale__ctas{ display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.btn{
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--f-head); font-weight: 700; font-size: 1rem;
  padding: .95em 1.7em; border-radius: 999px; border: 1.5px solid transparent;
  cursor: pointer; transition: transform .15s ease, background .2s ease, border-color .2s ease;
  white-space: nowrap;
}
.btn:hover{ transform: translateY(-2px); }
.btn--orange{ background: var(--orange); color: #fff; box-shadow: 0 14px 34px -12px rgba(242,107,58,.6); }
.btn--orange:hover{ background: var(--orange-deep); }
.btn--ghost{ background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.45); color: #fff; backdrop-filter: blur(6px); }
.btn--ghost:hover{ background: rgba(255,255,255,.18); }
.finale__note{
  margin: 6px 0 0; font-size: .92rem; color: rgba(255,255,255,.72);
  text-shadow: 0 1px 8px rgba(0,0,0,.6); max-width: 520px;
}
.finale__replay{
  background: none; border: 0; cursor: pointer;
  font-family: var(--f-body); font-size: .85rem; font-weight: 500;
  color: rgba(255,255,255,.55); text-decoration: underline; text-underline-offset: 4px;
}
.finale__replay:hover{ color: #fff; }

/* ---------- HUD ---------- */
.hud{
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(18px, 4vw, 40px);
  pointer-events: none;
}
.hud a{ pointer-events: auto; }
.hud__logo svg{ display: block; filter: drop-shadow(0 2px 10px rgba(0,0,0,.55)); }
.hud__exit{
  font-family: var(--f-head); font-weight: 700; font-size: .88rem;
  color: rgba(255,255,255,.85); padding: .55em 1.1em; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.35); backdrop-filter: blur(8px);
  background: rgba(10,14,18,.25); transition: background .2s ease;
}
.hud__exit:hover{ background: rgba(10,14,18,.55); }

.scrollhint{
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 10; display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-family: var(--f-head); font-weight: 600; font-size: .8rem;
  letter-spacing: .18em; text-transform: uppercase; color: rgba(255,255,255,.85);
  text-shadow: 0 1px 8px rgba(0,0,0,.6);
  transition: opacity .5s ease; pointer-events: none;
}
.scrollhint__line{
  width: 2px; height: 44px; border-radius: 1px; overflow: hidden;
  background: rgba(255,255,255,.22); position: relative;
}
.scrollhint__line::after{
  content: ""; position: absolute; left: 0; top: -50%;
  width: 100%; height: 50%; background: var(--orange);
  animation: hint-drop 1.6s cubic-bezier(.6,.05,.35,1) infinite;
}
@keyframes hint-drop{ 0%{ top: -50%; } 70%,100%{ top: 105%; } }

.progress{
  position: fixed; top: 0; right: 0; bottom: 0; width: 3px; z-index: 10;
  background: rgba(255,255,255,.07); pointer-events: none;
}
.progress__fill{
  width: 100%; height: 0%;
  background: linear-gradient(180deg, var(--orange), #f2a93b);
}

/* ---------- Loader ---------- */
.loader{
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
  background: var(--ink);
  transition: opacity .7s ease;
}
.loader.is-done{ opacity: 0; pointer-events: none; }
.loader__bar{ width: 150px; height: 2px; background: rgba(255,255,255,.14); border-radius: 1px; overflow: hidden; }
.loader__bar span{
  display: block; height: 100%; width: 40%;
  background: var(--orange); border-radius: 1px;
  animation: load-slide 1.1s ease-in-out infinite;
}
@keyframes load-slide{ 0%{ margin-left: -40%; } 100%{ margin-left: 100%; } }

/* ---------- Fallback story ---------- */
.fallback{ position: relative; z-index: 20; background: var(--ink); }
.fallback__panel{
  min-height: 92vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  padding: 12vh clamp(20px, 6vw, 72px); text-align: center;
}
.fallback__panel img{
  width: min(1080px, 100%); border-radius: 18px; display: block;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.8);
}
.fallback h1, .fallback h2{
  font-family: var(--f-head); font-weight: 800; color: #fff; margin: 12px 0 0;
  font-size: clamp(1.8rem, 4.5vw, 3.2rem); line-height: 1.08; letter-spacing: -.015em;
}
.fallback p{ max-width: 640px; color: rgba(255,255,255,.75); font-size: 1.05rem; line-height: 1.6; margin: 0; }

body.is-fallback #scroll-space,
body.is-fallback #scene,
body.is-fallback .photo,
body.is-fallback #captions,
body.is-fallback .finale,
body.is-fallback .scrollhint,
body.is-fallback .progress{ display: none; }

@media (max-width: 700px){
  #scroll-space{ height: 950vh; }
  .cap{ bottom: 17vh; }
  .hud__exit{ display: none; }
}
