/* ==========================================================================
   Jobriver v2 – API-Dokumentation (Lese-Layout)
   Basis: v2-core.css · Styleguide: docu/design/v2-styleguide.md
   Inhalt nutzt die Original-Klassen (docs-section, code-block, docs-table,
   method-badge, docs-warning, docs-info …) – hier neu gestaltet unter .ad2.
   ========================================================================== */

.ad2 { --ad-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace; --ad-code-bg: #140d24; --ad-warn: #9a5b00; --ad-warn-bg: #fff6e5; --ad-del: #c2255c; }
:root[data-theme="dark"] .ad2 { --ad-warn: #ffc46b; --ad-warn-bg: rgba(255, 180, 60, .1); --ad-del: #ff7aa8; }

/* Lesefortschritt */
.ad2-progress { position: fixed; inset: 0 0 auto; z-index: 60; height: 3px; pointer-events: none; }
.ad2-progress i { display: block; height: 100%; width: 100%; background: var(--brand); transform: scaleX(0); transform-origin: left; }

/* ---------- Hero ---------- */
.ad2-hero { position: relative; isolation: isolate; overflow: hidden; padding: calc(72px + clamp(40px, 6vw, 80px)) 0 clamp(48px, 6vw, 80px); }
.ad2-hero__glow {
    position: absolute; inset: -10% -10% 0; z-index: -1; opacity: var(--hero-glow-o);
    background: radial-gradient(40% 55% at 80% 35%, rgba(178, 157, 255, .5), transparent 70%), radial-gradient(30% 45% at 10% 12%, rgba(255, 168, 220, .24), transparent 70%);
    filter: blur(24px);
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 50%, transparent 95%);
    mask-image: linear-gradient(180deg, #000 0%, #000 50%, transparent 95%);
}
.ad2-hero__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .9fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
.ad2-hero__title { margin-top: 14px; font-size: clamp(2.4rem, 1.5rem + 3.2vw, 3.9rem); line-height: 1.04; font-weight: 600; letter-spacing: -.045em; max-width: 16ch; }
.ad2-hero__lead { margin-top: 20px; max-width: 54ch; font-size: var(--fs-lead); line-height: 1.6; color: var(--ink-2); }
.ad2-hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 28px; }
.ad2-hero__term { border-radius: 22px; background: var(--ad-code-bg); border: 1px solid rgba(255, 255, 255, .08); box-shadow: var(--shadow-lg); overflow: hidden; }
.ad2-term__bar { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.ad2-term__bar i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .18); }
.ad2-term__bar span { margin-left: 8px; font-size: .8125rem; color: #a59dbb; }
.ad2-term__body { margin: 0; padding: 22px; overflow-x: auto; font: .875rem/1.7 var(--ad-mono); color: #e9e3fb; white-space: pre-wrap; overflow-wrap: anywhere; }
.ad2-c { color: #c9b8ff; }

/* ---------- Layout ---------- */
.ad2-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: clamp(32px, 4vw, 64px); padding-top: clamp(24px, 3vw, 40px); padding-bottom: clamp(64px, 8vw, 104px); }
.ad2-side { position: relative; }
.ad2-toc { position: sticky; top: 96px; }
.ad2-toc__h { margin-bottom: 12px; font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ad2-toc ol { list-style: none; counter-reset: toc; display: grid; gap: 2px; border-left: 1px solid var(--line); }
.ad2-toc li { counter-increment: toc; }
.ad2-toc a { position: relative; display: flex; gap: 10px; margin-left: -1px; padding: 7px 12px; border-left: 2px solid transparent; font-size: .9rem; color: var(--muted); transition: color .2s, border-color .2s, background-color .2s; }
.ad2-toc a::before { content: counter(toc, decimal-leading-zero); font-size: .75rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--line-2); padding-top: 2px; }
.ad2-toc a:hover { color: var(--ink); }
.ad2-toc a.is-on { border-left-color: var(--brand); color: var(--ink); font-weight: 600; background: linear-gradient(90deg, var(--brand-50), transparent); }
.ad2-toc a.is-on::before { color: var(--brand-700); }

/* ---------- Inhalt (Original-Klassen) ---------- */
.ad2-content { min-width: 0; }
.ad2 .docs-section { padding: clamp(32px, 4vw, 48px) 0; border-bottom: 1px solid var(--line); scroll-margin-top: 96px; }
.ad2 .docs-section:first-child { padding-top: 0; }
.ad2 .docs-section:last-child { border-bottom: 0; }
.ad2 .docs-section h2 { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.25rem); font-weight: 600; letter-spacing: -.035em; line-height: 1.15; }
.ad2 .docs-section h2 svg { width: 22px; height: 22px; flex: none; padding: 9px; box-sizing: content-box; border-radius: 12px; background: var(--brand-50); color: var(--brand-700); }
.ad2 .docs-section h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 10px; font: 600 1.0625rem/1.4 var(--ad-mono); letter-spacing: -.01em; overflow-wrap: anywhere; }
.ad2 .docs-section h4 { margin: 28px 0 10px; font-size: 1.125rem; font-weight: 600; letter-spacing: -.015em; }
.ad2 .docs-section h5 { margin: 20px 0 8px; font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ad2 .docs-section p { margin: 0 0 12px; max-width: 72ch; line-height: 1.7; color: var(--ink-2); }
.ad2 .docs-section ul { margin: 8px 0 12px 20px; }
.ad2 .docs-section li { margin-bottom: 6px; line-height: 1.6; color: var(--ink-2); }
.ad2 .docs-section p code, .ad2 .docs-section li code, .ad2 .docs-table code { padding: 2px 6px; border-radius: 6px; background: var(--brand-50); color: var(--brand-700); font: .85em var(--ad-mono); overflow-wrap: anywhere; }
.ad2 .docs-section a { color: var(--brand-700); text-decoration: underline; text-underline-offset: 3px; }

.ad2 .docs-features { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.ad2 .docs-feature { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border-radius: var(--r); background: var(--tint); border: 1px solid var(--line); }
.ad2 .docs-feature strong { font-size: 1.375rem; font-weight: 600; letter-spacing: -.03em; }
.ad2 .docs-feature span { font-size: .8125rem; color: var(--muted); }

/* Endpunkt-Blöcke */
.ad2 .endpoint-section { margin-top: 20px; padding: clamp(18px, 2.5vw, 28px); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.ad2 .endpoint-section > h4:first-of-type { margin-top: 16px; }

/* Methoden-Kennzeichen: Text bleibt maßgeblich, Farbe nur unterstützend */
.ad2 .method-badge { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 8px; font: 700 .75rem var(--ad-mono); letter-spacing: .04em; }
.ad2 .method-badge.get { background: var(--brand-50); color: var(--brand-700); }
.ad2 .method-badge.post { background: var(--brand); color: #fff; }
.ad2 .method-badge.put { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-2); }
.ad2 .method-badge.delete { background: color-mix(in oklab, var(--ad-del) 12%, transparent); color: var(--ad-del); }

/* Code-Blöcke (immer dunkel) mit Kopieren-Knopf */
.ad2 .code-block { position: relative; margin: 10px 0 16px; padding: 18px 20px; border-radius: 16px; background: var(--ad-code-bg); border: 1px solid rgba(255, 255, 255, .06); overflow-x: auto; font: .8125rem/1.7 var(--ad-mono); color: #e9e3fb; tab-size: 2; }
.ad2 .code-block code { font: inherit; color: inherit; background: none; padding: 0; }
.ad2-codewrap { position: relative; }
.ad2-codewrap .code-block { padding-right: 104px; }
.ad2-copy { position: absolute; top: 10px; right: 10px; z-index: 1; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 999px; background: rgba(29, 18, 51, .85); color: #fff; font-size: .75rem; font-weight: 600; transition: background-color .2s, border-color .2s; }
.ad2-copy:hover { background: rgba(114, 79, 255, .6); border-color: rgba(255, 255, 255, .3); }
.ad2-copy svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ad2-copy.is-done { background: var(--mint); border-color: var(--mint); color: #062b1f; }

/* Tabellen */
.ad2-tbl { margin: 10px 0 16px; overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.ad2 .docs-table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: .9rem; }
.ad2 .docs-table td, .ad2 .docs-table td code { hyphens: manual; overflow-wrap: normal; }
.ad2 .docs-table th, .ad2 .docs-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.ad2 .docs-table th { font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--tint); white-space: nowrap; }
.ad2 .docs-table td { color: var(--ink-2); }
.ad2 .docs-table td:first-child { white-space: nowrap; }
.ad2 .docs-table tbody tr:last-child td { border-bottom: 0; }

/* Hinweise */
.ad2 .docs-warning, .ad2 .docs-info { margin: 18px 0; padding: 16px 18px; border-radius: var(--r); }
.ad2 .docs-warning { background: var(--ad-warn-bg); border: 1px solid color-mix(in oklab, var(--ad-warn) 35%, transparent); }
.ad2 .docs-warning strong { display: flex; align-items: center; gap: 8px; color: var(--ad-warn); }
.ad2 .docs-warning strong svg { width: 16px; height: 16px; }
.ad2 .docs-warning ul { margin: 8px 0 0 20px; }
.ad2 .docs-warning li, .ad2 .docs-warning p { color: var(--ink-2); font-size: .875rem; }
.ad2 .docs-info { background: var(--brand-50); border: 1px solid var(--brand-200); }
.ad2 .docs-info strong { display: flex; align-items: center; gap: 8px; color: var(--brand-700); }
.ad2 .docs-info p, .ad2 .docs-info li { font-size: .9rem; }

/* ---------- Abschluss ---------- */
.ad2-end { padding: 0 0 clamp(8px, 1vw, 12px); }
.ad2-end__card { margin-inline: var(--edge); padding: clamp(56px, 7vw, 96px) 0; border-radius: var(--r-xl); background: var(--seg-grad); border: 1px solid var(--line); }
.ad2-end__inner { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.ad2-end__inner > p { max-width: 560px; font-size: var(--fs-lead); color: var(--ink-2); }
.ad2-end__inner .btn { margin-top: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
    .ad2-hero__grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
    .ad2-layout { grid-template-columns: minmax(0, 1fr); }
    .ad2-toc { position: static; padding: 18px; border-radius: var(--r-lg); background: var(--tint); }
    .ad2-toc ol { grid-template-columns: repeat(2, minmax(0, 1fr)); border-left: 0; }
    .ad2-toc a { border-left: 0; border-radius: 10px; }
    .ad2 .docs-features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
    .ad2-toc ol { grid-template-columns: minmax(0, 1fr); }
    .ad2-codewrap .code-block { padding-right: 20px; padding-top: 50px; }
    .ad2 .endpoint-section { padding: 16px 12px; }
    .ad2 .docs-table td:first-child { white-space: normal; }
    .ad2 .docs-table { min-width: 0; font-size: .85rem; }
    .ad2 .docs-table th, .ad2 .docs-table td { padding: 8px 10px; }
    .ad2 .docs-table td, .ad2 .docs-table td code { overflow-wrap: anywhere; }
    .ad2 .code-block { padding-inline: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
    .ad2-progress { display: none; }
}
