/* ═══════════════════════════════════════════════════════
   THAT RAINBOW AGAIN — Global Stylesheet
   thatrainbowagain.org
   ═══════════════════════════════════════════════════════ */

/* ─── CSS VARIABLES ─── */
:root {
  /* Brand Colors */
  --warmth: #E8A838;
  --warmth-soft: #F4C97A;
  --warmth-glow: rgba(232,168,56,0.12);
  --sky: #4A7FA5;
  --sky-deep: #2C5F85;
  --sky-light: #6BA3C7;
  --earth: #3D3229;
  --earth-mid: #5C4A3A;
  --earth-soft: #8B7565;
  --cream: #FBF6EE;
  --cream-warm: #F5EDE0;
  --storm: #6B6259;
  --rain: #9B938A;
  --white: #FFFFFF;

  /* Rainbow Accents */
  --rainbow-1: #D4534A;
  --rainbow-2: #E8A838;
  --rainbow-3: #E8D44D;
  --rainbow-4: #5EA86B;
  --rainbow-5: #4A7FA5;
  --rainbow-6: #7B5EA7;

  /* Functional */
  --success: #5EA86B;
  --warning: #E8A838;
  --danger: #D4534A;
  --info: #4A7FA5;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Layout */
  --max-width: 1100px;
  --content-width: 720px;
  --nav-height: 72px;
  --border-radius: 12px;
  --border-radius-lg: 24px;

  /* Typography Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;
  --text-5xl: 3.5rem;
}

/* ─── HIGH CONTRAST MODE ─── */
body.high-contrast {
  --cream: #FFFFFF;
  --cream-warm: #F0F0F0;
  --earth: #000000;
  --earth-mid: #1a1a1a;
  --earth-soft: #333333;
  --storm: #444444;
  --rain: #666666;
}

/* ─── LARGE PRINT MODE ─── */
body.large-print {
  --text-base: 1.25rem;
  --text-lg: 1.375rem;
  --text-xl: 1.5rem;
  --text-2xl: 1.875rem;
  --text-3xl: 2.5rem;
  --text-4xl: 3rem;
  --text-5xl: 4rem;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 1rem);
}

/* ─── BASE ─── */
body {
  font-family: 'Source Sans 3', -apple-system, sans-serif;
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.8;
  color: var(--earth-mid);
  background: var(--cream);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── ONE-HAND MODE ─── */
body.one-hand-mode {
  --nav-height: 80px;
}

body.one-hand-mode .nav-links {
  gap: 0;
}

body.one-hand-mode .nav-links a,
body.one-hand-mode .nav-links button {
  min-height: 48px;
  min-width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
}

body.one-hand-mode .card,
body.one-hand-mode .btn,
body.one-hand-mode a {
  min-height: 48px;
  min-width: 48px;
}

/* ─── TYPOGRAPHY ─── */
h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--earth);
  line-height: 1.15;
  font-weight: 600;
}

h1 {
  font-size: var(--text-5xl);
  font-weight: 700;
}

h2 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-md);
}

h3 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-sm);
}

h4 {
  font-size: var(--text-xl);
}

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

a {
  color: var(--sky);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--sky-deep);
  text-decoration: underline;
}

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

strong { font-weight: 600; }
em { font-style: italic; }

