/* MathMind beta preview, design checkpoint, not production CSS.
   Tokens mirror app/src/design + app/src/constants/colors.ts. */

@font-face {
  font-family: 'Rubik';
  src: url('assets/fonts/Rubik_400Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Rubik';
  src: url('assets/fonts/Rubik_500Medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Rubik';
  src: url('assets/fonts/Rubik_600SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Rubik';
  src: url('assets/fonts/Rubik_700Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Rubik';
  src: url('assets/fonts/Rubik_900Black.ttf') format('truetype');
  font-weight: 900;
  font-display: swap;
}

:root {
  /* colors, app/src/constants/colors.ts */
  --color-primary: #4F46E5;
  --color-primary-dark: #4338CA;
  --color-accent: #F59E0B;
  --color-bg-cream: #FFF8EE;
  --color-surface: #FFFFFF;
  --color-surface-dim: #F8F2FA;
  --color-text-primary: #1A1008;
  --color-text-secondary: #494551;
  --color-text-muted: #6B7280;
  --color-border: #E9E3F0;
  --color-border-focus: #4F46E5;
  --color-error: #EF4444;

  /* glass, app/src/design/glass.ts (Material.L2) */
  --glass-fill: rgba(255, 255, 255, 0.62);
  --glass-rim: rgba(255, 255, 255, 0.60);
  --glass-shadow: rgba(26, 16, 8, 0.10);
  --shadow-purple: rgba(79, 70, 229, 0.18);

  /* spacing, app/src/design/tokens.ts (Space) */
  --space-xxs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 20px;
  --space-xl: 24px;
  --space-xxl: 32px;
  --space-xxxl: 40px;

  /* radius, app/src/design/tokens.ts (Radius) */
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* motion, app/src/design/motion.ts (Motion) */
  --motion-press: 100ms;
  --motion-crossfade: 180ms;
  --motion-standard: 220ms;
  --motion-soft: 320ms;
  --motion-achievement: 420ms;

  --touch-min: 44px;
  --button-height: 52px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Rubik', sans-serif;
  color: var(--color-text-primary);
  background: var(--color-bg-cream);
  line-height: 1.5;
}

h1, h2, h3, p, ol, ul, legend, fieldset {
  margin: 0;
  padding: 0;
}

fieldset {
  border: none;
}

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

a {
  color: inherit;
}

/* Robust hidden-attribute rule: several component classes below set their
   own `display`, which otherwise beats the user-agent [hidden] rule at
   equal specificity. This keeps hidden="" authoritative everywhere. */
[hidden] {
  display: none !important;
}

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

/* Honeypot field: off-screen, not display:none, so simple bots that only
   check CSS display/visibility still find and fill it. Real users never
   see or reach it (aria-hidden, tabindex -1, no visual placement). */
.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ─── Preview badge ───────────────────────────────────────────────── */

.preview-badge {
  position: fixed;
  top: var(--space-sm);
  right: var(--space-sm);
  z-index: 50;
  margin: 0;
  padding: var(--space-xxs) var(--space-sm);
  background: rgba(26, 16, 8, 0.78);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

/* ─── Shared primitives ───────────────────────────────────────────── */

.glass-card {
  background: var(--glass-fill);
  border: 1px solid var(--glass-rim);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 22px var(--glass-shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.section-title {
  font-size: clamp(20px, 4vw, 24px);
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--space-xl);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: var(--button-height);
  padding: 0 var(--space-xl);
  border-radius: var(--radius-md);
  border: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--motion-press) ease-in, box-shadow var(--motion-press) ease-in, opacity var(--motion-press) ease-in;
}

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

.button--primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #FFFFFF;
  box-shadow: 0 6px 18px var(--shadow-purple);
}

.button--ghost {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}

/* ─── Hero ─────────────────────────────────────────────────────────── */

.hero {
  position: relative;
  overflow: hidden;
  padding: var(--space-xxxl) var(--space-lg) var(--space-xxl);
  text-align: center;
}

.hero__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  z-index: 0;
}

.hero__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 248, 238, 0.10) 0%, rgba(255, 248, 238, 0.86) 78%, var(--color-bg-cream) 100%);
  z-index: 1;
}

.hero__content {
  position: relative;
  z-index: 2;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero__content > * {
  opacity: 0;
  transform: translateY(14px);
  animation: fadeUp var(--motion-achievement) ease-out forwards;
}

.hero__wordmark { animation-delay: 40ms; }
.hero__team { animation-delay: 110ms; }
.hero__heading { animation-delay: 180ms; }
.hero__body { animation-delay: 250ms; }
.hero__cta { animation-delay: 320ms; }

.hero__wordmark {
  font-family: 'Rubik', sans-serif;
  font-weight: 900;
  font-size: clamp(32px, 9vw, 44px);
  letter-spacing: -0.8px;
  color: var(--color-primary);
  margin: 0 0 var(--space-sm);
}

.hero__team {
  width: min(68%, 300px);
  height: auto;
  object-fit: contain;
  margin: 0 auto var(--space-md);
  animation-name: fadeUp, floatY;
  animation-duration: var(--motion-achievement), 6s;
  animation-timing-function: ease-out, ease-in-out;
  animation-iteration-count: 1, infinite;
  animation-delay: 110ms, 530ms;
  animation-fill-mode: forwards, none;
}

.hero__heading {
  font-size: clamp(22px, 5.5vw, 28px);
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: var(--space-md);
}

.hero__body {
  font-size: 16px;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xl);
}

