/* ============================================================
   Brainplanner — style.css
   Mobile-first. No accent colour. True dark.
   Breakpoints: 640px (tablet) · 1024px (desktop) · 1280px (wide)
============================================================ */

/* ── Custom Properties ─────────────────────────────────── */
:root {
  /* Palette — mirrors app/src/theme/colors.ts darkColors */
  --c-bg:        #0F0F0F;
  --c-elevated:  #1C1C1D;
  --c-card:      #1C1C1D;
  --c-input:     #373739;
  --c-text:      #FAFAFA;
  --c-secondary: #8e8e93;
  --c-muted:     #636366;
  --c-faint:     #48484A;
  --c-border:    #2C2C2E;
  --c-border-hi: #3A3A3C;
  --c-success:   #32D74B;
  --c-danger:    #FF453A;

  /* Spacing — mirrors app/src/theme/spacing.ts */
  --sp-sm:  8px;
  --sp-md:  12px;
  --sp-lg:  16px;
  --sp-xl:  24px;
  --sp-2xl: 32px;
  --sp-3xl: 48px;
  --sp-4xl: 64px;
  --sp-5xl: 96px;

  /* Layout */
  --page-pad:   24px;
  --content-max: 1140px;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
img, svg { display: block; max-width: 100%; }
button, input { font-family: inherit; }

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-stack, 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  line-height: 1.5;
}

/* ── Keyframes ──────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse-dot {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: 0.3; transform: scale(0.65); }
}

/* ── Hero animation classes ─────────────────────────────── */
.a0 { animation: fadeUp .75s cubic-bezier(.16,1,.3,1) .00s both; }
.a1 { animation: fadeUp .75s cubic-bezier(.16,1,.3,1) .10s both; }
.a2 { animation: fadeUp .75s cubic-bezier(.16,1,.3,1) .22s both; }
.a3 { animation: fadeUp .75s cubic-bezier(.16,1,.3,1) .36s both; }
.a4 { animation: fadeUp .75s cubic-bezier(.16,1,.3,1) .54s both; }

/* ── Scroll reveal ──────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .6s cubic-bezier(.16,1,.3,1),
              transform .6s cubic-bezier(.16,1,.3,1);
}
.reveal.in { opacity: 1; transform: none; }
.reveal-d1 { transition-delay: .12s; }
.reveal-d2 { transition-delay: .24s; }

/* ── Container ──────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

/* ── Brand bar ──────────────────────────────────────────── */
.brand-bar {
  padding: var(--sp-xl) 0 0;
}

.brand-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--c-text);
  display: block;
}

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  padding-top: var(--sp-2xl);
  padding-bottom: var(--sp-5xl);
  position: relative;
  overflow: hidden;
}

/* Subtle dot-grid texture — desktop only (added via media query) */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.035) 1px, transparent 0);
  background-size: 28px 28px;
  pointer-events: none;
  opacity: 0;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3xl);
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xl);
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: 6px 14px;
  background: var(--c-elevated);
  border: 1px solid var(--c-border);
  border-radius: 9999px;
  width: fit-content;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-success);
  animation: pulse-dot 2.5s ease-in-out infinite;
  flex-shrink: 0;
}

.status-text {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--c-muted);
}

/* Headline */
.hero-h1 {
  font-size: clamp(36px, 11vw, 52px);
  font-weight: 900;
  line-height: 1.06;
  letter-spacing: -.035em;
}

.hero-h1 .ghost { color: var(--c-secondary); }

/* Subtitle */
.hero-sub {
  font-size: 17px;
  line-height: 1.65;
  color: var(--c-secondary);
  max-width: 420px;
}

/* CTA group */
.cta-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
  max-width: 420px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  height: 56px;
  padding: 0 28px;
  border-radius: 9999px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.01em;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1),
              background .15s ease,
              border-color .15s ease,
              box-shadow .2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(.96) !important; transition-duration: .08s !important; }

.btn-primary {
  background: var(--c-text);
  color: var(--c-bg);
}

.btn-ghost {
  background: transparent;
  color: var(--c-text);
  border: 1px solid var(--c-border-hi);
}

.btn-full { width: 100%; }

/* ── Phone Mockup ───────────────────────────────────────── */
.hero-mockup {
  display: flex;
  justify-content: center;
  position: relative;
}

