/* ==========================================================================
   BvAT Archive (News + Events) — filters, cards, pagination
   Matches Risehand components:
     .theme_btn  -> #76ab24 bg, #fff, 700, 5px radius
     headings    -> #232323     body text -> #616161
   Text greens use #4a7a12 (AA on white / tint); #76ab24 for fills & accents.
   ========================================================================== */

.eat-wrap {
    --eat-accent: var(--color-set-one-1, #76ab24);
    --eat-accent-hover: #67951f;
    --eat-accent-ink: #4a7a12;
    --eat-tint: #f1f6e9;
    --eat-ink: #232323;
    --eat-text: #616161;
    --eat-muted: #6b6b6b;
    --eat-line: #e3e8dc;
    --eat-radius: 5px;
    --eat-radius-lg: 8px;
    --eat-control-h: 50px;
    --eat-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    --eat-shadow-hover: 0 14px 34px rgba(0, 0, 0, 0.10);

    width: 100%;
    font-family: var(--font-family-main, Arial, sans-serif);
    color: var(--eat-text);
}

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

.eat-sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

/* --------------------------------------------------------------------------
   1. Filter bar
   -------------------------------------------------------------------------- */
.eat-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 12px;
    padding: 18px;
    margin: 0 0 28px;
    background: #ffffff;
    border: 1px solid var(--eat-line);
    border-radius: var(--eat-radius-lg);
    box-shadow: var(--eat-shadow);
}

.eat-field {
    position: relative;
    flex: 1 1 150px;
    min-width: 0;
}

.eat-field--search { flex: 2 1 260px; }

.eat-field__icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--eat-muted);
    pointer-events: none;
}

