/* ==================== DESIGN TOKENS / CSS VARIABLES ==================== */
:root {
    /* UNC Secondary Palette */
    --unc-basin-slate: #4F758B;
    --unc-campus-sandstone: #F4E8DD;
    --unc-longleaf-pine: #00594C;
    --unc-azalea-pink: #EF426F;
    --unc-tile-teal: #00A5AD;
    --unc-sunburst-yellow: #FFD100;
    --unc-davie-green: #C4D600;
    --unc-hyperlink-blue: #007FAE;
    --white: #FFFFFF;

    /* Colors - Warm Historical Palette */
    --bg-primary: #F5F1E8;
    --bg-secondary: #EAE4D8;
    --bg-card: #FDFCFA;
    --bg-hover: rgba(139, 115, 85, 0.1);
    --text-primary: #1A1614;
    --text-secondary: #2D2420;
    --text-muted: rgba(45, 36, 32, 0.6);
    --accent-primary: #B8956A;
    --accent-secondary: #8B7355;
    --accent-gradient: linear-gradient(135deg, #B8956A 0%, #8B7355 100%);
    --border-color: rgba(139, 115, 85, 0.2);

    /* Shadows - Warmer sepia tones for historical feel */
    --shadow-sm: 0 2px 4px rgba(89, 67, 45, 0.15), 0 1px 2px rgba(89, 67, 45, 0.1);
    --shadow-md: 0 8px 16px rgba(89, 67, 45, 0.25), 0 4px 8px rgba(89, 67, 45, 0.15);
    --shadow-lg: 0 20px 40px rgba(89, 67, 45, 0.35), 0 10px 20px rgba(89, 67, 45, 0.2);
    --shadow-glow: 0 0 30px rgba(89, 67, 45, 0.3);
    --shadow-glow-strong: 0 0 40px rgba(89, 67, 45, 0.5);
    --shadow-hover: 0 12px 28px rgba(89, 67, 45, 0.4), 0 6px 14px rgba(89, 67, 45, 0.25);

    /* Transitions - Smoother, more refined */
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    --spring: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --spring-bouncy: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
}

/* ==================== BASE / RESET ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
}

/* ==================== TYPOGRAPHY ==================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Playfair+Display:wght@600;700;800;900&display=swap');

.hero-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

/* Editorial Title - Historical Newsstand Aesthetic */
.editorial-title {
    color: var(--text-primary);
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-shadow:
        1px 1px 0 rgba(184, 149, 106, 0.3),
        2px 2px 0 rgba(184, 149, 106, 0.2);
}

.subtitle-text {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ==================== CUSTOM SCROLLBAR ==================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 5px;
    transition: var(--transition-base);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--unc-tile-teal);
}

/* Smooth hiding scrollbar */
.scrollbar-hide::-webkit-scrollbar {
    opacity: 0;
    transition: opacity 0.3s;
}

.scrollbar-hide:hover::-webkit-scrollbar {
    opacity: 1;
}

/* ==================== BACKGROUND EFFECTS ==================== */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 50%, rgba(184, 149, 106, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 115, 85, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    animation: gradientShift 20s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.5; }
}

/* Enhanced paper texture for historical feel */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='paperTexture'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='6' seed='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23paperTexture)' opacity='0.4'/%3E%3C/svg%3E"),
        repeating-linear-gradient(
            0deg,
            rgba(139, 111, 78, 0.015) 0px,
            transparent 1px,
            transparent 2px,
            rgba(139, 111, 78, 0.015) 3px
        );
    opacity: 0.035;
    pointer-events: none;
    z-index: 0;
    mix-blend-mode: multiply;
}

/* ==================== CARDS (Replacing Glassmorphism) ==================== */
.glass {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
}

