/*
 * New Hope Community Church — Design System Tokens v0.1
 *
 * Source: 04-design/design-system/design-system.md
 * Spec doc: 04-design/design-system/Design-System-v0.pdf
 *
 * This file is the single source of truth for color, type, spacing, radius,
 * and shadow tokens across the rebuild. All mockups in /04-design/moodboard/
 * import this file. When the rebuild ships, this file moves to
 * /10-deploy/css/site.css :root.
 */

/* ---------- Webfonts ---------- */
/*
 * Webfonts are loaded directly by each page in /_pages/*.html via a top-level
 * <link rel="stylesheet" href="https://fonts.googleapis.com/...">, with paired
 * <link rel="preconnect"> hints to fonts.googleapis.com and fonts.gstatic.com.
 *
 * Why not @import here:
 * Browsers can't preload @imported stylesheets. The font fetch only starts
 * after this file finishes downloading, which adds 300-800ms of "flash of
 * unstyled text" where the page paints with system fonts before swapping
 * to Outfit/Manrope/Fraunces. Top-level <link> in the page head lets the
 * browser open the connection in parallel with this file.
 */

/* ---------- Tokens ---------- */

:root {
  /* Brand palette */
  --nh-paper:     #FFFFFF;
  --nh-cream:     #F6F2EC;
  --nh-stone:     #E8E2D8;
  --nh-stone-2:   #CFC7B9;
  --nh-mute:      #6E655D;
  --nh-ink-2:     #2B2522;
  --nh-ink:       #15110F;

  --nh-red:       #B83227;
  --nh-red-deep:  #8A1F17;
  --nh-red-soft:  #D96459;
  /* WCAG-AA-safe red for use on the deep teal band (--nh-teal-deep).
     #D96459 on #1C3F42 = ~2.66:1 (fails AA). #E88B82 on #1C3F42 = ~4.55:1 (passes AA). */
  --nh-red-on-teal: #E88B82;

  --nh-teal:      #2D5B5E;
  --nh-teal-deep: #1C3F42;
  --nh-teal-soft: #D8E3E2;

  /* Semantic tokens (light mode) */
  --bg:           var(--nh-paper);
  --bg-alt:       var(--nh-cream);
  --bg-deep:      var(--nh-ink);
  --fg:           var(--nh-ink);
  --fg-mute:      var(--nh-mute);
  --on-deep:      var(--nh-cream);
  --on-deep-mute: rgba(246, 242, 236, 0.62);
  --line:         rgba(21, 17, 15, 0.10);
  --line-strong:  rgba(21, 17, 15, 0.22);

  /* Typography */
  --font-display:   "Outfit", ui-sans-serif, system-ui, sans-serif;
  --font-body:      "Manrope", ui-sans-serif, system-ui, sans-serif;
  --font-scripture: "Fraunces", ui-serif, Georgia, serif;
  --font-mono:      ui-monospace, "SF Mono", Menlo, monospace;

  /* Spacing scale (multiples of 4) */
  --space-4:  4px;
  --space-8:  8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-24: 24px;
  --space-32: 32px;
  --space-48: 48px;
  --space-64: 64px;
  --space-96: 96px;

  /* Layout */
  --maxw:        1240px;
  --gap:         24px;
  --pad-card:    28px;
  --pad-section: clamp(64px, 9vw, 128px);

  /* Radius */
  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   14px;
  --r-xl:   22px;
  --r-pill: 999px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(21, 17, 15, 0.06), 0 1px 0 rgba(21, 17, 15, 0.04);
  --shadow-md: 0 6px 20px -6px rgba(21, 17, 15, 0.18), 0 2px 6px rgba(21, 17, 15, 0.06);
  --shadow-lg: 0 24px 60px -20px rgba(21, 17, 15, 0.30), 0 8px 20px -10px rgba(21, 17, 15, 0.18);

  /* Type scale (responsive clamp) */
  --t-display: clamp(48px, 6.4vw, 96px);
  --t-h1:      clamp(34px, 3.6vw, 56px);
  --t-h2:      clamp(22px, 2vw, 30px);
  --t-h3:      26px;
  --t-lede:    clamp(17px, 1.25vw, 19px);
  --t-body:    16px;
  --t-caption: 12.5px;
  --t-eyebrow: 11.5px;
}

/* ---------- Reset & base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  font-size: var(--t-body);
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, picture, video, svg { display: block; max-width: 100%; }

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

button { font: inherit; cursor: pointer; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

h1 { font-size: var(--t-display); font-weight: 800; }
h2 { font-size: var(--t-h1); }
h3 { font-size: var(--t-h2); font-weight: 600; }
h4 { font-size: var(--t-h3); font-weight: 600; }

p { margin: 0; }

/* Sitewide guard: long unbreakable words (e.g. a one-word display heading next
   to an image, or a long URL) wrap inside their own box instead of spilling
   over into an adjacent image or column. :where() keeps specificity at 0 so it
   never overrides a component's own wrapping. */
