/* One visual grammar.
   Casing: sentence case everywhere; uppercase small caps only for .eyebrow, .poles and .src.
   Type scale: 9.5 small caps · 11 legend and metadata · 12.5 body · 13 scores · 19 headings · wordmark.
   Orange (--hero): a rise, an <em> in the story, an eyebrow, the chosen country's name in a heading. Nothing else.
   Marks: size (--s) carries the size of a move, tint (--p) carries the confidence of the fit behind it.
   Components: .card for every panel, .pill for every small number or label, .dot for every marker. */
:root {
  --bg: #F0F0EE; --ink: #1F1E1C; --muted: rgba(31,30,28,.60); --lab: rgba(31,30,28,.72);
  --faint: rgba(31,30,28,.32); --grid: rgba(31,30,28,.16); --wash: rgba(31,30,28,.05);
  --data2: #8F8E86; --faintdata: #C0BFB7; --hero: #F5572F;
  --radius: 20px; --pad: 20px 22px 16px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--ink); font-family: 'Inter', sans-serif; -webkit-font-smoothing: antialiased; padding: 32px 32px 64px; font-size: 12.5px; line-height: 1.5; font-variant-numeric: tabular-nums; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
em { font-style: normal; color: var(--hero); font-weight: 700; }

/* type */
.eyebrow { font-size: 9.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--hero); margin-bottom: 8px; }
.src, .poles { font-size: 9.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.src { margin-top: 12px; line-height: 1.5; }
.meta, .legend, .sub { font-size: 11px; color: var(--muted); line-height: 1.5; }
h2 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
h2 .who { color: var(--hero); }
.sub { margin-top: 4px; }

/* header */
.page { max-width: 1120px; margin: 0 auto; }
.pagehead { margin-bottom: 20px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand .logo { width: clamp(40px, 4.5vw, 56px); height: auto; flex: none; }
.wordmark { font-size: clamp(24px, 3vw, 34px); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
.tagline { font-size: clamp(14px, 1.5vw, 17px); font-weight: 700; letter-spacing: -.02em; color: var(--lab); margin-top: 4px; }

/* components */
.card { background: var(--bg); border: 1px solid var(--grid); border-radius: var(--radius); padding: var(--pad); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; line-height: 1.3; padding: 3px 9px; border-radius: 99px; border: 1px solid transparent; background: var(--wash); color: var(--ink); white-space: nowrap; }
.pill.muted { background: transparent; border-color: var(--grid); color: var(--muted); }
/* --p is the tint share (confidence band) and --s the size share (size of the move), set per row */
.pill.up { background: color-mix(in srgb, var(--hero) var(--p, 100%), var(--bg)); }
.pill.down { background: color-mix(in srgb, var(--ink) var(--p, 100%), var(--bg)); }
.pill.down.deep { color: var(--bg); }
.pill.deep { font-weight: 800; }
.pill.good { background: var(--ink); color: var(--bg); }
.pill.mid { background: var(--wash); }
.pill.weak { background: transparent; border-color: var(--grid); border-style: dashed; color: var(--muted); }
button.pill { padding: 5px 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); vertical-align: -1px; }
.dot.hollow { border: 1.5px solid var(--ink); background: var(--bg); }
.dot.up { background: var(--hero); }
.dot.down { background: var(--ink); }
.dot.faint { width: 6px; height: 6px; background: var(--faint); }
.tick { display: inline-block; width: 1px; height: 11px; background: var(--data2); vertical-align: -2px; }

/* deck: country and public voice side by side on one line, sticky while the page scrolls */
.deck { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 10px 24px; align-items: start; padding: 14px 22px 12px; margin-bottom: 14px; }
.pagehead .eyebrow strong { font-weight: 800; color: var(--ink); }
.deck .eyebrow { margin-bottom: 6px; }
.deck .meta { grid-column: 1 / -1; min-height: 1.5em; }
select { font: inherit; font-weight: 600; width: 100%; height: 40px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--grid); background: transparent; color: var(--ink); }
.deck.empty select { font-size: 13px; font-weight: 800; padding: 0 16px; border: 2px solid var(--ink); }
.voice { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; height: 40px; }
.voice button { height: 32px; padding: 0 14px; border: 1px solid var(--ink); border-radius: 99px; background: #fff; color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; justify-self: start; }
.voice button[aria-pressed=true] { background: var(--ink); color: var(--bg); }
.voice button:disabled { opacity: .35; cursor: default; }
.voice output { font-size: 11px; color: var(--muted); white-space: nowrap; }
.voice output strong { font-size: 13px; color: var(--ink); }

/* story: one sentence under the deck */
.story { min-height: 1.5em; margin: 0 2px 14px; font-size: 13px; color: var(--lab); }

/* workspace: ranking in the centre; the values card at the right is parked (hidden) until the predictor arms are settled */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.workspace:has(aside:not([hidden])) { grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); }

/* values: one spectrum row per dimension */
.valuelist { list-style: none; }
.value { padding: 10px 0 8px; border-top: 1px solid var(--grid); }
.vhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.vlabel { font-weight: 700; line-height: 1.25; cursor: help; }
.poles { display: flex; justify-content: space-between; margin-top: 6px; }
.strip { position: relative; height: 22px; margin: 2px 0; }
.strip::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--data2); }
.strip::after { content: ''; position: absolute; left: 50%; top: 4px; bottom: 4px; width: 1px; background: var(--faintdata); }
.strip i { position: absolute; top: 50%; width: 5px; height: 5px; border-radius: 50%; background: var(--faint); transform: translate(-50%, -50%); }
.strip .me { width: 11px; height: 11px; background: var(--ink); }
.value input[type=range] { width: 100%; margin: 2px 0 0; accent-color: var(--ink); }

