/* ==========================================================================
   aluplattenzuschnitt.de — Design-Layer (Schicht 2 + Kontexte + Browser-Flächen)
   --------------------------------------------------------------------------
   WICHTIG (Handover): Tokens (Farben, Typo-Leiter --text-*, Spacing --space-*,
   Radius, Schatten) und Pattern-Klassen (.section, .container, .btn-*, .prose …)
   liegen im CrocoBuilder-Design-System. Diese Datei definiert KEINE Tokens neu
   (sie lädt nach dem Design-System), sondern nur:
     1. Webfonts (@font-face, lokal)
     2. Element-Defaults (body, h1–h6, a, Listen, Tabellen) — CrocoBuilder hat
        dafür keine native Heimat (common_styles werden nicht ausgeliefert)
     3. Browser-Flächen (Selektion, Caret, Fokus, Scrollbar)
     4. Kontext-/Verbund-Regeln (.on-dark …, .btn-*.btn-lg, .prose-Inhalte)
   Fontgrößen ausschließlich über var(--text-*).
   ========================================================================== */

/* ---------- 1. Webfonts ---------- */
@import url("fonts.css");

/* ---------- 2. Element-Defaults ---------- */
html { scroll-padding-top: 140px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--lh-body);
  color: var(--color-ink);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  color: var(--color-heading);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  font-weight: 700;
  margin: 0 0 var(--space-s);
  text-wrap: balance;
}
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5, h6 { font-size: var(--text-md); }
p { margin: 0 0 var(--space-s); }
p:last-child { margin-bottom: 0; }
a { color: var(--color-primary); text-underline-offset: 0.18em; }
a:hover { color: var(--color-primary-hover); }
img, video { max-width: 100%; height: auto; }
.icon { width: 1.15em; height: 1.15em; flex: none; display: inline-block; vertical-align: middle; }
.screen-reader-text, .sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
table { font-variant-numeric: tabular-nums; }
.site-main, #primary { overflow-x: clip; }

/* ---------- 3. Browser-Flächen (DF-V7) ---------- */
::selection { background: var(--color-primary-subtle); color: var(--color-heading); }
.on-dark ::selection { background: var(--color-accent); color: var(--color-surface-dark); }
input, textarea, select { caret-color: var(--color-primary); }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: 2px; }
.on-dark :focus-visible { outline-color: var(--color-accent); }
html { scrollbar-color: #9AA3AC var(--color-surface); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--color-surface); }
::-webkit-scrollbar-thumb { background: #9AA3AC; border-radius: 999px; border: 3px solid var(--color-surface); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- 4. Verbund-/Kontextregeln ---------- */
.btn-primary.btn-lg, .btn-outline.btn-lg, .btn-light.btn-lg { font-size: var(--text-base); padding: 0.95em 1.6em; }
.btn-primary .icon, .btn-outline .icon, .btn-light .icon, .link-arrow .icon { width: 1.1em; height: 1.1em; transition: transform .18s ease; }
.btn-primary:hover .icon, .btn-light:hover .icon, .link-arrow:hover .icon { transform: translateX(3px); }
.btn-primary:disabled, .btn-primary[aria-disabled="true"] { background: var(--color-border); border-color: var(--color-border); color: var(--color-muted); cursor: not-allowed; }
.text-center .section-head, .section-head.text-center { margin-left: auto; margin-right: auto; }
.section-flexhead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-m); margin-bottom: var(--space-xl); }
.section-flexhead .section-head { margin-bottom: 0; }

/* Dunkle Fläche: Text, Links, Outline-Buttons gemeinsam umschalten (Rule 16) */
.on-dark h1, .on-dark h2, .on-dark h3, .on-dark h4 { color: var(--color-on-dark); }
.on-dark p, .on-dark li { color: var(--color-on-dark-muted); }
.on-dark a:not([class*="btn-"]) { color: var(--color-on-dark); }
.on-dark .overline { color: var(--color-accent); }
.on-dark .btn-outline { border-color: var(--color-on-dark); color: var(--color-on-dark); }
.on-dark .btn-outline:hover { background: var(--color-on-dark); color: var(--color-primary); }

