/*
 * evaluations-page.css
 * The MicroEntrepreneur — /evaluations/ page styles
 * P009-T054 | Finn (PKA) | 2026-04-23
 *
 * All values use design system tokens from:
 * TAYLOR_micro_entrepreneur_implementation_DONE.md (P009-T020)
 *
 * No hardcoded pixel values for colour or typography —
 * all dimensions reference the token set defined in :root
 * (already present in Appearance → Customize → Additional CSS).
 *
 * Enqueue after the main design system CSS so tokens are
 * available when this file is parsed.
 * ============================================================ */


/* ============================================================
   1. PAGE HEADER
   ============================================================ */

.tme-eval-page-header {
    background-color: var(--tme-offwhite);
    padding: 48px 0 16px; /* P009-T062 spacing fix: pb 24→16 — reduces header-to-grid gap */
    /* border-bottom removed P009-T059 — Karl design direction 2026-04-29 */
    margin-bottom: 0;
}

.tme-eval-page-header__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.tme-eval-page-title {
    font-family: var(--tme-font-heading);
    font-size: 76px; /* P009-T062: overrides --tme-size-h1-desktop token (36px); token unchanged — used elsewhere */
    font-weight: 600;
    color: var(--tme-navy);
    line-height: var(--tme-lh-heading);
    margin: 0;
}


/* ============================================================
   2. FILTER BAR
   ============================================================ */

.tme-filter-bar {
    position: relative;
    background-color: var(--tme-offwhite);
    /* border-bottom removed P009-T059 — filter bar is now empty; no floating border */
    z-index: 100;
}

.tme-filter-triggers {
    display: flex;
    gap: 0;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px; /* P009-T062 spacing fix: 12px top/bottom → 0 — filter bar is empty (triggers in section label); padding was dead space */
    align-items: stretch;
}


/* -----------------------------------------------
   2a. Trigger controls
   ----------------------------------------------- */

.tme-filter-trigger {
    /* Base / default state */
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex: 1;
    min-height: 44px; /* WCAG 2.2 AA minimum tap target */
    padding: 10px 16px;
    font-family: var(--tme-font-body);
    font-size: var(--tme-size-body);
    font-weight: 600;
    color: var(--tme-navy);
    background-color: var(--tme-offwhite);
    border: 1px solid var(--tme-light-grey);
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    border-radius: 0;
    /* Ensure full-width layout when two triggers side by side */
}

.tme-filter-trigger:first-child {
    border-radius: 3px 0 0 3px;
    border-right-width: 0;
}

.tme-filter-trigger:last-child {
    border-radius: 0 3px 3px 0;
}

.tme-filter-trigger:focus-visible {
    outline: 2px solid var(--tme-amber);
    outline-offset: 2px;
    z-index: 1;
}

/* Trigger: panel is currently open */
.tme-filter-trigger[aria-expanded="true"] {
    border-bottom-color: var(--tme-amber);
    box-shadow: inset 0 -2px 0 var(--tme-amber);
    background-color: #fdf9f3; /* very slight amber tint — stays near --tme-offwhite */
    color: var(--tme-grey-mid); /* P009-T060: prevent white-on-light-bg from hover chain */
}

/* Trigger: a filter selection has been made (applied) */
.tme-filter-trigger--active {
    background-color: var(--tme-amber);
    color: var(--tme-navy);
    border-color: var(--tme-amber);
    border-radius: 3px;
    flex: 0 0 auto; /* don't force full width when active */
}

.tme-filter-trigger--active:focus-visible {
    outline-color: var(--tme-navy);
}

