/* ==========================================================================
   Mon Guide Lunaire — Landing
   The moon is the hero. Type sits in front of it. Composition over decoration.
   ========================================================================== */

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

html,
body {
  margin: 0;
  padding: 0;
}

/* iOS safe-area fallback: solid dark on html so any rubber-band scroll
   exposure shows brand-consistent color, not system black. */
html {
  background: #0A0A0F;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

input {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  outline: 0;
}

.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;
}

/* Tokens -------------------------------------------------------------------- */
:root {
  --bg: #0A0A0F;

  --text: #F4F1E8;
  --text-muted: rgba(244, 241, 232, 0.62);
  --text-faint: rgba(244, 241, 232, 0.42);
  --text-dim:   rgba(244, 241, 232, 0.28);

  --accent: #B1B4FF;
  --accent-soft: rgba(177, 180, 255, 0.14);

  --border: rgba(244, 241, 232, 0.08);
  --border-strong: rgba(244, 241, 232, 0.16);

  --serif: 'Instrument Serif', 'Iowan Old Style', 'Apple Garamond', Georgia, serif;
  --sans: 'Geist', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, sans-serif;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --pad-x: clamp(20px, 4vw, 48px);
  --pad-y: clamp(24px, 3vh, 40px);
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

/* Custom property for animatable conic angle (waitlist orbit glow). ------- */
@property --orbit-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* Body --------------------------------------------------------------------- */
body {
  min-height: 100dvh;
  background: #0A0A0F;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  font-feature-settings: 'kern', 'liga', 'calt', 'ss01';
  overflow-x: hidden;
}

/* Sky — bulletproof full-viewport gradient. Position fixed always covers
   safe-area zones (notch, home indicator) on iOS Safari, unlike body
   background-attachment: fixed which has known Safari rendering bugs.
--------------------------------------------------------------------------- */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: linear-gradient(180deg, #0A0A0F 0%, #343D50 100%);
}

.sky__grain {
  position: absolute;
  inset: 0;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Stars — pure CSS dots, no images. Realistic astronomical points,
   not the haloed asset. Sub-pixel sizes (1-2.5px) with tiny soft glow.
--------------------------------------------------------------------------- */
.stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.star {
  position: absolute;
  width: var(--s, 1.5px);
  height: var(--s, 1.5px);
  border-radius: 50%;
  background: #F4F1E8;
  opacity: var(--o, 0.5);
  box-shadow: 0 0 calc(var(--s, 1.5px) * 2.4) rgba(244, 241, 232, 0.65);
  animation: star-twinkle 5.4s var(--ease-in-out) infinite;
  animation-delay: var(--d, 0s);
  /* The glow scales with the dot size. Tiny stars get tiny halos —
     no fake "sparkle." Realistic point sources. */
}

@keyframes star-twinkle {
  0%, 100% { opacity: var(--o, 0.5); }
  50%      { opacity: calc(var(--o, 0.5) * 0.4); }
}

/* Moon --------------------------------------------------------------------- */
.moon-stage {
  position: relative;
  width: clamp(200px, 22vw, 300px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 0;
}

.moon-halo {
  position: absolute;
  inset: -45%;
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(244, 241, 232, 0.14) 0%,
    transparent 70%
  );
  filter: blur(24px);
  /* Single radial, single transparency stop. Smooth mono-fade,
     no concentric ring artifacts. */
}

.moon {
  position: relative;
  width: 100%;
  height: auto;
  opacity: 1;
  filter: drop-shadow(0 0 50px rgba(244, 241, 232, 0.18));
  animation: moon-breathe 14s var(--ease-in-out) infinite;
  /* Single drop-shadow = one continuous bloom. Multiple stacked shadows
     produce visible concentric rings — never use more than one for soft glow. */
}

@keyframes moon-breathe {
  0%, 100% { transform: scale(1) translateY(0); }
  50%      { transform: scale(1.018) translateY(-2px); }
}

/* Page grid ---------------------------------------------------------------- */
.page {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: var(--pad-y) var(--pad-x);
  max-width: 1200px;
  margin: 0 auto;
}

/* Masthead — icon + wordmark, top-left ------------------------------------- */
.masthead {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  padding: 6px 8px;
  margin-left: -8px;
  border-radius: 8px;
  transition: opacity 220ms var(--ease-out);
}

.brand__icon {
  width: 28px;
  height: 28px;
  border-radius: 6.5px;
  box-shadow:
    0 0 0 1px rgba(244, 241, 232, 0.06),
    0 4px 14px rgba(0, 0, 0, 0.45);
}

.brand:hover { opacity: 0.78; }

.brand:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

.brand__name {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Inter', system-ui, sans-serif;
  font-weight: 500;
  font-size: 15.5px;
  letter-spacing: -0.012em;
  color: var(--text);
  line-height: 1;
}

/* Hero --------------------------------------------------------------------- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: clamp(18px, 2.6vh, 32px);
  padding-block: clamp(28px, 5vh, 64px);
  position: relative;
  z-index: 2;
}

.hero__headline {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(46px, 8.4vw, 108px);
  line-height: 1.0;
  letter-spacing: -0.02em;
  color: var(--text);
  max-width: 14ch;
  text-wrap: balance;
}

.hero__line {
  display: block;
}

/* The italic signature — "lunaire" in italic + accent color.
   Reads as art-directed, not designed-by-template. */
.hero__headline em {
  font-style: italic;
  color: var(--accent);
  font-feature-settings: 'kern', 'liga';
}

.hero__lede {
  margin: 0;
  font-family: var(--sans);
  font-size: clamp(16px, 1.6vw, 18.5px);
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: -0.005em;
  color: var(--text-muted);
  max-width: 36ch;
  text-wrap: balance;
}

@media (max-width: 520px) {
  .hero__break { display: none; }
}

/* Waitlist form ------------------------------------------------------------ */
.waitlist {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
}

.waitlist__field {
  position: relative;
  align-self: stretch;
  width: 100%;
  display: flex;
  align-items: center;
  background: rgba(10, 10, 15, 0.5);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px;
  padding-inline-start: 22px;
  isolation: isolate;
  transition:
    border-color 240ms var(--ease-out),
    background 240ms var(--ease-out),
    box-shadow 240ms var(--ease-out);
  /* The pill sits in front of the moon — it MUST blur the backdrop or
     the cratered moon shows through and ruins legibility. Glassmorphism
     done right (one element, not everywhere). */
}

/* Orbit glow — a bright accent arc rotates around the pill border.
   conic-gradient driven by --orbit-angle (animatable via @property),
   masked to a 1.5px ring with mask-composite. Soft blur for halo feel. */
.waitlist__field::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(
    from var(--orbit-angle),
    transparent 0deg,
    transparent 230deg,
    rgba(177, 180, 255, 0.35) 270deg,
    rgba(177, 180, 255, 1) 310deg,
    rgba(177, 180, 255, 0.35) 350deg,
    transparent 360deg
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  filter: blur(0.6px) drop-shadow(0 0 6px rgba(177, 180, 255, 0.45));
  animation: orbit 5s linear infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes orbit {
  to { --orbit-angle: 360deg; }
}

.waitlist__field:hover {
  border-color: var(--border-strong);
}

.waitlist__field:focus-within {
  border-color: rgba(177, 180, 255, 0.55);
  background: rgba(10, 10, 15, 0.6);
  box-shadow:
    0 0 0 4px rgba(177, 180, 255, 0.10),
    0 0 32px rgba(177, 180, 255, 0.08);
}

.waitlist__input {
  flex: 1;
  height: 46px;
  font-family: var(--sans);
  font-size: 15.5px;
  letter-spacing: -0.005em;
  color: var(--text);
  min-width: 0;
}

.waitlist__input::placeholder {
  color: var(--text-dim);
}

.waitlist__input:-webkit-autofill,
.waitlist__input:-webkit-autofill:hover,
.waitlist__input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0px 1000px transparent inset;
  transition: background-color 9999s ease-in-out 0s;
}

.waitlist__button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 46px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #0E0F1C;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 14.5px;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition:
    background 220ms var(--ease-out),
    transform 220ms var(--ease-out),
    box-shadow 220ms var(--ease-out);
}

.waitlist__button:hover {
  background: #BCBFFF;
  box-shadow: 0 6px 20px rgba(177, 180, 255, 0.28);
}

.waitlist__button:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 2px 8px rgba(177, 180, 255, 0.18);
}