.glass-card:hover {
    background: var(--bg-card);
    border-color: var(--accent-primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

/* ==================== HEADER ==================== */
header {
    position: sticky;
    top: 0;
    z-index: 50;
    transition: var(--transition-base);
}

header.scrolled {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    box-shadow: var(--shadow-md);
}

header.scrolled h1 {
    font-size: 1.5rem;
}

/* ==================== BRANDING ==================== */
.branding-lockup {
    position: relative;
}

.brand-emblem {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(3.25rem, 5vw, 4.25rem);
    height: clamp(3.25rem, 5vw, 4.25rem);
    border-radius: 18%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.9), rgba(245, 241, 232, 0.7));
    border: 2px solid rgba(139, 115, 85, 0.4);
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
}

.brand-emblem svg {
    width: 70%;
    height: 70%;
    display: block;
}

.branding-lockup:hover .brand-emblem {
    transform: rotate(-3deg) scale(1.02);
    box-shadow: var(--shadow-glow);
}

/* Parallax header effect */
@supports (transform-style: preserve-3d) {
    header.parallax {
        transform: translateZ(0);
    }
}

/* ==================== SEARCH INPUT ==================== */
.search-input {
    transition: var(--transition-base);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(79, 117, 139, 0.15);
    background-color: var(--bg-card);
}

.search-input:focus + svg {
    color: var(--accent-primary);
}

/* ==================== DECO TIMELINE CONTROLS ==================== */
.deco-link {
    position: relative;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    font-weight: 600;
}

.deco-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -0.2rem;
    width: 100%;
    height: 1px;
    background: currentColor;
    opacity: 0.35;
    transition: var(--transition-base);
}

.deco-link:hover::after {
    opacity: 0.8;
}

.year-carousel {
    border: 1px solid rgba(139, 115, 85, 0.2);
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), var(--shadow-sm);
}

.year-carousel-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    text-transform: uppercase;
    letter-spacing: 0.26em;
    font-size: 0.78rem;
    color: var(--accent-secondary);
    font-weight: 700;
}

.year-readout {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.95rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.dial-readout-prefix {
    display: block;
    font-size: 0.65rem;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    opacity: 0.7;
}

.year-readout-value {
    display: block;
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 800;
    letter-spacing: 0.12em;
    margin-top: 0.5rem;
}

.year-range {
    font-size: 0.72rem;
    letter-spacing: 0.28em;
    color: rgba(45, 36, 32, 0.6);
}

.timeline-slider-container {
    width: 100%;
    padding: 1rem 0 0.5rem;
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.timeline-slider-container::-webkit-scrollbar {
    height: 6px;
}

.timeline-slider-container::-webkit-scrollbar-thumb {
    background: rgba(139, 115, 85, 0.3);
    border-radius: 999px;
}

.timeline-year-pills {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: max-content;
}

.timeline-year-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.4rem;
    padding: 0.55rem 0.85rem;
    border-radius: 1rem;
    border: 1px solid rgba(139, 115, 85, 0.35);
    background: linear-gradient(180deg, rgba(245, 241, 232, 0.95), rgba(224, 215, 200, 0.92));
    color: var(--text-secondary);
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    letter-spacing: 0.11em;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-base);
    box-shadow: 0 10px 20px rgba(89, 67, 45, 0.12);
}

.timeline-year-pill::after {
    content: attr(data-count);
    position: absolute;
    bottom: -0.85rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    letter-spacing: 0.18em;
    color: rgba(26, 22, 20, 0.55);
}

.timeline-year-pill:hover {
    transform: translateY(-6px);
    border-color: rgba(184, 149, 106, 0.4);
    box-shadow: 0 14px 30px rgba(89, 67, 45, 0.2);
    color: var(--accent-secondary);
}

.timeline-year-pill.active {
    background: linear-gradient(180deg, rgba(0, 165, 173, 0.22), rgba(0, 165, 173, 0.35));
    border-color: rgba(0, 165, 173, 0.65);
    color: var(--unc-longleaf-pine);
    box-shadow: 0 18px 34px rgba(0, 165, 173, 0.24);
}

