/* The 5D Project — "Threshold" */

:root {
  --night: #0d0e18;
  --night-2: #13141f;
  --night-3: #1a1b2b;
  --line: #2c2c40;
  --ink: #ece7dc;
  --ink-2: #c9c3b6;
  --ink-3: #9d97a8;
  --gold: #e0bd7c;
  --gold-hi: #f3d9a6;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: Karla, system-ui, sans-serif;
  --gutter: clamp(20px, 6vw, 96px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-hi); }
a:focus-visible, .btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
h1, h2 { font-family: var(--serif); font-weight: 400; margin: 0; }
em { font-style: italic; color: var(--gold); }

.skip { position: absolute; left: -999px; top: 8px; background: var(--gold); color: var(--night); padding: 10px 16px; z-index: 100; }
.skip:focus { left: 8px; }

.eyebrow {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 32px;
  border-radius: 999px;
  background: var(--gold); color: #14131c;
  font-weight: 600; font-size: 16px;
  transition: background .3s, transform .3s;
}
.btn:hover { background: var(--gold-hi); color: #14131c; transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid #55546a; }
.btn-ghost:hover { background: transparent; color: var(--gold); border-color: var(--gold); }

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  padding: 22px var(--gutter);
  transition: background .4s, padding .4s;
}
.nav.scrolled { background: rgba(13, 14, 24, 0.82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding-top: 14px; padding-bottom: 14px; }
.wordmark { font-family: var(--serif); font-size: 22px; letter-spacing: 0.18em; color: var(--ink); white-space: nowrap; }
.wordmark:hover { color: var(--gold); }
.nav nav { display: flex; gap: clamp(16px, 2.4vw, 36px); font-size: 15px; letter-spacing: 0.06em; }
.nav nav a { color: var(--ink-2); padding: 10px 0; }
.nav nav a:hover, .nav nav a.active { color: var(--gold); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center;
  padding: 120px var(--gutter) 96px;
  overflow: hidden;
}
.hero-media { position: absolute; inset: 0; z-index: 0; }
.hero-media img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 60%;
  transform: scale(calc(1.08 + var(--hp, 0) * 0.12)) translateY(calc(var(--hp, 0) * 6%));
  animation: drift 24s ease-in-out infinite alternate;
  will-change: transform;
}
.hero-media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(13,14,24,.88) 0%, rgba(13,14,24,.55) 45%, rgba(13,14,24,.15) 100%),
              linear-gradient(0deg, var(--night) 0%, rgba(13,14,24,0) 30%);
}
@keyframes drift { from { translate: 0 0; } to { translate: -1.5% -1%; } }

.rings {
  position: absolute; z-index: 1;
  width: min(1100px, 120vw); height: auto;
  right: -22%; top: 50%;
  color: var(--gold); opacity: .3;
  transform: translateY(-50%) rotate(calc(var(--hp, 0) * 40deg)) scale(calc(1 + var(--hp, 0) * .25));
  pointer-events: none;
}
.rings circle { stroke-opacity: .6; }

.hero-copy { position: relative; z-index: 2; max-width: 880px; display: flex; flex-direction: column; gap: 28px; align-items: flex-start; }
.hero h1 { font-size: clamp(52px, 8.6vw, 124px); line-height: .96; }
.hero h1 .line { display: block; }
.lede { margin: 0; max-width: 620px; font-size: clamp(18px, 1.6vw, 21px); color: var(--ink-2); }

.scroll-cue { position: absolute; left: 50%; bottom: 28px; z-index: 2; width: 1px; height: 64px; background: rgba(236,231,220,.18); overflow: hidden; }
.scroll-cue span { position: absolute; left: 0; top: -40%; width: 1px; height: 40%; background: var(--gold); animation: cue 2.4s ease-in-out infinite; }
@keyframes cue { to { top: 100%; } }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 1.1s ease, transform 1.1s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
.hero .reveal:nth-child(2), .hero h1 .line:nth-child(1) { transition-delay: .1s; }
.hero h1 .line:nth-child(2) { transition-delay: .3s; }
.hero .lede { transition-delay: .5s; }
.hero .btn.reveal { transition-delay: .7s; }

/* ---------- meanings ---------- */
.meanings {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(40px, 7vw, 120px);
  padding: clamp(96px, 12vw, 160px) var(--gutter);
  max-width: 1440px; margin: 0 auto;
}
.meaning { display: flex; flex-direction: column; gap: 18px; }
.meaning h2 { font-size: clamp(40px, 4.6vw, 64px); line-height: 1.02; }
.meaning p:last-child { margin: 0; color: var(--ink-2); font-size: 19px; max-width: 520px; }
.meaning:nth-child(2) { transition-delay: .2s; }

