/**
 * Artist Archive - CSS
 *
 * Styles for the artist archive page (/artists/)
 *
 * Features:
 * - Artist cards with hover overlays
 * - Letter divider cards (A-Z grouping)
 * - Sticky A-Z filter navigation
 * - Responsive grid (1/2/3/4 columns)
 * - Loading and empty states
 *
 * Converted from design system main.css (lines 1479-2145)
 * All values use design tokens from design-tokens/dist/tokens.css
 *
 * @package ARTBID
 */

/* ============================================
   ARTIST CARD
   ============================================ */

.artist-card {
    display: block;
    position: relative;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none; /* Override WordPress link styles */
}

.artist-card:focus-visible {
    outline: var(--border-width-2) solid var(--color-base-black);
    outline-offset: var(--spacing-scale-0_5); /* 2px */
}

.artist-card-image-wrapper {
    position: relative;
    overflow: hidden;
    margin-bottom: var(--spacing-scale-2); /* 8px - Space between image and name */
    border-radius: var(--radius-brand, 0);
    /* Ensure wrapper maintains aspect ratio for proper overlay positioning */
    aspect-ratio: 1;
}

.artist-card-image {
    width: 100%;
    height: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background-color: var(--color-gray-100);
    border-radius: var(--radius-brand, 0);
    transition: opacity 0.3s ease-in-out;
    display: block; /* Remove any inline spacing */
}

/* Lazy loading fade-in. Only once artist-archive.js has marked the grid, so
   without the script every portrait still shows. */
.artist-grid.is-fading .artist-card-image:not(.loaded):not(.artist-card-image--none) {
    opacity: 0;
}

/* No zoom on hover - keep image stable */
.artist-card:hover .artist-card-image {
    transform: none;
}

/* Hover overlay - shows medium + description */
.artist-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-scale-6); /* 24px */
    color: var(--color-base-white);
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: var(--overlay-dark-50);
    border-radius: var(--radius-brand, 0);
    pointer-events: none;
    z-index: 1;
}

.artist-card:hover .artist-card-overlay,
.artist-card:focus-visible .artist-card-overlay {
    opacity: 1;
}

/* Medium label - serif font, centered */
.artist-card-medium {
    font-family: var(--font-display, serif);
    margin-bottom: var(--spacing-scale-3); /* 12px */
    font-size: var(--text-2xl, clamp(1.5rem, 1.21rem + 0.775vw, 2.25rem)); /* 24px → 36px */
    line-height: var(--font-lineHeight-tight); /* was 1.2 */
    margin-block: 1em var(--spacing-scale-3); /* the h3 margins it had (1em above), kept as a <p> */
    pointer-events: none;
}

/* Description - small sans-serif, centered */
.artist-card-description {
    font-family: var(--font-sans, sans-serif);
    font-size: var(--text-sm, clamp(0.875rem, 0.851rem + 0.065vw, 0.9375rem)); /* 14px → 15px */
    line-height: var(--font-lineHeight-normal);
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    pointer-events: none;
}

/* Artist name - left-aligned, sans-serif */
.artist-card-name {
    font-family: var(--font-sans, sans-serif);
    text-align: left;
    font-size: var(--text-sm); /* 14→15px — the same step as the A–Z letters (Chuck 2026-10-01; was --text-base) */
    line-height: var(--font-lineHeight-tight); /* was 1.3 */
    text-decoration: none; /* Remove underline from link */
    margin-block-start: 0; /* Reset h3 default margin */
    margin-block-end: 0;
    margin: 0; /* Fallback for older browsers */
}

/* ============================================
   LETTER SECTION & CARD
   ============================================ */

/* Letter section - Wrapper for scroll-to functionality */
.letter-section {
    /* Takes up one grid cell - first box in that letter's section */
    scroll-margin-top: var(--spacing-scale-36); /* 144px - Offset for sticky header + filter bar */
}

/* Letter card - Alphabetical divider in grid */
.letter-card {
    position: relative;
    background-color: var(--color-base-white);
    aspect-ratio: 1; /* Match artist card aspect ratio */
    display: flex;
    align-items: flex-end; /* Bottom alignment */
    justify-content: flex-end; /* Right alignment */
    border-radius: var(--radius-brand, 0);
}

.letter-card-letter {
    font-family: var(--font-display, serif);
    font-size: var(--font-size-7xl); /* 72→128px — was a raw clamp(4rem→8rem) (G5, 2026-10-01) */ /* 64px → 128px */
    line-height: var(--font-lineHeight-none);
    font-weight: var(--font-weight-normal);
    color: var(--color-base-black);
    margin: 0; /* an <h2> now (the section heading); looks as the <span> did */
}

/* Artist card wrapper for grid positioning */
.artist-card-wrapper {
    /* No styles needed - just a wrapper for data attributes */
}

/* ============================================
   FILTER BAR — the A–Z guide (scroll variant; the ONLY variant this page
   renders). 2026-10-01: the "box" button variant, the search field, the tag
   rows and the loading rules were dead on this page (the artwork archive
   has its own sheet for its filters) — deleted. THE TAB-INDICATOR PATTERN
   (design-token-index.md §2.3): text · spacing-3 below · a border-width-2
   currentColor indicator resting ON the container's border-width-1 gray-300
   hairline. The journal's filter tabs use the same geometry.
   ============================================ */

