/* iTwin – eigenständiges Stylesheet (kein Framework). Farben oben anpassen. */
:root {
    color-scheme: light;
    --bg: #ffffff;
    --text: #1d2329;
    --muted: #5a6773;
    --line: #dde3e8;
    --soft: #f3f5f7;
    --head-bg: #ffffff;      /* Kopfzeile hell, damit das dunkelblaue Logo wirkt */
    --head-2: #e6edf4;       /* Hover/aktiv im Menü */
    --head-text: #1f3b57;
    --head-link: #2c4f73;
    --head-line: #1f4f8a;
    --heading: #1f3b57;
    --link: #0b5cad;
    --link-hover: #073e75;
    --code-bg: #eef1f4;
    --code-text: #24323f;
    --quote-bg: #f2f7fc;
    --th-bg: #1f3b57;
    --accent: #0a7cff;   /* iMessage-Blau */
    --green: #25a35a;
    --wrap: 64rem;
}

/* Dunkle Farben: automatisch nach System, oder per Knopf erzwungen (data-theme) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #121619; --text: #e3e8ec; --muted: #9aa7b2; --line: #2e3840; --soft: #1a2026;
        --head-bg: #0f1e2c; --head-2: #1f3b57; --heading: #cfe3f6;
        --head-text: #ffffff; --head-link: #dfe8f1; --head-line: #2c4f73;
        --link: #6cb2ff; --link-hover: #a6d0ff;
        --code-bg: #26313a; --code-text: #e3e8ec; --quote-bg: #1a2633; --th-bg: #24394f;
        --accent: #0a6fe0; --green: #1f8a4c;
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #121619; --text: #e3e8ec; --muted: #9aa7b2; --line: #2e3840; --soft: #1a2026;
    --head-bg: #0f1e2c; --head-2: #1f3b57; --heading: #cfe3f6;
    --head-text: #ffffff; --head-link: #dfe8f1; --head-line: #2c4f73;
    --link: #6cb2ff; --link-hover: #a6d0ff;
    --code-bg: #26313a; --code-text: #e3e8ec; --quote-bg: #1a2633; --th-bg: #24394f;
    --accent: #0a6fe0; --green: #1f8a4c;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    display: flex; flex-direction: column; min-height: 100vh;
}
img { max-width: 100%; height: auto; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Kopfzeile ---------- */
.site-header { background: var(--head-bg); color: var(--head-text); border-bottom: 3px solid var(--head-line); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 3.75rem; gap: 1rem; flex-wrap: wrap; }
.brand { color: var(--head-text); font-size: 1.5rem; font-weight: 700; text-decoration: none; display: flex; align-items: center; }
.brand img { height: 48px; width: auto; display: block; }
.brand .logo-dark { display: none; }
:root[data-theme="dark"] .brand .logo-light { display: none; }
:root[data-theme="dark"] .brand .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .brand .logo-light { display: none; }
    :root:not([data-theme="light"]) .brand .logo-dark { display: block; }
}
.brand:hover { color: var(--head-text); }

.site-nav { display: flex; align-items: center; gap: 1.25rem; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .25rem; }
.site-nav a { color: var(--head-link); text-decoration: none; padding: .4rem .6rem; border-radius: 6px; display: block; }
.site-nav a:hover, .site-nav a.active { color: var(--head-text); background: var(--head-2); }
.lang-switch a { font-size: .85rem; padding: .3rem .45rem; }

.nav-toggle { display: none; }
.nav-burger { display: none; cursor: pointer; width: 2.5rem; height: 2.5rem; position: relative; }
.nav-burger span, .nav-burger span::before, .nav-burger span::after {
    content: ""; position: absolute; left: .45rem; right: .45rem; height: 2px; background: var(--head-text); border-radius: 2px;
}
.nav-burger span { top: 50%; }
.nav-burger span::before { top: -8px; left: 0; right: 0; }
.nav-burger span::after { top: 8px; left: 0; right: 0; }

@media (max-width: 900px) {
    .nav-burger { display: block; }
    .site-nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 1rem; }
    .nav-toggle:checked ~ .site-nav { display: flex; }
    .site-nav ul.menu { flex-direction: column; }
    .lang-switch { justify-content: flex-start; }
    .site-nav .theme-toggle { align-self: flex-start; margin-left: .6rem; }
}