.timeline-year-pill.active::after {
    color: rgba(26, 22, 20, 0.75);
}

.timeline-year-pill:focus-visible {
    outline: 2px solid var(--accent-secondary);
    outline-offset: 4px;
}

.month-carousel {
    border: 1px solid rgba(139, 115, 85, 0.2);
    border-radius: 1rem;
    padding: 1.25rem 1.5rem;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), var(--shadow-sm);
}

.month-carousel--disabled {
    opacity: 0.6;
    pointer-events: none;
}

.month-carousel--disabled .month-scroll-track {
    display: flex;
    align-items: center;
    justify-content: center;
}

.month-carousel--disabled .month-scroll-track::before {
    content: 'Select a year to reveal months';
    font-size: 0.75rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: block;
    padding: 0.75rem 0;
}

.month-carousel-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    text-transform: uppercase;
    letter-spacing: 0.24em;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-secondary);
    margin-bottom: 1rem;
}

.month-caption {
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    color: var(--text-muted);
}

.month-scroll-viewport {
    overflow-x: auto;
    padding-bottom: 0.35rem;
    scrollbar-width: thin;
}

.month-scroll-viewport::-webkit-scrollbar {
    height: 6px;
}

.month-scroll-viewport::-webkit-scrollbar-thumb {
    background: rgba(184, 149, 106, 0.35);
    border-radius: 999px;
}

.month-scroll-track {
    display: flex;
    gap: 0.75rem;
    min-width: max-content;
    align-items: stretch;
    min-height: 4.5rem;
}

.month-tile {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 4.5rem;
    padding: 0.75rem 0.5rem 0.6rem;
    border-radius: 1.2rem;
    background: linear-gradient(180deg, rgba(245, 241, 232, 0.95), rgba(224, 215, 200, 0.9));
    border: 1px solid rgba(139, 115, 85, 0.35);
    box-shadow: 0 10px 18px rgba(89, 67, 45, 0.15);
    text-transform: uppercase;
    letter-spacing: 0.28em;
    font-size: 0.7rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-base);
}

.month-tile::after {
    content: attr(data-count);
    font-size: 0.6rem;
    letter-spacing: 0.18em;
    color: rgba(26, 22, 20, 0.55);
    margin-top: 0.4rem;
}

.month-tile[data-month="all"] {
    background: linear-gradient(180deg, rgba(0, 165, 173, 0.12), rgba(0, 165, 173, 0.2));
    border-color: rgba(0, 165, 173, 0.3);
    color: var(--unc-tile-teal);
    font-weight: 700;
}

.month-tile:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
}

.month-tile.active {
    background: linear-gradient(180deg, rgba(0, 165, 173, 0.2), rgba(0, 165, 173, 0.35));
    border-color: rgba(0, 165, 173, 0.7);
    color: var(--unc-longleaf-pine);
    box-shadow: 0 14px 24px rgba(0, 165, 173, 0.22);
}

.month-tile.active::after {
    color: rgba(26, 22, 20, 0.75);
}

.month-tile:focus-visible {
    outline: 2px solid var(--accent-secondary);
    outline-offset: 4px;
}

/* ==================== NEWSSTAND HERO ==================== */
.newsstand-hero {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.newsstand-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(184, 149, 106, 0.12) 0%, rgba(139, 115, 85, 0.08) 100%),
        radial-gradient(circle at -10% 50%, rgba(184, 149, 106, 0.2) 0%, transparent 55%);
    opacity: 0.6;
    pointer-events: none;
}

.newsstand-hero > * {
    position: relative;
    z-index: 1;
}

.hero-kicker {
    letter-spacing: 0.32em;
    color: var(--accent-secondary);
}

.hero-period-title {
    font-family: 'Playfair Display', serif;
    letter-spacing: 0.03em;
    color: var(--unc-longleaf-pine);
}

.hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.5rem;
    align-items: stretch;
}

