/* --- Blog engagement: toolbar, sorting, and hearts --- */

/* --- Toolbar: quiet editorial header above the grid --- */
.blog-toolbar {
    align-items: flex-end;
    border-bottom: 1px solid #e8e2d5;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 2.5rem;
    justify-content: space-between;
    margin: 0 auto 3rem;
    max-width: 1200px;
    padding-bottom: 1.75rem;
}

.blog-toolbar h2 {
    font-size: clamp(1.7rem, 2.6vw, 2.3rem);
    line-height: 1.2;
    margin: 0;
    text-align: left;
}

.blog-toolbar-copy {
    min-width: 0;
}

.blog-toolbar-eyebrow {
    color: var(--color-primary);
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

/* --- Sort: soft segmented control --- */
.blog-sort {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    gap: 0.85rem;
    padding-bottom: 0.2rem;
}

.blog-sort-label {
    color: #85806f;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
}

.blog-sort-options {
    background: #f1ede4;
    border: 1px solid #e8e2d5;
    border-radius: 999px;
    display: flex;
    padding: 0.25rem;
}

.blog-sort-button {
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: #6f6a5f;
    cursor: pointer;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    min-height: 40px;
    padding: 0.45rem 1.15rem;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.blog-sort-button:hover {
    color: var(--color-primary);
}

.blog-sort-button.active {
    background: #fff;
    box-shadow: 0 1px 4px rgba(42, 50, 75, 0.14);
    color: var(--color-primary);
}

.blog-sort-button:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* --- Card footer: read link + heart --- */
.blog-card-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    justify-content: space-between;
    margin-top: auto;
}

.blog-card .blog-card-actions .btn-text {
    margin-top: 0;
}

/* --- Heart button --- */
.blog-like-button {
    align-items: center;
    background: #fff;
    border: 1px solid #e3dccd;
    border-radius: 999px;
    color: #6f6a5f;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    font: inherit;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    gap: 0.45rem;
    justify-content: center;
    line-height: 1;
    min-height: 44px;
    min-width: 64px;
    padding: 0.5rem 1rem;
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.blog-like-button:hover {
    background: #fdf5f1;
    border-color: rgba(231, 111, 81, 0.45);
    box-shadow: 0 2px 10px rgba(231, 111, 81, 0.14);
}

.blog-like-button[aria-pressed="true"] {
    background: #fcefe9;
    border-color: rgba(231, 111, 81, 0.4);
    color: #ad4326;
}

.blog-like-button:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.blog-like-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.blog-heart-icon {
    fill: none;
    height: 1.1em;
    stroke: var(--color-accent);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    transition: fill 0.25s ease;
    width: 1.1em;
}

.blog-like-button[aria-pressed="true"] .blog-heart-icon {
    fill: var(--color-accent);
}

.blog-heart-pop {
    animation: blog-heart-pop 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

@keyframes blog-heart-pop {
    0% { transform: scale(1); }
    30% { transform: scale(1.35); }
    60% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* --- Article page placement --- */
.article-engagement {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin: 0 auto 2.25rem;
    max-width: 800px;
}

.article-like-caption {
    color: #85806f;
    font-size: 0.95rem;
    margin: 0;
}

/* --- Screen-reader-only live region --- */
.blog-engagement-status {
    border: 0;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

@media (max-width: 700px) {
    .blog-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 1.25rem;
    }

    .blog-sort {
        align-items: stretch;
        flex-direction: column;
        gap: 0.6rem;
        padding-bottom: 0;
    }

    .blog-sort-options {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .blog-sort-button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .blog-like-button,
    .blog-sort-button,
    .blog-heart-icon {
        transition: none;
    }

    .blog-heart-pop {
        animation: none;
    }
}
