/*=============== BLOG ===============
  Shared by the home page slider, blog.php and the blog admin preview, so a
  card looks the same everywhere. Self-contained colour tokens; dark theme
  via body.dark-theme like the rest of the site. */

:root {
    --bc-surface: #ffffff;
    --bc-surface-2: #f4f7f5;
    --bc-ink: #13201a;
    --bc-ink-2: #4b5852;
    --bc-muted: #7d8983;
    --bc-line: rgba(19, 32, 26, .08);
    --bc-brand: #2C5E48;
    --bc-brand-soft: hsl(155, 24%, 93%);
    --bc-yellow: #e3e35a;
    --bc-shadow: 0 14px 40px rgba(15, 35, 28, .10);
    --bc-shadow-hover: 0 24px 54px rgba(15, 35, 28, .18);
}

body.dark-theme {
    --bc-surface: #1a201d;
    --bc-surface-2: #202723;
    --bc-ink: #eef2f0;
    --bc-ink-2: #b9c4be;
    --bc-muted: #87938d;
    --bc-line: rgba(255, 255, 255, .07);
    --bc-brand: #6BB596;
    --bc-brand-soft: hsla(155, 30%, 40%, .2);
    --bc-shadow: 0 14px 40px rgba(0, 0, 0, .35);
    --bc-shadow-hover: 0 24px 54px rgba(0, 0, 0, .5);
}

/*=============== CARD ===============*/
.blog-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border-radius: 22px;
    background: var(--bc-surface);
    border: 1px solid var(--bc-line);
    box-shadow: var(--bc-shadow);
    color: var(--bc-ink);
    text-decoration: none;
    transition: transform .4s cubic-bezier(.2, .8, .2, 1), box-shadow .4s ease;
}

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

.blog-card__media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background:
        radial-gradient(circle at 80% 20%, hsla(61, 74%, 63%, .35), transparent 50%),
        linear-gradient(135deg, #2C5E48, hsl(155, 35%, 14%));
}

.blog-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .8s cubic-bezier(.2, .8, .2, 1);
}

a.blog-card:hover .blog-card__media img {
    transform: scale(1.06);
}

.blog-card__media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 55%, rgba(8, 20, 15, .45));
    pointer-events: none;
}

.blog-card__placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 2.4rem;
    color: hsla(0, 0%, 100%, .55);
}

.blog-card__chip {
    position: absolute;
    z-index: 1;
    top: .9rem;
    left: .9rem;
    padding: .3rem .75rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
    color: #102018;
    background: var(--bc-yellow);
}

.blog-card__play {
    position: absolute;
    z-index: 1;
    right: .9rem;
    bottom: .9rem;
    display: grid;
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    font-size: 1.3rem;
    color: #102018;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}

.blog-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: .55rem;
    padding: 1.25rem 1.35rem 1.4rem;
}

.blog-card__meta {
    font-size: .76rem;
    color: var(--bc-muted);
}

