/*
 * Public blog: the list (/blogs, templates/Blogs/index.php) and a post
 * (/blogs/{slug}, templates/Blogs/view.php). Colours, type and spacing come from site.css.
 */

/* ---------- List ---------- */

.blog-list {
    padding: var(--space-7) 0 var(--space-9);
}

/* Header box: badge, title, text, category filters (lined like the site's other boxes). */
.blog-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: var(--space-8);
    padding: var(--space-9) var(--space-6) var(--space-8);
    border: 0.7px solid var(--color-border);
    background: linear-gradient(180deg, var(--color-brand-soft) 0%, var(--color-surface) 100%);
    text-align: center;
}

.blog-hero__mosaic {
    position: absolute;
    top: 0;
    right: 0;
    width: auto;
    height: 150px;
    opacity: 0.9;
    pointer-events: none;
}

.blog-hero__badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.blog-hero__badge .icon {
    width: 14px;
    height: 14px;
    color: var(--color-brand);
}

.blog-hero__title {
    position: relative;
    max-width: 640px;
    margin: var(--space-4) auto 0;
}

.blog-hero__description {
    position: relative;
    max-width: 560px;
    margin: var(--space-4) auto 0;
    color: var(--color-text-desc);
}

.blog-filters {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: var(--space-7);
}

.blog-filter {
    padding: 8px 16px;
    border: 0.7px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.blog-filter:hover {
    border-color: #cfd0f5;
    background: var(--color-brand-soft);
}

.blog-filter.is-active {
    border-color: var(--color-dark);
    background: var(--color-dark);
    color: var(--color-dark-text);
}

/* Featured (newest) post: image left, text right. */
.blog-featured-slot {
    margin-bottom: 36px;
}

.blog-featured {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    background: var(--color-surface);
    color: inherit;
    text-decoration: none;
    transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.blog-featured:hover {
    box-shadow: 0 8px 28px rgba(17, 17, 17, 0.14);
}

.blog-featured__image {
    position: relative;
    display: block;
    min-height: 340px;
    overflow: hidden;
    background: var(--color-brand-soft);
}

.blog-featured__image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.blog-featured__body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px 44px;
}

.blog-featured__label {
    align-self: flex-start;
    margin-bottom: 16px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--color-highlight-soft);
    color: #3f5212;
    font-size: var(--fs-caption);
    font-weight: var(--fw-semibold);
}

.blog-featured__title {
    margin-top: 10px;
    color: var(--color-text);
    font-size: 30px;
    font-weight: var(--fw-semibold);
    line-height: 1.3;
}

.blog-featured__excerpt {
    display: -webkit-box;
    margin-top: 14px;
    overflow: hidden;
    color: #4b4b4b;
    font-size: var(--fs-body);
    line-height: 1.6;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
}

/* Grid of cards */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px;
    transition: opacity 0.2s ease;
}

.blog-grid.is-loading {
    opacity: 0.6;
}

/* Card: the whole card is a link to the post */
.blog-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    background: var(--color-surface);
    color: inherit;
    text-decoration: none;
    transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

/* Hover: only a soft shadow around the card (as on the previous website). */
a.blog-card:hover {
    box-shadow: 0 8px 28px rgba(17, 17, 17, 0.14);
}

.blog-card__image {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9.5;
    overflow: hidden;
    background: var(--color-brand-soft);
}

.blog-card__image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Category, before the date */
.blog-card__tag {
    margin-right: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--color-brand-soft);
    color: var(--color-brand);
    font-size: var(--fs-caption);
    font-weight: var(--fw-semibold);
}

.blog-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 22px 24px 22px;
}

.blog-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    color: var(--color-text-secondary);
    font-size: var(--fs-caption);
    font-weight: var(--fw-medium);
}

.blog-card__dot {
    color: #c4c4c4;
}

.blog-card__title {
    display: -webkit-box;
    margin-top: 10px;
    overflow: hidden;
    color: var(--color-text);
    font-size: 20px;
    font-weight: var(--fw-semibold);
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    transition: color 0.2s ease;
}

.blog-card__excerpt {
    display: -webkit-box;
    margin-top: 10px;
    overflow: hidden;
    color: #4b4b4b;
    font-size: var(--fs-ui);
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3; /* at most 3 lines, then "…" */
    line-clamp: 3;
}

/* Author (initials) and "Read article ->" along the bottom */
.blog-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 20px;
}

.blog-card__author {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--color-text);
    font-size: var(--fs-small);
    font-weight: var(--fw-medium);
}

.blog-card__avatar {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--color-brand-soft);
    color: var(--color-brand);
    font-size: 11px;
    font-weight: var(--fw-semibold);
}

.blog-card__more {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
    color: var(--color-brand);
    font-size: var(--fs-small);
    font-weight: var(--fw-semibold);
}

.blog-card__more .icon {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.2s ease;
}

.blog-featured__body .blog-card__foot {
    margin-top: 28px;
}

