/* ════════════════════════════════════════════════════════
   HYMNXHORTATION — main.css
   Design tokens, reset, base typography
   ════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ─────────────────────────────────────── */
:root {
  /* Colour palette */
  --navy:        #0D1B3E;
  --navy-deep:   #080F22;
  --navy-mid:    #122050;
  --gold:        #C8972A;
  --gold-light:  #E8B84B;
  --gold-pale:   #F5E8C0;
  --parchment:   #F5EDD6;
  --parchment-dk:#EDE0C0;
  --cream:       #FDFAF4;
  --ink:         #2C1810;
  --stone:       #7A7267;
  --stone-light: #A09890;
  --white:       #FFFFFF;
  --success:     #2D6A4F;
  --error:       #8B1A1A;

  /* Typography */
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --body:  'EB Garamond', Georgia, 'Times New Roman', serif;
  --ui:    'Inter', system-ui, -apple-system, sans-serif;

  /* Spacing scale (8px base) */
  --s1: 0.5rem;   /* 8px  */
  --s2: 1rem;     /* 16px */
  --s3: 1.5rem;   /* 24px */
  --s4: 2rem;     /* 32px */
  --s5: 3rem;     /* 48px */
  --s6: 4rem;     /* 64px */
  --s7: 5rem;     /* 80px */
  --s8: 6rem;     /* 96px */

  /* Border radius */
  --radius-sm: 2px;
  --radius:    4px;
  --radius-lg: 8px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow:    0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);

  /* Transitions */
  --ease: 0.2s ease;
  --ease-out: 0.3s cubic-bezier(0.16,1,0.3,1);

  /* Layout */
  --max-width: 1200px;
  --nav-h: 64px;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--body);
  background: var(--cream);
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, video { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
a { color: inherit; }
ul, ol { list-style: none; }
input, select, textarea { font-family: inherit; }

/* ── TYPOGRAPHY SCALE ──────────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-family: var(--serif);
  line-height: 1.15;
  color: var(--navy);
}

.text-gold    { color: var(--gold); }
.text-cream   { color: var(--parchment); }
.text-stone   { color: var(--stone); }
.text-center  { text-align: center; }
.text-italic  { font-style: italic; }

/* ── LAYOUT UTILITIES ───────────────────────────────────── */
.section-inner {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--s4);
  box-sizing: border-box;
}

.section {
  padding: var(--s7) var(--s4);
}

.section-label {
  font-family: var(--ui);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-label::after {
  content: '';
  width: 40px;
  height: 1px;
  background: var(--gold);
  opacity: 0.5;
  flex-shrink: 0;
}

.section-title {
  font-size: clamp(1.7rem, 3.5vw, 2.6rem);
  font-weight: 700;
  margin-bottom: 1rem;
}

.section-body {
  font-size: 1.05rem;
  color: var(--stone);
  line-height: 1.85;
  max-width: 600px;
}

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--ui);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.75rem;
  transition: background var(--ease), color var(--ease),
              border-color var(--ease), transform 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--gold);
  color: var(--navy-deep);
}
.btn-primary:hover { background: var(--gold-light); }

.btn-secondary {
  background: transparent;
  color: var(--gold);
  border: 1px solid rgba(200,151,42,0.4);
}
.btn-secondary:hover {
  border-color: var(--gold);
  color: var(--gold-light);
}

.btn-gold {
  background: var(--gold);
  color: var(--navy-deep);
}
.btn-gold:hover { background: var(--gold-light); }

.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--parchment-dk);
}
.btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.btn-dark {
  background: rgba(255,255,255,0.08);
  color: var(--parchment);
  border: 1px solid rgba(200,151,42,0.2);
}
.btn-dark:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(200,151,42,0.4);
}

/* ── FORMS ──────────────────────────────────────────────── */
.email-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  max-width: 480px;
  margin: 0 auto 0.75rem;
}

.email-input {
  flex: 1;
  min-width: 200px;
  font-family: var(--body);
  font-size: 1rem;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--parchment-dk);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  outline: none;
  transition: border-color var(--ease);
}

.email-input:focus { border-color: var(--gold); }
.email-input::placeholder { color: var(--stone-light); font-style: italic; }

.email-dark {
  background: rgba(255,255,255,0.07);
  color: var(--parchment);
  border-color: rgba(200,151,42,0.25);
}
.email-dark:focus { border-color: var(--gold); }
.email-dark::placeholder { color: rgba(245,237,214,0.3); }

.success-msg {
  font-family: var(--body);
  font-size: 0.95rem;
  color: var(--gold-light);
  font-style: italic;
  opacity: 0;
  height: 0;
  overflow: hidden;
  transition: opacity 0.4s, height 0.3s;
}
.success-msg.show { opacity: 1; height: 1.8em; }

/* ── NAVIGATION ─────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  width: 100%;
  max-width: 100vw;
  background: rgba(8,15,34,0.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(200,151,42,0.15);
  height: var(--nav-h);
  /* No overflow:hidden here — it would clip the mobile dropdown */
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--s4);
  height: 100%;
  gap: 1rem;
}

