/* ============================================================
   Denver DSA June 2026 Ballot Guide — style.css
   Mobile-first, typographic layout. National DSA brand colors.
   ============================================================ */

/* ----- Manifold DSA custom font ----- */
@font-face {
  font-family: "Manifold DSA";
  src: url("../ManifoldDSA-DemiBold.woff") format("woff");
  font-weight: 600;
  font-style: normal;
}
@font-face {
  font-family: "Manifold DSA";
  src: url("../ManifoldDSA-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
}

/* ----- CSS Variables / Design Tokens ----- */
:root {
  --dsa-red: #EC1F27;
  --dsa-red-dark: #c41a20;
  --dsa-black: #231F20;
  --white: #ffffff;
  --light-gray: #f4f4f4;
  --medium-gray: #666666;
  --border-gray: #dddddd;

  --yes-green: #2e7d32;
  --yes-green-bg: #e8f5e9;
  --neutral-color: #555555;
  --neutral-bg: #e8e8e8;
  --no-color: #b71c1c;
  --no-bg: #ffebee;
  --endorsed-color: #FFC107;
  --endorsed-color-dark: #cc9900;
  --endorsed-bg: #fff8e1;

  --font-heading: 'Manifold DSA', 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-width: 800px;
}

/* ----- Colorblind Modes ----- */
.colorblind-p {
  --yes-green: #e65100;
  --yes-green-bg: #fff3e0;
  --no-color: #0d47a1;
  --no-bg: #e3f2fd;
  --endorsed-color: #FFC107;
  --endorsed-color-dark: #cc9900;
  --endorsed-bg: #fff8e1;
}
.colorblind-p .race--no .race-heading { color: #37474f; }
.colorblind-p .race--no .race-body p { color: #4f5b62; }
.colorblind-p .stamp--yes {
  color: #e65100; border-color: #e65100;
  background: rgba(255, 243, 224, 0.7);
}
.colorblind-p .stamp--yes .stamp-icon { color: #e65100; }
.colorblind-p .legend-symbol--yes { background: #e65100; }
.colorblind-p .legend-symbol--no { background: #0d47a1; }

.colorblind-t {
  --yes-green: #00838f;
  --yes-green-bg: #e0f7fa;
  --no-color: #c62828;
  --no-bg: #ffebee;
  --endorsed-color: #FFC107;
  --endorsed-color-dark: #cc9900;
  --endorsed-bg: #fff8e1;
}
.colorblind-t .race--no .race-heading { color: #555; }
.colorblind-t .race--no .race-body p { color: #555; }
.colorblind-t .stamp--yes {
  color: #00838f; border-color: #00838f;
  background: rgba(224, 247, 250, 0.7);
}
.colorblind-t .stamp--yes .stamp-icon { color: #00838f; }
.colorblind-t .legend-symbol--yes { background: #00838f; }
.colorblind-t .legend-symbol--no { background: #c62828; }

/* Thicker, styled borders in accessibility modes */
.colorblind-p .race--yes,
.colorblind-t .race--yes {
  border-left-width: 5px;
  border-left-style: double;
}
.colorblind-p .race--neutral,
.colorblind-t .race--neutral {
  border-left-width: 5px;
  border-left-style: ridge;
}
.colorblind-p .race--no,
.colorblind-t .race--no {
  border-left-width: 5px;
  border-left-style: dotted;
}
.colorblind-p .race--endorsed,
.colorblind-t .race--endorsed {
  border-left-width: 5px;
  border-left-style: solid;
}

/* ----- Reset & Base ----- */
*, *::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(--font-body);
  font-weight: 400;
  line-height: 1.7;
  color: var(--dsa-black);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

/* ----- Accessibility ----- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  padding: 0.75rem 1.25rem;
  background: var(--dsa-black);
  color: var(--white);
  font-weight: 700;
  text-decoration: none;
  z-index: 1000;
}
.skip-link:focus {
  top: 0;
}

/* Global focus indicators */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--dsa-red);
  outline-offset: 2px;
}
.toc-button:focus-visible {
  outline-color: var(--dsa-black);
}

/* ----- Hero / Header ----- */
.hero {
  background: var(--dsa-red);
  color: var(--white);
  padding: 3rem 6vw 2.5rem;
  text-align: center;
}
.hero-content {
  max-width: var(--max-width);
  margin: 0 auto;
}
.hero-label {
  font-family: 'Tangerine', cursive;
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  opacity: 0.9;
}
.hero-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

/* ----- Sticky Top Bar (desktop, appears after scrolling past hero) ----- */
.top-bar {
  display: none;
}
.top-bar--visible {
  display: none;
}

/* ----- Sections ----- */
.section {
  padding: 2.5rem 6vw 3rem;
}
.section--white {
  background: var(--white);
}
.section--gray {
  background: var(--light-gray);
}
.section-content {
  max-width: var(--max-width);
  margin: 0 auto;
}
.section-heading {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dsa-black);
  margin-bottom: 1.25rem;
  padding-bottom: 0.4rem;
  border-bottom: 3px solid var(--dsa-red);
  display: inline-block;
}
  .subsection-heading {
    font-size: 1.4rem;
  }

/* ----- Introduction / Body Text ----- */
.section-content > p,
.section-main > p {
  margin-bottom: 1rem;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--dsa-black);
}

/* ----- Legend ----- */
.legend {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.legend-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.5;
}
.legend-symbol {
  flex-shrink: 0;
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 0;
  margin-top: 0.15rem;
}
.legend-symbol--endorsed {
  width: auto;
  height: auto;
  color: var(--endorsed-color);
  font-size: 1.1rem;
  line-height: 1.25rem;
}
.legend-pika {
  width: 1.3rem;
  height: auto;
  vertical-align: middle;
}
.legend-symbol--yes {
  background: var(--yes-green);
}
.legend-symbol--neutral {
  background: var(--neutral-color);
}
.legend-symbol--no {
  background: var(--no-color);
}

/* Colorblind toggle */
.colorblind-toggle {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.5);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.colorblind-toggle:hover {
  background: rgba(255,255,255,0.25);
}
.colorblind-toggle:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}
.hero-cb-toggle {
  margin-top: 0.5rem;
  display: inline-block;
}
.top-bar-cb-toggle {
  position: absolute;
  right: 5.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
}

/* ----- Table of Contents ----- */
.toc-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.toc-button {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--white);
  background: var(--dsa-red-dark);
  border: 2px solid var(--dsa-red-dark);
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.toc-button:hover,
.toc-button:focus {
  background: var(--white);
  color: var(--dsa-red);
}
.toc-instruction {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--medium-gray);
  margin-top: 0.25rem;
}

/* ----- Race Entries ----- */
.race {
  margin: 1.5rem 0;
  padding: 1rem 0 1rem;
  border-left: 4px solid transparent;
  padding-left: 1rem;
}

.race--yes,
.race--endorsed {
  position: relative;
}

/* Race status variants */
.race--yes {
  border-left-color: var(--yes-green);
}
.race--neutral {
  border-left-color: var(--neutral-color);
}
.race--no {
  border-left-color: var(--no-color);
}
.race--endorsed {
  border-left-color: var(--endorsed-color);
}

.race-heading {
  font-family: var(--font-heading);
  display: inline;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--dsa-black);
  margin-right: 0.5rem;
  vertical-align: middle;
}
.heading-pika {
  width: 1.15rem;
  height: auto;
  vertical-align: middle;
  margin-right: 0.2rem;
}
.race-recommend {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem 0.15rem;
  margin-bottom: 0;
  vertical-align: middle;
  line-height: 1.05rem;
}
.race--yes .race-recommend {
  background: var(--yes-green-bg);
  color: var(--yes-green);
}
.race--neutral .race-recommend {
  background: var(--neutral-bg);
  color: var(--neutral-color);
}
.race--no .race-recommend {
  background: var(--no-bg);
  color: var(--no-color);
}
.race--endorsed .race-recommend {
  background: var(--endorsed-bg);
  color: var(--endorsed-color-dark);
}

.race-body {
  margin-bottom: 0.75rem;
}
.race-body p {
  font-size: 0.95rem;
  line-height: 1.75;
  margin-bottom: 0.75rem;
  color: var(--dsa-black);
}

.race-callout {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--dsa-black);
  margin-bottom: 0.5rem;
}
.race--yes .race-callout strong { color: var(--yes-green); }
.race--neutral .race-callout strong { color: var(--medium-gray); }
.race--no .race-callout strong {
  color: var(--no-color);
  font-size: 0.85rem;
  font-weight: 500;
}
.race--no .race-body p {
  font-size: 0.88rem;
  color: #555;
}
.race--no .race-heading {
  font-weight: 400;
  color: #555555;
}
.race--endorsed .race-callout strong { color: var(--dsa-black); }

/* ----- Callout Cards (for inline notes/alerts within race entries) ----- */
.callout-card {
  margin: 1rem 0 0.5rem;
  padding: 0.85rem 1.1rem;
  border-left: 4px solid;
  font-size: 0.88rem;
  line-height: 1.6;
}
.callout-card--neutral {
  background: #fff8e1;
  border-color: #f9a825;
  color: #5d4037;
}
.callout-card--neutral strong {
  color: #3e2723;
}
.callout-card-body {
  margin: 0;
}
.callout-card a {
  color: #6d4c00;
  font-weight: 600;
}

/* ----- Stamp Badges ----- */
.stamp {
  float: right;
  clear: right;
  margin: 0 0 0.5rem 1rem;
  position: relative;
  top: 0;
  right: 0;
  z-index: 1;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1rem 0.5rem;
  border-width: 4px;
  border-style: double;
  border-radius: 3px;
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.1;
  opacity: 0;
  transform: rotate(10deg);
  /* animation applied via .stamp--visible */
  animation: none;
  /* stamped paper texture via box-shadow */
  box-shadow:
    inset 0 1px 3px rgba(255,255,255,0.35),
    inset 0 -2px 4px rgba(0,0,0,0.12),
    0 1px 2px rgba(0,0,0,0.08);
}

@keyframes stamp-down {
  0% {
    opacity: 0;
    transform: rotate(10deg) scale(1.4);
  }
  70% {
    opacity: 0.44;
    transform: rotate(10deg) scale(0.95);
  }
  100% {
    opacity: 0.48;
    transform: rotate(10deg) scale(1);
  }
}

.stamp--visible {
  animation: stamp-down 0.5s ease-out both;
}

/* Embossed/debossed paper texture */
.stamp::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 1px;
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,0.5),
    inset 0 -1px 2px rgba(0,0,0,0.15);
  pointer-events: none;
}

/* ----- YES Stamp ----- */
.stamp--yes {
  color: var(--yes-green);
  border-color: var(--yes-green);
  background: rgba(232, 245, 233, 0.7);
}
.stamp--yes .stamp-icon {
  font-size: 1.6rem;
  line-height: 1;
  margin-bottom: -0.1rem;
  color: #388e3c;
  text-shadow:
    1px 1px 0 rgba(0,0,0,0.2),
    -1px -1px 0 rgba(255,255,255,0.6);
}
.stamp--yes .stamp-text {
  font-size: 0.8rem;
  text-shadow:
    1px 1px 0 rgba(0,0,0,0.2),
    -1px -1px 0 rgba(255,255,255,0.6);
}

/* ----- ENDORSED Stamp ----- */
.stamp--endorsed {
  color: var(--endorsed-color-dark);
  border-color: var(--endorsed-color-dark);
  background: rgba(255, 248, 225, 0.7);
  flex-direction: row;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem 0.4rem;
}
.stamp--endorsed .stamp-logo {
  width: 2rem;
  height: auto;
  opacity: 0.8;
}
.stamp--endorsed .stamp-text {
  font-size: 0.75rem;
  text-shadow:
    1px 1px 0 rgba(0,0,0,0.2),
    -1px -1px 0 rgba(255,255,255,0.6);
}

/* ----- Footer ----- */
.footer {
  background: var(--dsa-black);
  color: var(--white);
  padding: 2.5rem 6vw;
}
.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: center;
}
.footer-org {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.footer-disclaimer {
  font-size: 0.8rem;
  line-height: 1.6;
  opacity: 0.75;
  margin-bottom: 1.5rem;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}
.footer-link {
  color: var(--white);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
}
.footer-link:hover,
.footer-link:focus {
  color: var(--dsa-red);
}

/* ----- Two-Column Section Layout ----- */
.section-layout {
  display: flex;
  flex-direction: column;
}
.section-explainer {
  display: none;
}

/* ----- Desktop / Tablet Enhancements ----- */
@media (min-width: 768px) {
  .hero {
    padding: 4rem 2rem 3rem;
  }
  .hero-title {
    font-size: 2.75rem;
  }
  .hero-label {
    font-size: 2.4rem;
  }
  .section {
    padding: 3rem 2rem 3.5rem;
  }
  .section-heading {
    font-size: 1.75rem;
  }
  .race {
    padding-left: 1.5rem;
  }
  .race-heading {
    font-size: 1.4rem;
  }
  .race-body p {
    font-size: 1rem;
  }
  .toc-button {
    font-size: 0.9rem;
    padding: 0.6rem 1.25rem;
  }
  .legend {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1.5rem 2rem;
  }
  .legend-item {
    flex: 0 1 auto;
  }

  .stamp {
    top: 0.75rem;
    right: 0.75rem;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.8rem 1.2rem 0.6rem;
  }
  .stamp--yes .stamp-icon {
    font-size: 2rem;
  }
  .stamp--yes .stamp-text {
    font-size: 0.9rem;
  }
}

/* ----- Two-Column Layout (1280px+) ----- */
@media (min-width: 1280px) {

  /* Larger, bolder type — CA DSA style */
  .hero-title {
    font-size: 3.5rem;
  }
  .hero-label {
    font-size: 2.8rem;
  }
  .section-heading {
    font-size: 2rem;
  }
  .subsection-heading {
    font-size: 1.6rem;
    font-weight: 700;
  }
  .race-heading {
    font-size: 1.5rem;
  }
  .section-content > p {
    font-size: 1.1rem;
  }
  .race-body p {
    font-size: 1.05rem;
  }
  .race-callout {
    font-size: 1rem;
  }
  .heading-pika {
    width: 1.35rem;
  }
  .section--layout {
    overflow: visible;
  }
  .section--layout .section-content {
    max-width: var(--max-width);
    overflow: visible;
  }
  .section-layout {
    display: block;
    overflow: visible;
  }
  .section-sidebar {
    float: left;
    width: 240px;
    margin-left: calc(-240px - 3rem);
    position: sticky;
    top: 1rem;
    text-align: right;
    z-index: 1;
  }
  .section-sidebar .section-heading {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
  }
  .section-main {
    /* fills the 800px content column */
  }
  .section-explainer {
    display: block;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--medium-gray);
    line-height: 1.5;
  }
  .sidebar-logo {
    width: 100%;
    max-width: 200px;
    height: auto;
    opacity: 0.25;
    filter: grayscale(100%);
  }

  /* Sticky top bar */
  .top-bar {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--dsa-red);
    color: var(--white);
    padding: 0.6rem 2rem;
    font-family: 'Tangerine', cursive;
    font-size: 1.1rem;
    text-align: center;
    transform: translateY(-100%);
    transition: transform 0.25s ease;
  }
  .top-bar--visible {
    transform: translateY(0);
  }
  .top-bar-link {
    position: absolute;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    text-decoration: none;
    opacity: 0.8;
  }
  .top-bar-link:hover {
    opacity: 1;
  }

  /* Offset anchors and sticky elements for top bar height */
  .top-bar--visible ~ main .section-sidebar {
    top: 3.2rem;
  }
  h2[id],
  h3[id],
  .section[id] {
    scroll-margin-top: 3rem;
  }
}

/* ----- Print Styles ----- */
@media print {
  .toc { display: none; }
  .skip-link { display: none; }
  .hero { padding: 1rem 0; }
  body { font-size: 12pt; }
}
