/* ============================================================
   ATOLL OS — "THE DESCENT"
   Cinematic dark landing page. Scroll = dive.
   ============================================================ */

:root {
  --abyss: #030b12;
  --deep: #07273f;
  --ink: #0a1f2e;
  --foam: #eaf4f6;
  --mist: rgba(234, 244, 246, 0.62);
  --aqua: #59e4ce;
  --cyan: #4fc7ff;
  --amber: #ffb45e;
  --hairline: rgba(234, 244, 246, 0.14);
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Archivo", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--abyss);
  color: var(--foam);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--aqua); color: var(--abyss); }

h1, h2, h3 { font-weight: 400; }
h2 {
  font-family: var(--serif);
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
  margin: 0.6rem 0 1.2rem;
}
h2 em, h1 em { font-style: italic; color: var(--aqua); }

.lead {
  font-size: clamp(1.02rem, 1.4vw, 1.2rem);
  color: var(--mist);
  max-width: 34em;
}

/* ============ GRAIN + VIGNETTE ============ */
.grain {
  position: fixed; inset: -50%;
  pointer-events: none; z-index: 90;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.05;
  animation: grain 0.9s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 3%); }
  50% { transform: translate(3%, -2%); }
  75% { transform: translate(-3%, -3%); }
  100% { transform: translate(2%, 2%); }
}
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 89;
  background: radial-gradient(120% 90% at 50% 50%, transparent 60%, rgba(0, 0, 0, 0.5));
}

/* ============ PRELOADER ============ */
.preloader {
  position: fixed; inset: 0; z-index: 200;
  background: var(--abyss);
  display: grid; place-items: center;
  transition: opacity 0.8s var(--ease), visibility 0.8s;
}
.preloader.is-done { opacity: 0; visibility: hidden; }
.preloader__inner { text-align: center; width: min(420px, 80vw); }
.preloader__logo img { width: 56px; margin-bottom: 1.6rem; filter: drop-shadow(0 0 24px rgba(89, 228, 206, 0.4)); }
.preloader__lines {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.18em;
  color: var(--mist); display: grid; gap: 0.5rem; min-height: 7em;
}
.preloader__lines span { opacity: 0; transform: translateY(6px); transition: 0.4s var(--ease); }
.preloader__lines span.on { opacity: 1; transform: none; }
.preloader__go { color: var(--aqua); }
.preloader__bar {
  margin-top: 1.6rem; height: 1px; background: var(--hairline);
  overflow: hidden; border-radius: 2px;
}
.preloader__bar i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--aqua), var(--cyan));
  transition: width 1.8s var(--ease);
}
.preloader.is-loading .preloader__bar i { width: 100%; }

/* ============ DEPTH HUD ============ */
.hud {
  position: fixed; right: 1.6rem; top: 50%; transform: translateY(-50%);
  z-index: 80; text-align: right;
  font-family: var(--mono);
  opacity: 0; transition: opacity 0.8s var(--ease) 0.2s;
}
body.is-ready .hud { opacity: 1; }
.hud__depth {
  font-size: 1.5rem; font-weight: 300; color: var(--foam);
  text-shadow: 0 0 18px rgba(79, 199, 255, 0.5);
}
.hud__depth em { font-style: normal; font-size: 0.65rem; color: var(--aqua); margin-left: 0.2em; }
.hud__scale {
  width: 2px; height: 26vh; margin: 0.8rem 0 0.8rem auto;
  background: var(--hairline); position: relative; border-radius: 2px;
}
.hud__scale i {
  position: absolute; left: 50%; top: 0; transform: translate(-50%, -50%);
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--aqua);
  box-shadow: 0 0 12px var(--aqua);
  transition: top 0.2s linear;
}
.hud__dive { font-size: 0.58rem; letter-spacing: 0.22em; color: var(--mist); white-space: nowrap; }
@media (max-width: 900px) { .hud { display: none; } }

