/* Kernic — schlicht, hell/dunkel, Animationen nur als Zusatz */

:root {
    --bg: #ffffff;
    --fg: #0f1115;
    --muted: #4a4f58;
    --line: #d3d7de;
    --card: #f1f3f6;
    --chip: #e2e6ec;
    --accent: #bd5c27;
    --brand: #f47820;
    --on-accent: #ffffff;
    --on-brand: #0b0d10;
    --shadow: 0 14px 34px rgba(15, 17, 21, .16);
    --radius: 12px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0b0d10;
        --fg: #f3f4f6;
        --muted: #b1b6c0;
        --line: #333943;
        --card: #171a20;
        --chip: #272c35;
        --accent: #f89736;
        --brand: #f47820;
        --on-accent: #0b0d10;
        --on-brand: #0b0d10;
        --shadow: 0 14px 34px rgba(0, 0, 0, .6);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0b0d10;
    --fg: #f3f4f6;
    --muted: #b1b6c0;
    --line: #333943;
    --card: #171a20;
    --chip: #272c35;
    --accent: #f89736;
    --brand: #f47820;
    --on-accent: #0b0d10;
    --on-brand: #0b0d10;
    --shadow: 0 14px 34px rgba(0, 0, 0, .6);
    color-scheme: dark;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-padding-top: 84px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--fg);
    background: var(--bg);
    transition: background-color .25s, color .25s;
}

.wrap {
    max-width: 1320px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
}

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* ---------- Header / Menü ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.bar {
    display: flex;
    align-items: center;
    gap: 8px 20px;
    min-height: 64px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--fg);
    text-decoration: none;
    margin-right: auto;
}

.brand img {
    width: 36px;
    height: 36px;
    transition: transform .3s;
}

.brand:hover img {
    transform: rotate(-10deg) scale(1.1);
}

.brand strong {
    display: block;
    font-size: 1.35em;
    line-height: 1.1;
}

.brand small {
    display: block;
    color: var(--muted);
    font-size: .8em;
}

.site-nav,
.tools {
    display: flex;
    align-items: center;
    gap: 22px;
}

/* Textlinks mit einwachsender Unterstreichung */
.site-nav a,
.tools a,
.pagination a,
.pagination .current {
    position: relative;
    color: var(--fg);
    text-decoration: none;
    font-weight: 500;
    padding: 4px 0;
    white-space: nowrap;
    transition: color .2s;
}

.site-nav a::after,
.tools a::after,
.pagination a::after,
.pagination .current::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: var(--brand);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .25s ease-out;
}

.site-nav a:hover,
.tools a:hover,
.pagination a:hover {
    color: var(--accent);
}

.site-nav a:hover::after,
.tools a:hover::after,
.pagination a:hover::after,
.site-nav a[aria-current="page"]::after,
.pagination .current::after {
    transform: scaleX(1);
}

.site-nav a[aria-current="page"],
.pagination .current {
    font-weight: 700;
}

.tools {
    gap: 14px;
    padding-left: 14px;
    border-left: 1px solid var(--line);
}

.theme-toggle {
    font: inherit;
    font-size: 1.15em;
    line-height: 1;
    color: var(--fg);
    background: none;
    border: 0;
    cursor: pointer;
    padding: 4px;
    transition: color .2s, transform .4s;
}

.theme-toggle:hover {
    color: var(--accent);
    transform: rotate(180deg);
}

/* ---------- Inhalt ---------- */

main.wrap {
    padding-top: 32px;
    padding-bottom: 56px;
    animation: enter .3s ease-out;
}

@keyframes enter {
    from { opacity: 0; transform: translateY(6px); }
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.25;
    font-weight: 650;
}

.page-title {
    font-size: 1.6em;
    margin-bottom: 20px;
}

/* ---------- Beitragsliste ---------- */

.post-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.post-item {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .25s, box-shadow .25s, border-color .25s;
}

.post-item:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow);
    border-color: var(--brand);
}

.post-thumbnail {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--chip);
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s, opacity .3s;
}

.post-thumbnail img.placeholder {
    object-fit: contain;
    padding: 18%;
    opacity: .2;
}

.post-item:hover .post-thumbnail img {
    transform: scale(1.08);
}

.post-item:hover .post-thumbnail img.placeholder {
    opacity: .35;
}

.post-content {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.post-title {
    font-size: 1.15em;
}

.post-title a {
    color: var(--fg);
    text-decoration: none;
    transition: color .2s;
}

.post-item:hover .post-title a {
    color: var(--accent);
}

.post-meta {
    color: var(--muted);
    font-size: .85em;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
}

/* Kategorie & Tags: Textlinks wie Menü/Seitennavigation */
.chip {
    position: relative;
    display: inline-block;
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
    transition: color .2s;
}

.chip::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: var(--brand);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .25s ease-out;
}

a.chip:hover {
    color: var(--fg);
}

a.chip:hover::after {
    transform: scaleX(1);
}

.chip-category {
    color: var(--accent);
    font-weight: 650;
}

