/* ==========================================================================
   CSS Variables & Base Styles
   ========================================================================== */

   :root {
    /* Greyscale variations */
    --dark-base: #000000;
    --dark-medium-darkest: #0a0a0a;
    --dark-medium-darker: #141414;
    --dark-medium: #1f1f1f;
    --dark-medium-lighter: #545454;
    --dark-medium-lightest: #878787;
    --dark-medium-lightest-30percent: rgba(84, 84, 84, 0.3);
    --dark-light: #d1d1d1;
    
    /* Accent variations */
    --accent-base: gold;
    --accent-hover: #ffd700;
    --accent-muted: #daa520;
    --accent-light: #ffed4e;
    --accent-dark: #b8860b;
    --accent-darker: #8b6914;
    --accent-darkest: #5d4a0e;
    
    --success: #5a905a;
    --border: #3e3106;
    
    /* Typography - Responsive Font Scale using clamp() */
    --font-xs: clamp(0.7rem, 0.8vw + 0.6rem, 0.8rem);      /* 0.7rem - 0.8rem */
    --font-sm: clamp(0.75rem, 0.8vw + 0.65rem, 0.85rem); /* 0.75rem - 0.85rem */
    /* Base */
    --font-md: clamp(1rem, 1.2vw + 0.8rem, 1.2rem);       /* 1rem - 1.2rem */
    --font-lg: clamp(1.1rem, 1.4vw + 0.8rem, 1.4rem);     /* 1.1rem - 1.4rem */
    --font-xl: clamp(1.3rem, 1.6vw + 1rem, 1.6rem);       /* 1.3rem - 1.6rem */
    --font-2xl: clamp(1.5rem, 2vw + 1.2rem, 2rem);        /* 1.5rem - 2rem */
    --font-3xl: clamp(2rem, 2.5vw + 1.5rem, 2.5rem);      /* 2rem - 2.5rem */
    --font-4xl: clamp(2.5rem, 3vw + 2rem, 3rem);         /* 2.5rem - 3rem */
    --font-5xl: clamp(3rem, 4vw + 2.5rem, 4rem);         /* 3rem - 4rem */

    /* Responsive unified sizing scale */
    --xs: clamp(0.25rem, 0.5vw + 0.25rem, 0.5rem);    /* 4px to 8px */
    --sm: clamp(0.75rem, 1vw + 0.5rem, 1rem);        /* 12px to 16px */
    --md: clamp(1rem, 1.5vw + 0.75rem, 1.5rem);     /* 16px to 24px */
    --lg: clamp(1.5rem, 2vw + 1rem, 2rem);           /* 24px to 32px */
    --xl: clamp(2rem, 3vw + 1.5rem, 3rem);           /* 32px to 48px */

    /* Responsive line-heights using clamp() */
    --tight: clamp(1.1, 0.1vw + 1.0, 1.2);    /* 1.1 to 1.2 */
    --normal: clamp(1.4, 0.2vw + 1.3, 1.6);  /* 1.4 to 1.6 */
    --relaxed: clamp(1.5, 0.3vw + 1.4, 1.8); /* 1.5 to 1.8 */
    --loose: clamp(1.7, 0.5vw + 1.7, 2.2);   /* 2.2 to 2.6 */

    /* Border radius */
    --radius: 0.5rem;
    --radius-rounded: 50%;
    
    /* Text shadows */
    --text-shadow-layered: 0px 0px 1px rgba(0,0,0,0.6), -1px 1px 2px rgba(0,0,0,0.6), 0 2px 4px rgba(0,0,0,0.3);
    --text-shadow-layered-small: 0px 0px 1px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 1);

    /* Color Scheme - Matching blog archive theme */
    --shadow: rgba(194, 70, 182, 0.3);
    --shadow-hover: rgba(194, 70, 180, 0.4);

    /* Issue Card Dimensions */
    --issue-card-width: 200px;
    --issue-card-height: 306px; /* 17:26 ratio (200 * 26/17) */
    --issue-card-ratio: 17/26; /* Portrait ratio for issue covers */
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: var(--font-md);
    line-height: var(--relaxed);
    color: var(--dark-light);
    background-color: var(--dark-base);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--md);
}

