:root {
  --bg: #031828;
  --panel: rgba(4, 22, 36, 0.74);
  --panel-border: rgba(79, 209, 197, 0.16);
  --ink: #eaf6fb;
  --muted: #8fb3c7;
  --accent: #4fd1c5;   /* sea teal */
  --accent-2: #ff8f6b; /* coral */
  --maxw: 1080px;

  /* Logo fish tail rig — tune these if the tail seam lands wrong.
     tail-cut: where the tail mask begins (fraction of logo width from left).
     tail-pivot: rotation joint. body-keep: how much of the body layer stays
     (slight overlap past tail-cut hides the seam while the tail swings). */
  --tail-cut: 74%;
  --tail-pivot: 76%;
  --body-keep: 75.5%;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background-color: var(--bg);
  /* Depth gradient — spans the whole document, so scrolling = descending. */
  background-image: linear-gradient(180deg,
    #0d5b7c 0%,
    #0a4a68 12%,
    #073a55 28%,
    #052c44 48%,
    #042034 68%,
    #031828 84%,
    #05202f 100%);
  color: var(--ink);
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 300;
  line-height: 1.65;
  overflow-x: hidden;
}
::selection { background: rgba(79, 209, 197, 0.25); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Creatures render above the scene backdrops (z:auto, inside main) but below
   text layers (z:4+), so fish cross the scenery without covering the copy. */
#sea { position: fixed; inset: 0; z-index: 3; pointer-events: none; }

/* ── Chrome ─────────────────────────────────────────────────── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.5rem;
  transition: background 0.35s ease, backdrop-filter 0.35s ease;
}
nav.scrolled {
  background: rgba(3, 20, 34, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.brand { display: flex; align-items: center; gap: 0.4rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand img {
  height: 30px; width: auto; display: block;
  transform: rotate(-4deg); /* match the hero fish's baked-in pitch */
}
.brand span { font-weight: 700; font-size: 1rem; color: var(--accent); }
nav .links { display: flex; gap: 1.6rem; font-size: 0.86rem; }
nav .links a { color: var(--ink); letter-spacing: 0.06em; text-transform: uppercase; }
nav .links a:hover { color: var(--accent); text-decoration: none; }
@media (max-width: 640px) { nav .links { gap: 1rem; font-size: 0.76rem; } }

/* No z-index here: main must not create a stacking context, so the fixed
   creature canvas can slot between scene images and the text layers. */
main { position: relative; }

/* ── Shared type ────────────────────────────────────────────── */
.overline {
  font-size: 0.76rem; letter-spacing: 0.32em; text-transform: uppercase;
  color: var(--accent); font-weight: 500; margin-bottom: 1rem;
}
h2 {
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 700; line-height: 1.1; letter-spacing: -0.01em;
  margin-bottom: 0.8rem;
}
h3 { font-size: 1.25rem; font-weight: 500; margin-bottom: 0.5rem; }
.sub { color: var(--muted); font-size: 1.05rem; max-width: 34em; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.reveal {
  opacity: 0; transform: translateY(42px);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.in { opacity: 1; transform: none; }

/* ── Hero beat (first viewport of the descent scene) ────────── */
.hero-beat {
  position: relative;
  flex-direction: column;
  align-items: center; justify-content: flex-end;
  text-align: center; padding-bottom: 14vh;
}
.surface-glow {
  position: absolute; top: 0; left: 0; right: 0; height: 26vh;
  background: radial-gradient(120% 100% at 50% -30%, rgba(210, 245, 255, 0.22), transparent 70%);
  pointer-events: none;
}
.hero-copy { position: relative; z-index: 5; }
.hero-copy .sub { margin: 1rem auto 2rem; }

/* Glass panel behind card-less text blocks so they pop off the imagery */
.hero-copy, .beat.center .reveal {
  background: rgba(3, 17, 29, 0.55);
  border: 1px solid rgba(79, 209, 197, 0.12);
  border-radius: 20px;
  padding: 2rem 2.6rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  max-width: 680px;
}
.cta-row { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.btn {
  display: inline-block; padding: 0.8rem 1.7rem; border-radius: 999px;
  font-size: 0.92rem; font-weight: 500; letter-spacing: 0.04em;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-solid {
  background: var(--accent); color: #03302b;
  box-shadow: 0 0 24px rgba(79, 209, 197, 0.25);
}
.btn-solid:hover { box-shadow: 0 0 44px rgba(79, 209, 197, 0.45); }
.btn-ghost { color: var(--ink); border: 1px solid rgba(234, 246, 251, 0.3); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.scroll-cue {
  position: absolute; bottom: 2.2rem; left: 50%; transform: translateX(-50%);
  width: 26px; height: 42px; border: 2px solid rgba(234, 246, 251, 0.35);
  border-radius: 14px; opacity: 0.8; z-index: 5;
}
.scroll-cue::after {
  content: ""; position: absolute; left: 50%; top: 7px;
  width: 4px; height: 8px; margin-left: -2px; border-radius: 2px;
  background: var(--accent);
  animation: cue 1.8s ease-in-out infinite;
}
@keyframes cue {
  0%   { transform: translateY(0);    opacity: 1; }
  70%  { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(0);    opacity: 0; }
}

/* ── The logo fish ──────────────────────────────────────────── */
.fish-stage {
  position: absolute; top: 0; left: 0; right: 0; height: 100vh;
  pointer-events: none; z-index: 4;
}
.fish-rig {
  position: absolute; left: 50%; top: 34%;
  transform: translate(-50%, -50%);
  width: clamp(225px, 33vw, 465px);
  aspect-ratio: 2347 / 1501;
  will-change: transform;
  filter: drop-shadow(0 14px 34px rgba(0, 10, 20, 0.4));
}
.fish-inner { position: absolute; inset: 0; will-change: transform; }
.fish-body, .fish-tail {
  position: absolute; inset: 0;
  background-image: url("Efficient-logo-my-edits.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
}
.fish-body { clip-path: inset(0 calc(100% - var(--body-keep)) 0 0); z-index: 2; }
.fish-tail {
  clip-path: inset(0 0 0 var(--tail-cut));
  transform-origin: var(--tail-pivot) 55%;
  z-index: 1;
  will-change: transform;
}

/* ── Plain text bands ───────────────────────────────────────── */
.band { max-width: var(--maxw); margin: 0 auto; padding: 22vh 1.5rem; }
.band .sub { margin-top: 0.8rem; }

/* ── Sticky image scenes ────────────────────────────────────── */
.scene { position: relative; }
.scene-sticky {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  /* fade the whole image stack to transparent at top/bottom so the page's
     water gradient shows through — seamless hand-off by construction */
  mask-image: linear-gradient(180deg, transparent 0%, black 18%, black 84%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, black 18%, black 84%, transparent 100%);
}
/* The descent spans the whole page — no edge fades at all */
#descent .scene-sticky {
  mask-image: none;
  -webkit-mask-image: none;
}
.scene-img {
  position: absolute; inset: -6% 0;
  background-size: cover; background-position: center;
  transform: translateY(calc(var(--p, 0) * -46px)) scale(1.06);
  will-change: transform;
}
.scene-img.fade { opacity: 0; }
.scene-shade {
  position: absolute; inset: 0; z-index: 3;
  background: radial-gradient(120% 90% at 50% 50%, transparent 40%, rgba(2, 12, 22, 0.5) 100%);
  pointer-events: none;
}

/* Somewhere in the wreck, something is watching. Position with --sx/--sy
   (% of the pinned viewport) once the backdrop image is final. */
.wreck-secret {
  position: absolute;
  left: var(--sx); top: var(--sy);
  width: 90px; height: 74px;
  transform: translate(-50%, -50%);
  background: transparent; border: 0; padding: 0;
  border-radius: 50%;
  cursor: default; /* no pointer tell — it has to be found */
  z-index: 5;
}

.scene-flow {
  position: relative; z-index: 4;
  margin-top: -100vh;
  max-width: var(--maxw); margin-left: auto; margin-right: auto;
  padding: 0 1.5rem;
  /* let clicks reach the scenery (and hidden things) between text blocks */
  pointer-events: none;
}
.scene-flow .card, .scene-flow .reveal, .scene-flow footer { pointer-events: auto; }
.beat { min-height: 100vh; display: flex; align-items: center; }
/* contact rides low over the reef — open fish water above it */
#contact.beat { align-items: flex-end; padding-bottom: 15vh; }
.scene-flow .overline, .scene-flow h2, .scene-flow .sub {
  text-shadow: 0 2px 16px rgba(2, 12, 22, 0.6);
}
.beat.right { justify-content: flex-end; }
.beat.center { justify-content: center; text-align: center; }

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 2.2rem 2.4rem;
  max-width: 520px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px rgba(0, 4, 10, 0.45);
}
.card p { color: var(--muted); }
.card .overline { margin-bottom: 0.5rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.2rem; }
.chip {
  font-size: 0.76rem; letter-spacing: 0.05em; color: var(--accent);
  border: 1px solid rgba(79, 209, 197, 0.3); border-radius: 999px;
  padding: 0.25rem 0.75rem;
}
.soon {
  display: inline-block; margin-top: 1.2rem;
  font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent-2);
}

/* ── Footer (last flow item of the descent, over the reef) ──── */
footer {
  position: relative; z-index: 4;
  padding: 2rem 1.5rem 2.5rem;
  font-size: 0.82rem; color: var(--muted);
  display: flex; gap: 1.6rem; justify-content: center; flex-wrap: wrap;
}
footer a { color: var(--muted); }
footer a:hover { color: var(--accent); }

/* ── Motion preferences ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .scroll-cue::after { animation: none; }
  .scene-img { transform: none; }
  .wreck-secret { display: none; }
}
