/* Living Civilization — Candidate Analysis Series
   Shared stylesheet v1.1
   ======================================================
   v1.0 — Initial release
   v1.1 — Added: .race-header, .voice-section,
           .tag-stated, .candidate-card-link,
           .compare-grid and cg- comparison table classes.
           Driven by WA-46 Pos. 1 analyses (May 2026).
   ====================================================== */

/* --- Color system --- */
:root {
  --bg: #FAF9F6;
  --bg2: #F0EEE9;
  --bg3: #E8E5DE;
  --text: #2C2A26;
  --text2: #6B6860;
  --text3: #9A9790;
  --border: #D8D5CD;

  --accent: #1D6B50;
  --accent-light: #E1F2EB;

  --wealth: #1D6B50;
  --wealth-light: #E1F2EB;
  --debt: #A83228;
  --debt-light: #FAECEB;
  --mixed: #946B1A;
  --mixed-light: #FBF2DD;

  --serif: 'Newsreader', Georgia, serif;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1A1917;
    --bg2: #242320;
    --bg3: #2E2D29;
    --text: #E0DED8;
    --text2: #A09D96;
    --text3: #706D66;
    --border: #3D3B36;

    --accent: #5DCAA5;
    --accent-light: #0F3328;

    --wealth: #5DCAA5;
    --wealth-light: #0F3328;
    --debt: #F09595;
    --debt-light: #3A1A1A;
    --mixed: #EFC04E;
    --mixed-light: #332A10;
  }
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
  -webkit-font-smoothing: antialiased;
}

/* --- Typography --- */
h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2rem;
  line-height: 1.2;
  margin: 0 0 0.25rem;
}

h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.35rem;
  margin: 2.5rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

h2:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text2);
  margin: 0 0 0.75rem;
}

p {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  color: var(--text);
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

a:hover {
  border-bottom-color: var(--accent);
}

.subtitle {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--text2);
  font-style: italic;
  margin: 0 0 2rem;
}

.meta {
  font-size: 0.8rem;
  color: var(--text3);
  margin: 0 0 2rem;
}

.hint {
  font-size: 0.8rem;
  color: var(--text3);
  margin-bottom: 1rem;
}

/* --- Series navigation --- */
.series-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 1.5rem;
  padding: 0 0 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text3);
}

.series-nav a {
  color: var(--text2);
  font-weight: 500;
}

.series-nav .sep {
  color: var(--border);
}

/* --- Race context block ---
     Appears at the top of every candidate page and comparison
     page to orient readers who arrive directly at the URL.
     --------------------------------------------------------- */
.race-header {
  background: var(--bg2);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin: 0 0 2rem;
}

.race-header h2 {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
  margin: 0 0 0.35rem;
  padding: 0;
  border: none;
}

.race-header p {
  font-size: 0.88rem;
  color: var(--text2);
  margin: 0;
  line-height: 1.55;
}

/* --- Author voice section ---
     Left-border serif block for the author's personal framing.
     Visually distinct from analytical content so readers can
     immediately see what is framework analysis vs. personal voice.
     -------------------------------------------------------------- */
.voice-section {
  border-left: 3px solid var(--accent);
  padding: 0.25rem 0 0.25rem 1.5rem;
  margin: 1.5rem 0 2rem;
}

.voice-section p {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 1rem;
}

.voice-section p:last-child {
  margin: 0;
}

/* --- Expandable sections (8D axes) --- */
.exp {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 0 0 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.exp:hover {
  border-color: var(--text3);
}

.exp-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--bg);
  transition: background 0.15s;
}

.exp-head:hover {
  background: var(--bg2);
}

.exp-arrow {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  transition: transform 0.25s ease;
  color: var(--text3);
}

.exp.open .exp-arrow {
  transform: rotate(90deg);
}

.exp-info {
  flex: 1;
  min-width: 0;
}

.exp-title {
  font-weight: 500;
  font-size: 0.95rem;
  margin: 0 0 4px;
}

.exp-summary {
  font-size: 0.82rem;
  color: var(--text2);
  margin: 0;
}

.exp-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.exp.open .exp-body {
  max-height: 4000px;
}

.exp-content {
  padding: 0 16px 16px 46px;
  font-size: 0.88rem;
  color: var(--text2);
  line-height: 1.65;
}

.exp-content p {
  font-size: 0.88rem;
  color: var(--text2);
}

/* --- Axis bar --- */
.axis-bar {
  position: relative;
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  margin: 8px 0 6px;
}

.axis-bar-center {
  position: absolute;
  left: 50%;
  top: -3px;
  width: 1px;
  height: 12px;
  background: var(--border);
}

.axis-dot {
  position: absolute;
  top: -5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid var(--bg);
  transform: translateX(-8px);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.axis-fill {
  position: absolute;
  height: 100%;
  border-radius: 3px;
  opacity: 0.5;
}

.axis-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text3);
}

.axis-labels .active {
  color: var(--text);
  font-weight: 500;
}

/* --- Tags --- */
.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: 20px;
  margin-top: 2px;
}