/* ============ NAV ============ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem clamp(1.2rem, 4vw, 3rem);
  transition: background 0.5s, backdrop-filter 0.5s, border-color 0.5s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: rgba(3, 11, 18, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--hairline);
}
.nav__brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; color: var(--foam); }
.nav__brand img { width: 30px; }
.nav__brand span { font-family: var(--serif); font-size: 1.25rem; letter-spacing: 0.01em; }
.nav__links { display: flex; gap: 1.8rem; }
.nav__links a {
  color: var(--mist); text-decoration: none;
  font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase;
  transition: color 0.3s;
}
.nav__links a:hover { color: var(--aqua); }
.nav__cta {
  font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--abyss); background: var(--aqua);
  padding: 0.6rem 1.2rem; border-radius: 100px; text-decoration: none;
  transition: transform 0.3s var(--ease), box-shadow 0.3s;
  box-shadow: 0 8px 24px -8px rgba(89, 228, 206, 0.5);
}
.nav__cta:hover { transform: translateY(-2px); box-shadow: 0 14px 32px -8px rgba(89, 228, 206, 0.6); }
@media (max-width: 760px) { .nav__links { display: none; } }

/* ============ BUTTONS ============ */
.btn {
  display: inline-block; text-decoration: none; cursor: pointer;
  font-family: var(--sans); font-size: 0.82rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.95rem 1.9rem; border-radius: 100px;
  transition: transform 0.35s var(--ease), box-shadow 0.35s, background 0.35s, color 0.35s;
}
.btn--fill {
  background: var(--aqua); color: var(--abyss); border: 1px solid var(--aqua);
  box-shadow: 0 10px 30px -10px rgba(89, 228, 206, 0.55);
}
.btn--fill:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -12px rgba(89, 228, 206, 0.7); }
.btn--ghost {
  background: rgba(3, 11, 18, 0.25); color: var(--foam);
  border: 1px solid rgba(234, 244, 246, 0.35);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.btn--ghost:hover { border-color: var(--aqua); color: var(--aqua); transform: translateY(-3px); }

/* ============ HERO ============ */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  overflow: hidden;
}
.hero__media, .chapter__media {
  position: absolute; inset: 0; z-index: -2;
}
.hero__media video, .chapter__media video {
  width: 100%; height: 100%; object-fit: cover;
}
.hero__media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(3, 11, 18, 0.55), rgba(3, 11, 18, 0.15) 40%, rgba(3, 11, 18, 0.75) 92%);
}
.hero__bar {
  position: absolute; left: 0; right: 0; height: 12vh;
  background: var(--abyss); z-index: 5;
  transition: transform 1.6s var(--ease) 0.3s;
}
.hero__bar--top { top: 0; transform-origin: top; }
.hero__bar--bottom { bottom: 0; transform-origin: bottom; }
body.is-ready .hero__bar--top { transform: translateY(-100%); }
body.is-ready .hero__bar--bottom { transform: translateY(100%); }

.hero__content {
  position: relative; z-index: 6;
  padding: 0 clamp(1.4rem, 6vw, 7rem);
  max-width: 1100px;
}
.kicker {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--aqua); margin-bottom: 1.4rem;
}
.hero__title {
  font-family: var(--serif);
  font-size: clamp(3rem, 8.4vw, 7.2rem);
  line-height: 1.06; letter-spacing: -0.015em;
  margin-bottom: 2.4rem;
  text-shadow: 0 4px 60px rgba(3, 11, 18, 0.7);
}
/* padding keeps italic descenders inside the clip box; margin re-tightens rhythm */
.hero__title .line { display: block; overflow: hidden; padding-bottom: 0.16em; margin-bottom: -0.16em; }
.hero__title .line > span { display: inline-block; }
.hero__sub {
  max-width: 36em; color: var(--mist);
  font-size: clamp(1rem, 1.4vw, 1.18rem); margin-bottom: 2.2rem;
}
.hero__actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero__cue {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  z-index: 6; text-decoration: none; text-align: center; color: var(--mist);
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.3em; text-transform: uppercase;
}
.hero__cue i {
  display: block; width: 1px; height: 46px; margin: 0.7rem auto 0;
  background: linear-gradient(180deg, var(--aqua), transparent);
  animation: cue 2s var(--ease) infinite;
}
@keyframes cue { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* ============ TICKER ============ */
.ticker {
  border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
  background: rgba(7, 39, 63, 0.35);
  overflow: hidden; padding: 0.9rem 0;
}
.ticker__track {
  display: flex; gap: 2.4rem; width: max-content;
  animation: ticker 36s linear infinite;
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--mist); white-space: nowrap;
}
.ticker__track b { color: var(--aqua); }
@keyframes ticker { to { transform: translateX(-50%); } }

