/* General Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

:root{
  --nav-h: 82px;
  --header-bg: #0b2342;
  --header-shadow: 0 10px 24px rgba(0,0,0,.25);
  --historical-chart-text: #0b2342;
  --historical-chart-grid: #e6e8eb;
  --historical-chart-bar: #c73b2e;
  --historical-chart-bar-hover: #ad2f25;
}

section[id] {
  scroll-margin-top: var(--nav-h);
}

body {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  color: #1a1a1a;
  background-color: #f8f3e8;
  padding-top: var(--nav-h);
}

/* Header */
header {
  padding: .75rem 1rem;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: var(--header-bg);
  transition: box-shadow .25s ease, background-color .25s ease;
  box-shadow: none;
  height: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  padding-top: calc(env(safe-area-inset-top, 0px) + 0.75rem);
}

header.scrolled {
  box-shadow: var(--header-shadow);
  /* padding: .5rem 2rem; */
}

/* Navbar */
.navbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.navbar .logo {
  font-weight: bold;
  color: #fff;
  text-transform: uppercase;
  padding-top: 5px;
  height: 58px;
}
.navbar .logo-img {
  max-width: 40px;
}
.navbar .nav-links {
  margin-left: auto;
  display: flex;
  list-style: none;
}
.navbar .nav-links li {
  margin-left: 1.5rem;
}
.navbar .nav-links a {
  text-decoration: none;
  color: #fff;
  transition: color 0.3s ease;
}
.navbar .nav-links a:hover {
  color: #f2a900;
}

.nav-toggle {
  margin-left: auto;
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  cursor: pointer;
  margin-left: auto;
}
.nav-toggle .bar {
  position: absolute;
  left: 10px;
  right: 10px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform .25s ease, opacity .2s ease, top .25s ease;
}
.nav-toggle .bar:nth-child(1) { top: 14px; }
.nav-toggle .bar:nth-child(2) { top: 21px; }
.nav-toggle .bar:nth-child(3) { top: 28px; }

/* X state */
.menu-open .nav-toggle .bar:nth-child(1) { top: 21px; transform: rotate(45deg); }
.menu-open .nav-toggle .bar:nth-child(2) { opacity: 0; }
.menu-open .nav-toggle .bar:nth-child(3) { top: 21px; transform: rotate(-45deg); }

/* Prevent body scroll when open */
body.no-scroll { overflow: hidden; }

