/* ============================================
   Category Page Styles - Mobile First
   Graham & Doddsville News Sources
   ============================================ */

/* --- CSS Variables (inheriting from main site) --- */
:root {
    --cat-purple: #6b21a8;
    --cat-purple-light: #8b5cf6;
    --cat-purple-dark: #4c1d95;
    --cat-gold: #d4af37;
    --cat-gold-light: #f5d76e;
    --cat-navy: #1e3a8a;
    --cat-navy-dark: #0f172a;
    --cat-bg: #f8f7f4;
    --cat-card-bg: #ffffff;
    --cat-text: #333333;
    --cat-text-muted: #666666;
    --cat-text-light: #888888;
    --cat-border: #e5e2d9;
    --cat-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --cat-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.12);
    --cat-radius: 12px;
    --cat-radius-sm: 8px;
    --cat-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Base Reset for Page --- */
.category-page {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--cat-bg);
    min-height: 100vh;
    color: var(--cat-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Back Navigation Bar --- */
.category-back-nav {
    /* Not sticky: the shared site header is sticky above it */
    position: relative;
    z-index: 1;
    background: linear-gradient(135deg, var(--cat-purple-dark) 0%, var(--cat-purple) 100%);
    padding: 0 16px;
    display: flex;
    align-items: center;
    height: 52px;
    box-shadow: 0 2px 12px rgba(107, 33, 168, 0.3);
}

.category-back-nav.world-section {
    background: linear-gradient(135deg, var(--cat-navy-dark) 0%, var(--cat-navy) 100%);
    box-shadow: 0 2px 12px rgba(30, 58, 138, 0.3);
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 0;
    transition: var(--cat-transition);
    -webkit-tap-highlight-color: transparent;
}

.category-back-nav a.back-link {
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 500;
}

.back-btn:active {
    opacity: 0.7;
}

.back-arrow {
    font-size: 1.2rem;
    line-height: 1;
    transition: transform 0.2s ease;
}

.back-btn:active .back-arrow {
    transform: translateX(-3px);
}

.back-label {
    letter-spacing: 0.02em;
}

/* --- Category Hero Header --- */
.category-hero {
    padding: 28px 20px 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.category-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(107, 33, 168, 0.04) 0%, transparent 100%);
    pointer-events: none;
}

.category-hero.world-section::before {
    background: linear-gradient(180deg, rgba(30, 58, 138, 0.04) 0%, transparent 100%);
}

.category-section-label {
    display: inline-block;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--cat-purple);
    background: rgba(107, 33, 168, 0.08);
    padding: 5px 14px;
    border-radius: 20px;
    margin-bottom: 12px;
    animation: fadeInDown 0.5s ease forwards;
}

.world-section .category-section-label {
    color: var(--cat-navy);
    background: rgba(30, 58, 138, 0.08);
}

.category-icon {
    font-size: 2.2rem;
    display: block;
    margin-bottom: 8px;
    animation: fadeInScale 0.6s ease forwards;
    animation-delay: 0.1s;
    opacity: 0;
}

.category-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--cat-purple-dark);
    margin: 0 0 8px;
    line-height: 1.2;
    animation: fadeInDown 0.5s ease forwards;
    animation-delay: 0.15s;
    opacity: 0;
}

.world-section .category-title {
    color: var(--cat-navy-dark);
}

.category-count {
    font-size: 0.8rem;
    color: var(--cat-text-light);
    letter-spacing: 0.02em;
    animation: fadeInDown 0.5s ease forwards;
    animation-delay: 0.25s;
    opacity: 0;
}

/* --- Sources List Container --- */
.sources-container {
    padding: 0 16px 32px;
    max-width: 600px;
    margin: 0 auto;
}

/* --- Source Card --- */
.source-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--cat-card-bg);
    border: 1px solid var(--cat-border);
    border-radius: var(--cat-radius);
    padding: 16px 18px;
    margin-bottom: 10px;
    text-decoration: none;
    color: var(--cat-text);
    transition: var(--cat-transition);
    box-shadow: var(--cat-shadow);
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;

    /* Staggered entrance animation */
    opacity: 0;
    transform: translateY(16px);
    animation: slideInCard 0.45s ease forwards;
}