a.chip-category:hover {
    color: var(--accent);
}

.post-excerpt {
    color: var(--muted);
    font-size: .95em;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- Neuester Beitrag (Startseite) ---------- */

.featured {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 28px;
    transition: transform .25s, box-shadow .25s, border-color .25s;
}

.featured:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--brand);
}

.featured-image {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--chip);
}

.featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .6s;
}

.featured-image img.placeholder {
    object-fit: contain;
    padding: 15%;
    opacity: .2;
}

.featured:hover .featured-image img {
    transform: scale(1.05);
}

.featured-body {
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
}

.featured-title {
    font-size: 1.9em;
    line-height: 1.2;
}

.featured-title a {
    color: var(--fg);
    text-decoration: none;
    transition: color .2s;
}

.featured:hover .featured-title a {
    color: var(--accent);
}

.featured-excerpt {
    color: var(--muted);
    font-size: 1.02em;
}

.featured-more {
    font-weight: 600;
    text-decoration: none;
}

.chip-new {
    color: var(--accent);
    font-size: .8em;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: .08em;
}

@media (max-width: 860px) {
    .featured {
        grid-template-columns: minmax(0, 1fr);
    }

    .featured-body {
        padding: 16px 18px 20px;
    }

    .featured-title {
        font-size: 1.45em;
    }
}

/* ---------- Pagination ---------- */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin: 44px 0 0;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    list-style: none;
}

.pagination .step {
    color: var(--muted);
}

.pagination .step:first-child {
    margin-right: auto;
}

.pagination .step:last-child {
    margin-left: auto;
}

.pagination .gap {
    color: var(--muted);
}

/* ---------- Seiten (Über mich, Impressum …) ---------- */

.article {
    max-width: 820px;
    margin: 0 auto;
}

.article h1,
.post-head h1 {
    font-size: 2.2em;
    margin-bottom: 10px;
}

/* ---------- Einzelbeitrag: Infos | Text | Inhaltsverzeichnis ---------- */

.post-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "cover" "head" "aside" "toc" "main";
    gap: 0 48px;
    max-width: 820px;
    margin: 0 auto;
}

.post-cover { grid-area: cover; }
.post-head { grid-area: head; }
.post-aside { grid-area: aside; }
.post-toc { grid-area: toc; }
.post-main { grid-area: main; min-width: 0; }

.post-header-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius);
    margin-bottom: 24px;
}

.article-description {
    font-size: 1.15em;
    color: var(--muted);
    margin-top: 12px;
}

/* Infobox: Datum/Autor · Lesezeit/Kategorie · Tags · Audio */
.infobox {
    margin-top: 20px;
    padding: 14px 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: .9em;
}

.meta-list {
    display: grid;
    grid-template-columns: repeat(4, max-content);
    gap: 12px 32px;
}

.meta-list .full {
    grid-column: 1 / -1;
}

.meta-list dt {
    color: var(--muted);
    font-size: .78em;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 2px;
}

.meta-list dd {
    font-weight: 500;
}

.meta-list dd.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 12px;
}

.audio-player {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.audio-player audio {
    width: 100%;
    height: 40px;
}

.audio-player a {
    text-decoration: none;
    font-size: .95em;
}

.audio-player a:hover {
    text-decoration: underline;
}

/* Inhaltsverzeichnis: nummeriert, Unterpunkte eingerückt mit Führungslinie */
.toc {
    margin-top: 18px;
    padding: 12px 12px 10px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: .9em;
}

.toc summary {
    cursor: pointer;
    font-weight: 650;
    padding: 0 4px;
}

.toc-label {
    display: none;
    color: var(--muted);
    font-size: .78em;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 0 8px 6px;
}

.toc ol {
    list-style: none;
    margin: 8px 0 6px;
    counter-reset: h2;
}

.toc li a {
    display: flex;
    gap: 8px;
    padding: 5px 8px;
    border-radius: 6px;
    text-decoration: none;
    line-height: 1.35;
    transition: color .2s, background-color .2s, border-color .2s;
}

.toc li a::before {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.toc-h2 {
    counter-increment: h2;
    counter-reset: h3;
}

.toc-h2 + .toc-h2,
.toc-h3 + .toc-h2 {
    margin-top: 4px;
}

.toc-h2 > a {
    color: var(--fg);
    font-weight: 600;
}

.toc-h2 > a::before {
    content: counter(h2) ".";
    min-width: 1.4em;
}

.toc-h3 {
    counter-increment: h3;
}

.toc-h3 > a {
    margin-left: 14px;
    padding-left: 12px;
    border-left: 1px solid var(--line);
    border-radius: 0 6px 6px 0;
    color: var(--muted);
    font-size: .93em;
}

.toc-h3 > a::before {
    content: counter(h2) "." counter(h3);
    font-size: .92em;
}

.toc li a:hover {
    color: var(--fg);
    background: var(--chip);
}

.toc li a[aria-current="true"] {
    color: var(--accent);
    background: color-mix(in srgb, var(--brand) 14%, transparent);
}

.toc-h3 > a[aria-current="true"] {
    border-left-color: var(--brand);
}

.toc-top {
    display: inline-block;
    margin: 4px 8px 0;
    color: var(--muted);
    font-size: .9em;
    text-decoration: none;
}

.toc-top:hover {
    color: var(--accent);
}

.article-content {
    font-size: 1.07em;
    line-height: 1.75;
    margin-top: 24px;
}

.article-content > * + * {
    margin-top: 1em;
}

.article-content h2 {
    font-size: 1.5em;
    margin-top: 1.6em;
}

.article-content h3 {
    font-size: 1.25em;
    margin-top: 1.4em;
}

.article-content ul,
.article-content ol {
    padding-left: 1.4em;
}

.article-content li + li {
    margin-top: .35em;
}

.article-content img {
    border-radius: 8px;
    cursor: zoom-in;
    transition: transform .3s, box-shadow .3s;
}

.article-content img:hover {
    transform: scale(1.015);
    box-shadow: var(--shadow);
}

.article-content blockquote {
    border-left: 3px solid var(--brand);
    padding: 4px 0 4px 16px;
    color: var(--muted);
}

.article-content code {
    background: var(--chip);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: .9em;
}

.article-content pre {
    background: var(--card);
    border: 1px solid var(--line);
    padding: 14px 16px;
    border-radius: 8px;
    overflow-x: auto;
}

.article-content pre code {
    background: none;
    padding: 0;
}

.article-content hr {
    border: 0;
    border-top: 1px solid var(--line);
}

.post-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 48px;
}

.post-navigation a {
    display: block;
    padding: 14px 16px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--fg);
    text-decoration: none;
    transition: transform .25s, box-shadow .25s, border-color .25s, color .25s;
}

