/* Riksdata — bright, white, official.
 *
 * Light only, on purpose: the brief asked for a bright and serious surface, so
 * the palette is committed to rather than doubled. Every colour is stated
 * outright; nothing is inherited from the host.
 */

:root {
  --yta: #ffffff;
  --botten: #f6f7f9;
  --tonad: #f0f3f6;
  --kant: #e2e6ea;
  --kant-stark: #ccd3da;

  --text: #14181d;
  --text-dampad: #5c6672;
  --text-svag: #7b8794;

  --accent: #1c4b8f;
  --accent-mork: #14375f;
  --accent-tonad: #eaf0f8;
  --varning: #a8500a;

  --radie: 6px;
  --radie-stor: 10px;
  --skugga: 0 1px 2px rgba(20, 24, 29, .06), 0 4px 12px rgba(20, 24, 29, .04);

  --serif: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  --matt: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--botten);
  color: var(--text);
  font: 16px/1.6 var(--sans);
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 1em; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-mork); }

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

.innermatt { max-width: var(--matt); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2.5rem); }

.hoppa {
  position: absolute; left: -9999px;
  font: inherit; cursor: pointer; color: var(--accent);
  background: var(--yta); padding: .7rem 1rem; z-index: 100;
  border: 1px solid var(--kant-stark); border-radius: var(--radie);
}
.hoppa:focus { left: 1rem; top: 1rem; }

/* --- topp --- */

.topp {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--kant);
}
.topp-rad { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 60px; }

.markesnamn {
  font-family: var(--serif); font-size: 1.3rem; font-weight: 600;
  color: var(--text); text-decoration: none; letter-spacing: -.01em;
}

/* --- meny --- */

.meny-knapp {
  display: flex; align-items: center; gap: .55rem;
  font: inherit; font-size: .93rem; cursor: pointer;
  min-height: 44px; padding: .4rem .7rem .4rem .5rem;
  background: none; color: var(--text-dampad);
  border: 1px solid transparent; border-radius: var(--radie);
}
.meny-knapp:hover { background: var(--tonad); color: var(--text); }

/* Three bars drawn in CSS rather than an image: the policy is
 * default-src 'none' with img-src 'self' data:, and a shape this simple has no
 * business being a file. The middle bar is the span, the outer two its
 * pseudo-elements. */
.meny-ikon {
  position: relative; display: block; flex: none;
  width: 20px; height: 2px; border-radius: 1px;
  background: currentColor;
  transition: background-color .12s;
}
.meny-ikon::before, .meny-ikon::after {
  content: ''; position: absolute; left: 0;
  width: 20px; height: 2px; border-radius: 1px;
  background: currentColor;
  transition: transform .12s;
}
.meny-ikon::before { top: -6px; }
.meny-ikon::after { top: 6px; }

/* Open: the middle bar goes, the other two cross. */
[aria-expanded="true"] .meny-ikon { background: transparent; }
[aria-expanded="true"] .meny-ikon::before { transform: translateY(6px) rotate(45deg); }
[aria-expanded="true"] .meny-ikon::after { transform: translateY(-6px) rotate(-45deg); }

/* .meny sets display, which would otherwise win over the user-agent's [hidden]
 * rule and leave the panel permanently open. */
.meny {
  position: absolute; inset-inline: 0; top: 100%;
  display: block;
  max-height: calc(100dvh - 60px); overflow-y: auto;
  background: var(--yta);
  border-bottom: 1px solid var(--kant);
  box-shadow: var(--skugga);
}
.meny[hidden] { display: none; }

.meny-lista { list-style: none; margin: 0; padding-block: .6rem 1rem; display: grid; gap: .15rem; }
.nav-lank {
  display: block; padding: .65rem .8rem; border-radius: var(--radie);
  color: var(--text-dampad); text-decoration: none;
}
.nav-lank:hover { background: var(--tonad); color: var(--text); }
.nav-lank.aktiv { background: var(--accent-tonad); color: var(--accent-mork); font-weight: 500; }

/* --- avsnitt --- */

/* One section is one page: the others are `hidden`, so nothing here separates
 * an avsnitt from its neighbours. */
.avsnitt { padding-block: clamp(2.5rem, 6vw, 4.5rem); background: var(--yta); }
.avsnitt:focus { outline: none; }
.sid-rubrik { font-size: clamp(1.5rem, 3vw, 2rem); }

