/*
 * * Product Category/Archive Pages
 * */

/* */
/* Header section (category logos and description) flexbox layout */
/* */

.woocommerce-products-header {
    display: flex;
    flex-flow: row wrap !important; /* Override default column, row responds dynamically */
    justify-content: space-around;
    align-items: center;
    padding-block-end: 0 !important; /* Logical padding */
    min-height: 12em;
}
.woocommerce-products-header h1 { 
    /*order: 2;    */
    text-align: center;
    width: 100%;
}
body.tax-product_cat .woocommerce-products-header h1 { 
    display: none !important; /* Hiding the product category heading from visual browsers as redundant w/ logos, but only on category/subcategories, not other archives */
}  
.woocommerce-products-header img.woocommerce-products-header__logo,
.woocommerce-products-header .inline-svg-logo {
    /*order: 1;*/
    height: 10em;
    width: 10em;
    /* Ensure the logo fits inside without stretching or cropping */
    object-fit: contain;
    /* Center the logo within its 1x1 space if it is narrow */
    object-position: center;
    vertical-align: top;
}
/* Ensure the raw SVG paths fill the 10em container perfectly */
.woocommerce-products-header .inline-svg-logo svg {
    width: 100%;
    height: 100%;
    display: block;
}
.woocommerce-products-header .term-description {
    order: 3;
    text-align: start; /* RTL Safe: Adapts to LTR/RTL dynamically */
    flex-shrink: 1;
    max-width: 40em;
} 
.woocommerce-products-header .term-description p {
    margin: 0; /* More garbage */
    font-weight: 300;
} 


/* Add icons for specific archive page titles */
h1::before, h1::after {
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    padding-inline: 0.5em; /* Logical padding */
}

/* Icons content attributes, consistent with product attributes */
.tax-pa_item-code h1::before {        content: "\f02a";}
.tax-pa_quantity h1::before {        content: "\e4e6";}
.tax-pa_status h1::before {         content: "\f071";}
.tax-product_tag h1::before {        content: "\#";   }
.tax-pa_product-type h1::before {   content: "\e4e2";}
.tax-pa_class h1::before {            content: "\f11b";}
.tax-pa_genre h1::before {            content: "\f6e2";}
.tax-pa_region h1::before {         content: "\f0ac";}
.tax-pa_territory h1::before {        content: "\f024";}
.tax-pa_packaging h1::before {      content: "\f466";}
.tax-pa_documentation h1::before {  content: "\f02d";}
.tax-pa_developer h1::before {        content: "\f5fc";}
.tax-pa_manufacturer h1::before {    content: "\f275";}
.tax-pa_publisher h1::before {        content: "\f1ad";}
.tax-pa_distributor h1::before {    content: "\f494";}
.tax-pa_media h1::before {            content: "\f51f";}
.tax-pa_players h1::after {            content: "\f0c0";}
.tax-pa_peripherals h1::before {    content: "\f11b";}
.tax-pa_av-modes h1::before {        content: "\f26c";}
.tax-pa_os h1::before {                content: "\f120";}
.tax-pa_release-date h1::before {    content: "\f073";}




/* ========================================= */
/* ARCHIVE LOOP TOOL BAR                     */
/* ========================================= */

.itemloop-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-block: 1em; /* Logical top/bottom margin */
    gap: 1em;
    flex-wrap: wrap;
    font-size: .9em;
    margin-bottom: 2em;
}

/* ========================================= */
/* PAGINATION (FLAT DIV STRUCTURE) */
/* ========================================= */

.pagination-track {
    display: flex;
    gap: 2px;
}
/* Base Button Style */
.pagination-node .page-numbers {
    background-color: var(--btn-bg);
    color: var(--text-color);
    padding: .5em 1em;
    border-bottom: 3px solid transparent;
    transition: background 0.2s;
    text-decoration: none;
}
/* Hover & Current */
.pagination-node a.page-numbers:hover {
    background-color: rgba(0, 0, 0, 0.1);
    border-bottom-color: #666;
}
.pagination-node .page-numbers.current {
    background-color: rgba(0, 0, 0, 0.15) !important;
    color: var(--btn-text);
    border-bottom-color: var(--btn-alt-bg);
    font-weight: 700;
}
/* Rounded ends */
.pagination-track .pagination-node:first-of-type .page-numbers {
    border-start-start-radius: 4px;
    border-end-start-radius: 4px;
}
.pagination-track .pagination-node:last-of-type .page-numbers {
    border-start-end-radius: 4px;
    border-end-end-radius: 4px;
}
/* Pseudo-content for arrows */
.pagination-node  .prev-icon::before {
    content: "\2190"; /* left arrow */
}
.pagination-node .next-icon::before {
    content: "\2192"; /* right arrow */
}
/* RTL Mirroring */
html[dir="rtl"] .pagination-node .pagination-arrow {
    transform: rotateY(180deg);
}