.tme-filter-trigger__caret {
    font-size: 18px;
    line-height: 1;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.tme-filter-trigger[aria-expanded="true"] .tme-filter-trigger__caret {
    transform: rotate(180deg);
}


/* ============================================================
   3. OVERLAY PANELS (Topic + Date)
   ============================================================ */

.tme-filter-panel {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    border: 1px solid var(--tme-light-grey);
    border-top: none;
    z-index: 200;
    /* Panel is hidden via [hidden] attribute; JS toggles this */
}

/* Panel revealed */
.tme-filter-panel:not([hidden]) {
    display: block;
}

.tme-filter-panel__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px 8px;
    position: relative;
    /* Maximum height: constrained to show ~8 items.
       Each item is approx 44px → 8 × 44 = 352px + headings/padding */
    max-height: 380px;
    overflow-y: auto;
    /* Smooth scroll for accessibility */
    scroll-behavior: smooth;
}

/* 8th item peek: last visible item before scroll is 70% opacity
   (not 50% — disambiguates from disabled/unavailable state per Drew CR2)
   This is applied via JS by adding a class to the 8th li. */
.tme-filter-panel__item--peek {
    opacity: 0.70;
}


/* -----------------------------------------------
   3a. Panel list and items
   ----------------------------------------------- */

.tme-filter-panel__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tme-filter-panel__item {
    margin: 0;
    padding: 0;
}

.tme-filter-panel__option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 44px; /* WCAG 2.2 AA minimum tap target */
    padding: 10px 8px;
    font-family: var(--tme-font-body);
    font-size: var(--tme-size-body);
    color: var(--tme-body-dark);
    background: none;
    border: none;
    border-bottom: 1px solid var(--tme-light-grey);
    cursor: pointer;
    text-align: left;
    transition: background-color 0.1s ease, color 0.1s ease;
}

.tme-filter-panel__option:last-child {
    border-bottom: none;
}

.tme-filter-panel__option:hover {
    background-color: var(--tme-slate-light);
    color: var(--tme-navy);
}

.tme-filter-panel__option:focus-visible {
    outline: 2px solid var(--tme-amber);
    outline-offset: -2px;
}

/* Active (selected) option */
.tme-filter-panel__option--selected {
    color: var(--tme-amber);
    font-weight: 700;
}

.tme-filter-panel__count {
    font-size: var(--tme-size-meta);
    color: var(--tme-secondary-grey);
    margin-left: 8px;
    white-space: nowrap;
}

.tme-filter-panel__empty {
    font-family: var(--tme-font-body);
    font-size: var(--tme-size-body);
    color: var(--tme-secondary-grey);
    padding: 16px 0;
    margin: 0;
}


/* -----------------------------------------------
   3b. Scroll indicator — chevron
   ----------------------------------------------- */

.tme-panel-scroll-indicator {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 0 4px;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.95) 60%, rgba(255,255,255,1) 100%);
    color: var(--tme-secondary-grey);
    pointer-events: none;
    /* Hidden when scrolled to bottom — JS adds .is-hidden */
}

.tme-panel-scroll-indicator.is-hidden {
    display: none;
}


/* -----------------------------------------------
   3c. Date panel — year headings and month rows
   ----------------------------------------------- */

.tme-date-year-group {
    margin-bottom: 12px;
}

.tme-date-year-heading {
    font-family: var(--tme-font-heading);
    font-size: var(--tme-size-h3);
    font-weight: 600;
    color: var(--tme-navy);
    margin: 0 0 4px 0;
    padding: 8px 8px 4px;
    border-bottom: 2px solid var(--tme-light-grey);
}

.tme-date-month-list {
    padding-left: 0;
}

/* Available month — rendered as button (via .tme-filter-panel__option) */
.tme-date-month--available {
    color: var(--tme-amber); /* matches site link colour */
}

/* Unavailable / future month — not a button, non-interactive */
.tme-date-month--inactive {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 8px;
    font-family: var(--tme-font-body);
    font-size: var(--tme-size-body);
    color: var(--tme-secondary-grey);
    border-bottom: 1px solid var(--tme-light-grey);
    cursor: default;
    /* Visually distinct from available months and from 70% peek opacity */
    opacity: 0.45;
}


/* -----------------------------------------------
   3d. Mobile panel behaviour (<768px)
   ----------------------------------------------- */

