/*
 Theme Name:   Twenty Twenty-Five Coloring
 Theme URI:    https://colorjoy.com
 Description:  Child theme for Coloring Pages Website - based on Twenty Twenty-Five
 Author:       ColorJoy Team
 Author URI:   https://colorjoy.com
 Template:     twentytwentyfive
 Version:      1.8.25
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Text Domain:  twentytwentyfive-coloring
 Tags:         coloring, gallery, kids, creative
*/

/* ==========================================================================
   CSS Variables - Design System
   ========================================================================== */
:root {
    /* Colors - Cream & Terracotta Theme */
    --color-base: #FDFAF7;
    --color-base-alt: #F5EDE4;
    --color-contrast: #2C2C2C;
    --color-contrast-light: #686868;
    --color-accent: #D97757;
    --color-accent-hover: #C4664A;
    --color-accent-light: #F5E6D3;
    --color-accent-muted: #8B7355;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 2px 8px rgba(139, 115, 85, 0.12);
    --shadow-card-hover: 0 8px 24px rgba(139, 115, 85, 0.18);
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-pill: 50px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
    
    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
}

/* ==========================================================================
   Base Styles Override
   ========================================================================== */
body {
    background-color: var(--color-base);
    color: var(--color-contrast);
    /* CLS Prevention: Use system fonts as fallback with similar metrics */
    font-family: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ==========================================================================
   Typography Enhancements
   ========================================================================== */
h1, h2, h3, h4, h5, h6, .entry-title {
    font-weight: 500;
    letter-spacing: -0.02em;
    /* CLS Prevention: Use system fonts as fallback */
    font-family: 'Fredoka', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ==========================================================================
   Button Styles
   ========================================================================== */
.btn,
.wp-block-button__link {
    border-radius: var(--radius-pill);
    transition: all var(--transition-normal);
}

.btn-primary,
.wp-block-button__link {
    background-color: var(--color-accent);
    color: white;
}

.btn-primary:hover,
.wp-block-button__link:hover {
    background-color: var(--color-accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--color-base);
    color: var(--color-contrast);
    border: 1px solid var(--color-accent-muted);
}

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

/* ==========================================================================
   Badge Component
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-pill);
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-sm);
}

.badge-images {
    color: var(--color-accent);
}

.badge-views {
    color: var(--color-accent-muted);
}

.badge-downloads {
    color: var(--color-accent);
    background-color: var(--color-accent-light);
}

/* ==========================================================================
   Navigation Pills Style
   ========================================================================== */
.wp-block-navigation .wp-block-navigation-item a {
    padding: 8px 20px;
    border-radius: var(--radius-pill);
    transition: all var(--transition-normal);
}

.wp-block-navigation .wp-block-navigation-item a:hover,
.wp-block-navigation .wp-block-navigation-item.current-menu-item a {
    background-color: var(--color-accent);
    color: white;
}
/* ==========================================================================
   HEADER & NAVIGATION STYLES
   ========================================================================== */

/* Header Container */
.site-header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.site-header.scrolled {
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 80px;
}

/* Site Branding */
.site-branding {
    display: flex;
    align-items: center;
    z-index: 10;
}

.site-logo img,
.custom-logo {
    max-height: 60px;
    width: auto;
    display: block;
}

.site-title-link {
    text-decoration: none;
}

.site-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    transition: color 0.3s ease;
}

.site-title-link:hover .site-title {
    color: #667eea;
}

.site-description {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 5px 0 0 0;
    font-weight: 400;
}

/* Primary Navigation */
.primary-navigation {
    display: flex;
    align-items: center;
}

/* Desktop Menu */
.desktop-menu {
    display: block;
}

.primary-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 10px;
}

.primary-menu > li {
    position: relative;
}

.primary-menu .menu-link {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 18px;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.primary-menu > li > .menu-link:hover,
.primary-menu > li.active > .menu-link,
.primary-menu > li.current-menu-item > .menu-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.dropdown-arrow {
    font-size: 0.7em;
    transition: transform 0.3s ease;
}

.has-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* Dropdown Menu - Styles moved to header.css */

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
}

.hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 28px;
}

.hamburger .line {
    width: 100%;
    height: 3px;
    background: #374151;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active .line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.mobile-menu-toggle.active .line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile Menu Sidebar */
.mobile-menu-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 320px;
    max-width: 85%;
    height: 100vh;
    background: #fff;
    z-index: 1000;
    transition: right 0.3s ease;
    box-shadow: -5px 0 30px rgba(0,0,0,0.2);
    overflow-y: auto;
}

.mobile-menu-sidebar.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.mobile-logo img,
.mobile-logo .custom-logo {
    max-height: 40px;
    width: auto;
}

.mobile-site-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: #6b7280;
    cursor: pointer;
    padding: 5px 10px;
    line-height: 1;
    transition: color 0.3s ease;
}

.mobile-menu-close:hover {
    color: #667eea;
}

.mobile-menu-content {
    padding: 15px 0;
}

.mobile-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-menu li {
    border-bottom: 1px solid #f3f4f6;
}

.mobile-menu a {
    display: block;
    padding: 15px 20px;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.mobile-menu a:hover,
.mobile-menu .active > a,
.mobile-menu .current-menu-item > a {
    background: linear-gradient(135deg, #667eea10 0%, #764ba210 100%);
    color: #667eea;
    padding-left: 30px;
}

.mobile-menu .sub-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    background: #f9fafb;
}

.mobile-menu .sub-menu a {
    padding-left: 40px;
    font-size: 0.9em;
}

/* No Menu Notice */
.no-menu-notice {
    padding: 15px 20px;
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
}

.no-menu-notice p {
    margin: 0;
    color: #92400e;
}

/* Responsive */
@media (max-width: 768px) {
    .header-container {
        min-height: 70px;
        padding: 0 15px;
    }

    .desktop-menu {
        display: none;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .site-description {
        display: none;
    }

    .site-logo img,
    .custom-logo {
        max-height: 45px;
    }

    .site-title {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .mobile-menu-sidebar {
        width: 280px;
    }
}


/* ==========================================================================
   FOOTER STYLES
   ========================================================================== */

.site-footer {
    background: #1f2937;
    color: #9ca3af;
    padding: 60px 0 30px;
    margin-top: 80px;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Footer Widgets */
.footer-widgets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
    margin-bottom: 50px;
    padding-bottom: 40px;
    border-bottom: 1px solid #374151;
}

.footer-column {
    min-width: 0;
}

.footer-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 20px;
}

.footer-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-menu li {
    margin-bottom: 12px;
}

.footer-menu a {
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.9375rem;
    transition: all 0.3s ease;
    display: inline-block;
}

.footer-menu a:hover {
    color: #667eea;
    padding-left: 5px;
}

.footer-menu-notice {
    font-size: 0.875rem;
    opacity: 0.7;
}

.footer-menu-notice a {
    color: #667eea;
    text-decoration: underline;
}

/* Footer Bottom */
.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-info {
    display: flex;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
}

.copyright p {
    margin: 0;
    font-size: 0.875rem;
    color: #9ca3af;
}

.copyright a {
    color: #667eea;
    text-decoration: none;
}

.copyright a:hover {
    text-decoration: underline;
}

/* Social Links */
.footer-social {
    display: flex;
    align-items: center;
}

.social-links {
    display: flex;
    gap: 12px;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: #374151;
    border-radius: 50%;
    color: #9ca3af;
    text-decoration: none;
    font-size: 1.25rem;
    transition: all 0.3s ease;
}

.social-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.social-link .social-icon {
    font-size: 1.2em;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 99;
    opacity: 0;
    visibility: hidden;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.5);
}

.arrow-up {
    font-size: 1.5em;
    line-height: 1;
}

/* Responsive */
@media (max-width: 1024px) {
    .footer-widgets {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
}

@media (max-width: 768px) {
    .site-footer {
        padding: 40px 0 20px;
        margin-top: 60px;
    }

    .footer-widgets {
        grid-template-columns: 1fr;
        gap: 30px;
        margin-bottom: 30px;
        padding-bottom: 30px;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    .footer-info {
        flex-direction: column;
        gap: 20px;
        width: 100%;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    .social-link {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }
}


/* ==========================================================================
   Coloring Grid Styles
   ========================================================================== */

/* Main Containers */
.coloring-archive-main,
.coloring-single-main {
    max-width: 1340px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.coloring-hero {
    text-align: center;
    padding: var(--space-2xl) 0;
    background: var(--color-base);
}

.hero-badge {
    display: inline-block;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-accent-muted);
    background: var(--color-accent-light);
    border-radius: var(--radius-pill);
    margin-bottom: var(--space-md);
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 500;
    line-height: 1.2;
    color: var(--color-contrast);
    margin: 0 0 var(--space-md);
}

.hero-highlight {
    color: var(--color-accent);
}

.hero-description {
    font-size: 1.1rem;
    color: var(--color-contrast-light);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ==========================================================================
   How It Works Section
   ========================================================================== */
.how-it-works {
    padding: var(--space-2xl) 0;
    background: var(--color-accent-light);
    margin-top: var(--space-2xl);
    border-radius: var(--radius-lg);
}

.how-it-works .section-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 500;
    color: var(--color-contrast);
    margin: 0 0 var(--space-xl);
}

.how-it-works .steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xl);
    max-width: 900px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

@media (max-width: 768px) {
    .how-it-works .steps {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
}

.how-it-works .step {
    text-align: center;
    padding: var(--space-lg);
}

.how-it-works .step-number {
    display: block;
    font-size: 2.5rem;
    margin-bottom: var(--space-sm);
}

.how-it-works .step h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-contrast);
    margin: 0 0 var(--space-xs);
}

.how-it-works .step p {
    font-size: 0.9rem;
    color: var(--color-contrast-light);
    margin: 0;
    line-height: 1.5;
}

/* ==========================================================================
   Grid Container
   ========================================================================== */
.coloring-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-xl);
    padding: var(--space-xl) 0;
}

