/* Styles confined to the five opening cards. */
.opening-slide h2 { font-size:1.3em; line-height:1.2; }
.opening-slide > p:not(.kicker):not(.support):not(.opening-footnote) { font-size:.86em; }
.opening-slide .opening-footnote { color:var(--muted); font-size:.56em; line-height:1.4; margin:.7em 0 0; }
.opening-slide .opening-step { position:absolute; width:0; height:0; overflow:hidden; pointer-events:none; }
.opening-alternatives { display:flex; align-items:center; justify-content:center; gap:28px; margin:1.1em 0; }
.opening-alternatives span:not(.ellipsis) { width:62px; height:62px; border:1.4px solid var(--ink); border-radius:50%; display:grid; place-items:center; font-style:italic; }
.opening-alternatives .ellipsis { color:var(--muted); }
.preference-reading { display:flex; align-items:center; justify-content:center; gap:48px; padding:28px 0; }
.preference-reading .preference-symbol { color:var(--accent); font-size:1.55em; }
.preference-reading > span:last-child { font-size:.84em; }
.borda-method { display:flex; align-items:baseline; flex-wrap:wrap; gap:8px 18px; }
.borda-method-name { color:var(--accent); white-space:nowrap; }
.borda-method-name > span { margin-right:10px; }
.borda-horizontal { display:grid; grid-template-columns:.9fr 1.15fr; column-gap:28px; margin:34px 0 0; }
.borda-ranking-panel { min-width:0; padding-right:22px; border-right:1px solid #ccc; }
.borda-score-panel { min-width:0; }
.borda-panel-heading { height:44px; position:relative; }
.borda-panel-heading h3 { position:absolute; top:0; left:0; margin:0; white-space:nowrap; }
.borda-score-panel h3 { margin:0 0 18px; }
.borda-person-only, .borda-profile-only { transition:opacity .65s var(--ease), transform .75s var(--ease); }
.borda-profile-only { opacity:0; transform:translateX(16px); }
.borda-introduction.has-profile .borda-profile-only { opacity:1; transform:translateX(0); }
.borda-introduction.has-profile .borda-person-only { opacity:0; transform:translateX(-16px); }
.borda-list-head { display:flex; justify-content:space-between; font-size:.57em; color:var(--muted); padding:0 4px 10px 4px; }
.borda-ranking-row { display:grid; grid-template-columns:22px 1fr 29px; column-gap:8px; align-items:center; min-height:47px; }
.borda-ranking-order { font-size:.62em; white-space:nowrap; transition:transform .75s var(--ease); }
.borda-introduction.has-profile .borda-ranking-order { transform:translateX(-25px); }
.person-index { font-size:.55em; color:var(--muted); }
.ranking-mass { font-size:.63em; color:var(--accent); text-align:center; }
.borda-ranking-ellipsis { text-align:center; font-size:.63em; padding:7px 0; }
.borda-points { display:flex; gap:20px; align-items:center; justify-content:center; margin:16px 0 12px; }
.borda-points > div:not(.points-ellipsis) { display:flex; flex-direction:column; align-items:center; min-width:68px; }
.borda-points > div > span { color:var(--muted); font-size:.62em; }
.borda-points strong { font-weight:400; color:var(--accent); font-size:1.05em; margin-top:7px; }
.borda-formula { height:168px; position:relative; margin:15px 0 6px; font-size:.62em; }
.borda-formula > div { position:absolute; inset:0; display:flex; flex-direction:column; justify-content:center; transition:opacity .65s var(--ease), transform .75s var(--ease); }
.borda-formula .katex-display { margin:.3em 0; }
.borda-formula .formula-profile { opacity:0; transform:translateY(28px); }
.borda-introduction.has-profile-score .formula-sample { opacity:0; transform:translateY(-35px); }
.borda-introduction.has-profile-score .formula-profile { opacity:1; transform:translateY(0); }
.formula-profile .expectation-line { color:var(--accent); }
.reveal .warmup-definition { font-size:.64em; line-height:1.4; margin:16px 0 0; }
.borda-introduction .borda-horizontal { margin-top:22px; }
.borda-introduction .borda-formula { height:130px; margin-top:12px; }
.reveal .warmup-formal-setting { font-size:.72em; margin:24px 0; }
.warmup-definitions .formal-block > div { font-size:.63em; }
.warmup-definitions .formal-block { margin:24px 0; }
.warmup-definitions .formal-label { color:var(--accent); }
.opening-example { display:grid; grid-template-columns:255px 1fr; gap:24px; margin:28px 0 15px; }
.explicit-profile { border-right:1px solid var(--muted); padding-right:20px; }
.explicit-profile h3 { margin:0 0 15px; }
#opening-profile p { font-size:.65em; margin:9px 0; white-space:nowrap; }
.rank-score-list { display:flex; flex-direction:column; gap:15px; }
.rank-score-row { display:grid; grid-template-columns:24px 140px 1fr; align-items:center; column-gap:15px; min-height:103px; }
.hist-alternative { color:var(--accent); font-weight:400; }
.rank-score-computation { font-size:.55em; line-height:1.6; }
.rank-score-computation > strong { font-size:1.25em; color:var(--accent); }
.example-rank-hist, .original-rank-hist { display:flex; align-items:flex-end; justify-content:center; gap:12px; --probability-scale:110px; }
.rank-column { flex:0 0 32px; text-align:center; }
.rank-bar-space { height:80px; border-bottom:1px solid #ccc; display:flex; align-items:flex-end; }
.rank-bar { width:100%; height:calc(var(--initial) * var(--probability-scale)); background:var(--accent); position:relative; transition:height .85s var(--ease); }
.bar-probability { position:absolute; bottom:calc(100% + 5px); left:50%; transform:translateX(-50%); font-size:14px; white-space:nowrap; }
.rank-label { display:block; font-size:14px; color:var(--muted); margin-top:4px; }
.opening-slide .after-polarization { display:none; }
.opening-winner { text-align:center; margin:15px 0 0; color:var(--accent); }

/* Airier, thin-bar rank distributions, matching the original figure treatment. */
#borda-example .opening-example { grid-template-columns:265px 1fr; gap:36px; margin:36px 0 24px; }
#borda-example .explicit-profile { padding-right:25px; }
#borda-example #opening-profile p { margin:14px 0; }
#borda-example .rank-score-list { gap:26px; }
#borda-example .rank-score-row { grid-template-columns:22px 196px 1fr; column-gap:24px; min-height:114px; }
#borda-example .hist-alternative { font-size:.88em; }
#borda-example .example-rank-hist { position:relative; box-sizing:border-box; width:196px; padding:0 18px; justify-content:space-between; gap:0; --probability-scale:130px; }
#borda-example .example-rank-hist::before { content:""; position:absolute; left:0; right:0; top:90px; border-top:1px solid #c7c7c7; }
#borda-example .rank-column { flex-basis:18px; }
#borda-example .rank-bar-space { height:90px; border-bottom:0; }
#borda-example .rank-bar { background:#a51d1d; }
#borda-example .bar-probability { bottom:calc(100% + 8px); color:var(--muted); }
#borda-example .rank-label { margin-top:9px; line-height:1; }
#borda-example .rank-score-computation { line-height:1.7; }
#borda-example .rank-score-computation > strong { display:block; margin-top:5px; }
#borda-example .opening-winner { margin-top:24px; }
.tournament-formula { height:132px; position:relative; font-size:.86em; }
.tournament-formula > div { position:absolute; inset:0; display:flex; justify-content:center; align-items:center; transition:transform .8s var(--ease), opacity .7s var(--ease), color .7s ease; }
.tournament-formula .rank-formula { transform:translateY(12px); }
.tournament-formula .pairwise-formula { opacity:0; transform:translateY(64px); color:var(--accent); }
#weighted-tournament.has-pairwise-formula .rank-formula { transform:translateY(-34px) scale(.78); opacity:0; color:var(--muted); }
#weighted-tournament.has-pairwise-formula .pairwise-formula { opacity:1; transform:translateY(12px); }
.opening-tournament-row { display:grid; grid-template-columns:440px 1fr; align-items:center; gap:22px; }
.opening-tournament { width:100%; display:block; overflow:visible; }
.tournament-edges { stroke:var(--ink); stroke-width:1.4; color:var(--ink); }
.tournament-nodes { fill:#fff; stroke:var(--ink); stroke-width:1.4; }
.tournament-letters { font-size:24px; font-style:italic; text-anchor:middle; fill:var(--ink); }
.tournament-weights { font-size:24px; text-anchor:middle; fill:var(--accent); }
.tournament-reading { font-size:.63em; }
.tournament-reading p { margin:.55em 0; }
.tournament-score-results { border-top:1px solid var(--faint); margin-top:15px; padding-top:7px; }
.tournament-score-results p { white-space:nowrap; font-size:.93em; }
.tournament-score-results strong { color:var(--accent); }
.opening-populations { display:grid; grid-template-columns:1fr 1fr; gap:24px; margin:15px 0 10px; }
.opening-population { min-width:0; text-align:center; transition:transform .85s var(--ease), opacity .65s var(--ease); }
.opening-population h3 { font-size:.78em; margin:0 0 9px; }
.uniform-population { transform:translateX(calc(50% + 12px)); }
.polarized-population { opacity:0; transform:translateX(-30px); }
#same-margins:not([data-build="0"]) .uniform-population { transform:translateX(0); }
#same-margins:not([data-build="0"]) .polarized-population { opacity:1; transform:translateX(0); }
.population-definition { height:125px; }
.population-definition p { font-size:.57em; margin:6px 0; }
.opening-ranking-list { display:grid; grid-template-columns:1fr 1fr; font-size:.53em; gap:4px 8px; margin:9px auto 0; max-width:285px; }
.original-rank-hist { --probability-scale:160px; gap:14px; margin-top:10px; }
.original-rank-hist .rank-column { flex-basis:44px; }
.original-rank-hist .rank-bar-space { height:90px; }
.original-rank-hist .bar-probability, .original-rank-hist .rank-label { font-size:16px; }
.hist-caption { font-size:.54em; color:var(--muted); margin:8px 0; }
.population-margins { display:flex; justify-content:center; gap:16px; border-top:1px solid #ccc; padding-top:13px; font-size:.58em; margin-top:15px; }
#same-margins:not([data-build="0"]):not([data-build="1"]) .polarized-population .rank-bar { height:calc(var(--final) * var(--probability-scale)); }
#same-margins:not([data-build="0"]):not([data-build="1"]) .polarized-population .before-polarization { display:none; }
#same-margins:not([data-build="0"]):not([data-build="1"]) .polarized-population .after-polarization { display:initial; }
#same-margins .opening-conclusion { font-size:.76em; line-height:1.4; text-align:center; margin:22px 0 0; }
.opening-conclusion strong { color:var(--accent); }

@media (max-width:760px) {
  #borda-example .opening-example { grid-template-columns:1fr; gap:24px; }
  #borda-example .explicit-profile { padding:0 0 16px; }
  #borda-example .rank-score-row { grid-template-columns:20px 140px; gap:12px 20px; justify-content:center; }
  #borda-example .example-rank-hist { width:140px; padding:0 9px; }
  #borda-example .rank-score-computation { grid-column:2; font-size:.65em; }
  #borda-example .rank-score-list { gap:30px; }
  .borda-horizontal { grid-template-columns:1fr; gap:25px; }
  .borda-ranking-panel { border-right:0; border-bottom:1px solid #ccc; padding:0 0 16px; }
  .borda-panel-heading h3 { white-space:normal; }
  .opening-alternatives { gap:12px; }
  .opening-alternatives span:not(.ellipsis) { width:44px; height:44px; }
  .preference-reading { gap:20px; }
  .borda-points { gap:15px; }
  .borda-points > div:not(.points-ellipsis) { min-width:60px; }
  .borda-formula { font-size:.66em; height:132px; }
  .borda-formula .katex-display { overflow-x:auto; max-width:100%; }
  .opening-example, .opening-tournament-row, .opening-populations { grid-template-columns:1fr; }
  .explicit-profile { border-right:0; border-bottom:1px solid #ccc; padding:0 0 12px; }
  .rank-score-row { grid-template-columns:20px 110px 1fr; column-gap:9px; }
  .example-rank-hist { gap:7px; }
  .example-rank-hist .rank-column { flex-basis:27px; }
  .rank-score-computation { font-size:.51em; }
  .opening-tournament-row { gap:8px; }
  .tournament-formula { font-size:.62em; }
  .opening-tournament { max-height:250px; }
  .uniform-population { transform:none; }
  #same-margins[data-build="0"] .polarized-population { display:none; }
  .population-definition { height:auto; min-height:95px; }
  .opening-populations { gap:25px; }
}

@media (prefers-reduced-motion:reduce) {
  .opening-slide *, .opening-slide *::before, .opening-slide *::after { transition:none !important; }
}

@media print {
  .borda-introduction .borda-person-only { opacity:0 !important; }
  .borda-introduction .borda-profile-only { opacity:1 !important; transform:none !important; }
  .borda-introduction .borda-ranking-order { transform:translateX(-25px); }
  .opening-slide .fragment { opacity:1 !important; visibility:visible !important; }
  .borda-formula .formula-sample { display:none; }
  .borda-formula .formula-profile, .tournament-formula .pairwise-formula { opacity:1; transform:none; }
  .tournament-formula .rank-formula { transform:translateY(-40px) scale(.78); }
  .tournament-formula .pairwise-formula { transform:translateY(30px); }
  .opening-population { opacity:1; transform:none; }
  .polarized-population .rank-bar { height:calc(var(--final) * var(--probability-scale)); }
  .polarized-population .before-polarization { display:none; }
  .polarized-population .after-polarization { display:initial; }
}
