/**
 * Static Theme - Main Stylesheet
 * 
 * Loaded async after critical CSS.
 * Contains non-critical styles: cards, footer, mobile nav, etc.
 */

/* =========================================================
   POSTS GRID
   ========================================================= */

.posts {
    padding: 4rem 0;
}

.posts__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

/* =========================================================
   CARD COMPONENT
   ========================================================= */

.card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.card__image {
    display: block;
    overflow: hidden;
    aspect-ratio: 3/2;
}

.card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease, opacity 0.3s ease;
}

.card__image img:not(.is-loaded) {
    opacity: 0;
}

.card__image img.is-loaded {
    opacity: 1;
}

.card:hover .card__image img {
    transform: scale(1.05);
}

.card__content {
    padding: 1.5rem;
}

.card__header {
    margin-bottom: 0.75rem;
}

.card__title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.card__title a {
    color: inherit;
}

.card__title a:hover {
    color: #0066cc;
    text-decoration: none;
}

.card__meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: #666;
}

.card__excerpt {
    color: #555;
    margin-bottom: 1rem;
}

.card__link {
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    color: #0066cc;
    transition: gap 0.2s ease;
}

.card__link::after {
    content: '→';
    margin-left: 0.25rem;
    transition: transform 0.2s ease;
}

.card__link:hover {
    text-decoration: none;
}

.card__link:hover::after {
    transform: translateX(4px);
}

/* =========================================================
   MOBILE NAVIGATION
   ========================================================= */

.mobile-nav {
    position: fixed;
    inset: 0;
    z-index: 99;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-nav[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.mobile-nav nav {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    max-width: 80vw;
    background: #fff;
    padding: 5rem 1.5rem 2rem;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.mobile-nav[aria-hidden="false"] nav {
    transform: translateX(0);
}

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

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

.mobile-nav-menu a {
    display: block;
    padding: 1rem 0;
    color: #333;
    font-weight: 500;
    font-size: 1.125rem;
}

/* Nav toggle animation */
body.nav-open .nav-toggle__bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

body.nav-open .nav-toggle__bar:nth-child(2) {
    opacity: 0;
}

body.nav-open .nav-toggle__bar:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* =========================================================
   SINGLE POST / PAGE
   ========================================================= */

.single-post,
.single-page {
    padding: 4rem 0;
}

.single-post .container,
.single-page .container {
    max-width: 800px;
}

.entry-header {
    margin-bottom: 2rem;
    text-align: center;
}

.entry-title {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 1rem;
}

.entry-meta {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    color: #666;
    font-size: 0.9375rem;
}

.entry-thumbnail {
    margin-bottom: 2rem;
    border-radius: 8px;
    overflow: hidden;
}

.entry-thumbnail img {
    width: 100%;
    height: auto;
}

.entry-content {
    font-size: 1.125rem;
    line-height: 1.8;
}

.entry-content h2 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.entry-content h3 {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.entry-content p {
    margin-bottom: 1.5rem;
}

.entry-content ul,
.entry-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.entry-content li {
    margin-bottom: 0.5rem;
}

.entry-content blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background: #f8f9fa;
    border-left: 4px solid #0066cc;
    font-style: italic;
}

.entry-content pre {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #1a1a1a;
    color: #f8f8f2;
    border-radius: 8px;
    overflow-x: auto;
}

.entry-content code {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.9em;
}

.entry-content img {
    border-radius: 8px;
    margin: 2rem 0;
}

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

.site-footer {
    background: #1a1a1a;
    color: #999;
    padding: 4rem 0 2rem;
    margin-top: auto;
}

.site-footer__inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 2rem;
}

.site-footer__branding {
    max-width: 300px;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    display: block;
    margin-bottom: 0.5rem;
}

.footer-logo:hover {
    text-decoration: none;
    color: #fff;
}

.footer-tagline {
    margin: 0;
    font-size: 0.9375rem;
}

.footer-nav {
    display: flex;
    gap: 2rem;
}

.footer-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 2rem;
}

.footer-menu a {
    color: #999;
    transition: color 0.2s;
}

.footer-menu a:hover {
    color: #fff;
    text-decoration: none;
}

.site-footer__bottom {
    border-top: 1px solid #333;
    padding-top: 2rem;
    text-align: center;
}

.copyright {
    margin: 0;
    font-size: 0.875rem;
}

/* =========================================================
   PAGINATION
   ========================================================= */

.pagination,
.nav-links {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    background: #f8f9fa;
    border-radius: 4px;
    color: #333;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.page-numbers:hover {
    background: #0066cc;
    color: #fff;
    text-decoration: none;
}

.page-numbers.current {
    background: #0066cc;
    color: #fff;
}

/* =========================================================
   UTILITY CLASSES
   ========================================================= */

.no-posts {
    text-align: center;
    padding: 4rem 0;
    color: #666;
}

/* Focus styles for accessibility */
a:focus,
button:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: #0066cc;
    color: #fff;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 768px) {
    .posts {
        padding: 2rem 0;
    }
    
    .posts__grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .single-post,
    .single-page {
        padding: 2rem 0;
    }
    
    .entry-content {
        font-size: 1rem;
    }
    
    .site-footer__inner {
        flex-direction: column;
        text-align: center;
    }
    
    .site-footer__branding {
        max-width: none;
    }
    
    .footer-nav {
        width: 100%;
        justify-content: center;
    }
    
    .footer-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
    
    .card__content {
        padding: 1rem;
    }
    
    .card__meta {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
