/* ============================================
   GLOBAL STYLES
   Brain & Mind Foundation WordPress Theme
   ============================================
   Design tokens, reset, base styles, utilities,
   scroll reveal animations, and button system.
   ============================================ */

/* ============================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================ */
:root {
  /* Colors — Brand */
  --navy: #111832;
  --navy-mid: #1a2242;
  --navy-light: #232d52;
  --coral: #f5846c;
  --coral-hover: #f7967f;
  --coral-glow: rgba(245, 132, 108, 0.35);
  --gold: #d4a853;
  --gold-soft: rgba(212, 168, 83, 0.15);
  --cream: #f8f6f2;
  --cream-dark: #efe9df;
  --white: #ffffff;

  /* Colors — Text */
  --text-dark: #1e1e2a;
  --text-body: #3d3d4e;
  --text-muted: #6e6e80;
  --text-light: rgba(255,255,255,0.85);
  --text-light-muted: rgba(255,255,255,0.55);

  /* Typography */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Outfit', system-ui, sans-serif;

  /* Easing */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--text-dark);
  background: var(--cream);
  line-height: 1.7;
  overflow-x: hidden;
}

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

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ============================================
   TEXT WRAPPING
   Balance multi-line headings and short display
   lines (biggest win on mobile); pretty-wrap
   body copy to avoid orphans. Progressive
   enhancement — older browsers just ignore it.
   ============================================ */
h1,
h2,
h3,
h4,
h5,
h6,
.hero-tagline,
.section-label,
.about-label,
.stat-label,
.give-option-title,
.interior-hero-label,
.content-image-label,
.page-hero-label {
  text-wrap: balance;
}

p,
li,
dd,
blockquote,
figcaption,
.give-option-desc {
  text-wrap: pretty;
}

/* ============================================
   GRAIN OVERLAY (atmospheric texture)
   ============================================ */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Skip Link — hidden until focused; drops in at the top left. */
.skip-link {
  position: absolute;
  top: -100%;
  left: 24px;
  z-index: 10000;
  padding: 12px 24px;
  background: var(--coral);
  color: var(--white);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 0 0 8px 8px;
  transition: top 0.3s ease;
}
.skip-link:focus {
  top: 0;
}

/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s var(--ease-out-expo), transform 0.9s var(--ease-out-expo);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.9s var(--ease-out-expo), transform 0.9s var(--ease-out-expo);
}
.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.9s var(--ease-out-expo), transform 0.9s var(--ease-out-expo);
}
.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.9s var(--ease-out-expo), transform 0.9s var(--ease-out-expo);
}
.reveal-scale.visible {
  opacity: 1;
  transform: scale(1);
}

/* Reveal delay classes (0.1s through 0.5s) */
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 36px;
  border-radius: 60px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  transition: all 0.4s var(--ease-out-expo);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--coral);
  color: var(--white);
  box-shadow: 0 4px 24px var(--coral-glow), 0 1px 3px rgba(0,0,0,0.1);
}
.btn-primary:hover {
  background: var(--coral-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 40px var(--coral-glow), 0 2px 6px rgba(0,0,0,0.12);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-outline {
  border: 2px solid rgba(255,255,255,0.4);
  color: var(--white);
  backdrop-filter: blur(4px);
}
.btn-outline:hover {
  border-color: var(--white);
  background: rgba(255,255,255,0.08);
  transform: translateY(-2px);
}

.btn-outline-dark {
  border: 2px solid var(--navy);
  color: var(--navy);
}
.btn-outline-dark:hover {
  background: var(--navy);
  color: var(--white);
  transform: translateY(-2px);
}

.btn-white {
  background: var(--white);
  color: var(--coral);
  font-weight: 700;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}
.btn-white:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

.btn-arrow::after {
  content: '\2192';
  transition: transform 0.3s var(--ease-out-expo);
}
.btn-arrow:hover::after {
  transform: translateX(4px);
}

/* ============================================
   SECTION HEADER (shared across sections)
   ============================================ */
.section-header {
  text-align: center;
  margin-bottom: 64px;
}

.section-label {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--coral);
  margin-bottom: 16px;
}

.section-heading {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.5vw, 2.8rem);
  font-weight: 500;
  line-height: 1.2;
}
.section-heading-light {
  color: var(--white);
}
.section-heading-dark {
  color: var(--navy);
}

.section-sub {
  font-size: 1.05rem;
  line-height: 1.8;
  max-width: 580px;
  margin: 16px auto 0;
}
.section-sub-light {
  color: var(--text-light-muted);
}
.section-sub-dark {
  color: var(--text-muted);
}

/* ============================================
   MOBILE FLOATING DONATE BUTTON
   ============================================ */
.mobile-donate {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  transform: translateY(100px);
  z-index: 999;
  padding: 16px 40px;
  background: var(--coral);
  color: var(--white);
  border-radius: 60px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 8px 32px var(--coral-glow), 0 2px 8px rgba(0,0,0,0.2);
  transition: all 0.5s var(--ease-out-expo);
}
.mobile-donate.visible {
  transform: translateY(0);
}
.mobile-donate:hover {
  background: var(--coral-hover);
  box-shadow: 0 12px 40px var(--coral-glow), 0 4px 12px rgba(0,0,0,0.25);
}

@media (max-width: 768px) {
  .mobile-donate {
    display: block;
  }
}

/* ============================================
   SMOOTH SECTION DIVIDER
   ============================================ */
.divider-wave {
  width: 100%;
  overflow: hidden;
  line-height: 0;
  background: var(--cream);
}
.divider-wave svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 3px;
}

@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;
  }
  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    opacity: 1;
    transform: none;
  }
}

/* ============================================
   MOBILE TYPE SCALE
   One consistent hierarchy on phones:
   hero (2rem+) > section headings (~1.7rem)
   > body (1rem) > labels (0.72rem).
   h2-qualified selectors outrank the section
   stylesheets' own clamps regardless of load
   order.
   ============================================ */
@media (max-width: 768px) {
  .section-header {
    margin-bottom: 40px;
  }

  .section-label,
  .about-label {
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    margin-bottom: 12px;
  }

  h2.section-heading,
  h2.about-heading,
  h2.give-heading,
  h2.content-image-heading {
    font-size: clamp(1.6rem, 6.5vw, 1.9rem);
    line-height: 1.25;
  }

  /* CTA banner heading sits half a step above section headings. */
  h2.cta-heading {
    font-size: clamp(1.8rem, 7vw, 2.1rem);
  }

  .section-sub,
  .hero-sub,
  .give-text,
  .cta-sub {
    font-size: 0.98rem;
    line-height: 1.7;
  }
}
