/* ============================================================
   Blog – Übersicht (blog.html) und Beiträge (/blog/<slug>)
   Gemeinsam genutzt von der Übersicht, der dynamischen Detailansicht
   und den vorgerenderten Beitragsseiten (scripts/web/prerender_blog.py).
   ============================================================ */

/* ---------- Lesefortschritt ---------- */
.post-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    z-index: 1600;
    background: linear-gradient(90deg, var(--pf-red), #ff4b57);
    transition: width 0.08s linear;
}

/* ---------- Übersicht ---------- */
.blog-hero {
    position: relative;
    overflow: hidden;
    padding: clamp(56px, 8vw, 104px) 0 clamp(28px, 4vw, 48px);
    text-align: center;
    background: linear-gradient(180deg, #fff 0%, var(--pf-bg-light) 100%);
    border-bottom: 1px solid var(--pf-border);
}

.blog-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(560px 300px at 85% 0%, var(--pf-red-wash-strong), transparent 70%),
        radial-gradient(480px 280px at 8% 100%, var(--pf-red-wash), transparent 70%);
    pointer-events: none;
}

.blog-hero .container {
    position: relative;
}

.blog-hero h1 {
    margin: 12px 0 14px;
}

.blog-hero .lead {
    max-width: 620px;
    margin: 0 auto;
}

.blog-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 26px 0 0;
}

.blog-chip {
    border: 1px solid var(--pf-border-strong);
    background: #fff;
    color: var(--pf-text-secondary);
    font: inherit;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.18s ease;
}

.blog-chip:hover {
    border-color: var(--pf-red);
    color: var(--pf-red);
}

.blog-chip.is-active {
    background: var(--pf-red);
    border-color: var(--pf-red);
    color: #fff;
    box-shadow: var(--shadow-red);
}

.blog-wrap {
    max-width: 1120px;
    margin: 0 auto;
}

.blog-empty,
.blog-loading {
    text-align: center;
    color: var(--pf-text-secondary);
    padding: 56px 0;
}

/* Karten */
.blog-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--pf-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    color: inherit;
    text-decoration: none;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.blog-card:hover,
.blog-card:focus-visible {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(209, 33, 45, 0.35);
}

.blog-card__media {
    position: relative;
    aspect-ratio: 1200 / 630;
    background: var(--pf-bg-light);
    overflow: hidden;
}

.blog-card__media > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.45s ease;
}

.blog-card:hover .blog-card__media > img {
    transform: scale(1.03);
}

.blog-card__media--fallback {
    display: flex;
    align-items: flex-end;
    padding: 20px 22px;
    background:
        radial-gradient(420px 260px at 90% -10%, rgba(255, 75, 87, 0.55), transparent 70%),
        linear-gradient(135deg, #1b1b1f 0%, #0b0b0d 100%);
}

.blog-card__media--fallback .blog-card__logo {
    position: absolute;
    right: 22px;
    top: 20px;
    width: 54px;
    height: auto;
    object-fit: contain;
    opacity: 0.92;
}

.blog-card__media--fallback span {
    color: #fff;
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    line-height: 1.15;
    max-width: 78%;
}

.blog-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 22px 24px 24px;
}

.blog-card__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 0.82rem;
    color: var(--pf-text-secondary);
}

.blog-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    background: var(--pf-red-wash);
    color: var(--pf-red-deep);
    font-weight: 700;
    font-size: 0.76rem;
    letter-spacing: 0.02em;
}

.blog-card h3 {
    font-size: 1.28rem;
    line-height: 1.28;
    letter-spacing: -0.015em;
    margin: 0 0 10px;
    color: var(--pf-ink);
}

