/**
 * Allegory Blog Filter – Frontend Styles
 * Studio Allegory Corporate Design v1.0
 *
 * Colors: Teal #005555 / Orange #fd5901 / Nunito Sans
 * All values hardcoded per CI – no CSS custom properties for design tokens.
 * Only layout variables (columns) are dynamic via inline <style>.
 *
 * @version 1.0.0
 */

/* ═══════════════════════════════════════════════════
   BASE CONTAINER
   ═══════════════════════════════════════════════════ */

.sab {
    --sab-columns: 3;
    --sab-mobile-columns: 1;
    --sab-tablet-columns: 2;

    font-family: "Nunito Sans", "Segoe UI", system-ui, sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.6;
    color: #333333;
    background: transparent;
    box-sizing: border-box;
}

.sab *, .sab *::before, .sab *::after {
    box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════
   HEADER: FILTER + SEARCH
   ═══════════════════════════════════════════════════ */

.sab__header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.sab__filters {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 10px;
}

.sab-filter-select {
    padding: 10px 16px;
    border: 1px solid #cccccc;
    border-radius: 6px;
    font-size: 16px;
    font-family: "Nunito Sans", sans-serif;
    min-width: 180px;
    background: #ffffff;
    color: #333333;
    cursor: pointer;
    transition: border-color 0.2s;
}

.sab-filter-select:focus {
    outline: none;
    border-color: #005555;
    box-shadow: 0 0 0 2px rgba(0, 85, 85, 0.15);
}

.sab-clear-btn {
    padding: 10px 20px;
    border: none;
    background: #005555;
    color: #ffffff;
    border-radius: 6px;
    font-size: 14px;
    font-family: "Nunito Sans", sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: background-color 0.2s;
}

.sab-clear-btn:hover {
    background: #007070;
}

/* Search */
.sab__search {
    position: relative;
    flex-shrink: 0;
}

.sab-search-input {
    padding: 10px 40px 10px 16px;
    border: 1px solid #cccccc;
    border-radius: 6px;
    font-size: 16px;
    font-family: "Nunito Sans", sans-serif;
    min-width: 260px;
    background: #ffffff;
    color: #333333;
    transition: border-color 0.2s;
}

.sab-search-input:focus {
    outline: none;
    border-color: #005555;
    box-shadow: 0 0 0 2px rgba(0, 85, 85, 0.15);
}

.sab-search-input::placeholder {
    color: #666666;
}

.sab-search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #666666;
    pointer-events: none;
}

/* ═══════════════════════════════════════════════════
   CATEGORY BADGES
   ═══════════════════════════════════════════════════ */

.sab-badge {
    display: inline-block;
    padding: 5px 10px;
    background: #fd5901;
    color: #ffffff;
    font-size: 12px;
    font-family: "Nunito Sans", sans-serif;
    font-weight: 700;
    text-decoration: none;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.4;
}

.sab-badge--sm {
    padding: 3px 8px;
    font-size: 11px;
}

/* ═══════════════════════════════════════════════════
   FEATURED POST
   ═══════════════════════════════════════════════════ */

.sab__featured {
    margin-bottom: 40px;
}

.sab__featured.sab-featured--hidden,
.sab__featured-mobile.sab-featured--hidden {
    display: none !important;
}

/* Mobile featured: hidden by default, shown at 576px */
.sab__featured-mobile {
    display: none;
    margin-bottom: 40px;
}

.sab-featured {
    display: grid;
    gap: 0;
    background: #ffffff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 85, 85, 0.08);
}

/* Layout: Image Left 50/50 */
.sab__featured--image-left-50 .sab-featured {
    grid-template-columns: 1fr 1fr;
}

/* Layout: Image Left 2/3 */
.sab__featured--image-left-66 .sab-featured {
    grid-template-columns: 2fr 1fr;
}

/* Layout: Full Width */
.sab__featured--full-width .sab-featured {
    grid-template-columns: 1fr;
}

/* Featured Image */
.sab-featured__image {
    display: block;
    overflow: hidden;
    min-height: 280px;
}

.sab-featured__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.sab-featured__image:hover img {
    transform: scale(1.03);
}

/* Featured Content */
.sab-featured__content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 32px;
}

.sab-featured__categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.sab-featured__title {
    margin: 0 0 12px;
    font-family: "Nunito Sans", sans-serif;
    font-weight: 900;
    font-size: 32px;
    line-height: 1.2;
    color: #1a1a1a;
}

.sab-featured__title a {
    color: #1a1a1a;
    text-decoration: none;
    transition: color 0.2s;
}

.sab-featured__title a:hover {
    color: #005555;
}

.sab-featured__excerpt {
    color: #333333;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.sab-featured__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    font-size: 13px;
    color: #666666;
    margin-bottom: 20px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.sab-featured__meta .sab-meta__sep {
    margin: 0 10px;
}

.sab-featured__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #005555;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    transition: color 0.2s;
}

.sab-featured__link:hover {
    color: #007070;
}

.sab-featured__link svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.sab-featured__link:hover svg {
    transform: translateX(4px);
}

/* ═══════════════════════════════════════════════════
   GRID & CARDS
   ═══════════════════════════════════════════════════ */

