/* ---------------------------------------------------------------
   Statute pages (/da/guides/lovgrundlag-...) - verbatim law text with
   Sattr's highlighting, § references that open the full paragraph,
   and expandable sources. Loaded on those pages only, after site.css.
   The § references are native popovers (popover / popovertarget):
   no JavaScript, so nothing here needs a CSP change.
   --------------------------------------------------------------- */
.statute-page {
  --highlight: #fde68a;            /* "relevant for a paying brand or agency" */
  --highlight-text: var(--primary);
}

/* How-to-read box */
.statute-page .legend {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; margin: 8px 0 8px; display: grid; gap: 8px;
  font-size: 14.5px; line-height: 1.6; color: var(--muted-foreground);
}
.statute-page .legend p { margin: 0; }
.statute-page .legend strong { color: var(--primary); }
.statute-page .hl-swatch {
  background: var(--highlight); color: var(--highlight-text);
  padding: 0 5px; border-radius: 3px; font-weight: 600;
}
.statute-page .dref { color: var(--primary); font-weight: 600; border-bottom: 1.5px dotted var(--primary); }

/* One statute */
.statute-page .statute { margin: 48px 0 0; }
.statute-page .statute-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px;
  border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 16px;
}
.statute-page .statute-head h2 { margin: 0; }
.statute-page .cite { font-size: 13px; color: var(--muted-foreground); }
.statute-page .cite a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.statute-page .num { font-weight: 600; color: var(--primary); }
.statute-page ol.points { margin: 4px 0 16px; padding-left: 26px; max-width: 68ch; }
.statute-page ol.points li { margin: 0 0 8px; line-height: 1.7; }
.statute-page .rnote { font-size: 13.5px; color: var(--muted-foreground); }

.statute-page mark {
  background: var(--highlight); color: var(--highlight-text);
  padding: 1px 2px; border-radius: 2px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* § reference - a button that opens the paragraph verbatim */
.statute-page .ref {
  font: inherit; line-height: inherit; background: none; border: 0; padding: 0 1px; margin: 0;
  cursor: pointer; color: var(--primary); font-weight: 600;
  border-bottom: 1.5px dotted var(--primary);
}
.statute-page .ref:hover { border-bottom-style: solid; }
.statute-page .ref:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }
.statute-page .ref-sm { font-size: 13px; }

/* The popover itself - centred by the browser, light-dismissed on outside click or Esc */
.refpop {
  width: min(36rem, calc(100vw - 32px)); max-height: min(72vh, 40rem); overflow: auto;
  margin: auto; padding: 18px 20px 20px;
  background: var(--card); color: var(--foreground);
  border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: 0 16px 48px rgba(10, 21, 38, 0.24);
  font-family: var(--font); font-size: 15px; line-height: 1.6;
}
.refpop::backdrop { background: rgba(10, 21, 38, 0.32); }
.refpop .vb-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.refpop .vb-label {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted-foreground); margin: 0;
}
.refpop .vb-close {
  flex: none; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  background: var(--secondary); color: var(--primary); border: 0;
  border-radius: var(--radius-btn); padding: 4px 10px;
}
.refpop p { margin: 0 0 8px; max-width: none; }
.refpop p:last-child { margin: 0; }

/* End of the law text. While more text sits below the fold, the sticky
   .vb-more hint stays pinned to the bottom of the popover; .vb-end is pulled
   up over the hint's resting place, so once the end is reached (or when
   nothing scrolls) the end mark covers it. No JavaScript involved. */
.refpop .vb-more {
  position: sticky; bottom: -20px; height: 72px; margin: 8px -20px 0; padding: 0 20px 14px;
  display: flex; align-items: flex-end; justify-content: center;
  background: linear-gradient(rgba(255, 255, 255, 0), var(--card) 60%);
}
.refpop .vb-more span {
  background: var(--primary); color: var(--chrome-foreground);
  font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: var(--radius-pill);
  box-shadow: var(--shadow);
}
.refpop .vb-end {
  position: relative; z-index: 1; margin-top: -72px; padding-top: 14px;
  background: var(--card);
}
.refpop .vb-end-mark {
  display: flex; align-items: center; gap: 10px; margin: 0 0 6px;
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--primary);
}
.refpop .vb-end-mark::before, .refpop .vb-end-mark::after {
  content: ""; flex: 1; border-top: 1px solid var(--line-strong);
}
.refpop .vb-fetched { font-size: 13px; color: var(--muted-foreground); text-align: center; }
.refpop .vb-fetched a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* Sources: collapsed to one line until expanded */
.statute-page .sources {
  margin: 18px 0 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--card); font-size: 13.5px; color: var(--muted-foreground);
}
.statute-page .sources summary {
  cursor: pointer; list-style: none; padding: 10px 40px 10px 14px; position: relative;
  font-weight: 600; color: var(--primary);
}
.statute-page .sources summary::-webkit-details-marker { display: none; }
.statute-page .sources summary::after {
  content: "Vis alle"; position: absolute; right: 14px; top: 10px;
  font-weight: 500; color: var(--muted-foreground); text-decoration: underline; text-underline-offset: 3px;
}
.statute-page .sources[open] summary::after { content: "Skjul"; }
.statute-page .sources-meta { font-weight: 400; color: var(--muted-foreground); margin-left: 6px; }
.statute-page .sources-head { margin: 4px 14px 4px; font-weight: 600; color: var(--primary); font-size: 13px; }
.statute-page .sources ul { margin: 0 14px 12px; padding-left: 18px; }
.statute-page .sources li { margin: 0 0 4px; line-height: 1.5; }
.statute-page .sources a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
/* eIndkomst section - waitlist only. Locked state in the page, unlocked state in
   gated/eindkomst-lovgrundlag.html, swapped in by the page's Pages Function. */