/* Loading placeholders */
.blog-card--loading .blog-card__image,
.blog-featured--loading .blog-featured__image,
.blog-skeleton {
    background: linear-gradient(90deg, #f1f1f3 0%, #f8f8fa 50%, #f1f1f3 100%);
    background-size: 200% 100%;
    animation: blog-shimmer 1.4s linear infinite;
}

.blog-skeleton {
    display: block;
    width: 100%;
    height: 14px;
    margin-top: 14px;
    border-radius: 6px;
}

.blog-skeleton--title {
    width: 85%;
    height: 22px;
}

.blog-skeleton--short {
    width: 40%;
    margin-top: 0;
}

@keyframes blog-shimmer {
    to {
        background-position: -200% 0;
    }
}

.blog-list__state {
    margin: 0;
    padding: var(--space-8) 0;
    color: var(--color-text-secondary);
    text-align: center;
}

/* Page numbers, as on the previous website: « Previous 1 2 3 … Next » as plain text,
   the current page in the brand colour. */
.blog-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 6px;
    margin-top: var(--space-8);
}

.blog-pager__button {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #6b6b6b;
    font: inherit;
    font-size: var(--fs-body);
    font-weight: var(--fw-semibold);
    cursor: pointer;
    transition: color 0.15s ease;
}

.blog-pager__button:hover:not(:disabled) {
    color: var(--color-text);
}

.blog-pager__button.is-current {
    color: var(--color-brand);
    cursor: default;
}

.blog-pager__button--wide {
    padding: 0 14px;
}

/* « Previous on the first page, Next » on the last */
.blog-pager__button:disabled:not(.is-current) {
    opacity: 0.45;
    cursor: default;
}

/* ---------- Post (as the Hiree365 blog post): title band, then article + Recent Posts ---------- */

.blog-post {
    padding-bottom: var(--space-9);
}

/* Title band */

.blog-post__hero {
    padding: 72px 0;
    background: var(--color-brand-soft);
    text-align: center;
}

.blog-post__hero-title {
    max-width: 1300px;
    margin: 0 auto;
    color: var(--color-brand);
    font-size: 52px;
    font-weight: var(--fw-medium);
    letter-spacing: -0.01em;
    line-height: 1.15;
}

/* Article 70%, Recent Posts 30% */

.blog-post__layout {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
    align-items: start;
    gap: 32px;
    max-width: 1360px;
    padding-top: 64px;
}

.blog-post__main {
    min-width: 0;
}

.blog-post__cover {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
}

/* Author / date / category between two thin lines, as on classe365.com */

.blog-post__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin-top: 32px;
    padding: 30px 0;
    border-top: 1px solid #F0F0F0;
    border-bottom: 1px solid #F0F0F0;
    color: var(--color-text-secondary);
    font-size: var(--fs-body);
    font-weight: var(--fw-semibold);
}

.blog-post__meta > span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.blog-post__meta .icon {
    width: 18px;
    height: 18px;
}

.blog-post__title {
    margin: 0 0 36px;
    padding: 35px 0;
    border-bottom: 1px solid #F0F0F0;
    color: var(--color-text);
    font-size: 34px;
    font-weight: var(--fw-bold);
    letter-spacing: -0.015em;
    line-height: 1.25;
}

/* Article content (editor HTML) */

.blog-content {
    color: #333;
    font-size: 17px;
    line-height: 1.8;
    overflow-wrap: break-word;
}

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

.blog-content p {
    margin: 0 0 20px;
}

.blog-content :is(h1, h2, h3, h4, h5, h6) {
    margin: 40px 0 16px;
    color: var(--color-text);
    font-weight: var(--fw-semibold);
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.blog-content :is(h1, h2) {
    font-size: 30px;
}

.blog-content h3 {
    font-size: 23px;
}

.blog-content :is(h4, h5, h6) {
    font-size: 19px;
}

.blog-content :is(ul, ol) {
    margin: 0 0 20px;
    padding-left: 24px;
}

.blog-content li {
    margin-bottom: 8px;
}

.blog-content li::marker {
    color: var(--color-brand);
}

.blog-content a {
    color: var(--color-brand);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.blog-content strong {
    color: var(--color-text);
}

.blog-content blockquote {
    margin: 28px 0;
    padding: 18px 22px;
    border-left: 4px solid var(--color-brand);
    border-radius: 0 12px 12px 0;
    background: var(--color-brand-soft);
    font-style: italic;
}

.blog-content hr {
    margin: 36px 0;
    border: 0;
    border-top: 1px solid var(--color-border);
}

.blog-content code {
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--color-surface-muted);
    font-size: 15px;
}

/* Images on their own line (no text beside them), as in the admin preview. */

.blog-content img {
    display: block;
    float: none;
    max-width: 100%;
    height: auto;
    margin: 28px 0;
    border-radius: 12px;
}

/* Tables: full width (whatever width came with pasted content) */

.blog-content table {
    width: 100% !important;
    margin: 28px 0;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    border-collapse: separate !important;
    border-spacing: 0;
    font-size: 15px;
    line-height: 1.5;
}

.blog-content td,
.blog-content th {
    padding: 12px 16px;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    vertical-align: top;
}

.blog-content tr > :last-child {
    border-right: 0;
}

.blog-content tr:last-child > * {
    border-bottom: 0;
}

.blog-content th,
.blog-content thead td {
    background: var(--color-surface-muted);
    color: var(--color-text);
    font-weight: var(--fw-semibold);
}

/* Previous / next post (bottom of the article card) */

.blog-post__nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 40px;
    padding-top: 28px;
    border-top: 1px solid #E6E8EC;
}