@media (min-width: 768px) {
    .hero-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1100px) {
    .hero-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

.hero-card {
    position: relative;
    overflow: hidden;
    border-radius: 1.25rem;
    background: var(--bg-card);
    border: 1px solid rgba(139, 115, 85, 0.35);
    box-shadow: 0 12px 24px rgba(89, 67, 45, 0.18);
    transform-origin: center;
    transition: transform 0.45s var(--ease-out-back), box-shadow 0.45s var(--ease-out-back);
    cursor: pointer;
}

.hero-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 55%, rgba(10, 10, 10, 0.45) 100%);
    pointer-events: none;
    opacity: 0.35;
    transition: opacity 0.4s ease;
}

.hero-card:nth-child(5n + 1) {
    transform: rotate(-4deg) translateY(6px);
}

.hero-card:nth-child(5n + 2) {
    transform: rotate(2.5deg);
}

.hero-card:nth-child(5n + 3) {
    transform: rotate(-1.5deg) translateY(-4px);
}

.hero-card:nth-child(5n + 4) {
    transform: rotate(3.5deg);
}

.hero-card:nth-child(5n) {
    transform: rotate(-2.5deg) translateY(4px);
}

.hero-card:hover {
    transform: translateY(-14px) scale(1.05) rotate(0deg);
    box-shadow: var(--shadow-hover);
}

.hero-card:hover::after {
    opacity: 0.15;
}

.hero-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.45s var(--ease-out-back);
}

.hero-card:hover img {
    transform: scale(1.08);
}

.hero-card figcaption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.25rem 1.1rem 1.4rem;
    color: white;
    letter-spacing: 0.04em;
}

.hero-card-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    margin-bottom: 0.35rem;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.hero-card-meta {
    font-size: 0.8rem;
    opacity: 0.85;
}

@media (max-width: 640px) {
    .hero-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }

    .hero-card {
        border-radius: 1rem;
    }

    .hero-card figcaption {
        padding: 1rem;
    }
}

.hero-clear-btn {
    font-weight: 600;
    text-decoration: underline;
}

.hero-clear-btn:hover {
    color: var(--accent-secondary) !important;
}

/* ==================== LOADING SKELETON ==================== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-card) 0px,
        var(--bg-hover) 40px,
        var(--bg-card) 80px
    );
    background-size: 1000px 100%;
    animation: shimmerSkeleton 2s infinite linear;
}

@keyframes shimmerSkeleton {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s var(--ease-out-expo) forwards;
}

.fade-in-scale {
    animation: fadeInScale 0.5s var(--ease-out-expo) forwards;
}

/* Stagger children animations */
.stagger-children > * {
    opacity: 0;
    animation: fadeIn 0.5s var(--ease-out-expo) forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.45s; }

/* ==================== ISSUE GRID - MASONRY LAYOUT ==================== */
#issue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-auto-flow: dense;
    gap: 2rem;
    padding: 1rem 0;
}

/* Responsive columns */
@media (max-width: 640px) {
    #issue-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (min-width: 641px) and (max-width: 1023px) {
    #issue-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.75rem;
    }
}

@media (min-width: 1024px) {
    #issue-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

@media (min-width: 1400px) {
    #issue-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2.25rem;
    }
}

/* ==================== ISSUE GRID CARDS - VINTAGE NEWSSTAND ==================== */
.issue-card {
    position: relative;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid var(--border-color);
    opacity: 0;
    animation: fadeInScale 0.5s var(--ease-out-expo) forwards;
    background: var(--bg-card);
    /* Enhanced shadow for paper-like depth */
    box-shadow:
        0 2px 4px rgba(89, 67, 45, 0.12),
        0 4px 8px rgba(89, 67, 45, 0.08),
        0 1px 0 rgba(255, 255, 255, 0.5) inset;
}

/* Vintage newsstand stagger - subtle random rotations */
.issue-card:nth-child(6n + 1) {
    transform: rotate(-0.8deg);
}

