/* NOCTUA — the night, formulated.
   Palette: #0b1026 night indigo · #8ea6ff moonlight · #e9ecf8 starlight.
   Tempo: every duration derives from the 4-7-8 breath (19 s cycle). */

:root {
  --night: #0b1026;
  --night-deep: #060814;
  --moon: #8ea6ff;
  --moon-dim: rgba(142, 166, 255, .55);
  --star: #e9ecf8;
  --body-text: #c3cbe8;
  --body-dim: #8d96bd;
  --hairline: rgba(142, 166, 255, .18);
  --dusk-ember: #c9825f;
  --serif: "Newsreader", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
  --ease-breath: cubic-bezier(.37, 0, .63, 1); /* sine in-out */
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--night);
  color: var(--body-text);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 1.0625rem;
  line-height: 1.75;
  letter-spacing: .01em;
  overflow-x: hidden;
}

::selection { background: rgba(142, 166, 255, .28); color: var(--star); }

a { color: var(--moon); text-decoration: none; }
a:hover { color: var(--star); }
:focus-visible { outline: 2px solid var(--moon); outline-offset: 3px; border-radius: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip {
  position: fixed; top: -3rem; left: 1rem; z-index: 60;
  background: var(--night-deep); color: var(--star);
  padding: .6rem 1rem; border: 1px solid var(--hairline); border-radius: 4px;
  transition: top .3s var(--ease-breath);
}
.skip:focus { top: 1rem; }

/* ---------- fixed sky ---------- */
#sky {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: -1; display: block;
  background: linear-gradient(#1a2148, #343064 45%, #6b4a72 78%, #c9825f);
}

/* ---------- descent line ---------- */
.descent-line {
  position: fixed; top: 0; bottom: 0; left: 50%; width: 1px;
  background: rgba(142, 166, 255, .07);
  z-index: 0; pointer-events: none;
}
.descent-line span {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(rgba(142,166,255,0), rgba(142,166,255,.4) 30%, rgba(233,236,248,.6));
  transform: scaleY(0); transform-origin: top;
}
@media (max-width: 720px) { .descent-line { display: none; } }

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem clamp(1.25rem, 4vw, 3rem);
  transition: background .8s var(--ease-breath), backdrop-filter .8s var(--ease-breath);
}
.nav.scrolled {
  background: rgba(8, 11, 28, .55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.nav-mark {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: 1.3rem; color: var(--star); letter-spacing: .02em;
}
.nav-mark svg { color: var(--moon); }
.nav nav { display: flex; align-items: center; gap: clamp(.9rem, 2.5vw, 2rem); }
.nav nav a {
  font-size: .8rem; font-weight: 400; letter-spacing: .14em; text-transform: uppercase;
  color: var(--body-text);
}
.nav nav a:hover { color: var(--star); }
.nav-cta {
  padding: .5rem 1.05rem; border: 1px solid var(--moon-dim); border-radius: 999px;
  color: var(--moon) !important;
}
.nav-cta:hover { border-color: var(--star); color: var(--star) !important; }
@media (max-width: 720px) {
  .nav nav a:not(.nav-cta) { display: none; }
}

/* ---------- hero ---------- */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 7rem 1.5rem 5rem;
  position: relative;
}

.orb { position: relative; width: clamp(120px, 17vh, 170px); aspect-ratio: 1; margin-bottom: 1.4rem; }
.orb-halo {
  position: absolute; inset: -46%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(142,166,255,.30), rgba(142,166,255,.08) 45%, transparent 70%);
  opacity: .5;
  will-change: transform, opacity;
}
.orb-core {
  position: absolute; inset: 11%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 32%, rgba(233,236,248,.85), rgba(142,166,255,.55) 42%, rgba(56,72,150,.5) 76%, rgba(23,30,72,.55));
  box-shadow: 0 0 60px rgba(142,166,255,.25), inset 0 0 30px rgba(233,236,248,.12);
  will-change: transform;
}
.orb-ring { position: absolute; inset: 0; width: 100%; height: 100%; }

.orb-caption {
  font-size: .78rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--body-dim); margin-bottom: 2.6rem;
  display: flex; gap: .6rem; align-items: baseline; justify-content: center;
  min-height: 1.4em;
  font-variant-numeric: tabular-nums;
}
.orb-caption .orb-dot { color: var(--moon-dim); }
#breath-count { color: var(--moon); }

.hero-title {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(2.5rem, 7.4vw, 5.6rem);
  line-height: 1.08; color: var(--star);
  text-wrap: balance;
}
.hero-title .line { display: block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; }
.hero-title .line span { display: inline-block; }
/* only hide behind the mask when JS + motion are actually running */
html.motion .hero-title .line span { transform: translateY(115%); }