.container-full {
    max-width: none;
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   Compact Issues Controls
   ========================================================================== */

.comics-controls {
    display: flex;
    align-items: center;
    gap: var(--md);
    padding: var(--md) 0;
    justify-content: center;
}

.search-container {
    position: relative;
    max-width: 400px;
}

.sort-controls {
    display: flex;
    gap: var(--sm);
}

.sort-btn {
    width: 3rem;
    height: 3rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--dark-medium-darker);
    color: var(--dark-light);
    font-size: var(--font-2xl);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.sort-btn:hover {
    background: var(--accent-base);
    border-color: var(--accent-base);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.sort-btn.active {
    background: var(--accent-base);
    border-color: var(--accent-base);
    color: white;
}

.sort-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.sort-btn:hover::before {
    left: 100%;
}

.search-input {
    width: 100%;
    padding: var(--xs) var(--sm);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--dark-medium-darker);
    color: var(--dark-light);
    font-size: var(--font-xl);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.search-input:hover {
    border-color: var(--accent-base);
}

.search-input:focus {
    outline: none;
    border: 1px solid var(--accent-hover);
    border-color: var(--accent-base);
    transform: translateY(-1px);
}

.search-input::placeholder {
    color: var(--dark-medium-lightest);
    transition: color 0.3s ease;
}

.search-input:focus::placeholder {
    color: var(--dark-medium-lighter);
}

/* Caret color styling for search input */
.search-input {
    caret-color: var(--accent-base);
}

.search-clear-btn {
    position: absolute;
    right: var(--sm);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--dark-medium-lightest);
    cursor: pointer;
    font-size: var(--font-md);
    padding: var(--xs);
    border-radius: var(--radius-rounded);
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.search-clear-btn:hover {
    background-color: var(--dark-medium-darker);
    color: var(--dark-light);
}

/* Sort controls */
.sort-controls {
    display: flex;
    align-items: center;
    gap: var(--sm);
}

.sort-select {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--dark-medium-darker);
    color: var(--dark-light);
    font-size: var(--font-xl);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sort-select:hover {
    background: var(--dark-medium);
    border-color: var(--accent-base);
}

.sort-select:focus {
    outline: none;
}

.filter-buttons {
    display: flex;
    gap: var(--sm);
}

.filter-button {
    width: 3rem;
    height: 3rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-rounded);
    background: var(--dark-medium-darker);
    color: var(--dark-light);
    font-size: var(--font-2xl);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

.filter-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.filter-button:hover::before {
    left: 100%;
}

.filter-button:hover {
    background: var(--dark-medium);
    border: 1px solid var(--accent-base);
    border-radius: var(--radius-rounded);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px var(--shadow);
}

.filter-button:active {
    transform: translateY(0) scale(1);
}

/* Active state for filter buttons when filters are applied */
.filter-button.active {
    background-color: var(--dark-medium-darker);
    border: 1px solid var(--success);
    border-radius: var(--radius-rounded);
    color: var(--dark-base);
    box-shadow: 0 4px 12px rgba(194, 70, 76, 0.3);
}

.filter-button.active:hover {
    background-color: var(--success);
    transform: translateY(-2px) scale(1.05);
}

/* Active Filters Display */
.active-filters-display {
    display: flex;
    align-items: center;
    gap: var(--md);
    margin-bottom: var(--lg);
    padding: var(--md);
    background: var(--dark-medium-darkest);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.active-filters-label {
    color: var(--dark-medium-lightest);
    font-size: var(--font-sm);
    font-weight: 500;
    white-space: nowrap;
}

.active-filter-chips {
    display: flex;
    gap: var(--sm);
    flex-wrap: wrap;
}

.active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--xs);
    background: var(--accent-base);
    color: var(--dark-base);
    padding: var(--xs) var(--sm);
    border-radius: var(--radius);
    font-size: var(--font-sm);
    font-weight: 500;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: all 0.2s ease;
}

.active-filter-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(194, 70, 76, 0.3);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.remove-filter-btn {
    background: none;
    border: none;
    color: var(--dark-base);
    cursor: pointer;
    font-size: var(--font-md);
    padding: 0;
    width: 1.2rem;
    height: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-rounded);
    transition: all 0.2s ease;
}

.remove-filter-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.clear-all-filters-btn {
    color: var(--accent-base);
    border: none;
    background-color: var(--dark-base);
    cursor: pointer;
    font-size: var(--font-md);
    white-space: nowrap;
}

.clear-all-filters-btn:hover {
    color: var(--accent-hover);
}

/* ==========================================================================
   Modal Styles (Matching blog design system)
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background-color: var(--dark-medium-darker);
    border-radius: var(--radius);
    padding: 0.75rem 1rem 1rem 1rem;
    max-width: 640px;
    width: 90%;
    max-height: 100vh;
    min-height: 240px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    flex-direction: column;
}

.modal-content {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 0 1rem 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: var(--font-xl);
    font-weight: 600;
    color: var(--dark-light);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--font-2xl);
    cursor: pointer;
    color: var(--dark-medium-lightest);
    padding: 0.5rem;
    border-radius: var(--radius-rounded);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background-color: var(--dark-medium-darkest);
    color: var(--dark-light);
}

.filter-section {
    margin-bottom: 1.5rem;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-label {
    display: block;
    color: var(--dark-light);
    font-weight: 600;
    font-size: var(--font-sm);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex-direction: row;
    justify-content: flex-start;
}

.filter-checkbox {
    position: relative;
}

.filter-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.filter-checkbox label {
    display: inline-block;
    background-color: var(--dark-medium-darkest);
    color: var(--dark-medium-lightest);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
    font-size: var(--font-xs);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    user-select: none;
    text-align: center;
}

.filter-checkbox input[type="checkbox"]:checked + label {
    background-color: var(--accent-base);
    color: var(--dark-base);
    border-color: var(--accent-base);
}

.filter-checkbox label:hover {
    background-color: var(--dark-medium-darker);
    color: var(--dark-light);
}

/* Count badges for filter options */
.count-badge {
    background-color: var(--dark-base);
    color: var(--dark-medium-lightest);
    font-size: var(--font-xs);
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius);
    margin-left: 0.5rem;
    font-weight: 500;
}