.waitlist__button:focus-visible {
  outline: 0;
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 4px rgba(177, 180, 255, 0.65);
}

.waitlist__button-arrow {
  width: 14px;
  height: 14px;
  transform: translateX(0);
  transition: transform 240ms var(--ease-out);
}

.waitlist__button:hover .waitlist__button-arrow {
  transform: translateX(2px);
}

.waitlist__button[disabled] {
  opacity: 0.7;
  cursor: progress;
}

.waitlist__note {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  letter-spacing: 0;
  color: var(--text-faint);
}

.waitlist__status {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  min-height: 0;
}

.waitlist__status[data-state="error"] { color: #E8A2A6; }
.waitlist__status[data-state="success"] { color: var(--accent); }

/* Success replacement ----------------------------------------------------- */
.waitlist[data-submitted="true"] .waitlist__field,
.waitlist[data-submitted="true"] .waitlist__note {
  display: none;
}

.waitlist[data-submitted="true"] .waitlist__status {
  font-family: var(--serif);
  font-size: clamp(20px, 2.4vw, 26px);
  font-style: italic;
  color: var(--text);
  line-height: 1.3;
  text-align: center;
  letter-spacing: -0.005em;
  padding: 16px 8px 4px;
}

/* Footer ------------------------------------------------------------------- */
.legal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 0.01em;
  color: var(--text-dim);
  padding-top: 24px;
  position: relative;
  z-index: 2;
}

