/* Homepage — page-specific styles. Assumes design-system.css is loaded first. */

html { scroll-behavior: smooth; background: var(--night); }
body {
  margin: 0;
  overflow-x: hidden;
  color: var(--cream);
  background: var(--night);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

/* Light field */
.light-field, .light-fallback, #light-canvas { position: fixed; inset: 0; width: 100%; height: 100%; }
.light-field { z-index: 0; overflow: hidden; background: var(--night); }
#light-canvas { display: block; opacity: 0; transition: opacity 1.8s ease; }
.webgl-ready #light-canvas { opacity: 1; }
.light-fallback {
  background:
    radial-gradient(ellipse 70% 55% at 78% 28%, #794334 0%, transparent 70%),
    radial-gradient(ellipse 60% 70% at 24% 78%, #461a1b 0%, transparent 75%),
    linear-gradient(135deg, #2c1718, #65393a);
  transition: background-color 6s ease, opacity 1.8s ease;
}
.webgl-ready .light-fallback { opacity: 0; }

/* Floating logo */
.floating-logo {
  position: fixed;
  z-index: 22;
  display: block;
  overflow: hidden;
  background: currentColor;
  font-size: 0;
  text-decoration: none;
  -webkit-mask: url('/brand/wordmark.png') center / contain no-repeat;
  mask: url('/brand/wordmark.png') center / contain no-repeat;
  color: var(--cream);
  top: max(1.4rem, env(safe-area-inset-top));
  left: clamp(1.5rem, 8vw, 8rem);
  width: 3.5rem;
  height: 2.2rem;
}

.header-logo-spacer { width: 3.5rem; height: 2.2rem; }

/* Header */
.site-header {
  position: fixed;
  z-index: 20;
  inset: 0 0 auto;
  min-height: 4.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(1.25rem, env(safe-area-inset-top)) clamp(1.5rem, 8vw, 8rem) 1rem;
  background: linear-gradient(to bottom, rgba(44, 23, 24, .85) 0%, transparent 100%);
  color: var(--cream);
  transition: color var(--transition-slow), background var(--transition-slow);
}
body[data-visual-theme='light'] .site-header { background: linear-gradient(to bottom, rgba(241, 235, 227, .85) 0%, transparent 100%); }
.site-header nav { display: flex; align-items: center; gap: clamp(.85rem, 2vw, 2.2rem); }
.site-header nav a { font-size: .72rem; font-weight: 600; letter-spacing: .055em; text-transform: uppercase; text-decoration: none; opacity: .68; }
.site-header nav a:hover { opacity: 1; }
.site-header .sign-in { opacity: 1; }
.site-header .enter-link {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  padding: 0 1.2rem;
  border: 1px solid currentColor;
  border-radius: 0;
  opacity: 1;
}

/* Chapter nav */
.chapter-nav {
  position: fixed;
  z-index: 21;
  right: clamp(.65rem, 2vw, 2rem);
  top: 50%;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  transform: translateY(-50%);
  color: var(--cream);
  transition: color var(--transition-slow);
}
.chapter-track { position: absolute; z-index: -1; top: 1.35rem; bottom: 1.35rem; right: 1.35rem; width: 1px; background: currentColor; opacity: .22; }
.chapter-track i { position: absolute; top: 0; left: 0; width: 1px; height: var(--progress); background: currentColor; opacity: 1; transition: height 1.2s var(--ease); }
.chapter-nav button {
  position: relative;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.chapter-nav button::after {
  content: '';
  width: .38rem;
  height: .38rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  transition: transform .8s var(--ease), background .8s ease;
}
.chapter-nav button[aria-current='step']::after { background: currentColor; transform: scale(1.7); }
.chapter-nav button span {
  position: absolute;
  right: 2.35rem;
  width: max-content;
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .05em;
  opacity: 0;
  transform: translateX(.5rem);
  transition: opacity .3s ease, transform .5s var(--ease);
}
.chapter-nav button:hover span, .chapter-nav button:focus-visible span { opacity: .82; transform: none; }

/* Scenes */
main { position: relative; z-index: 1; }
.scene {
  position: relative;
  min-height: 110svh;
  overflow: hidden;
  display: grid;
  align-items: center;
  padding: clamp(7rem, 13vh, 10rem) clamp(1.5rem, 8vw, 8rem) clamp(5rem, 12vh, 8rem);
  isolation: isolate;
}
.prose-scene { min-height: 125svh; }
.scene > * { position: relative; z-index: 2; }
.calm-zone {
  position: absolute;
  z-index: 1;
  width: min(60rem, 78vw);
  height: min(50rem, 85vh);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(31, 11, 13, .8) 0%, rgba(31, 11, 13, .45) 42%, transparent 74%);
  filter: blur(1.5rem);
  pointer-events: none;
}
.calm-zone-left { left: -14vw; top: 15%; }
.calm-zone-centre { left: 50%; top: 50%; transform: translate(-50%, -50%); }

/* Hero */
.arrival-copy { width: min(50rem, 76vw); padding-top: clamp(8rem, 16vh, 13rem); }
.arrival-copy > p:not(.eyebrow) { max-width: 38rem; margin: 1.8rem 0 0; font-size: clamp(1.03rem, 1.45vw, 1.25rem); color: var(--cream); }

.scroll-nudge {
  display: block;
  margin-top: 3rem;
  color: var(--cream);
  opacity: .45;
  text-decoration: none;
  animation: nudge 2.4s ease-in-out infinite;
}
@keyframes nudge {
  0%, 100% { transform: translateY(0); opacity: .45; }
  50% { transform: translateY(6px); opacity: .7; }
}

/* Intermission */
.prose-block { width: min(62rem, 82vw); }
.prose-block-wide h2 { max-width: 57rem; }
.prose-columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.5rem, 4vw, 4rem); margin-top: clamp(3rem, 8vh, 6rem); }
.prose-columns p { margin: 0; font-size: clamp(1rem, 1.25vw, 1.15rem); }
.prose-columns p:first-child { font-family: var(--serif); font-size: clamp(1.3rem, 2vw, 1.8rem); line-height: 1.35; }

/* Distance */
.scene-distance { color: var(--cream); min-height: 150svh; }
.distance-title { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); text-align: center; width: max-content; }
.voice { position: absolute; width: min(28rem, 36vw); margin: 0; font-family: var(--serif); font-size: clamp(1.3rem, 2.2vw, 2rem); line-height: 1.35; }
.voice p { margin: 0; }
.voice-one { left: clamp(1.5rem, 7vw, 7rem); top: 14%; }
.voice-two { right: clamp(4rem, 9vw, 9rem); top: 52%; text-align: right; }
.distance-note { position: absolute; left: clamp(1.5rem, 7vw, 7rem); top: 52%; width: min(28rem, 36vw); text-align: left; }
.distance-note p { margin: 0 0 1.2rem; }
.distance-note strong { font-family: var(--serif); font-size: 1.12rem; font-weight: 400; font-style: italic; }

/* Version gap */
.scene-version { align-content: center; gap: 0; }
.version-heading { width: min(62rem, 82vw); }
.version-heading h2 { max-width: 51rem; }
.version-columns { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(3rem, 6vw, 6rem); width: min(62rem, 82vw); margin-top: clamp(2.5rem, 5vh, 4rem); }
.declaration { margin: 0; font-family: var(--serif); font-size: clamp(1.5rem, 2.7vw, 2.5rem); line-height: 1.2; }
.version-copy { max-width: 32rem; }
.version-copy p { margin: 0 0 1.4rem; }
.version-copy .pull-quote { margin: 3rem 0; font-family: var(--serif); font-size: clamp(1.5rem, 2.2vw, 2rem); font-style: italic; line-height: 1.3; }

/* How it works */
.scene-how { min-height: auto; align-content: start; gap: 0; }
.how-intro { width: min(52rem, 76vw); margin-bottom: clamp(4rem, 8vh, 6rem); }
.how-intro > p:not(.eyebrow) { max-width: 40rem; margin: 1.8rem 0 0; font-size: clamp(1.03rem, 1.35vw, 1.2rem); color: var(--cream); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; width: min(52rem, 76vw); }
.step {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 1.5rem;
  padding: clamp(2.5rem, 5vh, 4rem) 0;
  border-top: 1px solid var(--line-light);
}
.step:last-child { border-bottom: 1px solid var(--line-light); }
.step-num { font-family: var(--serif); font-size: 1.1rem; opacity: .4; padding-top: .15rem; }
.step h3 { margin: 0 0 .8rem; font-family: var(--serif); font-size: clamp(1.2rem, 1.8vw, 1.5rem); font-weight: 400; }
.step p { margin: 0; font-size: clamp(.95rem, 1.15vw, 1.05rem); color: var(--cream); }
.privacy-note { width: min(52rem, 76vw); margin-top: clamp(2.5rem, 5vh, 4rem); font-family: var(--serif); font-size: .95rem; font-style: italic; line-height: 1.45; color: var(--cream); opacity: .72; }

/* Who it's for */
.scene-for-you { align-content: center; gap: clamp(3rem, 8vh, 6rem); }
.for-you-copy { width: min(68rem, 84vw); }
.for-you-copy h2 { max-width: 45rem; }
.prose-columns.compact { margin-top: 4rem; }

/* Pricing */
.scene-invitation { align-content: center; color: var(--cream); transition: color 1.8s ease; }
.invitation-copy { width: min(50rem, 76vw); }
.invitation-copy > p:not(.eyebrow) { max-width: 38rem; margin-top: 2rem; font-size: 1.05rem; }
.yearly-note { margin-top: 1.2rem; font-size: .84rem; opacity: .55; }
.yearly-note a { font-weight: 500; }

/* Closing */
.scene-closing {
  min-height: 100svh;
  align-content: center;
  justify-items: center;
  text-align: center;
  background:
    linear-gradient(to bottom, rgba(44, 23, 24, .15) 0%, rgba(44, 23, 24, .05) 40%, rgba(44, 23, 24, .25) 100%),
    linear-gradient(145deg, #D4B9A6 0%, #CF8167 25%, #BC8686 45%, #D4B9A6 65%, #D4B9A6 85%, #EAD5CE 100%);
  background-size: cover;
}
.closing-phrase { margin: 0; font-family: var(--serif); font-size: clamp(1.8rem, 3.2vw, 3rem); line-height: 1.2; }
.closing-cta .button { margin-top: 2.5rem; }

/* Footer */
.site-footer {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.2rem 3rem;
  align-items: start;
  padding: clamp(2.5rem, 5vh, 4rem) clamp(1.5rem, 8vw, 8rem) clamp(2rem, 4vh, 3rem);
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: .72rem;
}
.footer-logo { width: 2.8rem; height: 1.8rem; background: var(--ink); grid-row: 1; }
.footer-nav { grid-column: 2; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; font-weight: 500; }
.footer-social { grid-column: 3; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: flex-end; }
.footer-nav a, .footer-social a { text-decoration: none; opacity: .6; }
.footer-nav a:hover, .footer-social a:hover { opacity: 1; }
.footer-safety { grid-column: 1 / -1; margin: 1rem 0 0; padding-top: 1.2rem; border-top: 1px solid rgba(64, 48, 46, .12); font-size: .72rem; line-height: 1.6; opacity: .5; }
.footer-safety a { font-weight: 600; }
.footer-copy { grid-column: 1 / -1; opacity: .35; font-size: .65rem; }

/* Visual theme switching */
body[data-visual-theme='light'] .site-header,
body[data-visual-theme='light'] .chapter-nav,
body[data-visual-theme='light'] .floating-logo { color: var(--ink); }
body[data-visual-theme='light'] .scene-for-you,
body[data-visual-theme='light'] .scene-invitation,
body[data-visual-theme='light'] .scene-closing { color: var(--ink); }

/* Responsive */
@media (max-width: 64rem) {
  .site-header nav a:not(.enter-link):not(.sign-in) { display: none; }
}

@media (max-width: 48rem) {
  .site-header { min-height: 4.25rem; padding-inline: 1.25rem; }
  .site-header nav { gap: .9rem; }
  .site-header .sign-in { display: none; }
  .site-header .enter-link { min-height: 2.8rem; }
  .chapter-nav { display: none; }
  .scene, .prose-scene { min-height: 115svh; padding: 7rem 1.4rem 5.5rem; }
  .scene-distance { min-height: 140svh; }
  .calm-zone { width: 130vw; height: 76vh; }
  .arrival-copy, .for-you-copy, .prose-block, .how-intro, .steps { width: 100%; }
  .prose-columns, .prose-columns.compact { grid-template-columns: 1fr; gap: 1.35rem; margin-top: 2.5rem; }
  .prose-columns p:first-child { font-size: 1.35rem; }
  .voice { position: relative; inset: auto; width: 100%; font-size: 1.35rem; }
  .scene-distance { align-content: center; gap: 3.25rem; }
  .distance-title { position: relative; inset: auto; transform: none; justify-self: start; text-align: left; width: auto; order: 1; }
  .voice-one { order: 2; }
  .voice-two { order: 3; text-align: left; }
  .distance-note { position: relative; inset: auto; width: 100%; padding-top: 0; order: 4; }
  .scene-version { gap: 3rem; }
  .version-columns { grid-template-columns: 1fr; gap: 2rem; width: 100%; }
  .version-copy { align-self: auto; padding: 0; }
  .privacy-note { width: 100%; }
  .invitation-copy { width: 100%; }
  .site-footer { grid-template-columns: 1fr; gap: 1.2rem; padding-inline: 1.4rem; }
  .footer-logo { grid-row: auto; }
  .footer-nav, .footer-social { grid-column: 1; justify-content: flex-start; }
  .footer-copy { grid-column: 1; }
  .floating-logo { width: 2.8rem; height: 1.8rem; }
}