.filter-bar {
    background-color: var(--color-base-white);
}

.filter-bar--scroll {
    position: sticky;
    top: 0; /* Sticks below header */
    z-index: 40; /* Below header but above content */
    background-color: var(--color-base-white);
    padding-top: var(--spacing-scale-3); /* 12px */
    padding-bottom: var(--border-width-1); /* only the rule's own height under the letters */
}

/* THE RULE under the guide: inset by one scale step each side so it ends where
   the directory grid's edges do (spacing-4), not at the viewport. The bar itself
   stays full-width (its sticky background must cover scrolled content). */
.filter-bar--scroll::after {
    content: "";
    position: absolute;
    left: var(--spacing-scale-4);
    right: var(--spacing-scale-4);
    bottom: 0;
    border-bottom: var(--border-width-1) solid var(--color-gray-300);
}

.filter-bar--scroll .filter-bar-inner {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

.filter-bar--scroll .filter-az-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-scale-2); /* 8px */
    width: auto;
}

@media (min-width: 1024px) {
    .filter-bar--scroll .filter-az-wrapper {
        flex-direction: row;
        align-items: flex-end; /* label + letters share one bottom edge (both carry the indicator box) */
        gap: var(--spacing-scale-4); /* 16px */
    }
}

.filter-bar--scroll .filter-label {
    font-size: var(--text-sm); /* the same step as the letters and the card names (Chuck 2026-10-01) */
    font-family: var(--font-sans, sans-serif);
    font-weight: 400;
    color: var(--color-gray-600);
    flex-shrink: 0;
    white-space: nowrap;
    /* The same box as a letter (spacing-3 below + a transparent indicator), so
       "Scroll to:" sits on the letters' line, not centred on their taller box. */
    padding-bottom: var(--spacing-scale-3);
    border-bottom: var(--border-width-2) solid transparent;
    line-height: var(--font-lineHeight-tight); /* = the letters, so both texts share one line */
}

.filter-bar--scroll .filter-az {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-scale-3); /* 12px */
}

.filter-bar--scroll .filter-az-btn {
    width: auto;
    height: auto;
    /* the indicator now overlays the bottom --border-width-2 (THE TAB,
       global-blocks.css): the padding grows by it, so the text→line distance
       (spacing-3) and the box are unchanged. */
    padding: 0 var(--spacing-scale-1) calc(var(--spacing-scale-3) + var(--border-width-2));
    font-size: var(--text-sm, 0.875rem); /* 14px */
    font-weight: 400;
    line-height: var(--font-lineHeight-tight);
}

.filter-bar--scroll .filter-az-btn:focus-visible {
    outline: var(--border-width-2) solid var(--color-base-black);
    outline-offset: var(--spacing-scale-0_5); /* 2px */
}

.filter-bar--scroll .filter-az-btn.active {
    font-weight: 500;
}

.filter-bar--scroll .filter-az-btn:disabled {
    color: var(--color-gray-300);
    cursor: default;
}

/* PHONES AND TABLETS: ONE ROW THAT SCROLLS SIDEWAYS (Chuck 2026-10-29,
   Artist Archive Grid card — the wrapped letters took three sticky rows,
   about a fifth of a phone's screen). "Scroll to:" stays put at the left;
   the letters run on past the edge and the active letter is kept in view
   (artist-archive.js). The rule under the bar is unchanged. After the base
   rules above, which it overrides at the same specificity. */