:where(h1, h2, h3, h4, h5, h6, p, li, a, blockquote, figcaption, dd, dt, span, td, th) {
  overflow-wrap: break-word;
}

/* Editorial/series display headings opt OUT of the break-word guard: a tight
   line must drop the WHOLE word to the next line, never break it mid-character
   and orphan a letter (e.g. "DARKNES" / "S"). Hard rule (Andrew 2026-06-09).
   Specificity (0,1,1) beats the :where() guard's (0,0,0) so this wins. */
.series-ed :is(h1, h2, h3) { overflow-wrap: normal; }

/* SITEWIDE: no display heading ever breaks a word mid-character. A heading
   that does not fit drops the whole word to the next line (or, in a genuinely
   too-narrow box, overflows) rather than splitting like "PREPAR / ATION".
   Applies to every h1-h3; same specificity as the guard above but declared
   later, so it wins. Body copy (p, li, etc.) keeps the break-word guard. */
:where(h1, h2, h3) { overflow-wrap: normal; }

/* ---------- Utilities ---------- */

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--space-24);
}

.eyebrow {
  font-family: var(--font-display);
  font-size: var(--t-eyebrow);
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--fg-mute);
  margin: 0 0 var(--space-12);
}

.lede {
  font-size: var(--t-lede);
  line-height: 1.5;
  color: var(--fg-mute);
}

.caption {
  font-size: var(--t-caption);
  font-weight: 500;
  color: var(--fg-mute);
}

.scripture {
  font-family: var(--font-scripture);
  font-style: italic;
  font-weight: 400;
  line-height: 1.4;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  padding: var(--space-12) var(--space-24);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  border: 0;
  border-radius: var(--r-pill);
  transition: background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.btn--primary {
  background: var(--nh-red);
  color: var(--nh-paper);
}
.btn--primary:hover {
  background: var(--nh-red-deep);
  box-shadow: var(--shadow-md);
}

.btn--secondary {
  background: var(--nh-teal);
  color: var(--nh-paper);
}
.btn--secondary:hover {
  background: var(--nh-teal-deep);
  box-shadow: var(--shadow-md);
}

.btn--ghost {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line-strong);
}
.btn--ghost:hover {
  background: var(--nh-stone);
  border-color: var(--nh-ink);
}

.btn--ghost-on-dark {
  background: transparent;
  color: var(--on-deep);
  border: 1px solid rgba(246, 242, 236, 0.40);
}
.btn--ghost-on-dark:hover {
  background: rgba(246, 242, 236, 0.10);
}

.btn--lg {
  padding: var(--space-16) var(--space-32);
  font-size: 15px;
}

/* ---------- Sections ---------- */

.section {
  padding: var(--pad-section) 0;
}
.section--cream {
  background: var(--bg-alt);
}
.section--ink {
  background: var(--bg-deep);
  color: var(--on-deep);
}
.section--ink .eyebrow,
.section--ink .lede {
  color: var(--on-deep-mute);
}

/* ---------- Cards ---------- */

.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--pad-card);
  box-shadow: var(--shadow-sm);
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-link {
  color: inherit;
  text-decoration: none;
  display: block;
}

/* ---------- Hairline divider ---------- */

.hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--space-48) 0;
}

/* ---------- Inline-SVG icon utility ----------
   Sized once here so every page gets the same chevron / play-icon /
   arrow scale without each page re-declaring `.icon` in its inline
   <style>. Previously this rule was duplicated in 16 source-pages
   and missing on 4 others (about, events, our-team, 2026/parables),
   causing nav chevrons and Watch-button play-icons to collapse
   to 0×0 on those pages — the "different fonts/spacing across pages"
   nav drift symptom. */
.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.btn .icon {
  width: 16px;
  height: 16px;
}

/* ---------- Sunday Live mode ---------- */

[data-sunday-mode] .sunday-live { display: block; }
.sunday-live { display: none; }

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Focus indicator (sitewide) ----------
   Keyboard-only focus ring. Mouse clicks won't trigger :focus-visible in modern
   browsers, so this only appears for keyboard / AT users. Uses brand red with
   3px offset so it stays visible against both cream + teal-deep backgrounds. */
:where(a, button, [role="button"], input, select, textarea, summary,
       [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 3px solid var(--nh-red);
  outline-offset: 3px;
  border-radius: 2px;
}
/* On dark / deep-teal contexts the red can sit close to the bg; bump to the
   on-teal variant so it stays visible there too. */
.hero-cinema :where(a, button, [role="button"]):focus-visible,
.hero-live   :where(a, button, [role="button"]):focus-visible,
.mx-local    :where(a, button, [role="button"]):focus-visible,
.leader-band :where(a, button, [role="button"]):focus-visible,
.feature-band :where(a, button, [role="button"]):focus-visible {
  outline-color: var(--nh-red-on-teal);
}

html { scroll-padding-top: 96px; } /* anchors clear sticky header */