.hero__cta {
  width: 100%;
  max-width: 320px;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ─── How it works ─────────────────────────────────────────────────── */

.how {
  padding: var(--space-xxl) var(--space-lg);
  max-width: 480px;
  margin: 0 auto;
}

.how__steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.how__step {
  padding: var(--space-lg);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--motion-soft) ease-out, transform var(--motion-soft) ease-out;
}

.how__step.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.how__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: var(--space-sm);
}

.how__step h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.how__step p {
  font-size: 14px;
  color: var(--color-text-secondary);
}

/* ─── Signup ───────────────────────────────────────────────────────── */

.signup {
  padding: var(--space-xxl) var(--space-lg) var(--space-xxxl);
  max-width: 480px;
  margin: 0 auto;
}

.signup__note {
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-lg);
}

.form-shell {
  padding: var(--space-xl) var(--space-lg);
}

.form-privacy-note {
  font-size: 13px;
  line-height: 1.6;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-md);
}

.form-privacy-note a {
  color: var(--color-primary);
}

.privacy-page {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-xxl) var(--space-lg) var(--space-xxxl);
}

.privacy-page .section-title {
  margin-bottom: var(--space-sm);
}

.privacy-page__updated {
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xl);
}

.privacy-page__section {
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.privacy-page__section h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.privacy-page__section p {
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-sm);
}

.privacy-page__section p:last-child {
  margin-bottom: 0;
}

.privacy-page__section ul {
  margin: 0 0 var(--space-sm);
  padding-inline-start: var(--space-lg);
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.privacy-page__section ul:last-child {
  margin-bottom: 0;
}

.privacy-page__section a {
  color: var(--color-primary);
}

.stepper {
  list-style: none;
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.stepper__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xxs);
  font-size: 12px;
  color: var(--color-text-muted);
  flex: 1;
}

.stepper__dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-dim);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-weight: 700;
  font-size: 13px;
  transition: background var(--motion-standard) ease-in-out, color var(--motion-standard) ease-in-out, border-color var(--motion-standard) ease-in-out;
}

.stepper__item.is-active {
  color: var(--color-primary);
}

.stepper__item.is-active .stepper__dot {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #FFFFFF;
}

.stepper__item.is-done .stepper__dot {
  background: var(--color-surface);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.form-step {
  display: none;
}

.form-step.is-active {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  animation: fadeStep var(--motion-crossfade) ease-out;
}

@keyframes fadeStep {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-step legend {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xxs);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.field input,
.field select {
  font-family: inherit;
  font-size: 16px;
  color: var(--color-text-primary);
  min-height: var(--touch-min);
  padding: 0 var(--space-md);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  transition: border-color var(--motion-standard) ease-in-out, box-shadow var(--motion-standard) ease-in-out;
}

.field input:focus,
.field select:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px var(--shadow-purple);
  outline: none;
}

.field input:invalid:not(:placeholder-shown) {
  border-color: var(--color-error);
}

.radio-group {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-xxs);
}

.radio-chip {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-min);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background var(--motion-standard) ease-in-out, border-color var(--motion-standard) ease-in-out, color var(--motion-standard) ease-in-out;
}

.radio-chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.radio-chip:has(input:checked) {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #FFFFFF;
}

.radio-chip:has(input:focus-visible) {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 14px;
  color: var(--color-text-secondary);
  min-height: var(--touch-min);
}

.checkbox-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--color-primary);
}

.form-nav {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.form-nav .button {
  flex: 1;
}

.form-status {
  margin-top: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  background: var(--color-surface-dim);
  color: var(--color-text-secondary);
}

.form-status--error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-error);
}

.form-success {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  animation: fadeUp var(--motion-achievement) ease-out;
}

.form-success h3 {
  font-size: 19px;
  font-weight: 700;
}

.form-success p {
  font-size: 14px;
  color: var(--color-text-secondary);
}

.form-closed {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.form-closed h3 {
  font-size: 19px;
  font-weight: 700;
}

.form-closed p {
  font-size: 14px;
  color: var(--color-text-secondary);
}

/* ─── Footer ───────────────────────────────────────────────────────── */

.site-footer {
  padding: var(--space-xl) var(--space-lg) var(--space-xxl);
  text-align: center;
}

.site-footer p {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ─── Responsive ───────────────────────────────────────────────────── */

@media (min-width: 640px) {
  .how__steps {
    flex-direction: row;
  }
  .how__step {
    flex: 1;
  }
}

/* ─── Reduced motion ───────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .hero__content > * {
    opacity: 1;
    transform: none;
  }
}