.tag-wealth { background: var(--wealth-light); color: var(--wealth); }
.tag-debt   { background: var(--debt-light);   color: var(--debt);   }
.tag-mixed  { background: var(--mixed-light);  color: var(--mixed);  }

/* tag-stated: used when scoring a challenger with no legislative record.
   Signals that the alignment derives from stated platform positions rather
   than a demonstrated voting history. Pair with tag-wealth, tag-debt, or
   tag-mixed. Example: <span class="tag tag-wealth tag-stated">...</span>  */
.tag-stated {
  outline: 1.5px dashed currentColor;
  outline-offset: -2px;
  opacity: 0.8;
}

/* --- Compass grid --- */
.compass-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 0 0 1.5rem;
}

@media (max-width: 560px) {
  .compass-grid { grid-template-columns: 1fr; }
}

.compass-card {
  background: var(--bg2);
  border-radius: 12px;
  padding: 16px;
}

/* --- Field cards (Tribal, Jurisdictional, Economic, Cultural) --- */
.field-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 0 0 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.field-card:hover {
  border-color: var(--text3);
}

.field-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--bg);
  transition: background 0.15s;
}

.field-head:hover {
  background: var(--bg2);
}

.field-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.field-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.field-card.open .field-body {
  max-height: 4000px;
}

.field-content {
  padding: 0 16px 16px 64px;
  font-size: 0.88rem;
  color: var(--text2);
  line-height: 1.65;
}

.field-content p {
  font-size: 0.88rem;
  color: var(--text2);
}

.field-card .exp-arrow {
  color: var(--text3);
}

.field-card.open .exp-arrow {
  transform: rotate(90deg);
}

/* --- Score bar (for fields) --- */
.score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 4px;
  font-size: 0.75rem;
}

.score-label {
  color: var(--text3);
  min-width: 40px;
  text-align: right;
}

.score-track {
  flex: 1;
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  position: relative;
}

.score-fill {
  height: 100%;
  border-radius: 3px;
}

/* --- Summary / synthesis box --- */
.summary-box {
  background: var(--bg2);
  border-radius: 12px;
  padding: 20px;
  margin: 2rem 0;
  border-left: 3px solid var(--accent);
}

.summary-box p { margin: 0; }

.summary-box .label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
  margin: 0 0 6px;
}

/* --- Candidate card links ---
     Used on comparison pages to link to individual candidate analyses.
     Two-column grid at full width, single column on mobile.
     ------------------------------------------------------------------ */
.candidate-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 1.5rem 0 2rem;
}

@media (max-width: 560px) {
  .candidate-cards { grid-template-columns: 1fr; }
}

.candidate-card-link {
  display: block;
  text-decoration: none;
  border: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.25rem 1rem;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.candidate-card-link:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.07);
  border-color: var(--accent);
}

.candidate-card-link .card-label {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text3);
  margin-bottom: 0.35rem;
}

.candidate-card-link .card-name {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.4rem;
  line-height: 1.2;
}

.candidate-card-link .card-role {
  font-size: 0.85rem;
  color: var(--text2);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.candidate-card-link .card-cta {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
}

/* --- Comparison table ---
     Side-by-side field scoring grid for comparison pages.
     Three-column layout: field label | candidate A | candidate B.
     Alternating row backgrounds via .cg-row-a and .cg-row-b.
     ------------------------------------------------------------- */
.compare-grid {
  display: grid;
  grid-template-columns: 130px 1fr 1fr;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin: 1.25rem 0 2.5rem;
  font-family: var(--sans);
}

@media (max-width: 560px) {
  .compare-grid { grid-template-columns: 90px 1fr 1fr; }
}

.cg-cell {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Remove bottom border from the last three cells (bottom row) */
.cg-cell:nth-last-child(1),
.cg-cell:nth-last-child(2),
.cg-cell:nth-last-child(3) {
  border-bottom: none;
}

.cg-header {
  background: var(--bg3);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text2);
  display: flex;
  align-items: center;
}

.cg-field-label {
  background: var(--bg2);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Small field icon inside comparison table */
.cg-field-label .fi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
}

.cg-score-cell {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  justify-content: center;
}

.cg-bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--text3);
}

.cg-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}

.cg-bar-fill {
  height: 100%;
  border-radius: 3px;
}

/* Comparison table tags (smaller than standard page tags) */
.cg-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  width: fit-content;
}

.cg-tag-wealth { background: var(--wealth-light); color: var(--wealth); }
.cg-tag-mixed  { background: var(--mixed-light);  color: var(--mixed);  }
.cg-tag-debt   { background: var(--debt-light);   color: var(--debt);   }

/* Alternating row backgrounds */
.cg-row-a .cg-cell { background: var(--bg); }
.cg-row-b .cg-cell { background: var(--bg2); }

/* --- Footer --- */
.page-footer {
  font-size: 0.82rem;
  color: var(--text3);
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.page-footer a {
  color: var(--text3);
}

/* --- Utility --- */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }