/* ─── v2 SHELL — unified nav (with pledge counter) + bottom sticky CTA ─── */
/* Loaded after styles.css on every page; nav rules here are the source of truth */

:root {
  /* Action + accents — duplicated here so they're always defined regardless of styles.css cache state. Values verified WCAG 2.2 AA. */
  --action:        #c8102e;   /* Old Glory Red family */
  --action-bright: #e63946;
  --action-deep:   #9b0e26;
  --brass-deep:    #735420;
  --civic-navy:        #002868;
  --civic-navy-bright: #4d76a8;
  --civic-navy-deep:   #001845;
}

/* ─── A11Y: Screen-reader-only utility ─── */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ─── A11Y: Skip to main content (WCAG 2.4.1) ─── */
.skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  z-index: 1000;
  background: var(--ink, #0a1428);
  color: var(--bone, #fdf9ee);
  padding: 14px 22px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  border: 2px solid var(--brass-bright, #d4a943);
  border-radius: 4px;
  transition: top 0.12s ease;
}
.skip-link:focus {
  top: 12px;
  outline: 3px solid var(--brass-bright, #d4a943);
  outline-offset: 2px;
}

/* ─── A11Y: Visible focus indicators (WCAG 2.4.7) ─── */
/* Keyboard-only focus ring (modern browsers) */
*:focus-visible {
  outline: 3px solid var(--brass-bright, #d4a943);
  outline-offset: 3px;
  border-radius: 2px;
}
/* Slightly different ring for focus on dark surfaces */
.nav *:focus-visible,
.stop-dark *:focus-visible,
.donors *:focus-visible,
.illusion *:focus-visible,
.pledge *:focus-visible,
.thanks-page *:focus-visible,
.error-page *:focus-visible {
  outline-color: var(--brass-bright, #d4a943);
  box-shadow: 0 0 0 5px rgba(10, 20, 40, 0.85);
}
/* Hide focus ring for mouse interactions where supported */
*:focus:not(:focus-visible) { outline: none; }

/* ─── UNIFIED NAV ─── */
/* Sits at top: 0 always. Dark background. Consistent font sizes across pages. */
nav.nav,
nav.nav.nav-on-dark {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 12px 28px;
  background: rgba(10, 20, 40, 0.92);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid rgba(212, 169, 67, 0.18);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 32px;
  align-items: center;
  min-height: 58px;
}

nav.nav .nav-mark {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 14px;
  font-variation-settings: "SOFT" 30, "opsz" 32;
  color: var(--bone);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
/* Eagle logo (replaces former "T" seal) */
nav.nav .nav-mark .seal,
nav.nav .nav-mark .nav-eagle {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
  display: inline-block;
  /* Faint glow for the brass eagle on dark nav */
  filter: drop-shadow(0 0 8px rgba(212, 169, 67, 0.18));
}
nav.nav .nav-mark:hover .nav-eagle {
  filter: drop-shadow(0 0 12px rgba(212, 169, 67, 0.32));
}
nav.nav .nav-mark em {
  font-style: italic;
  font-weight: 400;
  color: var(--brass-bright);
}

nav.nav .nav-links {
  list-style: none;
  display: flex;
  gap: 28px;
  margin: 0;
  padding: 0;
  justify-self: center;
}
nav.nav .nav-links a {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(250, 244, 230, 0.65);
  text-decoration: none;
  position: relative;
  padding: 4px 0;
  transition: color 0.18s ease;
}
nav.nav .nav-links a:hover,
nav.nav .nav-links a.active { color: var(--brass-bright); }
nav.nav .nav-links a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--brass-bright);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
nav.nav .nav-links a:hover::after,
nav.nav .nav-links a.active::after { transform: scaleX(1); }

/* Right-side cluster: pledge counter + CTA */
nav.nav .nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-self: end;
}
nav.nav .nav-pledge-meter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid rgba(212, 169, 67, 0.28);
  border-radius: 100px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(250, 244, 230, 0.7);
  background: rgba(10, 20, 40, 0.4);
  white-space: nowrap;
}
nav.nav .nav-pledge-dot {
  width: 6px; height: 6px;
  background: var(--action-bright);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--action-bright);
  animation: nav-pulse 1.8s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes nav-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}
nav.nav .nav-pledge-count {
  color: var(--brass-bright);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
nav.nav .nav-pledge-label {
  color: rgba(250, 244, 230, 0.5);
}

nav.nav .nav-cta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  background: var(--action);
  color: var(--bone);
  padding: 12px 20px;
  /* line-height MUST be set explicitly — <button> elements default to `normal`
     (~1.2) instead of inheriting from body like <a> does, which makes button
     variants ~4.5px shorter than link variants of the same class. */
  line-height: 1;
  min-height: 44px;
  text-decoration: none;
  border-radius: 2px;
  border: 1px solid var(--action);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
  white-space: nowrap;
}
nav.nav .nav-cta:hover {
  background: var(--action-bright);
  border-color: var(--action-bright);
  transform: translateY(-1px);
}

/* Responsive: collapse links + counter on small screens */
@media (max-width: 960px) {
  nav.nav { grid-template-columns: auto auto; gap: 16px; padding: 10px 16px; }
  nav.nav .nav-links { display: none; }
  nav.nav .nav-pledge-meter { display: none; }
}
@media (max-width: 480px) {
  nav.nav .nav-mark span:last-child { font-size: 13px; }
  nav.nav .nav-cta { padding: 8px 14px; font-size: 10px; }
}

/* ─── STICKY CTA BAR (bottom — appears on scroll, dismissable) ─── */
.sticky-cta {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 90;
  background: var(--action, #b8451e);
  color: var(--bone, #fdf9ee);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  transform: translateY(110%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -8px 24px rgba(10, 20, 40, 0.18);
  font-family: 'Source Serif 4', serif;
}
.sticky-cta.shown { transform: translateY(0); }
.sticky-cta-text {
  font-size: 15px;
  line-height: 1.4;
  font-style: italic;
  flex: 1 1 auto;
}
.sticky-cta-text strong { font-style: normal; font-weight: 600; }
.sticky-cta-btn {
  background: var(--bone, #fdf9ee);
  color: var(--ink, #0a1428);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 12px 22px;
  border-radius: 2px;
  border: 1px solid var(--bone, #fdf9ee);
  transition: background 0.18s ease, color 0.18s ease;
  white-space: nowrap;
}
.sticky-cta-btn:hover { background: var(--action-bright, #e63946); color: var(--bone, #fdf9ee); border-color: var(--action-bright, #e63946); }
.sticky-cta-close {
  background: transparent;
  border: none;
  color: rgba(253, 249, 238, 0.85);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 12px 16px;        /* WCAG 2.5.8 — meet 44px touch target */
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.18s ease;
}
.sticky-cta-close:hover { color: var(--bone, #fdf9ee); }
@media (max-width: 700px) {
  .sticky-cta { padding: 12px 16px; gap: 12px; }
  .sticky-cta-text { font-size: 14px; }
  .sticky-cta-btn { padding: 10px 16px; font-size: 10px; }
}

/* ─── STICKY TOC OFFSET (bill + objections sidebars) ─── */
/* Ensure these don't touch the fixed nav when sticking */
.bill-toc,
.obj-index { top: 110px !important; }

/* ─── A11Y: Reduced motion (WCAG 2.3.3) — applies globally to all pages ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  /* Show reveals/staggered elements immediately rather than waiting for animation */
  .reveal,
  .reveal-soft,
  .reveal-stagger > *,
  .premise-q,
  .premise-yes,
  .premise-resolve,
  .premise-cta,
  .donor-row,
  .donor-bar,
  .empathy-mark,
  .big-stat-num,
  .voice-card {
    opacity: 1 !important;
    transform: none !important;
    width: var(--bar-width, 100%) !important;
  }
  .donor-row .donor-bar { width: var(--bar-width, 0%) !important; }
  /* Halt the ticker dot pulse */
  .nav-pledge-dot, .ticker-dot { animation: none !important; }
}