.mockup-glow {
  position: absolute;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.045) 0%, transparent 68%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.phone {
  width: 224px;
  height: 448px;
  background: var(--c-elevated);
  border-radius: 44px;
  border: 1.5px solid rgba(255,255,255,.1);
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0,0,0,.6),
    0 40px 80px rgba(0,0,0,.9),
    0 8px 24px rgba(0,0,0,.5);
  animation: breathe 5.5s ease-in-out infinite;
  flex-shrink: 0;
}

/* Dynamic Island */
.di {
  position: absolute;
  top: 13px;
  left: 50%;
  transform: translateX(-50%);
  width: 78px;
  height: 22px;
  background: var(--c-bg);
  border-radius: 9999px;
  z-index: 10;
}

.phone-screen {
  position: absolute;
  inset: 0;
  padding: 46px 14px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.phone-clock {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text);
  letter-spacing: .3px;
  text-align: center;
}

.phone-routine-tag {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--c-muted);
  text-align: center;
  margin-top: 2px;
}

/* Circular timer */
.timer-ring-wrap {
  position: relative;
  width: 142px;
  height: 142px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.timer-svg {
  position: absolute;
  inset: 0;
}

.t-track {
  fill: none;
  stroke: #2C2C2E;
  stroke-width: 7;
}

.t-ring {
  fill: none;
  stroke: var(--c-text);
  stroke-width: 7;
  stroke-linecap: round;
}

.timer-center {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timer-display {
  font-size: 27px;
  font-weight: 200;
  letter-spacing: -1.5px;
  color: var(--c-text);
  line-height: 1;
}

.timer-caption {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--c-muted);
  margin-top: 4px;
}

/* Block list in phone */
.phone-blocks {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
}

.pb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(250,250,250,.04);
  border: 1px solid var(--c-border);
  border-radius: 12px;
}

.pb.pb-active {
  background: rgba(250,250,250,.07);
  border-color: rgba(250,250,250,.16);
}

.pb-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pb-dot-active { background: var(--c-text); animation: pulse-dot 1.6s ease-in-out infinite; }
.pb-dot-idle   { background: var(--c-input); }

.pb-name { flex: 1; font-size: 10px; font-weight: 500; }
.pb-name-active { color: var(--c-text); }
.pb-name-idle   { color: var(--c-secondary); }

.pb-dur { font-size: 9px; color: var(--c-muted); }

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-border) 20%, var(--c-border) 80%, transparent);
  margin: 0;
}

/* ── Section generic ────────────────────────────────────── */
.section-eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--c-muted);
  margin-bottom: var(--sp-lg);
}

.section-h2 {
  font-size: 34px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -.025em;
}

.section-h2 .ghost { color: var(--c-secondary); }

/* ── Benefits ──────────────────────────────────────────── */
.section-benefits {
  padding: var(--sp-5xl) 0;
}

.section-head {
  margin-bottom: var(--sp-2xl);
}

.bcard-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-md);
}

.bcard {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 20px;
  padding: var(--sp-xl);
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
  transition: border-color .2s ease, transform .2s cubic-bezier(.16,1,.3,1);
}

.bcard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bcard-icon {
  width: 38px;
  height: 38px;
  background: var(--c-input);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text);
  flex-shrink: 0;
}

.bcard-pill {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--c-muted);
  padding: 5px 11px;
  background: var(--c-input);
  border-radius: 9999px;
}

.bcard-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.3;
}

.bcard-desc {
  font-size: 14px;
  line-height: 1.65;
  color: var(--c-secondary);
}

/* Mini-UI inside cards */
.mini-ui {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 14px;
  padding: var(--sp-md) var(--sp-lg);
  margin-top: auto;
}

.mini-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--c-muted);
  margin-bottom: 10px;
  display: block;
}

/* Challenge grid */
.challenge-grid {
  display: flex;
  gap: 6px;
}

.chbox {
  flex: 1;
  height: 34px;
  border-radius: 8px;
  background: var(--c-elevated);
  border: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--c-secondary);
}

.chbox.done {
  background: rgba(250,250,250,.07);
  border-color: rgba(250,250,250,.18);
  color: var(--c-text);
}