.filter-checkbox input[type="checkbox"]:checked + label .count-badge {
    background-color: var(--dark-base);
    color: var(--dark-medium-lightest);
}

/* Filter subsections for grouped filters */
.filter-subsection {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.filter-subsection .filter-label {
    font-size: var(--font-xs);
    color: var(--dark-medium-lightest);
    margin-bottom: 0.5rem;
}

a {
    color: var(--accent-base);
    text-decoration: none;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin: 1rem -1.5rem -1.5rem -1.5rem;
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--border);
    background-color: var(--dark-medium-darker);
    position: sticky;
    bottom: -1.5rem;
    z-index: 10;
    background-clip: padding-box;
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: var(--font-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: var(--accent-base);
    color: var(--dark-base);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-secondary {
    background-color: var(--dark-medium-darker);
    color: var(--dark-light);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--dark-medium);
}

/* ==========================================================================
   Results Summary
   ========================================================================== */

.results-summary {
    background: var(--dark-medium-darkest);
    /* border-radius: var(--radius); */
    /* padding: var(--md); */
    /* margin-bottom: var(--lg); */
    /* border: 1px solid var(--border); */
}

.results-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--lg);
    margin-bottom: var(--sm);
}

.result-count {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--dark-light);
}

.page-info {
    font-size: var(--font-sm);
    color: var(--dark-medium-lightest);
}

/* ==========================================================================
   Issues Grid Layout
   ========================================================================== */

.issues-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    width: fit-content; /* Let the flex container size itself to content */
    max-width: 100%; /* Don't exceed parent container */
    /* Prevent grid shifts during loading */
    min-height: 200px; /* Reserve space for at least one row */
    contain: layout; /* CSS containment for performance */
    justify-content: center;
    align-items: flex-start;
}

/* ==========================================================================
   Scroll-to-Bloom Animation (Modern CSS Scroll-Driven Animations)
   Based on Adam Argyle's scroll-to-bloom technique
   ========================================================================== */

/* Progressive enhancement - only apply if scroll-driven animations are supported */
@supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
        /* Reset any existing animations */
        .issue-card,
        .collection-card {
            animation: none;
        }

        /* Apply scroll-to-bloom animation to cards */
        .issues-grid > .issue-card,
        .issues-grid > .collection-card {
            animation-name: scroll-to-bloom;
            animation-timeline: view();
            animation-range: cover 0% contain 25%;
            animation-fill-mode: both;
            animation-duration: 1ms; /* Required but ignored for scroll-driven animations */
        }

        /* Bloom fanning patterns - cards start clustered and fan out to grid positions */
        .issues-grid > .issue-card:nth-child(6n+1),
        .issues-grid > .collection-card:nth-child(6n+1) {
            --bloom-x: -60px;
            --bloom-y: -30px;
            --bloom-rotation: -15deg;
        }

        .issues-grid > .issue-card:nth-child(6n+2),
        .issues-grid > .collection-card:nth-child(6n+2) {
            --bloom-x: -30px;
            --bloom-y: -20px;
            --bloom-rotation: -8deg;
        }

        .issues-grid > .issue-card:nth-child(6n+3),
        .issues-grid > .collection-card:nth-child(6n+3) {
            --bloom-x: 0px;
            --bloom-y: -40px;
            --bloom-rotation: 0deg;
        }

        .issues-grid > .issue-card:nth-child(6n+4),
        .issues-grid > .collection-card:nth-child(6n+4) {
            --bloom-x: 30px;
            --bloom-y: -20px;
            --bloom-rotation: 8deg;
        }

        .issues-grid > .issue-card:nth-child(6n+5),
        .issues-grid > .collection-card:nth-child(6n+5) {
            --bloom-x: 60px;
            --bloom-y: -30px;
            --bloom-rotation: 15deg;
        }

        .issues-grid > .issue-card:nth-child(6n),
        .issues-grid > .collection-card:nth-child(6n) {
            --bloom-x: 0px;
            --bloom-y: 20px;
            --bloom-rotation: -3deg;
        }

        /* Keyframe animation for the true bloom effect */
        @keyframes scroll-to-bloom {
            0% {
                opacity: 0;
                transform:
                    translate(var(--bloom-x, 0px), var(--bloom-y, 0px))
                    scale(0.7)
                    rotate(var(--bloom-rotation, 0deg));
                filter: blur(3px);
                z-index: 1;
            }
            30% {
                opacity: 0.3;
                transform:
                    translate(calc(var(--bloom-x, 0px) * 0.7), calc(var(--bloom-y, 0px) * 0.7))
                    scale(0.8)
                    rotate(calc(var(--bloom-rotation, 0deg) * 0.7));
                filter: blur(2px);
            }
            70% {
                opacity: 0.8;
                transform:
                    translate(calc(var(--bloom-x, 0px) * 0.2), calc(var(--bloom-y, 0px) * 0.2))
                    scale(0.95)
                    rotate(calc(var(--bloom-rotation, 0deg) * 0.2));
                filter: blur(0.5px);
            }
            100% {
                opacity: 1;
                transform: translate(0px, 0px) scale(1) rotate(0deg);
                filter: blur(0px);
                z-index: auto;
            }
        }
    }
}

