/* Momentum — Phase 0 Styles
   Brand: Navy (#1B2A4A) + Gold (#C5A55A)
   Font: Atkinson Hyperlegible (with system fallback)
   Base: 20px, WCAG AAA contrast
*/

@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('/fonts/atkinson-hyperlegible/AtkinsonHyperlegible-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('/fonts/atkinson-hyperlegible/AtkinsonHyperlegible-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #1B2A4A;
  --navy-dark: #0F1A2E;
  --navy-light: #2D4470;
  --gold: #C5A55A;
  --gold-light: #D4B96E;
  --gold-dark: #A68B3C;
  --white: #FFFFFF;
  --off-white: #F8F7F4;
  --gray-50: #F5F5F5;
  --gray-100: #EEEEEE;
  --gray-200: #DDDDDD;
  --gray-400: #999999;
  --gray-600: #666666;
  --gray-800: #333333;
  --text: #1A1A1A;
  --text-muted: #555555;
  --error: #C53030;
  --error-bg: #FFF5F5;
  --success: #2F855A;
  --success-bg: #F0FFF4;
  --crisis-bg: #FFF8E1;
  --crisis-border: #F9A825;
  --focus: #4A90D9;
  --font: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-size-base: 20px;
  --line-height: 1.6;
  --max-width: 800px;
  --radius: 8px;
  --radius-lg: 12px;
}

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

html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: var(--line-height);
  color: var(--text);
  background: var(--off-white);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Focus styles */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Screen reader only */
.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;
}

/* ===== Header ===== */
.site-header {
  background: var(--navy);
  color: var(--white);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
}

.logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo-img {
  height: 36px;
  width: auto;
  border-radius: 4px;
}

.header-nav {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.header-nav a {
  color: var(--white);
  text-decoration: none;
  font-size: 0.85rem;
  opacity: 0.9;
  transition: opacity 0.15s;
}
.header-nav a:hover { opacity: 1; }

/* ===== Footer ===== */
.site-footer {
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--gray-600);
}
.footer-inner { max-width: var(--max-width); margin: 0 auto; }
.site-footer a { color: var(--gray-600); }

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0.75rem 2rem;
  transition: background 0.15s, transform 0.1s;
  text-align: center;
  min-height: 56px;
  line-height: 1.3;
}

.btn--primary {
  background: var(--gold);
  color: var(--navy-dark);
}
.btn--primary:hover { background: var(--gold-light); }
.btn--primary:active { transform: scale(0.98); }

.btn--secondary {
  background: transparent;
  color: var(--gray-600);
  border: 2px solid var(--gray-200);
}
.btn--secondary:hover { border-color: var(--gray-400); }

.btn--large {
  font-size: 1.1rem;
  padding: 1rem 2.5rem;
  min-height: 60px;
}

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

/* ===== Welcome ===== */
.welcome-hero {
  text-align: center;
  padding: 2rem 0;
}

.welcome-logo {
  width: 120px;
  height: auto;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
}

.welcome-hero h1 {
  font-size: 2.4rem;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.hero-tagline {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.hero-body {
  text-align: left;
  margin-bottom: 2rem;
}
.hero-body p { margin-bottom: 1rem; }

.hero-disclosure {
  font-style: italic;
  color: var(--text-muted);
}

.hero-reassurance {
  list-style: none;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.hero-reassurance li { margin-bottom: 0.4rem; }
.hero-reassurance li::before {
  content: '\2713';
  color: var(--success);
  margin-right: 0.5rem;
  font-weight: 700;
}

/* ===== Auth ===== */
.auth-page {
  text-align: center;
  padding: 3rem 0;
  max-width: 400px;
  margin: 0 auto;
}
.auth-page h1 {
  color: var(--navy);
  margin-bottom: 0.5rem;
}
.auth-page > p { color: var(--text-muted); margin-bottom: 2rem; }

.auth-form { margin-bottom: 2rem; }

.code-input {
  display: block;
  width: 100%;
  font-family: var(--font);
  font-size: 1.5rem;
  text-align: center;
  letter-spacing: 0.15em;
  padding: 1rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  text-transform: uppercase;
}
.code-input:focus {
  border-color: var(--gold);
  outline: none;
  box-shadow: 0 0 0 3px rgba(197, 165, 90, 0.3);
}

.auth-help { font-size: 0.85rem; color: var(--gray-600); }

/* ===== Error & Success Messages ===== */
.error-message {
  background: var(--error-bg);
  color: var(--error);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--error);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.success-message {
  background: var(--success-bg);
  color: var(--success);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--success);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* ===== Onboarding ===== */
.onboarding-page {
  text-align: center;
  padding: 2rem 0;
  max-width: 600px;
  margin: 0 auto;
}
.onboarding-page h1 {
  font-size: 1.5rem;
  color: var(--navy);
  margin-bottom: 0.5rem;
}
.onboarding-subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.progress-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gray-200);
}
.dot--active { background: var(--gold); }
.dot--done { background: var(--navy); }

.onboarding-form { margin-bottom: 1rem; }

.radio-group--vertical {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
  text-align: left;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 56px;
}
.radio-option:hover { border-color: var(--gold); }

.radio-option input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--gold);
  flex-shrink: 0;
}