/* Overlay behind the drawer */
.nav-overlay {
  position: fixed;
  inset: var(--nav-h) 0 0 0;        /* respect the fixed header */
  background: rgba(0,0,0,.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  z-index: 999;
}
.menu-open .nav-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* Hero Section */
.hero {
  position: relative;
  height: 400px;
  background: url("../images/bg-image2.png") no-repeat center center/cover;
  background-position-y: -350px;
}
.hero-overlay {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem;
  color: #fff;
}
.hero-content {
  z-index: 2;
  max-width: 600px;
}

.headline {
  font-family: 'Oswald', 'League Gothic', sans-serif;
  font-weight: 700;          /* Bold */
  text-transform: uppercase; /* All caps */
  font-size: 2.75rem;         /* Adjust for size */
  letter-spacing: 1px;       /* Slight spacing */
  color: #ffffff;            /* White text */
  line-height: 1.1;
  margin-bottom: 1rem;
}
.subtext {
  font-family: 'Merriweather', 'Crimson Text', serif;
  font-weight: 400;          /* Normal */
  font-size: 1.25rem;
  color: #f8e5d2;            /* Muted cream */
  line-height: 1.4;
}
.capitol {
  position: absolute;
  bottom: -211px;
  right: 0;
  max-width: 610px;
}

/* Tracker */
.tracker {
  background: #0b2342;
  color: #fff;
  text-align: left;
  padding: 1.5rem 7rem;
}
.tracker-inner {
  max-width: 450px;
  text-align: center;
}
.countdown {
  display: flex;
  justify-content: left;
  margin-top: 1rem;
}
.time-box {
  margin: 0 1rem;
  padding: 1rem;
  background: #10305c;
  border-radius: 8px;
}
.time-box span {
  font-size: 2rem;
  display: block;
}
.time-box small {
  text-transform: uppercase;
  font-size: 0.75rem;
  opacity: 0.8;
}

.card {
  flex: 1;
  padding: 2rem;
  border-radius: 8px;
  color: #fff;
  text-align: center;
}
.card.red {
  background: #a7352d;
}
.card.blue {
  background: #246e9f;
}

/* Vote Section */
.vote {
  background: #f8f3e8 url("../images/mid-bg-4.png") center/cover no-repeat;
  overflow-x: clip;
}
.vote-subhead,
.vote-footer {
  margin: 0 0 6px;
  font-size: 15px;
  color: #24364f;
}
.vote-footer {
  margin: 15px 0 0;
}
.vote-link a {
  font-size: 14px;
  color: #0b2342;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(11,35,66,0.25);
}
.vote-link a:hover { border-bottom-color: rgba(11,35,66,0.6); }

.vote-bars {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.vote-bar-wrap {
  position: relative; /* so tooltips can anchor here */
  display: flex;
  align-items: center;
  gap: 6px;
}

.vote-label {
  width: 50px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 14px;
  color: #0b2342;
}
.vote-label.yea { color: #1b7a3d; } /* green for yea */
.vote-label.nay { color: #c73b2e; } /* red for nay */

.vote-bar {
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  min-width: 40px; /* so very small groups are still visible */
}

.vote-count {
  margin-left: 6px;
  font-weight: 700;
  color: #0b2342;
  white-space: nowrap;
}

/* Tooltip for votes */

.vote-tooltip {
  opacity: 0;
  visibility: hidden;            /* avoid accidental hover hits */
  pointer-events: none;          /* until shown */
  position: absolute;
  bottom: calc(100% - 120px);      /* sits above the bar */
  transform: translateX(-50%) translateY(8px); /* start slightly lower */;
  left: 50%;
  max-width: min(550px, 92vw);

  transition:
    opacity 0.5s ease,
    transform 0.5s ease,
    visibility 0s linear 0.5s; /* delay hiding visibility until fade finishes */
  padding: 12px 14px;
  background: #0b2342;
  color: #fff;
  font-size: 13px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-width: 550px;
  display: block; /* ensure it spans full width of its box */
  white-space: normal; /* allow wrapping */
  line-height: 1.4;
  z-index: 9999;
  column-count: 2;               /* your multi-col layout */
  column-gap: 18px;
}

/* Show when JS adds the class */
.vote-bar-wrap.show-tip .vote-tooltip {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;          /* allow hovering the tooltip */
  transform: translateX(-50%) translateY(30%); /* slide into place */
  transition:
    opacity 0.5s ease,
    transform 0.5s ease,
    visibility 0s; /* no delay when showing */
}

/* Reset column flow for header */
.vote-tooltip-header {
  column-span: all;
  text-align: center;
  font-weight: 700;
  margin-bottom: 8px;
  display: block;
  font-size: 14px;
  letter-spacing: 0.5px;
}

/* Each name row */
.vote-tooltip-item {
  display: flex;
  /* align-items: center; */
  align-items: flex-start;
  margin-bottom: 4px;
  break-inside: avoid; /* prevents splitting in columns */
}

/* Small colored box */
.vote-party-box {
  width: 14px;
  height: 14px;
  border: 1px solid #000;
  margin-right: 6px;
  border-radius: 2px;
  background: #fff; /* default Independent */
  flex-shrink: 0;
  margin-top: 2px;
}

/* Colors for parties */
.vote-party-box.dem { background: #1e40af; } /* dark-ish blue */
.vote-party-box.rep { background: #b91c1c; } /* dark-ish red */
.vote-party-box.ind { background: #fff; }    /* stays white */

#servicesDonut {
  display: block;   /* avoid inline-element line-height gaps */
  width: 100%;      /* Chart.js manages height from aspect ratio */
  height: auto;
  text-align: center;
}

.donut-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  line-height: 1.1;
  color: #0b2342;
  pointer-events: none; /* clicks pass through to canvas */
  font-size: clamp(16px, 2.4vw, 28px);
}

/* Impact section background */
.impact {
  background: #f8f3e8 url("../images/mid-bg-2.png") center/cover no-repeat;
  color: #0b2342;
  background-position-y: -365px;
}

/* Layout */
.info-section {
  padding: 4rem 0;
}
.info-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.25rem;
}
.info-grid {
  display: grid;
  gap: 3rem;
  align-items: stretch;                 /* important: columns same height */
}

.impact-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  grid-template-areas: "impact-left impact-right";
}

.impact-left  { grid-area: impact-left; }
.impact-right { grid-area: impact-right; }
.impact-left + .impact-right { margin-top: 0; }

#why-shutdowns {
  padding: 2rem 0 3rem;
}

/* Title */
.info-title {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 2.2rem;
  color: #0b2342;
  margin-bottom: 1rem;
}
#why-shutdowns .info-title {
  color: #cb0000;
}

.info-lead {
  font-size: 1.4rem;
  font-family: 'Oswald', sans-serif;
}

/* Accordions */
.accordion-list {
  /* flex: 1 1 auto; */
  min-height: 0;            /* critical for nested scroll to work */
  display: grid;
  gap: 1rem;
  overflow: hidden;         /* prevents inner growth from bleeding out */
  padding: 0 15px 15px;
}

/* Focus mode: when one opens, hide the other headers entirely */
.accordion-list.focused .accordion-item:not(.open) {
  display: none;
}

.accordion-trigger {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: 700 1.25rem/1.2 'Oswald', sans-serif;
  text-transform: none;
  background: linear-gradient(90deg, #12385f, #0f2d4d);
  color: #fff;
  border: 0;
  border-radius: 14px;
  padding: 1.25rem 1.25rem;
  /* box-shadow: 0 8px 20px rgba(10, 27, 53, 0.25); */
  box-shadow: 5px 5px 11px rgba(10, 27, 53, 0.2);
  cursor: pointer;
  flex: 0 0 auto;
}
.accordion-trigger:focus-visible {
  outline: 3px solid #f2a900;
  outline-offset: 2px;
}
.toggle-icon {
  font-size: 1.5rem;
  line-height: 1;
  opacity: 0.95;
  transform-origin: center;
  transition: transform .2s ease, opacity .2s ease;
}
.accordion-item.open .toggle-icon {
  transform: rotate(45deg); /* plus → × */
  opacity: 0.85;
}

/* The opened item becomes a column flex container */
.accordion-item.open {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.accordion-panel {
  flex: 1 1 auto;
  min-height: 0;             /* enables child overflow on flex items */
  overflow: auto;            /* <-- scroll INSIDE the panel */
  margin-top: 0.75rem;
  background: #f8f3e8;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(0,0,0,.12);
}

/* Style the entire scrollbar */
.accordion-panel::-webkit-scrollbar {
  width: 6px; /* Adjust width as needed */
}

/* Style the scrollbar track */
.accordion-panel::-webkit-scrollbar-track {
  /* background: #f1f1f1; */
  background: #f8f3e8;
  border-radius: 6px; /* Optional: round the track */
}

/* Style the scrollbar thumb */
.accordion-panel::-webkit-scrollbar-thumb {
  background: #0b2342;
  border-radius: 6px; /* Adjust to desired radius */
}

/* Style the thumb on hover */
.accordion-panel::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.panel-body {
  position: relative;
  padding: .5rem 1.25rem 1.5rem;
  color: #243447;
  max-height: 350px;
}

.panel-body h4 {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  color: #0b2342;
  margin: 0.5rem 0 0.25rem;
}
.panel-body ul {
  margin: 0.25rem 0 0.75rem 1.25rem;
}
.panel-body li + li { margin-top: .35rem; }

.close-panel {
  position: absolute;
  top: .5rem;
  right: .65rem;
  font-size: 1.5rem;
  border: none;
  background: transparent;
  color: #12385f;
  cursor: pointer;
}

.disclaimer {
  margin-top: .5rem;
  font-size: .95rem;
  opacity: .85;
}

/* Right column: chart */

.impact-right {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: 10px;
}

.chart-box {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}
.chart-footnote {
  font-size: .9rem;
  /* color: #384b63; */
  color: #fff;
  opacity: .8;
  margin-top: .25rem;
}

.historical {
  background: #f8f3e8 url("../images/mid-bg-3.png") center/cover no-repeat;
}

.historical-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "historical-left historical-right";
}

.historical-left {
  display: flex;
  flex-direction: column;
  min-height: 0;            /* allow children to shrink for overflow */
  overflow: hidden;         /* clip anything outside the box */
}

.historical-right {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: 10px;
}

.historical-left  { grid-area: historical-left; }
.historical-right { grid-area: historical-right; }

/* Vertical timeline (scoped to the historical column) */
.historical-left .timeline-vertical { padding: 6px 0; }
.historical-left .tl { 
  position: relative; 
  margin: 8px 0 0 18px; 
  padding-left: 20px; 
  list-style: none; 
}
.historical-left .tl::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.25rem;
  bottom: 0.25rem;
  width: 2px;
  background: #e6e8eb; /* faint vertical line */
}

.historical-left .tl-item {
  position: relative;
  margin: 0 0 18px 0;
  padding-left: 0; /* already provided by .tl */
}

.historical-left .tl-node {
  position: absolute;
  left: -25px; /* centers node on the line */
  top: 0.4rem;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #c73b2e;       /* crimson bullet */
  box-shadow: 0 0 0 3px #fff; /* white halo for contrast on patterned bgs */
}

.historical-left .tl-date {
  display: block;
  font-size: 12px;
  color: #0b2342;             /* dark blue */
  opacity: 0.9;
  margin-bottom: 2px;
}

.historical-left .tl-content { padding-bottom: 4px; }

.historical-left .tl-heading {
  font-size: 16px;
  line-height: 1.2;
  color: #0b2342;
  font-weight: 800;           /* bold event title */
  margin: 0 0 4px 0;
}

.historical-left .tl-desc {
  margin: 0;
  color: #24364f;             /* slightly lighter navy for body */
  font-size: 14px;
}

.historical-left .tl-footer { margin-top: 8px; }
.historical-left .tl-more {
  color: #0b2342;
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px solid rgba(11,35,66,0.25);
}
.historical-left .tl-more:hover { border-bottom-color: rgba(11,35,66,0.6); }

.historical-right {
  padding-top: 0;
}

.historical-right .info-lead {
  text-align: center;
}

/* Historical chart */

#shutdownsBar {
  width: 100%;
  max-width: 700px;
  height: 280px;       /* or use a percentage if inside flex/grid */
  height: auto;
}