/* ============ CHAPTERS ============ */
.chapter {
  position: relative; min-height: 108vh;
  display: flex; align-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--hairline);
}
.chapter__scrim {
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(3, 11, 18, 0.8), rgba(3, 11, 18, 0.45) 30%, rgba(3, 11, 18, 0.85));
}
.chapter__scrim--left { background: linear-gradient(90deg, rgba(3, 11, 18, 0.92) 0%, rgba(3, 11, 18, 0.55) 45%, rgba(3, 11, 18, 0.1) 80%), linear-gradient(180deg, rgba(3,11,18,.6), transparent 30%, rgba(3,11,18,.6)); }
.chapter__scrim--right { background: linear-gradient(270deg, rgba(3, 11, 18, 0.92) 0%, rgba(3, 11, 18, 0.55) 45%, rgba(3, 11, 18, 0.1) 80%), linear-gradient(180deg, rgba(3,11,18,.6), transparent 30%, rgba(3,11,18,.6)); }

.chapter__body {
  position: relative; z-index: 2;
  padding: clamp(6rem, 12vh, 9rem) clamp(1.4rem, 6vw, 7rem);
  max-width: 1200px; margin: 0 auto; width: 100%;
}
.chapter__body--left { max-width: none; margin: 0; }
.chapter__body--left > * { max-width: 560px; }
.chapter__body--right { max-width: none; margin: 0; display: flex; flex-direction: column; align-items: flex-end; text-align: right; margin-left: auto; }
.chapter__body--right > * { max-width: 560px; }
.chapter__body--right .list li { padding-left: 0; padding-right: 1.6rem; }
.chapter__body--right .list li::before { left: auto; right: 0; }
.chapter__body--center { text-align: center; display: flex; flex-direction: column; align-items: center; }
.chapter__body--center > * { max-width: 640px; }

.chapter__meta {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.26em;
  text-transform: uppercase; color: var(--mist);
}
.chapter__meta b { color: var(--aqua); font-weight: 500; }
.appmark { width: 30px; height: 30px; border-radius: 8px; }
.status {
  font-size: 0.6rem; padding: 0.25rem 0.7rem; border-radius: 100px;
  border: 1px solid var(--hairline); letter-spacing: 0.18em;
}
.status--live { color: var(--aqua); border-color: rgba(89, 228, 206, 0.4); }
.status--beta { color: var(--amber); border-color: rgba(255, 180, 94, 0.4); }
.status--dev { color: var(--cyan); border-color: rgba(79, 199, 255, 0.4); }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.6rem 0 2.4rem; max-width: 620px; }
.chips li {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 0.42rem 0.9rem; border: 1px solid var(--hairline); border-radius: 100px;
  color: var(--mist); background: rgba(3, 11, 18, 0.35);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.triptych { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); max-width: 980px; }
.triptych > div { background: rgba(3, 11, 18, 0.72); padding: 1.6rem; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.triptych h3 { font-family: var(--serif); font-size: 1.5rem; margin-bottom: 0.5rem; }
.triptych p { font-size: 0.92rem; color: var(--mist); }
@media (max-width: 860px) { .triptych { grid-template-columns: 1fr; } }

.list { list-style: none; margin: 1.8rem 0 2.2rem; display: grid; gap: 0.9rem; }
.list li { position: relative; padding-left: 1.6rem; color: var(--mist); font-size: 1rem; }
.list li::before {
  content: ""; position: absolute; left: 0; top: 0.55em;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--aqua); box-shadow: 0 0 10px rgba(89, 228, 206, 0.7);
}
.list--center li { padding-left: 0; padding-top: 1.2rem; }
.list--center li::before { left: 50%; top: 0; transform: translateX(-50%); }

