/* Shared layout for /docs and /blog — extends landing.css (load after it). */

.docs-layout {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 3rem;
  padding: 3rem 1.25rem 5rem;
}
.docs-sidebar { position: sticky; top: 84px; align-self: start; }
.docs-sidebar .side-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .7rem; }
.docs-sidebar nav { display: flex; flex-direction: column; gap: .15rem; }
.docs-sidebar a {
  display: block; padding: .42rem .7rem; border-radius: 8px;
  font-size: .92rem; color: var(--muted); font-weight: 500;
}
.docs-sidebar a:hover { color: var(--text); background: var(--bg-2); }
.docs-sidebar a.active { color: var(--red); background: rgba(220, 0, 0, .06); font-weight: 650; }

.prose { min-width: 0; }
.prose .crumb { font-size: .82rem; color: var(--muted); margin-bottom: .8rem; }
.prose .crumb a { color: var(--red); font-weight: 600; }
.prose h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); font-weight: 820; margin-bottom: .6rem; }
.prose .lead { color: var(--muted); font-size: 1.05rem; margin-bottom: 2rem; }
.prose h2 { font-size: 1.3rem; font-weight: 760; margin: 2.4rem 0 .7rem; }
.prose h3 { font-size: 1.05rem; font-weight: 720; margin: 1.8rem 0 .5rem; }
.prose p, .prose li { color: #3d434e; font-size: .97rem; }
.prose p { margin-bottom: .9rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin-bottom: 1rem; }
.prose li { margin-bottom: .35rem; }
.prose a { color: var(--red); font-weight: 600; }
.prose a:hover { text-decoration: underline; }
.prose strong, .prose b { color: var(--text); }
.prose code {
  font-family: ui-monospace, "SF Mono", monospace; font-size: .84rem;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px;
  padding: .1rem .4rem; color: var(--text);
  overflow-wrap: anywhere; /* lange URLs/Tokens dürfen das Layout nie sprengen */
}
.prose pre {
  background: #16181d; color: #d7dce4; border-radius: 12px;
  padding: 1rem 1.2rem; overflow-x: auto; margin: 1rem 0 1.4rem;
  font-family: ui-monospace, "SF Mono", monospace; font-size: .84rem; line-height: 1.55;
}
.prose pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.prose table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.4rem; font-size: .92rem; }
.prose th, .prose td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--border); }
.prose th { font-weight: 700; color: var(--text); font-size: .84rem; }
.prose td { color: #3d434e; }
.prose .callout {
  border: 1px solid var(--border); border-left: 3px solid var(--red);
  background: var(--card); border-radius: 10px; padding: .9rem 1.1rem; margin: 1rem 0 1.4rem;
  box-shadow: var(--shadow-sm);
}
.prose .callout p:last-child { margin-bottom: 0; }
.prose .next-link {
  display: inline-flex; align-items: center; gap: .4rem; margin-top: 2rem;
  border: 1px solid var(--border-strong); background: var(--card); border-radius: 12px;
  padding: .7rem 1.2rem; font-weight: 650; color: var(--text) !important; text-decoration: none !important;
}
.prose .next-link:hover { box-shadow: var(--shadow-sm); }

/* Buttons in Artikeln: .prose a (rot) darf die Button-Schrift nicht überschreiben */
.prose a.btn { text-decoration: none; }
.prose a.btn:hover { text-decoration: none; }
.prose a.btn-primary { color: #fff; }

/* ---------- blog ---------- */
.blog-head { max-width: 760px; margin: 0 auto; text-align: center; padding: 3.5rem 1.25rem 1rem; }
.blog-head h1 { font-size: clamp(2rem, 5vw, 2.8rem); font-weight: 830; margin-bottom: .6rem; }
.blog-head p { color: var(--muted); font-size: 1.05rem; }
.blog-grid {
  max-width: 1100px; margin: 0 auto; padding: 2rem 1.25rem 5rem;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 1.3rem;
}
.post-card {
  display: flex; flex-direction: column; gap: .5rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 1.5rem; box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s;
}
.post-card-img {
  display: block; margin: -1.5rem -1.5rem .55rem;
  border-bottom: 1px solid var(--border);
  border-radius: 16px 16px 0 0; overflow: hidden; aspect-ratio: 1200 / 630;
}
.post-card-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.post-card .post-tag { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--red); }
.post-card h2 { font-size: 1.15rem; font-weight: 760; }
.post-card p { color: var(--muted); font-size: .92rem; flex: 1; }
.post-card .post-meta { font-size: .8rem; color: var(--muted); }

.article { max-width: 760px; margin: 0 auto; padding: 3rem 1.25rem 5rem; }
.article .post-tag { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--red); }
.article h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); font-weight: 830; margin: .5rem 0 .8rem; }
.article .post-meta { color: var(--muted); font-size: .88rem; margin-bottom: 2.2rem; }
.article-cta {
  border: 1px solid var(--border); border-radius: 16px; background: var(--card);
  box-shadow: var(--shadow-sm); padding: 1.6rem; margin-top: 3rem; text-align: center;
}
.article-cta h3 { font-size: 1.15rem; font-weight: 760; margin-bottom: .4rem; }
.article-cta p { color: var(--muted); font-size: .93rem; margin-bottom: 1rem; }