/* ranking: one row per risk */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; max-width: 420px; justify-content: flex-end; }
.legend-key { flex-basis: 100%; text-align: right; }
.legend .dot, .legend .tick { margin-right: 5px; }
aside .sub { margin-bottom: 8px; }
aside .legend { margin-bottom: 6px; }
.risklist { list-style: none; }
.risk { display: grid; grid-template-columns: 22px minmax(0, 1fr) minmax(140px, 320px) 116px; gap: 12px; align-items: center; padding: 8px 6px; border-top: 1px solid var(--grid); cursor: pointer; border-radius: 8px; }
.risk:hover, .risk.open { background: var(--wash); }
.risk:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.risk .rank { font-size: 11px; font-weight: 700; color: var(--muted); text-align: right; }
.risk .name { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.risk .name strong { font-weight: 700; line-height: 1.25; }
.risk .tag { font-size: 11px; color: var(--muted); }
.risk .score { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.risk .score strong { font-size: 13px; font-weight: 800; }
.bar .track { position: relative; height: 18px; }
.bar .track::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--data2); }
.bar .tick { position: absolute; top: calc(50% - 4px); width: 1px; height: 8px; background: var(--faintdata); }
.bar .dot { position: absolute; top: 50%; transform: translate(-50%, -50%); }
.bar .dot.solid { width: calc(8px + 8px * var(--s, 0)); height: calc(8px + 8px * var(--s, 0)); }
.bar .dot.solid.up { background: color-mix(in srgb, var(--hero) var(--p, 100%), var(--bg)); }
.bar .dot.solid.down { background: color-mix(in srgb, var(--ink) var(--p, 100%), var(--bg)); }
.bar .link { position: absolute; top: 50%; height: calc(1.5px + 3.5px * var(--s, 0)); transform: translateY(-50%); background: var(--data2); }
.bar .link.up { background: color-mix(in srgb, var(--hero) var(--p, 100%), var(--bg)); }
.bar .link.down { background: color-mix(in srgb, var(--ink) var(--p, 100%), var(--bg)); }

/* risk dialog */
dialog { margin: auto; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 1px solid var(--grid); border-radius: var(--radius); padding: 22px 26px 20px; background: var(--bg); color: var(--ink); font-size: 12.5px; line-height: 1.55; }
dialog::backdrop { background: rgba(31,30,28,.35); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.dialog-head .eyebrow { margin-bottom: 6px; }
dialog .close { font-size: 20px; line-height: 1; border: 0; background: transparent; color: var(--muted); padding: 0 4px; }
dialog .def { color: var(--lab); margin-bottom: 12px; }
.scores { display: grid; grid-template-columns: repeat(4, auto); gap: 10px 24px; justify-content: start; align-items: end; margin-bottom: 12px; }
.scores dt { font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.scores dd { font-size: 19px; font-weight: 800; line-height: 1.2; }
dialog .note { color: var(--lab); margin: 8px 0; }
dialog details { border-top: 1px solid var(--grid); padding: 8px 0 4px; }
dialog summary, .fine summary { font-weight: 700; cursor: pointer; }
dialog table { border-collapse: collapse; width: 100%; font-size: 11px; margin: 8px 0 6px; }
dialog th, dialog td { padding: 4px 12px 4px 0; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: top; }
dialog th { font-size: 9.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
dialog td.num { text-align: right; white-space: nowrap; }
dialog .q { color: var(--lab); }
dialog .terms td:first-child { font-weight: 600; }
dialog tfoot td { font-weight: 800; border-bottom: 0; }

/* fine print and footer */
.fine { margin-top: 16px; }
.plain { list-style: none; margin-top: 10px; }
.plain li { margin: 6px 0; padding-left: 16px; position: relative; color: var(--lab); }
.plain li::before { content: ''; position: absolute; left: 0; top: .5em; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--ink); }
footer { max-width: 1120px; margin: 32px auto 0; font-size: 11px; color: var(--muted); line-height: 1.7; }
footer ul { list-style: none; }

@media (max-width: 820px) {
  body { padding: 20px 14px 48px; }
  .deck { position: static; grid-template-columns: 1fr; }
  .workspace { grid-template-columns: 1fr; }
  .risk { grid-template-columns: 20px minmax(0, 1fr) 116px; }
  .risk .bar { display: none; }
  .card { padding: 16px 14px 12px; }
}
@media (max-width: 560px) { .scores { grid-template-columns: 1fr 1fr; } .voice { grid-template-columns: 1fr; } }
