/* ============================================================
   THE HOUSE THAT STAYED — cinematic scroll story
   Original story & build: AHMED/studio
   Type: Cormorant Garamond (title cards) · Archivo (UI) · JetBrains Mono (years)
   The scene carries the color; the DOM stays near-invisible.
   ============================================================ */

:root {
  --black: #0a0908;
  --cream: #efe9dd;
  --cream-dim: rgba(239, 233, 221, 0.72);
  --blueprint: #9fc4e8;
  --font-card: "Cormorant Garamond", serif;
  --font-ui: "Archivo", sans-serif;
  --font-year: "JetBrains Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  background: var(--black);
  color: var(--cream);
  font-family: var(--font-ui);
  overflow-x: hidden;
}

/* ---------- cold open ---------- */

.open {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--black);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  padding: 1.5rem;
}

.open__line {
  font-family: var(--font-card);
  font-weight: 400;
  font-size: clamp(1.1rem, 2.6vw, 1.6rem);
  letter-spacing: 0.04em;
  color: var(--cream-dim);
  opacity: 0;
  text-align: center;
}

.open__blueprint {
  width: min(80vw, 640px);
  color: var(--blueprint);
  opacity: 0.9;
}

#bpPath, .bp-detail { visibility: hidden; }

.open__hint {
  position: absolute;
  bottom: 2.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.68rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--cream-dim);
  opacity: 0;
}

.open__hint-line {
  width: 1px;
  height: 2.6rem;
  background: linear-gradient(180deg, var(--cream-dim), transparent);
}

/* ---------- the film stage ---------- */

.film {
  position: relative;
  height: 100svh;
}

.film__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* paint grain — one subtle texture over the whole frame unifies the
   painterly look and kills the flat-render feel */
.film::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0.35 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)'/%3E%3C/svg%3E");
}

.year {
  position: absolute;
  top: 1.4rem;
  right: 1.6rem;
  z-index: 5;
  font-family: var(--font-year);
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  color: var(--cream-dim);
  opacity: 0;
}

/* ---------- title cards ---------- */

.cards { position: absolute; inset: 0; z-index: 4; pointer-events: none; }

.card {
  position: absolute;
  left: 50%;
  bottom: 14vh;
  transform: translateX(-50%);
  width: min(88vw, 34rem);
  text-align: center;
  font-family: var(--font-card);
  font-weight: 400;
  font-size: clamp(1.25rem, 3vw, 1.9rem);
  line-height: 1.35;
  letter-spacing: 0.03em;
  color: var(--cream);
  text-shadow: 0 2px 24px rgba(10, 9, 8, 0.85);
  opacity: 0;
}

.card--turn {
  bottom: auto;
  top: 26%;
  transform: translate(-50%, -50%);
  font-size: clamp(1.35rem, 3.4vw, 2.1rem);
  color: #ded9cf;
}

/* ---------- finale ---------- */

.finale {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%);
  width: min(90vw, 40rem);
  text-align: center;
  opacity: 0;
  pointer-events: none;
}

.finale__l1, .finale__l2 {
  font-family: var(--font-card);
  font-weight: 500;
  font-size: clamp(1.7rem, 4.6vw, 3rem);
  line-height: 1.25;
  opacity: 0;
}

.finale__l2 { font-style: italic; margin-top: 0.35rem; }

.finale__cta {
  display: inline-block;
  margin-top: 2.2rem;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--black);
  background: var(--cream);
  padding: 1rem 2.4rem;
  border-radius: 2px;
  opacity: 0;
  pointer-events: auto;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.finale__cta:hover, .finale__cta:focus-visible {
  background: #fff;
  transform: translateY(-2px);
}

.finale__cta:focus-visible { outline: 2px solid var(--cream); outline-offset: 4px; }

/* ---------- credits ---------- */

.credits {
  position: relative;
  z-index: 2;
  background: var(--black);
  border-top: 1px solid rgba(239, 233, 221, 0.12);
  text-align: center;
  padding: 2.4rem 1.4rem;
  font-size: 0.82rem;
  color: var(--cream-dim);
}

.credits p + p { margin-top: 0.5rem; }
.credits a { color: var(--cream); }

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .open { display: none; }
  .card, .year, .finale, .finale__l1, .finale__l2, .finale__cta { opacity: 1 !important; }
  .card { position: static; transform: none; margin: 1rem auto; }
  .cards { position: relative; padding: 4rem 0; pointer-events: auto; }
}