.hero-sub {
  margin-top: 1.7rem;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  color: var(--body-text);
  max-width: 34rem;
}
.hero-note {
  margin-top: 1.1rem;
  font-size: .85rem; color: var(--body-dim);
  max-width: 30rem;
}

.hero-scroll {
  position: absolute; bottom: 2.2rem; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: .7rem;
  font-size: .7rem; letter-spacing: .24em; text-transform: uppercase; color: var(--body-dim);
}
.hero-scroll-line { width: 1px; height: 52px; background: var(--hairline); position: relative; overflow: hidden; }
.hero-scroll-line::after {
  content: ""; position: absolute; top: -40%; left: 0; width: 100%; height: 40%;
  background: var(--moon);
  animation: scroll-drip 4.75s var(--ease-breath) infinite; /* one quarter breath */
}
@keyframes scroll-drip { 0% { top: -40%; } 60%, 100% { top: 110%; } }
@media (prefers-reduced-motion: reduce) { .hero-scroll-line::after { animation: none; top: 30%; } }

/* ---------- shared section chrome ---------- */
section { position: relative; z-index: 1; }

.chapter-head { max-width: 44rem; margin: 0 auto; padding: 0 1.5rem; text-align: center; }
.chapter-index {
  font-size: .72rem; letter-spacing: .26em; text-transform: uppercase;
  color: var(--moon); margin-bottom: 1.2rem;
}
.chapter-title {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(1.9rem, 4.6vw, 3.3rem); line-height: 1.14;
  color: var(--star); text-wrap: balance;
}
.chapter-sub { margin: 1.4rem auto 0; max-width: 36rem; color: var(--body-dim); font-size: .98rem; }

/* ---------- manifesto ---------- */
.manifesto { padding: clamp(7rem, 16vh, 12rem) 1.5rem; display: grid; place-items: center; }
.manifesto-text {
  max-width: 42rem;
  font-family: var(--serif); font-style: italic; font-weight: 300;
  font-size: clamp(1.35rem, 2.6vw, 1.9rem); line-height: 1.6;
  color: var(--body-text); text-align: center; text-wrap: balance;
}
.manifesto-text em { color: var(--star); font-style: italic; }

/* ---------- hours ---------- */
.hours { padding: clamp(5rem, 12vh, 9rem) 0 3rem; }
.hour {
  max-width: 62rem; margin: 0 auto;
  padding: clamp(5rem, 15vh, 10rem) 1.5rem;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(1.5rem, 5vw, 4.5rem); align-items: center;
}
.hour-time {
  font-family: var(--serif); font-style: italic; font-weight: 300;
  font-size: clamp(4rem, 12vw, 9.5rem); line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px var(--moon-dim);
  text-align: right;
  font-variant-numeric: tabular-nums;
  user-select: none;
}
@supports not (-webkit-text-stroke: 1px black) { .hour-time { color: var(--moon-dim); } }
/* the hour numerals breathe at 4-7-8 with the rest of the page */
.hour-time { animation: hour-breath 19s var(--ease-breath) infinite; }
@keyframes hour-breath {
  0% { opacity: .55; } 21.05% { opacity: 1; } 57.9% { opacity: 1; } 100% { opacity: .55; }
}
@media (prefers-reduced-motion: reduce) { .hour-time { animation: none; } }
.hour-body { max-width: 30rem; }
.hour-name {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(1.5rem, 3vw, 2rem); color: var(--star); line-height: 1.25;
  margin-bottom: 1rem;
  display: flex; flex-direction: column; gap: .45rem;
}
.hour-ing {
  font-family: var(--sans); font-style: normal; font-weight: 400;
  font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--moon);
}
.hour-body p + p { margin-top: .9rem; }
.hour-fn {
  font-size: .8rem; color: var(--body-dim);
  border-left: 1px solid var(--hairline); padding-left: .9rem;
}
.hours-disclaimer {
  max-width: 40rem; margin: 2rem auto 0; padding: 0 1.5rem;
  font-size: .74rem; color: var(--body-dim); text-align: center; line-height: 1.7;
}
@media (max-width: 780px) {
  .hour { grid-template-columns: 1fr; gap: 1.2rem; padding: clamp(4rem, 10vh, 6rem) 1.5rem; }
  .hour-time { text-align: left; font-size: clamp(3.4rem, 17vw, 5.5rem); }
}

