/* ==========================================================================
   XpandR — Direction D "XpandR Native"
   System fonts. Mobile-first. Dark theme matching the Android app palette.
   ========================================================================== */

/* ─── Design tokens ────────────────────────────────────────────────────────── */
:root {
  /* Colors — exact match to app's XpandRColors class */
  --bg:            #070B11;
  --surface:       #131A23;
  --surface-alt:   #1A222D;
  --primary:       #1BFF8A;   /* neon mint — CTA only */
  --secondary:     #5B8CFF;   /* electric blue — accents, links, focus rings */
  --text:          #F3F7FB;
  --text-muted:    #97A6BA;
  --border:        #243042;
  --error:         #FF5C72;

  /* Typography — system font stack that picks up Roboto on Android */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, ui-sans-serif, system-ui, sans-serif;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  /* Border radii */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  20px;
  --radius-phone: 28px;

  /* Transitions */
  --t-fast: 150ms ease;
  --t-base: 220ms ease;
}

/* ─── Reset ─────────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── Base ──────────────────────────────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: clamp(1rem, 1.1vw + 0.7rem, 1.125rem);
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}

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

a {
  color: var(--secondary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--t-fast);
}

a:hover {
  color: var(--primary);
}

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

ol, ul {
  list-style: none;
}

/* ─── Accessibility utilities ────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.skip-link {
  position: absolute;
  top: -200%;
  left: 1rem;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  z-index: 9999;
  transition: top var(--t-base);
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3rem);
}

.section {
  padding-block: clamp(4rem, 9vw, 8rem);
}

/* ─── Header ─────────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding-block: 1rem;
  background: rgba(7, 11, 17, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: inherit;
}

.logo-mark svg {
  flex-shrink: 0;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}

/* ─── Hero ───────────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: min(92svh, 860px);
  display: flex;
  align-items: center;
  overflow: hidden;
}

/* Radial mint glow — subtle brand atmosphere */
.hero-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 55% at 80% 20%, rgba(27, 255, 138, 0.055) 0%, transparent 65%),
    radial-gradient(ellipse 45% 40% at 15% 75%, rgba(91, 140, 255, 0.04) 0%, transparent 60%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
}

.hero-text {
  max-width: 660px;
}

.hero-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(27, 255, 138, 0.1);
  border: 1px solid rgba(27, 255, 138, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.625rem;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}

.hero-value-prop {
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  color: var(--text-muted);
  max-width: 52ch;
  margin-bottom: var(--space-8);
  line-height: 1.7;
}

/* ─── Signup form (shared by hero + bottom CTA) ───────────────────────────────── */
.form-wrapper {
  max-width: 560px;
}

.signup-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Honeypot — hidden from humans, bots love forms with "website" fields */
.honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
  height: 0;
  overflow: hidden;
}

.form-row {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.form-field {
  flex: 1 1 200px;
}

.form-field input[type="email"] {
  width: 100%;
  padding: 0.8125rem 1rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  -webkit-appearance: none;
  appearance: none;
}

.form-field input[type="email"]::placeholder {
  color: var(--text-muted);
}

.form-field input[type="email"]:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.18);
}

.form-field input[type="email"]:invalid:not(:placeholder-shown) {
  border-color: var(--error);
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8125rem 1.5rem;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  text-decoration: none;
  transition: opacity var(--t-fast), transform var(--t-fast);
  -webkit-appearance: none;
  appearance: none;
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #070B11; /* dark text on neon mint — high contrast */
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.88;
}

