/* ---------- Brand tokens (the 3D scene reads these too) ---------- */
:root {
  --deep: #06303c;
  --lagoon: #0a8fa5;
  --aqua: #1fd1c8;
  --sand: #f6efe0;
  --white: #ffffff;
  --coral: #ff6f4e;
  --radius: 22px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--deep);
  line-height: 1.5;
  overflow-x: hidden;
  /* vertical scroll stays native; horizontal drags rotate the 3D scene */
  touch-action: pan-y pinch-zoom;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, var(--sand) 0%, #c9f3ef 50%, #6fdcd4 100%);
}

/* ---------- 3D canvas ---------- */
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
#scene.ready { opacity: var(--scene-o, 1); }

main, .top, .foot { position: relative; z-index: 1; }

/* ---------- Header ---------- */
.top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 2;
  padding: max(1rem, env(safe-area-inset-top)) 1.25rem 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--deep);
  text-decoration: none;
}
.brand-mark {
  width: 1.5rem; height: 1.5rem;
  border-radius: 50%;
  background: var(--deep);
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  left: 0.42rem; top: 0.22rem;
  width: 0.38rem; height: 0.7rem;
  border: solid var(--aqua);
  border-width: 0 3px 3px 0;
  transform: rotate(40deg);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3.25rem;
  padding: 0.9rem 1.6rem;
  border: 0;
  border-radius: 999px;
  background: var(--deep);
  color: var(--sand);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(6, 48, 60, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(6, 48, 60, 0.34); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible, a:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.btn-ghost {
  background: rgba(255, 255, 255, 0.85);
  color: var(--deep);
  box-shadow: none;
}
.btn[hidden] { display: none; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  padding: 5rem 1.25rem max(1.5rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
h1 {
  margin: 0;
  max-width: 11ch;
  font-size: clamp(2.6rem, 12vw, 4rem);
  font-weight: 850;
  line-height: 1;
  letter-spacing: -0.035em;
}
.lede {
  margin: 1rem 0 0;
  max-width: 28ch;
  font-size: 1.1rem;
}
.hero-actions { display: grid; gap: 0.75rem; }
.hero-actions .btn { width: 100%; }
.hero-text { text-shadow: 0 0 14px rgba(246, 239, 224, 0.95), 0 0 4px rgba(246, 239, 224, 0.9); }
.hint { margin: 0; text-align: center; font-size: 0.9rem; opacity: 0.75; }
.hint-desk { display: none; }

/* ---------- Story (the 4 steps) ---------- */
.story { display: grid; gap: 0.9rem; padding: 2rem 1.25rem; }
.step {
  padding: 1.25rem 1.4rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 28px rgba(6, 48, 60, 0.1);
}
.step h2 { margin: 0.4rem 0 0.25rem; font-size: 1.4rem; letter-spacing: -0.02em; }
.step p { margin: 0; }
.num {
  display: inline-grid;
  place-items: center;
  width: 2rem; height: 2rem;
  border-radius: 50%;
  background: var(--aqua);
  font-weight: 800;
}

/* ---------- Family sites ---------- */
.sites { padding: 3rem 1.25rem 2rem; }
.sites h2 { margin: 0 0 1rem; font-size: 1.8rem; letter-spacing: -0.02em; }
.site-grid { display: grid; gap: 1rem; }
.site-card {
  padding: 1.4rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 28px rgba(6, 48, 60, 0.1);
}
.site-card h3 { margin: 0 0 0.3rem; font-size: 1.3rem; }
.site-card p { margin: 0 0 1rem; }
.site-card ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.5rem; }
.site-card a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  border-radius: 14px;
  background: rgba(31, 209, 200, 0.18);
  color: var(--deep);
  font-weight: 600;
  text-decoration: none;
}
.site-card a::after { content: "\2197"; opacity: 0.6; }
.site-card a:hover { background: rgba(31, 209, 200, 0.34); }
.final-cta { margin-top: 2rem; display: grid; }

/* ---------- Footer & toast ---------- */
.foot {
  padding: 1.5rem 1.25rem max(1.5rem, env(safe-area-inset-bottom));
  background: var(--deep);
  color: var(--sand);
  font-size: 0.9rem;
}
#toast {
  position: fixed;
  left: 50%;
  bottom: max(1.5rem, env(safe-area-inset-bottom));
  z-index: 5;
  transform: translate(-50%, 2rem);
  padding: 0.8rem 1.2rem;
  border-radius: 999px;
  background: var(--deep);
  color: var(--sand);
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Touch devices get the tilt hint ---------- */
@media (pointer: coarse), (max-width: 767px) {
  .hint-touch { display: block; }
}

/* ---------- Desktop: scroll story ---------- */
@media (min-width: 768px) and (pointer: fine) {
  .top { padding: 1.5rem 6vw 0; }
  .hero { padding: 6rem 6vw 4rem; justify-content: center; gap: 2.5rem; }
  h1 { font-size: clamp(3.5rem, 7vw, 6.5rem); max-width: 9ch; }
  .lede { font-size: 1.3rem; max-width: 24ch; }
  .hero-actions { justify-items: start; }
  .hero-actions .btn { width: auto; }
  .hint { text-align: left; }
  .hint-touch { display: none; }
  .hint-desk { display: block; }

  /* four full-screen steps; the scene reads scroll progress across this block */
  .story { grid-auto-rows: 100vh; align-items: center; gap: 0; padding: 0 6vw; }
  .step { width: min(26rem, 44vw); }

  .sites { padding: 6rem 6vw 4rem; }
  .site-grid { grid-template-columns: 1fr 1fr; }
  .final-cta { justify-items: start; }
  .foot { padding: 1.5rem 6vw; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