/* Native controls (used before/without select2) */
.eat-filters .eat-search,
.eat-filters select.eat-select {
    width: 100%;
    height: var(--eat-control-h);
    margin: 0;
    padding: 0 14px;
    font: inherit;
    font-size: 15px;
    color: var(--eat-ink);
    background-color: #ffffff;
    border: 1px solid var(--eat-line);
    border-radius: var(--eat-radius);
    box-shadow: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.eat-filters .eat-search {
    padding-left: 42px;
}

.eat-filters .eat-search::placeholder { color: var(--eat-muted); opacity: 1; }

.eat-filters .eat-search:focus,
.eat-filters select.eat-select:focus {
    outline: none;
    border-color: var(--eat-accent);
    box-shadow: 0 0 0 3px rgba(118, 171, 36, 0.18);
}

/* select2 (theme enhancement) — make it match the native controls */
.eat-filters .select2-container {
    width: 100% !important;
    display: block;
    margin: 0 !important; /* theme adds 5px vertical margin */
}

/* select2 keeps the native <select> in the DOM; take it out of the flow */
.eat-filters select.select2-hidden-accessible {
    position: absolute !important;
}

.eat-filters .select2-container .select2-selection--single {
    height: var(--eat-control-h) !important;
    padding: 0 !important; /* theme adds 16px 8px */
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--eat-line);
    border-radius: var(--eat-radius);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.eat-filters .select2-container .select2-selection--single .select2-selection__rendered {
    width: 100%;
    padding: 0 36px 0 14px;
    font-size: 15px;
    line-height: calc(var(--eat-control-h) - 2px);
    color: var(--eat-ink);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.eat-filters .select2-container .select2-selection--single .select2-selection__arrow {
    height: calc(var(--eat-control-h) - 2px);
    width: 34px;
    right: 4px;
    top: 0;
}

.eat-filters .select2-container .select2-selection__arrow b { display: none; }

/* theme draws its own chevron via ::before — keep only ours */
.eat-filters .select2-container .select2-selection__arrow::before {
    content: none !important;
    display: none !important;
}

.eat-filters .select2-container .select2-selection__arrow::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    margin: -6px 0 0 -4px;
    border-right: 2px solid var(--eat-muted);
    border-bottom: 2px solid var(--eat-muted);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.eat-filters .select2-container--open .select2-selection__arrow::after {
    transform: translateY(3px) rotate(-135deg);
}

.eat-filters .select2-container--focus .select2-selection--single,
.eat-filters .select2-container--open .select2-selection--single {
    border-color: var(--eat-accent);
    box-shadow: 0 0 0 3px rgba(118, 171, 36, 0.18);
    outline: none;
}

/* select2 dropdown is appended to <body>: style options globally but lightly */
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--eat-tint, #f1f6e9);
    color: #4a7a12;
}

/* Buttons — mirror Risehand .theme_btn */
.eat-actions {
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
}

.eat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: var(--eat-control-h);
    padding: 0 26px;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    border-radius: var(--eat-radius);
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.eat-btn--primary {
    background: var(--eat-accent);
    border-color: var(--eat-accent);
    color: #ffffff;
}

.eat-btn--primary:hover,
.eat-btn--primary:focus-visible {
    background: var(--eat-accent-hover);
    border-color: var(--eat-accent-hover);
    color: #ffffff;
}

.eat-btn--ghost {
    background: #ffffff;
    border-color: var(--eat-line);
    color: var(--eat-ink);
    padding: 0 20px;
}

.eat-btn--ghost:hover,
.eat-btn--ghost:focus-visible {
    border-color: var(--eat-accent);
    color: var(--eat-accent-ink);
    background: #ffffff;
}

.eat-btn:focus-visible,
.eat-page:focus-visible {
    outline: 2px solid var(--eat-accent);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   2. Results summary + grid
   -------------------------------------------------------------------------- */
.eat-results {
    position: relative;
    transition: opacity 0.2s ease;
}

.eat-results.is-loading {
    opacity: 0.45;
    pointer-events: none;
}

.eat-results.is-loading::after {
    content: '';
    position: absolute;
    top: 80px;
    left: 50%;
    width: 36px;
    height: 36px;
    margin-left: -18px;
    border: 3px solid var(--eat-tint);
    border-top-color: var(--eat-accent);
    border-radius: 50%;
    animation: eat-spin 0.8s linear infinite;
}

@keyframes eat-spin { to { transform: rotate(360deg); } }

.eat-summary {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--eat-muted);
}

.eat-grid {
    display: grid;
    grid-template-columns: repeat(var(--eat-cols, 3), minmax(0, 1fr));
    gap: 28px 24px;
}

/* --------------------------------------------------------------------------
   3. Card
   -------------------------------------------------------------------------- */
.eat-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #ffffff;
    border: 1px solid var(--eat-line);
    border-radius: var(--eat-radius-lg);
    overflow: hidden;
    box-shadow: var(--eat-shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.eat-wrap .eat-card:hover,
.eat-wrap .eat-card:has(a:focus-visible) {
    transform: translateY(-3px);
    box-shadow: var(--eat-shadow-hover);
    border-color: #cfdcbf;
}

.eat-card__media {
    position: relative;
    aspect-ratio: 16 / 10;
    background: var(--eat-tint);
    overflow: hidden;
}

/* .eat-wrap prefix outranks legacy Customizer CSS (.eat-card img{height:24vh !important}) */
.eat-wrap .eat-card .eat-card__media img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100% !important;
    height: 100% !important; /* theme forces img{height:auto} */
    max-width: none;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.eat-card:hover .eat-card__media img { transform: scale(1.04); }

.eat-card__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--eat-accent);
    background: linear-gradient(135deg, #f1f6e9 0%, #e3eed2 100%);
}

.eat-card__badge {
    position: absolute;
    left: 12px;
    top: 12px;
    z-index: 2;
    max-width: calc(100% - 24px);
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.3px;
    color: var(--eat-accent-ink);
    background: #ffffff;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eat-card__body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 18px 20px 20px;
}

.eat-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    margin: 0 0 10px;
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--eat-muted);
}

.eat-card__meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.eat-card__meta-item svg { color: var(--eat-accent); flex: 0 0 auto; }

.eat-pill {
    display: inline-block;
    padding: 3px 9px;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0.3px;
    border-radius: 999px;
}

