/* =============================================================================
   CLEARMIND — style.css
   ADHD-friendly landing page: calm palette, clear hierarchy, no clutter.
   Mobile-first. Two breakpoints: 600px, 900px.
============================================================================= */

/* =============================================================================
   1. CUSTOM PROPERTIES
============================================================================= */
:root {
  /* Colours */
  --color-bg:            #F7F9FB;
  --color-surface:       #FFFFFF;
  --color-primary:       #5B9EAD;
  --color-primary-dark:  #407A88;
  --color-accent:        #7DC4A0;
  --color-text-heading:  #1E2D3D;
  --color-text-body:     #4A5568;
  --color-text-muted:    #8896A7;
  --color-border:        #DDE6EF;
  --color-input-bg:      #EEF4F8;
  --color-success:       #4CAF82;
  --color-error:         #C0392B;

  /* Typography */
  --font-family:         'Nunito', system-ui, -apple-system, sans-serif;
  --font-size-base:      1.0625rem;   /* 17px */
  --line-height-body:    1.75;
  --line-height-heading: 1.25;

  /* Spacing */
  --space-xs:   0.5rem;
  --space-sm:   0.875rem;
  --space-md:   1.25rem;
  --space-lg:   2rem;
  --space-xl:   3rem;
  --space-2xl:  5rem;

  /* Shape */
  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-pill: 999px;

  /* Shadow */
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-nav:  0 1px 4px rgba(0, 0, 0, 0.06);
}

/* =============================================================================
   2. RESET
============================================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Ensure [hidden] always wins over display values set by class selectors */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
}

/* =============================================================================
   3. BASE
============================================================================= */
body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
  color: var(--color-text-body);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

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

ul, ol {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

/* =============================================================================
   4. TYPOGRAPHY
============================================================================= */
h1, h2, h3 {
  color: var(--color-text-heading);
  line-height: var(--line-height-heading);
  font-weight: 800;
}

h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.125rem); }
h3 { font-size: 1.125rem; font-weight: 700; }

p {
  color: var(--color-text-body);
}

strong {
  font-weight: 700;
  color: var(--color-text-heading);
}

/* =============================================================================
   5. LAYOUT
============================================================================= */
.container {
  width: 100%;
  padding-inline: var(--space-md);
}

.container--narrow {
  max-width: 660px;
  margin-inline: auto;
}

.container--centered {
  text-align: center;
}

.section {
  padding-block: var(--space-2xl);
}

.section--alt {
  background-color: var(--color-surface);
}

.section--hero {
  background-color: var(--color-surface);
  padding-block-start: calc(var(--space-2xl) + var(--space-lg));
  padding-block-end: var(--space-xl);
}

.section__title {
  margin-bottom: var(--space-sm);
}

.section__intro {
  color: var(--color-text-muted);
  font-size: 1.0625rem;
  margin-bottom: var(--space-xl);
  max-width: 560px;
}

/* =============================================================================
   6. BUTTONS
============================================================================= */
.btn {
  display: inline-block;
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.875rem 1.75rem;
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
  text-align: center;
  white-space: nowrap;
}

.btn--primary {
  background-color: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background-color: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.btn--small {
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
}

.btn--full {
  width: 100%;
  display: block;
  padding-block: 1rem;
  font-size: 1.0625rem;
}

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

/* =============================================================================
   7. FORMS
============================================================================= */
.signup-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

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

.form-field label {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-text-heading);
}

.form-field input {
  font-family: var(--font-family);
  font-size: 1rem;
  padding: 0.8125rem 1rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-border);
  background-color: var(--color-input-bg);
  color: var(--color-text-heading);
  transition: border-color 0.15s ease;
  width: 100%;
}

.form-field input::placeholder {
  color: var(--color-text-muted);
}

.form-field input:focus {
  outline: none;
  border-color: var(--color-primary);
  background-color: var(--color-surface);
}

.form-field input[aria-invalid="true"] {
  border-color: var(--color-error);
}

.field-error {
  font-size: 0.875rem;
  color: var(--color-error);
  font-weight: 600;
}

.form__note {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: calc(var(--space-xs) * -0.5);
}

/* Loading state — applied to submit button while API request is in-flight */
.btn--loading {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Form-level error (network / server errors) */
.form-error {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-error);
  background-color: #fdf3f2;
  border: 1px solid #f5c6c2;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  text-align: center;
}

/* Success state */
.signup-success {
  background-color: var(--color-input-bg);
  border: 2px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
}