/* ============ SONAR (ComHub) ============ */
.chapter--sonar { background: radial-gradient(90% 120% at 50% 110%, #06283e 0%, var(--abyss) 60%); }
.sonar { position: absolute; inset: 0; z-index: 0; overflow: hidden; }
.sonar i {
  position: absolute; left: 50%; top: 50%;
  width: 40vmax; height: 40vmax; border-radius: 50%;
  border: 1px solid rgba(79, 199, 255, 0.16);
  transform: translate(-50%, -50%) scale(0);
  animation: ping 7s linear infinite;
}
.sonar i:nth-child(2) { animation-delay: 1.75s; }
.sonar i:nth-child(3) { animation-delay: 3.5s; }
.sonar i:nth-child(4) { animation-delay: 5.25s; }
@keyframes ping {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(3); opacity: 0; }
}
.blip {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 14px var(--cyan);
  animation: blip 7s ease-in-out infinite;
}
.blip--1 { left: 24%; top: 30%; }
.blip--2 { left: 74%; top: 62%; animation-delay: 2s; }
.blip--3 { left: 60%; top: 22%; animation-delay: 4.4s; }
@keyframes blip { 0%, 100% { opacity: 0.15; } 50% { opacity: 1; } }

/* ============ DECK (who/why) ============ */
.deck {
  position: relative; padding: clamp(6rem, 14vh, 10rem) clamp(1.4rem, 6vw, 7rem);
  background:
    radial-gradient(60% 80% at 80% 0%, rgba(7, 39, 63, 0.8), transparent 70%),
    var(--abyss);
  border-bottom: 1px solid var(--hairline);
}
.deck__inner { max-width: 1200px; margin: 0 auto; }
.deck__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; margin: 3rem 0 4.5rem; }
.deck__grid article {
  border: 1px solid var(--hairline); border-radius: 16px;
  padding: 2rem 1.8rem; position: relative; overflow: hidden;
  background: linear-gradient(180deg, rgba(7, 39, 63, 0.35), rgba(3, 11, 18, 0.6));
  transition: transform 0.45s var(--ease), border-color 0.45s;
}
.deck__grid article:hover { transform: translateY(-6px); border-color: rgba(89, 228, 206, 0.45); }
.deck__grid article span {
  font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.3em; color: var(--aqua);
}
.deck__grid h3 { font-family: var(--serif); font-size: 1.7rem; margin: 0.8rem 0 0.6rem; }
.deck__grid p { color: var(--mist); font-size: 0.95rem; }
.deck__why { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); }
.deck__why > div { background: var(--abyss); padding: 1.6rem; }
.deck__why h4 {
  font-family: var(--mono); font-weight: 500; font-size: 0.72rem;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--aqua); margin-bottom: 0.6rem;
}
.deck__why p { font-size: 0.88rem; color: var(--mist); }
@media (max-width: 960px) { .deck__grid, .deck__why { grid-template-columns: 1fr; } }

/* ============ FINALE ============ */
.finale {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  text-align: center; overflow: hidden;
}
.finale__scrim {
  position: absolute; inset: 0; z-index: 1;
  background: radial-gradient(90% 90% at 50% 60%, rgba(3, 11, 18, 0.25), rgba(3, 11, 18, 0.85));
}
.finale__body { position: relative; z-index: 2; padding: 6rem 1.4rem; display: flex; flex-direction: column; align-items: center; }
.finale__body .lead { margin: 0 auto 2.4rem; }
.finale__title {
  font-size: clamp(3.4rem, 9vw, 8rem); line-height: 0.98;
  text-shadow: 0 6px 80px rgba(3, 11, 18, 0.8);
}
.finale__form {
  display: flex; gap: 0.7rem; flex-wrap: wrap; justify-content: center;
}
.finale__form input {
  min-width: 280px; padding: 0.95rem 1.4rem; border-radius: 100px;
  border: 1px solid rgba(234, 244, 246, 0.35);
  background: rgba(3, 11, 18, 0.45); color: var(--foam);
  font-family: var(--sans); font-size: 0.9rem; outline: none;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.3s;
}
.finale__form input:focus { border-color: var(--aqua); }
.finale__form input::placeholder { color: rgba(234, 244, 246, 0.4); }

/* ============ FOOTER ============ */
.footer {
  padding: 3.5rem clamp(1.4rem, 6vw, 7rem);
  display: grid; gap: 1.2rem; justify-items: center; text-align: center;
  color: var(--mist); font-size: 0.85rem;
}
.footer__brand { display: flex; align-items: center; gap: 0.6rem; }
.footer__brand img { width: 26px; }
.footer__brand span { font-family: var(--serif); font-size: 1.1rem; color: var(--foam); }
.footer nav { display: flex; gap: 1.4rem; flex-wrap: wrap; justify-content: center; }
.footer nav a {
  color: var(--mist); text-decoration: none;
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.2em; text-transform: uppercase;
}
.footer nav a:hover { color: var(--aqua); }
.footer__fine { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.18em; opacity: 0.55; }

/* ============ REVEALS ============ */
[data-reveal] {
  opacity: 0; transform: translateY(34px);
  filter: blur(6px);
  transition: opacity 1s var(--ease), transform 1s var(--ease), filter 1s var(--ease);
}
[data-reveal].is-in { opacity: 1; transform: none; filter: blur(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal] { opacity: 1; transform: none; filter: none; }
  html { scroll-behavior: auto; }
}