/* ---------- doors (pinned) ---------- */
.doors { position: relative; height: 560vh; }
.doors-stage {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
}
.door {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center;
  gap: clamp(32px, 5vw, 96px);
  padding: 96px var(--gutter) 64px calc(var(--gutter) + 56px);
  opacity: 0; pointer-events: none;
  transition: opacity .9s ease;
}
.door.active { opacity: 1; pointer-events: auto; }
.door-media {
  position: relative; height: min(76vh, 760px);
  border-radius: 999px 999px 18px 18px;
  overflow: hidden;
  background: var(--night-3);
  clip-path: inset(calc((1 - var(--dp, 1)) * 16%) calc((1 - var(--dp, 1)) * 22%) 0 round 999px 999px 18px 18px);
  transition: clip-path .15s linear;
}
.door-media img {
  width: 100%; height: 100%; object-fit: cover;
  transform: scale(calc(1.18 - var(--dp, 1) * .14));
  transition: transform .15s linear;
}
.door-copy { display: flex; flex-direction: column; gap: 22px; max-width: 540px; }
.door-copy > * { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); }
.door.active .door-copy > * { opacity: 1; transform: none; }
.door.active .door-copy > *:nth-child(2) { transition-delay: .12s; }
.door.active .door-copy > *:nth-child(3) { transition-delay: .24s; }
.door.active .door-copy > *:nth-child(4) { transition-delay: .36s; }
.door-num { margin: 0; font-family: var(--serif); font-size: 22px; letter-spacing: .08em; color: var(--gold); }
.door h2 { font-size: clamp(44px, 5.4vw, 80px); line-height: 1; }
.door-copy p { margin: 0; color: var(--ink-2); font-size: clamp(18px, 1.5vw, 20px); }
.door-copy .door-tools { font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.text-link { font-size: 16px; letter-spacing: .04em; align-self: flex-start; padding: 10px 0; }

.door-index {
  position: absolute; z-index: 5; left: var(--gutter); top: 50%; transform: translateY(-50%);
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 18px;
  font-family: var(--serif); font-size: 17px; color: #5d5b70;
}
.door-index li { transition: color .5s, transform .5s; }
.door-index li.on { color: var(--gold); transform: translateX(6px); }

/* ---------- honest ---------- */
.honest { padding: clamp(110px, 14vw, 190px) var(--gutter); border-top: 1px solid var(--line); }
.honest-inner { max-width: 900px; margin: 0 auto; text-align: center; display: flex; flex-direction: column; gap: 24px; align-items: center; }
.honest h2 { font-size: clamp(40px, 5vw, 72px); line-height: 1.02; }
.honest p:last-child { margin: 0; color: var(--ink-2); font-size: clamp(18px, 1.6vw, 21px); max-width: 700px; }

/* ---------- closing ---------- */
.closing {
  position: relative; overflow: hidden;
  margin: 0 var(--gutter);
  padding: clamp(90px, 10vw, 140px) clamp(24px, 6vw, 96px);
  border: 1px solid var(--line); border-radius: 28px;
  background: var(--night-2);
  text-align: center;
}
.closing > div { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.closing h2 { font-size: clamp(38px, 4.6vw, 64px); }
.closing p { margin: 0 0 8px; color: var(--ink-2); }
.rings-small { width: 900px; right: auto; left: 50%; top: 50%; opacity: .18; transform: translate(-50%, -50%) rotate(calc(var(--cp, 0) * 60deg)); }

.foot {
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 48px var(--gutter);
  font-size: 14px; color: var(--ink-3);
}
.foot a { color: var(--ink-3); }
.foot a:hover { color: var(--gold); }
.foot-links { display: flex; gap: 28px; flex-wrap: wrap; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  body { font-size: 17px; }
  .nav { flex-direction: column; align-items: flex-start; gap: 4px; padding-top: 16px; padding-bottom: 12px; }
  .nav nav { gap: 18px; font-size: 14px; }
  .wordmark { font-size: 18px; }
  .hero { padding-top: 150px; }
  .hero-media::after { background: linear-gradient(0deg, var(--night) 0%, rgba(13,14,24,.7) 45%, rgba(13,14,24,.45) 100%); }
  .rings { right: -60%; width: 150vw; }
  .meanings { grid-template-columns: minmax(0, 1fr); }
  .door { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 20px; padding: 124px 20px 64px 20px; align-items: stretch; }
  .door-media { height: auto; min-height: 0; }
  .door h2 { font-size: clamp(36px, 10vw, 48px); }
  .door-copy { gap: 12px; }
  .door-copy p { font-size: 16px; }
  .door-index { flex-direction: row; top: auto; bottom: 14px; left: 50%; transform: translateX(-50%); gap: 16px; }
  .door-index li.on { transform: translateY(-2px); }
  .closing { margin: 0 16px; }
}


/* ---------- no JS: stack the doors ---------- */
.no-js .reveal, .no-js .door-copy > * { opacity: 1; transform: none; }
.no-js .doors { height: auto; }
.no-js .doors-stage { position: static; height: auto; overflow: visible; }
.no-js .door { position: relative; inset: auto; opacity: 1; pointer-events: auto; min-height: 90vh; }
.no-js .door-media { clip-path: none; }
.no-js .door-media img { transform: none; }
.no-js .door-index { display: none; }

/* ---------- reduced motion: no pin, no zoom ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-media img, .scroll-cue span { animation: none; transform: none; }
  .rings { transform: translateY(-50%); }
  .reveal, .door-copy > * { opacity: 1; transform: none; transition: none; }
  .doors { height: auto; }
  .doors-stage { position: static; height: auto; overflow: visible; }
  .door { position: relative; inset: auto; opacity: 1; pointer-events: auto; min-height: 90vh; }
  .door-media { clip-path: none; }
  .door-media img { transform: none; }
  .door-index { display: none; }
}