.signup-success__icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: var(--space-sm);
}

.signup-success__title {
  margin-bottom: var(--space-xs);
  color: var(--color-text-heading);
}

.signup-success__msg {
  color: var(--color-text-body);
  margin-bottom: var(--space-xs);
}

.signup-success__note {
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

/* =============================================================================
   8. NAV
============================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-surface);
  box-shadow: var(--shadow-nav);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-md);
  max-width: 960px;
  margin-inline: auto;
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 1.1875rem;
  font-weight: 800;
  color: var(--color-text-heading);
}

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

.nav__actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* Ghost button (used in nav + modal) */
.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  background: var(--color-input-bg);
  color: var(--color-text-heading);
  border-color: var(--color-text-muted);
}

/* =============================================================================
   LOGIN MODAL
============================================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(30, 45, 61, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  backdrop-filter: blur(2px);
}

.modal-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  padding: 2.25rem 2rem;
  width: 100%;
  max-width: 420px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: none;
  background: var(--color-input-bg);
  color: var(--color-text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: var(--color-border);
  color: var(--color-text-heading);
}

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

.modal-title {
  font-size: 1.25rem;
  color: var(--color-text-heading);
  margin-bottom: 0.375rem;
  padding-right: 2rem; /* don't overlap close button */
}

.modal-intro {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.modal-success-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: var(--space-sm);
}

.modal-state { display: none; }
.modal-state.is-active { display: block; }

/* OTP boxes */
.otp-fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.otp-legend {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-text-heading);
  margin-bottom: var(--space-sm);
  display: block;
}

.otp-boxes {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: var(--space-xs);
}

.otp-box {
  width: 3.25rem;
  height: 3.75rem;
  font-family: var(--font-family);
  font-size: 1.75rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  color: var(--color-text-heading);
  background: var(--color-input-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease;
  caret-color: var(--color-primary);
}

.otp-box:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-surface);
}

.otp-box.is-error {
  border-color: var(--color-error);
}

.otp-error {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-error);
  text-align: center;
  margin-top: var(--space-xs);
}

/* =============================================================================
   9. HERO
============================================================================= */
.hero__badge {
  display: inline-block;
  background-color: var(--color-accent);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-pill);
  margin-bottom: var(--space-md);
}

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

.hero__subtext {
  font-size: 1.125rem;
  color: var(--color-text-body);
  margin-bottom: var(--space-xl);
  max-width: 520px;
}

.signup-wrap {
  max-width: 480px;
}

/* =============================================================================
   10. CARDS (shared base)
============================================================================= */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.card {
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  border-left: 4px solid var(--color-primary);
}

/* Pain cards — on --alt section so bg is the page colour */
.section--alt .card {
  background-color: var(--color-bg);
}

.card__icon {
  font-size: 1.75rem;
  display: block;
  margin-bottom: var(--space-sm);
}

.card__title {
  margin-bottom: var(--space-xs);
}

.card p {
  font-size: 0.9375rem;
  color: var(--color-text-body);
}

/* =============================================================================
   11. HOW IT WORKS
============================================================================= */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.step__number {
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background-color: var(--color-primary);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step__title {
  margin-bottom: var(--space-xs);
}

.step__body p {
  font-size: 0.9375rem;
  color: var(--color-text-body);
}

/* =============================================================================
   12. FEATURES
============================================================================= */
.feature-card {
  border-left-color: var(--color-accent);
}

/* =============================================================================
   13. WHO IT'S FOR
============================================================================= */
.who__icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: var(--space-md);
}

.container--centered p {
  margin-bottom: var(--space-md);
}

.container--centered p:last-child {
  margin-bottom: 0;
}

.who__cta-line {
  font-size: 1.125rem;
  color: var(--color-text-heading);
}

/* =============================================================================
   14. FOOTER
============================================================================= */
.footer {
  background-color: var(--color-text-heading);
  color: #fff;
  padding-block: var(--space-xl);
  text-align: center;
}

.footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.footer__brand {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.footer__tagline {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9375rem;
}

.footer__copy {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.875rem;
}

/* =============================================================================
   15. RESPONSIVE — tablet ≥ 600px
============================================================================= */
@media (min-width: 600px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =============================================================================
   16. RESPONSIVE — desktop ≥ 900px
============================================================================= */
@media (min-width: 900px) {
  .container {
    max-width: 960px;
    margin-inline: auto;
  }

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

  .feature-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

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

  html {
    scroll-behavior: auto;
  }
}