.nav-brand {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.04em;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}

.nav-link {
  font-family: var(--ui);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(245,237,214,0.65);
  background: none;
  border: none;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  transition: color var(--ease), background var(--ease);
}

.nav-link:hover { color: var(--gold-light); background: rgba(200,151,42,0.08); }
.nav-link.active { color: var(--gold); }

.nav-cta {
  font-family: var(--ui);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy-deep);
  background: var(--gold);
  border: none;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: background var(--ease);
}
.nav-cta:hover { background: var(--gold-light); }

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 4px;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--gold);
  border-radius: 1px;
  transition: transform var(--ease);
}

/* ── PAGE FRAME ─────────────────────────────────────────── */
.page {
  display: none;
  min-height: 100vh;
  padding-top: var(--nav-h);
}
.page.active { display: block; }

/* ── FOOTER ─────────────────────────────────────────────── */
.site-footer {
  background: var(--navy-deep);
  border-top: 1px solid rgba(200,151,42,0.1);
  padding: var(--s6) var(--s4) var(--s4);
}

.footer-inner { max-width: var(--max-width); margin: 0 auto; }

.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--s6);
  margin-bottom: var(--s5);
}

.footer-brand {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.4rem;
}

.footer-tagline {
  font-family: var(--body);
  font-style: italic;
  font-size: 0.88rem;
  color: rgba(245,237,214,0.4);
  margin-bottom: 0.75rem;
}

.footer-verse {
  font-family: var(--body);
  font-size: 0.8rem;
  font-style: italic;
  color: rgba(245,237,214,0.25);
  line-height: 1.7;
}

.footer-col-title {
  font-family: var(--ui);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.7;
  margin-bottom: 1rem;
}

.footer-links { display: flex; flex-direction: column; gap: 0.4rem; }

.footer-link {
  font-family: var(--ui);
  font-size: 0.8rem;
  color: rgba(245,237,214,0.38);
  background: none;
  border: none;
  text-align: left;
  padding: 0;
  text-decoration: none;
  transition: color var(--ease);
}
.footer-link:hover { color: var(--gold-light); }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.05);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer-copy, .footer-colophon {
  font-family: var(--ui);
  font-size: 0.7rem;
  color: rgba(245,237,214,0.2);
}

/* ── RESPONSIVE BREAKPOINTS ─────────────────────────────── */
@media (max-width: 1024px) {
  .footer-top { grid-template-columns: 1fr 1fr; gap: var(--s4); }
}

@media (max-width: 768px) {
  :root { --nav-h: 60px; }

  .nav-links {
    display: none;
    position: fixed;
    top: 60px; left: 0; right: 0;
    background: var(--navy-deep);
    flex-direction: column;
    padding: 1.5rem;
    gap: 0.25rem;
    border-bottom: 1px solid rgba(200,151,42,0.15);
  }
  .nav-links.open { display: flex; }
  .nav-link { font-size: 0.85rem; padding: 0.75rem 1rem; }
  .nav-hamburger { display: flex; }
  .nav-cta { font-size: 0.68rem; padding: 0.45rem 0.85rem; }

  .section { padding: var(--s5) var(--s3); }
  .section-inner { padding: 0 var(--s3); }
  .footer-top { grid-template-columns: 1fr 1fr; gap: var(--s3); }
  .email-row { max-width: 100%; }
}

@media (max-width: 480px) {
  .footer-top { grid-template-columns: 1fr; }
  .btn { font-size: 0.72rem; padding: 0.75rem 1.25rem; }
}

/* ════════════════════════════════════════════════════════
   MOBILE RESPONSIVENESS — COMPREHENSIVE FIX v2
   Fixes: horizontal scroll, hero overlap, grid overflow,
   modal cramping, button stacking, footer wrap, and all
   layout issues across mobile and desktop.
   ════════════════════════════════════════════════════════ */

/* ── ROOT: prevent ALL horizontal overflow ───────────────── */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* ── GLOBAL: safe padding on small screens ───────────────── */
@media (max-width: 480px) {
  .section-inner { padding: 0 var(--s2); }
  .section       { padding: var(--s4) var(--s2); }
}

/* ── GRIDS: safe minimum on very small screens ───────────── */
@media (max-width: 400px) {
  .hymn-grid,
  .event-cards,
  .features-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid    { grid-template-columns: 1fr 1fr; }
  .social-grid   { grid-template-columns: 1fr 1fr; }
  .contact-grid  { grid-template-columns: 1fr; }
}

/* ── FOOTER: always wrap on mobile ──────────────────────── */
@media (max-width: 768px) {
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
}

/* ── EMAIL ROW: stack on mobile ─────────────────────────── */
@media (max-width: 520px) {
  .email-row {
    flex-direction: column;
    max-width: 100%;
  }
  .email-input { min-width: 0; width: 100%; }
  .btn-gold    { width: 100%; justify-content: center; }
}