@media (max-width: 1023px) {
    .filter-bar--scroll .filter-bar-inner {
        justify-content: flex-start;
    }

    .filter-bar--scroll .filter-az-wrapper {
        flex-direction: row;
        align-items: flex-end;
        gap: var(--spacing-scale-3);
        width: 100%;
        min-width: 0;
    }

    .filter-bar--scroll .filter-az {
        flex: 1;
        min-width: 0;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
    }

    .filter-bar--scroll .filter-az::-webkit-scrollbar {
        display: none;
    }

    .filter-bar--scroll .filter-az-btn {
        flex: none;
    }

    /* "THERE'S MORE" (Chuck 2026-11-06, Yael's Artist Archive Grid card):
       the house chevron (the sliders' mitred arrow) over a white fade at an
       end with letters past it; a tap moves the row on (artist-archive.js
       sets data-more-prev / data-more-next). The button's padding is the
       letters' own, so the chevron centres on their line of text. */
    .filter-bar--scroll .filter-az-rail {
        position: relative;
        display: flex;
        flex: 1;
        min-width: 0;
    }

    .filter-bar--scroll .filter-az-more {
        position: absolute;
        top: 0;
        bottom: 0;
        display: flex;
        align-items: center;
        width: var(--spacing-scale-8);
        padding: 0 0 calc(var(--spacing-scale-3) + var(--border-width-2));
        border: 0;
        font-size: var(--text-sm);
        line-height: var(--font-lineHeight-tight);
        color: var(--color-base-black);
        cursor: pointer;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s, visibility 0.2s;
    }

    .filter-bar--scroll .filter-az-more--next {
        right: 0;
        justify-content: flex-end;
        background: linear-gradient(to right, transparent, var(--color-base-white) 50%);
    }

    .filter-bar--scroll .filter-az-more--prev {
        left: 0;
        justify-content: flex-start;
        background: linear-gradient(to left, transparent, var(--color-base-white) 50%);
    }

    .filter-bar--scroll .filter-az-rail[data-more-next] .filter-az-more--next,
    .filter-bar--scroll .filter-az-rail[data-more-prev] .filter-az-more--prev {
        opacity: 1;
        visibility: visible;
    }

    .filter-bar--scroll .filter-az-more::before {
        content: "";
        display: block;
        height: 1em;
        width: calc(1em * 46 / 82); /* the chevron's own shape */
        background-color: currentColor;
        -webkit-mask: url("data:image/svg+xml,%3Csvg width='46' height='82' viewBox='0 0 46 82' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0L45.1025 39H32L0 12V0Z' fill='black'/%3E%3Cpath d='M0 82L45.1025 43H32L0 70V82Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
        mask: url("data:image/svg+xml,%3Csvg width='46' height='82' viewBox='0 0 46 82' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0L45.1025 39H32L0 12V0Z' fill='black'/%3E%3Cpath d='M0 82L45.1025 43H32L0 70V82Z' fill='black'/%3E%3C/svg%3E") center / contain no-repeat;
    }

    .filter-bar--scroll .filter-az-more--prev::before {
        transform: scaleX(-1);
    }
}

/* Desktop shows every letter: the rail is no box and the chevrons never show. */
@media (min-width: 1024px) {
    .filter-bar--scroll .filter-az-rail {
        display: contents;
    }

    .filter-bar--scroll .filter-az-more {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .filter-bar--scroll .filter-az-more {
        transition: none;
    }
}

/* The grid itself (columns, gap, edges) is owned by the block's own stylesheet
   (blocks/artist-archive-grid/style.scss) since 2026-10-01 — one owner, no
   duplicate at two breakpoints. */

/* ============================================
   LOADING & EMPTY STATES
   ============================================ */

/* Empty state */
.empty-state {
    text-align: center;
    /* Fluid vertical padding: 64px → 96px (375px → 1920px) */
    padding-top: var(--spacing-block-lg); /* 60→96px (was a raw clamp 64→96) */
    padding-bottom: var(--spacing-block-lg);
}

.empty-state-icon {
    margin: 0 auto var(--spacing-scale-4);
    color: var(--color-gray-300); /* gray-300 */
    /* Fluid icon size: 64px → 80px */
    width: var(--spacing-scale-16); /* 64px (was a raw clamp 64→80) */
    height: var(--spacing-scale-16);
}

.empty-state-title {
    font-size: var(--text-2xl, 1.5rem); /* 24px */
    font-family: var(--font-display, serif);
    margin-bottom: var(--spacing-scale-2); /* 8px */
    color: var(--color-gray-900); /* gray-900 */
}

.empty-state-description {
    font-size: var(--text-base, 1rem);
    color: var(--color-gray-600); /* gray-600 */
    max-width: var(--spacing-scale-96); /* 384px - closest available token to 448px */
    margin: 0 auto var(--spacing-scale-6);
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: var(--spacing-scale-8); /* 32px */
    height: var(--spacing-scale-8);
    border: var(--spacing-scale-1) solid var(--color-gray-200); /* 4px, gray-200 */
    border-top-color: var(--color-base-black);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-state {
    text-align: center;
    padding: var(--spacing-scale-8) 0; /* 32px */
}

/* ============================================
   DIRECTORY HEADER TIGHTEN + CENTER (Chuck, 2026-07-09):
   heading and alpha nav both centered; vertical space between the
   hero heading and the letter nav pulled way in. Scoped to the
   artist CPT archive via WP's body class.
   ============================================ */

.post-type-archive-artbid-artist .inner-hero[data-layout="text-only"] {
    text-align: center;
    min-height: 0;
    padding-top: var(--spacing-block-sm); /* 20→32px (was a raw clamp 32→48; tight — Yael 10-01) */
    padding-bottom: var(--spacing-scale-3); /* 12px */
}

.post-type-archive-artbid-artist .inner-hero[data-layout="text-only"] .inner-hero-content {
    padding-top: 0;
    padding-bottom: 0;
    min-height: 0;
}

/* Round 2 (measured live 2026-07-09): the wrapper is a flex row that
   parks the content column LEFT and adds its own 64px padding; the h1
   carries ~44px block margins from theme typography. */
.post-type-archive-artbid-artist .inner-hero[data-layout="text-only"] .inner-hero-content-wrapper {
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
    min-height: 0;
}

.post-type-archive-artbid-artist .inner-hero[data-layout="text-only"] h1.hero-heading {
    margin-block: 0;
    /* the heading box is fit-content width — center the box itself */
    margin-inline: auto;
}
