/* Blog: /blog/, /blog/kategorie/<slug>/ and /blog/<id>/<slug> (blog/*.php,
   rendered by blog/blog_setup.inc). Loaded only there, after styles.css.
   The index and category pages use the product-hero grid (css/scenes.css)
   with the blog drawing (inc/scenes/blog.php); posts end like every other
   page, with the booking CTA. */

/* Each category keeps one site tint (card cover, chips, a post's header
   band) and an accent for small marks only, never for text. A post without
   a known category gets the lavender pair. */
[data-cat] {
    --cat-tint: var(--lavender);
    --cat-accent: var(--blue);
}

[data-cat="module"] {
    --cat-tint: var(--blush);
    --cat-accent: var(--peach);
}

[data-cat="produkt-updates"] {
    --cat-tint: var(--paper);
    --cat-accent: #D9A93A; /* gold_500 of the drawings' palette */
}

[data-cat="praxis"] {
    --cat-tint: var(--rose);
    --cat-accent: #FF2A6F; /* the Hilfswerk accent, css/scenes.css */
}

/* ------------------------------------------------------------------ hero */

/* Compact: the posts are what people came for. The drawing is smaller than
   on the product pages and sits at the row's right edge. */
.blog-hero {
    padding-bottom: clamp(2.5rem, 5vw, 3.5rem);
}

.blog-hero .product-hero-art {
    max-width: 320px;
}

@media (min-width: 900px) {
    .blog-hero .product-hero-split {
        grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    }

    .blog-hero .product-hero-art {
        justify-self: end;
        width: 100%;
        max-width: 430px;
    }
}

/* Category chips: the filter row in the hero. */
.blog-categories {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1.75rem;
}

.blog-chip,
.blog-cat {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    border-radius: var(--radius-pill);
    color: var(--ink-2);
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
}

.blog-chip {
    padding: .5rem .9rem;
    background: var(--cat-tint, var(--white));
    border: 1px solid var(--line);
    font-size: .9rem;
    transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}

.blog-chip:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.blog-chip.is-active,
.blog-chip.is-active:hover {
    background: var(--blue);
    border-color: var(--blue);
    color: var(--white);
}

/* The category label on a card and above a post's title. */
.blog-cat {
    padding: .3rem .7rem;
    background: var(--cat-tint);
    font-size: .85rem;
}

.blog-chip[data-cat]::before,
.blog-cat::before {
    content: "";
    flex: none;
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    background: var(--cat-accent);
}

.blog-chip.is-active::before {
    background: var(--white);
}

/* ----------------------------------------------------------------- cards */

/* One column, two from 768 px. blog_setup.inc marks the lead card and a
   card left alone in the last row as --wide: it takes the whole row, cover
   on the left, text on the right. */
.blog-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .blog-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .blog-card--wide {
        display: grid;
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    }
}

/* The whole card is the link (the title link's ::after covers it), with
   the focus ring on the card, as on the homepage "Für wen" cards. */
.blog-card {
    position: relative;
    overflow: hidden;
    padding: 0;
}

.blog-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2);
}

.blog-card:focus-within {
    outline: 3px solid var(--navy);
    outline-offset: 2px;
}

.blog-card-link {
    color: inherit;
    text-decoration: none;
}

.blog-card-link::after {
    content: "";
    position: absolute;
    inset: 0;
}

.blog-card-link:focus-visible {
    outline: none;
}

/* The cover is shown whole, never cropped: contained in a 16:9 panel on
   the category tint. Most covers are drawings on white, which multiply
   into the tint instead of sitting on it as a white box. The clip keeps a
   tall image from stretching the panel: an aspect-ratio box otherwise
   grows to its content. */
.blog-card-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    padding: clamp(.75rem, 4%, 1.25rem);
    background: var(--cat-tint);
    border-bottom: 1px solid var(--line);
}

.blog-card-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.blog-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: .6rem;
    padding: 1.25rem 1.5rem 1.5rem;
}

.blog-card-title {
    margin: .15rem 0 0;
    font-size: 1.3rem;
    line-height: 1.25;
    letter-spacing: -.01em;
}

.blog-card-date {
    margin: 0;
    font-size: .9rem;
    font-weight: 500;
    color: var(--ink-3);
}

.blog-card-summary {
    margin: .2rem 0 0;
    color: var(--ink-2);
    line-height: 1.6;
}

