/*
 * document.css — the ONE stylesheet for Notarium legal documents.
 *
 * The same file styles the wizard's live preview pane, the signing page and
 * the PDF that Chromium prints. That is the whole point: if preview and print
 * were two stylesheets they would drift, and the drift would be in legally
 * significant text. Never fork this file for print.
 *
 * Fonts are VENDORED (app/assets/fonts) and never fetched at render time —
 * the PDF renderer has no network. On screen Propshaft resolves the relative
 * url()s below; for print, Documents::PrintStylesheet inlines the same woff2
 * files as data: URIs so the Chromium pass is fully self-contained.
 *
 * Running footer: Chromium's Page.printToPDF ignores @page margin boxes
 * (@bottom-center) and the `pages` counter, so the printed footer comes from
 * printToPDF's footerTemplate — built by PdfRenderService from the same
 * title/selskab/CVR tokens that .nt-paper__footer shows on screen. CSS
 * counters DO drive the section numbering below, which works everywhere.
 */

/* ── Vendored faces ─────────────────────────────────────────────────── */

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 700;
  font-display: block;
  src: url("/assets/notarium-fraunces-latin-2a0ad122.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;
}

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 700;
  font-display: block;
  src: url("/assets/notarium-fraunces-latin-ext-cce59c20.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;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 700;
  font-display: block;
  src: url("/assets/notarium-source-serif-4-latin-88e013b5.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;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 700;
  font-display: block;
  src: url("/assets/notarium-source-serif-4-latin-ext-45521d1e.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;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400 700;
  font-display: block;
  src: url("/assets/notarium-source-serif-4-italic-latin-d304b70c.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;
}

@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400 700;
  font-display: block;
  src: url("/assets/notarium-source-serif-4-italic-latin-ext-19739600.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;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: block;
  src: url("/assets/notarium-inter-latin-496a588b.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;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: block;
  src: url("/assets/notarium-inter-latin-ext-5a6754fc.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;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: block;
  src: url("/assets/notarium-jetbrains-mono-latin-68dbce1c.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;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: block;
  src: url("/assets/notarium-jetbrains-mono-latin-ext-b0c48b7a.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;
}

/* ── Page geometry ──────────────────────────────────────────────────── */

/*
 * Danish legal-document margins: generous left for the ring binder, wide
 * bottom for the running footer. PdfRenderService passes the same numbers to
 * printToPDF (in inches) — keep the two in sync if you change them.
 */
@page {
  size: A4;
  margin: 22mm 20mm 24mm 20mm;
}

.nt-doc-tokens,
.nt-paper {
  --doc-ink: #16181d;
  --doc-ink-soft: #4b4f58;
  --doc-ink-faint: #83878f;
  --doc-rule: #d6cfc2;
  --doc-rule-strong: #b3aa99;
  --doc-seal: #7f1d2b;
  --doc-ok: #1e6b4f;
  --doc-paper: #ffffff;
  --doc-tint: #f6f3ec;

  --doc-serif: "Source Serif 4", "Georgia", "Times New Roman", serif;
  --doc-display: "Fraunces", "Source Serif 4", "Georgia", serif;
  --doc-sans: "Inter", -apple-system, "Segoe UI", "Helvetica Neue", sans-serif;
  --doc-mono: "JetBrains Mono", "SFMono-Regular", "Menlo", monospace;

  --doc-page-width: 210mm;
  --doc-margin-x: 20mm;
  --doc-margin-top: 22mm;
  --doc-margin-bottom: 24mm;
}

/*
 * The paper frame is SCREEN chrome only: on paper the sheet is the sheet, so
 * print drops the shadow, the ground and the simulated margins (the real ones
 * come from @page / printToPDF).
 */
.nt-paper {
  box-sizing: border-box;
  width: min(100%, var(--doc-page-width));
  margin: 0 auto;
  padding: var(--doc-margin-top) var(--doc-margin-x) var(--doc-margin-bottom);
  background: var(--doc-paper);
  color: var(--doc-ink);
  border: 1px solid var(--doc-rule);
  border-radius: 2px;
  box-shadow: 0 12px 32px rgba(22, 24, 29, 0.12);
  position: relative;
}

.nt-paper--flush {
  box-shadow: none;
  border: 0;
  border-radius: 0;
}

.nt-paper__footer {
  margin-top: 14mm;
  padding-top: 3mm;
  border-top: 0.5pt solid var(--doc-rule);
  font-family: var(--doc-sans);
  font-size: 7.5pt;
  letter-spacing: 0.02em;
  color: var(--doc-ink-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.6em;
}

.nt-paper__footer span::after {
  content: " ·";
  color: var(--doc-rule-strong);
}

.nt-paper__footer span:last-child::after {
  content: "";
}

/* ── The document body ──────────────────────────────────────────────── */

.nt-doc {
  counter-reset: nt-section;
  font-family: var(--doc-serif);
  font-size: 11.5pt;
  line-height: 1.55;
  color: var(--doc-ink);
  font-variant-numeric: oldstyle-nums proportional-nums;
  hyphens: auto;
}

.nt-doc p {
  margin: 0 0 0.75em;
  text-align: justify;
  orphans: 3;
  widows: 3;
}

.nt-doc > :first-child {
  margin-top: 0;
}

.nt-doc h1 {
  font-family: var(--doc-display);
  font-optical-sizing: auto;
  font-size: 21pt;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 2mm;
  text-wrap: balance;
}

.nt-doc h2 {
  counter-increment: nt-section;
  counter-reset: nt-subsection;
  font-family: var(--doc-display);
  font-size: 12.5pt;
  font-weight: 600;
  margin: 8mm 0 2mm;
  break-after: avoid;
  page-break-after: avoid;
}

.nt-doc h2::before {
  content: counter(nt-section) ". ";
  color: var(--doc-seal);
}

.nt-doc h3 {
  counter-increment: nt-subsection;
  font-family: var(--doc-serif);
  font-size: 11.5pt;
  font-weight: 700;
  margin: 5mm 0 1.5mm;
  break-after: avoid;
  page-break-after: avoid;
}

.nt-doc h3::before {
  content: counter(nt-section) "." counter(nt-subsection) " ";
  color: var(--doc-ink-faint);
}

.nt-doc h4 {
  font-family: var(--doc-sans);
  font-size: 9pt;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--doc-ink-soft);
  margin: 5mm 0 1.5mm;
  break-after: avoid;
  page-break-after: avoid;
}

/* Documents that number their own clauses (vedtægter carry real §§). */
.nt-doc--unnumbered h2::before,
.nt-doc--unnumbered h3::before {
  content: "";
}

.nt-doc ol,
.nt-doc ul {
  margin: 0 0 0.75em;
  padding-left: 1.6em;
}

.nt-doc li {
  margin-bottom: 0.25em;
}

.nt-doc blockquote {
  margin: 0 0 0.75em;
  padding: 0 0 0 4mm;
  border-left: 2pt solid var(--doc-rule);
  color: var(--doc-ink-soft);
  font-style: italic;
}

.nt-doc hr {
  border: 0;
  border-top: 0.5pt solid var(--doc-rule);
  margin: 6mm 0;
}

.nt-doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 4mm;
  font-size: 10pt;
  break-inside: avoid;
  page-break-inside: avoid;
}

.nt-doc th {
  font-family: var(--doc-sans);
  font-size: 8pt;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--doc-ink-soft);
  text-align: left;
  padding: 1.5mm 2mm 1.5mm 0;
  border-bottom: 0.75pt solid var(--doc-rule-strong);
}

.nt-doc td {
  padding: 1.5mm 2mm 1.5mm 0;
  border-bottom: 0.5pt solid var(--doc-rule);
  vertical-align: top;
}

.nt-doc td:last-child,
.nt-doc th:last-child {
  padding-right: 0;
}

.nt-doc .num {
  text-align: right;
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
}

/* § chips — statutory references are set in mono so they read as citations. */
.nt-doc__lov {
  font-family: var(--doc-mono);
  font-size: 0.82em;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--doc-seal);
  background: rgba(127, 29, 43, 0.07);
  border-radius: 3px;
  padding: 0.05em 0.35em;
}

.nt-doc__hash,
.nt-doc__mono {
  font-family: var(--doc-mono);
  font-size: 0.8em;
  overflow-wrap: anywhere;
}

/* ── Front matter ───────────────────────────────────────────────────── */

.nt-doc__frontmatter {
  margin: 0 0 8mm;
  padding-bottom: 4mm;
  border-bottom: 1pt solid var(--doc-rule-strong);
}

.nt-doc__kicker {
  font-family: var(--doc-sans);
  font-size: 8pt;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--doc-seal);
  margin: 0 0 2mm;
}

.nt-doc__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(38mm, 1fr));
  gap: 2mm 6mm;
  margin: 4mm 0 0;
  font-family: var(--doc-sans);
  font-size: 8.5pt;
}

.nt-doc__meta dt {
  color: var(--doc-ink-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 7.5pt;
  margin: 0 0 0.5mm;
}

.nt-doc__meta dd {
  margin: 0;
  color: var(--doc-ink);
  font-weight: 500;
}

/* A metadata grid inside the body (the evidence appendix) needs breathing
   room from the prose that follows; the front-matter one has its own rule. */
.nt-doc__break .nt-doc__meta {
  margin-bottom: 6mm;
}

/* ── Signature page + evidence appendix (sealed versions) ───────────── */

.nt-doc__break {
  break-before: page;
  page-break-before: always;
  margin-top: 0;
}

.nt-doc__seal {
  display: flex;
  align-items: center;
  gap: 4mm;
  margin: 0 0 6mm;
  padding: 4mm;
  background: var(--doc-tint);
  border: 0.5pt solid var(--doc-rule);
  border-radius: 3px;
}

.nt-doc__seal-mark {
  flex: 0 0 auto;
  /* The document body sets hyphens:auto; the seal must not break its word. */
  hyphens: none;
  width: 18mm;
  height: 18mm;
  border-radius: 50%;
  border: 1.5pt solid var(--doc-seal);
  color: var(--doc-seal);
  font-family: var(--doc-display);
  font-size: 6.5pt;
  font-weight: 600;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.nt-doc__seal-body {
  font-family: var(--doc-sans);
  font-size: 8.5pt;
  line-height: 1.45;
  color: var(--doc-ink-soft);
}

.nt-doc__signatures {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nt-doc__signature {
  break-inside: avoid;
  page-break-inside: avoid;
  padding: 4mm 0;
  border-bottom: 0.5pt solid var(--doc-rule);
}

.nt-doc__signature-name {
  font-family: var(--doc-display);
  font-size: 13pt;
  font-weight: 600;
  margin: 0 0 1mm;
}

.nt-doc__signature-meta {
  font-family: var(--doc-sans);
  font-size: 8.5pt;
  color: var(--doc-ink-soft);
  margin: 0;
}

.nt-doc__events {
  width: 100%;
  font-family: var(--doc-mono);
  font-size: 7.5pt;
}

.nt-doc__events td {
  padding: 1mm 2mm 1mm 0;
  overflow-wrap: anywhere;
}

/* ── Screen-only preview chrome ─────────────────────────────────────── */

.nt-preview {
  background: var(--nt-surface-sunken, #ece8e0);
  padding: 24px 16px;
  overflow-y: auto;
}

@media print {
  .nt-preview {
    background: none;
    padding: 0;
    overflow: visible;
  }

  .nt-paper {
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  /* The printed footer is printToPDF's footerTemplate — see the file header. */
  .nt-paper__footer,
  .nt-screen-only {
    display: none;
  }
}