@media (max-width: 767px) {
    .tme-filter-panel__inner {
        max-height: 60vh; /* Drew CR-m1: bounded max-height on mobile */
        overflow-y: auto;
    }

    /* Drew CR-m2: shadow at panel bottom on mobile to reinforce overlay status */
    .tme-filter-panel {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    }
}


/* ============================================================
   4. ACTIVE FILTER CHIPS
   ============================================================ */

.tme-active-filters {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 24px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.tme-active-filters[hidden] {
    display: none;
}

.tme-active-filters__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Individual chip — injected by JS */
.tme-active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--tme-amber);
    color: var(--tme-navy);
    font-family: var(--tme-font-body);
    font-size: var(--tme-size-meta);
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 3px;
    white-space: nowrap;
}

.tme-active-filter-chip__clear {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: var(--tme-navy);
    padding: 0;
    min-width: 20px;
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tme-active-filter-chip__clear:focus-visible {
    outline: 2px solid var(--tme-navy);
    outline-offset: 1px;
    border-radius: 2px;
}

/* Clear all link */
.tme-clear-all-filters {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--tme-font-body);
    font-size: var(--tme-size-meta);
    font-weight: 600;
    color: var(--tme-amber);
    padding: 4px 0;
    text-decoration: underline;
    white-space: nowrap;
    min-height: 44px; /* WCAG tap target */
    display: inline-flex;
    align-items: center;
}

.tme-clear-all-filters:hover {
    text-decoration: none;
}

.tme-clear-all-filters:focus-visible {
    outline: 2px solid var(--tme-amber);
    outline-offset: 2px;
    border-radius: 2px;
}


/* ============================================================
   5. CARD GRID
   ============================================================ */

.tme-eval-grid-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 24px 48px; /* P009-T062 spacing fix: pt 32→8 — dominant gap contributor; grid is now visually connected to header */
}


/* -----------------------------------------------
   5a. Section label row — "ALL EVALUATIONS" + inline filters
   R5: Drew gap analysis — structural separator above card grid (P009-T057)
   P009-T059: flex layout + inline filter triggers added (Nova | 2026-04-29)
   ----------------------------------------------- */

/* R5: Drew gap analysis — structural label above card grid, between filter zone and content zone.
   The rule-line here is the second application of the rule-line system (first: .site-header border-bottom;
   third: .site-footer border-top). This is the filter/grid structural separator.
   P009-T059: position: relative added so panels drop below via top: 100%
   P009-T062: separator moved from border-top (above row) to border-bottom (below row / above cards) */
.tme-grid-section-label {
    position: relative;           /* panels drop below this via top: 100% */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0 8px 0; /* P009-T062 spacing fix: pt 16→8 — completes gap reduction; bottom unchanged */
    border-bottom: 1px solid var(--tme-light-grey);
}

.tme-section-label-text {
    font-family: var(--tme-font-body);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--tme-grey-mid);
}

/* Inline filter wrapper — right-justified in section label row */
.tme-inline-filters {
    display: flex;
    align-items: center;
}

/* "Browse by:" static label — P009-T062 */
.tme-inline-browse-label {
    font-family: var(--tme-font-body);
    font-size: 12px;
    color: var(--tme-grey-mid);
    letter-spacing: 0;
    padding-right: 6px;
    line-height: 1;
    user-select: none;
}

/* Pipe separator between Topic and Date */
.tme-inline-filter-sep {
    color: var(--tme-grey-mid);
    font-size: 12px;
    padding: 0 8px;
    user-select: none;
    line-height: 1;
}

/* Inline trigger modifier — overrides base .tme-filter-trigger for inline context */
.tme-filter-trigger--inline {
    flex: 0 0 auto;
    min-height: unset;
    padding: 2px 0;
    font-size: 12px;
    letter-spacing: 0;
    font-weight: 400;
}

.tme-filter-trigger--inline .tme-filter-trigger__caret {
    font-size: 12px;
}


.tme-eval-grid {
    display: grid;
    /* 3 columns ≥ 1024px */
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    align-items: start;
}

