/* Shared typography and layout. Theme tokens live on html[data-theme]. */
:root {
  --header-h: 3.6rem;
  --measure: 42rem;
  --wide: 68rem;
  --radius: 10px;
  --gap: 1.25rem;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body), system-ui, "Segoe UI", sans-serif;
  font-size: 1.05rem;
  line-height: 1.62;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 0.14em; }
a:hover { color: var(--accent-2); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, h4 {
  font-family: var(--font-head), Georgia, serif;
  line-height: 1.22;
  font-weight: 650;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); margin: 0 0 0.6em; }
h2 { font-size: clamp(1.3rem, 2.2vw, 1.7rem); margin: 1.8em 0 0.55em; }
h3 { font-size: 1.15rem; margin: 1.4em 0 0.4em; }
p { margin: 0 0 1em; }
main { flex: 1 0 auto; padding-bottom: 3rem; }
.wrap { width: min(var(--wide), calc(100% - 2rem)); margin-inline: auto; }
.narrow { width: min(var(--measure), calc(100% - 2rem)); margin-inline: auto; }
.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: var(--bg); padding: 0.5rem 1rem;
}
.skip:focus { left: 0.5rem; top: 0.5rem; z-index: 20; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg-header);
  position: sticky; top: 0; z-index: 10;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: var(--header-h); gap: 1rem;
}
.logo {
  font-family: var(--font-head), Georgia, serif;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: var(--logo-tracking, 0);
  font-size: var(--logo-size, 1.2rem);
}
.logo:hover { color: var(--accent); }
.site-header nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.site-header nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.site-header nav a:hover { color: var(--accent); }

.page-head { padding: 2.2rem 0 0.5rem; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
  font-family: var(--font-body), sans-serif;
  font-weight: 600;
}
.lead { font-size: 1.15rem; color: var(--ink-soft); }
.meta-line { font-size: 0.92rem; color: var(--ink-soft); }
.author-note {
  margin-top: 2.4rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  background: var(--bg-card);
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.article-body table, .legal-page table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin: 1.2rem 0 1.6rem;
}
.article-body th, .article-body td,
.legal-page th, .legal-page td {
  border: 1px solid var(--line);
  padding: 0.55rem 0.7rem;
  text-align: left;
  vertical-align: top;
}
.article-body th { background: var(--bg-table); font-weight: 650; }
.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; }
blockquote {
  margin: 1.1rem 0;
  padding: 0.15rem 0 0.15rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft);
}
blockquote p:last-child { margin-bottom: 0; }
.src, .article-body a.src { font-size: 0.88em; }
.faq { margin-top: 2.2rem; }
.faq details {
  border-top: 1px solid var(--line);
  padding: 0.7rem 0;
}
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 650; }
.faq details p { margin: 0.6rem 0 0.2rem; }
.article-body ul, .legal-page ul { margin: 0 0 1em; padding-left: 1.2em; }
.article-body li { margin: 0.25em 0; }
code { font-size: 0.9em; }

/* Homepage */
.home-hero { padding: 2.4rem 0 1.4rem; }
.home-hero h1 { margin-bottom: 0.3em; }
.article-list { display: grid; gap: 1.1rem; margin: 1.2rem 0 2rem; }
.article-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem 1.2rem;
  box-shadow: var(--shadow);
}
.article-card:hover { border-color: var(--accent); }
.article-card h2 { margin: 0.15em 0 0.4em; font-size: 1.25rem; }
.article-card p { margin: 0; color: var(--ink-soft); }
.card-kicker { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); font-weight: 650; }

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-footer);
  padding: 1.6rem 0 2rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.footer-name { font-family: var(--font-head), Georgia, serif; color: var(--ink); font-weight: 700; margin-bottom: 0.2rem; }
.footer-tag { margin-bottom: 0.7rem; }
.footer-legal a { color: inherit; }