/* ========================================= */
/* Body section product loop grid layout     */
/* ========================================= */
.itemloop,
.products {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(12vw, 30%, 180px), 1fr));
    gap: 1rem;
}
/* In cases of large screen and very few items, grid items get massive; put a ceiling on how large grid item's content can grow */
.itemloop a,
.products a {
    max-width: 20em;
    margin: auto;
}

/* another catastrophic storefront shit, a blank pseudo content? trash hacks for no fucking reason? */
.products::before, .products::after { 
    content: none !important;
}
h2.woocommerce-loop-category__title { 
    display: none;            /* Hide category labels, logos are enough, but kept for accessibility */
}

li.product-category {
    width: 95% !important;
    margin: 0 !important;
    list-style: none;
}

mark.count {
    display: none;
}

/* Adjustments for smaller screens*/
@media (max-width:768px) {
    h2.woocommerce-loop-product__title, h2.woocommerce-loop-category__title { 
        font-size: 0.7rem !important;
    }
}
@media (max-width:568px) {
    h2.woocommerce-loop-product__title, h2.woocommerce-loop-category__title { 
        height: 1em;
        white-space: nowrap; /* Reduce titles to single line and truncate on phones */
        overflow: hidden;
        text-overflow: ellipsis;
    }
}




/* ==========================================================================
   CHROMAGI ARCHIVE FILTERS
   ========================================================================== */

.itemloop-toolbar__count {
    flex: 1; /* Takes up exactly 1 equal share of the extra space */
    text-align: start;
}

.itemloop-toolbar__pagination {
    flex: 0 1 auto; /* Only takes up as much space as it needs */
    text-align: center;
}

.itemloop-toolbar__filter {
    flex: 1; /* Matches the left side, keeping the center perfectly locked */
    display: flex;
    justify-content: flex-end; /* Pushes buttons strictly to the right */
    align-items: center;
    gap: 1em;
}

/* --------------------------------------------------------------------------
   2. TRIGGER BUTTONS (Base Styles for both Filter & Reset)
   -------------------------------------------------------------------------- */
.chromagi-toolbar-text-trigger {
    cursor: pointer;
    display: inline-flex; /* Changed from inline-block to natively align glyphs */
    align-items: center;
    padding: .5em 1em;
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
    border-bottom: 3px solid transparent;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    user-select: none;
    border-radius: 3px;
}

/* Filter Items: Dropdown Arrow */
.chromagi-toolbar-text-trigger:not(.reset-trigger)::after {
    content: '\25BE';
    margin-inline-start: 0.5em;
    font-size: 0.8em;
    transition: transform 0.2s ease;
}

/* Clear Filters: Cross Glyph */
.chromagi-toolbar-text-trigger.reset-trigger::before {
    content: '\2715'; 
    font-size: 0.8em; 
    margin-inline-end: 6px; 
    transform: translateY(1px); 
}

/* --------------------------------------------------------------------------
   3. BUTTON STATES (Hover, Active, Dark Mode)
   -------------------------------------------------------------------------- */
/* Light Mode */
.chromagi-toolbar-text-trigger:hover {
    background-color: rgba(0, 0, 0, 0.1);
    border-bottom-color: #666;
}

.chromagi-toolbar-text-trigger.active {
    background-color: rgba(0, 0, 0, 0.15);
    border-bottom-color: #000;
}

.chromagi-toolbar-text-trigger.active::after {
    transform: rotate(180deg);
}

/* Dark Mode Specificity */
body.dark-mode .chromagi-toolbar-text-trigger {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .chromagi-toolbar-text-trigger:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-bottom-color: #aaa;
}

body.dark-mode .chromagi-toolbar-text-trigger.active {
    background-color: rgba(255, 255, 255, 0.2);
    border-bottom-color: #fff;
}

/* --------------------------------------------------------------------------
   4. FILTER DRAWER & GRID (Strict Breakpoints)
   -------------------------------------------------------------------------- */
.filter-grid {
    display: grid;
    gap: 1.5rem;
    margin-block: 1rem;
    
    /* 1. THE DEFAULT (Ultra-Wide Desktop): 10 Columns */
    grid-template-columns: repeat(10, 1fr); 
}