.chbox.empty { opacity: .3; }

/* Mini block list */
.mini-block {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--c-border);
}

.mini-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.mb-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mb-done   { background: var(--c-success); }
.mb-active { background: var(--c-text); animation: pulse-dot 1.6s ease-in-out infinite; }
.mb-idle   { background: var(--c-border-hi); }

.mb-name { flex: 1; font-size: 12px; font-weight: 500; }
.mb-done-name   { color: var(--c-muted); text-decoration: line-through; }
.mb-active-name { color: var(--c-text); }
.mb-idle-name   { color: var(--c-secondary); }

.mb-time { font-size: 11px; color: var(--c-muted); }

/* Stats bars */
.stats-chart {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bars-row {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  height: 38px;
}

.bar-col {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
}

.bar {
  width: 100%;
  height: 0;
  border-radius: 3px 3px 0 0;
  background: var(--c-text);
  transition: height .75s cubic-bezier(.16,1,.3,1);
}

.bar.dim   { background: rgba(250,250,250,.28); }
.bar.ghost { background: rgba(250,250,250,.1); }

.days-row {
  display: flex;
  gap: 4px;
}

.day-label {
  flex: 1;
  font-size: 9px;
  color: var(--c-muted);
  text-align: center;
}

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(50,215,75,.08);
  border: 1px solid rgba(50,215,75,.2);
  border-radius: 9999px;
  margin-top: 6px;
}

.streak-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-success);
}

/* ── Waitlist ────────────────────────────────────────────── */
.section-waitlist {
  padding: var(--sp-5xl) 0;
}

.wl-card-wrap {
  max-width: 560px;
  margin: 0 auto;
}

.wl-card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 24px;
  padding: var(--sp-2xl) var(--sp-xl);
  display: flex;
  flex-direction: column;
  gap: var(--sp-xl);
}

.wl-h2 {
  font-size: 30px;
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -.025em;
  margin-bottom: 10px;
}

.wl-sub {
  font-size: 14px;
  line-height: 1.65;
  color: var(--c-secondary);
}

.wl-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.wl-form-note {
  font-size: 12px;
  color: var(--c-muted);
  text-align: center;
}

/* ── Modal form fields ─────────────────────────────────── */
.modal-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-secondary);
  letter-spacing: -.01em;
}

.form-req {
  color: var(--c-danger);
  font-size: 12px;
}

.form-optional {
  font-weight: 400;
  color: var(--c-muted);
  font-size: 11px;
}

.input-text {
  height: 48px;
  padding: 0 16px;
  background: var(--c-input);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  color: var(--c-text);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  width: 100%;
  transition: border-color .2s;
  -webkit-appearance: none;
}

.input-text::placeholder { color: var(--c-muted); }
.input-text:focus { border-color: var(--c-border-hi); }
.input-text.error { border-color: var(--c-danger); }

.input-textarea {
  padding: 14px 16px;
  background: var(--c-input);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  color: var(--c-text);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  width: 100%;
  min-height: 120px;
  resize: vertical;
  line-height: 1.55;
  transition: border-color .2s;
  -webkit-appearance: none;
}

.input-textarea::placeholder { color: var(--c-muted); }
.input-textarea:focus { border-color: var(--c-border-hi); }
.input-textarea.error { border-color: var(--c-danger); }

/* Modal success panel */
.modal-success {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-md);
  text-align: center;
  padding: var(--sp-3xl) var(--sp-xl);
}

.modal-success.show { display: flex; }

.input-email {
  height: 52px;
  padding: 0 20px;
  background: var(--c-input);
  border: 1px solid var(--c-border);
  border-radius: 9999px;
  color: var(--c-text);
  font-size: 15px;
  outline: none;
  width: 100%;
  transition: border-color .2s;
  -webkit-appearance: none;
}

.input-email::placeholder { color: var(--c-muted); }
.input-email:focus { border-color: var(--c-border-hi); }
.input-email.error { border-color: var(--c-danger); }

/* Success state */
.wl-success {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-md);
  text-align: center;
  padding: var(--sp-lg) 0;
}

.wl-success.show { display: flex; }

.wl-check {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(50,215,75,.1);
  border: 1px solid rgba(50,215,75,.22);
  display: flex;
  align-items: center;
  justify-content: center;
}

