/* Global overflow protection */
html, body { overflow-x: hidden; }

/* ═══════════════════════════════════════════════════
   THE NEW BLOC — shared.css
   Single source of truth for all cross-page styling.
   ═══════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ── */
:root {
  --bg: #ffffff; --surface: #f7f7f7; --border: #e0e0e0;
  --ink: #0a0a0a; --ink-2: #3a3a3a; --ink-3: #666666; --ink-4: #9a9a9a;
  --accent: #1847F0; --accent-light: #eef1fe;
  --green: #0d7a4e; --red: #b91c1c; --green-light: #e6f4ed;
  --dark-bg: #0f1623; --dark-border: #1e2d47;
  --dark-text: #ffffff; --dark-text-2: #c8d6f0; --dark-muted: #7a96c0;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 110px; }
body {
  padding-top: 60px;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
a:active, button:active { transform: scale(0.98); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ── SKIP LINK ── */
.skip-link { position: absolute; top: -999px; left: 8px; background: var(--accent); color: #fff; padding: 8px 16px; border-radius: 0 0 8px 8px; font-size: 0.85rem; font-weight: 700; text-decoration: none; z-index: 9999; }
.skip-link:focus { top: 0; }

/* ══════════════════════════════
   NAV BAR
   ══════════════════════════════ */
nav {
  position: fixed; top: 0; width: 100%; z-index: 200;
  height: 60px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 32px; gap: 16px;
  background: rgba(255,255,255,0.92); backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}
.nav-logo {
  font-family: 'Fraunces', serif; font-weight: 800; font-size: 1rem;
  letter-spacing: -0.03em; color: var(--ink); text-decoration: none;
  white-space: nowrap; flex-shrink: 0;
}
.dot { color: var(--accent); }
.nav-parent { font-size: 0.62rem; font-weight: 400; color: var(--ink-3); margin-left: 4px; letter-spacing: 0.02em; }
.nav-center { display: flex; gap: 0; flex: 1; justify-content: center; }
.nav-center a {
  font-size: 0.78rem; font-weight: 500; color: var(--ink-2);
  text-decoration: none; padding: 6px 10px; border-radius: 6px;
  transition: all 0.15s; white-space: nowrap;
}
.nav-center a:hover { background: var(--surface); color: var(--ink); }
.nav-center a.active { color: var(--accent); font-weight: 600; }
.nav-right { display: flex; align-items: center; gap: 8px; }
.nav-btn-fill {
  font-size: 0.75rem; font-weight: 600; color: #fff;
  background: var(--accent); border: none; padding: 7px 16px;
  border-radius: 7px; text-decoration: none; cursor: pointer;
  transition: background 0.15s;
}
.nav-btn-fill:hover { background: #1339c7; }

/* Hamburger (animated) */
.nav-hamburger {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; padding: 6px; cursor: pointer;
}
.nav-hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--ink); border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}
.nav-hamburger:hover span { background: var(--accent); }
.nav-hamburger[aria-expanded="true"] span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.nav-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-hamburger[aria-expanded="true"] span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

/* Mobile nav dropdown */
.nav-mobile-menu {
  display: none; position: fixed; top: 60px; left: 0; right: 0;
  background: rgba(255,255,255,0.98); backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px 16px; z-index: 199;
  flex-direction: column; gap: 2px;
  animation: slideDown 0.2s ease;
}
.nav-mobile-menu.open { display: flex; }
.nav-mobile-menu a {
  display: block; padding: 10px 12px; font-size: 0.88rem; font-weight: 500;
  color: var(--ink-2); text-decoration: none; border-radius: 8px;
  transition: all 0.15s;
}
.nav-mobile-menu a:hover { background: var(--surface); color: var(--ink); }
.nav-mobile-menu a.active { color: var(--accent); font-weight: 600; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* Legacy hamburger (candidates, register) */
.hamburger {
  display: none; background: none; border: none;
  font-size: 1.5rem; cursor: pointer; color: var(--ink);
  padding: 4px 8px;
}
#navMobileMenu {
  display: none; position: fixed; top: 60px; left: 0; right: 0;
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 12px 24px; z-index: 199; flex-direction: column; gap: 4px;
}
#navMobileMenu.open { display: flex; }
#navMobileMenu a {
  display: block; padding: 10px 12px; font-size: 0.92rem;
  color: var(--ink-2); text-decoration: none; border-radius: 8px;
}
#navMobileMenu a:hover, #navMobileMenu a.active { background: var(--surface); color: var(--accent); }

/* ══════════════════════════════
   COUNTDOWN STRIP
   ══════════════════════════════ */
.countdown-strip {
  position: sticky; top: 60px; left: 0; right: 0;
  background: #0f1623; border-bottom: 1px solid #1e2d47;
  padding: 9px 28px; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; flex-wrap: wrap;
  z-index: 190; min-height: 42px; box-sizing: border-box;
  border-top: 2px solid rgba(255,255,255,0.15);
}
.countdown-label { font-size: 0.72rem; font-weight: 700; color: #c8d6f0; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
.countdown-clock { display: flex; gap: 12px; align-items: center; }
.countdown-unit { text-align: center; }
.countdown-num { font-family: 'Fraunces', serif; font-size: 1.25rem; font-weight: 900; color: #ffffff; line-height: 1; }
.countdown-unit-label { font-size: 0.55rem; font-weight: 700; color: #7a96c0; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 1px; }
.countdown-sep { font-family: 'Fraunces', serif; font-size: 1.25rem; color: #7a96c0; line-height: 1; margin-bottom: 8px; }
.countdown-cta { font-size: 0.75rem; font-weight: 700; color: #ffffff; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); padding: 6px 14px; border-radius: 7px; text-decoration: none; white-space: nowrap; transition: background 0.12s; display: inline-flex; align-items: center; min-height: 32px; }
.countdown-cta:hover { background: rgba(255,255,255,0.18); }

/* Election-day states */
.countdown-strip.cd-state-vote { background: #b91c1c; border-bottom-color: #7f1d1d; padding: 10px 28px; }
.cd-urgent-label { font-weight: 800; font-size: 0.85rem; letter-spacing: 0.02em; color: #fff; }
.cd-vote-btn { font-size: 0.78rem; font-weight: 800; color: #fff; background: rgba(255,255,255,0.18); border: 2px solid rgba(255,255,255,0.45); padding: 7px 16px; border-radius: 8px; text-decoration: none; white-space: nowrap; }
.countdown-strip.cd-state-closed { background: #374151; border-bottom-color: #4b5563; justify-content: center; }
.cd-msg { font-size: 0.82rem; color: #e5e7eb; }
.cd-msg strong { color: #fff; }
.countdown-strip.cd-state-thankyou { background: linear-gradient(90deg,#052e16,#064e3b); border-bottom-color: #065f46; justify-content: center; }
.cd-thankyou { font-size: 0.82rem; color: #a7f3d0; }
@keyframes cdPulse { 0%,100%{opacity:1} 50%{opacity:.78} }

/* ══════════════════════════════
   PAGE HEADER (shared across most inner pages)
   ══════════════════════════════ */
.page-header { padding: 52px 40px 40px; border-bottom: 1px solid var(--border); }
.page-header-inner { max-width: 760px; margin: 0 auto; }
.page-header-inner { max-width: 760px; margin: 0 auto; }
.page-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.72rem; font-weight: 700; color: var(--accent);
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 14px;
}
.page-eyebrow::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: blink 2s infinite; }
@keyframes blink { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.4;transform:scale(1.4)} }
.page-title {
  font-family: 'Fraunces', serif; font-weight: 900;
  font-size: clamp(1.8rem, 5vw, 2.6rem); line-height: 1.1;
  letter-spacing: -0.02em; color: var(--ink); margin-bottom: 12px;
}
.page-title em { font-style: italic; color: var(--accent); }
.page-desc { font-size: 0.98rem; color: var(--ink-2); line-height: 1.65; max-width: 600px; }
.breadcrumb { font-size: 0.72rem; color: var(--ink-3); margin-bottom: 10px; }
.breadcrumb a { text-decoration: none; color: var(--accent); }
.breadcrumb a:hover { text-decoration: underline; }

/* ══════════════════════════════
   NEXT / PREVIOUS PAGE NAV
   ══════════════════════════════ */
.next-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  max-width: 760px;
  margin: 0 auto 32px;
}
.next-strip h3 {
  font-family: 'Fraunces', serif;
  font-size: 1rem; font-weight: 700;
  color: var(--ink); margin-bottom: 12px;
}
.next-links { display: flex; flex-direction: column; gap: 8px; }
.next-link {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg);
  text-decoration: none; transition: all 0.15s;
}
.next-link:hover { border-color: var(--accent); background: var(--accent-light); }
.next-link-left { display: flex; align-items: center; gap: 12px; }
.next-link-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.next-link-text .title { font-size: 0.88rem; font-weight: 600; color: var(--ink); }
.next-link-text .sub { font-size: 0.75rem; color: var(--ink-3); }
.next-link-arrow { color: var(--ink-3); font-size: 0.9rem; transition: color 0.15s; }
.next-link:hover .next-link-arrow { color: var(--accent); }

/* Bottom page nav (prev/next) */
.bottom-nav {
  margin-top: 56px; padding-top: 32px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  max-width: 760px; margin-left: auto; margin-right: auto;
}
.bottom-nav a {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; font-size: 0.85rem; font-weight: 600;
  color: var(--ink-2); padding: 10px 16px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); transition: all 0.15s;
}
.bottom-nav a:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.bottom-nav .prev { margin-right: auto; }
.bottom-nav .next { margin-left: auto; }
.bottom-nav .arrow { font-size: 1.1rem; line-height: 1; }

/* ══════════════════════════════
   FEEDBACK BANNER
   ══════════════════════════════ */
.feedback-banner {
  position: sticky; top: 60px; z-index: 100;
  background: linear-gradient(135deg, #1847F0 0%, #0f35c7 100%);
  border-bottom: 1px solid rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  gap: 16px; padding: 9px 28px; max-width: 1200px; margin-left: auto; margin-right: auto;
  font-size: 0.75rem; color: rgba(255,255,255,0.9);
  flex-wrap: wrap; min-height: 38px;
}
.feedback-banner a { color: #fff; text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.feedback-banner a:hover { color: #e0e7ff; }

/* ══════════════════════════════
   CHAT WIDGET
   ══════════════════════════════ */
.chat-widget { position: fixed; bottom: 0; right: 0; z-index: 500; font-family: 'DM Sans', sans-serif; }
.chat-fab {
  position: fixed; bottom: 28px; right: 28px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--ink); color: #fff; border: none;
  font-size: 1.4rem; cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  z-index: 501; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.chat-fab:hover { background: #222; transform: scale(1.05); }
.chat-fab.active { background: var(--accent); }
.chat-window {
  display: none; position: fixed; bottom: 96px; right: 28px;
  width: 380px; height: 540px; max-height: 80vh;
  background: var(--bg); border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.15);
  flex-direction: column; overflow: hidden;
  z-index: 502; border: 1px solid var(--border);
}
.chat-window.open { display: flex; }
.chat-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; background: var(--ink);
  color: #fff; flex-shrink: 0;
}
.chat-header-avatar { font-size: 1.4rem; }
.chat-header-info { flex: 1; }
.chat-header-name { font-weight: 700; font-size: 0.85rem; }
.chat-header-status { font-size: 0.65rem; color: rgba(255,255,255,0.6); display: flex; align-items: center; gap: 5px; }
.chat-header-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #22c55e; }
.chat-header-close { background: none; border: none; color: rgba(255,255,255,0.6); font-size: 1.1rem; cursor: pointer; padding: 4px; }
.chat-header-close:hover { color: #fff; }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--surface);
}
.chat-msg { display: flex; gap: 8px; align-items: flex-start; }
.chat-msg-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; flex-shrink: 0; }
.chat-bubble {
  max-width: 80%; padding: 10px 14px; border-radius: 14px;
  font-size: 0.82rem; line-height: 1.55;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--border);
}
.chat-msg.bot .chat-bubble { border-bottom-left-radius: 4px; }
.chat-msg.user { flex-direction: row-reverse; }
.chat-msg.user .chat-bubble { background: var(--accent); color: #fff; border: none; border-bottom-right-radius: 4px; }
.chat-msg.user .chat-msg-avatar { background: var(--ink-3); }
.chat-quick-replies { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 8px; }
.chat-qr {
  font-size: 0.72rem; font-weight: 600; padding: 6px 12px;
  border-radius: 16px; border: 1px solid var(--accent);
  color: var(--accent); background: transparent;
  cursor: pointer; transition: all 0.15s;
}
.chat-qr:hover { background: var(--accent); color: #fff; }
.chat-input-row {
  display: flex; gap: 8px; padding: 10px 14px;
  border-top: 1px solid var(--border); background: var(--bg);
}
.chat-input {
  flex: 1; border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; font-size: 0.82rem; font-family: 'DM Sans', sans-serif;
  outline: none; transition: border-color 0.15s;
}
.chat-input:focus { border-color: var(--accent); }
.chat-send {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: background 0.15s;
}
.chat-send:hover { background: #1339c7; }
.chat-human-cta { padding: 8px 16px; background: var(--surface); border-top: 1px solid var(--border); text-align: center; }
.chat-human-links { display: flex; gap: 12px; justify-content: center; margin-top: 4px; }
.chat-human-link { font-size: 0.68rem; color: var(--accent); text-decoration: none; font-weight: 600; }
.chat-human-link:hover { text-decoration: underline; }
.chat-typing { display: flex; gap: 4px; padding: 8px 14px; }
.chat-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-3); animation: typingBounce 1.4s infinite both;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%,60%,100%{transform:translateY(0);opacity:.3} 30%{transform:translateY(-6px);opacity:1} }

/* ══════════════════════════════
   RESPONSIVE — MOBILE
   ══════════════════════════════ */
@media (max-width: 768px) {
  nav { padding: 0 20px; }
  .nav-center { display: none !important; }
  .nav-hamburger, .hamburger { display: flex; }
  .countdown-strip { padding: 9px 16px; gap: 10px; }
  .countdown-cta { display: none; }
  .page-header { padding: 36px 20px 28px; }
  .page-title { font-size: 1.6rem; }
  .next-strip { margin: 0 16px 24px; padding: 16px 18px; }
  .bottom-nav { padding: 24px 16px; }
  .bottom-nav a { font-size: 0.78rem; padding: 8px 12px; }
  .chat-window { width: calc(100vw - 24px); right: 12px; bottom: 84px; height: 70vh; }
  .feedback-banner { padding: 8px 16px; font-size: 0.7rem; }
}

@media (max-width: 480px) {
  nav { padding: 0 16px; }
  .countdown-strip { padding: 8px 12px; min-height: 36px; }
  .countdown-num { font-size: 1rem; }
  .countdown-sep { font-size: 1rem; }
  .countdown-label { font-size: 0.65rem; }
  .bottom-nav { flex-direction: column; }
  .bottom-nav a { width: 100%; justify-content: center; }
}