.blog-card__title {
    margin: 0;
    font-size: 1.12rem;
    line-height: 1.35;
    color: var(--bc-ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card__excerpt {
    margin: 0;
    font-size: .88rem;
    line-height: 1.6;
    color: var(--bc-ink-2);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card__more {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-top: auto;
    padding-top: .35rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--bc-brand);
}

.blog-card__more i {
    transition: transform .3s ease;
}

a.blog-card:hover .blog-card__more i {
    transform: translateX(4px);
}

/*=============== SLIDER (home page) ===============*/
.blog-slider {
    position: relative;
    margin-top: 2rem;
}

/* Soft fade on the right edge hints that there is more to swipe. */
.blog-slider.has-more::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 4.5rem;
    width: 3.5rem;
    background: linear-gradient(90deg, transparent, var(--body-color, #fff));
    pointer-events: none;
}

.blog-slider__track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: min(86%, 360px);
    gap: 1.25rem;
    /* Room around the cards so the scroll area doesn't clip their shadows */
    padding: 1rem 1rem 2.5rem;
    margin: -1rem -1rem -.75rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 1rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.blog-slider__track::-webkit-scrollbar {
    display: none;
}

.blog-slider__track > * {
    scroll-snap-align: start;
}

.blog-slider__track.is-centered {
    justify-content: center;
}

.blog-slider__bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    margin-top: .25rem;
}

.blog-slider__nav {
    justify-self: end;
}

.blog-slider__all {
    white-space: nowrap;
}

@media screen and (max-width: 560px) {
    .blog-slider__bar {
        grid-template-columns: auto auto;
        grid-template-areas: "dots nav" "all all";
        row-gap: 1rem;
    }

    .blog-slider__dots { grid-area: dots; }
    .blog-slider__nav { grid-area: nav; }
    .blog-slider__all { grid-area: all; justify-self: center; }

    .blog-slider__btn {
        width: 2.5rem;
        height: 2.5rem;
    }
}

.blog-slider__dots {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.blog-slider__dot {
    width: .55rem;
    height: .55rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--bc-line);
    background: color-mix(in srgb, var(--bc-ink) 20%, transparent);
    cursor: pointer;
    transition: width .3s ease, background .3s ease;
}

.blog-slider__dot.is-active {
    width: 1.6rem;
    background: var(--bc-brand);
}

.blog-slider__nav {
    display: flex;
    gap: .5rem;
}

.blog-slider__btn {
    display: grid;
    place-items: center;
    width: 2.9rem;
    height: 2.9rem;
    border-radius: 50%;
    border: 1px solid var(--bc-line);
    background: var(--bc-surface);
    color: var(--bc-ink);
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--bc-shadow);
    transition: background .2s, color .2s, opacity .2s;
}

.blog-slider__btn:hover:not(:disabled) {
    background: var(--bc-brand);
    color: #fff;
}

.blog-slider__btn:disabled {
    opacity: .35;
    cursor: default;
}

.blog-slider__all {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-weight: 600;
    font-size: .9rem;
    color: var(--bc-brand);
}

@media screen and (min-width: 900px) {
    .blog-slider__track {
        grid-auto-columns: calc((100% - 2.5rem) / 3);
    }
}

/*=============== LAYOUT BY POST COUNT ===============
  1 post: one wide card filling the section. 2-3 posts: they share the
  width. 4+: the sliding row above. Phones always swipe one card at a time,
  except a single post, which simply fills the width. */
.blog-slider--n1 .blog-slider__track {
    grid-auto-columns: 100%;
}

@media screen and (min-width: 768px) {
    .blog-slider--n2 .blog-slider__track,
    .blog-slider--n3 .blog-slider__track {
        grid-auto-flow: row;
        overflow: visible;
    }

    .blog-slider--n2 .blog-slider__track {
        grid-template-columns: repeat(2, 1fr);
    }

    .blog-slider--n3 .blog-slider__track {
        grid-template-columns: repeat(3, 1fr);
    }

    /* The single post: photo beside the text */
    .blog-card--wide {
        display: grid;
        grid-template-columns: 1.2fr 1fr;
        min-height: 380px;
    }

    .blog-card--wide .blog-card__media {
        aspect-ratio: auto;
        height: 100%;
    }

    .blog-card--wide .blog-card__body {
        justify-content: center;
        gap: .8rem;
        padding: 2.5rem;
    }

    .blog-card--wide .blog-card__title {
        font-size: clamp(1.4rem, 2.4vw, 1.9rem);
        -webkit-line-clamp: 3;
    }

    .blog-card--wide .blog-card__excerpt {
        font-size: 1rem;
        -webkit-line-clamp: 5;
    }

    .blog-card--wide .blog-card__more {
        margin-top: .75rem;
        align-self: flex-start;
        padding: .7rem 1.2rem;
        border-radius: 999px;
        color: #102018;
        background: var(--bc-yellow);
    }
}

/* With nothing to slide, the bar only holds the "See all" link, centred. */
.blog-slider--n1 .blog-slider__bar {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

@media screen and (min-width: 768px) {
    .blog-slider--n2 .blog-slider__bar,
    .blog-slider--n3 .blog-slider__bar {
        display: flex;
        justify-content: center;
        margin-top: 1rem;
    }
}

/*=============== ARTICLE BODY ===============*/
.post-body {
    font-size: 1.04rem;
    line-height: 1.85;
    color: var(--bc-ink-2);
}

.post-body > * + * {
    margin-top: 1.15em;
}

.post-body h2,
.post-body h3 {
    color: var(--bc-ink);
    line-height: 1.3;
    margin-top: 1.8em;
}

.post-body h2 { font-size: 1.55rem; }
.post-body h3 { font-size: 1.22rem; }

.post-body a {
    color: var(--bc-brand);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.post-body strong {
    color: var(--bc-ink);
}

.post-body ul,
.post-body ol {
    padding-left: 1.4rem;
}

/* styles.css resets list markers site-wide; articles need them back. */
.post-body ul { list-style: disc; }
.post-body ol { list-style: decimal; }

.post-body li + li {
    margin-top: .4em;
}

.post-body ul li::marker {
    color: var(--bc-brand);
}

.post-body blockquote {
    margin-left: 0;
    padding: 1rem 1.25rem;
    border-left: 4px solid var(--bc-yellow);
    border-radius: 0 14px 14px 0;
    background: var(--bc-surface-2);
    font-size: 1.1rem;
    font-style: italic;
    color: var(--bc-ink);
}

.post-body figure {
    margin-left: 0;
    margin-right: 0;
}

.post-body figure img {
    display: block;
    width: 100%;
    border-radius: 16px;
}

.post-body figcaption {
    margin-top: .5rem;
    font-size: .82rem;
    text-align: center;
    color: var(--bc-muted);
}

.post-video {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 16px;
    background: #000;
}

.post-video iframe,
.post-video video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {
    .blog-card, .blog-card__media img, .blog-card__more i {
        transition: none;
    }

    .blog-slider__track {
        scroll-behavior: auto;
    }
}

.blog-card [hidden],
.blog-slider [hidden] {
    display: none !important;
}