.coloring-grid-section {
    padding: var(--space-lg) 0;
}

@media (max-width: 1024px) {
    .coloring-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-lg);
    }
}

@media (max-width: 768px) {
    .coloring-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-md);
    }
}

@media (max-width: 480px) {
    .coloring-grid {
        grid-template-columns: 1fr;
    }
}

/* Card Image Placeholder */
.card-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 3rem;
    background: var(--color-accent-light);
}

/* ==========================================================================
   Card Component
   ========================================================================== */
.coloring-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-normal);
    cursor: pointer;
}

.coloring-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}

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

/* Card Image Container */
.card-image {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--color-accent-light);
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.coloring-card:hover .card-image img {
    transform: scale(1.05);
}

/* Card Badges */
.card-badges {
    position: absolute;
    bottom: var(--space-sm);
    left: var(--space-sm);
    right: var(--space-sm);
    display: flex;
    justify-content: space-between;
    gap: var(--space-xs);
}

.card-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-contrast);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
}

.card-badge svg,
.card-badge .badge-icon {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.badge-images .badge-icon {
    color: var(--color-accent);
}

.badge-views .badge-icon {
    color: var(--color-accent-muted);
}

/* Card Content */
.card-content {
    padding: var(--space-md);
}

.card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-accent);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-excerpt {
    margin: var(--space-xs) 0 0;
    font-size: 0.875rem;
    color: var(--color-contrast-light);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================================================
   Category Pills Navigation
   ========================================================================== */
.category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    justify-content: center;
    padding: var(--space-lg) 0;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-contrast);
    background: white;
    border: 1px solid var(--color-accent-light);
    border-radius: var(--radius-pill);
    text-decoration: none;
    transition: all var(--transition-normal);
}