.issue-card:nth-child(6n + 2) {
    transform: rotate(0.6deg);
}

.issue-card:nth-child(6n + 3) {
    transform: rotate(-0.4deg);
}

.issue-card:nth-child(6n + 4) {
    transform: rotate(0.9deg);
}

.issue-card:nth-child(6n + 5) {
    transform: rotate(-0.6deg);
}

.issue-card:nth-child(6n) {
    transform: rotate(0.5deg);
}

/* Varying aspect ratios for masonry effect */
.issue-card:nth-child(7n + 1) .aspect-\[3\/4\] {
    aspect-ratio: 3/4.2;
}

.issue-card:nth-child(7n + 2) .aspect-\[3\/4\] {
    aspect-ratio: 3/3.8;
}

.issue-card:nth-child(7n + 3) .aspect-\[3\/4\] {
    aspect-ratio: 3/4.5;
}

.issue-card:nth-child(7n + 4) .aspect-\[3\/4\] {
    aspect-ratio: 3/3.9;
}

.issue-card:nth-child(7n + 5) .aspect-\[3\/4\] {
    aspect-ratio: 3/4.3;
}

.issue-card:nth-child(7n + 6) .aspect-\[3\/4\] {
    aspect-ratio: 3/4.1;
}

.issue-card:nth-child(7n) .aspect-\[3\/4\] {
    aspect-ratio: 3/4.4;
}

/* Some cards span 2 rows on larger screens for variety */
@media (min-width: 1024px) {
    .issue-card:nth-child(13n + 3),
    .issue-card:nth-child(13n + 8) {
        grid-row: span 1;
    }
}

/* Enhanced hover effect - dramatic lift with rotation */
.issue-card:hover {
    transform: translateY(-12px) scale(1.03) rotate(0deg) !important;
    border-color: var(--accent-primary);
    box-shadow:
        0 12px 24px rgba(89, 67, 45, 0.25),
        0 24px 48px rgba(89, 67, 45, 0.18),
        0 2px 0 rgba(255, 255, 255, 0.7) inset;
    z-index: 10;
}

/* Paper edge effect - simulates thickness */
.issue-card::after {
    content: '';
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: calc(100% - 8px);
    height: calc(100% - 8px);
    background: linear-gradient(135deg, transparent 0%, rgba(89, 67, 45, 0.1) 100%);
    border-radius: inherit;
    pointer-events: none;
    z-index: -1;
    opacity: 0.5;
    transition: var(--transition-base);
}

.issue-card:hover::after {
    opacity: 0.8;
    bottom: -5px;
    right: -5px;
}

/* Card shadow effect - enhanced depth */
.issue-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: inherit;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -2;
}

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

/* Image loading state */
.issue-card img {
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.issue-card img[data-loaded="false"] {
    opacity: 0;
}

.issue-card img[data-loaded="true"] {
    opacity: 1;
}

.issue-card:hover img {
    transform: scale(1.08);
}

/* ==================== MODAL ANIMATIONS ==================== */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.9) !important;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    animation: modalSlideUp 0.3s var(--ease-out-expo);
}

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

/* ==================== VIEWER NAVIGATION CONTROLS ==================== */
/* Ensure navigation buttons appear above the image wrapper (z-10) */
#prev-page-btn,
#next-page-btn,
#prev-issue-btn,
#next-issue-btn,
#zoom-in-btn,
#zoom-out-btn,
#zoom-reset-btn {
    z-index: 20;
    position: relative;
}

/* Zoom controls container also needs z-index */
#prev-page-btn,
#next-page-btn,
#prev-issue-btn,
#next-issue-btn {
    position: absolute;
}

/* ==================== PAGE TRANSITIONS ==================== */
.page-transition-next {
    animation: slideInRight 0.4s var(--ease-out-expo);
}

.page-transition-prev {
    animation: slideInLeft 0.4s var(--ease-out-expo);
}