/* 2. THE 5x2 BREAKPOINT (Standard Desktop / Tablet Landscape) */
/* Adjust the 1400px value to exactly where your 10-pane row starts feeling cramped */
@media (max-width: 1400px) {
    .filter-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* 3. THE 3-COLUMN BREAKPOINT (Tablet Portrait) */
@media (max-width: 900px) {
    .filter-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 4. THE MOBILE STACK (Phones) */
@media (max-width: 600px) {
    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --------------------------------------------------------------------------
   5. CHECKBOX LISTS (Hanging Indent Fix)
   -------------------------------------------------------------------------- */
.filter-item-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 12px;
    overflow-y: auto;
    letter-spacing: -0.05em;
    line-height: 1.3; /* Slight bump to make wrapped lines readable */
}

.filter-item strong {
    font-size: 0.8em;           /* Optional: slightly smaller for UI labels */
    font-weight: 700;
    text-transform: uppercase; /* Forces all-caps */
}

.filter-item-list li {
    margin-bottom: 4px; /* Increased slightly to separate items when wrapped */
    white-space: normal; /* Allows the text to break */
}

.filter-item-list label {
    display: flex;
    align-items: flex-start; /* Pins the checkbox to the top line of text */
    gap: 6px;
    cursor: pointer;
    word-break: keep-all;
}

.filter-item-list input[type="checkbox"] {
    margin: 0;
    width: 12px;
    height: 12px;
    flex-shrink: 0; /* CRITICAL: Prevents long text from crushing the box */
    margin-top: 1px; /* Optically aligns box with the font baseline */
}

.filter-item-list::-webkit-scrollbar {
    width: 4px;
}

.filter-item-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

/* Target just the 'Class' filter column which has long labels */
.filter-item.class .filter-item-list label {
    letter-spacing: -0.075em;
}
/* Grey out list items when prior filter leaves them 0 results  */
.filter-item-list li {
    transition: opacity 0.3s ease;
}
.filter-item-disabled label {
    opacity: 0.4;
    pointer-events: none;
}



/* --------------------------------------------------------------------------
   6. SORTING BUTTON (AJAX Dropdown Menu)
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   6. SORTING BUTTON (AJAX Dropdown Menu)
   -------------------------------------------------------------------------- */

/* --- Logic for Visibility --- */
.js-filter-trigger, .js-reset-trigger { display: none; }
.js-filter-trigger.is-visible, .js-reset-trigger.is-visible { display: inline-flex; }

.filter-drawer { display: none; }
.filter-drawer.is-open { display: block; }

/* --- Sort Wrapper --- */
.chromagi-sort-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-inline-start: 15px; 
}

.js-sort-trigger { cursor: pointer; }

/* --- Sort Dropdown --- */
.chromagi-dropdown-list {
    display: none;
    position: absolute;
    top: 100%;
    inset-inline-end: 0; 
    
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 10px;
    
    padding: 8px 0; /* Padding moved to top/bottom only to allow full-width hover on links */
    margin: 4px 0 0 0;
    list-style: none;
    z-index: 100;
    min-width: 200px;
    text-align: start;
    box-shadow: var(--glass-shadow);
}

.chromagi-dropdown-list.is-open { display: block; }

.chromagi-dropdown-list li {
    margin: 0;
    padding: 0;
}

/* --- Links & States --- */
.chromagi-dropdown-list .chromagi-ajax-sort {
    text-decoration: none;
    display: block;
    padding: 8px 16px; /* Expanded hit area for better UX */
    font-size: 14px;
    font-weight: 400;
    color: var(--text-color);
    transition: background-color 0.25s ease-in-out, color 0.25s ease-in-out;
}

.chromagi-dropdown-list .chromagi-ajax-sort:hover,
.chromagi-dropdown-list .chromagi-ajax-sort:focus { 
    background-color: var(--glass-hover);
    color: var(--accent-color);
    text-decoration: none;
}

.chromagi-dropdown-list .chromagi-ajax-sort.is-active { 
    font-weight: 700; 
    color: var(--heading-color); 
    background-color: var(--glass-hover);
}

/* --- Loading States --- */
.products.is-loading, .filter-grid.is-loading { opacity: 0.4; pointer-events: none; }








/* */
/* New CPT archive snippets  */
/* */


/* Company archive: make featured-image SVGs visible (WP often outputs 1x1) */
.post-type-archive-series .itemloop-item-image,
.post-type-archive-company .itemloop-item-image {
  width: 100%;
  aspect-ratio: 1 / 1;     /* logo tile, stable grid */
  display: block;
}

.post-type-archive-series .itemloop-item-image > span,
.post-type-archive-company .itemloop-item-image > span {
  display: block;
  width: 100%;
  height: 100%;
}

.post-type-archive-series .itemloop-item-image img,
.post-type-archive-company .itemloop-item-image img {
  width: 100% !important;
  height: 100% !important;
  display: block;
  object-fit: contain;
}

/* ==========================================================================
   Company Archive – Placeholder tile when no featured image
   ========================================================================== */

.post-type-archive-company .itemloop-item-image {
    width: 100%;
    aspect-ratio: 1 / 1;          /* Stable tile area */
    display: block;
}

.post-type-archive-company .itemloop-item-image > span {
    display: block;
    width: 100%;
    height: 100%;
}

/* Real images: ensure SVGs (often 1x1) still fill the tile */
.post-type-archive-company .itemloop-item-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    display: block;
}

/* Placeholder: ONLY shows when no image exists (because PHP inserts it) */
.post-type-archive-company .company-thumb-placeholder {
    display: block;
    width: 100%;
    height: 100%;
    border: 1px solid var(--glass-border);
    border-radius: 10px;          /* “Decent” radius, not a colour */
    background: transparent;       /* No hardcoded colour */
}
``