/* 2 columns at tablet */
@media (max-width: 1023px) and (min-width: 768px) {
    .tme-eval-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 1 column at mobile */
@media (max-width: 767px) {
    .tme-eval-grid {
        grid-template-columns: 1fr;
    }
}


/* -----------------------------------------------
   5a. Card component
   ----------------------------------------------- */

.tme-eval-card {
    background-color: #ffffff; /* Pure white — intentional lift against --tme-offwhite page bg */
    border: 1px solid var(--tme-light-grey);
    border-radius: 0; /* Consistent with existing .tme-evaluation-card */
    overflow: hidden;
    transition: box-shadow 0.15s ease;
    /* Cards hidden by JS filter get display:none */
}

.tme-eval-card:hover {
    box-shadow: 0 4px 16px rgba(28, 43, 58, 0.10);
}

/* Full card is the clickable link target */
.tme-eval-card__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.tme-eval-card__link:focus-visible {
    outline: 2px solid var(--tme-amber);
    outline-offset: 2px;
}


/* -----------------------------------------------
   5b. Card image — 16:9 enforced (Drew M3)
   ----------------------------------------------- */

.tme-eval-card__image-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background-color: var(--tme-slate-light);
    flex-shrink: 0;
}

.tme-eval-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* enforces 16:9 regardless of source image crop */
    display: block;
}

/* Placeholder when no featured image is set */
.tme-eval-card__image-placeholder {
    width: 100%;
    height: 100%;
    background-color: var(--tme-slate-light);
}


/* -----------------------------------------------
   5c. Card body
   ----------------------------------------------- */

.tme-eval-card__body {
    padding: 24px; /* Matches existing .tme-evaluation-card padding */
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.tme-eval-card__title {
    font-family: var(--tme-font-heading);
    font-size: var(--tme-size-h3); /* D4 fix: token replaces hardcoded 20px — Drew visual review */
    font-weight: 600; /* E1: Drew M1 — increased from 400 for scan path clarity in 3-col grid */
    color: var(--tme-body-dark);
    line-height: var(--tme-lh-heading);
    margin: 0;
    /* No truncation — full title renders; card height adjusts */
}

.tme-eval-card:hover .tme-eval-card__title {
    color: var(--tme-amber);
}

.tme-eval-card__excerpt {
    font-family: var(--tme-font-body);
    font-size: var(--tme-size-meta);
    color: var(--tme-body-dark); /* P009-T060: override link-colour inheritance from parent <a> */
    line-height: 1.6;
    margin: 0;
}

/* R7: Drew gap analysis — date field below title, above excerpt
   Small, italic, subdued — anchors post in time without competing with headline.
   P009-T056 | Nova | 2026-04-28 */
.tme-eval-card__date {
    font-family: var(--tme-font-body);
    font-size: 12px;
    font-style: italic;
    color: var(--tme-grey-mid);
    margin: 0 0 8px 0;
}

/* R8: Drew gap analysis — pipe-separated category tags at card foot
   Amber, 12px — navigation signal (distinct from verdict badge status signal).
   P009-T056 | Nova | 2026-04-28 */
.tme-eval-card__tags {
    font-family: var(--tme-font-body);
    font-size: 12px;
    color: var(--tme-amber);
    margin: 8px 0 0 0;
    line-height: 1.4;
}

/* Verdict badge on card — reuses existing .tme-verdict-outcome-badge + .tme-badge-* tokens.
   Those classes are defined in the Taylor CSS and are not redefined here.
   Only layout positioning is added.
   E2: Drew M2 — badge moved above title; margin-top: auto removed (was bottom-push).
   Badge now renders as first element in card body — align-self: flex-start keeps it left-aligned. */
.tme-eval-card__body .tme-verdict-outcome-badge {
    align-self: flex-start;
    margin-top: 0;
    margin-bottom: 4px; /* Small gap between badge and title */
}

/* E4: Drew M4 — methodology trust signal below H1 in page header */
/* P009-T062: font-size 15px → 20px; font-style italic removed */
/* P009-T062 contrast fix: --tme-secondary-grey (#717171) = 4.45:1 on #F7F4EF — fails WCAG AA at 20px normal weight.
   Switched to --tme-grey-mid (#6D6D6D) = 4.72:1 — WCAG AA pass. Drew Minor finding. */
.tme-eval-page-subhead {
    font-family: var(--tme-font-body);
    font-size: 20px;
    color: var(--tme-grey-mid);
    margin: 8px 0 0 0;
    line-height: 1.5;
}

/* E3: Filter result count display */
#tme-filter-count {
    font-family: var(--tme-font-body);
    font-size: var(--tme-size-meta);
    color: var(--tme-secondary-grey);
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 24px 0;
}


