/* Lambi — lambi.app
 *
 * Layers on shared/design-system/css/tokens.css (copied from Krateo, which has
 * been serving krateomoney.com). Same skeleton, different voice: Krateo's
 * accent is #534AB7; Lambi takes the app's own electric violet #7C4DFF, so the
 * two sites read as siblings rather than clones.
 *
 * Accessibility is a merge gate here, not a polish pass:
 *   - foreground/background pairs meet WCAG AA (4.5:1 for body text)
 *   - focus is always visible, never removed
 *   - interactive targets are >= 44px
 *   - text sizes in rem, so the user's setting scales the page
 *   - respects prefers-reduced-motion and prefers-color-scheme
 */

:root {
  /* From the app's brand token (src/constants/tokens.ts).
     Text uses #6A3FE0 rather than the app's #7C4DFF. Measured, not assumed:
       #7C4DFF on #FFFFFF -> 4.81:1  passes
       #7C4DFF on #FBFAFF -> 4.63:1  passes
       #7C4DFF on #F1EAFF -> 4.12:1  FAILS
     The tint is exactly where the accent gets used (hero badge, step numbers),
     so testing only against white would have shipped a failing pair. #6A3FE0
     clears every surface; #7C4DFF stays for fills and the focus ring, which
     are held to 3:1. Both cases are pinned in check-contrast.mjs. */
  --lambi-violet: #7C4DFF;
  --lambi-violet-text: #6A3FE0;
  --lambi-violet-deep: #4E2EB8;
  --lambi-violet-tint: #F1EAFF;

  --accent-600: var(--lambi-violet);
  --accent-text: var(--lambi-violet-text);
  --accent-on-600: #FFFFFF;

  --measure: 68ch;
  --page-max: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #1B1A26;
    --bg-secondary: #141320;
    --bg-tertiary: #0E0D16;
    --text-primary: #F3F1FA;
    --text-secondary: #C3BDD8;
    --text-tertiary: #A39CB8;
    --border-tertiary: rgba(255, 255, 255, 0.10);
    --border-secondary: rgba(255, 255, 255, 0.20);
    --surface-glass: rgba(27, 26, 38, 0.88);
    --surface-raised: rgba(34, 32, 48, 0.94);
    /* On dark the deep violet disappears — go lighter, not darker. */
    --accent-text: #C3A9FF;
    --lambi-violet-tint: rgba(124, 77, 255, 0.14);
  }
}

/* ---------------------------------------------------------------- base */

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-voice); line-height: 1.2; }
p { max-width: var(--measure); }

a { color: var(--accent-text); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--accent-600);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

/* Hidden until focused — the first stop for a keyboard user. */
.skip-link {
  position: absolute; left: var(--space-md); top: -100%;
  z-index: 100; padding: var(--space-sm) var(--space-md);
  background: var(--bg-primary); color: var(--accent-text);
  border: 2px solid var(--accent-600); border-radius: var(--radius-md);
}
.skip-link:focus { top: var(--space-md); }

/* ---------------------------------------------------------------- header */

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-tertiary);
}

.nav {
  max-width: var(--page-max); margin: 0 auto;
  padding: var(--space-sm) var(--space-md);
  display: flex; align-items: center; gap: var(--space-md);
  flex-wrap: wrap;
}

.nav__brand {
  display: inline-flex; align-items: center; gap: var(--space-sm);
  font-family: var(--font-voice); font-size: 1.25rem; font-weight: 600;
  color: var(--text-primary); text-decoration: none;
  min-height: 44px;
}

/* Placeholder mark until a real logo exists. A spiral reads as both cycle and
   shell — "lambi" is the conch in French Caribbean. Swap for the final asset. */
.nav__mark {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  background:
    conic-gradient(from 210deg, var(--lambi-violet), var(--lambi-violet-deep) 65%, transparent 66%),
    var(--lambi-violet-tint);
}

.nav__links {
  display: flex; gap: var(--space-md); list-style: none;
  margin: 0; padding: 0; margin-inline-start: auto;
}
.nav__links a {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--text-secondary); text-decoration: none;
}
.nav__links a:hover { color: var(--text-primary); text-decoration: underline; }

/* ---------------------------------------------------------------- language switcher */

.nav__lang { position: relative; }
.nav__lang summary {
  list-style: none; cursor: pointer;
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-secondary); border-radius: var(--radius-pill);
  padding-inline: var(--space-sm);
}
.nav__lang summary::-webkit-details-marker { display: none; }

.nav__dropdown-menu {
  position: absolute; inset-inline-end: 0; margin-top: var(--space-xs);
  background: var(--surface-raised); border: 1px solid var(--border-secondary);
  border-radius: var(--radius-lg); padding: var(--space-xs);
  list-style: none; min-width: 220px;
  box-shadow: 0 12px 32px rgba(20, 16, 40, 0.18);
}
/* At ~90 languages a flat list runs off the screen; cap it and scroll. */
.nav__dropdown-menu--scroll { max-height: min(60vh, 420px); overflow-y: auto; }
.nav__dropdown-menu a {
  display: flex; align-items: center; gap: var(--space-sm);
  min-height: 44px; padding-inline: var(--space-sm);
  border-radius: var(--radius-md);
  color: var(--text-primary); text-decoration: none;
}
.nav__dropdown-menu a:hover { background: var(--bg-tertiary); }

