/* =========================================================
   Indirect Democracy - site styles
   Civic-editorial: warm parchment, deep teal, amber accent.
   See CLAUDE.md for the full design system.
   ========================================================= */

:root {
  /* Ink */
  --ink: #0F172A;
  --ink-soft: #334155;
  --ink-muted: #64748B;

  /* Brand */
  --teal-900: #0B4F4A;
  --teal-700: #14746F;
  --teal-400: #4DB6AC;

  /* Accent */
  --amber-500: #B45309;
  --amber-300: #F59E0B;
  --amber-100: #FEF3C7;

  /* Surfaces */
  --parchment: #FAF7F2;
  --cream: #F3ECDF;
  --white: #FFFFFF;
  --rule: #E7E2D6;

  /* Party colors (used in homepage SVGs) */
  --party-red: #C9463C;
  --party-red-soft: #E5A79F;
  --party-blue: #2F5B8F;
  --party-blue-soft: #A5B8D1;

  /* Type */
  --font-serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Rhythm */
  --content-width: min(68ch, 100% - 2rem);
  --wide-width: min(1120px, 100% - 2rem);

  --radius: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 6px 24px rgba(15, 23, 42, 0.06);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--parchment);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* Headings - Fraunces */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-variation-settings: "opsz" 48;
}

p { max-width: 68ch; }

a {
  color: var(--teal-700);
  text-decoration-color: color-mix(in srgb, var(--teal-700) 35%, transparent);
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}
a:hover { color: var(--teal-900); }

:focus-visible {
  outline: 2px solid var(--teal-700);
  outline-offset: 3px;
  border-radius: 3px;
}

/* =========================================================
   Site header
   ========================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--parchment) 88%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.site-header.is-scrolled {
  border-bottom-color: var(--rule);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--teal-900); }
.brand img { width: 28px; height: 28px; }

.site-nav {
  display: flex;
  gap: clamp(1rem, 3vw, 2rem);
}
.site-nav a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 0.375rem 0;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--teal-900);
  border-bottom-color: var(--teal-700);
}

/* =========================================================
   Hero
   ========================================================= */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
  min-height: calc(90vh - 72px);
  padding: clamp(3rem, 8vh, 6rem) 1.5rem 4rem;
}
.hero h1 {
  font-size: clamp(3rem, 9vw, 6.5rem);
  font-weight: 500;
  color: var(--teal-900);
  max-width: 14ch;
  letter-spacing: -0.025em;
}
.hero-sub {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 4.5vw, 2.75rem);
  font-style: italic;
  font-weight: 400;
  color: var(--amber-500);
  margin-top: 0.25rem;
}
.hero-lede {
  max-width: 48ch;
  color: var(--ink-soft);
  margin-top: 0.75rem;
  font-size: 1.125rem;
}
.scroll-hint {
  margin-top: clamp(2rem, 6vh, 4rem);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-decoration: none;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.scroll-hint::after {
  content: "";
  width: 1px;
  height: 28px;
  background: var(--ink-muted);
  animation: drip 2.2s ease-in-out infinite;
  transform-origin: top;
}
@keyframes drip {
  0%, 100% { transform: scaleY(0.5); opacity: 0.4; }
  50%      { transform: scaleY(1);   opacity: 1; }
}

/* =========================================================
   Slides (homepage narrative)
   ========================================================= */

.slide {
  padding: clamp(4rem, 10vh, 7rem) clamp(1rem, 4vw, 2rem);
}
.slide:nth-of-type(even) {
  background: var(--cream);
}

.slide-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

/* Even slides flip image to the left. */
.slide:nth-of-type(even) .slide-text   { order: 2; }
.slide:nth-of-type(even) .slide-visual { order: 1; }

.slide-text h2 {
  font-size: clamp(1.75rem, 3.4vw, 2.6rem);
  font-weight: 500;
  color: var(--ink);
  text-wrap: balance;
}

.slide-text .emphasis {
  color: var(--amber-500);
  font-style: italic;
  font-weight: 500;
}
/* `wrap` / `nowrap` are hints to prevent awkward line breaks mid-phrase. */
.slide-text .emphasis.nowrap { white-space: nowrap; }
.slide-text .emphasis.wrap   { white-space: normal; }

.slide-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}
.slide-visual svg {
  width: 100%;
  max-width: 420px;
  height: auto;
}

