/* =====================================================================
   MyWave — Marble Entrance
   A stark, cinematic landing page. A glass marble sits on dark wood,
   still water within. On hover the water comes alive. Click to enter.
   ===================================================================== */

:root {
  /* Wall + table are light, so overlay text flips to dark for contrast */
  --bg: #d4cab8;            /* wall (fallback) */
  --ink: #15212e;           /* deep navy, the marble's own water */
  --ink-dim: rgba(21, 33, 46, 0.66);
  --ink-faint: rgba(21, 33, 46, 0.46);
  --teal: #0e8a86;          /* darker teal that reads on light */
  --aqua: #0a6f9c;
  --gold: #b08a4e;
  --navy: #0a2540;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-serif: "Georgia", "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

body {
  font-family: var(--font-sans);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  cursor: default;
}

/* The body gains .is-hover when the pointer is over the marble,
   and .is-entering during the click transition. */

/* ========== Scene / canvas ========== */
.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  /* The "wall" behind the table: a soft, warm neutral plaster.
     Brighter up top (overhead light), settling toward a slightly
     deeper neutral near the horizon where it meets the butcher block. */
  background:
    radial-gradient(135% 95% at 50% 8%, #c6caca 0%, #a7b3b3 38%, #869393 72%, #697878 100%);
    /*radial-gradient(135% 95% at 50% 8%, #f4efe4 0%, #e6dccb 38%, #d4cab8 72%, #c3b8a4 100%);*/
}

.scene canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Gentle vignette layered over the canvas — just enough to focus the eye
   on the marble without darkening the wall into a "2-tier black". */
.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(125% 95% at 50% 44%, transparent 62%, rgba(70, 55, 35, 0.14) 100%);
}

/* ========== Fallback (no WebGL) ========== */
.fallback {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2rem;
  text-decoration: none;
  color: var(--ink);
}

.scene.no-webgl .fallback { display: flex; }

.fallback-marble {
  width: clamp(180px, 32vmin, 340px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,0.95), rgba(255,255,255,0) 30%),
    radial-gradient(circle at 70% 72%, #06243b 0%, #0e4a6b 42%, #2d8fb0 100%);
  box-shadow:
    inset -18px -22px 50px rgba(0,20,40,0.45),
    inset 14px 16px 34px rgba(150, 225, 255, 0.4),
    0 36px 64px rgba(30, 22, 10, 0.32),
    0 10px 18px rgba(30, 22, 10, 0.22);
  animation: fbBob 6s ease-in-out infinite;
}

@keyframes fbBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.fallback-word {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: 0.04em;
}

/* Hide fallback once WebGL is up */
.scene.has-webgl .fallback { display: none !important; }

/* ========== Overlay layout ==========
   Now just a spacer + bottom controls. All headline/logo/tagline copy
   lives inside the 3D scene (so it parallaxes with the room). */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: clamp(1.2rem, 3vw, 2.4rem) clamp(1.2rem, 4vw, 3rem);
  pointer-events: none; /* let the marble receive pointer events by default */
}

.overlay-spacer { min-height: 0; }

/* Re-enable pointer events for interactive bits only */
.enter-hint,
.quick-nav a {
  pointer-events: auto;
}

/* Visually-hidden but available to screen readers / search engines */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wordmark img {
  height: clamp(34px, 5vw, 52px);
  width: auto;
  opacity: 0;
  filter: drop-shadow(0 2px 10px rgba(40, 30, 15, 0.22));
  transform: translateY(-8px);
  transition: opacity 1.2s ease 0.2s, transform 1.2s ease 0.2s;
}

body.is-loaded .wordmark img { opacity: 1; transform: translateY(0); }

/* The stage: reserves the central marble area (spacer) and hosts copy.
   The spacer lets pointer events fall through to the canvas/marble. */
.stage {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  justify-items: center;
  min-height: 0;
}