.category-pill:hover,
.category-pill.active {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

.category-pill .pill-icon {
    font-size: 1.1em;
}

.category-pill .pill-count {
    font-size: 0.8em;
    opacity: 0.7;
}

/* ==========================================================================
   Archive Header
   ========================================================================== */
.archive-header {
    text-align: center;
    padding: var(--space-2xl) 0 var(--space-xl);
}

.archive-title {
    font-size: 2.5rem;
    font-weight: 500;
    color: var(--color-contrast);
    margin: 0 0 var(--space-sm);
}

.archive-description {
    font-size: 1.1rem;
    color: var(--color-contrast-light);
    max-width: 600px;
    margin: 0 auto;
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.coloring-pagination {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-2xl) 0;
}

.coloring-pagination a,
.coloring-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 var(--space-md);
    font-weight: 500;
    color: var(--color-contrast);
    background: white;
    border: 1px solid var(--color-accent-light);
    border-radius: var(--radius-pill);
    text-decoration: none;
    transition: all var(--transition-normal);
}

.coloring-pagination a:hover {
    background: var(--color-accent-light);
}

.coloring-pagination .current {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

/* ==========================================================================
   Loading Skeleton
   ========================================================================== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-accent-light) 25%,
        var(--color-base-alt) 50%,
        var(--color-accent-light) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.skeleton-image {
    aspect-ratio: 1;
    background: var(--color-accent-light);
}

.skeleton-title {
    height: 20px;
    margin: var(--space-md);
    border-radius: 4px;
}

/* CLS Fixes v1.6.3 */
header.wp-block-template-part {
    min-height: 100px;
    contain: layout paint;
}

/* ==========================================================================
   CLS Optimization - Prevent Layout Shift
   ========================================================================== */

/* Block site-logo container - Reserve space */
.wp-block-site-logo {
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    contain: layout size;
}

/* Site-logo link wrapper - Fixed dimensions */
.wp-block-site-logo a {
    display: flex;
    align-items: center;
    min-height: 40px;
    line-height: 0;
}

/* Logo image - Fixed aspect ratio to prevent CLS */
.wp-block-site-logo img,
.wp-block-site-logo .custom-logo {
    display: block;
    width: auto;
    height: 40px; /* Match the width setting in header.html */
    max-height: 60px;
    object-fit: contain;
}

/* Custom logo link container */
.custom-logo-link {
    display: flex;
    align-items: center;
    line-height: 0;
    min-height: 43px; /* Reserve space based on common logo height */
}

.custom-logo-link .custom-logo {
    display: block;
    height: auto;
    max-height: 60px;
    width: auto;
}

/* For logos with known dimensions, use CSS containment */
.wp-block-site-logo img[width][height] {
    /* Let browser calculate aspect-ratio from attributes */
    aspect-ratio: auto;
}

/* Category page layout stability */
.category-main {
    contain: layout;
    min-height: 100vh;
}

/* Category hero - Reserve space */
.category-hero {
    min-height: 250px;
    contain: layout paint;
}

.category-hero-container {
    contain: content;
}

/* Category hero icon - Reserve fixed space */
.category-hero-icon {
    min-width: 120px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Category toolbar stability */
.category-toolbar {
    min-height: 40px;
    contain: layout;
}

/* Posts grid - Prevent layout shift */
.category-posts-grid {
    contain: layout;
}

/* Post card image - Reserve aspect ratio space */
.category-post-card .post-card-image {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background-color: #f5f5f5;
    contain: strict;
}

.category-post-card .post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Siblings section stability */
.category-siblings {
    min-height: 60px;
    contain: layout;
}

/* ==========================================================================
   Typography Variable Integration
   ========================================================================== */
body {
    font-family: var(--font-primary, system-ui, -apple-system, sans-serif);
}

h1, h2, h3, h4, h5, h6, .site-title, .entry-title {
    font-family: var(--font-heading, var(--font-primary, system-ui, -apple-system, sans-serif));
}
