/* ==========================================================================
   eGateweb — Blog archive (template-parts/eg-blog.php)
   --------------------------------------------------------------------------
   Used by home.php (/blogartikels) and category.php — one layout, two entry
   points.

   Sections: 1 Hero  2 Filter  3 Articles  4 Empty state  5 CTA
   Hero and CTA come from css/eg-page.css.

   No hardcoded colors — see inc/eg-colors.php.
   ========================================================================== */

/* ==========================================================================
   2. CATEGORY FILTER
   ========================================================================== */
.eg-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 44px;
}

.eg-filter__pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--eg-radius-pill);
    background: var(--eg-card);
    border: 1px solid var(--eg-border);
    font-size: .9rem;
    font-weight: 700;
    color: var(--eg-text);
    text-decoration: none;
    transition: all .25s var(--eg-ease);
}

.eg-filter__pill:hover {
    border-color: var(--eg-brand);
    color: var(--eg-brand);
    transform: translateY(-2px);
}

.eg-filter__pill.is-active {
    background: var(--eg-brand);
    border-color: var(--eg-brand);
    color: var(--eg-brand-ink);
    box-shadow: var(--eg-shadow-brand);
}

/* The count badge sits on whatever the pill's background is, so it needs a
   variant for the active state as well as the resting one. */
.eg-filter__count {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding-inline: 5px;
    border-radius: var(--eg-radius-pill);
    background: var(--eg-brand-soft);
    color: var(--eg-brand);
    font-size: .72rem;
    font-weight: 800;
    transition: all .25s var(--eg-ease);
}

.eg-filter__pill.is-active .eg-filter__count {
    background: rgba(255, 255, 255, .22);
    color: var(--eg-brand-ink);
}

.eg-filter__pill:hover .eg-filter__count {
    background: var(--eg-brand-soft);
    color: var(--eg-brand);
}

/* ==========================================================================
   3. ARTICLES
   ========================================================================== */
.eg-blog__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--eg-gap);
}

.eg-post {
    display: flex;
    flex-direction: column;
    background: var(--eg-card);
    border: 1px solid var(--eg-border);
    border-radius: var(--eg-radius-lg);
    overflow: hidden;
    transition: transform .3s var(--eg-ease), box-shadow .3s var(--eg-ease),
                border-color .3s var(--eg-ease);
}

.eg-post:hover {
    transform: translateY(-6px);
    box-shadow: var(--eg-shadow);
    border-color: rgba(var(--eg-brand-rgb), .35);
}

/* ---- Media ---- */
.eg-post__media {
    position: relative;
    display: block;
    overflow: hidden;
    background: var(--eg-bg-alt);
    aspect-ratio: 16 / 10;
}

.eg-post__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s var(--eg-ease);
}

.eg-post:hover .eg-post__img { transform: scale(1.05); }

/* Article with no featured image: a branded tile, never a broken box. */
.eg-post__img--empty {
    display: grid;
    place-items: center;
    background: var(--eg-brand-soft);
    color: var(--eg-brand);
}

.eg-post__cat {
    position: absolute;
    top: 14px;
    left: 14px;
    padding: 6px 12px;
    border-radius: var(--eg-radius-pill);
    background: var(--eg-card);
    color: var(--eg-brand);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    box-shadow: var(--eg-shadow-sm);
}

/* ---- Body ---- */
.eg-post__body {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 24px;
}

.eg-post__date {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--eg-muted);
    margin-bottom: 12px;
}

.eg-post__date .eg-icon { color: var(--eg-brand); }

.eg-post__title {
    font-size: 1.12rem;
    line-height: 1.35;
}

.eg-post__title a {
    color: var(--eg-heading);
    text-decoration: none;
    /* Stretched link: the whole card is clickable, but only the title is in the
       tab order — so keyboard users get one stop per card, not three. */
    background-image: none;
}

.eg-post__title a::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}

.eg-post { position: relative; }

.eg-post:hover .eg-post__title a { color: var(--eg-brand); }

.eg-post__excerpt {
    margin-top: 10px;
    font-size: .9rem;
    line-height: 1.65;
    color: var(--eg-muted);
    flex-grow: 1;
}

.eg-post__more {
    margin-top: 18px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .88rem;
    font-weight: 700;
    color: var(--eg-brand);
}

.eg-post__more .eg-icon { transition: transform .3s var(--eg-ease); }
.eg-post:hover .eg-post__more .eg-icon { transform: translateX(4px); }