/* ---------- related-reading tiles (end of posts & glossary entries) ---------- */
.related { margin-top: 3.2rem; border-top: 1px solid var(--border); padding-top: 1.5rem; }
.related-title { font-size: .78rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 1rem; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .9rem; }
/* .prose-Link- und Typo-Regeln neutralisieren: Kacheln sind eigenständige Karten */
.related-grid .post-card { color: var(--text); font-weight: 500; text-decoration: none; }
.related-grid .post-card:hover { text-decoration: none; }
.related-grid .post-card h2 { margin: 0; font-size: .98rem; font-weight: 720; line-height: 1.35; }
.related-grid .post-card p { margin: 0; font-size: .85rem; color: var(--muted); }

/* ---------- in-article infographics (CSS, no images) ---------- */
.ig {
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  padding: 1.4rem 1.5rem 1.2rem; box-shadow: var(--shadow-sm); margin: 1.4rem 0 1.8rem;
}
.ig-title { font-size: .78rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; color: var(--red); margin-bottom: .2rem; }
.ig-sub { font-size: .84rem; color: var(--muted); margin-bottom: 1.2rem; }
.ig-note { margin-top: .9rem; font-size: .8rem; color: var(--muted); }
.ig-legend { display: flex; gap: 1.2rem; margin-top: 1.1rem; font-size: .78rem; color: var(--muted); flex-wrap: wrap; }
.ig-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.ig-dot { width: 10px; height: 10px; border-radius: 3px; }

/* grouped percentile bars (e.g. HIT vs MISS latency) */
.pct-grid { display: grid; gap: .9rem; }
.pct-row { display: grid; grid-template-columns: 3.2rem 1fr; gap: .6rem; align-items: center; }
.pct-label { font-size: .78rem; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.pct-bars { display: grid; gap: .3rem; }
.ig .bar { height: 18px; border-radius: 5px; position: relative; min-width: 2.2rem; }
.ig .bar b { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  font-size: .7rem; font-weight: 750; color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ig .bar-hit  { background: linear-gradient(90deg, #12a35c, var(--ok)); }
.ig .bar-miss { background: linear-gradient(90deg, #ff5a36, var(--red)); }
.ig .bar.outside b { color: var(--text); left: calc(100% + .45rem); right: auto; }

/* heat list (ranked horizontal bars, warm→cool) */
.heat-row { display: grid; grid-template-columns: 7.2rem 1fr 3.4rem; gap: .7rem;
  align-items: center; padding: .42rem 0; border-bottom: 1px dashed var(--border); }
.heat-row:last-child { border-bottom: 0; }
.heat-name { font-size: .82rem; font-weight: 650; }
.heat-name small { color: var(--muted); font-weight: 500; }
.heat-track { height: 10px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.heat-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ffb199, #ff5a36 60%, var(--red)); }
.heat-fill.cool { background: var(--ok); }
.heat-val { font-size: .8rem; font-weight: 750; text-align: right; font-variant-numeric: tabular-nums; }
.heat-val.cool { color: var(--ok); }
.heat-val.warm { color: var(--red); }

/* collapsible raw-data table inside a figure (accessible + markdown fallback);
   neutralizes the global FAQ <details> card styling */
.ig-data { border: 0; background: transparent; border-radius: 0; padding: .6rem 0 0; margin-top: .6rem; border-top: 1px dashed var(--border); }
.ig-data summary { font-size: .78rem; font-weight: 650; color: var(--muted); padding-right: 1.6rem; }
.ig-data summary::after { font-size: 1rem; }
.ig-data table { margin: .6rem 0 0; font-size: .84rem; }

@media (max-width: 480px) {
  .ig { padding: 1.1rem 1rem 1rem; border-radius: 14px; }
  .pct-row { grid-template-columns: 2.6rem 1fr; }
  .heat-row { grid-template-columns: 3.4rem 1fr 3.1rem; gap: .5rem; }
  .heat-name small { display: none; }
}

@media (max-width: 860px) {
  .docs-layout { grid-template-columns: 1fr; gap: 1.2rem; padding-top: 1.6rem; }
  /* Sidebar wird zur horizontal scrollbaren Chip-Leiste (volle Breite, Kante zu Kante) */
  .docs-sidebar { position: static; margin: 0 -1.25rem; }
  .docs-sidebar .side-title { display: none; }
  .docs-sidebar nav {
    flex-direction: row; flex-wrap: nowrap; gap: .45rem;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding: .15rem 1.25rem .5rem;
    scrollbar-width: none;
  }
  .docs-sidebar nav::-webkit-scrollbar { display: none; }
  .docs-sidebar a {
    flex: none; white-space: nowrap;
    border: 1px solid var(--border); background: var(--card);
    border-radius: 999px; padding: .42rem .95rem; font-size: .86rem;
  }
  .docs-sidebar a.active { border-color: rgba(220, 0, 0, .35); background: rgba(220, 0, 0, .06); }
}