/* Fade-in on scroll */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* =========================================================
   SVG figure palette (shared across homepage illustrations)
   Classes let us re-color via CSS. Stroke defaults to none.
   ========================================================= */

.svg-fig        { fill: var(--ink-muted); }
.svg-fig-soft   { fill: color-mix(in srgb, var(--ink-muted) 35%, var(--parchment)); }
.svg-red        { fill: var(--party-red); }
.svg-red-soft   { fill: var(--party-red-soft); }
.svg-blue       { fill: var(--party-blue); }
.svg-blue-soft  { fill: var(--party-blue-soft); }
.svg-teal       { fill: var(--teal-700); }
.svg-teal-soft  { fill: var(--teal-400); }
.svg-amber      { fill: var(--amber-500); }
.svg-amber-soft { fill: var(--amber-300); }
.svg-ink        { fill: var(--ink); }
.svg-paper      { fill: var(--white); stroke: var(--rule); stroke-width: 1; }
.svg-rule       { fill: none; stroke: var(--ink-muted); stroke-width: 1.5; }
.svg-rule-dashed{ fill: none; stroke: var(--ink-muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.svg-ink-line   { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.svg-amber-line { fill: none; stroke: var(--amber-500); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.svg-label      { fill: var(--ink-soft); font-family: var(--font-sans); font-size: 12px; font-weight: 600; }
.svg-label-sm   { fill: var(--ink-muted); font-family: var(--font-sans); font-size: 10px; font-weight: 500; }
.svg-label-big  { fill: var(--ink); font-family: var(--font-serif); font-size: 22px; font-weight: 500; }

/* =========================================================
   FAQ page
   ========================================================= */

.page {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: clamp(3rem, 8vh, 5rem) 1rem clamp(4rem, 10vh, 7rem);
}

.page-header {
  text-align: center;
  margin-bottom: clamp(2.5rem, 6vh, 4rem);
}
.page-header h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  color: var(--teal-900);
  font-weight: 500;
}
.page-header p {
  max-width: 48ch;
  margin: 1rem auto 0;
  color: var(--ink-soft);
  font-size: 1.125rem;
}

.faq-list {
  max-width: 720px;
  margin: 0 auto;
  border-top: 1px solid var(--rule);
}

.faq-item {
  border-bottom: 1px solid var(--rule);
}

.faq-trigger {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 1.5rem 0.25rem;
  text-align: left;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  font-weight: 500;
  line-height: 1.3;
  transition: color 0.15s ease;
}
.faq-trigger:hover { color: var(--teal-900); }

.faq-chevron {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 0.35rem;
  color: var(--teal-700);
  transition: transform 0.25s ease;
}
.faq-item[open] .faq-chevron,
.faq-trigger[aria-expanded="true"] .faq-chevron {
  transform: rotate(180deg);
}

.faq-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s ease;
}
.faq-panel > div {
  overflow: hidden;
}
.faq-panel.is-open {
  grid-template-rows: 1fr;
}
.faq-answer {
  color: var(--ink-soft);
  font-size: 1.0625rem;
  line-height: 1.7;
  padding: 0 0.25rem 1.75rem;
  max-width: 64ch;
}
.faq-answer p + p { margin-top: 0.9rem; }

/* =========================================================
   About page
   ========================================================= */

.about {
  max-width: 720px;
  margin: 0 auto;
}
.about-lede {
  font-family: var(--font-serif);
  font-size: clamp(1.375rem, 2.5vw, 1.875rem);
  font-weight: 400;
  line-height: 1.35;
  color: var(--ink);
  text-wrap: balance;
}

.about-list {
  list-style: none;
  margin-top: 2.5rem;
  border-top: 1px solid var(--rule);
}
.about-list li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 1.125rem;
  color: var(--ink-soft);
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}
.about-list li::before {
  content: "-";
  color: var(--teal-400);
  font-weight: 600;
  flex-shrink: 0;
}
.about-closing {
  margin-top: 2.5rem;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 500;
  color: var(--teal-900);
  text-align: center;
}

/* =========================================================
   Footer
   ========================================================= */

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 2.5rem 1.5rem 3rem;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.875rem;
  background: var(--parchment);
}
.site-footer .brand {
  font-size: 0.9375rem;
  justify-content: center;
  margin-bottom: 0.75rem;
  color: var(--ink-soft);
}
.site-footer .brand img { width: 22px; height: 22px; }
.site-footer p { margin: 0 auto; }

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 760px) {
  .slide-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .slide:nth-of-type(even) .slide-text   { order: 2; }
  .slide:nth-of-type(even) .slide-visual { order: 1; }
  .slide-visual svg { max-width: 320px; }

  .site-nav { gap: 1rem; }
  .site-nav a { font-size: 0.875rem; }
  .brand span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* =========================================================
   Buttons and CTAs
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
  border: 2px solid transparent;
}
.btn:hover  { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--teal-700);
  color: var(--white);
  border-color: var(--teal-700);
}
.btn-primary:hover {
  background: var(--teal-900);
  border-color: var(--teal-900);
  color: var(--white);
}