/* ==========================================================================
   3b. FEATURED — the newest article, page 1 only
   ========================================================================== */
.eg-post--featured {
    flex-direction: row;
    align-items: stretch;
    margin-bottom: var(--eg-gap);
}

.eg-post--featured .eg-post__media {
    flex: 0 0 52%;
    aspect-ratio: auto;
}

.eg-post--featured .eg-post__body {
    justify-content: center;
    padding: 40px;
}

.eg-post--featured .eg-post__title { font-size: clamp(1.3rem, 2.2vw, 1.75rem); }

.eg-post--featured .eg-post__excerpt {
    margin-top: 14px;
    font-size: .98rem;
    flex-grow: 0;
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */
.eg-pagination {
    margin-top: 48px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.eg-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 42px;
    height: 42px;
    padding-inline: 14px;
    justify-content: center;
    border-radius: var(--eg-radius-sm);
    background: var(--eg-card);
    border: 1px solid var(--eg-border);
    font-size: .9rem;
    font-weight: 700;
    color: var(--eg-text);
    text-decoration: none;
    transition: all .25s var(--eg-ease);
}

.eg-pagination a.page-numbers:hover {
    border-color: var(--eg-brand);
    color: var(--eg-brand);
}

.eg-pagination .page-numbers.current {
    background: var(--eg-brand);
    border-color: var(--eg-brand);
    color: var(--eg-brand-ink);
}

.eg-pagination .page-numbers.dots {
    border-color: transparent;
    background: transparent;
    color: var(--eg-muted);
}

/* The "previous" arrow reuses the right-pointing icon, mirrored. */
.eg-pagination .eg-page__prev { transform: rotate(180deg); }

/* ==========================================================================
   4. EMPTY STATE
   ========================================================================== */
.eg-blog__empty {
    text-align: center;
    max-width: 480px;
    margin-inline: auto;
    padding: 60px 24px;
}

.eg-blog__empty h2 {
    margin-top: 22px;
    font-size: 1.4rem;
}

.eg-blog__empty p {
    margin-top: 12px;
    color: var(--eg-muted);
}

.eg-blog__empty .eg-btn { margin-top: 26px; }

/* ==========================================================================
   SINGLE ARTICLE (single.php)
   ========================================================================== */
.eg-article__head {
    padding-block: 40px 36px;
    background: var(--eg-bg);
}

/* A reading measure, not the full container — the whole article column is
   built around ~68 characters per line. */
.eg-article__head-inner,
.eg-article__body,
.eg-article__foot {
    max-width: 760px;
    margin-inline: auto;
}

.eg-article__head h1 {
    font-size: clamp(1.9rem, 3.6vw, 2.75rem);
    line-height: 1.15;
    text-wrap: balance;
}

/* The eyebrow is a link here (to the category), so it needs its own reset. */
.eg-article__head .eg-eyebrow {
    text-decoration: none;
    transition: all .25s var(--eg-ease);
}

.eg-article__head .eg-eyebrow:hover {
    background: var(--eg-brand);
    color: var(--eg-brand-ink);
}

.eg-article__meta {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    font-size: .86rem;
    font-weight: 600;
    color: var(--eg-muted);
}

.eg-article__meta > * {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.eg-article__meta .eg-icon { color: var(--eg-brand); }

/* ---- Featured image ---- */
.eg-article__figure {
    margin: 0 0 44px;
}

.eg-article__img {
    width: 100%;
    aspect-ratio: 16 / 8;
    object-fit: cover;
    border-radius: var(--eg-radius-lg);
    box-shadow: var(--eg-shadow-lg);
}

.eg-article__figure figcaption {
    margin-top: 12px;
    text-align: center;
    font-size: .82rem;
    color: var(--eg-muted);
}

.eg-article__body { padding-bottom: 8px; }

/* ==========================================================================
   PROSE — the client's editor output
   --------------------------------------------------------------------------
   This is the ONE place the theme does not control the markup: whatever the
   editor produces lands here. So style generously and defensively.
   ========================================================================== */
.eg-prose-body {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--eg-text);
}

.eg-prose-body > * + * { margin-top: 1.4em; }

.eg-prose-body h2 {
    font-size: 1.6rem;
    margin-top: 2em;
}

.eg-prose-body h3 {
    font-size: 1.25rem;
    margin-top: 1.8em;
}

.eg-prose-body h4 { font-size: 1.08rem; }

.eg-prose-body a {
    color: var(--eg-brand);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.eg-prose-body a:hover { text-decoration-thickness: 2px; }

.eg-prose-body strong { color: var(--eg-heading); font-weight: 700; }

.eg-prose-body ul,
.eg-prose-body ol { padding-left: 1.3em; }

.eg-prose-body li { margin-bottom: .5em; }

.eg-prose-body li::marker { color: var(--eg-brand); }

.eg-prose-body blockquote {
    margin-inline: 0;
    padding: 22px 26px;
    border-left: 3px solid var(--eg-brand);
    border-radius: var(--eg-radius-sm);
    background: var(--eg-brand-soft);
    font-size: 1.05rem;
    color: var(--eg-heading);
}

.eg-prose-body blockquote p { margin: 0; }

.eg-prose-body img,
.eg-prose-body iframe {
    max-width: 100%;
    height: auto;
    border-radius: var(--eg-radius);
}

/* Editor-inserted media can be wider than the reading column; let it breathe
   without breaking the page. */
.eg-prose-body figure { margin-inline: 0; }

.eg-prose-body figcaption {
    margin-top: 10px;
    font-size: .82rem;
    color: var(--eg-muted);
    text-align: center;
}

.eg-prose-body hr {
    border: 0;
    height: 1px;
    background: var(--eg-border);
    margin-block: 2.4em;
}

/* A pasted table must scroll, not stretch the article. */
.eg-prose-body table {
    width: 100%;
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
}

.eg-prose-body th,
.eg-prose-body td {
    padding: 10px 14px;
    border: 1px solid var(--eg-border);
    text-align: left;
}

.eg-prose-body th {
    background: var(--eg-brand-soft);
    color: var(--eg-brand-dark);
    font-weight: 800;
}

.eg-prose-body code {
    background: var(--eg-bg-alt);
    border: 1px solid var(--eg-border);
    border-radius: 5px;
    padding: 2px 6px;
    font-size: .9em;
}

/* ==========================================================================
   TAGS + SHARE
   ========================================================================== */
.eg-article__foot {
    margin-top: 44px;
    padding-top: 28px;
    border-top: 1px solid var(--eg-border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.eg-article__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.eg-article__tags a {
    padding: 6px 12px;
    border-radius: var(--eg-radius-pill);
    background: var(--eg-bg-alt);
    border: 1px solid var(--eg-border);
    font-size: .8rem;
    font-weight: 600;
    color: var(--eg-muted);
    text-decoration: none;
    transition: all .25s var(--eg-ease);
}

.eg-article__tags a:hover {
    border-color: var(--eg-brand);
    color: var(--eg-brand);
}

.eg-share {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.eg-share__label {
    font-size: .84rem;
    font-weight: 700;
    color: var(--eg-heading);
}

.eg-share__btn {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--eg-card);
    border: 1px solid var(--eg-border);
    color: var(--eg-muted);
    transition: all .25s var(--eg-ease);
}

.eg-share__btn:hover {
    background: var(--eg-brand);
    border-color: var(--eg-brand);
    color: var(--eg-brand-ink);
    transform: translateY(-2px);
}

.eg-article__pages {
    margin-top: 2em;
    font-size: .9rem;
    font-weight: 600;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1100px) {
    .eg-blog__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    /* The featured card becomes a normal (taller) card — a 50/50 split on a
       narrow screen leaves both halves unreadable. */
    .eg-post--featured { flex-direction: column; }

    .eg-post--featured .eg-post__media {
        flex: none;
        aspect-ratio: 16 / 9;
    }

    .eg-post--featured .eg-post__body { padding: 28px; }
}

@media (max-width: 900px) {
    .eg-article__img { aspect-ratio: 16 / 9; }
    .eg-article__figure { margin-bottom: 34px; }
}

@media (max-width: 600px) {
    .eg-blog__grid { grid-template-columns: 1fr; }

    .eg-article__head { padding-block: 26px 28px; }
    .eg-prose-body { font-size: 1rem; }
    .eg-prose-body h2 { font-size: 1.35rem; }
    .eg-prose-body blockquote { padding: 18px 20px; }

    /* Stack tags above the share row rather than squeezing both onto one line */
    .eg-article__foot { flex-direction: column; align-items: flex-start; }
    .eg-share { margin-left: 0; }

    .eg-filter {
        /* Many categories would wrap into a tall block on a phone; a single
           scrollable row keeps the articles above the fold. */
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 6px;
        margin-inline: -18px;
        padding-inline: 18px;
        scrollbar-width: none;
    }

    .eg-filter::-webkit-scrollbar { display: none; }
    .eg-filter__pill { flex: 0 0 auto; }

    .eg-pagination .page-numbers {
        min-width: 38px;
        height: 38px;
        padding-inline: 10px;
    }
}

/* ==========================================================================
   404 (404.php)
   ========================================================================== */
.eg-404__inner {
    max-width: 620px;
    margin-inline: auto;
    text-align: center;
}

/* Big, but decorative: the heading carries the message, so this is
   aria-hidden and does not need to be readable at speed. */
.eg-404__code {
    display: block;
    font-size: clamp(4rem, 12vw, 7rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.04em;
    color: var(--eg-brand-soft);
    margin-bottom: 8px;
}

.eg-404__hero h1 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); }

.eg-404__text {
    margin-top: 16px;
    font-size: 1.02rem;
    color: var(--eg-muted);
}

.eg-404__search { margin-top: 30px; }

.eg-404__actions {
    margin-top: 24px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.eg-404__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.eg-404__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    text-decoration: none;
    font-size: .92rem;
    font-weight: 700;
    color: var(--eg-heading);
}

.eg-404__link > span:nth-child(2) { flex: 1; min-width: 0; }

.eg-404__link .eg-chip { width: 40px; height: 40px; border-radius: 11px; }

.eg-404__link > .eg-icon { color: var(--eg-brand); flex-shrink: 0; }

.eg-404__link:hover {
    transform: translateY(-3px);
    box-shadow: var(--eg-shadow);
    border-color: rgba(var(--eg-brand-rgb), .35);
}

.eg-404__link:hover .eg-chip {
    background: var(--eg-brand);
    color: var(--eg-brand-ink);
}

/* ==========================================================================
   SEARCH (search.php)
   ========================================================================== */
.eg-search__form { margin-top: 28px; }

/* WordPress's get_search_form() markup is not ours, so style it by element. */
.eg-search__form form,
.eg-404__search form {
    display: flex;
    gap: 10px;
    max-width: 460px;
    margin-inline: auto;
}

.eg-search__form label,
.eg-404__search label { flex: 1; }

.eg-search__form input[type="search"],
.eg-404__search input[type="search"] {
    width: 100%;
    font: inherit;
    font-size: .95rem;
    color: var(--eg-heading);
    background: var(--eg-card);
    border: 1.5px solid var(--eg-border);
    border-radius: var(--eg-radius-pill);
    padding: 13px 20px;
    transition: border-color .2s var(--eg-ease), box-shadow .2s var(--eg-ease);
}

.eg-search__form input[type="search"]:focus,
.eg-404__search input[type="search"]:focus {
    outline: none;
    border-color: var(--eg-brand);
    box-shadow: 0 0 0 4px rgba(var(--eg-brand-rgb), .14);
}

.eg-search__form input[type="submit"],
.eg-404__search input[type="submit"] {
    font: inherit;
    font-size: .92rem;
    font-weight: 700;
    padding: 13px 24px;
    border: 0;
    border-radius: var(--eg-radius-pill);
    background: var(--eg-brand);
    color: var(--eg-brand-ink);
    cursor: pointer;
    transition: background-color .25s var(--eg-ease);
}

.eg-search__form input[type="submit"]:hover,
.eg-404__search input[type="submit"]:hover { background: var(--eg-brand-dark); }

.eg-search__label {
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--eg-muted);
    margin-bottom: 16px;
}

.eg-search__label--spaced { margin-top: 44px; }

.eg-search__pages {
    display: grid;
    gap: 12px;
    margin-bottom: 8px;
}

.eg-search__pages .eg-search__label { grid-column: 1 / -1; margin-bottom: 4px; }

.eg-search__page {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    text-decoration: none;
}

.eg-search__page:hover {
    transform: translateX(4px);
    border-color: rgba(var(--eg-brand-rgb), .35);
    box-shadow: var(--eg-shadow-sm);
}

.eg-search__page-body { flex: 1; min-width: 0; }

.eg-search__page-title {
    display: block;
    font-size: .98rem;
    font-weight: 800;
    color: var(--eg-heading);
}

.eg-search__page-url {
    display: block;
    margin-top: 3px;
    font-size: .8rem;
    color: var(--eg-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.eg-search__page > .eg-icon { color: var(--eg-brand); flex-shrink: 0; }

@media (max-width: 1100px) {
    .eg-404__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .eg-404__grid { grid-template-columns: 1fr; }
    .eg-404__actions .eg-btn { width: 100%; }

    .eg-search__form form,
    .eg-404__search form { flex-direction: column; }
}