.source-card:nth-child(1)  { animation-delay: 0.05s; }
.source-card:nth-child(2)  { animation-delay: 0.08s; }
.source-card:nth-child(3)  { animation-delay: 0.11s; }
.source-card:nth-child(4)  { animation-delay: 0.14s; }
.source-card:nth-child(5)  { animation-delay: 0.17s; }
.source-card:nth-child(6)  { animation-delay: 0.20s; }
.source-card:nth-child(7)  { animation-delay: 0.23s; }
.source-card:nth-child(8)  { animation-delay: 0.26s; }
.source-card:nth-child(9)  { animation-delay: 0.29s; }
.source-card:nth-child(10) { animation-delay: 0.32s; }
.source-card:nth-child(11) { animation-delay: 0.35s; }
.source-card:nth-child(12) { animation-delay: 0.38s; }
.source-card:nth-child(13) { animation-delay: 0.41s; }
.source-card:nth-child(14) { animation-delay: 0.44s; }
.source-card:nth-child(15) { animation-delay: 0.47s; }
.source-card:nth-child(16) { animation-delay: 0.50s; }
.source-card:nth-child(17) { animation-delay: 0.53s; }
.source-card:nth-child(18) { animation-delay: 0.56s; }
.source-card:nth-child(19) { animation-delay: 0.59s; }
.source-card:nth-child(20) { animation-delay: 0.62s; }

/* Left accent bar */
.source-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--card-accent, var(--cat-purple));
    border-radius: 4px 0 0 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.source-card:active::before,
.source-card:hover::before {
    opacity: 1;
}

.source-card:active {
    transform: scale(0.98);
    box-shadow: var(--cat-shadow);
    background: #faf9f7;
}

@media (hover: hover) {
    .source-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--cat-shadow-hover);
        border-color: rgba(107, 33, 168, 0.15);
    }

    .world-section ~ .sources-container .source-card:hover {
        border-color: rgba(30, 58, 138, 0.15);
    }
}

/* --- Source Number Badge --- */
.source-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(107, 33, 168, 0.08) 0%, rgba(107, 33, 168, 0.04) 100%);
    color: var(--cat-purple);
    font-size: 0.75rem;
    font-weight: 700;
    font-family: Georgia, 'Times New Roman', serif;
}

.world-variant .source-number {
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.08) 0%, rgba(30, 58, 138, 0.04) 100%);
    color: var(--cat-navy);
}

/* --- Source Info --- */
.source-info {
    flex: 1;
    min-width: 0;
}

.source-name {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--cat-text);
    line-height: 1.3;
    margin: 0 0 3px;
}

.source-domain {
    font-size: 0.72rem;
    color: var(--cat-text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

/* --- External Link Icon --- */
.source-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: rgba(107, 33, 168, 0.06);
    color: var(--cat-purple-light);
    transition: var(--cat-transition);
}

.world-variant .source-arrow {
    background: rgba(30, 58, 138, 0.06);
    color: var(--cat-navy);
}

.source-arrow svg {
    width: 14px;
    height: 14px;
}

.source-card:active .source-arrow,
.source-card:hover .source-arrow {
    background: var(--cat-purple);
    color: #ffffff;
    transform: scale(1.1);
}

.world-variant .source-card:active .source-arrow,
.world-variant .source-card:hover .source-arrow {
    background: var(--cat-navy);
}

/* --- Empty State --- */
.category-empty {
    text-align: center;
    padding: 60px 24px;
    animation: fadeInDown 0.5s ease forwards;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.2rem;
    color: var(--cat-text);
    margin-bottom: 8px;
}

.empty-text {
    font-size: 0.85rem;
    color: var(--cat-text-muted);
    line-height: 1.5;
}

.empty-home-link {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 28px;
    background: var(--cat-purple);
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--cat-transition);
}

.empty-home-link:active {
    transform: scale(0.97);
    opacity: 0.9;
}

/* --- Divider --- */
.sources-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0 16px;
    padding: 0 4px;
}

.sources-divider-line {
    flex: 1;
    height: 1px;
    background: var(--cat-border);
}

.sources-divider-text {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cat-text-light);
    white-space: nowrap;
}

/* --- Footer --- */
.category-footer {
    text-align: center;
    padding: 24px 20px 40px;
    border-top: 1px solid var(--cat-border);
    margin-top: 8px;
}

.footer-text {
    font-size: 0.72rem;
    color: var(--cat-text-light);
    line-height: 1.5;
}

.footer-link {
    color: var(--cat-purple);
    text-decoration: none;
    font-weight: 600;
}

.world-variant .footer-link {
    color: var(--cat-navy);
}

/* --- Animations --- */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

/* --- Responsive: Slightly larger screens --- */
@media (min-width: 400px) {
    .category-hero {
        padding: 32px 24px 28px;
    }

    .category-title {
        font-size: 1.8rem;
    }

    .source-card {
        padding: 18px 20px;
    }

    .source-name {
        font-size: 1rem;
    }

    .source-domain {
        max-width: 280px;
    }
}

/* --- Responsive: Tablet+ --- */
@media (min-width: 600px) {
    .sources-container {
        padding: 0 24px 40px;
    }

    .category-hero {
        padding: 40px 32px 32px;
    }

    .category-title {
        font-size: 2rem;
    }

    .source-card {
        padding: 20px 24px;
        gap: 16px;
    }

    .source-number {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 0.8rem;
    }
}

/* --- Desktop preview (for later) --- */
@media (min-width: 768px) {
    .sources-container {
        max-width: 700px;
    }
}
