/* =========================================================
   SUPERBASE — CARDS
   Shared by index.html, blogs.html, writeups.html:
   .search-box, .cards grid, .blog-card, .badge,
   .featured-card, listing header/controls, tag filters
   ========================================================= */

/* ---------- Global search box ---------- */

.search-box {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 32px;
    font-size: 14.5px;
    font-family: var(--font-mono);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box::placeholder {
    color: var(--text-faint);
}

.search-box:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(124, 143, 47, 0.12);
}

/* ---------- Card grid ---------- */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    align-items: stretch;
}

.blog-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

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

.blog-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.blog-card span {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--blue);
    background: rgba(124, 143, 47, 0.08);
    border: 1px solid var(--border-bright);
    padding: 3px 9px;
    border-radius: 12px;
    margin-bottom: 14px;
}

.blog-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: 0.1px;
    line-height: 1.4;
}

.blog-card p {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.6;
    flex-grow: 1;
}

.blog-card a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--blue);
    transition: color 0.2s ease, gap 0.2s ease;
}

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

/* ---------- Featured card ---------- */

.featured-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    padding: 32px 36px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.featured-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--blue);
    opacity: 0.55;
}

.featured-card img {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--amber);
    border: 1px solid rgba(220, 220, 170, 0.3);
    background: rgba(220, 220, 170, 0.06);
    padding: 4px 10px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.featured-card h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    letter-spacing: 0.1px;
}

.featured-card p {
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.65;
    max-width: 560px;
    margin-bottom: 18px;
}

.featured-card a {
    font-size: 13px;
    font-weight: 600;
    color: var(--blue);
}

.featured-card a:hover {
    color: var(--blue-bright);
}

/* ---------- Empty-state variant for featured card ---------- */
/* When #featured-blog has no post yet, blog-loader.js sets
   data-state="empty" on the .featured-card element itself. */

.featured-card[data-state="empty"] {
    border-style: dashed;
    border-color: var(--border-bright);
    background: transparent;
    box-shadow: none;
    padding: 28px 32px;
}

.featured-card[data-state="empty"]::before {
    display: none;
}

/* =========================================================
   LISTING PAGES (blogs.html / writeups.html)
   ========================================================= */

.listing-header {
    padding-bottom: 0;
}

.listing-header .mono {
    font-size: 13px;
    color: var(--text-dim);
    font-weight: 600;
    margin-bottom: 10px;
}

.listing-title {
    font-size: 27px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.1px;
}

.listing-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 24px;
    padding-bottom: 24px;
}

.search-input {
    width: 100%;
    max-width: 420px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-family: var(--font-mono);
    font-size: 13.5px;
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input::placeholder {
    color: var(--text-faint);
}

.search-input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(124, 143, 47, 0.12);
}

.tag-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-btn {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: var(--text-dim);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 6px 13px;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.tag-btn:hover {
    border-color: var(--blue);
    color: var(--blue-bright);
}

.tag-btn.active {
    background: var(--blue);
    border-color: var(--blue);
    color: #1e1e1e;
}

/* =========================================================
   RESPONSIVE GRID
   Desktop: up to 4 columns depending on width
   Tablet:  2 columns
   Mobile:  1 column
   ========================================================= */

@media (min-width: 1200px) {
    .cards {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 960px) {
    .cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }

    .featured-card {
        padding: 26px 24px;
    }
}

@media (max-width: 600px) {
    .cards {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .listing-title {
        font-size: 22px;
    }

    .featured-card {
        padding: 22px 20px;
    }

    .search-input {
        max-width: 100%;
    }
}