/* ─── LAYOUT ─── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

.content-narrow {
  max-width: var(--content-width);
  margin: 0 auto;
}

section {
  padding: var(--space-3xl) 0 calc(var(--space-3xl) + 1rem);
}

/* ─── NAVIGATION ─── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--earth);
  z-index: 1000;
  display: flex;
  align-items: center;
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg,
    var(--rainbow-1),
    var(--rainbow-2),
    var(--rainbow-3),
    var(--rainbow-4),
    var(--rainbow-5),
    var(--rainbow-6)
  ) 1;
}

.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-container {
  display: flex;
  align-items: center;
  width: 100%;
  gap: var(--space-sm);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: var(--cream);
  font-family: 'Playfair Display', serif;
  font-size: var(--text-xl);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-brand em {
  color: var(--warmth-soft);
  font-style: italic;
}

.nav-brand:hover {
  text-decoration: none;
  color: var(--cream);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  list-style: none;
  flex: 1;
  justify-content: center;
}

.nav-links a {
  color: rgba(251,246,238,0.7);
  font-size: var(--text-sm);
  font-weight: 400;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--border-radius);
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--cream);
  background: rgba(251,246,238,0.08);
}

.nav-links a.active {
  color: var(--warmth);
}

/* Accessibility toggle in nav */
.nav-a11y-btn {
  background: rgba(251,246,238,0.08);
  border: 1px solid rgba(251,246,238,0.2);
  color: rgba(251,246,238,0.7);
  padding: var(--space-sm) var(--space-lg);
  border-radius: 50px;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-a11y-btn:hover {
  border-color: var(--warmth);
  color: var(--warmth);
  background: rgba(232,168,56,0.1);
}

/* Sign In button in nav */
.nav-login-btn {
  background: rgba(232,168,56,0.15);
  border: 1px solid rgba(232,168,56,0.3);
  color: var(--warmth) !important;
  padding: var(--space-sm) var(--space-lg) !important;
  border-radius: 50px !important;
  font-weight: 600 !important;
  font-size: var(--text-sm) !important;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
}

.nav-login-btn:hover {
  background: var(--warmth) !important;
  color: var(--earth) !important;
  border-color: var(--warmth) !important;
}

/* Mobile hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--cream);
  margin: 5px 0;
  transition: all 0.3s ease;
}

/* Mobile nav */
@media (max-width: 900px) {
  .nav-toggle { display: block; }

  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--earth);
    flex-direction: column;
    padding: var(--space-lg);
    gap: var(--space-xs);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg,
      var(--rainbow-1), var(--rainbow-2), var(--rainbow-3),
      var(--rainbow-4), var(--rainbow-5), var(--rainbow-6)
    ) 1;
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }

  .nav-links a {
    width: 100%;
    padding: var(--space-md);
    font-size: var(--text-lg);
    min-height: 48px;
  }
}

/* Spacer for fixed nav */
.nav-spacer {
  height: var(--nav-height);
}

/* ─── ACCESSIBILITY PANEL ─── */
.a11y-panel {
  display: none;
  position: fixed;
  top: var(--nav-height);
  right: 0;
  background: var(--white);
  border: 1px solid var(--rain);
  border-radius: 0 0 0 var(--border-radius-lg);
  padding: var(--space-lg);
  z-index: 999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  min-width: 240px;
}

.a11y-panel.open { display: block; }

.a11y-panel h4 {
  font-family: 'Source Sans 3', sans-serif;
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--storm);
  margin-bottom: var(--space-md);
}

.a11y-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  font-size: var(--text-sm);
  color: var(--earth-mid);
  min-height: 48px;
}

.a11y-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--rain);
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.a11y-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 0.2s;
}

.a11y-toggle.active {
  background: var(--warmth);
}

.a11y-toggle.active::after {
  transform: translateX(20px);
}

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-family: 'Source Sans 3', sans-serif;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.875rem 2rem;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 48px;
}

.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 3px solid var(--warmth); outline-offset: 2px; }

.btn-primary {
  background: var(--warmth);
  color: var(--earth);
}

.btn-primary:hover {
  background: var(--warmth-soft);
  color: var(--earth);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(232,168,56,0.2);
}

.btn-secondary {
  background: transparent;
  color: var(--earth);
  border: 1.5px solid var(--earth);
}

.btn-secondary:hover {
  background: var(--earth);
  color: var(--cream);
}

.btn-light {
  background: transparent;
  color: var(--cream);
  border: 1.5px solid rgba(251,246,238,0.3);
}

.btn-light:hover {
  border-color: var(--warmth);
  color: var(--warmth);
}

/* ─── CARDS ─── */
.card {
  background: var(--white);
  border: 1px solid rgba(0,0,0,0.04);
  border-radius: var(--border-radius-lg);
  padding: var(--space-2xl);
  transition: all 0.4s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.06);
  border-color: rgba(232,168,56,0.15);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-xl);
}

/* ─── SECTION STYLES ─── */
.section-label {
  font-family: 'Source Sans 3', sans-serif;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--warmth);
  margin-bottom: var(--space-md);
}

.section-dark {
  background: var(--earth);
  color: var(--cream);
}