.radio-option input[type="radio"]:checked + .radio-label {
  font-weight: 700;
}

/* When radio is checked, style the parent */
.radio-option:has(input:checked) {
  border-color: var(--gold);
  background: rgba(197, 165, 90, 0.05);
}

.radio-label { font-size: 1rem; }

.radio-option--with-helper {
  flex-wrap: wrap;
}
.radio-helper {
  width: 100%;
  font-size: 0.8rem;
  color: var(--gray-600);
  margin-left: 2.75rem;
  margin-top: -0.25rem;
}

.reassurance-text {
  font-size: 0.8rem;
  color: var(--gray-400);
  font-style: italic;
  margin-top: 0.75rem;
}

/* Ready page */
.onboarding-ready { padding: 4rem 0; }
.ready-checkmark {
  font-size: 3rem;
  color: var(--success);
  margin-bottom: 1rem;
}
.ready-body {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* ===== Settings ===== */
.settings-page {
  max-width: 600px;
  margin: 0 auto;
}
.settings-page h1 {
  color: var(--navy);
  margin-bottom: 1.5rem;
}

.profile-completeness {
  margin-bottom: 2rem;
  font-size: 0.85rem;
  color: var(--gray-600);
}
.progress-bar {
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  margin-top: 0.5rem;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 4px;
  transition: width 0.3s;
}

.settings-form { display: flex; flex-direction: column; gap: 1.5rem; }

.setting-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  color: var(--navy);
}

.setting-group select,
.setting-group textarea {
  display: block;
  width: 100%;
  font-family: var(--font);
  font-size: 1rem;
  padding: 0.75rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
}
.setting-group select:focus,
.setting-group textarea:focus {
  border-color: var(--gold);
  outline: none;
  box-shadow: 0 0 0 3px rgba(197, 165, 90, 0.3);
}

.field-note {
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-top: 0.25rem;
}

/* ===== Content pages ===== */
.content-page {
  max-width: 700px;
  margin: 0 auto;
}
.content-page h1 {
  color: var(--navy);
  margin-bottom: 1.5rem;
}
.content-page h2 {
  color: var(--navy);
  font-size: 1.3rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}
.content-page h3 {
  color: var(--navy-light);
  font-size: 1.1rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
.content-page p { margin-bottom: 1rem; }
.content-page ul {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}
.content-page li { margin-bottom: 0.5rem; }
.content-page hr {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 2rem 0;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-400);
  padding: 0.25rem;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

.modal-content h2 {
  color: var(--navy);
  margin-bottom: 0.5rem;
}
.modal-subheading {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.modal-content fieldset {
  border: none;
  padding: 0;
  margin: 1rem 0;
}
.modal-content legend {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--navy);
  margin-bottom: 0.75rem;
}

.modal-content hr {
  border: none;
  border-top: 1px solid var(--gray-100);
  margin: 0.5rem 0;
}

.radio-group--horizontal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.radio-group--horizontal .radio-option {
  padding: 0.6rem 1rem;
  min-height: auto;
  font-size: 0.9rem;
}

.select-input {
  display: block;
  width: 100%;
  font-family: var(--font);
  font-size: 1rem;
  padding: 0.75rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
}
.select-input:focus {
  border-color: var(--gold);
  outline: none;
  box-shadow: 0 0 0 3px rgba(197, 165, 90, 0.3);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  :root { --font-size-base: 18px; }

  .header-nav { gap: 0.75rem; }
  .header-nav a { font-size: 0.8rem; }

  .welcome-hero h1 { font-size: 1.8rem; }

  .modal-content {
    padding: 1.5rem;
    border-radius: 0;
    max-height: 100vh;
    height: 100%;
  }
  .modal-overlay { padding: 0; }

  .radio-group--horizontal {
    flex-direction: column;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }
  .modal-actions .btn { width: 100%; }
}

/* ===== Print ===== */
@media print {
  .site-header,
  .site-footer,
  .chat-input-area,
  .starter-prompts,
  .disclosure-banner,
  .print-btn,
  .modal-overlay { display: none !important; }

  body { background: white; }
  main { max-width: 100%; padding: 0; }
}