.blog-card p {
    margin: 0 0 18px;
    color: var(--pf-text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card__more {
    margin-top: auto;
    color: var(--pf-red);
    font-weight: 700;
    font-size: 0.95rem;
}

.blog-card__more span {
    display: inline-block;
    transition: transform 0.2s ease;
}

.blog-card:hover .blog-card__more span {
    transform: translateX(4px);
}

/* neuester Beitrag groß */
.blog-featured {
    flex-direction: row;
    margin-bottom: 32px;
}

.blog-featured .blog-card__media {
    flex: 1.25;
    aspect-ratio: auto;
    min-height: 320px;
}

.blog-featured .blog-card__body {
    flex: 1;
    justify-content: center;
    padding: 36px 36px 36px 32px;
}

.blog-featured h3 {
    font-size: clamp(1.5rem, 2.6vw, 2.1rem);
    letter-spacing: -0.025em;
}

.blog-featured p {
    -webkit-line-clamp: 4;
    font-size: 1.04rem;
}

.blog-featured .blog-card__more {
    margin-top: 6px;
}

.blog-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 28px;
}

@media (min-width: 680px) {
    .blog-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1040px) {
    .blog-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 820px) {
    .blog-featured { flex-direction: column; }
    .blog-featured .blog-card__media { min-height: 0; aspect-ratio: 1200 / 630; flex: none; }
    .blog-featured .blog-card__body { padding: 24px; }
}

.blog-follow {
    margin-top: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px 28px;
    padding: 24px 28px;
    border-radius: var(--radius-lg);
    background: var(--pf-bg-light);
    border: 1px solid var(--pf-border);
}

.blog-follow__text {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1 1 340px;
}

.blog-follow__icon {
    flex: none;
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f9a03f 0%, #e1306c 55%, #7f3fbf 100%);
}

.blog-follow__icon svg {
    width: 26px;
    height: 26px;
}

.blog-follow strong {
    display: block;
    color: var(--pf-ink);
}

.blog-follow small {
    color: var(--pf-text-secondary);
    font-size: 0.92rem;
}

/* ---------- Beitrag ---------- */
.post {
    padding-bottom: clamp(48px, 7vw, 96px);
}

.post-head {
    max-width: 820px;
    margin: 0 auto;
    padding: clamp(36px, 5vw, 64px) 0 0;
    text-align: center;
}

.post-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--pf-text-secondary);
    font-weight: 600;
    font-size: 0.92rem;
    text-decoration: none;
    margin-bottom: 26px;
    padding: 7px 14px;
    border: 1px solid var(--pf-border);
    border-radius: var(--radius-pill);
    background: #fff;
    cursor: pointer;
    font-family: inherit;
}

.post-back:hover {
    color: var(--pf-red);
    border-color: var(--pf-red);
}

.post-head .blog-tag {
    margin-bottom: 18px;
}

.post-title {
    font-size: clamp(2.1rem, 5vw, 3.4rem);
    line-height: 1.08;
    letter-spacing: -0.035em;
    font-weight: 800;
    margin: 0 0 18px;
    color: var(--pf-ink);
    text-wrap: balance;
}

.post-lead {
    font-size: clamp(1.08rem, 2vw, 1.28rem);
    line-height: 1.6;
    color: var(--pf-text-secondary);
    max-width: 680px;
    margin: 0 auto 26px;
    text-wrap: pretty;
}

.post-meta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 18px;
    font-size: 0.9rem;
    color: var(--pf-text-secondary);
}

.post-meta__author {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--pf-ink);
}

.post-meta__author img {
    width: 30px;
    height: 30px;
    padding: 4px;
    border-radius: 50%;
    border: 1px solid var(--pf-border);
    background: #fff;
}

.post-meta__dot::before {
    content: "·";
    margin-right: 18px;
    color: var(--pf-border-strong);
}

.post-cover {
    max-width: 1040px;
    margin: clamp(28px, 4vw, 44px) auto 0;
}

.post-cover img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1200 / 630;
    object-fit: cover;
    border-radius: clamp(16px, 2.4vw, 26px);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--pf-border);
}

.post-layout {
    max-width: 1040px;
    margin: clamp(32px, 5vw, 56px) auto 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
}

@media (min-width: 1100px) {
    .post-layout {
        grid-template-columns: 220px minmax(0, 720px);
        justify-content: center;
        gap: 56px;
    }
}

.post-toc {
    display: none;
}

@media (min-width: 1100px) {
    .post-toc.has-items {
        display: block;
        position: sticky;
        top: 104px;
        align-self: start;
        font-size: 0.9rem;
    }
}

.post-toc h4 {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--pf-text-secondary);
    margin: 0 0 14px;
}

.post-toc ol {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 2px solid var(--pf-border);
}

.post-toc a {
    display: block;
    padding: 7px 0 7px 16px;
    margin-left: -2px;
    border-left: 2px solid transparent;
    color: var(--pf-text-secondary);
    text-decoration: none;
    line-height: 1.35;
    font-weight: 500;
}