.section-dark h2,
.section-dark h3 { color: var(--cream); }
.section-dark p { color: rgba(251,246,238,0.75); }
.section-dark .section-label { color: var(--warmth); }

.section-warm {
  background: var(--cream-warm);
}

/* Rainbow top border on sections */
.section-rainbow-top {
  position: relative;
}
.section-rainbow-top::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg,
    var(--rainbow-1), var(--rainbow-2), var(--rainbow-3),
    var(--rainbow-4), var(--rainbow-5), var(--rainbow-6)
  );
}

/* ─── BLOCKQUOTE ─── */
blockquote {
  font-family: 'Playfair Display', serif;
  font-size: var(--text-2xl);
  font-style: italic;
  line-height: 1.6;
  color: var(--earth);
  padding: var(--space-2xl);
  border-left: 4px solid var(--warmth);
  background: var(--warmth-glow);
  border-radius: 0 var(--border-radius-lg) var(--border-radius-lg) 0;
  margin: var(--space-2xl) 0;
}

blockquote cite {
  display: block;
  margin-top: var(--space-lg);
  font-family: 'Source Sans 3', sans-serif;
  font-style: normal;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--warmth);
}

/* ─── CHORUS BLOCK ─── */
.chorus-block {
  padding: var(--space-2xl) var(--space-2xl);
  border-left: 4px solid var(--warmth);
  background: linear-gradient(135deg, var(--warmth-glow) 0%, rgba(232,168,56,0.04) 100%);
  border-radius: 0 var(--border-radius-lg) var(--border-radius-lg) 0;
  margin: var(--space-2xl) 0;
}

.chorus-block p {
  font-family: 'Playfair Display', serif;
  font-size: var(--text-2xl);
  font-style: italic;
  line-height: 2.2;
  color: var(--earth);
  margin-bottom: 0;
}

/* ─── HERO IMAGE ─── */
.hero-image {
  width: 100%;
  height: 280px;
  object-fit: cover;
  border-radius: var(--border-radius-lg);
  margin: var(--space-xl) 0;
}

/* ─── WARM GREETING ─── */
.warm-greeting {
  background: var(--cream-warm);
  border-radius: var(--border-radius-lg);
  padding: var(--space-2xl);
  text-align: center;
  margin-bottom: var(--space-xl);
}

.warm-greeting p {
  font-family: 'Playfair Display', serif;
  font-size: var(--text-xl);
  font-style: italic;
  color: var(--earth);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ─── GENTLE CALLOUT ─── */
.gentle-callout {
  background: var(--cream-warm);
  border-radius: var(--border-radius-lg);
  padding: var(--space-xl) var(--space-2xl);
  display: flex;
  align-items: flex-start;
  gap: var(--space-lg);
  margin: var(--space-xl) 0;
}

.gentle-callout .callout-icon {
  font-size: 28px;
  flex-shrink: 0;
  margin-top: 2px;
}

.gentle-callout p {
  font-size: var(--text-base);
  color: var(--earth-mid);
  margin: 0;
  line-height: 1.7;
}

.gentle-callout strong {
  color: var(--earth);
}

/* ─── FOOTER ─── */
.footer {
  background: var(--earth);
  padding: var(--space-2xl) 0;
  text-align: center;
  border-top: 1px solid rgba(251,246,238,0.06);
}

.footer-rainbow {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-bottom: var(--space-lg);
}

.footer-rainbow span {
  width: 24px;
  height: 3px;
  border-radius: 2px;
}

.footer p {
  font-size: var(--text-sm);
  color: rgba(251,246,238,0.35);
  line-height: 1.8;
}

.footer a {
  color: var(--warmth);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  margin-top: var(--space-md);
  flex-wrap: wrap;
}

.footer-links a {
  font-size: var(--text-xs);
  color: rgba(251,246,238,0.4);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.footer-links a:hover {
  color: var(--warmth);
  text-decoration: none;
}

/* ─── MEDICAL DISCLAIMER BAR ─── */
.disclaimer-bar {
  background: var(--cream-warm);
  padding: var(--space-sm) 0;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--storm);
  border-top: 1px solid rgba(0,0,0,0.06);
}

/* ─── SIGNUP FORM ─── */
.signup-form {
  display: flex;
  gap: 0.75rem;
  max-width: 480px;
  margin: 0 auto;
  flex-wrap: wrap;
  justify-content: center;
}

.signup-form input[type="email"] {
  flex: 1;
  min-width: 250px;
  padding: 0.875rem 1.5rem;
  border-radius: 50px;
  border: 1px solid var(--rain);
  background: var(--white);
  color: var(--earth);
  font-family: 'Source Sans 3', sans-serif;
  font-size: var(--text-base);
  outline: none;
  transition: border-color 0.3s;
  min-height: 48px;
}

.signup-form input[type="email"]:focus {
  border-color: var(--warmth);
  box-shadow: 0 0 0 3px var(--warmth-glow);
}

.signup-form input[type="email"]::placeholder {
  color: var(--rain);
}

/* Dark background variant */
.section-dark .signup-form input[type="email"] {
  border-color: rgba(251,246,238,0.15);
  background: rgba(251,246,238,0.08);
  color: var(--cream);
}

.section-dark .signup-form input[type="email"]::placeholder {
  color: rgba(251,246,238,0.4);
}

.section-dark .signup-form input[type="email"]:focus {
  border-color: var(--warmth);
}

/* ─── UTILITY CLASSES ─── */
.text-center { text-align: center; }
.text-warmth { color: var(--warmth); }
.text-cream { color: var(--cream); }
.text-muted { color: var(--storm); }
.text-small { font-size: var(--text-sm); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

/* ─── SKIP LINK (Accessibility) ─── */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-md);
  background: var(--warmth);
  color: var(--earth);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--border-radius);
  font-weight: 600;
  z-index: 10000;
  transition: top 0.2s;
}