.blog-post__nav-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 16px 20px;
    border: 1px solid #E6E8EC;
    border-radius: 14px;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.blog-post__nav-link:hover {
    border-color: #C7C9F6;
    box-shadow: 0 8px 24px -12px rgba(91, 95, 214, 0.45);
}

.blog-post__nav-link--next {
    text-align: right;
}

.blog-post__nav-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--color-brand);
    font-size: 11px;
    font-weight: var(--fw-bold);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.blog-post__nav-link--next .blog-post__nav-label {
    justify-content: flex-end;
}

.blog-post__nav-label .icon {
    width: 14px;
    height: 14px;
    transition: transform 0.15s ease;
}

.blog-post__nav-link--prev:hover .blog-post__nav-label .icon {
    transform: translateX(-3px);
}

.blog-post__nav-link--next:hover .blog-post__nav-label .icon {
    transform: translateX(3px);
}

.blog-post__nav-title {
    display: -webkit-box;
    overflow: hidden;
    color: var(--color-text);
    font-size: 13px;
    font-weight: var(--fw-semibold);
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.blog-post__nav-link:hover .blog-post__nav-title {
    color: var(--color-brand);
}

/* Recent Posts: a plain list beside the article */

.blog-post__side {
    /* Stays at the top of the blog content (beside the cover); scrolls with the page. */
    padding-top: 4px;
}

.blog-post__side-title {
    margin: 0 0 20px;
    color: var(--color-text);
    font-size: 21px;
    font-weight: var(--fw-semibold);
}

.blog-post__side-empty {
    margin: 0;
    color: var(--color-text-secondary);
}

.blog-recent {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 0;
    padding-left: 18px;
    list-style: disc;
}

.blog-recent li::marker {
    color: #4A5468;
}

.blog-recent a {
    color: #4A5468;
    font-size: var(--fs-ui);
    line-height: 1.6;
    text-decoration: none;
}

.blog-recent a:hover {
    color: var(--color-brand);
}

/* ---------- Responsive (one block per screen size, widest first) ---------- */

@media (max-width: 1024px) {
    /* ---------- Smaller screens ---------- */

    .blog-post__layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .blog-post__side {
        padding-top: 32px;
        border-top: 1px solid var(--color-border);
    }

    .blog-post__hero-title {
        font-size: 40px;
    }

    .blog-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 24px;
    }

    .blog-featured {
        grid-template-columns: minmax(0, 1fr);
    }

    .blog-featured__image {
        min-height: 0;
        aspect-ratio: 16 / 8;
    }

    .blog-featured__body {
        padding: 28px 28px 30px;
    }

    .blog-featured__title {
        font-size: 26px;
    }

    .blog-hero__mosaic {
        display: none;
    }
}

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

    .blog-card__title {
        font-size: 18px;
    }

    .blog-hero {
        padding: var(--space-8) var(--space-4) var(--space-7);
    }

    .blog-filters {
        flex-wrap: nowrap;
        justify-content: flex-start;
        margin-inline: calc(-1 * var(--space-4));
        padding-inline: var(--space-4);
        overflow-x: auto;
        scrollbar-width: none;
    }

    .blog-filter {
        flex-shrink: 0;
    }

    .blog-featured__body {
        padding: 22px 20px 24px;
    }

    .blog-featured__title {
        font-size: 22px;
    }

    .blog-pager__button--wide {
        padding: 0 8px;
    }

    .blog-post__hero {
        padding: 40px 0;
    }

    .blog-post__hero-title {
        font-size: 30px;
    }

    .blog-post__layout {
        padding-top: 32px;
    }

    .blog-post__title {
        margin-bottom: 28px;
        padding: 24px 0;
        font-size: 26px;
    }

    .blog-content {
        font-size: 16px;
    }

    .blog-content table {
        display: block;
        overflow-x: auto;
    }

    .blog-post__nav {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .blog-card,
    .blog-featured,
    .blog-card__image img,
    .blog-featured__image img,
    .blog-skeleton,
    .blog-card--loading .blog-card__image,
    .blog-featured--loading .blog-featured__image {
        animation: none;
        transition: none;
    }
}