.sab__grid {
    display: grid;
    grid-template-columns: repeat(var(--sab-columns), 1fr);
    gap: 28px;
}

.sab-card {
    background: #ffffff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 85, 85, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    animation: sabFadeIn 0.4s ease;
}

.sab-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 85, 85, 0.12);
}

@keyframes sabFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Card Image */
.sab-card__image {
    display: block;
    height: 200px;
    overflow: hidden;
}

.sab-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.sab-card__image:hover img {
    transform: scale(1.05);
}

.sab-card__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: #edf5f5;
    color: #666666;
}

.sab-card__placeholder svg {
    width: 48px;
    height: 48px;
}

/* Card Content */
.sab-card__content {
    padding: 20px;
}

.sab-card__categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.sab-card__title {
    margin: 0 0 8px;
    font-family: "Nunito Sans", sans-serif;
    font-weight: 900;
    font-size: 20px;
    line-height: 1.3;
}

.sab-card__title a {
    color: #1a1a1a;
    text-decoration: none;
    transition: color 0.2s;
}

.sab-card__title a:hover {
    color: #005555;
}

.sab-card__excerpt {
    color: #333333;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 12px;
}

.sab-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    font-size: 13px;
    color: #666666;
    margin-top: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.sab-card__meta .sab-meta__sep {
    margin: 0 10px;
}

/* Card Read More */
.sab-card__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    color: #005555;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    transition: color 0.2s;
}

.sab-card__link:hover {
    color: #007070;
}

.sab-card__link svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s;
}

.sab-card__link:hover svg {
    transform: translateX(4px);
}

/* ═══════════════════════════════════════════════════
   LOAD MORE & LOADING
   ═══════════════════════════════════════════════════ */

.sab__load-more {
    text-align: center;
    margin-top: 40px;
}

.sab-load-more-btn {
    padding: 14px 28px;
    border: 2px solid #005555;
    background: transparent;
    color: #005555;
    font-size: 16px;
    font-family: "Nunito Sans", sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.sab-load-more-btn:hover {
    background: #005555;
    color: #ffffff;
}

.sab-load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sab__loading {
    text-align: center;
    padding: 40px;
}

.sab-spinner {
    display: inline-block;
    width: 36px;
    height: 36px;
    border: 3px solid #edf5f5;
    border-top-color: #005555;
    border-radius: 50%;
    animation: sabSpin 0.8s linear infinite;
}

@keyframes sabSpin {
    to { transform: rotate(360deg); }
}

.sab__no-results {
    text-align: center;
    padding: 60px 20px;
    color: #666666;
    font-size: 18px;
}

/* ═══════════════════════════════════════════════════
   SINGLE POST EMBED
   ═══════════════════════════════════════════════════ */

.sab-single-post {
    font-family: "Nunito Sans", sans-serif;
    color: #333333;
}

.sab-single-post .sab-card {
    max-width: 100%;
}

.sab-single-post--horizontal .sab-card {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 0;
}

.sab-single-post--horizontal .sab-card__image {
    height: 100%;
    min-height: 200px;
}

.sab-single-post--compact .sab-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #edf5f5;
}

.sab-single-post--compact .sab-card__image {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    border-radius: 6px;
}

.sab-single-post--compact .sab-card__content {
    padding: 0;
}

.sab-single-post--compact .sab-card__title {
    font-size: 18px;
    margin-bottom: 4px;
}

.sab-single-post--compact .sab-card__excerpt {
    display: none;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE – Tablet (≤ 992px)
   ═══════════════════════════════════════════════════ */

@media (max-width: 992px) {
    .sab__grid {
        grid-template-columns: repeat(var(--sab-tablet-columns), 1fr);
    }

    /* Featured goes full width on tablet */
    .sab__featured--image-left-50 .sab-featured,
    .sab__featured--image-left-66 .sab-featured {
        grid-template-columns: 1fr;
    }

    .sab-featured__title {
        font-size: 28px;
    }

    .sab-single-post--horizontal .sab-card {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE – Mobile (≤ 576px)
   ═══════════════════════════════════════════════════ */

@media (max-width: 576px) {
    .sab {
        font-size: 16px;
    }

    /* Hide desktop featured, show mobile card version */
    .sab__featured {
        display: none !important;
    }

    .sab__featured-mobile {
        display: block;
    }

    .sab__grid {
        grid-template-columns: repeat(var(--sab-mobile-columns), 1fr);
    }

    .sab-card__image {
        height: 180px;
    }

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

    .sab__header {
        flex-direction: column;
        align-items: stretch;
    }

    .sab__filters {
        flex-direction: column;
        width: 100%;
    }

    .sab-filter-select {
        width: 100%;
        min-width: auto;
        font-size: 16px; /* Prevents iOS zoom */
    }

    .sab-clear-btn {
        width: 100%;
    }

    .sab-search-input {
        width: 100%;
        min-width: auto;
        font-size: 16px; /* Prevents iOS zoom */
    }

    .sab-single-post--horizontal .sab-card {
        grid-template-columns: 1fr;
    }

    .sab-single-post--compact .sab-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .sab-single-post--compact .sab-card__image {
        width: 100%;
        height: 150px;
    }
}
