/* Inter + Source Serif 4, self-hosted (was fonts.googleapis.com --
   no visitor request leaves the site for a font). The upstream woff2 for
   weights 400/500/600 are one and the same variable font (fvar/gvar), so
   each family/style/subset ships once with a font-weight range covering
   the weights the pages use; the unicode-range on each face keeps the
   browser fetching only what the page's text needs. Prepended to the
   served style.css by render.write_assets. */
/* latin-ext */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(/fonts/inter-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(/fonts/inter-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 400 500;
  font-display: swap;
  src: url(/fonts/source-serif-4-italic-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 400 500;
  font-display: swap;
  src: url(/fonts/source-serif-4-italic-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(/fonts/source-serif-4-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url(/fonts/source-serif-4-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* lagen 2026 -- Marginalia, recoloured.
   ==========================================================================
   An evolution of the implemented stylesheet. Layout, class names, geometry
   and typography are UNCHANGED -- only the colour layer is rebuilt as tokens.

   Two coordinated schemes, driven by a single [data-theme] switch with a
   prefers-color-scheme fallback:

     * Light  -- cool porcelain paper, cool near-black ink, one warm
                 oxblood accent. Warm-on-cool editorial tension.
     * Dark   -- deep cool slate, terracotta accent, the three source
                 category hues (case / forarbete / kommentar) lightened.

   Drop-in: set  <html data-theme="light">  or  "dark", or leave it off to
   follow the OS. Everything below the token block is the original CSS with
   its scattered colour literals promoted to tokens so both schemes hold.
   ========================================================================== */

/* ── Light (default) ─────────────────────────────────────────── */
:root {
  --bg:#e9ecf0; --surf:#f4f6f8; --surf-2:#dde2e8; --surf-3:#c9d0d9;
  --ink:#171b21; --ink-2:#3b434d; --ink-3:#697079; --ink-4:#9aa1aa;
  --rule:#cfd4dc; --rule-soft:#dee2e9;
  --accent:#8f3524; --case:#9a5a2a; --forarbete:#544a80; --kommentar:#933659;

  /* promoted literals */
  --diff-ins-bg:#d9e8dc; --diff-del-bg:#efdad6;
  --fk-bg:#eaf1f8; --fk-border:#c3d5e6;
  --overlay:rgba(18,22,28,.34); --shadow-modal:rgba(18,22,28,.30);
  --mark:#f0e4a6; --danger:#b5402c; --on-accent:#ffffff;
  --senti-neg:#a3402f; --senti-pos:#2f6b46;

  --serif:"Source Serif 4","Charter",Georgia,serif;
  --sans:"Inter","Helvetica Neue",system-ui,sans-serif;
  --col-toc:16rem; --col-rail:18rem; --col-main:56rem;
  /* the whole reading block (TOC + reading column + rail) is centered on the
     page and capped at this width; columns are border-box and sit flush, so
     the cap is their exact sum. Any surplus viewport becomes symmetric
     left/right margin rather than a gap between text and rail (U1/U2). */
  --page-max:calc(var(--col-toc) + var(--col-main) + var(--col-rail));
  /* anchor clearance under the sticky masthead; the mobile breakpoint (whose
     masthead is static and scrolls away) shrinks it in one place */
  --scroll-clear:5rem;
  color-scheme: light;
}

/* ── Dark ────────────────────────────────────────────────────── */
:root[data-theme="dark"] {
  --bg:#12161b; --surf:#1a1f26; --surf-2:#232a33; --surf-3:#2f3843;
  --senti-neg:#d98b7a; --senti-pos:#7fb494;
  --ink:#e7e9ec; --ink-2:#b6bcc4; --ink-3:#868d97; --ink-4:#5c636d;
  --rule:#2b323b; --rule-soft:#222831;
  --accent:#cd6f56; --case:#c9884f; --forarbete:#9b90d2; --kommentar:#cf7295;

  --diff-ins-bg:#25352a; --diff-del-bg:#3a2723;
  --fk-bg:#1b2531; --fk-border:#2e4257;
  --overlay:rgba(6,8,11,.55); --shadow-modal:rgba(0,0,0,.6);
  --mark:#4a4326; --danger:#e0755e; --on-accent:#1a0f0c;
  color-scheme: dark;
}
/* follow the OS when no explicit theme is set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg:#12161b; --surf:#1a1f26; --surf-2:#232a33; --surf-3:#2f3843;
  --senti-neg:#d98b7a; --senti-pos:#7fb494;
    --ink:#e7e9ec; --ink-2:#b6bcc4; --ink-3:#868d97; --ink-4:#5c636d;
    --rule:#2b323b; --rule-soft:#222831;
    --accent:#cd6f56; --case:#c9884f; --forarbete:#9b90d2; --kommentar:#cf7295;
    --diff-ins-bg:#25352a; --diff-del-bg:#3a2723;
    --fk-bg:#1b2531; --fk-border:#2e4257;
    --overlay:rgba(6,8,11,.55); --shadow-modal:rgba(0,0,0,.6);
    --mark:#4a4326; --danger:#e0755e; --on-accent:#1a0f0c;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); font-size: 15px; line-height: 1.6;
       letter-spacing: -.005em; color: var(--ink); background: var(--bg);
       font-feature-settings: "kern";
       transition: background-color .25s ease, color .25s ease; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* -- Masthead -- */
.masthead { position: sticky; top: 0; z-index: 10; height: 4rem;
            background: var(--surf); border-bottom: 1px solid var(--rule); }
.mast-inner { display: flex; align-items: center; gap: 1rem; height: 100%;
              max-width: var(--page-max); margin: 0 auto; padding: 0 1.5rem; }
.masthead .brand { font-family: var(--serif); font-size: 1.5rem; font-weight: 500;
                   letter-spacing: -.015em; color: var(--ink); }
.masthead .brand em { color: var(--accent); font-style: italic; }
.masthead .brand:hover { text-decoration: none; }
.masthead .search { flex: 1; max-width: 36rem; display: flex; align-items: center;
                    gap: .6rem; padding: .55rem .9rem; cursor: text; text-align: left;
                    color: var(--ink-3); background: var(--surf-2);
                    border: 1px solid var(--rule); border-radius: 6px;
                    font-family: var(--serif); font-style: italic; font-size: .95rem; }
.masthead .search:hover { background: var(--surf-3); }
/* Under about 1236px the search label wraps to a second line and the button
   grows from 40px tall to 62px. The row does not grow with it -- .masthead
   pins height: 4rem until 64rem -- so the taller button crowds the 64px row
   and overflows it. Collapse the field to the same 2rem circle the other
   masthead controls use before that can happen. */
@media (max-width: 80rem) {
  /* The circle joins the other controls at the end of the row (order, because
     the DOM keeps the field before the nav for tab order and for the wide
     layout; .mast-nav orders itself after these below 64rem). The nav takes
     the space the flexible field used to hold, so between 64rem and 80rem it
     sits directly after the brand. */
  /* the geometry is restated rather than shared with the controls above: the
     field is 36rem wide over 80rem, so only the collapsed form is a circle.
     `cursor` is part of that -- collapsed it opens the palette on a click and
     must not keep the text field's I-beam. */
  .masthead .search { order: 1; flex: 0 0 auto; margin-left: auto;
                      margin-right: -.5rem; box-sizing: border-box;
                      width: 2rem; height: 2rem; padding: 0; gap: 0;
                      cursor: pointer; justify-content: center;
                      border-radius: 999px; }
  .masthead .search > span { display: none; }   /* icon-only; opens the palette */
  .mast-tools { order: 2; }
}
.masthead .search .k { margin-left: auto; font-family: var(--sans); font-style: normal;
                       font-size: .72rem; color: var(--ink-2); background: var(--surf);
                       border: 1px solid var(--rule); border-radius: 4px; padding: .1rem .5rem; }
.mast-nav { display: flex; gap: 1.4rem; font-size: .88rem; }
.mast-nav a { color: var(--ink-2); padding: .35rem 0;
              border-bottom: 1px solid transparent; }
.mast-nav a:hover { color: var(--ink); text-decoration: none;
                    border-bottom-color: var(--ink-3); }
.mast-nav a.on { color: var(--ink); font-weight: 500; border-bottom-color: var(--accent); }
/* -- The masthead's icon controls (collection, theme, account) sit in one
   group at the end of the row, closer to each other than to the nav. -- */
.mast-tools { display: flex; flex: none; align-items: center; gap: .5rem; }
/* Every control in that group is the same circle -- the theme toggle, the
   collection icon and the logged-in editor's initials (.ed-account, mounted by
   editor.js and skinned here so the group has one definition; style.css
   already names the editor's classes in its @media print block). Each control
   keeps only what makes it itself, below and in editor.css. The selector lists
   the classes rather than adding a shared one to the markup, so a page
   rendered before this change still draws its theme toggle as a circle.
   `position: relative` is here because two of the three hang a .mast-badge off
   their corner. */
.theme-toggle, .collection-toolbar, .ed-account {
  position: relative; flex: none; display: inline-flex;
  align-items: center; justify-content: center; width: 2rem; height: 2rem;
  box-sizing: border-box; padding: 0; cursor: pointer; color: var(--ink-2);
  background: var(--surf-2); border: 1px solid var(--rule);
  border-radius: 999px; transition: background-color .15s, color .15s; }
.theme-toggle:hover, .collection-toolbar:hover, .ed-account:hover {
  background: var(--surf-3); color: var(--accent); text-decoration: none; }
.theme-toggle:focus-visible, .collection-toolbar:focus-visible,
.ed-account:focus-visible { outline: 2px solid var(--accent);
  outline-offset: 2px; }
/* `display: inline-flex` above beats the browser's own rule for [hidden], so a
   control that hides itself (the collection icon, when the collection is
   empty) needs the display reset spelled out here */
.theme-toggle[hidden], .collection-toolbar[hidden], .ed-account[hidden] {
  display: none; }
/* the count of documents in the collection, or of an editor's uncommitted
   changes -- the corner badge shared by the controls that carry one */
.mast-badge { position: absolute; top: -.38rem; right: -.42rem;
  min-width: 1rem; height: 1rem; box-sizing: border-box; padding: 0 .22rem;
  border-radius: 999px; background: var(--accent); color: var(--on-accent);
  font: 600 .62rem/1rem var(--sans); text-align: center;
  font-variant-numeric: tabular-nums; }
.mast-badge:empty { display: none; }
/* -- Theme toggle: a single sun/moon control; the icon reflects the scheme the
   click would switch AWAY from -- moon while light, sun while dark. -- */
.theme-toggle:hover { color: var(--ink); }   /* not the accent the others take */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline-flex; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline-flex; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-sun { display: inline-flex; }
  :root:not([data-theme]) .theme-toggle .icon-moon { display: none; }
}

/* -- Body grid -- */
.gr-body { display: grid; align-items: start; max-width: var(--page-max);
           margin: 0 auto;
           grid-template-columns: var(--col-toc) minmax(0,var(--col-main)) var(--col-rail); }
.gr-body.solo { display: block; max-width: 56rem; margin: 0 auto; }
.gr-main { min-width: 0; padding: 2.5rem clamp(1.5rem, 4vw, 4rem) 8rem; max-width: 56rem; }
.gr-body.solo .gr-main { max-width: none; }

/* -- Frontpage: curated multi-column law index --
   cluster headings (h2) and the intro/"vanliga ingångar" paragraphs span every
   column; the `### category` + its law list flow into columns and never break
   mid-list, so 20 categories read as 5 scannable bands. The max-width pins the
   columns at 15rem (3 x 15 + 2 x 1 gap = 47rem) -- multicol otherwise
   stretches them to fill the container -- and gives the spanning intro
   paragraphs the same measure, so paragraphs and columns share one edge. */
.frontpage { columns: 15rem 3; column-gap: 1rem; max-width: 47rem; }
.frontpage > h2, .frontpage > p { column-span: all; -webkit-column-span: all; }
.frontpage > p { color: var(--ink-2); }
.frontpage > p strong { color: var(--ink); }
.frontpage h2 { font-family: var(--serif); font-size: .82rem; font-weight: 600;
                letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
                margin: 2.4rem 0 1rem; padding-bottom: .45rem;
                border-bottom: 1px solid var(--rule); }
.frontpage > p + h2 { margin-top: 2.8rem; }
.frontpage h3 { font-family: var(--serif); font-size: 1.02rem; font-weight: 600;
                color: var(--ink); margin: 0 0 .35rem;
                /* avoid: keep the heading with its list; avoid inside: at 15rem
                   columns a heading wraps, and the wrap point must not become a
                   column break splitting the heading's own lines */
                break-after: avoid; break-inside: avoid; }
.frontpage ul { list-style: none; margin: 0; padding: 0;
                break-inside: avoid; margin-bottom: 1.6rem; }
.frontpage li { line-height: 1.5; padding: .04rem 0; font-size: .93rem; }
.frontpage li a { color: var(--ink-2); }
.frontpage li a:hover { color: var(--accent); }
.frontpage li strong { font-weight: 400; }
.frontpage li strong a { color: var(--ink); font-weight: 600; }
.frontpage a.ext::after { content: " ↗"; color: var(--ink-4); font-size: .8em; }

/* -- TOC -- */
.toc-col { position: sticky; top: 4rem; max-height: calc(100vh - 4rem);
           overflow-y: auto; background: var(--surf); border-right: 1px solid var(--rule); }
nav.toc { padding: 1.75rem 0 5rem; font-size: .82rem; }
nav.toc .toc-h { padding: 0 1.5rem; font-family: var(--serif); font-style: italic;
                 font-size: .8rem; color: var(--ink-3); margin-bottom: .6rem; }
nav.toc a { display: block; color: var(--ink-2); line-height: 1.35;
            padding: .2rem 1.5rem .2rem 1.35rem; border-left: 2px solid transparent; }
nav.toc a:hover { color: var(--ink); background: var(--surf-2); text-decoration: none; }
/* the document's own short id, first in the list: the way back to the top of
   the document, so it reads as the document rather than as a section of it */
nav.toc a.toc-top { color: var(--ink); font-weight: 600; letter-spacing: -.01em;
                    padding-bottom: .35rem; margin-bottom: .35rem;
                    border-bottom: 1px solid var(--rule); }
nav.toc a.lvl2 { padding-left: 2.5rem; color: var(--ink-3); }
nav.toc a.lvl3 { padding-left: 3.4rem; color: var(--ink-4); font-size: .78rem; }
nav.toc a.active { color: var(--accent); border-left-color: var(--accent);
                   background: var(--surf-2); font-weight: 500; }
/* scrollspy collapses every branch but the active section's ancestor path, so
   only top-level entries (plus the open branch) show; no-JS keeps all visible */
nav.toc a.toc-collapsed { display: none; }

/* -- "Spara som PDF" (pdf.js): the printer icon riding the short-id row
   at the top right of the TOC rail, and its options dialog. Screen chrome
   only -- the print block hides the icon, and api/pdf.py drops the whole
   column. The toc-top row reserves its width so a long id never runs
   under it -- room for both icons, the printer and the collection button
   beside it. -- */
.toc-list { position: relative; }
nav.toc a.toc-top { padding-right: 5.3rem; }
.pdf-open { position: absolute; top: .05rem; right: .9rem;
            display: inline-flex; align-items: center; justify-content: center;
            padding: .2rem; border: 0; border-radius: 4px;
            background: none; color: var(--ink-3); cursor: pointer; }
.pdf-open:hover { color: var(--accent); background: var(--surf-2); }
.pdf-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.pdf-dialog { border: 1px solid var(--rule); border-radius: 8px;
              background: var(--surf); color: var(--ink);
              padding: 1.25rem 1.5rem; width: min(26rem, 90vw);
              box-shadow: 0 12px 40px var(--shadow-modal);
              font: 400 .9rem/1.5 var(--sans); }
.pdf-dialog::backdrop { background: var(--overlay); }
.pdf-dialog h2 { font: 600 1.05rem var(--sans); margin: 0 0 .9rem; }
.pdf-dialog .pdf-row { display: block; margin: .45rem 0; }
.pdf-layout { display: flex; gap: 1.2rem; border: 0; margin: 0 0 .75rem;
              padding: 0; }
.pdf-layout legend { margin-bottom: .25rem; font-weight: 600; }
.pdf-kinds { border: 0; margin: .2rem 0 .2rem 1.55rem; padding: 0;
             display: grid; grid-template-columns: 1fr 1fr; gap: .1rem .8rem; }
.pdf-kinds[disabled] { opacity: .45; }
/* checkbox + label as two columns, so a long kind name ("Rättsliga
   ställningstaganden") wraps under its own text, not under the box */
.pdf-kinds label { display: grid; grid-template-columns: auto 1fr;
                   gap: .4rem; align-items: baseline; font-size: .82rem; }
.pdf-dialog .pdf-mode { display: flex; gap: 1.2rem; margin-top: .7rem; }
.pdf-hint { color: var(--ink-4); font-size: .78rem; margin: .8rem 0 0; }
.pdf-actions { display: flex; justify-content: flex-end; gap: .6rem;
               margin-top: 1rem; }
.pdf-actions button { font: 500 .82rem var(--sans); border-radius: 5px;
                      padding: .4rem .9rem; cursor: pointer;
                      border: 1px solid var(--rule); background: var(--surf-2);
                      color: var(--ink-2); }
.pdf-actions button:hover { background: var(--surf-3); color: var(--ink); }
.pdf-actions .pdf-go { background: var(--accent); border-color: var(--accent);
                       color: var(--on-accent); }
/* the dialog no longer waits for anything: "Skapa PDF" opens the export's
   own page (/internal-api/v1/pdf/vanta), which carries the progress bar */
@keyframes spin { to { transform: rotate(360deg); } }   /* also .search-spin */
.pdf-err { color: var(--danger); font-size: .82rem; margin: .8rem 0 0; }

/* -- Browser-owned PDF collection -------------------------------------- */
.collection-add { position: absolute; top: .05rem; right: 3rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 4px; background: none; color: var(--ink-3);
  cursor: pointer; padding: .2rem; }
.collection-add:hover { color: var(--accent); background: var(--surf-2); }
.collection-add:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.collection-add[aria-pressed="true"] { color: var(--accent); }

.collection-mast-spacer { flex: 1; }
@keyframes collection-arrived {
  0% { transform: scale(.72); }
  40% { transform: scale(1.24); }
  70% { transform: scale(.94); }
  100% { transform: scale(1); }
}
.collection-toolbar.collection-arrived { animation: collection-arrived .7s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .collection-toolbar.collection-arrived { animation: none; }
}

.collection-editor { width: min(68rem, calc(100% - 3rem)); margin: 3.5rem auto 6rem;
  color: var(--ink); }
.collection-editor-head { max-width: 46rem; margin-bottom: 2rem; }
.collection-editor-head h1 { font: 500 2.6rem/1.05 var(--serif); margin: .25rem 0 .5rem; }
.collection-editor-head p { color: var(--ink-3); }
.collection-card, .collection-document-row { border: 1px solid var(--rule);
  border-radius: 7px; background: var(--surf); }
.collection-settings { padding: 1.2rem 1.35rem; display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1.4rem;
  font: 400 .88rem/1.45 var(--sans); }
.collection-settings h2 { grid-column: 1 / -1; margin: 0; font: 600 1.15rem var(--serif); }
.collection-settings > label:not(.collection-check) { display: grid; gap: .25rem; }
.collection-settings input[type=text], .collection-settings input:not([type]) {
  width: 100%; box-sizing: border-box; border: 1px solid var(--rule);
  border-radius: 4px; background: var(--surf-2); color: var(--ink); padding: .45rem .55rem; }
.collection-settings fieldset { border: 0; padding: 0; margin: 0; }
.collection-settings legend { font-weight: 600; margin-bottom: .2rem; }
.collection-settings fieldset label { margin-right: 1rem; }
.collection-context-kinds { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
.collection-context-kinds[disabled] { opacity: .5; }
.collection-documents { margin-top: 2.4rem; }
.collection-section-head { display: flex; align-items: baseline; justify-content: space-between; }
.collection-section-head h2 { font: 600 1.35rem var(--serif); margin: 0 0 .8rem; }
.collection-count, .collection-empty { color: var(--ink-4); font: .82rem var(--sans); }
.collection-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.collection-document-row { padding: 1rem 1.15rem; }
.collection-document-row[draggable=true] { cursor: grab; }
.collection-document-head { display: flex; justify-content: space-between; gap: 1rem; }
.collection-document-name h3 { margin: .1rem 0 0; font: 500 1.1rem/1.25 var(--serif); }
.collection-document-name h3 a { color: var(--ink); }
.collection-document-name .eyebrow { font-size: .78rem; }
.collection-ordering { flex: none; display: flex; gap: .35rem; align-items: start; }
.collection-ordering button, .collection-actions button, .collection-import {
  border: 1px solid var(--rule); border-radius: 4px; background: var(--surf-2);
  color: var(--ink-2); padding: .4rem .65rem; cursor: pointer;
  font: 500 .76rem/1.2 var(--sans); }
.collection-document-settings { display: flex; flex-wrap: wrap; gap: .45rem 1.4rem;
  margin-top: .9rem; padding-top: .75rem; border-top: 1px solid var(--rule-soft);
  font: .8rem var(--sans); }
.collection-document-settings select { margin-left: .3rem; }
.collection-sections { margin-top: .7rem; font: .8rem/1.4 var(--sans); }
.collection-sections summary { color: var(--accent); cursor: pointer; }
.collection-sections > label { display: block; margin: .5rem 0; font-weight: 600; }
.collection-outline { max-height: 18rem; overflow-y: auto; display: grid; gap: .15rem;
  padding: .5rem .7rem; border-left: 2px solid var(--rule-soft); }
.collection-outline label { padding-left: calc((var(--outline-level) - 1) * 1.1rem); }
.collection-actions { position: sticky; bottom: 0; display: flex; flex-wrap: wrap;
  align-items: center; gap: .5rem; margin-top: .5rem; padding: .8rem;
  border: 1px solid var(--rule); border-radius: 6px; background: var(--surf); }
.collection-action-spacer { flex: 1; }
.collection-actions .collection-create { background: var(--accent); border-color: var(--accent);
  color: var(--on-accent); font-size: .84rem; }
.collection-import input { position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); }
.collection-error { color: var(--danger); font: .85rem var(--sans); }
.collection-direct-link { display: flex; align-items: center; gap: .45rem;
  margin-top: 1.5rem; font: .78rem/1.4 var(--sans); color: var(--ink-3); }
.collection-direct-link > span:first-child { flex: none; }
.collection-direct-link > a { min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.collection-direct-link button { flex: none; display: inline-flex; align-items: center;
  justify-content: center; padding: .25rem; border: 0; border-radius: 4px;
  background: none; color: var(--ink-3); cursor: pointer; }
.collection-direct-link button:hover, .collection-direct-link button.copied {
  color: var(--accent); background: var(--surf-2); }
.collection-copy-status { position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%); }

.collection-wait { max-width: 32rem; margin: 18vh auto 0; padding: 0 1.5rem;
  font: 400 .95rem/1.6 var(--sans); color: var(--ink); }
.collection-wait h1 { font: 500 1.5rem/1.25 var(--serif); margin: 0 0 .3rem; }
.collection-wait .doc { font-family: var(--serif); font-style: italic; margin: 0 0 1.6rem; }
.collection-wait .track { height: .5rem; border-radius: 99px; background: var(--surf-3); overflow: hidden; }
.collection-wait .bar { height: 100%; width: 0; border-radius: 99px; background: var(--accent); }
.collection-wait .line { display: flex; justify-content: space-between; gap: 1rem;
  margin-top: .55rem; font-size: .85rem; color: var(--ink-3); }
.collection-wait .note { color: var(--ink-4); font-size: .82rem; margin-top: 2.2rem; }
.collection-wait .err { color: var(--danger); }

@media (max-width: 44rem) {
  .collection-settings { grid-template-columns: 1fr; }
  .collection-settings > * { grid-column: 1; }
  .collection-document-head { display: block; }
  .collection-ordering { margin-top: .7rem; }
  .collection-actions { position: static; }
}

/* -- Frontmatter -- */
/* every id-bearing node in the reading column is a citable anchor target
   (stycke/punkt/moment included, via nodes.html's id_attr); the specific
   selectors below repeat this for elements that need a different clearance
   (e.g. .konvention-instrument's extra +2rem) and must still win, so this
   catch-all is written with :where() -- zero specificity of its own -- to
   leave every later, single-class override in charge */
:where(.gr-main) [id] { scroll-margin-top: var(--scroll-clear); }
/* #top -- the TOC's first entry jumps here, so it clears the sticky masthead
   like every other anchor target */
.frontmatter { margin-bottom: 2rem; padding-bottom: 1.1rem;
               border-bottom: 1px solid var(--rule);
               scroll-margin-top: var(--scroll-clear); }
.eyebrow { font-family: var(--serif); font-style: italic; font-size: .95rem;
           color: var(--accent); }
.gr-main h1 { font-family: var(--serif); font-weight: 500; font-size: 2.6rem;
              line-height: 1.05; letter-spacing: -.028em; margin: .3rem 0 .35rem;
              text-wrap: balance; }
.gr-main h1 em { color: var(--accent); font-style: italic; }
.gr-body.solo h1 { font-size: 2.1rem; }
/* the frontpage lockup: the mark stands beside the eyebrow + h1 stack, in the
   reading column's own left padding. The negative margin is the mark's width
   plus the gap (3rem), so at a wide viewport the heading text sits exactly
   where it does on every other page. Where the padding is narrower than 3rem
   the pull shrinks with it and the text moves right by the difference -- the
   mark never crosses the page edge. */
.frontmatter.branded { display: flex; align-items: center; gap: 1rem; }
.frontmatter.branded .branded-text { min-width: 0; }
.site-mark { flex: none; height: 70px; width: auto;
             margin-left: calc(-1 * clamp(1.5rem, 4vw, 3rem)); }
/* the full official title, sitting under the short-name h1 -- kept compact so a
   long formal title (SFS/EU acts, treaties) does not steal the top of the page */
.subtitle { font-family: var(--serif); font-style: italic; font-size: .95rem;
            color: var(--ink-3); line-height: 1.35; margin: 0; text-wrap: pretty; }
/* the metadata block under the h1 -- kept compact (tight rows, small type) so it
   leads quickly into the text rather than stealing the top of the page */
dl.meta { margin: .7rem 0 0; display: grid; grid-template-columns: max-content 1fr;
          column-gap: 1rem; row-gap: .1rem; font-family: var(--serif);
          font-style: italic; font-size: .85rem; line-height: 1.3; color: var(--ink-3); }
dl.meta dt { font-weight: 500; font-style: normal; }
dl.meta dd { margin: 0; }
dl.meta a { color: var(--accent); }

/* -- Upphävd (repealed) författning -- a clear repeal callout, a subdued reading
   column, and a fixed watermark that stays in view at any scroll depth (so an
   anchor link deep into the text still reads as repealed). -- */
/* .note-banner (EDPB language/version notes, "text not held") shares the
   callout shape; the flex gap is also what separates the strong label from
   the note text, since the template butts them together */
.expired-banner, .note-banner {
                  display: flex; flex-wrap: wrap; align-items: baseline; gap: .55rem;
                  margin: 0 0 2.25rem; padding: .7rem 1rem; border: 1px solid var(--rule);
                  border-left: 3px solid var(--accent); border-radius: 5px;
                  background: var(--surf-2); font-size: .92rem; color: var(--ink-2); }
.expired-banner strong, .note-banner strong {
                         font-family: var(--serif); font-weight: 600; color: var(--accent);
                         text-transform: uppercase; letter-spacing: .04em; font-size: .82rem; }
.expired-banner a, .note-banner a { color: var(--accent); }
body.expired .gr-main { color: var(--ink-3); }
body.expired .gr-main h1, body.expired .kaprubrik, body.expired .rubrik,
body.expired h3.artikel,
body.expired section.artikel > h2 { color: var(--ink-2); }
body.expired::before { content: "Upphävd författning"; position: fixed;
                       top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-24deg);
                       font-family: var(--serif); font-weight: 600; white-space: nowrap;
                       font-size: min(11vw, 8rem); color: var(--accent); opacity: .08;
                       pointer-events: none; user-select: none; z-index: 1; }
/* an EU act is not a svensk författning, and CELLAR's end-of-validity covers a
   repeal and a lapse alike, so the watermark says what is certain */
body.expired-eu::before { content: "Gäller inte längre"; }

/* -- Historical consolidations (lydelser) + version diff -- */
body.inaktuell .gr-main { color: var(--ink-3); }
body.inaktuell .gr-main h1, body.inaktuell .kaprubrik, body.inaktuell .rubrik {
  color: var(--ink-2); }
body.inaktuell::before { content: "Inaktuell författning"; position: fixed;
                         top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-24deg);
                         font-family: var(--serif); font-weight: 600; white-space: nowrap;
                         font-size: min(11vw, 8rem); color: var(--accent); opacity: .08;
                         pointer-events: none; user-select: none; z-index: 1; }
.version-banner { display: flex; flex-wrap: wrap; align-items: baseline; gap: .55rem;
                  margin: 0 0 2.25rem; padding: .7rem 1rem; border: 1px solid var(--rule);
                  border-left: 3px solid var(--accent); border-radius: 5px;
                  background: var(--surf-2); font-size: .92rem; color: var(--ink-2); }
.version-banner strong { font-family: var(--serif); font-weight: 600; color: var(--accent);
                         text-transform: uppercase; letter-spacing: .04em; font-size: .82rem; }
.version-banner a { color: var(--accent); }
/* the compare affordance rides the "Ändring införd t.o.m." row of dl.meta, so it
   inherits that row's small serif voice and adds no box of its own -- a full-width
   panel above the text pushed the statute below the fold (S1). Closed it is an
   inline continuation of the cutoff ("SFS 2026:880 · Jämför lydelser 14"); open it
   drops the <select> under the row. */
details.lydelser { display: inline; margin: 0; padding: 0; border: 0;
                   background: none; font: inherit; }
details.lydelser summary::before { content: " · "; color: var(--ink-4); }
/* the compare status: a small heading that names what is being diffed, shown
   the instant a lydelse is picked (versions.js) so the change is visible (T1) */
.lydelser-status { font-family: var(--serif); font-style: italic; font-weight: 400;
                   font-size: 1.05rem; color: var(--ink-2); margin: 0 0 1.25rem;
                   padding: 0; border: 0; }
details.lydelser summary { display: inline; cursor: pointer; font-style: normal;
                           color: var(--accent); list-style: none; }
details.lydelser summary::-webkit-details-marker { display: none; }
details.lydelser summary:hover { text-decoration: underline; }
details.lydelser summary .count { color: var(--ink-4); }
details.lydelser label { display: block; margin: .35rem 0 .1rem; color: var(--ink-3); }
details.lydelser select { max-width: 100%; font-family: var(--sans);
                          font-size: .8rem; margin-left: .4rem; }
details.lydelser ol { margin: .5rem 0 .3rem; padding-left: 1.4rem; }
details.lydelser li { margin: .2rem 0; }
details.lydelser .note { color: var(--ink-4); font-size: .85rem; }
.version-diff ins, .diff-note ins { background: var(--diff-ins-bg); color: var(--ink);
                    text-decoration: none; padding: 0 .1em; border-radius: 2px; }
.version-diff del, .diff-note del { background: var(--diff-del-bg); color: var(--ink-3);
                    text-decoration: line-through; padding: 0 .1em; border-radius: 2px; }
.version-diff [id] { scroll-margin-top: var(--scroll-clear); }
.diff-note { margin: 0 0 1.5rem; padding: .55rem 1rem; border: 1px solid var(--rule);
             border-radius: 5px; background: var(--surf-2); font-size: .9rem;
             color: var(--ink-2); }

/* -- Ändringar och övergångsbestämmelser (the register view) -- */
section.andringar { margin-top: 4rem; }
.andring { margin: 2.25rem 0; padding: 1rem 1.25rem; border: 1px solid var(--rule-soft);
           border-radius: 5px; background: var(--surf); scroll-margin-top: var(--scroll-clear); }
.andring h2 { font-family: var(--serif); font-weight: 600; font-size: 1.15rem;
              margin: 0 0 .5rem; }
.andring h3 { font-family: var(--serif); font-weight: 600; font-size: 1rem;
              margin: 1.25rem 0 .25rem; }
.andring ul { margin: .3rem 0 .6rem; padding-left: 1.3rem; font-size: .92rem; }
.andring li { margin: .15rem 0; }
.andring dl.meta { margin: .75rem 0 0; font-size: .9rem; }
.andring section.paragraf { margin: .75rem 0; }

/* -- Headings -- */
.kaprubrik { font-family: var(--serif); font-weight: 500; font-size: 1.7rem;
             letter-spacing: -.022em; line-height: 1.12; margin: 3rem 0 .25rem;
             padding-bottom: .75rem; border-bottom: 1px solid var(--rule);
             text-wrap: balance; scroll-margin-top: var(--scroll-clear); }
.rubrik { font-family: var(--serif); font-weight: 600; font-size: 1.2rem;
          letter-spacing: -.015em; margin: 2.25rem 0 .5rem; scroll-margin-top: var(--scroll-clear); }
/* One class, two structures: eurlex sets an article heading as `h3.artikel`,
   while a treaty article is a `section.artikel` wrapping its heading *and* its
   paragraphs (nodes.html `eu_article` / `artikel_section`). Typography has to
   sit on the heading -- on the container it inherits into every paragraph, and
   the whole of every coe/icrc/untc treaty rendered semi-bold. */
/* an article whose heading did not split into a designation and a title (six
   of 10,204 sampled: "Enda artikel", "Article premier") keeps the plain one
   line -- `display: block` because the grid rule below matches it too, and a
   grid would set the whole heading inside the 3.25rem gutter column */
h3.artikel.artikel-plain, section.artikel > h2 {
           display: block; font-family: var(--serif); font-weight: 600;
           font-size: 1.15rem; margin: 2rem 0 .5rem;
           scroll-margin-top: var(--scroll-clear); }
/* -- Three places hang a number in a gutter beside its text: an SFS paragraf,
   an EU article heading and a numbered förarbete section. The numeral and the
   permalink look the same in all three; only the grid geometry differs, and
   that is all each block below sets. -- */
.paragraf-gutter .n, h3.artikel > .n, .rubrik.numrerad > .n {
  font-family: var(--serif); font-size: 1.55rem; font-weight: 500;
  line-height: 1.2; color: var(--accent); font-variant-numeric: oldstyle-nums; }
.paragraf-gutter .pilcrow, h3.artikel > .pilcrow, .rubrik.numrerad > .pilcrow {
  font-family: var(--sans); font-size: .7rem; font-weight: 400;
  color: var(--ink-4); opacity: 0; transition: opacity .15s; }
section.paragraf:hover .pilcrow, h3.artikel:hover > .pilcrow,
.rubrik.numrerad:hover > .pilcrow { opacity: 1; }
.paragraf-gutter .pilcrow:hover, h3.artikel > .pilcrow:hover,
.rubrik.numrerad > .pilcrow:hover { color: var(--accent); text-decoration: none; }

/* -- An EU article heading: the designation hangs in the same gutter an SFS
   paragraf uses, the word small over the number, the permalink under it. Three
   rows, because the title has to sit on the number's baseline and the word
   above it -- one baseline-aligned row would put the title beside the word. -- */
h3.artikel { display: grid; grid-template-columns: 3.25rem minmax(0,1fr);
             gap: 0 .9rem; margin: 2.25rem 0 .5rem; font-weight: 400;
             scroll-margin-top: var(--scroll-clear); }
/* the gutter's contents set flush left, not right as the §-gutter's do: the
   number then stands directly over the article's own paragraph markers, which
   hang at the same edge -- right-aligned it sat to the right of them */
h3.artikel > .k { grid-area: 1 / 1; font-family: var(--sans);
                  font-size: .62rem; font-weight: 500; letter-spacing: .07em;
                  text-transform: uppercase; color: var(--ink-3); }
h3.artikel > .n { grid-area: 2 / 1; }
h3.artikel > .artikel-titel { grid-area: 2 / 2; align-self: baseline;
                              font-family: var(--serif); font-weight: 600;
                              font-size: 1.15rem; }
h3.artikel > .pilcrow { grid-area: 3 / 1; }
/* the division designation ("Kapitel I"), set apart from the title it opens */
.rubrik-nr { color: var(--accent); font-variant-numeric: oldstyle-nums; }
/* -- A numbered förarbete section: its number hangs in a gutter of its own,
   with a permalink, and the title reads as before. The gutter is wider than the
   §-gutter because a section number nests ("9.2.4"). -- */
h1.rubrik.numrerad, h2.rubrik.numrerad, h3.rubrik.numrerad,
h4.rubrik.numrerad, h5.rubrik.numrerad {
  display: grid; grid-template-columns: 3.6rem minmax(0,1fr); gap: 0 .9rem;
  align-items: baseline; scroll-margin-top: var(--scroll-clear); }
.rubrik.numrerad > .n { grid-area: 1 / 1; }
.rubrik.numrerad > .n.lang { font-size: 1.05rem; }
.rubrik.numrerad > .rubrik-titel { grid-area: 1 / 2; }
.rubrik.numrerad > .pilcrow { grid-area: 2 / 1; }
section.artikel { margin: 2rem 0 .5rem; scroll-margin-top: var(--scroll-clear); }
section.artikel > h2 { margin-top: 0; }
/* A consolidated act's provenance: the "Ändrad genom förordning ..." line
   under an amended article's heading, and the subdued treatment of an
   article the register marks DELETED -- the text and its anchor survive
   (an inbound "artikel 19" still lands), it just must not read as law in
   force (same idea as the temporal-expired paragraf variant). */
p.artikel-mod { margin: -.35rem 0 .75rem 4.15rem; font-family: var(--sans);
                font-size: .8rem; color: var(--ink-3); }
section.artikel-upphavd > :not(h3):not(p.artikel-mod) { color: var(--ink-3); }
section.artikel-upphavd p.artikel-mod { font-weight: 600; }

/* -- Paragraphs (SFS § with hanging numeral) -- */
section.paragraf { display: grid; grid-template-columns: 3.25rem minmax(0,1fr);
                   gap: 1rem; margin: 1.75rem 0; align-items: baseline;
                   scroll-margin-top: var(--scroll-clear); }
.paragraf-gutter { text-align: right; font-family: var(--serif); line-height: 1.2;
                   font-variant-numeric: oldstyle-nums; }
.paragraf-gutter .pilcrow { display: block; margin-top: .15rem; }
.paragraf-body { min-width: 0; font-size: 1.0rem; line-height: 1.7; }
.paragraf-body > p:first-child { margin-top: 0; }
p { margin: 0 0 .7rem; }
.num { font-family: var(--serif); font-weight: 600; color: var(--accent);
       font-variant-numeric: oldstyle-nums; }
section.paragraf.rail-active { background:
   linear-gradient(90deg, color-mix(in oklab, var(--accent) 6%, transparent), transparent 60%);
   border-radius: 4px; }

/* -- Föreskrift: the ingress and the allmänna råd --
   A föreskrift opens with its ingress -- the day it was decided and the
   bemyndigande it rests on -- which is the document speaking about itself, not
   a provision, so it is set apart from the §§ that follow.
   An allmänt råd is the advisory text under a paragraf. The documents state
   its status themselves ("Allmänna råd har en annan juridisk status än
   föreskrifter. De är inte tvingande."), so the page has to show at a glance
   that it is not the binding rule: smaller, indented, and labelled. */
section.ingress { margin: 0 0 2rem; color: var(--ink-2); font-size: .95rem; }
section.ingress p:last-child { margin-bottom: 0; }
aside.allmanna-rad { margin: .9rem 0 1.2rem; padding: .1rem 0 .1rem 1rem;
                     border-left: 3px solid var(--rule); font-size: .93rem; }
aside.allmanna-rad > .rad-etikett { font: 600 .68rem var(--sans);
                     color: var(--ink-3); letter-spacing: .07em;
                     text-transform: uppercase; margin-bottom: .35rem; }
aside.allmanna-rad p:last-child, aside.allmanna-rad ul:last-child
                   { margin-bottom: 0; }

/* -- Incorporated conventions rendered as multilingual parallel corpora --
   Every heading and legal paragraph is one row with one cell per language. The
   column count is driven by --n-languages (2 or 3), set inline on the
   .konventionsbilaga container. The grid has no minimum width: all languages
   share the available reading column instead of clipping the last, and it uses
   the ordinary law-page surface. */
body.parallel-appendix .gr-main { max-width: 90rem; }
.konventionsbilaga { margin-top: 1.5rem; }
.konvention-languages, .konvention-row { display: grid;
                     grid-template-columns: repeat(var(--n-languages, 3), minmax(0, 1fr));
                     column-gap: clamp(.75rem, 2vw, 1.5rem); }
.konvention-languages { margin-bottom: 2.25rem; }
.konvention-languages > div { font: 600 .68rem var(--sans);
                              color: var(--ink-3); letter-spacing: .07em;
                              text-transform: uppercase; }
.konvention-instrument { scroll-margin-top: calc(var(--scroll-clear) + 2rem); }
.konvention-instrument + .konvention-instrument { margin-top: 4.5rem; }
.konvention-cell { min-width: 0; overflow-wrap: break-word;
                   font-family: var(--serif); font-size: .9rem; line-height: 1.55; }
.konvention-cell h3, .konvention-cell h4 { line-height: 1.3; text-wrap: balance; }
.konvention-cell h3 a, .konvention-cell h4 a { color: inherit; }
.konvention-title { margin-bottom: 1.4rem; }
.konvention-title .konvention-cell h3 { margin: 0; font-size: 1.05rem;
                                        font-weight: 600; }
.konvention-section { margin: 2.5rem 0 1.5rem; }
.konvention-section-heading .konvention-cell h4 { margin: 0; color: var(--ink-2);
                                          letter-spacing: .025em; font-size: .78rem;
                                          font-weight: 600; }
.konvention-article { margin: 1.8rem 0; }
.konvention-article-heading { margin-bottom: .65rem; }
.konvention-article-heading .konvention-cell h4 { margin: 0; font-size: .9rem;
                                                   font-weight: 600; }
.konvention-paragraph { margin-bottom: .7rem; }
.konvention-paragraph .konvention-cell p { margin: 0; }
.konvention-article { scroll-margin-top: calc(var(--scroll-clear) + 2rem); }

/* -- DV / förarbete extras -- */
.sammanfattning { font-family: var(--serif); font-style: italic; font-size: 1.05rem;
                  color: var(--ink-2); }
.sokord { font-size: .85rem; color: var(--ink-3); }
.sokord span { text-transform: uppercase; letter-spacing: .05em; font-size: .68rem;
               margin-right: .4rem; }
/* the "Ursprunglig dom" link on a referat that absorbed the court's pre-referat
   verdict PDF (R2) */
.ursprunglig-dom { font-size: .85rem; color: var(--ink-3); margin: 0 0 1.25rem; }
.ursprunglig-dom .label { text-transform: uppercase; letter-spacing: .05em;
               font-size: .68rem; margin-right: .4rem; }
.ursprunglig-dom a { color: var(--accent); }
/* a numbered domskäl paragraph (recovered from HD's margin-bitmap numbers): the
   number hangs in the gutter and is its own permalink anchor */
.dom-p { position: relative; padding-left: 2.6rem; margin: 0 0 .9rem; }
.dom-p .pnum { position: absolute; left: 0; top: .1em; width: 2rem;
               text-align: right; font-variant-numeric: tabular-nums;
               font-size: .8rem; color: var(--ink-4); text-decoration: none; }
.dom-p .pnum:hover, .dom-p:target .pnum { color: var(--accent); }
/* DV instance/ruling structure */
.instans { margin: 1.75rem 0 0; }
.instans-rubrik { font-family: var(--serif); font-weight: 600; font-size: 1.45rem;
                  margin: 0 0 .6rem; padding-bottom: .2rem;
                  border-bottom: 1px solid var(--rule); }
.betankande > .instans-rubrik, .dom > .instans-rubrik,
.skiljaktig > .instans-rubrik, .tillagg > .instans-rubrik {
    font-size: 1.1rem; border-bottom: 0; color: var(--ink-2); }
.delmal-rubrik { font-family: var(--serif); font-weight: 600; font-size: 1.6rem;
                 margin: 1.5rem 0 .6rem; }
/* the föredragande's proposal HD decides on -- subdued, set apart from the ruling */
.betankande { border-left: 2px solid var(--rule); padding-left: 1rem;
              margin: 1rem 0; color: var(--ink-3); }
.betankande .instans-rubrik { color: var(--ink-3); font-style: italic; }
/* The last instance settled the case; the courts below it are the record of how
   it got there. Set smaller, the way the föredragande's proposal above already
   is -- with every instance at one weight a reader could not tell HD's domskäl
   from tingsrättens, and the three of each read as one repeated section (D6). */
.instans-lower { font-size: .92em; color: var(--ink-2); }
.instans-lower > .instans-rubrik { font-size: 1.35rem; color: var(--ink-2); }
/* footnotes (HD 2023+): inline superscript markers + the endnote list */
sup.fnref { font-size: .7em; line-height: 0; }
sup.fnref a { text-decoration: none; padding: 0 .1em; }
.fotnoter { margin-top: 2.5rem; border-top: 1px solid var(--rule);
            padding-top: 1rem; font-size: .9rem; color: var(--ink-2); }
.fotnoter h2 { font-family: var(--serif); font-size: 1rem; font-weight: 600;
               border: 0; margin: 0 0 .5rem; }
.fotnoter ol { margin: 0; padding-left: 1.5rem; }
.fotnoter li { margin: .2rem 0; }
.fn-back { text-decoration: none; color: var(--ink-4); margin-left: .25rem; }
.fn-back:hover { color: var(--accent); }
.kommentar-law { font-family: var(--serif); font-style: italic; font-size: 1rem;
                 color: var(--ink-2); border-left: 2px solid var(--kommentar);
                 padding: .4rem 0 .4rem 1rem; margin-bottom: 1rem; }
.genomforande { margin: 1.5rem 0; padding: 1rem 1.25rem; background: var(--surf);
                border: 1px solid var(--rule); border-radius: 6px; }
.genomforande h2 { font-family: var(--serif); font-size: 1rem; font-weight: 600;
                   margin: 0 0 .5rem; border: 0; }
.genomforande ul { margin: 0; padding-left: 1.1rem; font-size: .9rem; }
/* The page boundary of the source PDF, and the control that shows that page as
   it was printed. Set as a pair of tabs sitting on the rule: as a bare oldstyle
   "s. 33" the number read as a footnote and gave no hint that it was a button
   at all, so the facsimile -- the thing that settles what the document actually
   says -- went unfound. */
.sid { display: flex; align-items: stretch; gap: 2px; margin: 1.75rem 0 .75rem;
       font-size: .78rem; font-family: var(--sans);
       border-bottom: 1px solid var(--rule); scroll-margin-top: var(--scroll-clear); }
.sid-nr, .sid button { padding: .25rem .6rem; border: 1px solid var(--rule);
       border-bottom: 0; border-radius: 4px 4px 0 0; margin-bottom: -1px;
       line-height: 1.5; }
.sid-nr { color: var(--ink-3); background: var(--bg-2); font-weight: 500; }
.sid button { all: unset; box-sizing: border-box; cursor: pointer;
       padding: .25rem .6rem; border: 1px solid transparent; border-bottom: 0;
       border-radius: 4px 4px 0 0; margin-bottom: -1px; color: var(--ink-4);
       display: inline-flex; align-items: center; gap: .35rem; }
.sid button:hover, .sid button:focus-visible {
       color: var(--accent); border-color: var(--rule); background: var(--bg-2); }
.sid-ico { flex: none; opacity: .75; }
/* the two controls are tabs, not toggles: the selected one is lit and inert,
   the other is what switches away from it */
.sid button[aria-selected="true"] { color: var(--ink); background: var(--surf-2);
                                    cursor: default; font-weight: 500; }
.sid button[aria-selected="false"] { color: var(--ink-3); background: transparent; }
.sid.fax-loading button { opacity: .4; cursor: progress; }
img.faksimil { display: block; width: 100%; max-width: 40rem; margin: .5rem 0 1rem;
               border: 1px solid var(--rule); border-radius: 4px;
               box-shadow: 0 1px 6px rgba(18,22,28,.12); }

/* -- Recovered graphics (formulas/maps/signs the SFST text drops, cropped from
      the published SFS PDF by the .graphics layer) -- */
figure.grafik { margin: 1rem 0; }
figure.grafik .grafik-img { display: block; max-width: 100%; height: auto;
               border: 1px solid var(--rule); border-radius: 4px;
               background: #fff; }
figure.grafik figcaption { font-family: var(--serif); font-style: italic;
               font-size: .8rem; color: var(--ink-3); margin-top: .35rem; }
/* a road-sign cell holds just the cropped sign, tight to the code column */
td.grafik { width: 1%; white-space: nowrap; }
td.grafik .grafik-img { max-height: 3.5rem; width: auto; border: 0;
               background: transparent; }
/* the crop is a button so it is keyboard-reachable (grafik.js opens it full
   size), but it must look and print like the bare image it wraps */
.grafik-open { display: block; padding: 0; border: 0; background: none;
               font: inherit; color: inherit; cursor: zoom-in; max-width: 100%; }
.grafik-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px;
               border-radius: 4px; }
td.grafik .grafik-open { line-height: 0; }
/* not-yet-localized gap: an honest, unobtrusive marker, never silent loss */
.grafik-saknas { font-family: var(--serif); font-style: italic;
               font-size: .85rem; color: var(--ink-3); }
td.grafik-saknas { white-space: nowrap; color: var(--ink-3); }
/* the lightbox: these graphics are printed small -- a road sign is 3.5rem in
   its cell -- and small is where a sign's symbol or a formula's subscripts stop
   being legible. Sized to the viewport rather than to the crop's own pixels, so
   a tall map and a square sign both open as large as they can be seen whole. */
.grafik-lightbox { position: fixed; inset: 0; z-index: 110; display: flex;
               flex-direction: column; justify-content: center; align-items: center;
               gap: .75rem; padding: 2rem; background: var(--overlay);
               cursor: zoom-out; }
.grafik-full { max-width: min(100%, 1100px); max-height: 82vh; width: auto;
               height: auto; object-fit: contain; background: #fff;
               border-radius: 4px; padding: .5rem;
               box-shadow: 0 30px 80px var(--shadow-modal); cursor: default; }
.grafik-full-cap { margin: 0; max-width: 46rem; text-align: center;
               font-family: var(--serif); font-style: italic; font-size: .85rem;
               color: var(--ink); background: var(--surf);
               border-radius: 4px; padding: .3rem .7rem; }
.grafik-close { position: absolute; top: 1rem; right: 1rem; width: 2.2rem;
               height: 2.2rem; font-size: 1.4rem; line-height: 1; cursor: pointer;
               color: var(--ink); background: var(--surf);
               border: 1px solid var(--rule); border-radius: 50%; }
.grafik-close:hover { color: var(--accent); }
/* a publisher's editorial note standing where statute text would be: a repeal
   notice ("Har upphävts genom förordning (2024:1330).") or the corpus gap
   "/Författningens text finns bara i tryckt version/". Same subdued treatment
   as the markers above -- it is the publisher speaking, not the statute -- but
   never hidden, and it keeps its links (sfs/redaktionell.py) */
p.redaktionell { font-family: var(--serif); font-style: italic;
               color: var(--ink-3); }
/* a temporal variant's entry-into-force state ("/Träder i kraft: den dag
   regeringen bestämmer/"), printed beside its in-force sibling. Subdued:
   the slash delimiters already mark it as editorial, like the source */
.temporal-status { font-family: var(--serif); font-style: italic;
               font-size: .8rem; color: var(--ink-3);
               margin: .25rem 0 .75rem; }
/* marker row above a pending/expiring table-row variant */
.temporal-status-rad td { border: 0; padding-bottom: 0; }
.temporal-status-rad .temporal-status { margin: .25rem 0 0; }

/* A consolidated statute prints an amended provision as two sibling variants,
   and around the boundary both are on the page -- BrB 3 kap. 6 § stood as
   "/Upphör att gälla: 2026-08-01/ … lägst fem år" directly above "/Träder i
   kraft: 2026-08-01/ … lägst sex år", with nothing but a small grey marker to
   say which was law that day. The variant that is *not* in force takes the
   marker's own subdued treatment, so the in-force text is the one that reads
   as the statute (D1). Set from the build date and corrected in the browser by
   versions.js; the text stays selectable, searchable and linkable -- it is
   still the law that was, or will be. */
.temporal-expired > .paragraf-body, .temporal-pending > .paragraf-body,
section.temporal-expired > :not(.temporal-status),
section.temporal-pending > :not(.temporal-status) { color: var(--ink-3); }
.temporal-expired .temporal-status, .temporal-pending .temporal-status {
    font-weight: 600; }

/* -- Context rail --------------------------------------------------------
   The client (scrollspy.js) fills the column with one .rail-entry per
   context-bearing location, absolutely positioned beside it. Out of focus an
   entry is a single summary line at the reading column's own type size; in
   focus it expands, in place, into the full panel (C4/C5).

   The *column* carries no surface of its own -- the page ground shows through,
   and only the panel and the summary lines are drawn on it. A column-wide
   surface made the whole right-hand side read as one widget, so a line six
   screens from the open panel looked like part of it (C4). The column is still
   the positioning context, so it stretches the whole grid row rather than
   sticking; the panel sticks within its own box instead. -- */
.rail { position: relative; align-self: stretch; padding: 0;
        font-size: .82rem; }
/* a collapsed line sits at its location and stays there, drawn as its own
   small card so it reads as a peer of the panel, not a piece of it */
.rail-entry { position: absolute; left: 1rem; right: .75rem;
              padding: .3rem .75rem; border-radius: 5px;
              background: var(--surf); border: 1px solid var(--rule-soft); }
/* the open panel starts at its location and owns the rest of the column, so a
   panel taller than its § stays readable instead of sliding off with it. The
   box itself must not eat clicks: it spans down to the column's foot, and the
   collapsed lines beneath it stay clickable through its empty part (C1) */
.rail-panelbox { position: absolute; left: 1rem; right: .75rem; bottom: 0;
                 z-index: 2; pointer-events: none; }
.rail-panelbox:not(.rail-open) { display: none; }
/* the remiss rail's sentiment mark: direction by the triangle's orientation,
   strength by whether it is filled, a diamond for neither -- five levels where
   three could not tell "avstyrker" from "tillstyrker med en invändning". A lone
   "−" read as a dash separating the organisation from its quote rather than as a
   minus sign, which inverted the meaning of every critical entry at a glance.
   Colour only groups them for the eye; the shape carries the meaning, and the
   title attribute carries it in words. */
.sentiment { font-size: .95em; line-height: 1; cursor: help; }
.sentiment-neg, .sentiment-neg-strong { color: var(--senti-neg); }
.sentiment-pos, .sentiment-pos-strong { color: var(--senti-pos); }
.sentiment-neutral { color: var(--ink-4); }
/* what an organisation wrote, set apart from the organisation naming it */
.rail .q { font-style: italic; }
/* the verdict over a section's answers, above the list it summarises */
.remiss-sum { margin: 0 0 .45rem; color: var(--ink-2); }
.rail-panel { position: sticky; top: 4rem; max-height: calc(100vh - 5rem);
              overflow-y: auto; padding: 1rem 1.1rem 1.25rem;
              border-radius: 6px; background: var(--surf);
              border: 1px solid var(--rule); pointer-events: auto; }
/* the sticky panel slides over the collapsed lines below it as you scroll;
   letting them show through as a faint blur says "there is more underneath"
   without competing with the panel's own text (C4) */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .rail-panel { background: color-mix(in srgb, var(--surf) 88%, transparent);
                -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
}
/* the collapsed line: the section-heading voice of the panel it stands for
   (.rail-h/.rail-sec-h -- serif italic, C2), so stub and panel read as the
   same thing at two sizes. The label keeps one line and ellipsizes; the
   "+ N ytterligare" tail drops to its own line instead of crowding it (C3). */
.rail-stub { display: flex; flex-wrap: wrap; align-items: baseline; width: 100%;
             border: 0; background: none; padding: 0; cursor: pointer;
             text-align: left; font: inherit; font-size: .85rem;
             line-height: 1.4; color: var(--ink-3); white-space: nowrap; }
.rail-stub:hover .rail-stub-label { color: var(--accent); }
.rail-stub-label { font-family: var(--serif); font-style: italic;
                   color: var(--ink-3);
                   min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rail-stub-n { flex: none; color: var(--ink-3);
               font-variant-numeric: oldstyle-nums; margin-left: .3rem; }
.rail-stub-more { flex: none; flex-basis: 100%; color: var(--ink-4);
                  font-size: .85em; }
/* the focused entry's own line steps aside -- the panel grows out of where it
   stood, so the swap reads as that line expanding rather than as two things (C5) */
.rail-entry.rail-on { visibility: hidden; }
.rail-panel.rail-grow { animation: rail-expand .18s ease both; }
@keyframes rail-expand {
  from { opacity: 0; transform: translateY(-.3rem); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .rail-panel.rail-grow { animation: none; }
}
.rail-h { font-family: var(--serif); font-style: italic; font-size: .85rem;
          color: var(--ink-3); padding-bottom: .6rem; margin-bottom: .75rem;
          border-bottom: 1px solid var(--rule); }
.rail-h b { font-style: normal; font-weight: 500; color: var(--ink);
            font-variant-numeric: oldstyle-nums; }
/* -- Rail accordion: one <details> per kind of context, the highest-priority
   one open (C3). Only the open row costs vertical space, so a paragraf with
   commentary, case law and a hundred citations still reads at a glance. -- */
.rail-sec { border-top: 1px solid var(--rule-soft); }
.rail-h + .rail-sec { border-top: 0; }
details.rail-sec > summary { display: flex; align-items: baseline; gap: .4rem;
                             cursor: pointer; list-style: none;
                             padding: .45rem 0; }
details.rail-sec > summary::-webkit-details-marker { display: none; }
details.rail-sec > summary:hover .rail-sec-h { color: var(--accent); }
details.rail-sec[open] > summary { padding-bottom: .25rem; }
.rail-sec-h { font-family: var(--serif); font-style: italic; font-size: .78rem;
              color: var(--ink-3); }
.rail-sec-n { margin-left: auto; font-size: .72rem; color: var(--ink-4);
              font-variant-numeric: oldstyle-nums; }
/* the fold affordance: a chevron that points down when the row is open --
   without it nothing said the rows were accordions at all */
.rail-sec-chevron { flex: none; align-self: center; width: .5em; height: .5em;
                    border-right: 1.5px solid var(--ink-4);
                    border-bottom: 1.5px solid var(--ink-4);
                    transform: rotate(-45deg); transition: transform .15s ease; }
.rail-sec-chevron { margin-left: auto; }       /* right-aligned when no count */
.rail-sec-n + .rail-sec-chevron { margin-left: .1rem; }
details.rail-sec[open] > summary .rail-sec-chevron { transform: rotate(45deg); }
/* a flat section: its body inline under the label, no fold */
.rail-sec-flat { padding: .45rem 0 .4rem; }
.rail-sec-flat > .rail-sec-h { display: block; margin-bottom: .2rem; }
details.rail-sec > ul { list-style: none; margin: 0 0 .5rem; padding: 0; }
details.rail-sec > ul > li { margin: .15rem 0; line-height: 1.4; }
/* every case-law group reads in the case colour, wherever the court sits */
.rail-sec.dv a, .rail-sec.aldre-rattsfall a,
.rail-sec.eu-caselaw a, .rail-sec.eu-forslag a { color: var(--case); }
.rail-sec.forarbete a { color: var(--forarbete); }
.rail-sec.begrepp a { color: var(--accent); }
.rail-sec .rail-prov { color: var(--ink-3); font-style: italic;
                       font-size: .78rem; margin-bottom: .25rem; }
/* commentary shown side-by-side in the rail (in place of a kommentar page) */
.rail-sec.kommentar p { font-family: var(--serif); font-size: .9rem;
               line-height: 1.5; margin: 0 0 .5rem; color: var(--ink); }
.komm-by { font-family: var(--serif); font-style: italic; font-size: .78rem;
           color: var(--ink-3); }
/* a förarbete's small-print footnotes ("Senaste lydelse 2008:1266.") */
p.fotnot { font-size: .78rem; color: var(--ink-3); margin: .3rem 0; }

/* a nuvarande/föreslagen lydelse comparison table */
table.lydelse { width: 100%; border-collapse: collapse; margin: 1rem 0;
                table-layout: fixed; }
table.lydelse th { font-family: var(--serif); font-style: italic;
                   font-weight: 400; text-align: left; color: var(--ink-2);
                   border-bottom: 1px solid var(--rule); padding: .2rem .6rem; }
table.lydelse td { vertical-align: top; padding: .35rem .6rem;
                   font-family: var(--serif); line-height: 1.5; }
table.lydelse td + td, table.lydelse th + th
                 { border-left: 1px solid var(--rule-soft); }

/* the författningskommentar prose highlighted on the prop page itself: one
   box per run of commentary blocks, set off from the quoted lagtext */
.fk-komm { background: var(--fk-bg); border: 1px solid var(--fk-border);
           border-radius: 6px; padding: .7rem .9rem; margin: .8rem 0; }
.fk-komm p { margin: 0 0 .6rem; }
.fk-komm p:last-child { margin-bottom: 0; }

/* the lagstiftare's own författningskommentar, from the proposition's FK */
.rail-sec.fk p { font-family: var(--serif); font-size: .9rem; line-height: 1.5;
             margin: 0 0 .5rem; color: var(--ink); }
.rail-sec.fk .prov { font-style: italic; font-size: .78rem; color: var(--ink-3);
                 white-space: nowrap; }
.rail-sec.fk .prov a { color: var(--forarbete); }
.more { color: var(--ink-3); font-style: italic; font-size: .78rem; margin-top: .25rem; }
details.more { margin-top: .3rem; }
details.more > summary { color: var(--ink-3); font-style: italic; font-size: .78rem;
                         cursor: pointer; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] > summary { margin-bottom: .25rem; }
details.more > ul { list-style: none; margin: 0; padding: 0; }
.rail-sec.genomfor .prov, .rail-sec.bemyndigande .prov,
.rail-sec.andringar .prov { color: var(--ink-3); }
.rail-sec.andringar .prov a { color: var(--forarbete); }

/* -- Preparatory works ("Förarbeten"), top-billed above the citation panel -- */
section.forarbeten { margin: 1.25rem 0; font-size: .85rem; }
section.forarbeten h2 { font-family: var(--serif); font-style: italic; font-size: .85rem;
                        color: var(--ink-3); font-weight: 400; margin: 0 0 .4rem; border: 0; }
section.forarbeten ul { list-style: none; margin: 0; padding: 0; }
section.forarbeten li { margin: .15rem 0; line-height: 1.4; }
section.forarbeten a { color: var(--forarbete); }
section.forarbeten .forarbeten-mer > summary { cursor: pointer; color: var(--ink-3);
                        font-style: italic; margin: .2rem 0; list-style: none; }
section.forarbeten .forarbeten-mer > summary::-webkit-details-marker { display: none; }
section.forarbeten .forarbeten-mer[open] > summary { margin-bottom: .15rem; }

/* -- Curated relation groups on a decision page (Lagrum / Förarbeten /
      Rättsfall / Litteratur) -- same compact metadata-list voice -- */
section.curated { margin: 1.25rem 0; font-size: .85rem; }
section.curated h2 { font-family: var(--serif); font-style: italic; font-size: .85rem;
                     color: var(--ink-3); font-weight: 400; margin: 0 0 .4rem; border: 0; }
section.curated ul { list-style: none; margin: 0; padding: 0; }
section.curated li { margin: .15rem 0; line-height: 1.4; }

/* -- Inline bits -- */
ol.punkter { list-style: none; margin: .4rem 0; padding-left: 0; }
ol.punkter li { margin: .25rem 0; padding-left: 2.1rem; }
/* the marker hangs in a fixed column (like the paragraf gutter's §-numeral),
   right-aligned so "1." and "12." line up on the dot, in text colour not accent */
ol.punkter li > .num { display: inline-block; box-sizing: border-box; width: 1.7rem;
                       margin-left: -2.1rem; margin-right: .4rem; text-align: right;
                       color: var(--ink); }
ol.punkter ol.punkter { margin-top: .35rem; }
.noref { color: var(--ink-3); border-bottom: 1px dotted var(--ink-4); cursor: help; }
/* an in-act use of a defined term: underlined, hover shows the definition */
a.term { color: inherit; border-bottom: 1px dotted var(--ink-4); cursor: help; }
a.term:hover { color: var(--accent); border-bottom-color: var(--accent);
               text-decoration: none; }
/* the definition point itself (Article "Definitions") */
p.definition { scroll-margin-top: var(--scroll-clear); }
p.definition dfn { font-style: normal; font-weight: 600; color: var(--accent); }

/* -- EU act editorial layer (.ann): thematic recital groups + the rail's
   article<->recital links. The group label is editorial, not part of the
   authentic text, so it reads as a subdued, compact aside outdented to the
   left rather than a heading competing with the act. -- */
.recital-group { margin: 1.75rem 0 .4rem -1.6rem; font-family: var(--serif);
                 font-style: italic; font-size: .8rem; line-height: 1.4;
                 color: var(--ink-3); scroll-margin-top: var(--scroll-clear); }
.recital-group b { font-style: normal; font-weight: 600; color: var(--ink-2); }
.recital-group .rg-range { font-variant-numeric: oldstyle-nums; }
.recital-group .jfr { color: var(--ink-4); }
.recital-group a { color: var(--ink-3); }
/* the consolidated page's way into the amending acts' recital sets: a
   subdued editorial line opening the (base act's) preamble */
p.preamble-note { margin: 1.5rem 0 .75rem; font-family: var(--sans);
                  font-size: .8rem; color: var(--ink-3); }
p.preamble-note a { color: var(--ink-2); }
p.recital { scroll-margin-top: var(--scroll-clear); }
/* EU enacting terms: a numbered recital/paragraph or lettered point hangs its
   marker in the left margin (.hang); points sit indented under their paragraph
   so the nesting reads as depth. The hang width tracks the marker width, so
   wrapped lines align under the text and not past it: a recital's marker is the
   widest ("(172)"), a numbered paragraph's or lettered point's markedly narrow
   ("1.", "a)"). */
p.recital.hang { padding-left: 2.4rem; text-indent: -2.4rem; }
p.paragraph.hang, p.point.hang { padding-left: 1.5rem; text-indent: -1.5rem; }
/* a stycke carries no marker (the act prints none either), so it needs no rule
   of its own: it sets flush, aligning with the text of the paragraph it
   continues, whose own marker hangs in the margin. The class is the anchor
   hook -- the SFS <p id="P2S1"> shape. */
p.point { margin-left: 2.2rem; }
/* a point nested inside another point (a definition's own roman sub-list, e.g.
   2015/1535 art. 1.1 f ii) steps in once per level, so the depth its anchor
   records is the depth the eye reads. Points nest to seven; the step saturates
   at the fourth, past which the remaining 1% would walk off a narrow screen. */
p.point.sub2 { margin-left: 4rem; }
p.point.sub3 { margin-left: 5.8rem; }
p.point.sub4 { margin-left: 7.6rem; }
/* An act quoted verbatim inside a judgment paragraph ("I artikel 25 i detta
   direktiv föreskrevs följande:" — Schrems II's sections 3 to 42 are almost all
   this shape). The quotation is another document's text, so it is set apart
   rather than run in: a rule down the left, a step in, one size smaller and a
   shade lighter. It keeps the quoted act's own numbering, hung in the margin
   the way the act's own page hangs it, so a reader can follow "1.", "2.", "6."
   back to the directive. The official PDF only indents; the rule and the
   lighter setting are what tell the eye where the court stops speaking. */
p.citat { --citat-step: 0rem;
          margin-left: 1.2rem; padding-left: calc(.9rem + var(--citat-step));
          font-size: .92em; color: var(--ink-2);
          border-left: 2px solid var(--rule);
          margin-top: .35rem; margin-bottom: .35rem; }
/* consecutive blocks are one quotation: close the gap, and step the quoted
   act's own nesting with padding rather than margin, so the rule stays at one
   x and reads as a single unbroken stroke down the whole quotation. Graded and
   saturating like the enacting terms' points. */
p.citat + p.citat { margin-top: 0; }
p.citat.sub1 { --citat-step: 1.8rem; }
p.citat.sub2 { --citat-step: 3.6rem; }
p.citat.sub3 { --citat-step: 5.4rem; }
p.citat.sub4 { --citat-step: 7.2rem; }
p.citat.hang { padding-left: calc(2.4rem + var(--citat-step));
               text-indent: -1.5rem; }
p.citat.citat-recital.hang { text-indent: -2.4rem; }
/* the quoted act's own marker is the quoted document numbering itself, not the
   court numbering its judgment: it takes the quotation's colour, so the eye
   still finds the judgment's own paragraph numbers first */
p.citat .num { color: var(--ink-3); }
/* a heading inside the quotation (the quoted act's own division title) is the
   quoted document speaking, not the court: it keeps the quotation's setting and
   is marked by weight alone */
p.citat.citat-heading { font-weight: 600; color: var(--ink); }
/* every addressable enacting-terms block clears the sticky masthead when a
   #4.22.a permalink scrolls to it */
p.hang { scroll-margin-top: var(--scroll-clear); }
.rail-sec.skal .skal-links { display: flex; flex-wrap: wrap; gap: .2rem .6rem; }
.rail-sec.skal a { font-variant-numeric: oldstyle-nums; }
/* curated external links (the act's "Externa länkar" rail section) */
.rail-sec.vagledning { margin-bottom: 1rem; }
.rail-sec.vagledning ul { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.rail-sec.vagledning li { margin: .3rem 0; line-height: 1.4; }
.rail-sec.vagledning .prov { color: var(--ink-3); font-style: italic; }

/* A unit carrying rail context needs no marker of its own: its context
   announces itself as a summary line beside it in the rail (C4), and the unit in
   focus is tinted (section.paragraf.rail-active). position:relative stays --
   the rail measures its entries against these boxes. */
[data-rail] { position: relative; }
a.ext { color: var(--accent); }
a.ext::after { content: " \2197"; font-size: .8em; color: var(--ink-4); }
table { border-collapse: collapse; margin: 1rem 0; width: 100%; font-size: .92rem; }
/* a table's own heading, where the source gives it one (an OJ annex table's
   Formex TITLE): it names the table, so it reads like one, left where the
   first column starts rather than centred over the whole width */
caption { text-align: left; font-family: var(--serif); font-style: italic;
          color: var(--ink-2); padding: 0 0 .35rem; }
td { border-top: 1px solid var(--rule); padding: .35rem .7rem; vertical-align: top; }
th { border-bottom: 1px solid var(--ink-4); padding: .35rem .7rem;
     vertical-align: bottom; text-align: left; font-weight: 600; }
/* SFS tables follow the restrained official typesetting. Their first row is
   the heading, in italic, and body rows use alignment rather than rules. */
#dokument table { font-size: 1rem; }
#dokument table td, #dokument table th {
  border: 0; padding: .12rem 1rem .12rem 0; vertical-align: top;
}
#dokument table th, #dokument table tr:first-child > td {
  font-style: italic; font-weight: 400; padding-bottom: .35rem;
}
/* a wide authored table scrolls inside its own box rather than pushing the
   page sideways (the /om pages' endpoint and tool tables on a phone).
   `.site` is the editorial pages' body class -- document-page tables keep
   their own layout rules above. */
.site table { display: block; overflow-x: auto; }

/* -- Frontpage / browse -- */
.lead { font-family: var(--serif); font-size: 1.2rem; color: var(--ink-2); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; margin-top: 2rem; }
.cols h2, .browse-group h2 { font-family: var(--serif); font-weight: 500; font-size: 1.2rem;
              border-bottom: 1px solid var(--rule); padding-bottom: .3rem; }
ol.ranked { padding-left: 1.4rem; } ol.ranked .c { color: var(--ink-3); font-size: .8rem; }
.cols ul { list-style: none; padding: 0; } .cols li { margin: .3rem 0; }
.counts ul { list-style: none; padding: 0; margin: 1.5rem 0 0; display: flex;
             flex-wrap: wrap; gap: .5rem 1.75rem; }
.counts li { font-size: 1.05rem; }
.counts .c { color: var(--ink-3); font-size: .8rem; margin-left: .2rem; }
.browse-group { margin: 1.5rem 0; }
.browse-group h1 { font-family: var(--serif); font-weight: 500; font-size: 1.5rem;
                   border-bottom: 1px solid var(--rule); padding-bottom: .3rem; }
.browse-group h1 .c, .browse-group h2 .c { color: var(--ink-3); font-size: .8rem;
                   font-weight: 400; }
/* index listings are single column -- multi-column is reserved for where it is
   clearly useful, never the default for a listing */
.browse-group ul { list-style: none; padding: 0; margin: .75rem 0 0; font-size: .92rem; }
.browse-group li { margin: .18rem 0; }
dl.browse-list { margin: .75rem 0 0; font-size: .92rem; }
dl.browse-list dt { margin: .45rem 0 0; }
dl.browse-list dd { margin: 0; color: var(--ink-2); font-size: .88rem; }
/* the legacy two-column definition-list layout: the bold id term to the left, its
   name/description to the right, aligned on the same row */
dl.browse-list.def { display: grid; grid-template-columns: max-content 1fr;
                     column-gap: 1.5rem; row-gap: .3rem; align-items: baseline; }
dl.browse-list.def dt { margin: 0; white-space: nowrap; }
dl.browse-list.def dd { align-self: baseline; }
@media (max-width: 34rem) {   /* stack on narrow screens */
    dl.browse-list.def { display: block; }
    dl.browse-list.def dt { margin: .45rem 0 0; }
}
/* A glossary bucket (/begrepp/<letter>/): one-word entries, thousands of them,
   so this is the listing where multi-column is clearly useful -- `columns:
   <width> <count>` like the frontpage, which keeps a column readable and drops
   to one on a phone without a media query. A term the wiki describes is bold;
   the rest only occur in the corpus's own texts. */
ul.browse-list.terms { columns: 14rem 3; column-gap: 2rem; }
ul.browse-list.terms li { break-inside: avoid; overflow-wrap: break-word; }
/* the group headings of a grouped listing: Domar/Referat/Notiser, an EU year's
   enacting bodies, the treaty families */
.listing-head { font-family: var(--sans); text-transform: uppercase; letter-spacing: .06em;
              font-size: .72rem; font-weight: 600; color: var(--ink-3); margin: 1.75rem 0 .2rem; }
/* statute listing: the dropped designation/number prefix is subdued so the eye
   lands on the sort subject; secondary instruments (förordning, …) dim wholesale */
.browse-list .pre { color: var(--ink-4); }
.browse-list dt.subdued a { color: var(--ink-3); }
.browse-list dt.subdued .pre { color: var(--ink-4); }
/* a föreskrift's ändringsförfattningar, nested inside its own row (F5) */
.browse-list .fs-andringar { font-size: .85em; color: var(--ink-3);
                             margin-top: .1rem; }
.browse-list .fs-andringar a { color: var(--ink-2); }
.browse-list .fs-andringar a.subdued { color: var(--ink-3); }
/* the listed entry is the konsoliderade version; the base text as promulgated
   is offered from the document page instead of listing beside it (B4) */
.browse-list .fs-konsoliderad { font-size: .8em; color: var(--ink-3);
                                font-variant: small-caps; letter-spacing: .03em;
                                white-space: nowrap; }
/* the succession note under a samling's heading (F8) */
.browse-note { margin: -0.5rem 0 1rem; color: var(--ink-3);
               font-family: var(--serif); font-style: italic; font-size: .9rem; }
.empty { color: var(--ink-3); font-style: italic; }

/* -- folkrätt landing: the CoE treaty listing (alphabetical, protocols nested)
   beside the ECtHR facet links -- */
.folkratt-group { margin: 1.5rem 0 2.5rem; }
.folkratt-group h3 { font-family: var(--sans); text-transform: uppercase;
                     letter-spacing: .06em; font-size: .72rem; font-weight: 600;
                     color: var(--ink-3); margin: 1.5rem 0 .3rem; }
.folkratt-treaties .ref { color: var(--ink-4); font-size: .8rem; }
.folkratt-protocols { list-style: none; padding: 0; margin: .1rem 0 .1rem .9rem;
                     border-left: 1px solid var(--rule); }
.folkratt-protocols li { margin: .1rem 0; padding-left: .6rem; font-size: .86rem; }
.folkratt-protocols a { color: var(--ink-2); }

/* -- faceted browse navigator -- */
.facets { margin: 0 0 2rem; }
.facet-axis { font-family: var(--sans); text-transform: uppercase;
              letter-spacing: .06em; font-size: .72rem; font-weight: 600;
              color: var(--ink-3); margin: 1.1rem 0 .4rem; }
.facet-list { list-style: none; padding: 0; margin: 0; display: flex;
              flex-wrap: wrap; gap: .35rem .7rem; }
.facet-list a { display: inline-block; padding: .12rem .55rem; border-radius: 4px;
                background: var(--surf-2); color: var(--ink-2); font-size: .92rem;
                text-decoration: none; }
.facet-list a:hover { background: var(--surf-3); }
.facet-list a[aria-current] { background: var(--accent); color: var(--on-accent); }
.facet-list .c { color: var(--ink-4); font-size: .72rem; margin-left: .25rem; }
.facet-list a[aria-current] .c { color: color-mix(in oklab, var(--on-accent) 72%, transparent); }

/* -- Browse index: facets in a left rail beside the list (X1) --
   the browse page is solo but widened to hold the two columns; the folkrätt
   banner (if any) stays a full-width pill row above the layout. */
body.browse .gr-body.solo { max-width: var(--page-max); }
.browse-layout { display: grid; align-items: start; gap: 2.5rem;
                 grid-template-columns: var(--col-toc) minmax(0, 1fr); }
.browse-facets { position: sticky; top: 5rem; }
.browse-main { min-width: 0; }
/* link-like, vertical facets sharing the search rail's tokens -- not pills */
.browse-facets .facets { margin: 0; }
.browse-facets .facet-list { flex-direction: column; flex-wrap: nowrap; gap: .05rem; }
.browse-facets .facet-list a { display: block; background: transparent;
                 padding: .18rem .45rem; color: var(--ink-2); }
.browse-facets .facet-list a:hover { background: var(--surf-2); }
.browse-facets .facet-list a[aria-current] { background: transparent;
                 color: var(--accent); font-weight: 500; }
.browse-facets .facet-list a[aria-current] .c { color: var(--ink-4); }

/* -- feed screens (/dataset/<alias>/feed, the news feed, the feed directory):
   the browse layout, so the source selector sits in the same left rail the
   browse pages put their facets in. */
.feed-all { margin: 1.1rem 0 0; font-size: .86rem; }
.feed-all a { color: var(--ink-3); text-decoration: none; }
.feed-all a[aria-current] { color: var(--accent); }
.feed-all a:hover { color: var(--accent); }
.feed-link { margin: -.4rem 0 1.6rem; font-size: .86rem; }
.news-item { margin: 0 0 1.9rem; }
.news-item h2 { margin: .1rem 0 .35rem; font-size: 1.12rem; }
.news-date { font-family: var(--sans); font-size: .74rem; letter-spacing: .04em;
             color: var(--ink-4); margin: 0; }
.feed-list { list-style: none; padding: 0; margin: 0; }
.feed-list li { margin: .18rem 0; }
.feed-atom { font-family: var(--sans); font-size: .64rem; letter-spacing: .06em;
             text-transform: uppercase; padding: .05rem .3rem; border-radius: 3px;
             background: var(--surf-2); color: var(--ink-4); text-decoration: none; }

/* -- search palette (live full-text search via the REST API) -- */
.search-overlay { position: fixed; inset: 0; z-index: 100; display: flex;
                  justify-content: center; align-items: flex-start; padding-top: 8rem;
                  background: var(--overlay); }
.search-box { width: 37rem; max-width: 92vw; background: var(--surf);
              border: 1px solid var(--rule); border-radius: 8px;
              box-shadow: 0 30px 80px var(--shadow-modal); overflow: hidden; }
.search-input-row { display: flex; align-items: stretch; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; padding: 1.1rem 1.25rem;
                    background: transparent; font-family: var(--serif); font-size: 1.2rem;
                    color: var(--ink); }
.search-box .search-note { padding: .9rem 1.25rem; border-top: 1px solid var(--rule);
                           font-family: var(--serif); font-style: italic;
                           color: var(--ink-3); font-size: .9rem; }
/* the API round-trip past 400 ms (a cold prod OpenSearch takes 10+ s on the
   first search after idle): a ring at the input's right edge, unhidden by
   search.js waitOn/waitOff so the warm ~100 ms path never flashes it */
.search-spin { align-self: center; flex: none; width: .8em; height: .8em;
               margin-right: 1.1rem; border-radius: 50%;
               border: 2px solid var(--ink-3); border-right-color: transparent;
               animation: spin .8s linear infinite; }
.search-results:not(:empty) { border-top: 1px solid var(--rule);
                              max-height: 60vh; overflow-y: auto; }
/* keystroke in flight: the prior hits stay put but dim, so the list doesn't
   flash empty between queries (search.js keeps them until the response lands) */
.search-results.loading { opacity: .45; transition: opacity .12s ease; }
.search-hit { display: block; padding: .7rem 1.25rem; border-bottom: 1px solid var(--rule);
              text-decoration: none; color: var(--ink); }
.search-hit:last-child { border-bottom: 0; }
.search-hit:hover, .search-hit.sel { background: var(--surf-2); }
.search-hit.sel { box-shadow: inset 3px 0 0 var(--accent); }
.search-hit .hit-title { display: block; font-family: var(--sans); font-weight: 600;
                         font-size: .95rem; }
.search-hit .hit-sub { display: block; font-family: var(--serif); color: var(--ink-2);
                       font-size: .9rem; }
.search-hit .hit-snip { display: block; font-family: var(--serif); color: var(--ink-3);
                        font-size: .82rem; margin-top: .15rem; }
.search-hit .hit-snip em { font-style: normal; background: var(--mark);
                           border-radius: 2px; padding: 0 1px; }
.search-refine { display: inline-flex; align-items: center; margin: .55rem .8rem .55rem 0;
                 flex: 0 0 auto; align-self: center;
                 /* flex layout drops the whitespace text nodes around the
                    count span; the gap is those word spaces */
                 gap: .3em;
                 padding: .4rem .65rem; border-radius: 5px; white-space: nowrap;
                 color: var(--accent); font-family: var(--sans); font-size: .86rem;
                 font-weight: 600; text-decoration: none; background: var(--surf-2); }
.search-refine[hidden] { display: none; }
/* tabular figures so the odometer roll (search.js rollNumber) doesn't reflow */
.search-refine .refine-count { font-variant-numeric: tabular-nums; }
.search-refine:hover, .search-refine.sel { background: var(--surf-3);
                                           box-shadow: inset 0 0 0 1px var(--rule); }

/* -- complete search result page -- */
.full-search-form { display: flex; gap: .55rem; margin: 0 0 .75rem; }
.full-search-form input { flex: 1; min-width: 0; padding: .7rem .85rem;
                          border: 1px solid var(--rule); border-radius: 6px;
                          background: var(--surf); color: var(--ink);
                          font: 1rem var(--serif); }
.full-search-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.full-search-form button, .search-page button { border: 1px solid var(--rule);
                    border-radius: 6px; padding: .55rem .8rem; background: var(--surf-2);
                    color: var(--ink); font: 600 .84rem var(--sans); cursor: pointer; }
.full-search-form button { background: var(--accent); color: var(--on-accent);
                           border-color: var(--accent); }
.full-search-layout { display: grid; grid-template-columns: 12rem minmax(0, 1fr);
                      gap: 2rem; align-items: start; margin-top: 1.5rem; }
.search-facet-group { border: 0; padding: 0; margin: 0 0 1.4rem; }
.search-facet-group legend { font: 600 .72rem var(--sans); letter-spacing: .06em;
                             text-transform: uppercase; color: var(--ink-3);
                             margin-bottom: .35rem; }
.search-facet-group button { display: flex; width: 100%; justify-content: space-between;
                             gap: .5rem; border: 0; padding: .28rem .4rem;
                             background: transparent; font-weight: 400; text-align: left; }
.search-facet-group button:hover { background: var(--surf-2); }
.search-facet-group button[aria-pressed="true"] { background: var(--accent);
                             color: var(--on-accent); font-weight: 600; }
.search-facet-group .facet-count { color: var(--ink-4); font-size: .75rem; }
.search-facet-group button[aria-pressed="true"] .facet-count { color: inherit; }
.full-search-status { min-height: 1.3rem; color: var(--ink-3); font-size: .9rem; }
.full-search-results { border-top: 1px solid var(--rule); }
.full-search-hit { padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.full-search-hit h2 { font: 600 1rem var(--sans); margin: 0; }
.full-search-hit .hit-id { color: var(--ink-3); font-size: .82rem; margin: .15rem 0; }
.full-search-hit .hit-snip { color: var(--ink-2); margin: .35rem 0 0;
                             font-size: .92rem; }
.full-search-hit .hit-snip em { font-style: normal; background: var(--mark); }
/* the passages inside the document where the query matched -- indented under
   the hit, each its own link to that §/article, so the hit itself still leads
   to the document */
.full-search-hit .hit-passages { list-style: none; margin: .5rem 0 0;
                                 padding: 0 0 0 .85rem;
                                 border-left: 2px solid var(--rule); }
.full-search-hit .hit-passages li + li { margin-top: .35rem; }
.full-search-hit .hit-passages a { display: block; color: var(--ink-2);
                                   font-size: .88rem; text-decoration: none; }
.full-search-hit .hit-passages a:hover { text-decoration: underline; }
.full-search-hit .hit-passages em { font-style: normal; background: var(--mark); }
.full-search-hit .passage-label { color: var(--ink-3); font-family: var(--sans);
                                  font-size: .8rem; white-space: nowrap; }
.search-pagination { display: flex; justify-content: space-between; align-items: center;
                     gap: 1rem; margin: 1.25rem 0; color: var(--ink-3); font-size: .85rem; }
.search-pagination button:disabled { visibility: hidden; }

/* -- link preview popover + split reading view (popover.js) -- */
.lagen-popover { position: fixed; z-index: 90; background: var(--surf);
                 border: 1px solid var(--rule); border-radius: 8px;
                 box-shadow: 0 18px 50px var(--shadow-modal); overflow: hidden; }
.lagen-popover .pop-head { display: flex; align-items: center; gap: .5rem;
                           padding: .5rem .9rem; border-bottom: 1px solid var(--rule);
                           background: var(--surf-2); }
.lagen-popover .pop-title { flex: 1; min-width: 0; font: 600 .82rem var(--sans);
                            color: var(--ink); text-decoration: none; white-space: nowrap;
                            overflow: hidden; text-overflow: ellipsis; }
.lagen-popover .pop-title:hover { color: var(--accent); }
.lagen-popover .pop-expand { border: 0; background: none; cursor: pointer;
                             color: var(--ink-3); font-size: .95rem; line-height: 1;
                             padding: .15rem .35rem; border-radius: 4px; }
.lagen-popover .pop-expand:hover { color: var(--accent); background: var(--surf-3); }
.lagen-popover .pop-body { padding: .8rem 1rem; max-height: 45vh; overflow-y: auto;
                           font-family: var(--serif); font-size: .88rem;
                           line-height: 1.5; color: var(--ink-2); }
.lagen-popover .pop-loading { color: var(--ink-3); font-style: italic; }

body.split { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
body.split .pane-stack { flex: 1 1 0; min-height: 0; display: flex;
                         flex-direction: column; }
.pane { flex: 1 1 0; min-height: 5rem; display: flex; flex-direction: column; }
.pane-bar { display: flex; align-items: center; gap: .75rem; padding: .3rem .9rem;
            background: var(--surf-2); border-bottom: 1px solid var(--rule);
            font-family: var(--sans); font-size: .78rem; }
.pane-bar .pane-title { flex: 1; min-width: 0; color: var(--ink-2); font-weight: 600;
                        text-decoration: none; white-space: nowrap; overflow: hidden;
                        text-overflow: ellipsis; }
.pane-bar .pane-title:hover { color: var(--accent); }
.pane-actions { display: flex; gap: .15rem; }
.pane-actions button { border: 0; background: none; cursor: pointer; color: var(--ink-3);
                       font-size: .85rem; line-height: 1; padding: .15rem .4rem;
                       border-radius: 4px; }
.pane-actions button:hover { color: var(--ink); background: var(--surf-3); }
.pane-scroll { flex: 1 1 0; min-height: 0; overflow-y: auto; }
/* the sticky offsets assume a window-scrolled masthead; inside a pane the
   scroll container starts right under the pane bar */
.pane-scroll .toc-col { top: 0; max-height: 100%; }
.pane-divider { flex: 0 0 5px; cursor: row-resize; background: var(--rule);
                touch-action: none; }
.pane-divider:hover { background: var(--accent); }
.pane-error { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
              z-index: 95; background: var(--danger); color: var(--on-accent);
              font: 500 .85rem var(--sans); padding: .5rem 1rem; border-radius: 6px; }

/* the landing flash after a quick-jump (⌘K local hit, in-pane anchor) */
@keyframes jump-flash { from { background: var(--mark); } to { background: transparent; } }
.jump-flash { animation: jump-flash 1.6s ease-out; }

/* ⌘K local hits: the "på denna sida" chip */
.search-hit .hit-here { margin-left: .5rem; font: 500 .68rem var(--sans);
                        color: var(--accent); border: 1px solid currentColor;
                        border-radius: 999px; padding: .05rem .45rem;
                        vertical-align: 1px; }

/* -- Mobile chrome (drawers.js): a fixed bottom toolbar on document pages.
   Inert on desktop; the breakpoint below turns the side columns into
   drawers the toolbar opens. -- */
.mobile-bar { display: none; }

/* -- Responsive: the reading column owns the viewport; the side columns
   become drawers (TOC: left drawer, context rail: bottom sheet) reachable
   from the bottom toolbar. The masthead wraps -- icon-only search, the
   section nav on its own horizontally scrollable line -- and scrolls away
   rather than staying stuck over a small screen. -- */
@media (max-width: 64rem) {
  .masthead { position: static; height: auto; }
  .mast-inner { flex-wrap: wrap; height: auto; gap: .5rem .9rem; padding: .6rem 1rem; }
  .mast-nav { order: 10; flex-basis: 100%; overflow-x: auto;
              white-space: nowrap; scrollbar-width: none;
              margin: 0 -1rem; padding: 0 1rem; }
  .mast-nav::-webkit-scrollbar { display: none; }

  .gr-body { display: block; }
  .gr-main { max-width: 46rem; margin: 0 auto; padding: 1.5rem 1.25rem 8rem; }
  .gr-main h1 { font-size: 1.9rem; }
  /* the mark stays beside the eyebrow + h1 stack; with only 1.25rem of
     padding to hang in, the pull is dropped so it sets flush with the text */
  .site-mark { height: 58px; margin-left: 0; }
  /* a table wider than the screen (BrB 2:3's jurisdiction table, a prop's
     unbreakable ELI URLs) scrolls inside its own box; left to overflow it
     widens the layout viewport and the whole page zooms out to fit */
  .gr-main table { display: block; overflow-x: auto; }
  /* no sticky masthead left to clear when jumping to an anchor */
  :root { --scroll-clear: .75rem; }
  /* a förarbete section number nests ("9.2.4") and would waste a wide gutter
     on a narrow column, so it sets inline before the title. h3.artikel keeps
     its desktop grid: the word-over-number gutter sits inside the column. */
  h1.rubrik.numrerad, h2.rubrik.numrerad, h3.rubrik.numrerad,
  h4.rubrik.numrerad, h5.rubrik.numrerad { display: block; }
  .rubrik.numrerad > .n { margin-right: .4rem; }
  .rubrik.numrerad > .rubrik-titel { display: block; }

  /* TOC: an off-canvas left drawer (kept in layout, so scrollspy's active
     tracking and auto-scroll keep working while it is closed) */
  .toc-col { position: fixed; z-index: 60; top: 0; bottom: 0; left: 0;
             width: min(85vw, 20rem); max-height: none;
             box-shadow: 0 0 40px var(--shadow-modal);
             transform: translateX(-105%); visibility: hidden;
             transition: transform .25s ease, visibility 0s .25s; }
  body.toc-open .toc-col { transform: none; visibility: visible;
                           transition: transform .25s ease; }

  /* context rail: a bottom sheet -- scrollspy keeps it synced to the
     reading position, so opening it shows the context for where you are.
     The sheet scrolls its own content (a panel taller than 70vh was simply
     cut off before), and overscroll-behavior keeps a swipe inside it from
     scrolling the document underneath -- while a swipe on the visible page
     above the sheet still scrolls the document, as before */
  .rail { position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; top: auto;
          max-height: 70vh; overflow-y: auto; overscroll-behavior: contain;
          -webkit-overflow-scrolling: touch;
          background: var(--surf);
          border-top: 1px solid var(--rule);
          border-radius: 12px 12px 0 0;
          box-shadow: 0 -12px 40px var(--shadow-modal);
          padding: 1.25rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
          transform: translateY(105%); visibility: hidden;
          transition: transform .25s ease, visibility 0s .25s; }
  body.rail-open .rail { transform: none; visibility: visible;
                         transition: transform .25s ease; }

  .drawer-scrim { position: fixed; inset: 0; z-index: 55;
                  background: var(--overlay); }

  .mobile-bar { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
                display: flex; justify-content: space-around; align-items: stretch;
                background: var(--surf); border-top: 1px solid var(--rule);
                padding: .25rem .5rem calc(.25rem + env(safe-area-inset-bottom)); }
  .mobile-bar button { display: flex; flex-direction: column; align-items: center;
                       gap: .2rem; flex: 1; border: 0; background: none;
                       padding: .35rem 0; cursor: pointer; color: var(--ink-2);
                       font: 500 .68rem var(--sans); }
  .mobile-bar button[aria-expanded="true"] { color: var(--accent); }
  /* a page with no TOC, or a section with no context, keeps its place in the
     bar rather than shifting the other two: the buttons stand still, and a
     grey one says there is nothing to open here */
  .mobile-bar button[disabled] { color: var(--ink-4); opacity: .55;
                                 cursor: default; }
  body.split .mobile-bar { display: none; }

  /* the sheet shows only the context for where you are, so the summary lines
     have nothing left to summarise -- the panel itself is what the sheet is for */
  .rail-entry { display: none; }
  .rail-panelbox { position: static; }
  .rail-panel { position: static; max-height: none; overflow: visible;
                padding: 0; background: none; border: 0; border-radius: 0; }
  .recital-group { margin-left: 0; }

  /* search palette: top-anchored and full width, clear of the on-screen
     keyboard the input summons */
  .search-overlay { padding: 1rem; align-items: flex-start; }
  .search-box { width: 100%; }
  .search-results:not(:empty) { max-height: 55vh; }

  .full-search-layout { grid-template-columns: 1fr; gap: .75rem; }
  .full-search-facets { display: grid; grid-template-columns: repeat(3, 1fr);
                        gap: .75rem; }

  /* browse facets go back on top, flowing horizontally, above the list */
  .browse-layout { grid-template-columns: 1fr; gap: 1rem; }
  .browse-facets { position: static; }
  .browse-facets .facet-list { flex-direction: row; flex-wrap: wrap; gap: .35rem .7rem; }
  .browse-facets .facet-list a { background: var(--surf-2); }
}
@media (max-width: 38rem) {
  .full-search-facets { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- statistik
   The /statistik page and its figures. Marks are single-series throughout --
   the corpus has one value per year, per bin, per law -- so identity is never
   carried by colour and no categorical palette is needed; `--viz-mark` is the
   page accent, stepped per mode for contrast against that mode's surface.
   The heat table is the one magnitude encoding, and it carries its own
   validated sequential ramp inline (charts.HEAT) because the step is data. */
:root {
  --viz-mark:#8f3524; --viz-grid:#dee2e9; --viz-on-heat:#ffffff;
}
:root[data-theme="dark"], :root.dark {
  --viz-mark:#cd6f56; --viz-grid:#2b323b; --viz-on-heat:#ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --viz-mark:#cd6f56; --viz-grid:#2b323b; --viz-on-heat:#ffffff;
  }
}

.stats .stat-nav ol { list-style:none; margin:0 0 2.5rem; padding:0;
  display:flex; flex-wrap:wrap; gap:.4rem .8rem; }
.stats .stat-nav a { font:600 .82rem/1.4 var(--sans); text-decoration:none;
  color:var(--ink-2); background:var(--surf-2); border-radius:999px;
  padding:.3rem .7rem; display:inline-block; }
.stats .stat-nav a:hover { background:var(--surf-3); color:var(--ink); }

.stats .stat-group { margin:0 0 3.5rem; }
.stats .stat-group > h2 { font:600 1.35rem/1.3 var(--sans); color:var(--ink);
  border-bottom:2px solid var(--rule); padding-bottom:.4rem; margin:0 0 1.5rem; }
.stats .stat { margin:0 0 2.75rem; }
.stats .stat > h3 { font:600 1.05rem/1.35 var(--sans); color:var(--ink);
  margin:0 0 .35rem; display:flex; gap:.6rem; align-items:baseline; }
.stats .stat-no { font:600 .75rem/1 var(--sans); color:var(--ink-4);
  min-width:1.6rem; }
.stats .stat-lede { font:400 .95rem/1.55 var(--serif); color:var(--ink-2);
  margin:0 0 .9rem; max-width:52rem; }
.stats .stat-note { font:400 .82rem/1.5 var(--sans); color:var(--ink-3);
  margin:.7rem 0 0; max-width:52rem; border-left:2px solid var(--rule);
  padding-left:.7rem; }
.stats .stat-foot { font:400 .85rem/1.55 var(--sans); color:var(--ink-3);
  margin-top:3rem; padding-top:1rem; border-top:1px solid var(--rule); }

/* bar table: the label wraps like prose, the bar is a width on the value cell */
.viz-bars, .viz-plain { width:100%; border-collapse:collapse;
  font:400 .88rem/1.45 var(--sans); }
.viz-bars th, .viz-bars td, .viz-plain th, .viz-plain td {
  text-align:left; padding:.35rem .5rem; vertical-align:baseline;
  border-bottom:1px solid var(--rule-soft); font-weight:400; }
.viz-bars thead th, .viz-plain thead th { font:600 .74rem/1.3 var(--sans);
  text-transform:uppercase; letter-spacing:.04em; color:var(--ink-4);
  border-bottom:1px solid var(--rule); }
.viz-bars th[scope="row"] { color:var(--ink); width:60%; }
.viz-bars .num, .viz-plain .num { text-align:right; white-space:nowrap;
  position:relative; }
.viz-bars td.num { padding-left:1rem; }
/* the bar sits behind the number, anchored to the right (the value end) */
.viz-bar { position:absolute; right:.5rem; top:.45rem; bottom:.35rem;
  width:var(--w); background:var(--viz-mark); opacity:.22;
  border-radius:3px 0 0 3px; display:block; }
.viz-val { position:relative; font-variant-numeric:tabular-nums;
  color:var(--ink); }
.viz-detail { color:var(--ink-3); font-size:.82em; }

.viz-hero { font:600 2.4rem/1.15 var(--sans); color:var(--viz-mark);
  margin:.2rem 0 .6rem; letter-spacing:-.01em; }

/* the KPI row: several headline numbers side by side, each over its unit.
   Wraps to one tile per line on a narrow screen, so a 10-digit figure never
   shrinks to fit. Proportional figures, not tabular -- nothing aligns
   vertically here, and tabular digits read loose at display size. */
.viz-tiles { display:flex; flex-wrap:wrap; gap:.4rem 2.5rem;
  margin:.2rem 0 .6rem; }
.viz-tile { display:flex; flex-direction:column-reverse; gap:.15rem; }
.viz-tile-val { font:600 2.1rem/1.1 var(--sans); color:var(--viz-mark);
  margin:0; letter-spacing:-.01em; }
.viz-tile-cap { font:600 .72rem/1.3 var(--sans); color:var(--ink-4);
  text-transform:uppercase; letter-spacing:.05em; }

.viz-scroll { overflow-x:auto; max-width:100%; }
.viz-svg { width:100%; height:auto; min-width:34rem; display:block; }
.viz-grid { stroke:var(--viz-grid); stroke-width:1; }
.viz-tick { font:400 .68rem/1 var(--sans); fill:var(--ink-3); }
.viz-axis { font:600 .66rem/1 var(--sans); fill:var(--ink-4);
  text-transform:uppercase; letter-spacing:.05em; }
.viz-line { fill:none; stroke:var(--viz-mark); stroke-width:2;
  stroke-linejoin:round; stroke-linecap:round; }
.viz-dot { fill:var(--viz-mark); stroke:var(--surf); stroke-width:2; }
.viz-peak { font:600 .7rem/1 var(--sans); fill:var(--ink-2); }
.viz-col { fill:var(--viz-mark); opacity:.85; }
.viz-col:hover { opacity:1; }
.viz-hit { fill:transparent; }
.viz-hit:hover { fill:var(--viz-mark); opacity:.07; }

/* the flow diagram: one accent for every ribbon (identity is carried by the
   named node at each end, not by hue), translucent so crossings darken, with a
   surface hairline so two ribbons that cross stay two ribbons. The node bar is
   the same accent at full strength, and the label beside it wears text ink. */
.viz-flow { fill:var(--viz-mark); fill-opacity:.2; stroke:var(--surf);
  stroke-width:.6; stroke-opacity:.55; }
.viz-flow:hover { fill-opacity:.5; }
.viz-node { fill:var(--viz-mark); opacity:.9; }
.viz-nodelabel { font:600 .72rem/1 var(--sans); fill:var(--ink-2); }
.viz-nodeval { font:400 .68rem/1 var(--sans); fill:var(--ink-4);
  font-variant-numeric:tabular-nums; }
/* the sankey is nearly square rather than wide, so it needs less width than the
   plotted forms before its labels stop being readable -- under 30rem the figure
   scrolls sideways in .viz-scroll rather than shrinking the labels away */
.viz-sankey { min-width:30rem; }

/* 14 columns against a 52rem text column, so the cell padding is the whole
   budget: at .5rem a side the table could not fit and every figure wrapped
   mid-number. The 2px border-spacing stays -- that is the surface gap that
   keeps two neighbouring cells from reading as one block. */
.viz-heat { border-collapse:separate; border-spacing:2px;
  font:400 .72rem/1.25 var(--sans); }
.viz-heat th { font:600 .66rem/1.25 var(--sans); color:var(--ink-3);
  padding:.22rem; text-align:left; white-space:nowrap; }
.viz-heat td { background:var(--c); padding:.3rem .22rem; border-radius:3px;
  text-align:right; font-variant-numeric:tabular-nums; color:#0d366b;
  white-space:nowrap; }
.viz-heat td.on-dark { color:var(--viz-on-heat); }
.viz-heat td.viz-nil { background:var(--surf-2); }

/* the chain behind a row's count, folded away until asked for. The row's
   header cell is the anchor, so the list indents under the label rather than
   pushing the value column around. */
.viz-steps { margin:.35rem 0 .1rem; font-weight:400; }
.viz-steps summary { font:600 .74rem/1.4 var(--sans); color:var(--ink-3);
  cursor:pointer; }
.viz-steps summary:hover { color:var(--ink); }
.viz-steps ol { margin:.45rem 0 .2rem; padding-left:1.6rem;
  font:400 .84rem/1.5 var(--sans); color:var(--ink-2); }
.viz-steps li { margin:.15rem 0; }
.viz-steps li .viz-detail { display:block; font-size:.92em; }

.viz-data { margin:.6rem 0 0; }
.viz-data summary { font:600 .78rem/1.4 var(--sans); color:var(--ink-3);
  cursor:pointer; }
.viz-data summary:hover { color:var(--ink); }
.viz-data table { margin-top:.5rem; }
.viz-empty { font:400 .85rem/1.5 var(--sans); color:var(--ink-3); }
.vh { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
.viz-bars tr.viz-split th { font:600 .72rem/1.3 var(--sans); color:var(--ink-4);
  text-transform:uppercase; letter-spacing:.05em; padding-top:.9rem;
  border-bottom:1px solid var(--rule); }

/* The ruled box a förarbete states its proposal or assessment in ("Regeringens
   förslag:", "Förslag:", "Bedömning:"). The rule is a vector drawing pdftohtml
   discards, so the box is recovered from the narrower measure it is set to
   (lib/pdftext.boxed) and drawn here. The printed rule is black, so the border
   follows the ink rather than the light --rule the page uses to separate its
   own furniture -- the box is part of the document, not part of the site. No
   background tint for the same reason: the source sets it on plain paper.
   Consecutive ruta paragraphs are one box: the borders between them collapse. */
p.ruta { border: 1px solid var(--ink-2); border-bottom: 0;
         margin: 0; padding: .7rem 1rem .2rem; }
p.ruta + p.ruta { border-top: 0; padding-top: 0; }
p.ruta:last-of-type, p.ruta:not(:has(+ p.ruta)) {
         border-bottom: 1px solid var(--ink-2); padding-bottom: .7rem;
         margin-bottom: 1.1rem; }
p.ruta:first-of-type, p:not(.ruta) + p.ruta { margin-top: 1.1rem; }

/* An illustration the source PDF carries, rendered on demand as a crop of its
   page (lib/facsimile.cached with a bbox) rather than copied into the corpus. */
figure.bild { margin: 1.4rem 0; text-align: center; }
figure.bild img { max-width: 100%; height: auto; border: 1px solid var(--rule-soft);
                  border-radius: 3px; }
/* the manual's screenshots and screencasts (site/media/, site/render.py):
   the same frame as an illustration, a caption under it, the film full width */
figure.film { margin: 1.4rem 0; }
figure.film video { display: block; width: 100%; height: auto;
                    border: 1px solid var(--rule-soft); border-radius: 3px;
                    background: var(--surf); }
.site figure.bild { text-align: left; }
.site figure figcaption { font-family: var(--serif); font-style: italic;
                          font-size: .85rem; color: var(--ink-3);
                          margin-top: .4rem; }

/* A begrepp page with no written description: the term's occurrences ARE the
   page, so they render in the reading column instead of the context rail (see
   wiki/render.py). The rail's own list markup is reused inside each group, at
   reading size rather than margin size, with every group open -- a reader who
   opens a concept came for this list, so nothing is folded away.

   The page keeps the ordinary three-column document grid even though it has no
   TOC and no rail: every page's main content then sits at the same width, which
   reads better across the site than widening this one to fill the space. */
.stub-lede { color: var(--ink-3); font-style: italic; margin: 0 0 1.4rem; }
section.occurrences { margin: 0 0 1.6rem; }
section.occurrences > h2 { font-family: var(--serif); font-size: 1rem;
         font-weight: 500; margin: 0 0 .4rem; padding-bottom: .25rem;
         border-bottom: 1px solid var(--rule-soft); }
section.occurrences > h2 .c { color: var(--ink-4); font-size: .8rem;
         font-weight: 400; margin-left: .35rem; }
section.occurrences ul { list-style: none; margin: 0; padding: 0; }
section.occurrences li { margin: .3rem 0; line-height: 1.45; }
section.occurrences details.more > summary { color: var(--ink-3);
         font-size: .85rem; cursor: pointer; margin-top: .4rem; }
/* Legaldefinitioner: the citation is the label, the act's own sentence the
   reading matter under it. A term defined in a hundred acts makes a hundred
   entries, so the sentence sets at reading width and the citation stays small
   above it -- a two-column dl would put a 300-character definition in a
   half-width gutter. */
section.definitions dl { margin: 0; }
section.definitions dt { margin: .8rem 0 .1rem; font-size: .85rem;
         color: var(--ink-3); }
section.definitions dt:first-child { margin-top: .4rem; }
section.definitions dd { margin: 0; line-height: 1.55; }

/* ------------------------------------------------------------------- print
   One print design, two consumers: the browser's own Skriv ut, and the PDF
   export (api/pdf.py), which renders the same page through WeasyPrint. Both
   read this block; WeasyPrint additionally honours the paged-media features
   browsers skip (string-set running headers, target-counter() page numbers,
   leader() dots, bookmark-*), all of which degrade silently on the ones
   that don't. `.print-toc` / `.print-kontext` markup exists only in the
   PDF export -- api/pdf.py injects it -- so those rules are inert on the
   live page and under Ctrl+P.

   The design: the reading column alone, as a book page. All chrome and
   every interactive widget disappears; the text moves to the serif,
   justified with Swedish hyphenation; ink is black on true white in both
   themes; A4 with the document's identifier as a running header and
   "n (total)" folios from page two. */
@media print {
  /* paper tokens -- restated for the explicit dark theme too, so a
     dark-mode reader still prints a light page. The prefers-color-scheme
     fallback earlier in the file loses to these by order. */
  :root, :root[data-theme="dark"], :root:not([data-theme]) {
    --bg:#fff; --surf:#fff; --surf-2:#fff; --surf-3:#fff;
    --ink:#000; --ink-2:#1c1c1c; --ink-3:#3d3d3d; --ink-4:#6a6a6a;
    --rule:#8a8a8a; --rule-soft:#c2c2c2;
    --accent:#7c2d1c; --case:#6d431f; --forarbete:#443b68; --kommentar:#762b48;
    --fk-bg:#fff; --fk-border:#9a9a9a;
    --diff-ins-bg:#e8e8e8; --diff-del-bg:#f2f2f2;
    --mark:#e8e0b0; --danger:#7c2d1c; --on-accent:#fff;
    --senti-neg:#5d2417; --senti-pos:#254f35;
    --viz-mark:#7c2d1c; --viz-grid:#c2c2c2; --viz-on-heat:#fff;
    color-scheme: light;
  }

  /* Mirrored book pages: 117 mm of text and a 55 mm outer column. The wider
     context column takes its five extra millimetres from the inner margin.
     Right pages put text at x=28 mm and notes at x=145 mm. Left pages mirror
     them: notes at x=10 mm and text at x=65 mm.

     WeasyPrint recalculates percentage margins against each page fragment.
     The right page content box is 172 mm wide; the left one is 117 mm.
     `.kontextnot` turns that changing width into the two required offsets:

       right: 3.12727273 * 172 - 420.89091 = 117 mm; 28 + 117 = 145 mm
       left:  3.12727273 * 117 - 420.89091 = -55 mm; 65 - 55 = 10 mm

     Every ordinary child keeps the 117 mm measure. Only the article/aside
     grid reads the full page content width as its side signal. */
  :root { --matt: 117mm; --marg: 55mm; }

  @page {
    size: A4;
    margin-top: 22mm;
    margin-bottom: 24mm;
    /* The page-specific boxes below keep the running head inside the same
       172 mm band as the reading column and its context column. */
    @top-center { content: string(doc-title, start);
                  font: italic 9pt "Source Serif 4", Georgia, serif;
                  color: #3d3d3d; }
    @bottom-left { content: none; }
    @bottom-center { content: none; }
    @bottom-right { content: none; }
  }
  @page :right {
    margin-left: 28mm;
    margin-right: 10mm;
    @top-left { content: string(doc-id, start); text-align: left;
                font: italic 8.5pt "Source Serif 4", Georgia, serif;
                color: #6a6a6a; }
    @top-right { content: string(here, start) string(here-inner, start);
                 width: 55mm; text-align: right;
                 white-space: nowrap;
                 font: italic 8.5pt "Source Serif 4", Georgia, serif;
                 color: #3d3d3d; }
    @bottom-right { content: counter(page); width: 55mm; text-align: right;
                    font: italic 8.5pt "Source Serif 4", Georgia, serif;
                    font-variant-numeric: tabular-nums; color: #3d3d3d; }
  }
  @page :left {
    margin-left: 65mm;
    margin-right: 28mm;
    @top-left-corner { content: string(here, start) string(here-inner, start);
                       text-align: left; padding-left: 10mm;
                       white-space: nowrap;
                       font: italic 8.5pt "Source Serif 4", Georgia, serif;
                       color: #3d3d3d; }
    @top-right { content: string(doc-id, start); text-align: right;
                 font: italic 8.5pt "Source Serif 4", Georgia, serif;
                 color: #6a6a6a; }
    @bottom-left-corner { content: counter(page); text-align: left;
                          padding-left: 10mm;
                          font: italic 8.5pt "Source Serif 4", Georgia, serif;
                          font-variant-numeric: tabular-nums; color: #3d3d3d; }
  }
  /* The space-saving mode uses the complete page band. Its two 89 mm
     columns have an 8 mm gutter and 12 mm page margins. */
  @page compact {
    size: A4;
    margin: 18mm 12mm;
    @top-center { content: string(doc-title, start);
                  font: italic 8pt "Source Serif 4", Georgia, serif;
                  color: #3d3d3d; }
  }
  @page compact:right {
    @top-left { content: string(doc-id, start); text-align: left;
                font: italic 8pt "Source Serif 4", Georgia, serif;
                color: #6a6a6a; }
    @top-right { content: string(here, start) string(here-inner, start);
                 width: 62mm; text-align: right; white-space: nowrap;
                 font: italic 8pt "Source Serif 4", Georgia, serif;
                 color: #3d3d3d; }
    @bottom-right { content: counter(page); text-align: right;
                    font: italic 8pt "Source Serif 4", Georgia, serif;
                    font-variant-numeric: tabular-nums; color: #3d3d3d; }
  }
  @page compact:left {
    @top-left-corner { content: none; }
    @top-left { content: string(here, start) string(here-inner, start);
                width: 62mm; text-align: left; white-space: nowrap;
                font: italic 8pt "Source Serif 4", Georgia, serif;
                color: #3d3d3d; }
    @top-right { content: string(doc-id, start); text-align: right;
                 font: italic 8pt "Source Serif 4", Georgia, serif;
                 color: #6a6a6a; }
    @bottom-left { content: counter(page); text-align: left;
                   font: italic 8pt "Source Serif 4", Georgia, serif;
                   font-variant-numeric: tabular-nums; color: #3d3d3d; }
    @bottom-left-corner { content: none; }
  }
  @page compact:first {
    @top-center { content: none; }
    @top-left { content: none; }
    @top-right { content: none; }
  }
  /* the first page carries the document's own title block; no running head */
  @page :first {
    @top-center { content: none; }
    @top-left-corner { content: none; }
    @top-left { content: none; }
    @top-right { content: none; }
    @top-right-corner { content: none; }
  }
  .frontmatter .eyebrow { string-set: doc-id content(text); }
  .frontmatter h1 { string-set: doc-title content(text); }
  /* "Where you are": the chapter, and within it the § or article. Each
     writes its own half, and the head prints whichever half the page has.
     `start` -- the value in force as the page opens, not `first`, which is
     the first value *assigned on* it -- so a page that starts mid-§ still
     names that §. The separator rides in the chapter's own string, so
     a statute with no chapter division prints "3 §" and not " · 3 §".
     An EU article splits the citable "Artikel 5" across two elements of its
     gutter -- the word in `.k`, the number in `.n` -- and eurlex headings carry
     no `data-kort`, so the word has to take the `here` slot the statutes fill
     from that attribute. Setting only `.n` printed a running head reading "5",
     which names nothing. A numbered förarbete section has no word, so its
     number goes in the same slot as a § numeral. */
  .kaprubrik, h2.rubrik, .instans-rubrik { string-set: here attr(data-kort); }
  h3.artikel > .k { string-set: here content(text) " "; }
  .paragraf-gutter .n, h3.artikel > .n, .rubrik.numrerad > .n {
    string-set: here-inner content(text); }

  /* chrome and widgets: nothing a finger can operate belongs on paper */
  .masthead, .mobile-bar, .toc-col, .rail, .drawer-scrim, .search-overlay,
  .theme-toggle, .paragraf-gutter a.pilcrow, h3.artikel > a.pilcrow,
  .rubrik.numrerad > a.pilcrow, .fn-back, details.lydelser,
  .ed-tools, .ed-panel, .ed-overlay, .ed-btn-top, .admin-panel,
  .pdf-open, .collection-add, .collection-toolbar,
  .grafik-lightbox { display: none; }
  /* the crop's button wrapper is not chrome -- it *is* the graphic, so it
     prints; only its interactive affordances go */
  .grafik-open { cursor: auto; outline: 0; }
  /* an open fold prints its content as plain text, without the summary
     widget. A closed fold keeps only its "+N till" line -- an honest note
     that paper is missing something the page has. The PDF export opens
     every fold (api/pdf.py), so there the content always prints. */
  details[open].more > summary,
  details[open].forarbeten-mer > summary { display: none; }
  /* the printed-page marker stays -- citations point at printed pages --
     but as a plain caption, and its facsimile-opener button goes */
  .sid button[data-fax] { display: none; }
  .sid-nr, .sid button { border: 0; padding: 0; background: none;
                         color: var(--ink-4); }

  /* the reading column, full measure */
  .gr-body { display: block; max-width: none; }
  .gr-body.solo { max-width: none; }
  .gr-main { max-width: none; padding: 0; }
  .gr-main > * { width: var(--matt); }
  /* SFS keeps divisions and chapters as semantic containers. They must pass
     the page fragment's full width to an annotated provision, while their
     ordinary headings and provisions retain the reading measure. */
  .gr-main > .kontextrot, .kontextrot > .kontextrot,
  .kontextrot > .kontextblock { width: 100%; }
  .kontextrot > * { width: var(--matt); }
  body.parallel-appendix .gr-main { max-width: none; }

  /* book typography: serif, justified, hyphenated. 1rem = 10.5pt scales
     every rem-sized component in the sheet to paper proportions at once. */
  html { font-size: 10.5pt; }
  body { font-family: var(--serif); font-size: 1rem; line-height: 1.55;
         letter-spacing: 0; background: #fff; transition: none; }
  /* the ASCII hyphen: the self-hosted woff2 subsets carry no U+2010, which
     otherwise renders as .notdef boxes at every break WeasyPrint hyphenates */
  .gr-main p { text-align: justify; hyphens: auto; hyphenate-character: "-"; }
  /* prose set small on screen reads fine at paper's higher resolution --
     lift the floors a touch */
  .paragraf-body { line-height: 1.55; }

  /* the title block */
  .gr-main h1 { font-size: 2.1rem; line-height: 1.1; }
  .frontmatter { border-bottom-color: var(--ink); margin-bottom: 1.6rem; }
  dl.meta { row-gap: .15rem; }

  /* The title stays full width. All following document sections share one
     paged two-column flow. At 8.25 pt, an 89 mm column holds about 66 prose
     characters without changing the document's typefaces. */
  html.pdf-two-columns { font-size: 8.25pt; }
  body.pdf-two-columns { page: compact; }
  body.pdf-two-columns .gr-main > .frontmatter,
  body.pdf-two-columns .gr-main > .print-columns { width: 100%; }
  body.pdf-two-columns .print-columns {
    column-count: 2; column-gap: 8mm; column-fill: auto;
  }
  body.pdf-two-columns .print-columns > * { width: auto; }
  /* Compact SFS replaces the screen grid with a fragmenting block. A small
     opening grid keeps the section number with its first paragraph. Table rows
     remain indivisible through the general `tr` rule below, so a table breaks
     only between rows. */
  body.pdf-two-columns .print-document section.paragraf {
    display: block; min-height: 5rem; break-inside: auto;
  }
  body.pdf-two-columns .print-document .paragraf-body { margin-left: 4.3rem; }
  body.pdf-two-columns .print-document .paragraf-start {
    display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); gap: .8rem;
    width: calc(100% + 4.3rem); margin-left: -4.3rem;
    align-items: baseline; break-inside: avoid;
  }
  body.pdf-two-columns .print-document table { break-inside: auto; }

  /* breaks: no orphaned headings, register entries whole */
  /* `.artikel` is not in this list: both article headings are already here as
     `h2`/`h3`, and the class also names the `section.artikel` *container* --
     a whole treaty article, 25 400 characters at coe/026#A11, which
     `break-inside: avoid` would demand fit on one printed page */
  h1, h2, h3, h4, h5, h6, .kaprubrik, .rubrik,
  .instans-rubrik, .delmal-rubrik { break-after: avoid; break-inside: avoid; }
  .andring, figure, blockquote, .expired-banner,
  .note-banner, .version-banner, p.ruta { break-inside: avoid; }
  /* SFS provisions range from one line to several pages. Keep other document
     units whole, but let a statute provision continue on the next page. */
  .print-document section.paragraf { break-inside: auto; }
  tr { break-inside: avoid; }
  thead { display: table-header-group; }
  p { orphans: 3; widows: 3; }
  /* the amendment register is an appendix: start it on its own page */
  section.andringar { break-before: page; margin-top: 0; }
  .andring { border-color: var(--rule-soft); background: none; }
  /* The PDF register is a compact legal appendix. Its screen-only source,
     consolidation and diff links have already been removed by pdf.py. */
  body.pdf-weasy section.print-andringar > h2 { margin-bottom: 1.4rem; }
  body.pdf-weasy section.print-andringar .andring {
    break-inside: auto; margin: 1.5rem 0; padding: 0; border: 0;
    border-radius: 0; background: none;
  }
  body.pdf-weasy section.print-andringar .andring h2 {
    font-size: 1rem; margin: 0 0 .45rem;
  }
  body.pdf-weasy section.print-andringar .andring h3 {
    font-size: .95rem; margin: .8rem 0 .2rem;
  }
  body.pdf-weasy section.print-andringar .andring dl.meta {
    margin-top: .55rem; font-size: .82rem;
  }
  body.pdf-weasy section.print-andringar a { color: inherit; }

  /* links: ink, not paint -- the citation text is the reference on paper.
     The § numerals and inline number markers keep the accent. The extra
     selectors outgun the screen's category-coloured link rules
     (section.forarbeten a, .rail-sec.forarbete a, ...). */
  .gr-main a, section.forarbeten a, .print-kontext .rail-sec a,
  .print-kontext .rail-sec .prov a { color: inherit; text-decoration: none; }
  a.ext::after { content: none; }
  a.term { border-bottom: 0; }
  .paragraf-gutter .n, .num, h3.artikel > .n, .rubrik.numrerad > .n,
  .rubrik-nr { color: var(--accent); }

  /* The § gutter stays inside the measure. Hanging it in the left margin
     reads better, and did until the apparatus moved out there: on a verso
     page the left margin *is* the outer one, and the numeral landed on top
     of the notes. 3.5rem holds "3 b §" without wrapping. */
  section.paragraf { grid-template-columns: 3.5rem minmax(0, 1fr);
                     gap: .8rem; }
  /* One visual § can contain several synchronized context rows. Preserve its
     original top and bottom space, but do not insert a § margin between its
     stycken or numbered points. Their own paragraph/list margins remain. */
  section.paragraf.paragraf-del { margin-bottom: 0; }
  section.paragraf.paragraf-del + section.paragraf.paragraf-del {
    margin-top: 0;
  }
  section.paragraf.paragraf-del-sist { margin-bottom: 1.75rem; }

  /* A direct EU point has a left margin and an explicit page measure. Reduce
     its width by the same amount so its right edge stays on the text edge. */
  .gr-main > p.point { width: calc(var(--matt) - 2.2rem); }
  .gr-main > p.point.sub2 { width: calc(var(--matt) - 4rem); }
  .gr-main > p.point.sub3 { width: calc(var(--matt) - 5.8rem); }
  .gr-main > p.point.sub4 { width: calc(var(--matt) - 7.6rem); }

  img, .grafik-img, table, figure { max-width: 100%; }
  /* Tables and figures used to be allowed past the measure, on the grounds
     that a rate table squeezed into 67 characters wraps every cell. The
     margin they grew into now holds the apparatus: measured on an
     eight-column table, the cells drew out to 534 pt while the note beside
     them started at 451 pt, so the table printed over its own context. They
     keep the reading column. */

  /* --- PDF export only (api/pdf.py injects the markup) --- */
  /* the outline panel of the exported PDF: WeasyPrint's UA sheet bookmarks
     h1-h6; keep the injected apparatus out of it */
  .print-toc h2, .print-kontext h4 { bookmark-level: none; }

  /* Innehåll with leader dots and resolved page numbers */
  .print-toc { margin: 1.8rem 0 0; break-after: page; }
  .print-toc h2 { font-family: var(--serif); font-weight: 600; font-size: 1.15rem;
                  margin: 0 0 .7rem; }
  .print-toc ol { list-style: none; margin: 0; padding: 0; }
  .print-toc li { margin: .18rem 0; }
  .print-toc li.lvl2 { padding-left: 1.4rem; }
  .print-toc li.lvl3 { padding-left: 2.8rem; font-size: .88rem; }
  .print-toc a { color: inherit; text-decoration: none; }
  .print-toc a::after { content: leader(dotted) " " target-counter(attr(href), page);
                        font-variant-numeric: tabular-nums; }

  /* Provision and note overlap in one grid cell, then their fixed widths and
     the note's calculated margin put them beside each other. The row height
     follows the longer flow. A later provision therefore waits for both.
     When either flow crosses a page, WeasyPrint resolves the note margin
     against the new fragment and moves it to that page's outer side. */
  .kontextblock { display: grid; grid-template-columns: 1fr;
                  grid-template-rows: auto; justify-items: start;
                  width: 100%; }
  .kontextsp, .kontextnot { grid-column: 1; grid-row: 1;
                            justify-self: start; align-self: start;
                            min-width: 0; }
  .kontextsp { width: var(--matt); }
  .kontextnot { width: var(--marg);
                margin-left: calc(312.727273% - 420.89091mm);
                padding-left: 6mm; }
  /* Both flows must use the same break opportunities. A note is a list and
     starts anywhere, while the provision is normally a three-line paragraph
     or an unbroken §. */
  .kontextsp p, .kontextsp li { orphans: 1; widows: 1; }
  .kontextsp section.paragraf, .kontextsp .andring, .kontextsp figure,
  .kontextsp blockquote, .kontextsp p.ruta { break-inside: auto; }
  /* an annotated heading keeps its text */
  .kontextblock.rubrikblock { break-after: avoid; }
  .kontextblock.rubrikblock > .kontextnot { margin-top: 2.25rem; }
  .kontextblock.artikelblock > .kontextnot { margin-top: 2rem; }
  .kontextblock.kaprubrikblock > .kontextnot { margin-top: 3rem; }
  .kontextblock.paragrafblock > .kontextnot { margin-top: 1.75rem; }
  .kontextblock.paragrafblock { break-inside: avoid; }
  .kontextblock.fortsattblock > .kontextnot { margin-top: 0; }
  .kontextsp > section.paragraf.paragraf-fortsatt { margin-top: 0; }
  /* WeasyPrint's grid paginator becomes superlinear across hundreds of SFS
     provisions. The API marks its private paper DOM with `.pdf-weasy` and
     uses a fixed table row instead. Table rows fragment both cells together
     and calculate the next row from the taller cell. Both cells first use
     recto order. api/pdf.py then moves the note-cell boxes left on verso
     pages, by the row's own laid-out width, so the two widths below stay
     the only place either number is written. The generic grid above remains
     the standalone CSS implementation and the fallback for other print
     engines. */
  body.pdf-weasy .kontextblock { display: table; table-layout: fixed;
                                 border-spacing: 0; break-inside: auto; }
  body.pdf-weasy .kontextsp, body.pdf-weasy .kontextnot {
    display: table-cell; vertical-align: top;
  }
  body.pdf-weasy .kontextsp { width: var(--matt); }
  body.pdf-weasy .kontextnot { width: var(--marg); margin-left: 0; }
  body.pdf-weasy .kontextblock.rubrikblock > .kontextnot {
    margin-top: 0; padding-top: 2.25rem;
  }
  body.pdf-weasy .kontextblock.artikelblock > .kontextnot {
    padding-top: 2rem;
  }
  body.pdf-weasy .kontextblock.kaprubrikblock > .kontextnot {
    padding-top: 3rem;
  }
  body.pdf-weasy .kontextblock.paragrafblock > .kontextnot {
    margin-top: 0; padding-top: 1.75rem;
  }
  body.pdf-weasy .kontextblock.fortsattblock > .kontextnot {
    padding-top: 0;
  }
  .print-kontext { border-left: 1px solid var(--rule-soft);
                   border-right: 0 solid var(--rule-soft); padding-left: 3mm;
                   font-family: var(--sans); font-size: .6rem;
                   line-height: 1.4; color: var(--ink-2);
                   margin-bottom: 1.1rem; }
  /* The screen rail gives commentary and official commentary larger serif
     prose. Paper context has one compact sans-serif size throughout. Source
     labels may use bold and quotations may use italic, but neither changes
     family, size, or leading. `!important` isolates this paper component from
     the more specific screen selectors it reuses. */
  .print-kontext * {
    font-family: var(--sans) !important;
    font-size: inherit !important;
    line-height: inherit !important;
  }
  /* Each source label and each reference gets a line. This keeps distinct
     cases and preparatory works legible without adding list bullets. */
  .print-kontext .rail-sec { border-top: 0; padding: 0; margin-bottom: .35rem; }
  .print-kontext h4 { display: block; font-size: .6rem; font-weight: 600;
                      margin: 0 0 .08rem; }
  .print-kontext h4::after { content: none; }
  .print-kontext .rail-sec ul { display: block; margin: 0; padding: 0; }
  .print-kontext .rail-sec li { display: block; }
  .print-kontext .rail-sec li::after { content: none; }
  .print-kontext .more { display: block; margin: 0; color: var(--ink-4); }
  .print-kontext .more::before { content: none; }
  .print-kontext .rail-h { font-weight: 600; font-size: .58rem;
                           text-transform: uppercase; letter-spacing: .06em;
                           color: var(--ink-3); margin: 0 0 .3rem;
                           padding-bottom: 0; border-bottom: 0; }
  /* No rules between the sections: the bold label already separates them,
     and on screen the line does work it cannot do here -- it marks a row
     you can fold. Every one of them costs a millimetre of a column that is
     the tallest thing on the page. */
  .print-kontext .rail-sec-flat { padding: 0; }
  .print-kontext h4 .n { color: var(--ink-4); font-weight: 400; margin-left: .3rem; }
  .print-kontext ul { list-style: none; margin: 0; padding: 0; }
  .print-kontext li { margin: 0 0 .1rem; break-inside: avoid; }
  .print-kontext p { margin: 0 0 .15rem; text-align: inherit; }
  .print-kontext .prov { color: var(--ink-4); }
  .print-kontext .q { font-style: italic; }

  /* A collection uses the same paper fragments as one document, inside a
     page-fragmenting wrapper. The wrapper passes the complete page band to
     context rows; ordinary children keep the normal reading measure. */
  body.pdf-collection .collection-main > .collection-document { width: 100%; }
  body.pdf-collection .collection-document > * { width: var(--matt); }
  body.pdf-collection .collection-document > .kontextrot,
  body.pdf-collection .collection-document > .kontextblock { width: 100%; }
  body.pdf-collection .collection-document.start-page { break-before: page; }
  body.pdf-collection .collection-document.start-recto,
  body.pdf-collection .collection-first-document { break-before: right; }
  /* WeasyPrint's `string(..., start)` correctly keeps the first document's
     title when another document begins midway down a page. At a forced page
     break it otherwise keeps the old title for one page. This zero-size box
     updates the two strings after the old page header is fixed and before
     WeasyPrint starts the new page. */
  body.pdf-collection .collection-running-next {
    position: absolute; height: 0; margin: 0; padding: 0;
    font-size: 0; line-height: 0;
    string-set: doc-title attr(data-doc-title), doc-id attr(data-doc-id),
                here "", here-inner "";
  }
  body.pdf-collection .collection-document.start-direct:not(.collection-first-document) {
    margin-top: 2.6rem;
  }
  body.pdf-collection .collection-document > .frontmatter {
    break-after: avoid; margin-top: 0; string-set: here "", here-inner "";
  }
  body.pdf-collection .collection-document .frontmatter h1 { bookmark-level: 1; }

  /* The optional cover is a recto followed by an intentionally blank verso.
     Both omit running furniture. The visible footer belongs to the cover's
     content so it never appears on the blank reverse. */
  @page collection-cover {
    size: A4; margin: 24mm 28mm;
    @top-left { content: none; } @top-center { content: none; }
    @top-right { content: none; } @bottom-left { content: none; }
    @bottom-center { content: none; } @bottom-right { content: none; }
    @bottom-left-corner { content: none; } @bottom-right-corner { content: none; }
  }
  @page collection-blank {
    size: A4; margin: 0;
    @top-left { content: none; } @top-center { content: none; }
    @top-right { content: none; } @bottom-left { content: none; }
    @bottom-center { content: none; } @bottom-right { content: none; }
    @bottom-left-corner { content: none; } @bottom-right-corner { content: none; }
  }
  @page :blank {
    @top-left { content: none; } @top-center { content: none; }
    @top-right { content: none; } @bottom-left { content: none; }
    @bottom-center { content: none; } @bottom-right { content: none; }
    @bottom-left-corner { content: none; } @bottom-right-corner { content: none; }
  }
  body.pdf-collection .collection-cover { page: collection-cover; width: 100%;
    box-sizing: border-box; height: 249mm; margin: 0; display: flex;
    flex-direction: column; justify-content: center; position: relative;
    break-after: page; text-align: center; }
  body.pdf-collection .collection-cover h1 { bookmark-level: none;
    font-size: 30pt; line-height: 1.12; margin: 0; }
  body.pdf-collection .collection-subtitle { font: italic 15pt/1.35 var(--serif);
    text-align: center; margin: 1rem auto 0; max-width: 125mm; }
  body.pdf-collection .collection-generated { position: absolute; bottom: 0;
    width: 100%; text-align: center; font: italic 9pt var(--serif); color: var(--ink-3); }
  body.pdf-collection .collection-cover-verso { page: collection-blank;
    width: 100%; min-height: 1px; break-after: page; }

  /* The collection TOC is deliberately shallow. Internal headings stay in
     the PDF sidebar but do not consume paper here. It ends on a verso when
     needed, so the first document always starts on a recto. */
  body.pdf-collection .collection-toc { width: 100%; margin: 0;
    padding-top: 8mm; break-after: right; bookmark-level: none; }
  body.pdf-collection .collection-toc h2 { font-size: 1.5rem; }
  body.pdf-collection .collection-toc li { margin: .3rem 0; }
  body.pdf-collection .collection-toc-id { display: inline-block; width: 36mm;
    margin-right: 3mm; font-style: italic; color: var(--ink-3); }
  body.pdf-collection .collection-toc-title { color: var(--ink); }

  body.pdf-collection.pdf-two-columns .collection-document > .frontmatter,
  body.pdf-collection.pdf-two-columns .collection-document > .print-columns {
    width: 100%;
  }
}
/* The inline editor's chrome (appended to style.css at generate): the
   masthead account control, edit buttons, dialogs -- inert without a
   logged-in session. */
/* inline editor (editor.js) */
/* the logged-in editor's masthead control: the same circle as the theme
   toggle and the collection icon (style.css skins all three, and holds the
   .mast-badge on its corner), carrying the editor's initials */
.ed-initials { font: 600 .72rem/1 var(--sans); letter-spacing: .02em;
               user-select: none; }
.ed-btn { border: 1px solid var(--rule); background: var(--surf); color: var(--accent);
          border-radius: 5px; cursor: pointer; font-size: .8rem; line-height: 1;
          padding: .15rem .35rem; }
.ed-btn:hover { background: var(--surf-2); }
.ed-btn-patch { margin-left: .5rem; }
[id] > .ed-btn { position: absolute; right: -3.4rem; top: .05rem; }
.paragraf > .ed-btn { right: -3.4rem; top: .05rem; }
.ed-btn-top { position: static; display: inline-flex; gap: .3rem; margin: 0 0 1rem; }
.ed-overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 80;
              display: flex; align-items: flex-start; justify-content: center;
              padding: 4vh 1rem; overflow: auto; }
.ed-panel { background: var(--surf); color: var(--ink); width: min(760px, 96vw);
            border: 1px solid var(--rule); border-radius: 10px; padding: 1rem 1.2rem;
            box-shadow: 0 16px 48px var(--shadow-modal); }
.ed-panel h3 { margin: 0 0 .6rem; font-size: 1.05rem; }
.ed-panel h4 { margin: .9rem 0 .4rem; font-size: .9rem; color: var(--ink-2); }
.ed-panel textarea { width: 100%; box-sizing: border-box; min-height: 200px;
                     font-family: var(--mono, ui-monospace, monospace); font-size: .9rem;
                     border: 1px solid var(--rule); border-radius: 6px; padding: .5rem; }
.ed-panel input { box-sizing: border-box; width: 100%; margin: .25rem 0;
                  border: 1px solid var(--rule); border-radius: 6px; padding: .4rem .5rem; }
.ed-tools { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0; }
.ed-tools button, .ed-row button, .ed-rm { border: 1px solid var(--rule);
    background: var(--surf-2); color: var(--ink); border-radius: 5px; cursor: pointer;
    padding: .3rem .6rem; font: inherit; font-size: .85rem; }
.ed-save, .ed-commit, .ed-do { background: var(--accent) !important; color: var(--on-accent) !important;
                               border-color: var(--accent) !important; }
.ed-preview { border: 1px dashed var(--rule); border-radius: 6px; padding: .5rem .75rem;
              margin-top: .5rem; background: var(--bg); }
.ed-preview h4 { margin: .3rem 0; }
.ed-row { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .7rem; }
.ed-row .ed-logout { margin-right: auto; }
.ed-err { color: var(--danger); font-size: .85rem; margin-top: .4rem; }
/* the /admin/ login page: the sign-in form editor.js mounts, standalone rather
   than in a modal overlay */
.admin-panel { width: min(22rem, 96vw); margin: 1.5rem 0; }
.admin-panel input { box-sizing: border-box; width: 100%; margin: .3rem 0;
                     border: 1px solid var(--rule); border-radius: 6px;
                     padding: .45rem .55rem; font: inherit; }
.admin-panel .ed-do { margin-top: .5rem; padding: .4rem .85rem; cursor: pointer;
                      border-radius: 5px; border: 1px solid var(--accent); }
.ed-search-res { list-style: none; margin: .3rem 0 0; padding: 0;
                 border: 1px solid var(--rule); border-radius: 6px; max-height: 220px;
                 overflow: auto; }
.ed-search-res li { padding: .3rem .5rem; cursor: pointer; }
.ed-search-res li:hover { background: var(--surf-2); }
.ed-cart-list { list-style: none; margin: 0 0 .6rem; padding: 0; }
.ed-cart-list li { display: flex; justify-content: space-between; gap: .5rem;
                   align-items: center; padding: .3rem 0; border-bottom: 1px solid var(--rule); }
@media (max-width: 64rem) {
  [id] > .ed-btn, .paragraf > .ed-btn { position: static; margin-left: .4rem; }
}