.eat-pill--live  { color: #ffffff; background: var(--eat-accent-ink); }
.eat-pill--muted { color: #3a3a3a; background: #ffffff; }

/* Status pill sits on the image, top-right, opposite the category badge */
.eat-card__status {
    position: absolute;
    right: 12px;
    top: 12px;
    z-index: 2;
    padding: 5px 11px;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.eat-card--events .eat-card__badge { max-width: calc(100% - 110px); }

.eat-card__title {
    margin: 0 0 10px;
    font-family: var(--font-family-main, Arial, sans-serif);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--eat-ink);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.eat-card__title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

/* Whole card is clickable through the title link (single tab stop) */
.eat-card__title a::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}

.eat-card__title a:focus { outline: none; }

.eat-card:has(a:focus-visible) {
    outline: 2px solid var(--eat-accent);
    outline-offset: 2px;
}

.eat-card:hover .eat-card__title a,
.eat-card__title a:focus-visible {
    color: var(--eat-accent-ink);
}

.eat-card__excerpt {
    margin: 0 0 16px;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--eat-text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.eat-card__more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid #eef1ea;
    font-size: 15px;
    font-weight: 700;
    color: var(--eat-accent-ink);
}

.eat-card__more svg { transition: transform 0.2s ease; }
.eat-card:hover .eat-card__more svg { transform: translateX(4px); }

/* --------------------------------------------------------------------------
   4. Pagination
   -------------------------------------------------------------------------- */
.eat-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 44px 0 8px;
}

.eat-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 44px;
    height: 44px;
    padding: 0 14px;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    color: var(--eat-ink);
    background: #ffffff;
    border: 1px solid var(--eat-line);
    border-radius: var(--eat-radius);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.eat-page:hover:not(:disabled):not(.is-current) {
    border-color: var(--eat-accent);
    color: var(--eat-accent-ink);
    background: var(--eat-tint);
}

.eat-page.is-current {
    background: var(--eat-accent);
    border-color: var(--eat-accent);
    color: #ffffff;
    cursor: default;
}

.eat-page:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.eat-page--gap {
    min-width: 24px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--eat-muted);
    cursor: default;
}

/* --------------------------------------------------------------------------
   5. Empty state
   -------------------------------------------------------------------------- */
.eat-empty {
    padding: 56px 20px;
    text-align: center;
    color: var(--eat-muted);
    background: #fafcf7;
    border: 1px dashed var(--eat-line);
    border-radius: var(--eat-radius-lg);
}

.eat-empty svg { color: var(--eat-accent); margin-bottom: 10px; }

.eat-empty__title {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
    color: var(--eat-ink);
}

.eat-empty__hint { margin: 0; font-size: 15px; }

/* --------------------------------------------------------------------------
   6. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1199px) {
    .eat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 991px) {
    .eat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 18px; }
}

@media (max-width: 767px) {
    .eat-filters {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding: 14px;
    }

    .eat-field--search,
    .eat-actions {
        grid-column: 1 / -1;
    }

    .eat-actions .eat-btn { flex: 1 1 0; }

    .eat-wrap { --eat-control-h: 46px; }
}

@media (max-width: 575px) {
    .eat-grid { grid-template-columns: 1fr; gap: 20px; }

    .eat-card__body { padding: 16px 16px 18px; }

    .eat-card__title { font-size: 17px; }

    .eat-page--nav span { display: none; }

    .eat-page { min-width: 42px; height: 42px; padding: 0 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .eat-card,
    .eat-card__media img,
    .eat-card__more svg,
    .eat-results { transition: none; }
    .eat-card:hover { transform: none; }
    .eat-card:hover .eat-card__media img { transform: none; }
    .eat-results.is-loading::after { animation: none; }
}

/* --------------------------------------------------------------------------
   7. Resources (Resources Manager theme templates) + link-based pagination
   -------------------------------------------------------------------------- */

/* Section heading used by [resources_category] grids */
.eat-section-title {
    margin: 0 0 20px;
    font-family: var(--font-family-main, Arial, sans-serif);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--eat-ink);
}

.eat-wrap--category + .eat-wrap--category { margin-top: 48px; }

/* Document covers: show the top of the page (title area), not the middle */
.eat-wrap .eat-card--resources .eat-card__media img,
.eat-wrap .eat-card--resources .eat-card__media canvas {
    object-position: center top;
}

/* PDF.js first-page preview fills the media frame like an image */
.eat-wrap .eat-card__media canvas.pml-pdf-canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    object-fit: cover;
    border: 0;
    box-shadow: none;
}

.eat-card__placeholder--pdf {
    position: absolute;
    inset: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
}

/* Link/span variants of the pagination items (GET-based listings) */
a.eat-page,
a.eat-page:visited {
    text-decoration: none;
    color: var(--eat-ink);
}

a.eat-page:hover {
    border-color: var(--eat-accent);
    color: var(--eat-accent-ink);
    background: var(--eat-tint);
}

.eat-page.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

a.eat-btn,
a.eat-btn:visited { text-decoration: none; }
a.eat-btn--ghost { color: var(--eat-ink); }