.page-transition-fade {
    animation: fadeIn 0.3s ease-out;
}

/* ==================== THUMBNAILS ==================== */
.thumbnail-item {
    cursor: pointer;
    transition: var(--transition-base);
    border: 2px solid transparent;
    opacity: 0.6;
}

.thumbnail-item:hover {
    opacity: 1;
    transform: translateY(-2px) scale(1.05);
    border-color: var(--accent-primary);
}

.thumbnail-item.active {
    opacity: 1;
    border-color: var(--unc-tile-teal);
    box-shadow: 0 0 20px rgba(0, 165, 173, 0.4);
}

/* Smooth scrollbar for thumbnails */
#thumbnail-strip::-webkit-scrollbar {
    height: 6px;
}

#thumbnail-strip::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 3px;
}

#thumbnail-strip::-webkit-scrollbar-thumb:hover {
    background: var(--unc-tile-teal);
}

/* ==================== BUTTONS ==================== */
.btn-primary {
    background: var(--accent-primary);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
    box-shadow: var(--shadow-sm);
    color: white;
    font-size: 0.875rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--unc-tile-teal);
}

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

/* ==================== STATS COUNTER ==================== */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-number {
    animation: countUp 0.5s var(--ease-out-expo);
}

/* ==================== LOADING STATES ==================== */
.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* ==================== TOOLTIPS ==================== */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 0.5rem 0.75rem;
    background: var(--unc-longleaf-pine);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: white;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-base);
    z-index: 100;
    box-shadow: var(--shadow-md);
}

[data-tooltip]:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* ==================== FOCUS STATES ==================== */
button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ==================== FILTER ANIMATIONS ==================== */
.filter-checkbox:checked + .filter-label {
    background: rgba(79, 117, 139, 0.1);
    border-color: var(--accent-primary);
}

/* ==================== INFINITE SCROLL ==================== */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .year-carousel {
        padding: 1.1rem;
    }

    .timeline-year-pills {
        gap: 0.75rem;
    }

    .timeline-year-pill {
        min-width: 2.9rem;
        font-size: 0.75rem;
        letter-spacing: 0.1em;
        padding: 0.45rem 0.65rem;
    }

    .month-tile {
        min-width: 3.4rem;
        letter-spacing: 0.2em;
    }

    .month-scroll-track {
        min-height: 4rem;
    }
}

/* ==================== PRINT STYLES ==================== */
@media print {
    header,
    .filter-sidebar,
    .timeline-section,
    button {
        display: none;
    }

    body {
        background: white;
        color: black;
    }
}

/* ==================== INTRO OVERLAY ==================== */
.intro-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 110;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.intro-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.intro-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 22, 20, 0.78);
    backdrop-filter: blur(6px);
}

.intro-dialog {
    position: relative;
    z-index: 1;
    max-width: 480px;
    padding: 3rem 2.5rem;
    border-radius: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.intro-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.45);
    color: var(--text-secondary);
    transition: var(--transition-base);
}

.intro-close-btn:hover {
    transform: rotate(90deg);
    background: rgba(255, 255, 255, 0.7);
}

.intro-title {
    font-size: clamp(2rem, 5vw, 2.75rem);
}

.intro-body {
    font-size: 0.95rem;
    line-height: 1.8;
}

/* ==================== PERFORMANCE OPTIMIZATIONS ==================== */
/* Use GPU acceleration for smoother animations */
.issue-card,
.timeline-year-pill,
.glass-card,
#viewer-image {
    will-change: transform;
}

/* Prevent layout shift during animations */
.issue-card,
.timeline-year-pill {
    contain: layout style paint;
}

/* ==================== ACCESSIBILITY ==================== */
/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .glass,
    .glass-card {
        border-width: 2px;
        border-color: var(--text-primary);
    }
}