.legal__copy { font-variant-numeric: tabular-nums; }
.legal__dot { color: var(--text-dim); }
.legal__hint { color: var(--text-faint); }

/* Entrance animation ------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .masthead,
  .hero__headline .hero__line,
  .hero__lede,
  .waitlist,
  .legal {
    opacity: 0;
    transform: translateY(8px);
    animation: rise 900ms var(--ease-out) forwards;
  }

  .masthead              { animation-delay: 80ms; }
  .hero__line:nth-child(1) { animation-delay: 280ms; }
  .hero__line:nth-child(2) { animation-delay: 380ms; }
  .moon-stage            { animation-delay: 480ms; animation-duration: 1400ms; }
  .hero__lede            { animation-delay: 660ms; }
  .waitlist              { animation-delay: 800ms; }
  .legal                 { animation-delay: 940ms; }

  .moon-stage {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
    animation: moon-rise 1400ms var(--ease-out) forwards;
  }

  .stars {
    animation: sky-rise 2200ms var(--ease-out) both;
    animation-delay: 80ms;
  }
}

@keyframes moon-rise {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sky-rise {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .moon,
  .star,
  .waitlist__field::before {
    animation: none !important;
  }
}

/* Laptop tightening — keep everything above the fold on ~13-15" displays --- */
@media (max-height: 920px) and (min-width: 601px) {
  .hero {
    gap: clamp(14px, 2vh, 24px);
    padding-block: clamp(20px, 3.5vh, 48px);
  }
  .hero__headline {
    font-size: clamp(44px, 6.4vw, 88px);
  }
  .moon-stage {
    width: clamp(180px, 19vw, 260px);
  }
}

/* Mobile tightening -------------------------------------------------------- */
@media (max-width: 600px) {
  .page {
    padding-block: 28px 20px;
    padding-inline: 22px;
  }

  .hero {
    padding-block: 32px;
    gap: 28px;
  }

  .hero__headline {
    line-height: 1.02;
    letter-spacing: -0.022em;
  }

  .moon-stage {
    width: clamp(180px, 48vw, 240px);
    margin: 8px 0;
  }

  .waitlist__button {
    padding: 0 18px;
    font-size: 14px;
  }

  .legal {
    font-size: 11.5px;
    flex-wrap: wrap;
    text-align: center;
  }
}

@media (max-width: 380px) {
  .waitlist__field {
    padding-inline-start: 18px;
  }
  .waitlist__button-label { display: none; }
  .waitlist__button { padding: 0 16px; }
}

/* Print -------------------------------------------------------------------- */
@media print {
  body { background: #fff; color: #000; }
  .sky, .waitlist, .legal__hint { display: none !important; }
  .brand__name, .hero__headline, .hero__lede { color: #000; }
}