/* ---------- Inhalt ---------- */
.content { flex: 1; width: 100%; padding-top: 2rem; padding-bottom: 3rem; }
h1, h2, h3 { line-height: 1.25; color: var(--heading); }
h1 { font-size: 2.6rem; margin: .5rem 0; }
h2 { font-size: 1.8rem; margin: 2rem 0 1rem; }
h3 { font-size: 1.3rem; margin: 1.75rem 0 .75rem; }
.content > h2:first-child { margin-top: 0; }

.title-center h1, .title-center h2:first-of-type { text-align: center; }
.title-h1h2 h1 + h2 { margin-top: 0; font-weight: 400; color: var(--muted); }
.text-center .content { text-align: center; }
.lead { font-size: 1.25rem; }
.title-center .lead { text-align: center; }

code { background: var(--code-bg); color: var(--code-text); border-radius: 4px; padding: 1px 5px; font-size: .9em; overflow-wrap: anywhere; }

blockquote { border-left: 4px solid var(--accent); background: var(--quote-bg); padding: .6rem 1rem; margin: 1.25rem 0; }
blockquote p { margin: .3rem 0; }

table { border-collapse: collapse; width: 100%; margin: 1rem 0; display: block; overflow-x: auto; }
th, td { border: 1px solid var(--line); padding: 6px 12px; text-align: left; vertical-align: top; }
th { background: var(--th-bg); color: #fff; }

hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

/* Knöpfe: [Text](ziel?classes=button) bzw. button,secondary */
a.button {
    display: inline-block; margin: .4rem .5rem .4rem 0; padding: .8rem 1.6rem;
    font-size: 1.1rem; line-height: 1.2; border-radius: 10px;
    color: #fff; background: var(--accent); text-decoration: none;
}
a.button:hover { filter: brightness(.92); color: #fff; }
a.button.secondary { background: var(--green); }

/* ---------- Anleitung ---------- */
.chapter-back { margin: 0 0 1rem; font-size: .95rem; }
.chapter-list { padding-left: 1.5rem; }
.chapter-list li { margin: .3rem 0; }
.chapter-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* ---------- Fußzeile ---------- */
.site-footer { background: var(--soft); color: var(--muted); font-size: .85rem; text-align: center; padding: 1.5rem 0; }
.site-footer a { color: var(--link); }
.footer-launcher { margin: .6rem 0 0; }
.footer-launcher img { vertical-align: -5px; margin-right: .4rem; border-radius: 4px; }
.footer-trademark { max-width: 52rem; margin: .5rem auto 0; font-size: .78rem; }

/* ---------- Handy ---------- */
@media (max-width: 600px) {
    body { font-size: 16px; }
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    a.button { display: block; text-align: center; margin: .5rem 0; }
    th, td { padding: 4px 6px; }
}

/* ---------- Umschalter hell/dunkel ---------- */
.theme-toggle {
    background: none; border: 1px solid var(--line); color: var(--head-text); cursor: pointer;
    width: 2.2rem; height: 2.2rem; border-radius: 50%; font-size: 1.05rem; line-height: 1; padding: 0;
}
.theme-toggle:hover { background: var(--head-2); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: inline; }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* ---------- Statistik (/stats) ---------- */
table.stats { display: table; width: auto; min-width: 50%; }
.stats .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Hinweiskästen (Plugin GitHub Markdown Alerts): > [!NOTE] / [!TIP] / [!IMPORTANT] / [!WARNING] / [!CAUTION]
   Titel übersetzt in user/languages/*.yaml (PLUGIN_GITHUB_MARKDOWN_ALERTS). Farben hier, passend zum Dark Mode. ---------- */
.content .md-alert {
    --alert: var(--accent);
    border: 0; border-left: 4px solid var(--alert); background: var(--quote-bg); color: var(--text);
    padding: .6rem 1rem; margin: 1.25rem 0; border-radius: 0 6px 6px 0;
}
.content .md-alert p { margin: .3rem 0; }
.content .md-alert .md-alert-title { font-weight: 600; color: var(--alert); display: flex; align-items: center; gap: .4rem; }
.content .md-alert .md-alert-title svg { fill: currentColor; }
.content .md-alert--note      { --alert: #0969da; }
.content .md-alert--tip       { --alert: #1a7f37; }
.content .md-alert--important { --alert: #8250df; }
.content .md-alert--warning   { --alert: #9a6700; }
.content .md-alert--caution   { --alert: #cf222e; }
:root[data-theme="dark"] .content .md-alert--note      { --alert: #4493f8; }
:root[data-theme="dark"] .content .md-alert--tip       { --alert: #3fb950; }
:root[data-theme="dark"] .content .md-alert--important { --alert: #ab7df8; }
:root[data-theme="dark"] .content .md-alert--warning   { --alert: #d29922; }
:root[data-theme="dark"] .content .md-alert--caution   { --alert: #f85149; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .content .md-alert--note      { --alert: #4493f8; }
    :root:not([data-theme="light"]) .content .md-alert--tip       { --alert: #3fb950; }
    :root:not([data-theme="light"]) .content .md-alert--important { --alert: #ab7df8; }
    :root:not([data-theme="light"]) .content .md-alert--warning   { --alert: #d29922; }
    :root:not([data-theme="light"]) .content .md-alert--caution   { --alert: #f85149; }
}

/* ---------- Bildschirmfotos: [![Text](bild.png?classes=shot)](bild.png) ---------- */
img.shot {
    display: block; width: 100%; max-width: 560px; height: auto; margin: 1.25rem auto;
    border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.12);
    cursor: zoom-in;
}
/* mehrere Bilder in einem Absatz = Galerie */
.content p:not(.carousel-track):has(> a + a > img.shot) {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin: 2rem 0;
}
.content p:not(.carousel-track):has(> a + a > img.shot) img.shot { margin: 0; max-width: none; aspect-ratio: 1; object-fit: cover; }
:root[data-theme="dark"] img.shot { box-shadow: 0 4px 16px rgba(0,0,0,.5); }

dialog.lightbox {
    border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; cursor: zoom-out;
}
dialog.lightbox::backdrop { background: rgba(0,0,0,.8); }
dialog.lightbox img { display: block; max-width: 96vw; max-height: 88vh; width: auto; height: auto; border-radius: 6px; }
dialog.lightbox p { color: #fff; text-align: center; margin: .5rem 0 0; font-size: .95rem; }

/* ---------- Karussell (Startseite): ?classes=shot,carousel ---------- */
.carousel { max-width: 600px; margin: 2rem auto; }
.content .carousel-track { display: grid; margin: 0; }
.carousel-track > a { grid-area: 1 / 1; opacity: 0; visibility: hidden; transition: opacity .6s, visibility .6s; }
.carousel-track > a.active { opacity: 1; visibility: visible; }
.carousel-track img.shot { margin: 0; max-width: none; }
.carousel-caption { text-align: center; color: var(--muted); margin: .75rem 0 .25rem; min-height: 1.6em; }
.carousel-nav { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .35rem; }
.carousel-nav button { cursor: pointer; border: 0; padding: 0; background: none; color: var(--text); }
.carousel-nav .arrow { font-size: 1.8rem; line-height: 1; width: 2.2rem; height: 2.2rem; border-radius: 50%; }
.carousel-nav .arrow:hover { background: var(--soft); }
.carousel-nav .dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--line); }
.carousel-nav .dot.active { background: var(--accent); }
@media (prefers-reduced-motion: reduce) { .carousel-track > a { transition: none; } }

/* Querverweis auf den Launcher (Startseite) */
.content .crosslink { display: flex; gap: 1.2rem; align-items: flex-start; background: var(--soft); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 1.1rem 1.3rem; margin: 2rem 0; }
.content .crosslink-icon { flex: 0 0 72px; }
.content .crosslink-icon img { display: block; width: 72px; height: 72px; max-width: none; border-radius: 14px; }
.content .crosslink h3 { margin: 0 0 .4rem; }
.content .crosslink p { margin: 0 0 .6rem; }
.content .crosslink p:last-child { margin-bottom: 0; }
@media (max-width: 34rem) { .content .crosslink { flex-direction: column; } }