/* ---------- 5. Prose (post_content aus Bestand) ---------- */
.prose > * + * { margin-top: var(--space-s); }
.prose > :first-child { margin-top: 0; }
.prose p { margin-bottom: 0; }
.prose h2 { font-size: var(--text-2xl); margin-top: var(--space-xl); margin-bottom: 0; scroll-margin-top: 140px; }
.prose h3 { font-size: var(--text-lg); margin-top: var(--space-l); margin-bottom: 0; }
.prose h4, .prose h5, .prose h6 { font-size: var(--text-base); margin-top: var(--space-m); margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 1.4em; margin-bottom: 0; }
.prose li + li { margin-top: var(--space-2xs); }
.prose li::marker { color: var(--color-primary); }
.prose a { color: var(--color-primary); text-decoration: underline; overflow-wrap: anywhere; }
.prose a:hover { color: var(--color-primary-hover); }
.prose strong, .prose b { color: var(--color-heading); font-weight: 600; }
.prose img { border-radius: var(--radius-m); display: block; height: auto; }
.prose figure, .prose .wp-block-image { margin: var(--space-l) 0; }
.prose figcaption { font-size: var(--text-xs); color: var(--color-muted); margin-top: var(--space-2xs); }
.prose .alignleft { float: left; margin: 0 var(--space-m) var(--space-s) 0; max-width: 50%; }
.prose .alignright { float: right; margin: 0 0 var(--space-s) var(--space-m); max-width: 50%; }
.prose .aligncenter { margin-left: auto; margin-right: auto; }
.prose blockquote { margin: var(--space-l) 0; padding: var(--space-s) var(--space-m); border-left: 3px solid var(--color-primary); background: var(--color-surface-light); border-radius: 0 var(--radius-m) var(--radius-m) 0; }
.prose hr { border: 0; border-top: 1px solid var(--color-border); margin: var(--space-xl) 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); display: block; overflow-x: auto; border-radius: var(--radius-m); box-shadow: var(--shadow-ring); }
.prose th, .prose td { padding: 0.75em 0.9em; text-align: left; vertical-align: top; border-bottom: 1px solid var(--color-border); }
.prose thead th, .prose tr:first-child th { background: var(--color-surface-light); color: var(--color-heading); font-weight: 700; }
.prose tbody tr:last-child > * { border-bottom: 0; }
.prose .wp-block-table { margin: var(--space-l) 0; }
.prose iframe { max-width: 100%; border: 0; border-radius: var(--radius-m); }
.prose::after { content: ""; display: table; clear: both; }
.prose .todo-mark, .prose mark { background: #FFE58A; color: #4A3B05; padding: 0 3px; border-radius: 3px; }

/* ---------- 6. Breadcrumb (Pattern) ---------- */
.breadcrumb { font-size: var(--text-xs); color: var(--color-muted); margin-bottom: var(--space-m); }
.breadcrumb a { color: var(--color-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb .sep { margin: 0 0.4em; color: var(--color-border); }

/* ---------- 7. Theme-Altlasten neutralisieren (underscores) ---------- */
.site-main > article > .entry-header { display: none; }

/* ---------- 8. Hinweis-Kästen aus Content-Import (Kunde prüfen) ---------- */
.prose .hinweis, .hinweis { margin: var(--space-l) 0; padding: var(--space-s) var(--space-m); border-radius: var(--radius-m); background: var(--color-surface-light); box-shadow: inset 0 0 0 1.5px var(--color-primary-subtle); font-size: var(--text-sm); }
.prose .hinweis.hinweis--kunde-pruefen, .hinweis.hinweis--kunde-pruefen { background: #FFF6D6; box-shadow: inset 0 0 0 1.5px var(--color-warning); color: #4A3B05; }
.hinweis.hinweis--kunde-pruefen a { color: inherit; }

/* ---------- 9. Themen-Navigation (Ratgeber) ---------- */
.topic-nav { display: flex; flex-wrap: wrap; gap: var(--space-2xs); margin-bottom: var(--space-xl); }
.topic-chip { display: inline-flex; align-items: center; gap: .5em; padding: .5em .95em; border-radius: var(--radius-pill); background: var(--color-bg); box-shadow: var(--shadow-ring); font-size: var(--text-sm); font-weight: 500; color: var(--color-ink); text-decoration: none; transition: box-shadow .16s ease, color .16s ease, background-color .16s ease; }
.topic-chip:hover { box-shadow: inset 0 0 0 1.5px var(--color-primary); color: var(--color-primary); }
.topic-chip.is-active { background: var(--color-primary); color: #fff; box-shadow: none; }
.topic-chip-count { font-size: var(--text-xs); font-weight: 600; opacity: .75; }
.archive-pagination { margin-top: var(--space-xl); }

/* ---------- 10. Theme-Sidebar (underscores) ausblenden: Layout kommt aus CrocoBuilder ---------- */
#secondary.widget-area { display: none; }
#primary.site-main, .site-main { width: 100%; max-width: none; margin: 0; padding: 0; }
html { caret-color: var(--color-primary); }
.site-footer-group-head p:not(.site-footer-group-title) { max-width: 70ch; }
.archive-pagination .cb-el-pagination__items { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3xs); }
.archive-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-2xs); }
.archive-pagination .cb-el-pagination__item { display: inline-grid; place-items: center; min-width: 2.75rem; height: 2.75rem; padding: 0 .8em; border-radius: var(--radius-s); box-shadow: var(--shadow-ring); background: var(--color-bg); color: var(--color-ink); font-size: var(--text-sm); font-weight: 600; text-decoration: none; }
.archive-pagination a.cb-el-pagination__item:hover { box-shadow: inset 0 0 0 1.5px var(--color-primary); color: var(--color-primary); }
.archive-pagination .cb-el-pagination__item--active { background: var(--color-primary); color: #fff; box-shadow: none; }
.archive-pagination .cb-el-pagination__item--delimiter { box-shadow: none; background: transparent; }
.archive-pagination .cb-el-pagination__item[aria-disabled="true"] { opacity: .45; pointer-events: none; }
/* Theme-Default a:focus (dotted 1px) schlägt :focus-visible an Spezifität → explizit überschreiben (Phase D) */
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; }
.on-dark a:focus-visible, .on-dark button:focus-visible { outline-color: var(--color-accent); }
/* Starter-Theme gibt .entry-content margin-top 1.5em → weiße Lücke unter dem blauen Header auf Builder-Seiten */
.site-main .entry-content { margin-top: 0; }
