:root {
  --paper: #F3F5F3;
  --paper-2: #E8ECE9;
  --card: #FFFFFF;
  --ink: #16212C;
  --muted: #56616D;
  --rule: #CFD6D1;
  --total: #A9B7C3;
  --exp: #1E3A55;
  --event: #8A6D1F;
  --low: #B03A2E;
  --mid: #D39B2A;
  --high: #2E7D5B;
  --focus: #1E6FB8;
  --serif: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Public Sans", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.6;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.wrap { max-width: 44rem; margin: 0 auto; padding: 0 1.25rem; }
.wrap-wide { max-width: 60rem; margin: 0 auto; padding: 0 1.25rem; }

h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.1rem, 5.4vw, 3.4rem); line-height: 1.08; margin: 0 0 1.25rem; max-width: 18ch; }
h2 { font-size: clamp(1.55rem, 3.4vw, 2.05rem); line-height: 1.2; margin: 0 0 1rem; }
p { margin: 0 0 1rem; }
strong { font-weight: 600; }
em { font-style: italic; }
a { color: var(--exp); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

/* Hero */
.hero { padding: 4.5rem 0 3.5rem; border-bottom: 1px solid var(--rule); background: linear-gradient(var(--paper), var(--paper-2)); }
.lede { font-size: 1.3rem; line-height: 1.55; color: var(--ink); max-width: 38rem; }
.answer {
  font-family: var(--sans); font-size: 1rem; line-height: 1.6;
  background: var(--card); border-left: 4px solid var(--exp);
  padding: 1rem 1.2rem; margin: 1.5rem 0 2.5rem; max-width: 40rem;
}
.hero-chart { margin-top: 0.5rem; }

figcaption, .panel-sentence { font-family: var(--sans); }
.fig-title { display: block; font-weight: 600; font-size: 1.05rem; line-height: 1.35; margin-bottom: 0.3rem; }
.fig-sub { display: block; color: var(--muted); font-size: 0.9rem; line-height: 1.45; margin-bottom: 1.25rem; max-width: 46rem; }
.fig-note { font-family: var(--sans); font-size: 0.82rem; color: var(--muted); line-height: 1.45; margin: 0.75rem 0 0; }

/* Bar list (HTML bars, responsive) */
.barlist { font-family: var(--sans); display: grid; gap: 0.55rem; }
.bar-row { display: grid; grid-template-columns: minmax(7.5rem, 11rem) 1fr; align-items: center; gap: 0.75rem; }
.bar-name { font-size: 0.98rem; font-weight: 600; line-height: 1.2; }
.bar-name small { display: block; font-weight: 400; color: var(--muted); font-size: 0.78rem; margin-top: 0.1rem; }
.bar-track { position: relative; height: 2.35rem; background: var(--card); border-radius: 3px; }
.bar-fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 3px; transition: width .9s cubic-bezier(.2,.7,.2,1); }
.bar-val { position: absolute; top: 50%; transform: translateY(-50%); font-weight: 700; font-size: 0.95rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-val.inside { color: #fff; }
.bar-zero { position: absolute; top: -0.35rem; bottom: -0.35rem; width: 2px; background: var(--ink); }
.barlist-axis { display: grid; grid-template-columns: minmax(7.5rem, 11rem) 1fr; gap: 0.75rem; font-size: 0.78rem; color: var(--muted); }
.barlist-axis span:last-child { display: flex; justify-content: space-between; }
@media (prefers-reduced-motion: reduce) { .bar-fill { transition: none; } }

.legend-scale { font-family: var(--sans); font-size: 0.8rem; color: var(--muted); display: flex; align-items: center; gap: 0.6rem; margin-top: 1rem; flex-wrap: wrap; }
.legend-scale .scale { display: inline-block; width: 9rem; height: 0.6rem; border-radius: 2px; background: linear-gradient(90deg, var(--low), var(--mid), var(--high)); }

main section.wrap { padding: 3.5rem 1.25rem 0.5rem; }
main section + section { border-top: 1px solid var(--rule); margin-top: 3rem; }

/* Sources */
.sources3, .criteria { margin: 1.25rem 0 1.5rem; display: grid; gap: 0.9rem; }
.sources3 > div, .criteria > div { background: var(--card); padding: 0.9rem 1.1rem; border-radius: 4px; }
.sources3 dt, .criteria dt { font-family: var(--sans); font-weight: 700; font-size: 0.95rem; margin-bottom: 0.2rem; }
.sources3 dd, .criteria dd { margin: 0; font-size: 1.02rem; line-height: 1.5; }
.note { font-size: 1rem; color: var(--muted); }

/* Picker */
.picker { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 1.25rem 0 1rem; font-family: var(--sans); }
.picker button {
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  border: 1px solid var(--rule); background: var(--card); color: var(--ink);
  padding: 0.5rem 0.85rem; border-radius: 999px; min-height: 44px;
}
.picker button[aria-selected="true"] { background: var(--exp); border-color: var(--exp); color: #fff; }

.panel { background: var(--card); margin: 0 0 1.5rem; padding: 1.25rem 1.25rem 1rem; border-radius: 6px; }
.panel-sentence { font-size: 1rem; line-height: 1.55; margin: 0 0 1rem; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--sans); }
.legend { display: flex; flex-wrap: wrap; gap: 1rem; font-family: var(--sans); font-size: 0.82rem; color: var(--muted); margin-top: 0.5rem; }
.sw { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 2px; margin-right: 0.35rem; vertical-align: -1px; }
.sw-total { background: var(--total); }
.sw-exp { background: var(--exp); }
.sw-event { background: var(--event); border-radius: 50%; }

/* Score grid */
.scoregrid { font-family: var(--sans); display: grid; gap: 2px; background: var(--paper); margin-top: 1.5rem; }
.sg-row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, 5.5rem); gap: 2px; }
.sg-head { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.sg-head > div { padding: 0.35rem 0.5rem; text-align: center; }
.sg-head > div:first-child { text-align: left; }
.sg-row button {
  font: inherit; text-align: left; background: var(--card); border: 0; cursor: pointer;
  padding: 0.7rem 0.75rem; font-weight: 600; font-size: 0.95rem; color: var(--ink); min-height: 44px;
}
.sg-row button[aria-pressed="true"] { box-shadow: inset 4px 0 0 var(--exp); background: #F7FAFC; }
.sg-cell { display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.05rem; color: #fff; font-variant-numeric: tabular-nums; }
.sg-cell.dark { color: var(--ink); }

.policy-detail { background: var(--card); padding: 1.1rem 1.25rem; margin-top: 0.9rem; border-radius: 4px; border-left: 4px solid var(--exp); }
.policy-detail h3 { font-family: var(--serif); font-weight: 600; font-size: 1.25rem; margin: 0 0 0.6rem; }
.policy-detail dl { margin: 0; display: grid; gap: 0.6rem; }
.policy-detail dt { font-family: var(--sans); font-weight: 700; font-size: 0.85rem; }
.policy-detail dd { margin: 0; font-size: 1.02rem; line-height: 1.5; }
.policy-detail .dates { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); margin-top: 0.8rem; }

.takeaways p { font-size: 1.05rem; }

/* Compare table */
.table-scroll { overflow-x: auto; margin: 1.25rem 0 1.5rem; }
.compare { border-collapse: collapse; width: 100%; min-width: 30rem; font-family: var(--sans); font-size: 0.92rem; line-height: 1.45; background: var(--card); }
.compare th, .compare td { padding: 0.75rem 0.85rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--paper-2); }
.compare thead th { font-size: 0.85rem; color: var(--muted); font-weight: 700; border-bottom: 2px solid var(--rule); }
.compare tbody th { font-weight: 700; width: 24%; }

/* Method */
.method details { background: var(--card); border-radius: 4px; margin-bottom: 0.7rem; padding: 0.2rem 1.1rem; }
.method summary { font-family: var(--sans); font-weight: 700; cursor: pointer; padding: 0.75rem 0; min-height: 44px; }
.method details p, .method li { font-size: 1rem; line-height: 1.55; }
.method ul { padding-left: 1.2rem; margin: 0 0 1rem; }
.method li { margin-bottom: 0.45rem; }
.disclosure { font-family: var(--sans); font-size: 0.88rem; color: var(--muted); margin-top: 1.5rem; }

.footer { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); padding-top: 2rem; padding-bottom: 3rem; border-top: 1px solid var(--rule); margin-top: 3rem; }

@media (max-width: 34rem) {
  body { font-size: 1.08rem; }
  .hero { padding-top: 2.5rem; }
  .bar-row, .barlist-axis { grid-template-columns: 6.3rem 1fr; gap: 0.5rem; }
  .bar-name { font-size: 0.86rem; }
  .panel { padding: 1rem 0.8rem; }
  .sg-row { grid-template-columns: minmax(0, 1fr) repeat(3, 4.4rem); }
  .sg-head { font-size: 0.68rem; }
  .sg-head > div { padding: 0.35rem 0.2rem; }
}