.wl-ok-title {
  font-size: 18px;
  font-weight: 700;
}

.wl-ok-sub {
  font-size: 14px;
  color: var(--c-secondary);
  max-width: 280px;
  line-height: 1.6;
}

/* Error message */
.wl-error-msg {
  font-size: 13px;
  color: var(--c-danger);
  text-align: center;
  display: none;
}

.wl-error-msg.show { display: block; }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--c-border);
  padding: var(--sp-xl) 0 var(--sp-4xl);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 20px;
}

.footer-link {
  font-size: 13px;
  color: var(--c-muted);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 0;
  transition: color .18s;
}

.footer-link:hover { color: var(--c-secondary); }

.footer-copy {
  font-size: 11px;
  color: var(--c-faint);
}

/* ── Privacy modal ──────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: var(--c-bg);
  z-index: 300;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s ease;
  overflow: hidden;
}

.modal.open {
  opacity: 1;
  pointer-events: all;
}

.modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-lg) var(--sp-xl);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  /* on desktop: align items better */
  padding-left: var(--page-pad);
  padding-right: var(--page-pad);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-x {
  width: 32px;
  height: 32px;
  background: var(--c-input);
  border: none;
  border-radius: 50%;
  color: var(--c-text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
}

.modal-x:hover { background: var(--c-border-hi); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--sp-xl) var(--page-pad);
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}

.modal-body h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--c-text);
  margin-top: var(--sp-2xl);
  margin-bottom: 10px;
}

.modal-body h2:first-child { margin-top: 0; }

.modal-body p {
  font-size: 14px;
  line-height: 1.72;
  color: var(--c-secondary);
  margin-bottom: 6px;
}

/* ============================================================
   TABLET — 640px+
============================================================ */
@media (min-width: 640px) {
  :root {
    --page-pad: 36px;
  }

  .hero-h1 { font-size: 64px; }

  .bcard-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .wl-card {
    padding: var(--sp-2xl);
  }

  .modal-top {
    padding-left: var(--sp-xl);
    padding-right: var(--sp-xl);
  }
}

/* ============================================================
   DESKTOP — 1024px+
============================================================ */
@media (min-width: 1024px) {
  :root {
    --page-pad: 48px;
  }

  /* Hero dot-grid texture */
  .hero::before {
    opacity: 1;
  }

  .hero .container {
    max-width: var(--content-max);
  }

  /* 2-column hero */
  .hero-inner {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 80px;
    align-items: center;
  }

  .hero-h1 { font-size: 72px; }

  .hero-sub { font-size: 18px; }

  .cta-group {
    flex-direction: row;
    max-width: none;
  }

  .cta-group .btn { flex: none; width: auto; }
  .cta-group .btn-primary { padding: 0 32px; }
  .cta-group .btn-ghost   { padding: 0 28px; }

  .hero-mockup {
    justify-content: flex-start;
  }

  .phone {
    width: 248px;
    height: 494px;
  }

  /* Benefits 3-col */
  .bcard-list {
    grid-template-columns: repeat(3, 1fr);
  }

  .section-h2 { font-size: 42px; }

  /* Benefit cards hover on desktop */
  .bcard:hover {
    border-color: var(--c-border-hi);
    transform: translateY(-4px);
  }

  /* Buttons hover + lift */
  .btn-primary:hover {
    transform: scale(1.016);
    background: #fff;
    box-shadow: 0 8px 28px rgba(250,250,250,.12);
  }

  .btn-ghost:hover {
    background: var(--c-elevated);
    border-color: var(--c-secondary);
  }

  .wl-card {
    padding: var(--sp-3xl);
  }

  .wl-h2 { font-size: 36px; }

  .footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .footer-copy { margin-top: 0; }
}

/* ============================================================
   WIDE DESKTOP — 1280px+
============================================================ */
@media (min-width: 1280px) {
  :root {
    --page-pad: 64px;
  }

  .hero-inner {
    grid-template-columns: 1fr 340px;
    gap: 100px;
  }

  .hero-h1 { font-size: 80px; }

  .phone {
    width: 264px;
    height: 528px;
  }
}

/* ============================================================
   REDUCED MOTION
============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
