/* PDF-Export des Brandkits: Vorschau, A4-Seiten und Druck.
   Wird nach dem <style> in index.html geladen und nutzt dessen Variablen. */

/* ---- PDF-Vorschau ---- */
.pdf-preview { position: fixed; inset: 0; z-index: 500; display: grid; grid-template-columns: 270px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); background: #30343B; visibility: hidden; pointer-events: none; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
.pdf-preview.is-open { visibility: visible; pointer-events: auto; }
.pdf-preview__bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #FFFFFF; color: var(--ui-ink); border-bottom: 1px solid var(--ui-line); font-size: 15px; }
.pdf-preview__count { flex: 1; font-size: 13px; color: var(--ui-muted); }
.pdf-preview__side { padding: 18px 16px; background: #FFFFFF; color: var(--ui-ink); overflow-y: auto; font-size: 14px; }
.pdf-preview__side h4 { margin: 0 0 10px; font-size: 14px; font-weight: 650; }
.pdf-toggle { display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: 14px; cursor: pointer; }
.pdf-toggle input { width: 18px; height: 18px; accent-color: var(--ui-active); }
.pdf-toggle.is-empty { color: var(--ui-muted); cursor: default; }
.pdf-toggle small { margin-left: auto; font-size: 12px; color: var(--ui-muted); }
.pdf-preview__warn { margin: 14px 0 0; padding: 10px 12px; font-size: 13px; line-height: 1.4; color: #7A4B00; background: #FFF4DB; border-radius: 8px; }
.pdf-preview__side .setting-hint { margin-top: 14px; }
.pdf-preview__stage { overflow: auto; padding: 24px; }
#printDoc { --pv-zoom: 1; display: flex; flex-direction: column; align-items: center; gap: 18px; }
#printDoc .pg { zoom: var(--pv-zoom); flex: none; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35); }
@media (max-width: 767px) {
  .pdf-preview { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); }
  .pdf-preview__side { max-height: 32vh; }
  .pdf-preview__stage { padding: 12px; }
  .pdf-preview__bar strong { display: none; }
}

/* ---- PDF-Seiten: A4 quer mit festem Raster ---- */
.pg { position: relative; width: 297mm; height: 210mm; display: flex; flex-direction: column; padding: 10mm 16mm 8mm; overflow: hidden; background: var(--color-surface, #FFFFFF); color: var(--color-text); font-family: var(--font-family-base, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif); font-size: 13px; line-height: 1.5; --pg-muted: color-mix(in srgb, var(--color-text) 70%, white); }
.pg * { transition: none !important; }
.pg *:not(.palette-color) { box-shadow: none !important; }
.pg__head { flex: none; height: 9mm; display: flex; align-items: center; justify-content: space-between; gap: 8mm; font-size: 10px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase; color: var(--pg-muted); }
.pg__head-logo { height: 8mm; max-width: 70mm; min-width: 0; display: flex; align-items: center; justify-content: flex-end; letter-spacing: 0; text-transform: none; }
.pg__head-logo span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg__head-logo img { height: 100%; max-width: 100%; object-fit: contain; }
.pg__title { flex: none; margin: 3mm 0 1mm; font-size: 30px; line-height: 1.15; font-weight: var(--font-weight-heading, 600); color: var(--color-text); }
.pg__lead { flex: none; margin: 0; max-width: 190mm; font-size: 13px; line-height: 1.45; color: var(--pg-muted); }
.pg__body { flex: 1; min-height: 0; margin-top: 5mm; overflow: hidden; font-size: calc(13px * var(--fit, 1)); }
.pg__foot { flex: none; height: 7mm; margin-top: 3mm; display: flex; align-items: flex-end; justify-content: space-between; gap: 8mm; font-size: 9.5px; color: var(--pg-muted); border-top: 1px solid var(--color-border); }
.pg-sub { margin: 0 0 2mm; font-size: 12px; font-weight: 600; color: var(--color-text); }
.pg-note { margin: 3mm 0 0; font-size: 9.5px; line-height: 1.4; color: var(--pg-muted); }

/* Deckblatt */
.pg--cover { padding: 18mm 20mm 0; background: var(--gradient-hero); color: var(--cover-ink); }
.pg-cover__logo { flex: none; height: 26mm; display: flex; align-items: center; }
.pg-cover__logo img { height: 100%; max-width: 110mm; object-fit: contain; }
.pg-cover__main { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: 14mm; }
.pg-cover__eyebrow { margin: 0 0 4mm; font-size: 12px; font-weight: 600; letter-spacing: 2.4px; text-transform: uppercase; opacity: 0.85; }
.pg-cover__title { margin: 0; font-size: 68px; line-height: 1.04; font-weight: var(--font-weight-heading, 600); overflow-wrap: anywhere; }
.pg-cover__title.is-long { font-size: 46px; line-height: 1.1; }
.pg-cover__sub { margin: 5mm 0 0; max-width: 175mm; font-size: 17px; line-height: 1.45; opacity: 0.92; }
.pg-cover__meta { flex: none; display: flex; justify-content: space-between; gap: 10mm; padding-bottom: 7mm; font-size: 11px; opacity: 0.85; }
.pg-cover__strip { flex: none; display: flex; height: 5mm; margin: 0 -20mm; }
.pg-cover__strip i { flex: 1; }

/* Inhaltsverzeichnis */
.pg-toc { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16mm; height: 100%; }
.pg-toc__list { list-style: none; margin: 0; padding: 0; }
.pg-toc__list a { display: flex; align-items: baseline; gap: 3mm; padding: 3.6mm 0; border-bottom: 1px solid var(--color-border); font-size: 15px; font-weight: 500; color: inherit; text-decoration: none; }
.pg-toc__list a span:first-child { flex: 1; }
.pg-toc__list a span:last-child { font-variant-numeric: tabular-nums; color: var(--pg-muted); }
.pg-toc__glance { padding: 7mm; background: color-mix(in srgb, var(--color-primary) 4%, var(--color-surface, white)); border-radius: var(--radius-md); align-self: start; }
.pg-toc__glance h4 { margin: 0 0 4mm; font-size: 13px; font-weight: 600; }
.pg-toc__swatches { display: flex; height: 16mm; margin-bottom: 5mm; border-radius: 6px; overflow: hidden; }
.pg-toc__swatches i { flex: 1; }
.pg-toc__font { font-size: 34px; line-height: 1.1; font-weight: 600; }
.pg-toc__fontname { margin: 1mm 0 0; font-size: 12px; color: var(--pg-muted); }

/* Markenkern */
/* Mit wenig Inhalt steht der Markenkern in der Seitenmitte statt oben; Spalten füllen die Höhe wie bisher */
.pg-brand { display: flex; flex-direction: column; justify-content: center; height: 100%; gap: 9mm; font-size: 1.25em; }
.pg-brand__statement { margin: 0; padding: 8mm 10mm; font-size: 1.9em; line-height: 1.32; font-weight: 600; color: var(--cover-ink, #FFFFFF); background: var(--gradient-hero); border-radius: var(--radius-lg); white-space: pre-line; }
.pg-brand__statement:only-child { padding: 13mm 15mm; font-size: 2.5em; }
.pg-brand__cols { flex: 1; min-height: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10mm; }
.pg-brand__col h4 { margin: 0 0 3mm; padding-bottom: 2mm; font-size: 1em; font-weight: 600; color: var(--color-text); border-bottom: 2px solid var(--color-accent); }
.pg-brand__col ul { list-style: none; margin: 0; padding: 0; }
.pg-brand__col li { padding: 1.4mm 0; font-size: 1.15em; line-height: 1.35; font-weight: 500; }
.pg-brand__col p { margin: 0; font-size: 1.1em; line-height: 1.5; white-space: pre-line; }

/* Logo */
.pg-logos { display: grid; gap: 5mm; height: 100%; }
.pg-logo { margin: 0; display: flex; flex-direction: column; min-height: 0; }
.pg-logo__stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 12mm; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.pg-logo__stage img { width: 100%; height: 100%; object-fit: contain; }
.pg-logo figcaption { flex: none; margin-top: 2.5mm; font-size: 12px; line-height: 1.35; color: var(--pg-muted); }
.pg-logo figcaption b { display: block; font-size: 13px; font-weight: 600; color: var(--color-text); }

.pg-rules { display: grid; grid-template-columns: 1fr 1fr; gap: 6mm; margin-bottom: 5mm; }
.pg-rules .rule-stage { height: 64mm; min-height: 0; }
.pg-rules p { margin: 2mm 0 0; font-size: 12px; line-height: 1.4; color: var(--pg-muted); }
.pg .rule-card { padding: 0; border: none; }
.pg .rule-card h4 { margin: 0 0 2mm; font-size: 13px; }
.pg .bg-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4mm; }
.pg .bg-tiles.bg-tiles--few { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pg .bg-tiles.bg-tiles--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pg .bg-tile__stage { height: 41mm; padding: 8mm; }
.pg .bg-tile figcaption, .pg .misuse-tile figcaption { margin-top: 1.5mm; font-size: 11px; }
.pg .misuse-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3mm 5mm; }
.pg .misuse-tile__stage { height: 37mm; padding: 7mm 14mm; }
.pg-min { display: flex; gap: 8mm; align-items: flex-end; justify-content: center; flex-wrap: wrap; }
.pg-min figure { margin: 0; text-align: center; font-size: 11px; color: var(--pg-muted); }
.pg-min img { display: block; margin: 0 auto 2mm; object-fit: contain; }
.pg-dodont { display: grid; grid-template-columns: 1fr 1fr; gap: 8mm; margin-top: 6mm; }
.pg-dodont h4 { margin: 0 0 2mm; font-size: 13px; font-weight: 600; }
.pg-dodont ul { margin: 0; padding: 0; list-style: none; }
.pg-dodont li { position: relative; padding: 1mm 0 1mm 5.5mm; font-size: 12.5px; line-height: 1.4; }
.pg-dodont li::before { position: absolute; left: 0; font-weight: 700; }
.pg-dodont__do li::before { content: '\2713'; color: #1E7E4F; }
.pg-dodont__dont li::before { content: '\00d7'; color: #C62828; font-size: 15px; line-height: 1.2; }

/* Moodboard: Zeilen aus den echten Seitenverhältnissen, nichts wird beschnitten */
.pg-mb { display: flex; flex-direction: column; justify-content: center; gap: 3mm; height: 100%; }
.pg-mb__row { display: flex; justify-content: center; gap: 3mm; min-height: 0; }
.pg-mb figure { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; margin: 0; min-width: 0; min-height: 0; }
.pg-mb img { flex: 1 1 0; display: block; width: 100%; min-height: 0; object-fit: contain; }
.pg-mb figcaption { flex: none; width: 100%; padding-top: 1mm; font-size: 10px; line-height: 1.25; text-align: center; color: var(--pg-muted); }

/* Farben */
.pg-colors { display: flex; flex-direction: column; gap: 5mm; }
.pg-colors__row { display: flex; gap: 5mm; }
.pg-colors__group { min-width: 0; }
.pg-colors__cards { display: flex; gap: 2.5mm; }
.pc { flex: 1 1 0; min-width: 0; border: 1px solid var(--color-border); border-radius: 6px; overflow: hidden; }
.pc__sw { height: 25mm; display: flex; align-items: flex-end; justify-content: flex-end; padding: 1.5mm 2.5mm; font-size: 15px; font-weight: 600; }
.pc__sw--bordered { border-bottom: 1px solid var(--color-border); }
.pc__info { padding: 2mm 2.5mm 2.5mm; }
.pc__name { margin: 0; font-size: 11.5px; font-weight: 600; line-height: 1.25; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc__desc { margin: 0 0 1.2mm; font-size: 9px; line-height: 1.25; color: var(--pg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc dl { display: grid; grid-template-columns: auto 1fr; column-gap: 2mm; margin: 0; font-size: 8.7px; line-height: 1.5; }
.pc dt { font-weight: 600; color: var(--pg-muted); }
.pc dd { margin: 0; font-family: "SF Mono", Menlo, Monaco, Consolas, monospace; white-space: nowrap; }

.pg .palette-list { gap: 2.2mm; }
.pg .palette-row { grid-template-columns: 27mm 1fr; gap: 3mm; }
.pg .palette-label { font-size: 11.5px; line-height: 1.2; }
.pg .palette-base-hex { font-size: 8.7px; margin-top: 0; }
.pg .palette-swatches { grid-template-columns: repeat(11, 1fr); gap: 1mm; }
.pg .palette-color { height: 10mm; border-radius: 3px; }
.pg .palette-swatch.is-base .palette-color { box-shadow: 0 0 0 1.5px var(--color-text); border-color: var(--color-text); }
/* Kleinste Schrift im PDF ist 8.7px (6.5 pt), damit auch Farbwerte gedruckt lesbar bleiben */
.pg .palette-stop { font-size: 8.7px; margin-top: 0.5mm; line-height: 1.2; }
.pg .palette-hex { display: block; font-size: 8.7px; line-height: 1.2; letter-spacing: -0.2px; color: var(--pg-muted); }
.pg-gradients { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; margin-top: 3.5mm; }
.pg .gradient-card { height: 19mm; padding: 2.5mm 4mm; border-radius: var(--radius-sm); box-shadow: none; }
.pg .gradient-card h4 { margin: 0; font-size: 12px; line-height: 1.2; }
.pg .gradient-card p { font-size: 8.7px; }

/* Typografie */
.pg-font { display: grid; grid-template-columns: 86mm 1fr; gap: 12mm; height: 100%; align-items: center; }
.pg-font__aa { display: flex; align-items: center; justify-content: center; height: 100%; max-height: 110mm; font-size: 150px; line-height: 1; font-weight: 600; background: var(--gradient-hero); border-radius: var(--radius-lg); }
.pg-font__name { margin: 0 0 1mm; font-size: 30px; line-height: 1.15; font-weight: 600; }
.pg-font__src { margin: 0 0 6mm; font-size: 12px; color: var(--pg-muted); }
.pg-font__chars { margin: 0 0 6mm; font-size: 21px; line-height: 1.35; overflow-wrap: anywhere; }
.pg-font__weights { display: flex; gap: 10mm; font-size: 12px; color: var(--pg-muted); }
.pg-font__weights b { display: block; font-size: 26px; line-height: 1.2; color: var(--color-text); }
.pg-fonts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10mm; height: 100%; }
.pg-fonts__col { display: flex; flex-direction: column; min-width: 0; }
.pg-fonts__role { margin: 0 0 3mm; font-size: 10px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase; color: var(--pg-muted); }
.pg-fonts .pg-font__aa { flex: none; height: 46mm; max-height: none; margin-bottom: 5mm; font-size: 96px; }
.pg-fonts .pg-font__name { font-size: 24px; }
.pg-fonts .pg-font__src { margin-bottom: 4mm; }
.pg-fonts .pg-font__chars { margin-bottom: 0; font-size: 15px; }
.pg-fonts__sample { margin: auto 0 0; padding-top: 5mm; border-top: 1px solid var(--color-border); color: var(--color-text); }
.pg-fonts__sample--heading { font-size: 26px; line-height: 1.2; font-weight: 600; }
.pg-fonts__sample--body { font-size: 13px; line-height: 1.55; }
.pg .type-table { gap: 2mm; }
.pg .type-row { grid-template-columns: 30mm minmax(0, 1fr) 30mm; gap: 5mm; padding: 3.4mm 4mm; border-radius: 6px; }
.pg .type-label { font-size: 9.5px; letter-spacing: 0.8px; }
.pg .type-meta { font-size: 9px; line-height: 1.35; color: var(--pg-muted); text-align: right; }

/* System */
.pg-system { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10mm; height: 100%; }
.pg .spacing-list { gap: 2.4mm; }
.pg .spacing-row { grid-template-columns: 13mm 1fr 41mm; gap: 3mm; padding: 3mm; border-radius: 6px; }
.pg .spacing-token { font-size: 10px; }
.pg .spacing-usage { display: block; font-size: 9.5px; line-height: 1.2; color: var(--pg-muted); }
.pg .spacing-bar { height: 3mm; }
.pg-shadows { position: relative; margin: -2mm 0 2mm; }
.pg-shadows img { display: block; width: 100%; height: auto; }
.pg-shadow-tile { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.pg-shadow-tile b { font-size: 10.5px; font-weight: 600; line-height: 1.2; }
.pg-shadow-tile span { font-family: "SF Mono", Menlo, Monaco, Consolas, monospace; font-size: 8.7px; letter-spacing: -0.3px; line-height: 1.3; color: var(--pg-muted); }
.pg .radius-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3mm; align-items: center; }
.pg .radius-box { height: 36mm; font-size: 11px; line-height: 1.2; text-align: center; color: #FFFFFF; }
.pg .radius-box span { font-size: 8.7px; margin-top: 1px; line-height: 1.15; }
/* Der Kreis richtet sich nach der Spaltenbreite, sonst ragt er über den Seitenrand */
.pg .r-full { width: 100%; max-width: 21mm; height: auto; aspect-ratio: 1; margin: 0 auto; }

/* Komponenten in Originalgrösse */
.pg-comp-row { display: grid; grid-template-columns: 50mm minmax(0, 1fr); gap: 6mm; align-items: center; padding: 3.5mm 0; border-bottom: 1px solid var(--color-border); }
.pg-comp-row:last-child { border-bottom: none; }
.pg-comp-row h4 { margin: 0; font-size: 13px; font-weight: 600; color: var(--color-text); }
.pg-comp-row p { margin: 1px 0 0; font-size: 11px; line-height: 1.35; color: var(--pg-muted); }
.pg .button-group { flex-direction: row; align-items: center; }
.pg .btn { justify-content: center; }
.pg .badge-group { gap: 2mm; }
.pg .card, .pg .card--service { border: 1px solid var(--color-border); }
.pg .mock-browser, .pg .mock-bc { border: 1px solid var(--color-border); }
.pg .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5mm; margin-bottom: 5mm; }
.pg .card-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pg .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: none; gap: 3.5mm 6mm; }
.pg .form-group--full { grid-column: 1 / -1; }
.pg .form-textarea { min-height: 22mm; resize: none; }
.pg .checkbox-group { gap: 1.5mm; margin-top: 0; }

.pg .mock-grid { zoom: 1.22; grid-template-columns: 1.32fr 1fr; gap: 6mm; }
.pg .mock-side { gap: 5mm; }

/* ---- Druck: nur das PDF-Dokument, randlos ---- */
@page { size: A4 landscape; margin: 0; }
@media print {
  html, body { margin: 0 !important; padding: 0 !important; width: 297mm; background: #FFFFFF !important; overflow: visible !important; }
  body > *:not(.pdf-preview) { display: none !important; }
  .pdf-preview { position: static !important; display: block !important; visibility: visible !important; background: none !important; overflow: visible !important; }
  .pdf-preview__bar, .pdf-preview__side { display: none !important; }
  .pdf-preview__stage { padding: 0 !important; overflow: visible !important; }
  #printDoc { display: block !important; }
  #printDoc .pg { zoom: 1 !important; box-shadow: none !important; break-after: page; break-inside: avoid; }
  #printDoc .pg:last-child { break-after: auto; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}