/* ============================================================
   6. EMPTY STATE
   ============================================================ */

.tme-eval-empty-state {
    text-align: center;
    padding: 48px 24px;
    /* display controlled by JS / [hidden] attribute */
}

.tme-eval-empty-state[hidden] {
    display: none;
}

.tme-eval-empty-state__message {
    font-family: var(--tme-font-body);
    font-size: var(--tme-size-body);
    color: var(--tme-secondary-grey);
    margin-bottom: 12px;
}

.tme-eval-empty-state__clear {
    font-family: var(--tme-font-body);
    font-size: var(--tme-size-body);
    font-weight: 600;
    color: var(--tme-amber);
    text-decoration: none;
}

.tme-eval-empty-state__clear:hover {
    text-decoration: underline;
}

.tme-eval-empty-state__clear:focus-visible {
    outline: 2px solid var(--tme-amber);
    outline-offset: 2px;
    border-radius: 2px;
}


/* ============================================================
   7. PAGINATION
   ============================================================ */

.tme-eval-pagination {
    margin-top: 40px;
}

/* paginate_links() outputs a <ul> when type='list' */
.tme-eval-pagination ul.page-numbers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
    justify-content: center;
}

.tme-eval-pagination ul.page-numbers li {
    margin: 0;
    padding: 0;
}

.tme-eval-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px; /* WCAG 2.2 AA minimum tap target */
    padding: 8px 12px;
    font-family: var(--tme-font-body);
    font-size: var(--tme-size-body);
    font-weight: 600;
    color: var(--tme-navy);
    background-color: transparent;
    border: 1px solid var(--tme-light-grey);
    border-radius: 3px;
    text-decoration: none;
    transition: background-color 0.1s ease, color 0.1s ease;
}

.tme-eval-pagination .page-numbers:hover {
    background-color: var(--tme-slate-light);
    color: var(--tme-navy);
}

.tme-eval-pagination .page-numbers.current {
    background-color: var(--tme-amber);
    color: var(--tme-navy);
    border-color: var(--tme-amber);
}

.tme-eval-pagination .page-numbers:focus-visible {
    outline: 2px solid var(--tme-amber);
    outline-offset: 2px;
}

.tme-eval-pagination .prev,
.tme-eval-pagination .next {
    font-size: var(--tme-size-meta);
    letter-spacing: 0.02em;
}


/* ============================================================
   8. MOBILE BREAKPOINT — page-level adjustments
   ============================================================ */

@media (max-width: 767px) {

    .tme-eval-page-header {
        padding: 32px 0 16px;
    }

    .tme-eval-page-title {
        font-size: 28px; /* P009-T062: mobile override — keeps 28px; desktop is now 76px */
    }

    .tme-filter-triggers {
        padding: 8px 16px;
    }

    .tme-eval-grid-wrapper {
        padding: 24px 16px 40px;
    }

    .tme-eval-grid {
        gap: 16px;
    }

    .tme-active-filters {
        padding: 8px 16px 0;
    }

    /* Pagination — smaller gap on mobile */
    .tme-eval-pagination ul.page-numbers {
        gap: 4px;
    }
}

@media (max-width: 479px) {

    .tme-eval-page-header__inner {
        padding: 0 12px;
    }

    .tme-eval-grid-wrapper {
        padding: 16px 12px 32px;
    }

    .tme-filter-triggers {
        padding: 8px 12px;
    }
}