/* ---------- hypnogram ---------- */
.night { padding: clamp(6rem, 14vh, 11rem) 0; }
.hypno { max-width: 56rem; margin: 3.5rem auto 0; padding: 0 1.5rem; }
.hypno svg { width: 100%; height: auto; display: block; }
.hypno-grid line { stroke: rgba(142, 166, 255, .1); stroke-width: 1; }
.hypno-labels text, .hypno-hours text {
  font-family: var(--sans); font-size: 13px; fill: var(--body-dim); letter-spacing: .06em;
}
.hypno-hours text { font-size: 12px; fill: rgba(141, 150, 189, .75); }
#hypno-path {
  stroke: var(--moon); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(142, 166, 255, .45));
}
#hypno-dot { fill: var(--star); filter: drop-shadow(0 0 8px rgba(233, 236, 248, .8)); }
.hypno figcaption {
  margin-top: 1.4rem; font-size: .82rem; color: var(--body-dim);
  max-width: 34rem; margin-left: auto; margin-right: auto; text-align: center;
}

/* ---------- app ---------- */
.app { padding: clamp(5rem, 12vh, 9rem) 1.5rem; }
.app-grid {
  max-width: 60rem; margin: 3.5rem auto 0;
  display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 5rem); align-items: center;
}
.phone {
  justify-self: center;
  width: min(270px, 78vw); aspect-ratio: 9 / 18.6;
  border: 1px solid rgba(142, 166, 255, .35);
  border-radius: 42px;
  padding: 12px;
  background: linear-gradient(160deg, rgba(142,166,255,.10), rgba(11,16,38,.4));
  box-shadow: 0 30px 80px rgba(3, 5, 16, .6), inset 0 0 0 1px rgba(233,236,248,.05);
}
.phone-screen {
  height: 100%; border-radius: 32px;
  background: radial-gradient(120% 90% at 50% 0%, #131a3f, var(--night-deep) 70%);
  display: flex; flex-direction: column; align-items: center;
  padding: 2rem 1.2rem 1.6rem;
  overflow: hidden;
}
.phone-time {
  font-family: var(--serif); font-style: italic; font-weight: 300;
  font-size: 2rem; color: var(--star); font-variant-numeric: tabular-nums;
}
.phone-orb {
  margin: auto 0; width: 44%; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid rgba(142, 166, 255, .25);
}
.phone-orb span {
  display: block; width: 68%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 40% 32%, rgba(233,236,248,.75), rgba(142,166,255,.4) 55%, rgba(30,40,92,.5));
  box-shadow: 0 0 28px rgba(142, 166, 255, .35);
  animation: phone-breath 19s var(--ease-breath) infinite;
}
/* 4-7-8 as keyframe percentages of a 19 s cycle: 0-21% in, 21-58% hold, 58-100% out */
@keyframes phone-breath {
  0% { transform: scale(.66); }
  21.05% { transform: scale(1); }
  57.9% { transform: scale(1); }
  100% { transform: scale(.66); }
}
@media (prefers-reduced-motion: reduce) { .phone-orb span { animation: none; } }
.phone-label { font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; color: var(--body-dim); margin-bottom: 1.4rem; }
.phone-wave { width: 100%; opacity: .5; }
.phone-wave svg { width: 100%; height: 26px; display: block; }
.phone-wave path { stroke: var(--moon); stroke-width: 1.5; }
.phone-foot { margin-top: .9rem; font-size: .68rem; color: var(--body-dim); letter-spacing: .1em; }

.app-features { list-style: none; display: grid; gap: 2.2rem; }
.app-features h3 {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: 1.35rem; color: var(--star); margin-bottom: .45rem;
}
.app-features p { font-size: .96rem; color: var(--body-text); max-width: 30rem; }
@media (max-width: 780px) {
  .app-grid { grid-template-columns: 1fr; }
  .phone { order: 2; }
}

/* ---------- waitlist ---------- */
.waitlist { padding: clamp(6rem, 16vh, 12rem) 1.5rem clamp(6rem, 14vh, 10rem); }
.waitlist-inner { max-width: 40rem; margin: 0 auto; text-align: center; }
.waitlist-title {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(1.9rem, 4.8vw, 3.2rem); line-height: 1.16; color: var(--star);
  text-wrap: balance;
}
.waitlist-sub { margin: 1.4rem auto 2.4rem; max-width: 33rem; color: var(--body-dim); font-size: .95rem; }
.waitlist-form { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; }
.waitlist-form input {
  flex: 1 1 240px; max-width: 330px;
  background: rgba(8, 11, 28, .55);
  border: 1px solid var(--hairline); border-radius: 999px;
  padding: .95rem 1.4rem;
  color: var(--star); font-family: var(--sans); font-size: .95rem;
  transition: border-color .6s var(--ease-breath);
}
.waitlist-form input::placeholder { color: var(--body-dim); }
.waitlist-form input:focus { border-color: var(--moon); outline: none; }
.waitlist-form button {
  cursor: pointer;
  background: var(--moon); color: #0a0e24;
  border: none; border-radius: 999px;
  padding: .95rem 1.7rem;
  font-family: var(--sans); font-weight: 500; font-size: .92rem; letter-spacing: .04em;
  box-shadow: 0 0 0 rgba(142, 166, 255, 0);
  animation: cta-breath 19s var(--ease-breath) infinite;
  transition: background .5s var(--ease-breath), transform .5s var(--ease-breath);
}
.waitlist-form button:hover { background: var(--star); }
@keyframes cta-breath {
  0% { box-shadow: 0 0 14px rgba(142, 166, 255, .12); }
  21.05% { box-shadow: 0 0 34px rgba(142, 166, 255, .42); }
  57.9% { box-shadow: 0 0 34px rgba(142, 166, 255, .42); }
  100% { box-shadow: 0 0 14px rgba(142, 166, 255, .12); }
}
@media (prefers-reduced-motion: reduce) { .waitlist-form button { animation: none; box-shadow: 0 0 22px rgba(142,166,255,.25); } }
.waitlist-confirm { margin-top: 1.3rem; min-height: 1.6em; color: var(--moon); font-size: .92rem; }