.historical .chart-card {
  padding: 18px;
}
.historical .chart-wrap { position: relative; width: 100%; }

/* About */

/* About Section */
#about .email-us {
  text-align: right;
  padding-top: 10px;
  font-size: 14px;
}
#about .email-us a {
  color: #10305c;
}
#about .info-panel {
  background: #fff;
  border: 1px solid #eef2f7;
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(0,0,0,.06);
  padding: 20px 20px 15px;
}
#about .info-grid {
  display: grid;
  gap: 20px;
}
@media (min-width: 820px) {
  #about .info-grid {
    grid-template-columns: 1.5fr 1fr;
  }
}
#about .keyterms {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 18px;
}
#about .keyterms .h3 {
  font-weight: 700;
  margin-bottom: 8px;
  color: #0b2342;
}
#about .keyterms ul {
  margin: 0;
  padding-left: 18px;
  color: #24364f;
  font-size: 14px;
}
#about .mini-callout {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-left: 4px solid #c73b2e;
  background: #fff7f7;
  border-radius: 8px;
  font-size: 14px;
  color: #24364f;
}

/* Footer */
footer {
  color: #fff;
  text-align: center;
  margin-top: 2rem;
}

footer a {
  color: #fff;
  text-decoration: none;
  font-weight: bold;
}
#primary-footer {
  padding: 1rem;
  background: #0b2342;
}