/* ==================== COLLAPSIBLE FILTER SIDEBAR ==================== */
#filter-toggle {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
    background: var(--unc-basin-slate);
    color: white;
    padding: 1rem 0.75rem;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: var(--transition-base);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

#filter-toggle:hover {
    background: var(--unc-tile-teal);
    transform: translateY(-50%) scale(1.05);
    box-shadow: var(--shadow-lg);
}

#filter-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform 400ms cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 60;
    overflow-y: auto;
    padding: 2rem 1.5rem;
}

#filter-sidebar.open {
    transform: translateX(0);
}

#filter-sidebar .close-filters {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-base);
    color: var(--text-secondary);
}

#filter-sidebar .close-filters:hover {
    background: var(--unc-azalea-pink);
    color: white;
    transform: rotate(90deg);
}

#filter-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
    z-index: 55;
    backdrop-filter: blur(2px);
}

#filter-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Modal viewer button hover states */
#help-btn:hover,
#download-btn:hover,
#thumbnails-toggle:hover,
#close-viewer-btn:hover {
    background: var(--unc-tile-teal) !important;
}

#zoom-out-btn:hover,
#zoom-in-btn:hover,
#zoom-reset-btn:hover {
    background: var(--unc-tile-teal) !important;
    color: white !important;
}

/* Reset filters button hover */
#reset-filters-btn:hover {
    background: var(--unc-tile-teal) !important;
}

/* Hide default sidebar on mobile when collapsible is active */
@media (max-width: 1023px) {
    .lg\:w-64 {
        display: none;
    }
}

/* Desktop: Show collapsible toggle only */
@media (min-width: 1024px) {
    #filter-toggle {
        display: block;
    }
}

/* ==================== RANDOM ISSUE BUTTON ==================== */
.spin-archive-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: 999px;
    border: 2px solid var(--unc-tile-teal);
    background: linear-gradient(135deg, var(--unc-tile-teal) 0%, var(--unc-basin-slate) 100%);
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition-base);
    box-shadow: 0 4px 15px rgba(0, 165, 173, 0.3);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.spin-archive-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 25px rgba(0, 165, 173, 0.5);
    background: linear-gradient(135deg, var(--unc-tile-teal) 0%, var(--unc-azalea-pink) 100%);
    border-color: var(--unc-azalea-pink);
}

.spin-archive-btn:active {
    transform: translateY(0) scale(1);
}

.spin-archive-btn .spin-icon {
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.spin-archive-btn:hover .spin-icon {
    transform: rotate(180deg);
}

.spin-archive-btn.spinning .spin-icon {
    animation: spinAnimation 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes spinAnimation {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.2);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* Make button more compact on mobile */
@media (max-width: 640px) {
    .spin-archive-btn {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }

    .spin-archive-btn .spin-text {
        display: none;
    }

    .spin-archive-btn .spin-icon {
        width: 1.25rem;
        height: 1.25rem;
    }
}

/* ==================== DARK MODE OVERRIDE (Future-Proof) ==================== */
.dark-mode {
    --bg-primary: #1A1614;
    --bg-secondary: #2D2420;
    --bg-card: #3A302A;
    --bg-hover: rgba(184, 149, 106, 0.15);
    --text-primary: #F5F1E8;
    --text-secondary: #EAE4D8;
    --text-muted: rgba(234, 228, 216, 0.7);
    --accent-primary: #B8956A;
    --accent-secondary: #8B7355;
    --border-color: rgba(184, 149, 106, 0.2);
}

/* ==================== ENHANCED CARD TEXTURES & DEPTH ==================== */

/* Paper texture on glass elements */
.glass::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='cardTexture'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='4' seed='5'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23cardTexture)' opacity='0.3'/%3E%3C/svg%3E");
    opacity: 0.02;
    pointer-events: none;
    z-index: 1;
}

.glass {
    position: relative;
}