.hero { background: var(--yta); padding-block: clamp(3rem, 8vw, 6rem); }
.hero .ledtext { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--text-dampad); max-width: 60ch; }
.hero .spann { color: var(--text-svag); font-size: .95rem; }

.ingress { color: var(--text-dampad); max-width: 68ch; }
.underrubrik { margin-top: 2rem; }

/* Splitting the one page into five raised every section heading a level: what
 * was the page's h2 is now its h1, and what was an h3 inside it is now an h2.
 * The outline changed, the typography did not. :where() keeps the specificity
 * at .avsnitt so a heading with a size of its own — .votering-rubrik — still
 * wins. The page's own h1 carries .sid-rubrik and is not touched. */
.avsnitt :where(h2) { font-size: 1.2rem; }
.anteckning { color: var(--text-svag); font-size: .88rem; }

.nyckeltal-stora { display: flex; flex-wrap: wrap; gap: clamp(1.5rem, 5vw, 3.5rem); margin-top: 2rem; }
.nyckeltal-stor { display: flex; flex-direction: column; }
.nyckeltal-stor .nyckeltal-varde {
  font-family: var(--serif); font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.nyckeltal-namn { color: var(--text-dampad); font-size: .9rem; }

/* --- filter --- */

.filter {
  display: grid; gap: .9rem 1.1rem; margin-block: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  padding: 1.1rem; background: var(--tonad);
  border: 1px solid var(--kant); border-radius: var(--radie-stor);
}
.filter-smal { grid-template-columns: minmax(190px, 280px); }

.falt { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.falt label { font-size: .82rem; font-weight: 500; color: var(--text-dampad); }
.falt-knapp { justify-content: flex-end; }

input, select {
  font: inherit; font-size: .95rem;
  padding: .5rem .6rem;
  background: var(--yta); color: var(--text);
  border: 1px solid var(--kant-stark); border-radius: var(--radie);
  min-width: 0; width: 100%;
}
input:hover, select:hover { border-color: var(--text-svag); }

.knapp {
  font: inherit; font-size: .93rem; cursor: pointer;
  padding: .5rem .9rem;
  background: var(--yta); color: var(--text);
  border: 1px solid var(--kant-stark); border-radius: var(--radie);
}
.knapp:hover { background: var(--tonad); border-color: var(--text-svag); }
.knapp[disabled] { opacity: .55; cursor: default; }
.knapp.lank { border-color: transparent; background: none; color: var(--accent); padding-inline: .3rem; }
.knapp.lank:hover { background: var(--accent-tonad); }

.raknare { color: var(--text-dampad); font-size: .9rem; margin-bottom: .8rem; }
.mer-rad { display: flex; justify-content: center; margin-top: 1.5rem; }

/* --- tillstånd --- */

.tillstand { padding: 1.5rem 0; color: var(--text-dampad); }
.tillstand.fel {
  padding: 1rem 1.1rem; background: #fdf3ef; color: #7c2d12;
  border: 1px solid #f2d5c8; border-radius: var(--radie);
}
.tillstand.fel p { margin-bottom: .6rem; }

.notis {
  padding: .9rem 1.1rem; margin-bottom: 1.2rem;
  background: var(--accent-tonad); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radie) var(--radie) 0; font-size: .93rem;
}
.notis p:last-child { margin-bottom: 0; }
.notis-varning { background: #fdf6ec; border-left-color: var(--varning); }

/* --- voteringslista --- */

.votering-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }

.votering-lank {
  display: block; padding: 1.1rem 1.2rem;
  background: var(--yta); color: inherit; text-decoration: none;
  border: 1px solid var(--kant); border-radius: var(--radie-stor);
  transition: border-color .12s, box-shadow .12s;
}
.votering-lank:hover { border-color: var(--kant-stark); box-shadow: var(--skugga); }

.votering-topp {
  display: flex; flex-wrap: wrap; gap: .35rem .9rem;
  font-size: .82rem; color: var(--text-svag);
  font-variant-numeric: tabular-nums;
}
.votering-topp .beteckning { font-weight: 500; color: var(--text-dampad); }

.votering-rubrik { font-size: 1.05rem; margin: .35rem 0 .55rem; }

.votering-mark { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.votering-mark > span {
  font-size: .78rem; padding: .15rem .5rem; border-radius: 999px;
  background: var(--tonad); color: var(--text-dampad); border: 1px solid var(--kant);
}
.utfall { font-weight: 500; }
.utfall-bifall { background: #eaf3ee; color: #1c5236; border-color: #cfe3d7; }
.utfall-avslag { background: #fbecef; color: #7a2338; border-color: #f0d2d9; }
.utfall-reservation { background: #fdf6ec; color: #7a4a12; border-color: #f0e0c6; }
.oberikad { background: #fdf6ec !important; color: var(--varning) !important; border-color: #f0e0c6 !important; }

.votering-roster { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.2rem; }

/* --- röststapel --- */

.stapel {
  display: flex; gap: 2px; /* ytmellanrum mellan segment, per marks-specen */
  height: 10px; min-width: 140px; flex: 1 1 180px;
  background: var(--tonad); border-radius: 4px; overflow: hidden;
}
.stapel-del { display: block; min-width: 2px; }
.stapel-tom { flex: 1; background: var(--kant); }

.rost-siffror { display: flex; flex-wrap: wrap; gap: .2rem .9rem; list-style: none; margin: 0; padding: 0; font-size: .84rem; }
.rost-siffror li { display: flex; align-items: center; gap: .3rem; }
.rost-namn { color: var(--text-dampad); }
.rost-tal { font-variant-numeric: tabular-nums; font-weight: 500; }

.rost-prick, .parti-prick {
  width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none;
  /* A ring so a pale chip still reads against white. */
  box-shadow: inset 0 0 0 1px rgba(20, 24, 29, .18);
}

.legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; list-style: none; margin: .6rem 0; padding: 0; font-size: .84rem; color: var(--text-dampad); }
.legend li { display: flex; align-items: center; gap: .35rem; }

.parti-marke { display: inline-flex; align-items: center; gap: .3rem; font-weight: 500; }
.parti-fullt { color: var(--text-svag); font-weight: 400; font-size: .85rem; margin-left: .4rem; }

/* --- tabeller --- */

.tabell-svep { overflow-x: auto; margin-block: 1rem; border: 1px solid var(--kant); border-radius: var(--radie); background: var(--yta); }
.tabell { border-collapse: collapse; width: 100%; font-size: .92rem; }
.tabell th, .tabell td { padding: .55rem .75rem; text-align: left; border-bottom: 1px solid var(--kant); }
.tabell thead th {
  position: sticky; top: 0; background: var(--tonad); z-index: 1;
  font-size: .8rem; font-weight: 600; color: var(--text-dampad); white-space: nowrap;
}
.tabell tbody tr:last-child th, .tabell tbody tr:last-child td { border-bottom: 0; }
.tabell tbody tr:hover { background: var(--tonad); }
.tabell tbody th { font-weight: 500; }
.tabell .num { text-align: right; font-variant-numeric: tabular-nums; }
.tabell .nowrap { white-space: nowrap; }
.tabell .varning { color: var(--varning); font-weight: 600; }
.tabell tbody th .parti-prick { margin-right: .35rem; }
.stapel-kol { min-width: 130px; }
.arende-meta { display: block; font-size: .8rem; color: var(--text-svag); }

.tabellvy summary { cursor: pointer; color: var(--accent); font-size: .9rem; padding: .3rem 0; }

/* --- stapeldiagram (sammanhållning) --- */

.stapeldiagram { display: grid; gap: .45rem; margin-block: 1.2rem; }
.stapel-rad { display: grid; grid-template-columns: 3.2rem 1fr 4.2rem; align-items: center; gap: .7rem; }
.stapel-etikett { font-weight: 600; font-size: .92rem; text-align: right; }
.stapel-spar {
  height: 20px; background: var(--tonad); border-radius: 4px; overflow: hidden;
  /* Recessive gridlines at 25 % intervals. */
  background-image: linear-gradient(90deg,
    transparent 0 calc(25% - 1px), var(--kant) calc(25% - 1px) 25%,
    transparent 25% calc(50% - 1px), var(--kant) calc(50% - 1px) 50%,
    transparent 50% calc(75% - 1px), var(--kant) calc(75% - 1px) 75%,
    transparent 75%);
}
.stapel-fyll { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 3px; }
.stapel-varde { font-variant-numeric: tabular-nums; font-size: .9rem; color: var(--text-dampad); }

/* --- värmekarta (partijämförelse) --- */

.matris-svep { overflow-x: auto; padding-bottom: .5rem; }
.matris { display: block; max-width: none; }
.matris-etikett { font: 600 12px var(--sans); fill: var(--text-dampad); }
.matris-varde { font: 500 12px var(--sans); fill: var(--text); font-variant-numeric: tabular-nums; }
.matris-varde.ljus { fill: #ffffff; }
.matris-diagonal { fill: var(--tonad); }
.matris-saknas { fill: var(--yta); stroke: var(--kant); }

.ramp-legend { display: flex; align-items: center; gap: .6rem; font-size: .82rem; color: var(--text-dampad); }
.ramp { display: flex; gap: 2px; }
.ramp-steg { width: 26px; height: 12px; border-radius: 2px; display: block; box-shadow: inset 0 0 0 1px rgba(20, 24, 29, .08); }

/* --- partier och ledamöter --- */

.parti-kort { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin-block: 1rem; }
.parti-kort-ett {
  padding: .9rem 1rem; background: var(--yta);
  border: 1px solid var(--kant); border-left: 3px solid var(--parti, var(--kant-stark));
  border-radius: var(--radie);
}
.parti-kort-ett h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem; margin-bottom: .5rem; font-size: 1rem; }
.parti-kort-ett .anteckning { margin: .4rem 0 0; font-size: .78rem; }

.nyckeltal { display: grid; grid-template-columns: 1fr auto; gap: .1rem .8rem; margin: 0; font-size: .88rem; }
.nyckeltal dt { color: var(--text-dampad); }
.nyckeltal dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }

.nyckeltal-rad { display: flex; flex-wrap: wrap; gap: 1.6rem; list-style: none; margin: 0 0 1rem; padding: 0; }
.nyckeltal-rad li { display: flex; flex-direction: column; }
.nyckeltal-rad .nyckeltal-varde { font-size: 1.5rem; font-variant-numeric: tabular-nums; font-family: var(--serif); }

.ledamot-rutnat { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.ledamot-kort {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .7rem;
  padding: .7rem .85rem; text-decoration: none; color: inherit;
  background: var(--yta); border: 1px solid var(--kant);
  border-left: 3px solid var(--parti, var(--kant-stark)); border-radius: var(--radie);
}
.ledamot-kort:hover { border-color: var(--kant-stark); box-shadow: var(--skugga); }
.ledamot-text { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.ledamot-namn { font-weight: 500; }
.ledamot-meta { display: flex; flex-wrap: wrap; gap: .5rem; font-size: .84rem; color: var(--text-svag); }

/* Porträtt.
 *
 * 3:4 rather than a circle, because that is the ratio riksdagen's archive
 * serves (192x256). Cropping one to a circle takes the top off the head, which
 * is worse than the shape being unfashionable.
 *
 * The initials sit underneath rather than beside: riksdagen has no picture of
 * roughly a tenth of the members, and rd-web removes the <img> when the request
 * 404s, so the chip is what remains. Painting it always means there is no gap
 * while a portrait loads and no second layout for the ones that never arrive. */
.portratt {
  position: relative; flex: none; display: grid; place-items: center;
  overflow: hidden; border-radius: var(--radie);
  background: color-mix(in srgb, var(--parti, var(--kant-stark)) 14%, var(--tonad));
  color: color-mix(in srgb, var(--parti, var(--text-dampad)) 72%, var(--text));
}
.portratt-initialer { font-weight: 600; letter-spacing: .02em; user-select: none; }
.ledamot-bild {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center top; display: block;
}
.portratt-liten { width: 40px; height: 53px; font-size: .8rem; }
.portratt-stor { width: 96px; height: 128px; font-size: 1.5rem; border-radius: var(--radie-stor); }

/* The portrait leads the facts in the detail dialog, and drops above them on a
 * narrow screen along with the rest of .fakta (see the media query below). */
.ledamot-topp { display: flex; align-items: flex-start; gap: 1.1rem; }
.ledamot-topp .fakta { flex: 1; min-width: 0; }

/* --- framsteg --- */

.framsteg { display: flex; align-items: center; gap: .6rem; min-width: 150px; }
.framsteg-spar { flex: 1; height: 8px; background: var(--tonad); border-radius: 4px; overflow: hidden; min-width: 60px; }
.framsteg-fyll { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.framsteg-text { font-size: .82rem; color: var(--text-dampad); font-variant-numeric: tabular-nums; white-space: nowrap; }

.jobblista { font-family: var(--mono); font-size: .82rem; margin: .5rem 0 0; padding-left: 1.2rem; max-height: 12rem; overflow-y: auto; }

/* --- dialog --- */

#detalj {
  padding: 0; border: 0; border-radius: var(--radie-stor);
  background: var(--yta); color: var(--text);
  width: min(860px, calc(100vw - 2rem));
  max-height: min(88vh, 960px);
  box-shadow: 0 12px 48px rgba(20, 24, 29, .22);
}
#detalj::backdrop { background: rgba(20, 24, 29, .45); }

.dialog-ram { display: flex; flex-direction: column; max-height: inherit; }
.dialog-topp {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1.2rem 1.4rem; border-bottom: 1px solid var(--kant);
  position: sticky; top: 0; background: var(--yta); z-index: 2;
  border-radius: var(--radie-stor) var(--radie-stor) 0 0;
}
.dialog-topp h2 { font-size: 1.3rem; margin: 0; }
.overrubrik { font-size: .82rem; color: var(--text-svag); margin: 0 0 .2rem; font-variant-numeric: tabular-nums; }
.stang {
  margin-left: auto; flex: none; cursor: pointer;
  width: 32px; height: 32px; line-height: 1; font-size: 1.4rem;
  background: none; border: 1px solid transparent; border-radius: var(--radie); color: var(--text-dampad);
}
.stang:hover { background: var(--tonad); color: var(--text); }

.dialog-kropp { padding: 1.2rem 1.4rem 1.6rem; overflow-y: auto; }
.block { margin-top: 1.8rem; }
.block:first-child { margin-top: 0; }
.block h3 { padding-bottom: .3rem; border-bottom: 1px solid var(--kant); }

.fakta { display: grid; grid-template-columns: minmax(8rem, auto) 1fr; gap: .3rem 1.2rem; margin: 0 0 1rem; font-size: .93rem; }
.fakta dt { color: var(--text-dampad); }
.fakta dd { margin: 0; }

.forslag { white-space: pre-wrap; }
.motforslag-partier { display: flex; flex-wrap: wrap; gap: .5rem; }

/* --- beslutet i korthet ---
 *
 * Tinted rather than bordered like .notis, because this is not a warning: it is
 * the one passage in the dialog written for a reader rather than for the
 * record, and it should look like the place to start. */
.beslut {
  background: var(--accent-tonad);
  border-radius: var(--radie);
  padding: 1rem 1.1rem .4rem;
}
.beslut h3 { border-bottom: 0; padding-bottom: 0; color: var(--accent-mork); }
.beslut-rubrik { font-weight: 600; }
.beslut-kammaren { font-weight: 500; }
.beslut .anteckning { margin-bottom: .6rem; }
.beslut-mer { margin-bottom: .8rem; font-size: .92rem; }
.beslut-mer summary { cursor: pointer; color: var(--accent); font-size: .88rem; padding: .2rem 0; }
.beslut-mer p { margin-top: .6rem; color: var(--text-dampad); }
.beslut-mer .beslut-kort { color: var(--text); font-weight: 500; }

/* --- behandlade dokument --- */

.dokument-lista { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .7rem; }
.dokument-post {
  padding: .75rem .9rem; background: var(--yta);
  border: 1px solid var(--kant); border-radius: var(--radie);
}
.dokument-post > p { margin: 0 0 .2rem; }
.dokument-topp { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; }
.doktyp {
  font-size: .75rem; font-weight: 500; letter-spacing: .02em; text-transform: uppercase;
  color: var(--text-dampad); background: var(--tonad);
  border: 1px solid var(--kant); border-radius: 999px; padding: .05rem .5rem;
}
.dokument-bet { font-variant-numeric: tabular-nums; color: var(--text-svag); font-size: .85rem; }
.dokument-titel { font-weight: 500; }
.dokument-forfattare { color: var(--text-svag); font-size: .88rem; }
.dokument-yrkanden { color: var(--text-dampad); font-size: .88rem; }
.dokument-mer { margin-top: .35rem; }
.dokument-mer .knapp.lank { font-size: .85rem; padding-inline: 0; }
.dokument-mer .tillstand { padding: .5rem 0; }

.dokument-voteringar { list-style: none; margin: .4rem 0 0; padding: 0; display: grid; gap: .3rem; font-size: .9rem; }
.dokument-voteringar li { display: flex; flex-wrap: wrap; gap: .2rem .6rem; }
.dokument-voteringar .anteckning { margin: 0; }

/* --- reservationer --- */

.reservation-lista { list-style: none; margin: .8rem 0 .6rem; padding: 0; display: grid; gap: .35rem; }
.reservation {
  display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .7rem;
  padding: .4rem .7rem; font-size: .92rem;
  background: var(--yta); border: 1px solid var(--kant); border-radius: var(--radie);
}
/* The one that was actually put to the chamber. Marked by weight, a left rule
 * and a word — never by colour alone. */
.reservation.rostad { border-left: 3px solid var(--accent); font-weight: 500; }
.reservation-nr { font-variant-numeric: tabular-nums; }
.reservation-rubrik { color: var(--text-dampad); font-weight: 400; }
.reservation-partier { display: flex; flex-wrap: wrap; gap: .4rem; }
.markering {
  margin-left: auto; font-size: .78rem; font-weight: 500;
  color: var(--accent-mork); background: var(--accent-tonad);
  border-radius: 999px; padding: .05rem .55rem;
}

/* --- länkar ut --- */

.kall-lankar { list-style: none; margin: 1rem 0 .6rem; padding: 0; display: grid; gap: .3rem; }
.extern-pil { font-size: .85em; }

/* Text for screen readers only. Not `display: none`, which would take it out of
 * the accessibility tree along with everything else. */
.enbart-skarmlasare {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.avser-val { display: flex; gap: .3rem; margin-bottom: 1rem; }
.flik {
  font: inherit; font-size: .9rem; cursor: pointer; padding: .35rem .8rem;
  background: var(--tonad); color: var(--text-dampad);
  border: 1px solid var(--kant); border-radius: 999px;
}
.flik.aktiv { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }

.total-stapel { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.2rem; }
.total-stapel .stapel { height: 14px; }
.roster-block > input { max-width: 380px; margin-bottom: .4rem; }
.rad-verktyg { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .8rem; margin-bottom: .8rem; }
.rad-verktyg .falt { max-width: 220px; }

/* --- ordförklaringar --- */

/* The trigger is a real button, so it is in the tab order and announced as
 * interactive. The dotted underline is the only affordance it needs: an icon on
 * every explained word would out-shout the data it sits next to. */
.term {
  font: inherit; color: inherit; cursor: help;
  background: none; border: 0; padding: 0; margin: 0;
  text-align: inherit;
  text-decoration: underline dotted var(--text-svag);
  text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.term:hover { text-decoration-color: var(--accent); color: var(--accent-mork); }

/* Where the word cannot be wrapped — a <label> must not contain a button — the
 * trigger becomes a small standalone mark instead. */
.term-ikon {
  display: inline-grid; place-items: center;
  width: 1.05rem; height: 1.05rem; flex: none;
  font-size: .7rem; font-weight: 600; line-height: 1;
  color: var(--text-svag); background: var(--yta);
  border: 1px solid var(--kant-stark); border-radius: 50%;
  text-decoration: none;
}
.term-ikon:hover { color: var(--accent); border-color: var(--accent); }

.falt-etikett { display: flex; align-items: center; gap: .35rem; }

#ordbubbla {
  /* The UA stylesheet centres a popover with inset:0 and margin:auto. Both have
   * to go, or the coordinates set in ordbubbla.js are simply ignored. */
  position: fixed; inset: auto; margin: 0;
  width: min(19rem, calc(100vw - 2rem));
  padding: .7rem .85rem;
  background: var(--yta); color: var(--text);
  border: 1px solid var(--kant-stark); border-radius: var(--radie);
  box-shadow: 0 2px 6px rgba(20, 24, 29, .10), 0 10px 28px rgba(20, 24, 29, .14);
  font-size: .88rem; line-height: 1.5;
}
#ordbubbla:popover-open { animation: bubbla-in .12s ease-out; }
#ordbubbla.ovanfor:popover-open { animation-name: bubbla-in-uppat; }

.ordbubbla-ord { display: block; font-family: var(--serif); font-size: .95rem; }
.ordbubbla-text { margin: .2rem 0 .5rem; color: var(--text-dampad); }
.ordbubbla-mer { font-size: .84rem; }

@keyframes bubbla-in { from { opacity: 0; transform: translateY(-3px); } }
@keyframes bubbla-in-uppat { from { opacity: 0; transform: translateY(3px); } }

/* --- ordlistesidan --- */

.ord-register {
  columns: 4 11rem; column-gap: 1.6rem;
  margin: 1.6rem 0 2.4rem; padding: 1.1rem 1.2rem;
  background: var(--tonad); border: 1px solid var(--kant);
  border-radius: var(--radie-stor);
}
.ord-register-grupp { break-inside: avoid; margin-bottom: 1rem; }
.ord-register-rubrik {
  font-family: var(--sans); font-size: .78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-svag); margin-bottom: .3rem;
}
.ord-register ul { list-style: none; margin: 0; padding: 0; font-size: .92rem; }
.ord-register li { margin-bottom: .15rem; }

.ord-grupp { margin-bottom: 2.4rem; }
.ord-grupp > h2 {
  padding-bottom: .4rem; margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--kant);
}

.ord {
  padding: .9rem 1rem; margin-bottom: .7rem;
  border: 1px solid transparent; border-radius: var(--radie);
  scroll-margin-block: 5rem;
}
.ord h3 { font-size: 1.05rem; margin-bottom: .3rem; }
.ord p { margin-bottom: .4rem; max-width: 62ch; }
.ord p:last-child { margin-bottom: 0; }
.ord-se { font-size: .89rem; color: var(--text-dampad); }

/* A deep link has to survive the reader looking away: the highlight stays until
 * they navigate, rather than flashing once and leaving them to find the term. */
.ord.markerad {
  background: var(--accent-tonad); border-color: var(--accent);
}
.ord:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.avser-not { margin-top: -.4rem; margin-bottom: 1rem; }

/* --- fot --- */

.fot { padding-block: 2.5rem; background: var(--tonad); border-top: 1px solid var(--kant); font-size: .9rem; color: var(--text-dampad); }
.fot p { max-width: 70ch; }
.fot p:last-child { margin-bottom: 0; }

/* --- små skärmar --- */

@media (max-width: 640px) {
  .topp-rad { min-height: 52px; }
  .meny { max-height: calc(100dvh - 52px); }
  .meny-text { position: absolute; left: -9999px; }

  .ord-register { columns: 1; }

  .filter { grid-template-columns: 1fr; padding: 1rem; }
  .filter-smal { grid-template-columns: 1fr; }

  .stapel-rad { grid-template-columns: 2.6rem 1fr 3.6rem; gap: .5rem; }
  .votering-roster { flex-direction: column; align-items: stretch; }
  .stapel { flex: none; width: 100%; }

  #detalj {
    width: 100vw; max-width: 100vw; max-height: 92vh;
    margin: auto 0 0; border-radius: var(--radie-stor) var(--radie-stor) 0 0;
  }
  .dialog-topp, .dialog-kropp { padding-inline: 1rem; }
  .fakta { grid-template-columns: 1fr; gap: 0 0; }
  .fakta dt { margin-top: .5rem; font-size: .82rem; }
  /* The facts go to one column here, so side by side leaves the portrait next
   * to a very narrow list. Stack instead. */
  .ledamot-topp { flex-direction: column; gap: .8rem; }
}

@media print {
  .topp, .meny, .filter, .mer-rad, .hoppa { display: none; }
  /* Nothing to hover on paper, so the affordance is noise; the ordlista page
   * still prints in full. */
  #ordbubbla, .term-ikon { display: none; }
  .term { text-decoration: none; }
  .avsnitt { padding-block: 1rem; }
  /* Portraits are decoration on paper and cost a page of ink; the initials
   * carry nothing the adjacent name does not. */
  .portratt { display: none; }
  /* The committee's summary stays behind its disclosure on paper too: a closed
   * <details> is hidden by the user agent's own slot, which no rule here can
   * reach, and pretending otherwise would be worse than leaving it shut.
   *
   * The button below a document only works in a browser, and the arrow after a
   * link points at nothing on paper — but the address itself is the whole
   * value of the link there, so it is written out. */
  .dokument-mer, .extern-pil { display: none; }
  .extern::after { content: " (" attr(href) ")"; font-size: .85em; word-break: break-all; }
}