/* ─── Consent checkbox ────────────────────────────────────────────────────────── */
.form-consent {
  font-size: 0.875rem;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 0.1em;
  accent-color: var(--primary);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.checkbox-label a {
  color: var(--secondary);
}

/* ─── Form feedback states ──────────────────────────────────────────────────── */
.form-error-msg {
  font-size: 0.875rem;
  color: var(--error);
  display: none; /* shown via JS: el.style.display = 'block' */
  line-height: 1.5;
}

.form-error-msg.is-visible {
  display: block;
}

.form-microcopy {
  font-size: 0.8125rem;
  color: var(--text-muted);
  opacity: 0.7;
}

/* Success state — replaces form content */
.form-success {
  padding: clamp(2rem, 5vw, 3.5rem) 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-success:focus {
  outline: none;
}

.success-icon {
  font-size: 2.5rem;
  color: var(--primary);
  line-height: 1;
}

.success-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.success-body {
  color: var(--text-muted);
  max-width: 44ch;
  line-height: 1.6;
}

/* ─── Section shared ────────────────────────────────────────────────────────── */
.section-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  text-align: center;
  margin-bottom: 0.625rem;
}

.section-subtitle {
  font-size: clamp(1rem, 1.8vw, 1.1rem);
  color: var(--text-muted);
  text-align: center;
  max-width: 55ch;
  margin-inline: auto;
  line-height: 1.65;
  margin-bottom: var(--space-4);
}

/* ─── Features grid ─────────────────────────────────────────────────────────── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 1.25rem;
  margin-top: var(--space-12);
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.625rem;
  transition: border-color var(--t-base), transform var(--t-base);
}

.feature-card:hover {
  border-color: rgba(27, 255, 138, 0.4);
  transform: translateY(-3px);
}

.feature-icon {
  color: var(--primary);
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.65;
}

/* ─── Screenshots ───────────────────────────────────────────────────────────── */
.screenshots {
  background: linear-gradient(180deg, var(--bg) 0%, var(--surface) 30%, var(--surface) 70%, var(--bg) 100%);
}

.screenshots-row {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  align-items: flex-end;
  margin-top: var(--space-12);
  overflow-x: auto;
  padding-block: 1rem;
  padding-inline: 1rem;
  /* Negative margin trick to allow overflow within container */
  margin-inline: calc(-1 * clamp(1.25rem, 5vw, 3rem));
  padding-inline: clamp(1.25rem, 5vw, 3rem);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Middle phone is slightly taller to create depth */
.phone-frame:nth-child(2) {
  transform: scale(1.06);
  z-index: 1;
}

.phone-frame {
  flex-shrink: 0;
  width: clamp(140px, 20vw, 200px);
  aspect-ratio: 9 / 19.5;
  border: 2px solid var(--border);
  border-radius: var(--radius-phone);
  background: var(--surface-alt);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.phone-screen {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(
    45deg,
    var(--surface) 0px,
    var(--surface) 10px,
    var(--surface-alt) 10px,
    var(--surface-alt) 20px
  );
}

.placeholder-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.5;
}

/* ─── How it works ──────────────────────────────────────────────────────────── */
.steps-list {
  max-width: 620px;
  margin-inline: auto;
  margin-top: var(--space-12);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.step {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.step-number {
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  min-width: 3.5rem;
  letter-spacing: -0.04em;
  flex-shrink: 0;
}

.step-content h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.375rem;
  letter-spacing: -0.01em;
}

.step-content p {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.65;
}

/* ─── Bottom CTA ────────────────────────────────────────────────────────────── */
.cta-bottom {
  border-top: 1px solid var(--border);
}

.cta-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.cta-inner .form-wrapper {
  width: 100%;
  margin-top: var(--space-8);
}

.cta-inner .form-row {
  justify-content: center;
}

.cta-inner .form-consent {
  justify-content: center;
}

.cta-inner .form-microcopy {
  text-align: center;
}

/* ─── Footer ────────────────────────────────────────────────────────────────── */
.site-footer {
  padding-block: var(--space-12);
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
}

.footer-nav a {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-decoration: none;
  transition: color var(--t-fast);
}

.footer-nav a:hover {
  color: var(--primary);
}

.footer-copy {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* ─── Legal pages (shared layout) ─────────────────────────────────────────── */
.legal-header {
  padding-block: 2rem;
  border-bottom: 1px solid var(--border);
}

.legal-back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--t-fast);
}

.legal-back:hover {
  color: var(--primary);
}

.legal-content {
  padding-block: clamp(2.5rem, 6vw, 5rem);
  max-width: 720px;
  margin-inline: auto;
}

.legal-content h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.legal-meta {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: var(--space-8);
}

.legal-content h2 {
  font-size: 1.1875rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

.legal-content p {
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 1rem;
}

.legal-content p:last-child {
  margin-bottom: 0;
}

.legal-content ul {
  list-style: disc;
  padding-left: 1.5rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 1rem;
}

.legal-content ul li {
  margin-bottom: 0.375rem;
}

.legal-content a {
  color: var(--secondary);
}

.legal-content strong {
  color: var(--text);
  font-weight: 600;
}

.legal-notice {
  background: rgba(255, 92, 114, 0.08);
  border: 1px solid rgba(255, 92, 114, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: var(--space-8);
  font-size: 0.875rem;
  color: #ffb3bc;
  line-height: 1.6;
}

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

  .feature-card:hover {
    transform: none;
  }

  .phone-frame:nth-child(2) {
    transform: none;
  }
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (min-width: 640px) {
  .form-row {
    flex-wrap: nowrap;
  }
}

@media (min-width: 900px) {
  .how-it-works .steps-list {
    flex-direction: row;
    max-width: 100%;
    align-items: flex-start;
  }

  .step {
    flex-direction: column;
    gap: 0.875rem;
    flex: 1;
  }

  .step-number {
    min-width: unset;
  }
}