.statute-page .gated-kicker { display: inline-flex; align-items: center; gap: 8px; }
.statute-page .gated-kicker .pill {
  font-size: 11px; letter-spacing: 0.08em; padding: 3px 9px; border-radius: var(--radius-pill);
  background: var(--secondary); color: var(--primary);
}
.statute-page .table-wrap { overflow-x: auto; margin: 18px 0 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.statute-page table.fields { border-collapse: collapse; width: 100%; min-width: 820px; font-size: 14.5px; line-height: 1.5; }
.statute-page table.fields th, .statute-page table.fields td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.statute-page table.fields thead th { background: var(--paper-reading); color: var(--primary); font-weight: 600; font-size: 13.5px; }
.statute-page table.fields tbody th { color: var(--primary); font-weight: 600; width: 22%; }
.statute-page table.fields tr:last-child th, .statute-page table.fields tr:last-child td { border-bottom: 0; }
.statute-page .felt { font-weight: 600; color: var(--primary); white-space: nowrap; }
.statute-page .unconfirmed {
  display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  padding: 1px 7px; border-radius: var(--radius-pill); background: var(--brand-tint); color: var(--brand-text);
}
.statute-page .quote-refs { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 6px 0 14px; font-size: 14.5px; }

/* Locked state */
.statute-page .gate-wrap { position: relative; margin-top: 18px; }
.statute-page .gate-teaser { filter: blur(5px); opacity: 0.55; pointer-events: none; user-select: none; max-height: 220px; overflow: hidden; }
.statute-page .gate-card {
  position: relative; margin: -120px auto 0; max-width: 520px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card-lg);
  box-shadow: 0 16px 48px rgba(10, 21, 38, 0.16); padding: 24px 24px 22px;
}
.statute-page .gate-card h3 { font-size: 20px; color: var(--primary); margin: 0 0 6px; }
.statute-page .gate-card > p { font-size: 15px; color: var(--muted-foreground); margin: 0 0 16px; }
.statute-page .gate-form { display: grid; gap: 12px; }
.statute-page .gate-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .statute-page .gate-form .row { grid-template-columns: 1fr; } }
.statute-page .gate-form label { display: grid; gap: 5px; font-size: 13.5px; font-weight: 500; color: var(--primary); }
.statute-page .gate-form input[type="text"], .statute-page .gate-form input[type="email"] {
  font: inherit; font-size: 15px; padding: 10px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-btn); background: var(--background); color: var(--foreground);
}
.statute-page .gate-form .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--muted-foreground); font-size: 13px; line-height: 1.5; }
.statute-page .gate-form .check input { margin-top: 3px; }
.statute-page .gate-form .fine { font-size: 12.5px; color: var(--muted-foreground); margin: 0; }
.statute-page .gate-form .btn { justify-self: start; cursor: pointer; border: 0; font: inherit; }
.statute-page .gate-error {
  background: var(--brand-tint); color: var(--brand-text); border-radius: var(--radius-btn);
  padding: 10px 12px; font-size: 14px; margin: 0 0 14px;
}
.statute-page .gate-honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* With four creator types the field table is wider than the reading column: on large
   screens it breaks out to 1040px, centred; on small ones it scrolls inside its box. */
@media (min-width: 900px) {
  .statute-page #eindkomst .table-wrap {
    width: min(1040px, calc(100vw - 64px));
    margin-left: calc((100% - min(1040px, calc(100vw - 64px))) / 2);
  }
}
/* Notes under the eIndkomst table reuse the collapsed sources box */
.statute-page .sources.notes summary::after { content: "Vis"; }
.statute-page .sources.notes[open] summary::after { content: "Skjul"; }
.statute-page .sources.notes p { margin: 0 14px 12px; line-height: 1.6; max-width: 68ch; }
/* Equal-width creator columns: the row-label column is fixed, the rest share the rest. */
.statute-page table.fields { table-layout: fixed; }
.statute-page table.fields thead th:first-child { width: 16%; }
.statute-page table.fields tbody th { width: auto; }
.statute-page table.fields td, .statute-page table.fields th { overflow-wrap: break-word; }
/* Small circled "i" that opens a short note as a popover */
.statute-page .info-icon {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: 0.1em;
  width: 17px; height: 17px; margin-left: 2px; padding: 0; border-radius: 50%;
  border: 1.5px solid var(--primary); background: none; color: var(--primary);
  font: 600 11px/1 var(--font); font-style: normal; cursor: pointer;
}
.statute-page .info-icon:hover { background: var(--primary); color: var(--chrome-foreground); }
.statute-page .info-icon:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.refpop.refpop-sm { width: min(28rem, calc(100vw - 32px)); }
.refpop.refpop-sm .vb-end { margin-top: 10px; }
