/*
 * DESIGN TOKENS
 * All visual constants in one place. Change the palette here,
 * the entire site updates. This is how design systems like
 * Material Design and Tailwind work under the hood.
 */
:root {
  /* Palette — warm, contemplative */
  --color-bg: #faf6f1;
  --color-bg-deep: #f3ece3;
  --color-text: #2d2926;
  --color-text-muted: #8a7e74;
  --color-accent: #c4956a;
  --color-accent-hover: #b07a52;
  --color-accent-light: rgba(196, 149, 106, 0.12);
  --color-glow: rgba(210, 170, 130, 0.25);
  --color-border: rgba(45, 41, 38, 0.08);
  --color-success: #7a9e7e;

  /* Typography */
  --font-heading: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  /* Spacing scale — based on a 4px grid (standard in UI design) */
  --space-xs: 0.5rem;   /* 8px */
  --space-sm: 1rem;      /* 16px */
  --space-md: 2rem;      /* 32px */
  --space-lg: 4rem;      /* 64px */
  --space-xl: 6rem;      /* 96px */

  /* Sizing */
  --max-width: 680px;
  --border-radius: 8px;

  /* Animation — "ease-out" feels natural, like physical deceleration */
  --transition-fast: 150ms ease-out;
  --transition-base: 300ms ease-out;
  --transition-slow: 600ms ease-out;
}

/*
 * RESET & BASE
 * Modern CSS reset — removes browser inconsistencies.
 * This is "Normalize + Reset" pattern.
 */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  /* Subtle warm gradient across the full page */
  background: linear-gradient(
    175deg,
    var(--color-bg) 0%,
    var(--color-bg-deep) 60%,
    var(--color-bg) 100%
  );
  min-height: 100vh;
}

/*
 * HERO SECTION
 * Uses CSS Grid for centering (more robust than flexbox for
 * full-viewport layouts). The "place-items: center" shorthand
 * centers both axes in one declaration.
 */
.hero {
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  padding: var(--space-md);
}

/*
 * DECORATIVE GLOW RING
 * Pure CSS — no image needed. Creates a luminous ring that evokes
 * the "mirror" concept. Uses border + blur + opacity for softness.
 * "aria-hidden" in HTML means screen readers ignore this.
 */
.glow-ring {
  position: absolute;
  width: min(520px, 80vw);
  height: min(520px, 80vw);
  border-radius: 50%;
  border: 1.5px solid var(--color-glow);
  box-shadow:
    0 0 80px 20px var(--color-glow),
    inset 0 0 60px 10px var(--color-glow);
  opacity: 0.45;
  pointer-events: none;
  /* Gentle floating animation */
  animation: glow-breathe 8s ease-in-out infinite;
}

@keyframes glow-breathe {
  0%, 100% {
    transform: scale(1);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.03);
    opacity: 0.55;
  }
}

/*
 * HERO CONTENT
 * z-index ensures text sits above the glow ring.
 * Text alignment and max-width create readable line lengths
 * (the "measure" in typography — 45-75 chars per line is ideal).
 */
.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: var(--max-width);
  /* Staggered fade-in animation */
  animation: fade-up 0.8s var(--transition-slow) both;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* WORDMARK — the brand name, styled distinctively */
.wordmark {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0.35em;
  text-transform: lowercase;
  color: var(--color-accent);
  margin-bottom: var(--space-lg);
  animation: fade-up 0.8s 0.2s both;
}

/* HEADLINE — serif font for warmth and personality */
h1 {
  font-family: var(--font-heading);
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--color-text);
  margin-bottom: var(--space-md);
  animation: fade-up 0.8s 0.4s both;
}

/*
 * clamp() is a CSS function: clamp(minimum, preferred, maximum)
 * It creates fluid typography that scales with viewport width
 * but never goes below 2.2rem or above 3.6rem. This is
 * "Fluid Typography" — no media queries needed for font scaling.
 */