.btn-secondary {
  background: transparent;
  color: var(--teal-900);
  border-color: var(--teal-700);
}
.btn-secondary:hover {
  background: var(--teal-700);
  color: var(--white);
}

.cta-row {
  display: flex;
  gap: 0.875rem;
  flex-wrap: wrap;
  margin-top: 1.75rem;
}

/* =========================================================
   Slide body prose + text-only variant
   ========================================================= */

.slide-text p {
  font-size: 1.0625rem;
  color: var(--ink-soft);
  margin-top: 1rem;
  line-height: 1.65;
  max-width: 60ch;
}

.slide--text .slide-inner {
  grid-template-columns: 1fr;
  max-width: 720px;
}
.slide--text .slide-text { grid-column: 1; order: 0; }

/* Dashed-bullet list used for "what changes" */
.changes-list {
  list-style: none;
  margin-top: 1.5rem;
  padding: 0;
}
.changes-list li {
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 1.0625rem;
  color: var(--ink-soft);
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  line-height: 1.55;
}
.changes-list li:first-child { border-top: 1px solid var(--rule); }
.changes-list li::before {
  content: "\2014";
  color: var(--teal-400);
  font-weight: 600;
  flex-shrink: 0;
}

/* Numbered "rules" on the case page */
.rule-list {
  list-style: none;
  margin-top: 1.75rem;
  padding: 0;
  counter-reset: rule;
}
.rule-list li {
  padding: 1.25rem 0 1.25rem 3.25rem;
  position: relative;
  border-bottom: 1px solid var(--rule);
  font-size: 1.0625rem;
  color: var(--ink-soft);
  line-height: 1.6;
  counter-increment: rule;
}
.rule-list li:first-child { border-top: 1px solid var(--rule); }
.rule-list li::before {
  content: counter(rule);
  position: absolute;
  left: 0;
  top: 1.1rem;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--teal-700);
  border-radius: 50%;
  color: var(--teal-900);
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
}
.rule-list li strong {
  color: var(--ink);
  font-weight: 600;
  display: block;
  margin-bottom: 0.25rem;
}

/* Subsection within a slide (h3 block) */
.subsection {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
.subsection h3 {
  font-family: var(--font-serif);
  font-size: clamp(1.375rem, 2.4vw, 1.75rem);
  font-weight: 500;
  color: var(--teal-900);
  margin-bottom: 0.75rem;
}

/* Q&A blocks for the "hard questions" section */
.qa-list {
  margin-top: 1.5rem;
  border-top: 1px solid var(--rule);
}
.qa {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}
.qa h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--ink);
  font-style: italic;
  margin-bottom: 0.625rem;
}
.qa p {
  color: var(--ink-soft);
  max-width: 64ch;
  line-height: 1.65;
}
.qa p + p { margin-top: 0.75rem; }

/* Numbered steps (implementation section) */
.steps {
  list-style: none;
  margin: 1.75rem 0;
  padding: 0;
  counter-reset: step;
}
.steps li {
  padding: 1rem 0 1rem 3.25rem;
  position: relative;
  font-size: 1.0625rem;
  color: var(--ink);
  counter-increment: step;
}
.steps li::before {
  content: "Step " counter(step);
  position: absolute;
  left: 0;
  top: 1rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber-500);
}

/* Alt background variant for CTA section so it stands apart */
.slide.slide--cta {
  background: var(--cream);
  border-top: 1px solid var(--rule);
}
.slide--cta .slide-text h2 { color: var(--teal-900); }

/* Worked-example vote-count list */
.tally {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  max-width: 28rem;
}
.tally li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 1rem;
  color: var(--ink-soft);
}
.tally li strong {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-serif);
  font-size: 1.0625rem;
}
