/*
 * archive.css — Product catalog archive and taxonomy archive pages.
 * Handles /shop/ and /product-category/{slug}/, /product-role/{slug}/, etc.
 *
 * Filter sidebar: Dow-style collapsible accordions with per-group autosuggest
 * search and show more / show less truncation.
 */

/* ── Archive Layout ── */
.archive-header {
    background: var(--navy-dark);
    padding: 40px 48px;
}

.archive-header h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--white);
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}

.archive-header p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

.archive-layout {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 48px 64px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    align-items: start;
}

/* ── Filter Sidebar ── */
 

.filter-panel {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md); 
}

.filter-panel-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    font-weight: 700;
    color: var(--navy-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.filter-panel-head-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin-left: 4px;
    background: var(--navy);
    color: var(--white);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--mono);
}

.filter-clear {
    font-size: 11px;
    color: var(--navy);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s;
}

.filter-clear:hover {
    color: var(--navy-light);
}

/* ── Global product search ── */
.filter-search-wrap {
    position: relative;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
}

.filter-search-icon {
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
}

.filter-search {
    width: 100%;
    padding: 9px 12px 9px 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-search:focus {
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(31, 71, 136, 0.08);
}

/* ── Active filter summary ── */
.filter-summary {
    padding: 12px 18px 14px;
    border-bottom: 1px solid var(--border-light);
    background: var(--navy-wash);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-summary-head {
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-summary-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--navy-dark);
}

.filter-summary-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 5px;
    background: var(--navy);
    color: var(--white);
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    font-family: var(--mono);
}

.filter-summary-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.filter-summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    background: var(--white);
    border: 1px solid rgba(31, 71, 136, 0.2);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    color: var(--navy);
    text-decoration: none;
    line-height: 1.3;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.filter-summary-chip:hover {
    background: var(--navy);
    color: var(--white);
    border-color: var(--navy);
}

.filter-summary-chip span {
    font-size: 13px;
    line-height: 1;
    opacity: 0.7;
}

/* ── Accordions ── */
.filter-accordions {
    display: flex;
    flex-direction: column;
}

.filter-accordion {
    border-bottom: 1px solid var(--border-light);
}

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

.filter-accordion-head {
    width: 100%;
    background: transparent;
    border: none;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 700;
    color: var(--navy-dark);
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
}

.filter-accordion-head:hover {
    background: var(--off-white);
}

.filter-accordion-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.filter-accordion-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    background: var(--accent);
    color: var(--white);
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    font-family: var(--mono);
    line-height: 1;
}

.filter-accordion-caret {
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.filter-accordion.is-open .filter-accordion-caret {
    transform: rotate(180deg);
    color: var(--navy);
}

.filter-accordion-body[hidden] {
    display: none;
}

.filter-accordion-body {
    padding: 0 18px 14px;
}

/* In-accordion search */
.filter-group-search-wrap {
    position: relative;
    margin-bottom: 10px;
}

.filter-group-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.filter-group-search {
    width: 100%;
    padding: 7px 10px 7px 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 12px;
    color: var(--text-primary);
    background: var(--white);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-group-search:focus {
    border-color: var(--navy);
    box-shadow: 0 0 0 3px rgba(31, 71, 136, 0.08);
}

/* Autosuggest dropdown */
.filter-group-suggestions {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: 10;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 6px 18px rgba(12, 30, 61, 0.12);
    max-height: 200px;
    overflow-y: auto;
}

.filter-group-suggestions[hidden] {
    display: none;
}

.filter-group-suggestions li {
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    line-height: 1.3;
    transition: background 0.1s;
}

.filter-group-suggestions li:hover,
.filter-group-suggestions li.is-active {
    background: var(--navy-wash);
    color: var(--navy);
}

.filter-group-suggestions li.is-checked {
    color: var(--text-muted);
}

.filter-group-suggestions li.is-checked::after {
    content: "✓";
    color: var(--navy);
    font-weight: 700;
}

.filter-group-suggestions mark {
    background: transparent;
    color: var(--navy);
    font-weight: 700;
}

/* Option list */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.filter-option[hidden] {
    display: none;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 0;
    font-size: 13px;
    cursor: pointer;
    line-height: 1.35;
}

.filter-option input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--navy);
    flex-shrink: 0;
    cursor: pointer;
    margin: 0;
}

.filter-option-label {
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

.filter-option:hover .filter-option-label {
    color: var(--navy);
}

.filter-option-count {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--mono);
    flex-shrink: 0;
}

.filter-options-empty {
    margin: 0;
    padding: 8px 0;
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

/* Show more / less */
.filter-show-more {
    margin-top: 8px;
    padding: 2px 0;
    background: none;
    border: none;
    color: var(--navy);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: color 0.12s;
}

.filter-show-more:hover {
    color: var(--navy-light);
    text-decoration: underline;
}

/* Apply filters button */
.filter-apply {
    display: block;
    width: calc(100% - 36px);
    margin: 16px 18px;
    padding: 11px;
    background: var(--navy);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

.filter-apply:hover {
    background: var(--navy-light);
}

/* ── Active Filters (above grid) ── */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.active-filter-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--navy-wash);
    border: 1px solid rgba(31, 71, 136, 0.15);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--navy);
}

.active-filter-tag a {
    color: var(--text-muted);
    line-height: 1;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.1s;
}

.active-filter-tag a:hover {
    color: var(--navy);
}

/* ── Product Grid ── */
.product-grid-wrap {
    min-width: 0;
}

.product-grid-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}

.product-count {
    font-size: 13px;
    color: var(--text-muted);
}

.product-count strong {
    color: var(--text-primary);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* ── Product Card ── */
.product-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

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

.product-card-family {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent);
    margin-bottom: 6px;
}

.product-card-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--navy-dark);
    margin-bottom: 4px;
    line-height: 1.3;
}

.product-card-cas {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.product-card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 14px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-roles {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 16px;
}

.product-card-role-tag {
    font-size: 9px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 3px;
    background: var(--navy-wash);
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.product-card-link {
    font-size: 12px;
    font-weight: 700;
    color: var(--navy);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: auto;
    text-decoration: none;
    transition: gap 0.15s;
}

.product-card-link:hover {
    gap: 9px;
}

/* ── Pagination ── */
.archive-pagination {
    margin-top: 36px;
    display: flex;
    justify-content: center;
}

.page-numbers {
    display: flex;
    gap: 4px;
    list-style: none;
    flex-wrap: wrap;
    justify-content: center;
}

.page-numbers li a,
.page-numbers li span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    text-decoration: none;
    transition: all 0.15s;
}

.page-numbers li a:hover {
    background: var(--navy-wash);
    color: var(--navy);
    border-color: rgba(31, 71, 136, 0.2);
}

.page-numbers li .current {
    background: var(--navy);
    color: var(--white);
    border-color: var(--navy);
}

/* No results */
.archive-no-results {
    text-align: center;
    padding: 64px 32px;
    color: var(--text-muted);
}

.archive-no-results h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--navy-dark);
    margin-bottom: 8px;
}

/* ── Responsive ── */
@media (max-width: 960px) {
    .archive-layout {
        grid-template-columns: 1fr;
        padding: 24px 20px 48px;
    }

    .filter-sidebar {
        position: static;
    }

    .archive-header {
        padding: 32px 20px;
    }
}

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