.subtitle {
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  color: var(--color-text-muted);
  max-width: 480px;
  margin: 0 auto var(--space-lg);
  animation: fade-up 0.8s 0.6s both;
}

/*
 * WAITLIST FORM
 * Horizontal layout on desktop, stacks on mobile.
 * The form-group uses flexbox for the input + button row.
 */
.waitlist-form {
  animation: fade-up 0.8s 0.8s both;
}

.form-group {
  display: flex;
  gap: 0.5rem;
  max-width: 420px;
  margin: 0 auto;
}

.form-group input {
  flex: 1;
  padding: 0.85rem 1.1rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--color-text);
  background: white;
  border: 1.5px solid var(--color-border);
  border-radius: var(--border-radius);
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-group input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.6;
}

.form-group input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-light);
}

/* Invalid state — only show after user has interacted */
.form-group input:not(:placeholder-shown):invalid {
  border-color: #c47070;
}

.form-group button {
  padding: 0.85rem 1.5rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: white;
  background: var(--color-accent);
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background var(--transition-fast),
    transform var(--transition-fast);
  position: relative;
}

.form-group button:hover {
  background: var(--color-accent-hover);
}

.form-group button:active {
  transform: scale(0.97);
}

/* Button loading state */
.btn-loading {
  display: none;
}

.form-group button.loading .btn-text {
  visibility: hidden;
}

.form-group button.loading .btn-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset: 0;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.form-note {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: var(--space-sm);
  opacity: 0.7;
}

/*
 * SUCCESS MESSAGE
 * The [hidden] attribute in HTML hides it by default.
 * JS removes [hidden] and adds .visible for the animation.
 */
.success-message {
  animation: fade-up 0.5s both;
}

.success-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.success-body {
  font-size: 1rem;
  color: var(--color-text-muted);
}

/*
 * HOW IT WORKS — THREE FEATURES
 * CSS Grid with auto-fit creates a responsive grid without
 * media queries. Columns automatically wrap when they'd be
 * narrower than 220px. This is "Intrinsic Design" (Jen Simmons).
 */
.how-it-works {
  padding: var(--space-lg) var(--space-md) var(--space-lg);
  max-width: 900px;
  margin: 0 auto;
}

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.feature {
  text-align: center;
  /* Staggered reveal on scroll (JS adds .visible class) */
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity var(--transition-slow),
    transform var(--transition-slow);
}

.feature.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Delay each feature for staggered effect */
.feature:nth-child(2) { transition-delay: 150ms; }
.feature:nth-child(3) { transition-delay: 300ms; }

.feature-marker {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  margin: 0 auto var(--space-sm);
  opacity: 0.6;
}

.feature h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.feature p {
  font-size: 0.92rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

/*
 * FOOTER
 */
footer {
  text-align: center;
  padding: var(--space-md);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  opacity: 0.5;
}

/*
 * RESPONSIVE ADJUSTMENTS
 * Mobile-First design: base styles are mobile, then we adjust up.
 * But with fluid typography (clamp) and intrinsic grid (auto-fit),
 * we only need one breakpoint for the form layout.
 */
@media (max-width: 720px) {
  .features {
    grid-template-columns: 1fr;
    gap: var(--space-md);
    max-width: 360px;
    margin: 0 auto;
  }
}

@media (max-width: 520px) {
  .form-group {
    flex-direction: column;
  }

  .form-group button {
    padding: 0.95rem;
  }

  .hero {
    min-height: 90vh;
    padding: var(--space-md) var(--space-sm);
  }

  .wordmark {
    margin-bottom: var(--space-md);
  }
}

/*
 * REDUCED MOTION
 * Accessibility: respects the user's OS-level preference
 * for reduced motion. This is "Progressive Enhancement" for a11y.
 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .glow-ring {
    opacity: 0.3;
  }

  .feature {
    opacity: 1;
    transform: none;
  }
}