.post-navigation a:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--accent);
    color: var(--accent);
}

.post-navigation small {
    display: block;
    color: var(--muted);
}

.post-navigation .next {
    grid-column: 2;
    text-align: right;
}

/* mittel: Text | Inhaltsverzeichnis */
@media (min-width: 960px) {
    .post-layout {
        max-width: none;
        grid-template-columns: minmax(0, 1fr) 240px;
        grid-template-areas: "cover toc" "head toc" "aside toc" "main toc";
    }

    .post-layout.no-toc {
        max-width: 860px;
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "cover" "head" "aside" "main";
    }

    .post-toc {
        align-self: start;
        position: sticky;
        top: 88px;
    }

    .toc {
        margin-top: 0;
        max-height: calc(100vh - 110px);
        overflow-y: auto;
    }

    .toc summary {
        display: none;
    }

    .toc-label {
        display: block;
    }

    .toc ol {
        margin-top: 0;
    }
}

/* breit: Infos | Text | Inhaltsverzeichnis */
@media (min-width: 1300px) {
    .post-layout,
    .post-layout.no-toc {
        max-width: none;
        grid-template-columns: 240px minmax(0, 1fr) 240px;
        grid-template-areas: "aside cover toc" "aside head toc" "aside main toc";
    }

    .post-aside {
        grid-row: 1 / span 3;
        align-self: start;
        position: sticky;
        top: 88px;
    }

    .infobox {
        margin-top: 0;
    }

    .meta-list {
        grid-template-columns: 1fr 1fr;
        gap: 12px 14px;
    }
}

/* ---------- Footer ---------- */

.site-footer {
    border-top: 1px solid var(--line);
    background: var(--card);
    padding: 20px 0 28px;
    color: var(--muted);
    font-size: .85em;
}

.site-footer .wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 20px;
}

.site-footer a {
    color: var(--muted);
    transition: color .2s;
}

.site-footer a:hover {
    color: var(--accent);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
}

/* ---------- Lightbox ---------- */

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .92);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, visibility .2s;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    transform: scale(.94);
    transition: transform .25s;
}

.lightbox.active img {
    transform: none;
}

.lightbox-close {
    position: absolute;
    top: 14px;
    right: 24px;
    color: #fff;
    font-size: 36px;
}

/* ---------- Mobil ---------- */

@media (max-width: 700px) {
    .bar {
        padding-top: 8px;
        padding-bottom: 8px;
    }

    main.wrap {
        padding-top: 20px;
        padding-bottom: 40px;
    }

    .site-nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        scrollbar-width: none;
        gap: 18px;
        padding-bottom: 4px;
    }

    .pagination .step {
        flex-basis: 100%;
        text-align: center;
        margin: 0 !important;
    }

    .brand small {
        display: none;
    }

    .meta-list {
        grid-template-columns: 1fr 1fr;
    }

    .article h1,
    .post-head h1 {
        font-size: 1.6em;
    }

    .post-navigation {
        grid-template-columns: 1fr;
    }

    .post-navigation .next {
        grid-column: auto;
    }
}

/* ---------- Seitenwechsel & reduzierte Bewegung ---------- */

@view-transition {
    navigation: auto;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    @view-transition {
        navigation: none;
    }
}