.stage-spacer {
  /* empty hole so the marble (in the canvas behind) is hover/clickable */
  width: min(70vmin, 560px);
  pointer-events: none;
}

.stage-copy {
  text-align: center;
  max-width: 640px;
  padding: 0 1rem clamp(1.5rem, 4vh, 3rem);
}

.kicker {
  margin: 0 0 0.9rem;
  font-size: clamp(0.78rem, 1.5vw, 0.95rem);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--teal);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1s ease 0.5s, transform 1s ease 0.5s;
}

.headline {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2rem, 5.4vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.headline-line {
  display: block;
  overflow: hidden;
}

.headline-line span,
.headline-line {
  opacity: 0;
  transform: translateY(120%);
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}

body.is-loaded .headline-line { opacity: 1; transform: translateY(0); }
body.is-loaded .headline-line:nth-child(1) { transition-delay: 0.65s; }
body.is-loaded .headline-line:nth-child(2) { transition-delay: 0.8s; }
body.is-loaded .headline-line:nth-child(3) { transition-delay: 0.95s; }

.tagline {
  margin: 1.1rem 0 0;
  font-size: clamp(0.95rem, 1.8vw, 1.12rem);
  color: var(--ink-dim);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1s ease 1.2s, transform 1s ease 1.2s;
}

body.is-loaded .kicker,
body.is-loaded .tagline { opacity: 1; transform: translateY(0); }

/* On hover, gently dim the copy so the marble reads as the focus */
body.is-hover .stage-copy { transition: opacity 0.6s ease; opacity: 0.82; }

/* ========== Bottom row ========== */
.overlay-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.enter-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(21, 33, 46, 0.16);
  color: var(--ink-dim);
  font-family: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  box-shadow: 0 4px 14px rgba(40, 30, 15, 0.1);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1s ease 1.4s, transform 1s ease 1.4s,
              color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

body.is-loaded .enter-hint { opacity: 1; transform: translateY(0); }

.enter-hint:hover {
  color: var(--navy);
  border-color: rgba(10, 111, 156, 0.55);
  background: rgba(255, 255, 255, 0.78);
}

.enter-hint-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 0 rgba(79, 209, 197, 0.7);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(79, 209, 197, 0.6); }
  70%  { box-shadow: 0 0 0 12px rgba(79, 209, 197, 0); }
  100% { box-shadow: 0 0 0 0 rgba(79, 209, 197, 0); }
}

.quick-nav {
  display: flex;
  gap: clamp(1rem, 2.4vw, 1.8rem);
  flex-wrap: wrap;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 1s ease 1.6s, transform 1s ease 1.6s;
}

body.is-loaded .quick-nav { opacity: 1; transform: translateY(0); }

.quick-nav a {
  color: var(--ink-faint);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  transition: color 0.2s ease;
}

.quick-nav a:hover { color: var(--ink); }

/* ========== Hover state (marble alive) ========== */
body.is-hover { cursor: pointer; }
body.is-pointer { cursor: pointer; }

body.is-hover .enter-hint {
  color: var(--aqua);
  border-color: rgba(111, 226, 255, 0.5);
}

/* ========== Click-to-enter transition ========== */
body.is-entering .overlay { transition: opacity 0.7s ease; opacity: 0; }
body.is-entering .scene { transition: transform 1.1s cubic-bezier(0.6,0,0.2,1), filter 0.9s ease; transform: scale(1.12); filter: brightness(1.15); }

/* ========== Loading gate ========== */
body.is-loading .overlay { opacity: 0; }
body { transition: opacity 0.6s ease; }

/* ========== Responsive ========== */
@media (max-width: 640px) {
  .overlay-bottom { justify-content: center; }
  .quick-nav { justify-content: center; }
  .stage-copy { padding-bottom: 1.2rem; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .fallback-marble,
  .enter-hint-dot { animation: none; }
  * { transition-duration: 0.001ms !important; }
}