/* ===== Themes ===== */
[data-theme="bruehkompass"] {
  --bg: #f4efe6; --bg-header: #faf7f1; --bg-footer: #ebe4d8; --bg-card: #fffdf8; --bg-table: #efe7db;
  --ink: #1c1410; --ink-soft: #4a4038; --line: #ddd4c6;
  --accent: #8a3d28; --accent-2: #6b2c1c;
  --shadow: 0 1px 2px rgba(28,20,16,.04), 0 8px 24px rgba(28,20,16,.05);
  --font-head: "Source Serif Pro"; --font-body: "Source Sans 3";
  --logo-tracking: 0.01em;
  background-image: radial-gradient(1100px 480px at 8% -12%, #efe4d4 0%, transparent 55%);
}
[data-theme="grammweg"] {
  --bg: #eef1ec; --bg-header: #e7ebe4; --bg-footer: #dfe4d8; --bg-card: #f7f8f5; --bg-table: #e6ebe3;
  --ink: #1b241c; --ink-soft: #445046; --line: #c9d1c6;
  --accent: #3d5c45; --accent-2: #2a3f30;
  --shadow: 0 1px 0 rgba(27,36,28,.06);
  --font-head: "IBM Plex Serif"; --font-body: "IBM Plex Sans";
  --radius: 2px;
}
[data-theme="beckenstart"] {
  --bg: #eef6f6; --bg-header: rgba(255,255,255,.86); --bg-footer: #dceeed; --bg-card: #ffffff; --bg-table: #e7f2f2;
  --ink: #143038; --ink-soft: #3d5a60; --line: #c6ddde;
  --accent: #0e7c7b; --accent-2: #0a5c5b;
  --shadow: 0 10px 30px rgba(14,80,80,.07);
  --font-head: "Crimson Pro"; --font-body: "Lato";
  --radius: 18px;
}
[data-theme="bordgepaeck"] {
  --bg: #f3efe8; --bg-header: #17324a; --bg-footer: #17324a; --bg-card: #fffcf7; --bg-table: #ece6dc;
  --ink: #14202c; --ink-soft: #445262; --line: #d9d1c5;
  --accent: #c56a2d; --accent-2: #9a4e1c;
  --shadow: 0 12px 32px rgba(20,32,44,.08);
  --font-head: "Outfit"; --font-body: "Source Sans 3";
  --logo-tracking: 0.04em; --logo-size: 1.05rem;
}
[data-theme="bordgepaeck"] .site-header { border-bottom: 0; }
[data-theme="bordgepaeck"] .logo,
[data-theme="bordgepaeck"] .site-header nav a { color: #f4efe6; }
[data-theme="bordgepaeck"] .site-header nav a:hover { color: #f0c9a0; }
[data-theme="bordgepaeck"] .site-footer,
[data-theme="bordgepaeck"] .footer-name { color: #d9d1c5; }
[data-theme="bordgepaeck"] .footer-name { color: #f4efe6; }

[data-theme="radalltag"] {
  --bg: #111111; --bg-header: #111111; --bg-footer: #0a0a0a; --bg-card: #1a1a1a; --bg-table: #222;
  --ink: #f3f1ea; --ink-soft: #b9b5ab; --line: #333;
  --accent: #ffd000; --accent-2: #ffe56a;
  --shadow: none;
  --font-head: "Barlow Condensed"; --font-body: "Barlow";
  --radius: 0; --logo-tracking: 0.08em; --logo-size: 1.35rem;
}
[data-theme="radalltag"] .site-header { border-bottom: 3px solid var(--accent); }
[data-theme="radalltag"] a { text-decoration-thickness: 2px; }
[data-theme="radalltag"] .article-card { border-left: 4px solid var(--accent); }
[data-theme="radalltag"] h1, [data-theme="radalltag"] h2 { text-transform: uppercase; letter-spacing: 0.03em; }

[data-theme="hobelstart"] {
  --bg: #f3eadb; --bg-header: #5c3b22; --bg-footer: #3e2818; --bg-card: #fff8ee; --bg-table: #e9dcc8;
  --ink: #2a1c12; --ink-soft: #5b4634; --line: #d3c3ab;
  --accent: #8a4b1f; --accent-2: #6b3816;
  --shadow: 0 2px 0 rgba(90,50,20,.08);
  --font-head: "Inknut Antiqua"; --font-body: "Source Sans 3";
  --radius: 0;
}
[data-theme="hobelstart"] .site-header { border-bottom: 0; }
[data-theme="hobelstart"] .logo,
[data-theme="hobelstart"] .site-header nav a { color: #f6ead8; }
[data-theme="hobelstart"] .site-footer, [data-theme="hobelstart"] .footer-name { color: #e6d3bc; }
[data-theme="hobelstart"] .footer-name { color: #f6ead8; }
[data-theme="hobelstart"] h1 { font-weight: 600; }

[data-theme="arbeitswinkel"] {
  --bg: #f6f7f9; --bg-header: #f6f7f9; --bg-footer: #eef0f3; --bg-card: #ffffff; --bg-table: #eef0f3;
  --ink: #1b1f24; --ink-soft: #5b616a; --line: #dde1e6;
  --accent: #2b4c7e; --accent-2: #1d3559;
  --shadow: 0 1px 2px rgba(20,24,30,.04);
  --font-head: "Inter"; --font-body: "Inter";
  --radius: 8px;
}
[data-theme="arbeitswinkel"] .site-header { border-bottom: 0; }
[data-theme="arbeitswinkel"] .header-inner { min-height: 4.2rem; }
[data-theme="arbeitswinkel"] h1 { font-weight: 560; letter-spacing: -0.02em; }

[data-theme="einbrennweg"] {
  --bg: #1c1612; --bg-header: #140f0c; --bg-footer: #120e0b; --bg-card: #261e18; --bg-table: #2c231c;
  --ink: #f3e6d4; --ink-soft: #c9b49a; --line: #3b3026;
  --accent: #c45c26; --accent-2: #e07a3a;
  --shadow: none;
  --font-head: "Source Serif Pro"; --font-body: "Fira Sans";
  --radius: 4px;
}
[data-theme="einbrennweg"] .site-header { border-bottom: 1px solid #c45c26; }
[data-theme="einbrennweg"] blockquote { border-left-color: #c45c26; }

[data-theme="schliffwinkel"] {
  --bg: #f5f5f3; --bg-header: #f5f5f3; --bg-footer: #ecece8; --bg-card: #fff; --bg-table: #ecece8;
  --ink: #191b1d; --ink-soft: #53565b; --line: #cfd0cc;
  --accent: #2c4a5e; --accent-2: #17303f;
  --shadow: none;
  --font-head: "IBM Plex Serif"; --font-body: "IBM Plex Sans";
  --radius: 0;
}
[data-theme="schliffwinkel"] .site-header { border-bottom: 1px solid var(--ink); }
[data-theme="schliffwinkel"] h1 { font-weight: 500; }
[data-theme="schliffwinkel"] .article-body table { border: 1px solid var(--ink); }
[data-theme="schliffwinkel"] .article-body th { border-color: var(--ink); }

[data-theme="leitungsklar"] {
  --bg: #f3f8fb; --bg-header: #ffffffcc; --bg-footer: #e4eef3; --bg-card: #ffffff; --bg-table: #e8f2f6;
  --ink: #16303a; --ink-soft: #46606a; --line: #c9dbe3;
  --accent: #1578a6; --accent-2: #0d5b7e;
  --shadow: 0 8px 24px rgba(21,80,110,.06);
  --font-head: "Lexend"; --font-body: "Libre Franklin";
  --radius: 12px;
}

/* ===== Layout variants ===== */
[data-layout="classic"] .home-hero { max-width: var(--measure); }
[data-layout="rail"] .site-header { position: relative; }
@media (min-width: 960px) {
  [data-layout="rail"] body { display: grid; grid-template-columns: 13rem 1fr; grid-template-rows: auto 1fr auto; }
  [data-layout="rail"] .skip { grid-column: 1 / -1; }
  [data-layout="rail"] .site-header {
    grid-row: 1 / -1; grid-column: 1;
    border-right: 1px solid var(--line); border-bottom: 0;
    position: sticky; top: 0; height: 100vh;
    writing-mode: horizontal-tb;
  }
  [data-layout="rail"] .header-inner {
    flex-direction: column; align-items: flex-start;
    padding: 1.5rem 1rem; min-height: 100vh;
  }
  [data-layout="rail"] .logo { font-size: 1.5rem; }
  [data-layout="rail"] .site-header nav { flex-direction: column; gap: 0.5rem; }
  [data-layout="rail"] main, [data-layout="rail"] .site-footer { grid-column: 2; }
}
[data-layout="split"] .home-hero .wrap {
  display: grid; gap: 1.5rem;
}
@media (min-width: 800px) {
  [data-layout="split"] .home-hero .wrap { grid-template-columns: 1.1fr 0.9fr; align-items: end; }
}
[data-layout="magazine"] .article-list {
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}
[data-layout="magazine"] .home-hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: -0.03em; }
[data-layout="compact"] .wrap { width: min(60rem, calc(100% - 1.5rem)); }
[data-layout="compact"] .lead { font-size: 1.05rem; }
[data-layout="compact"] .header-inner { min-height: 3.1rem; }
[data-layout="workshop"] .article-body,
[data-layout="workshop"] .legal-page.narrow,
[data-layout="workshop"] .home-hero .wrap {
  border-left: 4px solid var(--accent);
  padding-left: 1.2rem;
}
[data-layout="minimal"] .home-hero { padding-top: 4rem; }
[data-layout="minimal"] .article-card { border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; padding-left: 0; background: transparent; }
[data-layout="cookbook"] .article-body h2 { border-bottom: 2px solid var(--accent); padding-bottom: 0.2rem; display: inline-block; }
[data-layout="technical"] .meta-line { font-family: "IBM Plex Sans", system-ui, sans-serif; letter-spacing: 0.02em; }
[data-layout="technical"] .article-body h2 { border-top: 1px solid var(--line); padding-top: 1rem; }
[data-layout="utility"] .home-hero { background: linear-gradient(180deg, #fff 0%, transparent 100%); }

@media (max-width: 640px) {
  .site-header nav { font-size: 0.85rem; gap: 0.7rem; }
  .header-inner { padding-block: 0.4rem; }
}

/* ===== Media (heroes, diagrams, card thumbs) ===== */
.hero-figure {
  margin: 0.4rem auto 1.6rem;
}
.hero-figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  background: var(--bg-card);
}
.diagram-figure,
.stock-figure {
  margin: 1.6rem 0 1.8rem;
}
.diagram-figure .diagram-inner svg,
.diagram-figure img,
.stock-figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
}
.diagram-figure .diagram-inner {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}
.hero-figure figcaption,
.diagram-figure figcaption,
.stock-figure figcaption {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin: 0.5rem 0 0;
}
.article-card .card-thumb {
  display: block;
  width: calc(100% + 2.4rem);
  max-width: none;
  margin: -1.15rem -1.2rem 0.9rem;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--bg-table);
}
[data-layout="minimal"] .article-card .card-thumb {
  width: 100%;
  margin: 0 0 0.8rem;
  border-radius: var(--radius);
}
[data-layout="compact"] .article-card .card-thumb,
[data-theme="radalltag"] .article-card .card-thumb {
  border-radius: 0;
}
[data-layout="split"] .home-hero-media {
  margin: 0;
}
[data-layout="split"] .home-hero-media img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
}