/* ---------------------------------------------------------------- layout */

.hero, .section, .page-head, .waitlist, .footer__inner {
  max-width: var(--page-max); margin: 0 auto;
  padding: var(--space-xl2) var(--space-md);
}

.hero__status {
  display: inline-block; margin: 0 0 var(--space-md);
  padding: var(--space-xs) var(--space-md);
  background: var(--lambi-violet-tint); color: var(--accent-text);
  border-radius: var(--radius-pill); font-size: 0.875rem;
}
.hero__title { font-size: clamp(2.25rem, 6vw, 4rem); margin: 0 0 var(--space-md); }
.hero__lede { font-size: clamp(1.125rem, 2.2vw, 1.375rem); color: var(--text-secondary); }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-md); margin-top: var(--space-xl); }

.section--alt { background: var(--bg-secondary); max-width: none; }
.section--alt > * { max-width: var(--page-max); margin-inline: auto; }
.section__title { font-size: clamp(1.75rem, 4vw, 2.5rem); margin: 0 0 var(--space-lg); }
.section__lede { font-size: 1.125rem; color: var(--text-secondary); }

.page-head { padding-bottom: var(--space-lg); }
.page-head h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 var(--space-md); }
.page-head__lede { font-size: 1.125rem; color: var(--text-secondary); }

.cards {
  display: grid; gap: var(--space-lg);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
.card {
  background: var(--bg-secondary); border: 1px solid var(--border-tertiary);
  border-radius: var(--radius-xl); padding: var(--space-lg);
}
.card__title { font-size: 1.25rem; margin: 0 0 var(--space-sm); }
.card p { color: var(--text-secondary); margin: 0; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-xl); counter-reset: step; }
.step { counter-increment: step; padding-inline-start: calc(var(--space-xl) + var(--space-md)); position: relative; }
.step::before {
  content: counter(step);
  position: absolute; inset-inline-start: 0; top: 0;
  width: var(--space-xl); height: var(--space-xl);
  display: grid; place-items: center;
  background: var(--lambi-violet-tint); color: var(--accent-text);
  border-radius: 50%; font-family: var(--font-voice); font-size: 1.125rem;
}
.step__title { font-size: 1.375rem; margin: 0 0 var(--space-sm); }
.step p { color: var(--text-secondary); }

.notice {
  margin-top: var(--space-xl); padding: var(--space-lg);
  border-inline-start: 4px solid var(--accent-600);
  background: var(--bg-secondary); border-radius: var(--radius-lg);
}
.notice__title { font-size: 1.125rem; margin: 0 0 var(--space-sm); }

/* ---------------------------------------------------------------- buttons + form */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-pill); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; border: 2px solid transparent;
}
.btn--primary { background: var(--lambi-violet-deep); color: #FFFFFF; }
.btn--primary:hover { background: var(--accent-600); }
.btn--ghost { border-color: var(--border-secondary); color: var(--text-primary); }
.btn--ghost:hover { border-color: var(--accent-600); }

.waitlist { border-top: 1px solid var(--border-tertiary); }
.waitlist__form { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin: var(--space-lg) 0 var(--space-sm); }
.waitlist__input {
  flex: 1 1 260px; min-height: 44px; padding: var(--space-sm) var(--space-md);
  font: inherit; color: var(--text-primary); background: var(--bg-primary);
  border: 1px solid var(--border-secondary); border-radius: var(--radius-pill);
}
.waitlist__consent { font-size: 0.875rem; color: var(--text-tertiary); }

/* A standalone call-to-action, so it carries the 44px target (rule 16c) even
   though it is styled as a link. Measured at 76x21 on a 375px viewport before
   this; WCAG's "inline in a sentence" exception does not apply to a link that
   sits alone as the next step. Links inside running prose — the consent line
   under the waitlist form — keep the exception and stay inline. */
.link-arrow {
  display: inline-flex; align-items: center;
  min-height: 44px; font-weight: 600;
}
.link-arrow::after { content: " \2192"; }

/* ---------------------------------------------------------------- footer */

.footer { border-top: 1px solid var(--border-tertiary); background: var(--bg-secondary); }
.footer__links { display: flex; flex-wrap: wrap; gap: var(--space-md); list-style: none; margin: var(--space-md) 0; padding: 0; }
.footer__links a { display: inline-flex; align-items: center; min-height: 44px; }
.footer__made { font-family: var(--font-voice); font-size: 1.125rem; }
.footer__disclaimer { font-size: 0.875rem; color: var(--text-tertiary); max-width: var(--measure); }

/* ---------------------------------------------------------------- motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* The perimenopause card leads deliberately: it is the phase most cycle apps
   abandon their users in, and the one Lambi's honest-uncertainty engine was
   built for. Spans two columns where there is room. */
.card--feature {
  border-color: var(--accent-600);
  background: linear-gradient(var(--lambi-violet-tint), var(--bg-secondary));
}
@media (min-width: 760px) {
  .card--feature { grid-column: span 2; }
}

/* Long-form pages: give prose the same measured rhythm as the cards. */
.prose h2 { font-size: 1.375rem; margin: var(--space-xl) 0 var(--space-sm); }
.prose h2:first-child { margin-top: 0; }
.prose p { color: var(--text-secondary); }