/* Fallback animation for browsers without scroll-driven animation support */
@supports not (animation-timeline: view()) {
    .issue-card,
    .collection-card {
        animation: fadeInUp 0.5s ease-out;
    }

    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Shuffle message animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ==========================================================================
   Issue Card Styles (Portrait Orientation - 2:3 ratio)
   ========================================================================== */

.issue-card {
    flex: 0 0 150px; /* Fixed width, don't grow or shrink */
    width: 150px;
    height: 229px; /* 17:26 ratio (150 * 26/17) */
    padding: 1.5rem;
    background: var(--dark-medium-darkest);
    border-radius: var(--radius);
    border: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    aspect-ratio: 17/26;
    overflow: visible; /* Changed from hidden to visible so badge can stick out */
    cursor: pointer;
    contain: layout style; /* CSS containment to prevent layout shifts */
    transform-origin: center;
    /* Ensure clickability */
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.issue-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 16px 40px var(--shadow-hover);
    z-index: 10;
}

.issue-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(194, 70, 76, 0.05), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.issue-card:hover::before {
    opacity: 1;
}

/* Enhanced hover effects for issue cards */
.issue-card.has-image:hover .comic-overlay {
    opacity: 1;
}

.issue-card.has-image:hover .comic-info {
    opacity: 1;
}

.issue-card.has-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0.3s ease;
    /* Prevent layout shift during image loading */
    background-color: var(--dark-medium-darkest);
}

/* Lazy loading enhancement for issue cards */
.issue-card.has-image.loading {
    background-color: var(--dark-medium-darkest);
    background-image: none;
    /* Dimensions will be set by responsive breakpoints */
}

.issue-card.has-image.loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-base);
    border-radius: var(--radius-rounded);
    animation: spin 1s linear infinite;
    /* Prevent spinner from affecting layout */
    will-change: transform;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.issue-card.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    /* Dimensions will be set by responsive breakpoints */
    box-sizing: border-box;
}

.issue-card.no-image .comic-title {
    color: var(--dark-light);
    font-weight: 600;
    font-size: var(--font-md);
    line-height: var(--relaxed);
}

/* Ensure issue cards without images show info properly */
.issue-card.no-image .comic-info {
    position: relative;
    background: var(--dark-medium-darkest);
    border-top: 1px solid var(--border);
    opacity: 1;
    color: var(--dark-light);
}

.issue-card.no-image .comic-title {
    color: var(--dark-light);
}

.issue-card.no-image .comic-artist,
.issue-card.no-image .comic-author {
    color: var(--dark-medium-lightest);
}

.issue-card.no-image .comic-date {
    color: var(--dark-medium-lighter);
}

.issue-card h3 {
    margin-bottom: 0.5rem;
}

.issue-card time {
    color: var(--dark-medium-lightest);
    font-size: var(--font-sm);
}

.comic-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.7) 0%,
        rgba(0, 0, 0, 0.3) 30%,
        rgba(0, 0, 0, 0.3) 70%,
        rgba(0, 0, 0, 0.7) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.5rem;
}

.issue-card:hover .comic-overlay {
    opacity: 1;
}

/* Copy count badge */
.copy-count-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc2626;
    color: white;
    border-radius: var(--radius-rounded);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-xs);
    font-weight: bold;
    z-index: 20; /* Higher z-index to ensure it's above everything */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Copy selection buttons */
.copy-selection-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.issue-card:hover .copy-selection-buttons {
    opacity: 1;
}