/* ---------- night clock ---------- */
.night-clock {
  position: fixed; bottom: 1.2rem; left: 1.4rem; z-index: 40;
  display: flex; align-items: center; gap: .5rem;
  font-size: .72rem; letter-spacing: .18em; color: var(--body-dim);
  font-variant-numeric: tabular-nums;
}
.night-clock svg { color: var(--moon-dim); }
@media (max-width: 720px) { .night-clock { display: none; } }

/* ---------- footer ---------- */
.footer {
  position: relative; z-index: 1;
  border-top: 1px solid rgba(142, 166, 255, .1);
  padding: 3rem 1.5rem 3.4rem;
  text-align: center;
  display: grid; gap: .9rem;
  background: rgba(4, 6, 16, .35);
}
.footer p { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--body-dim); }
.footer nav a { font-size: .85rem; letter-spacing: .06em; }
.footer-fine { text-transform: none !important; letter-spacing: .01em !important; font-size: .78rem !important; }
.footer-fine a { color: var(--moon); }

/* ---------- guide + 404 shared ---------- */
.guide-body {
  position: relative; z-index: 1;
  max-width: 46rem; margin: 0 auto;
  padding: clamp(5rem, 10vh, 7rem) 1.5rem 5rem;
}
.guide-body .back {
  display: inline-block; margin-bottom: 3rem;
  font-size: .8rem; letter-spacing: .2em; text-transform: uppercase;
}
.guide-body h1 {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(2.2rem, 6vw, 3.4rem); color: var(--star); line-height: 1.15;
  margin-bottom: 1.6rem; text-wrap: balance;
}
.guide-body h2 {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: 1.5rem; color: var(--star);
  margin: 3rem 0 .9rem;
  padding-top: 1.6rem;
  border-top: 1px solid rgba(142, 166, 255, .12);
}
.guide-body p, .guide-body li { color: var(--body-text); font-size: .98rem; }
.guide-body p + p { margin-top: .8rem; }
.guide-body ul, .guide-body ol { padding-left: 1.3rem; display: grid; gap: .55rem; margin-top: .6rem; }
.guide-body code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: .84em; color: var(--moon);
  background: rgba(142, 166, 255, .08);
  padding: .1em .4em; border-radius: 4px;
}
.guide-body strong { color: var(--star); font-weight: 500; }
.guide-body em { color: var(--star); }

/* ---------- 404 ---------- */
.lost {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 2rem 1.5rem;
  position: relative; z-index: 1;
}
.lost-time {
  font-family: var(--serif); font-style: italic; font-weight: 300;
  font-size: clamp(4.5rem, 16vw, 10rem); line-height: 1;
  color: transparent; -webkit-text-stroke: 1px var(--moon-dim);
  font-variant-numeric: tabular-nums;
}
@supports not (-webkit-text-stroke: 1px black) { .lost-time { color: var(--moon-dim); } }
.lost h1 {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(1.6rem, 4vw, 2.4rem); color: var(--star);
  margin: 1.4rem 0 .8rem; text-wrap: balance;
}
.lost p { max-width: 30rem; color: var(--body-dim); }
.lost a.lost-home {
  margin-top: 2.2rem; display: inline-block;
  padding: .8rem 1.6rem; border: 1px solid var(--moon-dim); border-radius: 999px;
  font-size: .82rem; letter-spacing: .16em; text-transform: uppercase; color: var(--moon);
}
.lost a.lost-home:hover { border-color: var(--star); color: var(--star); }

/* ---------- reveal defaults (JS enhances; no-JS stays visible) ---------- */
@media (prefers-reduced-motion: reduce) {
  .descent-line { display: none; }
}