.post-toc a:hover {
    color: var(--pf-ink);
}

.post-toc a.is-active {
    color: var(--pf-red);
    border-left-color: var(--pf-red);
    font-weight: 600;
}

.post-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #2b2a31;
}

.post-body > :first-child {
    margin-top: 0;
}

.post-body p {
    margin: 0 0 1.3em;
}

.post-body h2 {
    position: relative;
    font-size: clamp(1.45rem, 3vw, 1.85rem);
    line-height: 1.2;
    letter-spacing: -0.025em;
    font-weight: 800;
    color: var(--pf-ink);
    margin: 2.1em 0 0.7em;
    padding-top: 0.9em;
    scroll-margin-top: 100px;
}

.post-body h2::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 4px;
    border-radius: 4px;
    background: var(--pf-red);
}

.post-body h3 {
    font-size: 1.28rem;
    letter-spacing: -0.015em;
    margin: 1.7em 0 0.5em;
    color: var(--pf-ink);
    scroll-margin-top: 100px;
}

.post-body ul {
    list-style: none;
    margin: 0 0 1.4em;
    padding: 0;
}

.post-body ul li {
    position: relative;
    padding-left: 30px;
    margin-bottom: 0.65em;
}

.post-body ul li::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 0.62em;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pf-red);
    box-shadow: 0 0 0 4px var(--pf-red-wash-strong);
}

.post-body strong {
    color: var(--pf-ink);
    font-weight: 700;
}

.post-body a {
    color: var(--pf-red);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
}

.post-body a:hover {
    color: var(--pf-red-deep);
}

.post-body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 2em auto;
    border-radius: 18px;
    border: 1px solid var(--pf-border);
    box-shadow: var(--shadow-md);
}

.post-fig {
    margin: 2em 0;
    text-align: center;
}

.post-fig img {
    margin: 0 auto;
}

.post-fig figcaption {
    margin: 12px auto 0;
    max-width: 560px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--pf-text-secondary);
}

.post-fig--klein img { max-width: min(380px, 100%); }
.post-fig--mittel img { max-width: min(560px, 100%); }

@media (min-width: 1100px) {
    .post-fig--breit {
        width: min(1040px, calc(100vw - 80px));
        margin-left: 50%;
        transform: translateX(-50%);
    }
}

.post-body hr {
    border: 0;
    border-top: 1px solid var(--pf-border);
    margin: 2.4em 0;
}

/* Abschluss: Teilen, Instagram, CTA */
.post-end {
    max-width: 720px;
    margin: clamp(40px, 6vw, 64px) auto 0;
    display: grid;
    gap: 22px;
}

.post-share {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 22px;
    border-top: 1px solid var(--pf-border);
}

.post-share > span {
    font-weight: 700;
    color: var(--pf-ink);
    margin-right: 6px;
}

.post-share a,
.post-share button {
    font: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--pf-text-secondary);
    background: #fff;
    border: 1px solid var(--pf-border-strong);
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.18s ease;
}

.post-share a:hover,
.post-share button:hover {
    color: var(--pf-red);
    border-color: var(--pf-red);
}

.post-cta {
    position: relative;
    overflow: hidden;
    padding: clamp(28px, 4vw, 40px);
    border-radius: var(--radius-lg);
    background: #fff;
    border: 1px solid var(--pf-border);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.post-cta::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(520px 220px at 50% -10%, var(--pf-red-wash-strong), transparent 70%);
    pointer-events: none;
}

.post-cta > * {
    position: relative;
}

.post-cta h3 {
    font-size: clamp(1.35rem, 3vw, 1.7rem);
    letter-spacing: -0.02em;
    margin: 0 0 8px;
}

.post-cta p {
    margin: 0 0 20px;
    color: var(--pf-text-secondary);
}

.post-cta__actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.post-related {
    max-width: 1120px;
    margin: clamp(56px, 8vw, 96px) auto 0;
}

.post-related > h2 {
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    margin: 0 0 22px;
    text-align: center;
}

.post-related .blog-grid {
    grid-template-columns: 1fr;
}

@media (min-width: 680px) {
    .post-related .blog-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1040px) {
    .post-related .blog-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    .blog-card,
    .blog-card__media > img,
    .blog-card__more span,
    .post-progress {
        transition: none;
    }
}