/* Beside the text the cover takes the row's height: a grid item with an
   aspect-ratio would not stretch and leave a strip under it. */
@media (min-width: 768px) {
    .blog-card--wide .blog-card-cover {
        aspect-ratio: auto;
        min-height: clamp(14rem, 28vw, 22rem);
        border-bottom: 0;
        border-right: 1px solid var(--line);
    }

    .blog-card--wide .blog-card-body {
        justify-content: center;
        padding: clamp(1.5rem, 3vw, 2.5rem);
    }

    .blog-card--wide .blog-card-title {
        font-size: clamp(1.5rem, 2.4vw, 2rem);
        line-height: 1.15;
    }
}

@media (max-width: 480px) {
    .blog-card-title {
        font-size: clamp(1.1rem, 5.4vw, 1.3rem);
    }
}

.blog-empty {
    margin: 0;
    color: var(--ink-2);
}

.blog-rss {
    margin: 2.5rem 0 0;
}

.blog-rss a {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-weight: 600;
    text-decoration: none;
}

.blog-rss a:hover {
    text-decoration: underline;
}

.blog-rss img {
    width: 1.25rem;
    height: 1.25rem;
}

/* ------------------------------------------------------------------ post */

/* Header band on the post's category tint: category, title, byline. */
.blog-post-hero {
    padding: calc(var(--header-h) + clamp(2.5rem, 5vw, 4rem)) 0 clamp(2.5rem, 5vw, 3.5rem);
    background: var(--cat-tint);
}

.blog-post-hero .blog-cat {
    background: var(--white);
}

a.blog-cat:hover {
    color: var(--blue);
}

.blog-post-title {
    max-width: 24ch;
    margin: 1.1rem 0 1.5rem;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.1;
}

@media (max-width: 480px) {
    .blog-post-title {
        font-size: clamp(1.35rem, 6.8vw, 2rem);
    }
}

.blog-byline {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 0;
    font-size: .95rem;
    color: var(--ink-2);
}

.blog-byline img {
    flex: none;
    width: 2.75rem;
    height: 2.75rem;
}

.blog-byline > span {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
}

.blog-byline-author {
    font-weight: 700;
    color: var(--ink);
}

/* The text: left on the container's edge like every other page, at
   reading width (§4: 62ch). */
.blog-post-body {
    padding-block: clamp(2.5rem, 5vw, 3.5rem) var(--space-section);
}

.blogtext {
    max-width: 62ch;
    font-size: 1.0625rem;
    line-height: 1.7;
    /* Sources sections carry bare URLs with no break points — without this
       they push the page wider than a phone viewport. */
    overflow-wrap: break-word;
}

.blogtext > :first-child {
    margin-top: 0;
}

.blogtext img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-m);
}

.blogtext em {
    font-weight: 600; /* Sora has no italic: no faux slant */
    font-style: normal;
}

.blogtext p {
    margin: 1.1rem 0;
}

.blogtext h1,
.blogtext h2 {
    margin: 2.75rem 0 .75rem;
    font-size: clamp(1.35rem, 2.6vw, 1.75rem);
    line-height: 1.2;
    letter-spacing: -.015em;
}

.blogtext h3 {
    margin: 2.25rem 0 .5rem;
    font-size: 1.25rem;
}

.blogtext h4 {
    margin: 2rem 0 .5rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.blogtext :is(ul, ol) {
    padding-left: 1.25rem;
}

.blogtext li + li {
    margin-top: .4rem;
}

/* An aside in a post is a markdown quote ("> …"): safe mode shows raw
   <div style> blocks as text. Drawn as a note on the category tint. */
.blogtext blockquote {
    margin: 1.75rem 0;
    padding: .25rem 1.25rem;
    background: var(--cat-tint);
    border-left: 4px solid var(--cat-accent);
    border-radius: 0 var(--radius-s) var(--radius-s) 0;
    color: var(--ink-2);
}

.blogtext code {
    padding: .1em .3em;
    background: var(--paper);
    border-radius: 4px;
    font-size: .9em;
}

.blog-related .section-title {
    margin-bottom: 2rem;
}

@media (prefers-reduced-motion: reduce) {
    .blog-card,
    .blog-chip {
        transition: none;
    }

    .blog-card:hover {
        transform: none;
    }
}