/* Paper texture and edge depth on glass cards */
.glass-card {
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='cardTexture'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='4' seed='5'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23cardTexture)' opacity='0.3'/%3E%3C/svg%3E");
    opacity: 0.02;
    pointer-events: none;
    z-index: 1;
}

/* Edge highlight for paper thickness */
.glass-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, rgba(139, 115, 85, 0.15) 100%);
    border-radius: inherit;
    pointer-events: none;
    z-index: 2;
}

/* ==================== ENHANCED ISSUE CARD EFFECTS ==================== */

/* Override issue card transitions for smoother feel */
.issue-card {
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.45s ease,
                border-color 0.3s ease !important;
    overflow: hidden;
    background: var(--bg-card);
}

/* Paper texture on issue cards */
.issue-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='issueTexture'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.5' numOctaves='5' seed='8'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23issueTexture)' opacity='0.25'/%3E%3C/svg%3E");
    opacity: 0.025;
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: multiply;
}

/* Enhanced dramatic hover lift */
.issue-card:hover {
    transform: translateY(-12px) scale(1.03) !important;
    box-shadow: var(--shadow-hover),
                0 0 0 1px rgba(184, 149, 106, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.5) !important;
}

/* Warm shadow glow expansion on hover */
.issue-card::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: inherit;
    background: linear-gradient(135deg,
                rgba(184, 149, 106, 0.3) 0%,
                rgba(139, 115, 85, 0.2) 100%);
    opacity: 0;
    transition: opacity 0.45s ease;
    z-index: -1;
    filter: blur(12px);
}

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

/* Smoother image zoom */
.issue-card img {
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.4s ease !important;
    position: relative;
    z-index: 2;
}

.issue-card:hover img {
    transform: scale(1.06) !important;
}

.newsstand-thumbnail {
    border: 1px solid rgba(139, 115, 85, 0.25);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.issue-card-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.2rem, 2.6vw, 1.45rem);
    letter-spacing: 0.05em;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 1.2;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.4),
        0 8px 18px rgba(0, 0, 0, 0.15);
    word-break: break-word;
}

.issue-card-date {
    font-size: 0.9rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(45, 36, 32, 0.65);
}

/* ==================== IMPROVED STAGGER ANIMATIONS ==================== */
/* Longer stagger delays for more sequential appearance */
.stagger-children > *:nth-child(1) { animation-delay: 0.08s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.16s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.24s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.32s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.4s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.48s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.56s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.64s; }
.stagger-children > *:nth-child(9) { animation-delay: 0.72s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.8s; }
.stagger-children > *:nth-child(11) { animation-delay: 0.88s; }
.stagger-children > *:nth-child(12) { animation-delay: 0.96s; }

/* Smoother fade-in animations */
.fade-in {
    animation: fadeIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.fade-in-scale {
    animation: fadeInScale 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

/* Enhanced issue card fade-in */
.issue-card {
    animation: fadeInScale 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

/* ==================== VINTAGE GRADIENT OVERLAYS ==================== */
/* Subtle vignette effect on body */
body::before {
    background:
        radial-gradient(circle at 20% 50%, rgba(184, 149, 106, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 115, 85, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at center, transparent 0%, rgba(89, 67, 45, 0.03) 100%);
}

/* ==================== ENHANCED TIMELINE PILLS ==================== */
.timeline-year-pill {
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    box-shadow: var(--shadow-sm),
                inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

.timeline-year-pill:hover {
    box-shadow: var(--shadow-md),
                inset 0 1px 0 rgba(255, 255, 255, 0.5) !important;
}

.month-tile {
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    box-shadow: var(--shadow-sm),
                inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

.month-tile:hover {
    box-shadow: var(--shadow-md),
                inset 0 1px 0 rgba(255, 255, 255, 0.5) !important;
}

/* ==================== IMPROVED HEADER SHADOW ==================== */
header.scrolled {
    box-shadow: var(--shadow-md),
                0 1px 0 rgba(255, 255, 255, 0.5) !important;
}