.skip-link:focus {
  top: var(--space-md);
}

/* ─── SCROLL REVEAL ─── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── STORM-TO-RAINBOW HERO PROGRESSION ─── */
/* Each page gets a sky-stage class on its hero section.
   The journey goes from dark storm to bright rainbow. */

.sky-hero {
  position: relative;
  overflow: hidden;
}

.sky-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-size: cover;
  background-position: center;
  z-index: 0;
}

.sky-hero > * {
  position: relative;
  z-index: 1;
}

/* Stage 1: Homepage — Dark storm */
.sky-stage-1::before {
  background-image: url('https://images.unsplash.com/photo-1534088568595-a066f410bcda?w=1600&q=80');
  opacity: 0.18;
}

/* Stage 2: Understanding — Storm with faint glow */
.sky-stage-2::before {
  background-image: url('https://images.unsplash.com/photo-1499346030926-9a72daac6c63?w=1600&q=80');
  opacity: 0.2;
}

/* Stage 3: Recovery — Light breaking through clouds */
.sky-stage-3::before {
  background-image: url('https://images.unsplash.com/photo-1517483000871-1dbf64a6e1c6?w=1600&q=80');
  opacity: 0.22;
}

/* Stage 4: Possibilities — Sun breaking through, golden */
.sky-stage-4::before {
  background-image: url('https://images.unsplash.com/photo-1500382017468-9049fed747ef?w=1600&q=80');
  opacity: 0.25;
}

/* Stage 5: Guides — Warm light, mostly clear */
.sky-stage-5::before {
  background-image: url('https://images.unsplash.com/photo-1465056836900-8f1e940f2114?w=1600&q=80');
  opacity: 0.28;
}

/* Stage 6: Resources — Bright day */
.sky-stage-6::before {
  background-image: url('https://images.unsplash.com/photo-1470252649378-9c29740c9fa8?w=1600&q=80');
  opacity: 0.3;
}

/* Stage 7: Mental Health — Soft golden hope */
.sky-stage-7::before {
  background-image: url('https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=1600&q=80');
  opacity: 0.42;
}

/* Stage 8: Community — Rainbow, bright horizon */
.sky-stage-8::before {
  background-image: url('https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=1600&q=80');
  opacity: 0.4;
}

/* ─── PRINT ─── */
@media print {
  .nav, .footer, .a11y-panel, .skip-link, .nav-spacer { display: none !important; }
  body { background: white; color: black; }
  section { padding: 1rem 0; }
}