#secondary-footer {
  background: red;
}

/* Responsive */

@media (max-width: 980px) {
  /* Stack Impact: left above right */
  .impact-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "impact-left"
      "impact-right";
    row-gap: 1.25rem; /* spacing between stacked blocks */
  }

  /* Stack Historical: left above right (timeline over chart) */
  .historical-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "historical-left"
      "historical-right";
    row-gap: 1.25rem;
  }

  /* Keep your scroll cap on mobile */
  .accordion-panel {
    max-height: 60vh;
    overflow: auto;
  }

  #about .email-us {
    text-align: center;
  }
}

@media (min-width: 981px) {
  body { padding-top: calc(var(--nav-h) + env(safe-area-inset-top, 0px)); }
}

@media (max-width: 980px) {

  body { padding-top: 0; }
  .nav-toggle { display: inline-block; }

  /* Make the UL a right-side drawer on mobile */
  .navbar .nav-links {
    position: fixed;
    right: 0;
    top: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
    height: calc(100dvh - var(--nav-h) - env(safe-area-inset-top, 0px));
    width: min(80vw, 320px);
    background: var(--header-bg);
    box-shadow: -12px 0 30px rgba(0,0,0,.25);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transform: translateX(100%);
    transition: transform .3s ease;
    z-index: 1000; /* above overlay */
  }
  .navbar .nav-links li { margin: 0; }
  .navbar .nav-links a {
    display: block;
    padding: 12px 10px;
    border-radius: 8px;
    font-size: 1.05rem;
  }
  .navbar .nav-links a:hover {
    background: rgba(255,255,255,0.08);
    color: #f2a900;
  }
  .nav-overlay {
    inset: calc(var(--nav-h) + env(safe-area-inset-top, 0px)) 0 0 0;
  }
  header {
    /* padding: .75rem 1rem; */
    width: 100%;
    position: sticky;
    top: 0;
  }
  /* Show drawer when menu-open is on <header> */
  header.menu-open .nav-links {
    transform: translateX(0);
  }

  /* Hide desktop inline list on mobile (fallback) */
  .navbar .nav-links { list-style: none; }

  .hero .headline { text-align: center; }

  .hero,
  .impact { background-position-y: 0px; }
  .hero .subtext {
    background: rgba(0, 0, 0, .7);
    padding: 5px;
    text-align: center;
  }
  .hero-overlay { padding: 1rem; }
  .tracker { padding: 1.5rem 2rem; position: relative; }
  .tracker-inner { max-width: 100%; }
  .time-box {
    margin: 0 .5rem;
    padding: .5rem;
  }
  .countdown { justify-content: center;}
  .vote-tooltip {
    column-count: 3;
    column-gap: 5px;
  }
  .vote-bar-wrap.show-tip .vote-tooltip {
    transform: translateX(-50%) translateY(60%);
  }
  .vote-footer,
  .vote-subhead,
  .vote-link,
  .info-title,
  .info-lead { text-align: center; }
  .impact-grid {
    height: auto;                     /* no fixed height on small screens */
  }
  /* Cap the panel height for scroll of mobile */
  .accordion-panel {
    max-height: 60vh;
    overflow: auto;
  }

  .impact-right { order: 2; }
  .impact-left  { order: 1; }

  .chart-footnote { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  header { transition: none; }
  html { scroll-behavior: auto; }
}

/* Small screens spacing */
@media (max-width: 640px) {
  .historical-left .tl { margin-left: 14px; padding-left: 16px; }
}

@media (min-width: 600px) {
  .vote-tooltip { column-count: 2; }
}
@media (min-width: 900px) {
  .vote-tooltip { column-count: 4; }
}