.copy-select-btn {
    background: var(--accent-base);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-size: var(--font-xs);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.copy-select-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.copy-select-btn:active {
    transform: translateY(0);
}

.comic-date-overlay {
    color: white;
    font-size: var(--font-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.comic-title-overlay {
    color: white;
    font-weight: 600;
    font-size: var(--font-sm);
    line-height: var(--normal);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.cover-variant-pill {
    display: inline-block;
    background: var(--dark-light);
    color: var(--dark-base);
    font-size: var(--font-xs);
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    margin-left: 0.5rem;
    text-shadow: none;
    line-height: var(--tight);
    vertical-align: middle;
}

.comic-subseries-overlay {
    color: var(--accent-base);
    font-size: var(--font-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.comic-publisher-overlay {
    color: rgba(255, 255, 255, 0.8);
    font-size: var(--font-xs);
    font-style: italic;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Comic Cover Image - Updated for overlay approach */
.comic-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.comic-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.issue-card:hover .comic-cover img {
    transform: scale(1.05);
}

/* Comic Placeholder (when no image) */
.comic-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--dark-medium-darker);
    z-index: 1;
}

.placeholder-icon {
    font-size: var(--font-3xl);
    opacity: 0.3;
}

/* Comic Information - Now positioned as overlay */
.comic-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.9) 0%,
        rgba(0, 0, 0, 0.7) 50%,
        rgba(0, 0, 0, 0) 100%
    );
    color: white;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.issue-card:hover .comic-info {
    opacity: 1;
}

.comic-title {
    margin: 0 0 var(--xs) 0;
    font-size: var(--font-md);
    font-weight: 600;
    color: white;
    line-height: var(--normal);
    /* Truncate long titles */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.comic-issue {
    margin: 0 0 var(--xs) 0;
    font-size: var(--font-sm);
    color: var(--accent-base);
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.comic-artist,
.comic-author,
.comic-subseries,
.comic-publisher {
    margin: 0 0 var(--xs) 0;
    font-size: var(--font-xs);
    color: rgba(255, 255, 255, 0.9);
    line-height: var(--normal);
    /* Truncate long names */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.comic-subseries {
    color: var(--accent-base);
    font-weight: 600;
    font-size: var(--font-sm);
}

.comic-publisher {
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.comic-artist:last-child,
.comic-author:last-child {
    margin-bottom: 0;
}

.comic-date {
    margin: 0;
    font-size: var(--font-xs);
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* ==========================================================================
   No Results
   ========================================================================== */

.no-results {
    text-align: center;
    padding: var(--xxl);
    color: var(--dark-medium-lightest);
}

.clear-filters-link {
    color: var(--accent-base);
    text-decoration: none;
}

.clear-filters-link:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--md);
    margin: var(--xl) 0;
}

.pagination a {
    color: var(--accent-base);
    text-decoration: none;
    padding: var(--sm) var(--md);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.pagination a:hover {
    background: var(--accent-base);
    color: white;
    border-color: var(--accent-base);
}

/* ==========================================================================
   Infinite Scroll Styles
   ========================================================================== */

.infinite-scroll-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent-base);
    border-radius: var(--radius-rounded);
    animation: spin 1s linear infinite;
    margin-bottom: var(--md);
}

.infinite-scroll-loader p {
    color: var(--dark-medium-lightest);
    margin: 0;
    font-size: var(--font-md);
}

.infinite-scroll-end {
    text-align: center;
    padding: var(--xl);
    margin: var(--xl) 0;
    background: var(--dark-medium-darkest);
}

.infinite-scroll-end p {
    color: var(--dark-medium-lightest);
    margin: 0;
    font-size: var(--font-md);
}

.manual-load-more {
    text-align: center;
    padding: var(--xl);
    margin: var(--xl) 0;
}

.manual-load-more .btn {
    padding: var(--md) var(--xl);
    font-size: var(--font-lg);
    min-width: 200px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Medium-large viewports - increase cover image height */
@media (min-width: 768px) and (max-width: 1199px) {
    .issue-card {
        height: auto;
        aspect-ratio: 17/26;
        max-height: 60vh;
        max-width: 200px;
    }
    
    .comic-cover img {
        object-fit: cover;
        width: 100%;
        height: 100%;
    }
}

/* Large viewports - maximize cover image height */
@media (min-width: 1200px) {
    .issue-card {
        height: auto;
        aspect-ratio: 17/26;
        max-height: 80vh;
        max-width: 250px;
    }
    
    .comic-cover img {
        object-fit: cover;
        width: 100%;
        height: 100%;
    }
}

/* Responsive Filter Layout */
@media (max-width: 768px) {
    .issue-card {
        /* Use grid-based sizing for reliable layout */
        width: 100%;
        height: auto;
        aspect-ratio: 17/26;
        max-width: 150px; /* Increased from 100px for better proportions */
        padding: 1.5rem;
    }
    
    .issues-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 0.75rem;
        width: 100%;
    }
    
    .filter-row {
        grid-template-columns: 1fr;
        gap: var(--sm);
    }
    
    .filter-checkboxes {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
        max-height: 100px;
    }
    
    .results-stats {
        flex-direction: column;
        gap: var(--sm);
    }
    
    .sort-controls {
        justify-content: center;
    }
}

@media (max-width: 480px) {   
    /* Fluid scaling: ensure 3 issue cards always fit while maintaining 17:26 aspect ratio */
    .issue-card {
        /* Use grid-based sizing for reliable 3-column layout */
        width: 100%;
        height: auto;
        aspect-ratio: 17/26;
        max-width: 138px; /* Cap at original 480px size */
        padding: 0.75rem;
    }
    
    .issues-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        width: 100%;
    }
    
    .container {
        padding: 0 var(--sm); /* Reduce container padding to maximize space */
    }
    
    .comic-info {
        padding: 0.75rem;
    }
    
    .comic-title {
        font-size: var(--font-sm);
    }
    
    .comic-artist,
    .comic-author {
        font-size: var(--font-xs);
    }
    
    .filters-section {
        padding: var(--md);
    }
    
    .filter-checkboxes {
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
        max-height: 80px;
    }
    
    .filter-checkbox label {
        font-size: var(--font-xs);
    }
    
    .infinite-scroll-loader,
    .infinite-scroll-end {
        padding: var(--md);
        margin: var(--md) 0;
    }
    
    .loading-spinner {
        width: 32px;
        height: 32px;
        border-width: 2px;
    }
}



/* ==========================================================================
   Loading States
   ========================================================================== */

.issue-card.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-base);
    border-radius: var(--radius-rounded);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Comic Detail Page Styles
   ========================================================================== */

.comic-navigation {
    margin-bottom: 2rem;
}

.back-link {
    color: var(--accent-base);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.comic-detail {
    max-width: none;
    width: 100%;
    min-width: 320px;
}

.comic-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding: 0;
}

.site-link {
    margin: 0 0 0.5rem 0;
    font-size: var(--font-sm);
}

.site-link a {
    color: var(--dark-medium-lightest);
    text-decoration: none;
}

.site-link a:hover {
    color: var(--accent-base);
}

.comic-header h1 {
    font-size: var(--font-4xl);
    font-weight: 700;
    line-height: var(--normal);
    margin: 0 0 0.75rem 0;
    letter-spacing: -0.03em;
    color: var(--dark-light);
}

.comic-meta {
    display: flex;
    gap: 0.75rem;
    color: var(--dark-medium-lightest);
    font-size: var(--font-sm);
}

.comic-date,
.comic-print {
    padding: 0.25rem 0.75rem;
    background-color: var(--dark-medium-darkest);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.comic-signed {
    padding: 0.25rem 0.75rem;
    background-color: var(--accent-base);
    color: white;
    border-radius: var(--radius);
    border: 1px solid var(--accent-base);
    font-weight: 500;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(194, 70, 76, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(194, 70, 76, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(194, 70, 76, 0.7);
    }
}

.nav-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 1001;
    pointer-events: auto;
}

.nav-prev,
.nav-next {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    background-color: var(--dark-medium-darkest);
    border-radius: var(--radius-rounded);
    text-decoration: none;
    color: var(--dark-light);
    font-size: var(--font-md);
    transition: all 0.3s ease;
}

.nav-prev:hover,
.nav-next:hover {
    background-color: var(--dark-medium-darker);
    border-color: var(--accent-base);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.comic-content {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: start;
    padding-right: 1rem;
}

.comic-cover-section {
    text-align: center;
    width: fit-content;
    max-width: none;
}

.comic-cover-large {
    aspect-ratio: 17/26;
    display: flex;
    max-height: 100vh;
    width: auto;
}

.comic-cover-large:hover {
    background-color: var(--dark-medium-darker);
    transform: translateY(-4px);
}

.comic-cover-large img {
    max-width: 100%;
    max-height: 100vh;
    width: auto;
    height: auto;
    border-radius: var(--radius);
    border: none;
}

/* Smooth transition when high-res image loads */
.comic-cover-large img.loaded {
    opacity: 1;
}

/* Ensure picture element behaves like the container */
.comic-cover-large picture {
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 100vh;
}

.comic-cover-placeholder {
    text-align: center;
    color: var(--dark-medium-lightest);
    aspect-ratio: 17/26;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-height: 100vh;
    width: auto;
}

.comic-cover-placeholder .placeholder-icon {
    font-size: var(--font-3xl);
    opacity: 0.3;
    margin-bottom: 1rem;
}

.comic-details {
    padding: 0;
    max-width: 640px;
    min-width: 320px;
}

.comic-info-grid {
    display: grid;
    gap: 0;
    position: relative;
}

.info-section {
    padding-bottom: 1rem;
}

.info-section h3 {
    margin: 0 0 0.75rem 0;
    font-size: var(--font-sm);
    color: var(--accent-base);
    border-bottom: 1px solid var(--accent-base);
    padding-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Series Information */
.grid {
    display: grid;
    gap: 0.5rem;
}

.row {
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border);
}

.row:last-child {
    border-bottom: none;
}

.row .value {
    color: var(--dark-light);
    font-weight: 500;
    padding-right: 0.5rem;
}

.row .role {
    padding-right: 0.5rem;
}

.row .value.signed {
    color: var(--accent-base);
    font-weight: 600;
}

.row .role {
    font-size: var(--font-xs);
    color: var(--dark-medium-lightest);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* Responsive design for comic detail page */
@media (max-width: 1200px) {
    .comic-content {
        grid-template-columns: auto 1fr;
        gap: 1rem;
    }
    
    .comic-cover-section {
        width: fit-content;
        max-width: none;
    }
}

@media (max-width: 768px) {       
    .comic-cover-section {
        width: fit-content;
        max-width: none;
    }
    
    .comic-info-grid {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .comic-header {
        padding: 0 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .comic-content {
        grid-template-columns: 1fr;
    }
    
    .comic-cover-section {
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
    }
    
    .comic-info-grid {
        gap: 0.75rem;
    }
    
    .info-section {
        background-color: var(--dark-medium-darker);
        border-radius: var(--radius);
        padding: 0.75rem;
    }
    
    .nav-prev,
    .nav-next {
        width: 2.5rem;
        height: 2.5rem;
        font-size: var(--font-md);
    }
}

@media (max-width: 320px) {
    .comic-detail {
        min-width: 320px;
    }
    
    .comic-content {
        grid-template-columns: 1fr;
    }
    
    .comic-cover-section {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        order: 1;
    }
    
    .comic-details {
        order: 2;
        max-width: none;
        padding: 0 0.5rem;
    }
    
    .comic-header h1 {
        font-size: var(--font-lg);
    }
    
    .comic-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .comic-info-grid {
        gap: 0.75rem;
    }
    
    .info-section {
        padding: 0.5rem;
    }
    
    .nav-prev,
    .nav-next {
        width: 2.25rem;
        height: 2.25rem;
        font-size: var(--font-sm);
    }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {   
    body {
        font-size: 16px;
    }
    
    h1.site-title {
        font-size: var(--font-3xl);
    }
    
    header.scrolled .site-title {
        font-size: var(--font-lg);
    }
    
    header.scrolled:hover .site-title {
        font-size: var(--font-3xl);
    }
    
    header.scrolled:hover #description {
        font-size: var(--font-sm);
    }
    
    header.scrolled:hover .header-links {
        font-size: var(--font-sm);
    }

    #description {
        font-size: var(--font-md);
    }
    
    .header-links {
        font-size: var(--font-xs);
    }
    
    header.scrolled:hover .header-links {
        font-size: var(--font-xs);
    }
    
    .search-container {
        max-width: none;
    }
    
    .filter-buttons {
        justify-content: center;
    }
    
    .active-filters-display {
        flex-direction: column;
        align-items: stretch;
        gap: var(--sm);
    }
    
    .active-filter-chips {
        justify-content: center;
    }

    .modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .filter-options {
        justify-content: center;
    }
}

@media (max-width: 480px) {  
    .filter-button {
        width: 2.5rem;
        height: 2.5rem;
        font-size: var(--font-md);
    }
    
    .results-stats {
        flex-direction: column;
        gap: var(--sm);
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.issue-card:focus {
    outline: 2px solid var(--accent-base);
    outline-offset: 2px;
}

.issue-card:focus:not(:focus-visible) {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .issue-card {
        border-width: 2px;
    }
    
    .comic-info {
        background: var(--dark-base);
        border-top-width: 2px;
    }
}

/* Ensure issue cards are clickable */
.issue-card[onclick] {
    pointer-events: auto;
    cursor: pointer;
}

.issue-card[onclick]:hover {
    cursor: pointer;
}

.issue-card[onclick]:active {
    cursor: pointer;
}

/* Comic card links - ensure they look and behave like the original cards */
a.issue-card {
    text-decoration: none;
    color: inherit;
    display: block;
}

a.issue-card:hover {
    text-decoration: none;
    color: inherit;
}

a.issue-card:focus {
    outline: 2px solid var(--accent-base);
    outline-offset: 2px;
}

a.issue-card:focus:not(:focus-visible) {
    outline: none;
}

/* Copy selection buttons - ensure they work well with modal system */
.copy-select-btn {
    position: relative;
    z-index: 20;
    pointer-events: auto;
}

.copy-select-btn:hover {
    background-color: var(--accent-base);
    color: white;
}

/* Ensure copy buttons don't interfere with comic card clicks */
.copy-selection-buttons {
    position: relative;
    z-index: 20;
    pointer-events: auto;
}

/* ==========================================================================
   Collection Card Styles
   ========================================================================== */

/* Collection card styles - exactly match regular issue cards */
.collection-card {
    flex: 0 0 150px; /* Fixed width, don't grow or shrink */
    width: 150px;
    height: 229px; /* 17:26 ratio (150 * 26/17) */
    padding: 1.5rem;
    background: var(--dark-medium-darkest);
    border-radius: var(--radius);
    border: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    aspect-ratio: 17/26;
    overflow: visible;
    cursor: pointer;
    contain: layout style;
    transform-origin: center;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    z-index: 1; /* Ensure proper stacking context */
}

/* Responsive collection card styles - match issue-card behavior */
@media (min-width: 768px) and (max-width: 1199px) {
    .collection-card {
        height: auto;
        aspect-ratio: 17/26;
        max-height: 60vh;
        max-width: 200px;
    }
}

@media (min-width: 1200px) {
    .collection-card {
        height: auto;
        aspect-ratio: 17/26;
        max-height: 80vh;
        max-width: 250px;
    }
}

@media (max-width: 768px) {
    .collection-card {
        width: 100%;
        height: auto;
        aspect-ratio: 17/26;
        max-width: 150px;
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .collection-card {
        width: 100%;
        height: auto;
        aspect-ratio: 17/26;
        max-width: 138px;
        padding: 0.75rem;
    }
}

.collection-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 16px 40px var(--shadow-hover);
    z-index: 10;
}

/* Collection card hover overlay - same as issue cards */
.collection-card:hover .comic-overlay {
    opacity: 1;
}

/* Collection card with image - same background behavior as issue cards */
.collection-card.has-image {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0.3s ease;
    background-color: var(--dark-medium-darkest);
}

/* Collection card overlay - same as issue cards */
.collection-card .comic-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.7) 0%,
        rgba(0, 0, 0, 0.3) 30%,
        rgba(0, 0, 0, 0.3) 70%,
        rgba(0, 0, 0, 0.7) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.5rem;
    z-index: 2; /* Ensure overlay appears above image */
}

/* Collection badge */
.collection-badge {
    position: absolute;
    top: 30px;
    right: -5px;
    background: var(--accent-base);
    color: white;
    padding: 8px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
    border-top-left-radius: 50px;
    border-top-right-radius: 5px;
    border-bottom-left-radius: 50px;
    border-bottom-right-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Responsive collection badge */
@media (max-width: 768px) {
    .collection-badge {
        padding: 6px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .collection-badge {
        padding: 4px;
        font-size: 8px;
    }
}

.collection-card {
    background-size: cover;
    background-position: center;
    border: 1px solid #000;
    position: relative;
    display: inline-block;
    cursor: pointer;
}

/* Stacked preview cards - subtle like the example */
.collection-card .preview-item::before,
.collection-card .preview-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    background-size: cover;
    background-position: center;
    border: 1px solid #000;
    z-index: -1;
}

.collection-card .preview-item::before {
    transform: translateY(3px) rotate(-1deg);
    z-index: -2;
}

.collection-card .preview-item::after {
    transform: translateY(6px) rotate(0.5deg);
    z-index: -3;
}

/* Expanded collection styles */
.collection-expanded {
    grid-column: 1 / -1;
    background: #f8f9fa;
    border-radius: var(--radius);
    padding: 20px;
    margin: 10px 0;
    border: 1px solid #667eea;
}

.collection-expanded .collection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #667eea;
}

.collection-expanded .collection-title {
    color: #333;
    font-size: var(--font-xl);
    font-weight: bold;
}

.collection-expanded .collection-count {
    color: #666;
    font-size: var(--font-md);
}

.collection-expanded .close-btn {
    background: #667eea;
    color: white;
    border: none;
    border-radius: var(--radius-rounded);
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.collection-expanded .issues-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

/* Collection Modal Styles */
.collection-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.collection-modal-content {
    background: var(--dark-base);
    border-radius: var(--radius);
    max-width: 90vw;
    max-height: 90vh;
    width: 1200px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.collection-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    background: var(--dark-medium-darkest);
}

.collection-modal-title {
    margin: 0;
    color: var(--dark-light);
    font-size: var(--font-2xl);
}

.collection-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--dark-medium-lightest);
    padding: 5px;
    border-radius: var(--radius-rounded);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.collection-modal-close:hover {
    background: var(--dark-medium-darker);
}

.collection-modal-body {
    padding: 20px;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
}

/* Base transition for all issue cards in collection modal */
.collection-modal .issue-card {
    opacity: 1 !important;
    transition: opacity 0.3s ease-in-out, border 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

/* Ensure cards are visible when first loaded */
.collection-modal .issues-grid .issue-card {
    opacity: 1 !important;
}

/* Highlighted issue in collection modal - stays at full opacity with highlight */
.collection-issue-highlighted {
    opacity: 1;
    border: 3px solid var(--accent-base);
    box-shadow: 0 0 20px rgba(234, 102, 120, 0.5);
    transition: opacity 0.3s ease-in-out, border 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.collection-modal .issues-grid .collection-issue-other {
    opacity: 0.33 !important;
    transition: opacity 0.3s ease-in-out;
}
.collection-modal .issues-grid .collection-issue-other:hover {
    opacity: 1 !important;
}

/* ==========================================================================
   Issue Modal Styles
   ========================================================================== */

.issue-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.issue-modal-content {
    background: var(--dark-base);
    max-width: 100vw;
    max-height: 100vh;
    overflow-y: auto;
    position: relative;
}

/* Modal close button inherits filter-button styling */

/* Modal loading state */
.issue-modal-body .loading {
    text-align: center;
    color: var(--dark-medium-lightest);
}

.issue-modal-body .error {
    text-align: center;
    color: var(--accent-base);
}

/* Ensure modal content uses existing styles */
.issue-modal-body .comic-detail {
    margin: 0;
    padding: 0;
}

.issue-modal-body .comic-content {
    max-width: none;
}

/* Hide edit button by default in modal, show on comic-info-grid hover */
.issue-modal .nav-controls .nav-prev {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.issue-modal .comic-info-grid:hover .nav-controls .nav-prev {
    opacity: 1;
}

/* Modal navigation buttons */
.modal-nav-btn {
    background: none;
    border: none;
    font-size: var(--font-md);
    cursor: pointer;
    padding: var(--sm);
    color: var(--dark-light);
    border-radius: var(--radius);
    transition: background-color 0.2s ease;
}

.modal-nav-btn:hover {
    background-color: var(--dark-medium);
}

/* Comic count styling */
.comic-count {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: var(--font-lg);
    color: var(--dark-medium-lighter);
    margin: 0;
    margin-bottom: var(--sm);
    text-align: center;
}

/* Mobile responsive adjustments for back-to-top moved to bits/footer.css */
