/* ========================================
   CSS Variables & Reset
   ======================================== */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #f9fafb;
    --white: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --header-height: 60px;
    --nav-width: 280px;
    --transition: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

/* Prevent scrolling when navigation is open */
body.nav-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ========================================
   Header Styles
   ======================================== */
.header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--white);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 100;
}

.menu-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background var(--transition);
    color: var(--text-color);
}

.menu-btn:hover {
    background: var(--bg-color);
}

.site-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    white-space: nowrap;
}

.search-container {
    flex: 1;
    max-width: 400px;
    margin-left: auto;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 10px 36px 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px 8px;
    display: none;
}

.search-clear.visible {
    display: block;
}

/* ========================================
   Navigation Drawer Styles
   ======================================== */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
    z-index: 200;
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

.nav-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--nav-width);
    height: 100%;
    background: var(--white);
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform var(--transition);
    z-index: 300;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.nav-drawer.active {
    transform: translateX(0);
}

.nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.nav-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
    line-height: 1;
    transition: color var(--transition);
}

.close-btn:hover {
    color: var(--text-color);
}

.nav-links {
    list-style: none;
    padding: 12px 0;
    flex: 1;
}

.nav-links li a {
    display: block;
    padding: 14px 20px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 15px;
    transition: background var(--transition);
}

.nav-links li a:hover {
    background: var(--bg-color);
}

.nav-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-footer a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 13px;
    transition: color var(--transition);
}

.nav-footer a:hover {
    color: var(--primary-color);
}

/* ========================================
   Carousel Styles
   ======================================== */
.carousel-section {
    padding: 20px 16px;
}

.carousel-container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

.carousel {
    position: relative;
    width: 100%;
    /* 1.91:1 aspect ratio */
    padding-bottom: 52.36%;
    overflow: hidden;
    border-radius: 12px;
    background: var(--border-color);
}

.carousel-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    transition: transform 0.4s ease;
}

.carousel-slide {
    min-width: 100%;
    height: 100%;
    position: relative;
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.carousel-slide-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 24px 24px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: var(--white);
}

.carousel-slide-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.carousel-slide-desc {
    font-size: 0.875rem;
    opacity: 0.9;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: background var(--transition), transform 0.2s;
    z-index: 10;
}

.carousel-btn:hover {
    background: var(--white);
    transform: translateY(-50%) scale(1.05);
}

.carousel-btn-prev {
    left: 12px;
}

.carousel-btn-next {
    right: 12px;
}

.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
    border: none;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}

.carousel-indicator:hover {
    background: var(--text-light);
}

.carousel-indicator.active {
    background: var(--primary-color);
    transform: scale(1.2);
}

/* ========================================
   Search Info
   ======================================== */
.search-info {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    display: none;
}

.search-info.visible {
    display: block;
}

.search-info-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--white);
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.search-info-text {
    font-size: 14px;
    color: var(--text-light);
}

.search-info-text strong {
    color: var(--text-color);
}

.clear-search-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background var(--transition);
}

.clear-search-btn:hover {
    background: var(--bg-color);
}

/* ========================================
   Posts Grid Styles
   ======================================== */
.posts-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px 20px;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.post-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
    cursor: pointer;
}

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

.post-image {
    position: relative;
    width: 100%;
    padding-bottom: 66.67%; /* 3:2 aspect ratio */
    overflow: hidden;
}

.post-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition);
}

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

.post-content {
    padding: 14px;
}

.post-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-light);
}

/* No Results */
.no-results {
    display: none;
    text-align: center;
    padding: 60px 20px;
}

.no-results.visible {
    display: block;
}

.no-results-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.no-results h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    color: var(--text-color);
}

.no-results p {
    color: var(--text-light);
}

/* ========================================
   Pagination Styles
   ======================================== */
.pagination-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--white);
}

.pagination-ellipsis {
    padding: 0 8px;
    color: var(--text-light);
}

/* ========================================
   Footer Styles
   ======================================== */
.footer {
    background: var(--white);
    border-top: 1px solid var(--border-color);
    padding: 24px 16px;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.copyright {
    color: var(--text-light);
    font-size: 14px;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-links a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
    transition: color var(--transition);
}

.footer-links a:hover {
    color: var(--primary-color);
}

.footer-divider {
    color: var(--border-color);
}

/* ========================================
   Legal Pages Styles
   ======================================== */
.legal-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.legal-header {
    position: sticky;
    top: 0;
    background: var(--white);
    box-shadow: var(--shadow-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 100;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-color);
    text-decoration: none;
    transition: all var(--transition);
}

.back-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.legal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.legal-content {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

.legal-content h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    color: var(--text-color);
}

.legal-content .last-updated {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 32px;
}

.legal-content h2 {
    font-size: 1.25rem;
    margin-top: 32px;
    margin-bottom: 16px;
    color: var(--text-color);
}

.legal-content p {
    margin-bottom: 16px;
    color: var(--text-color);
    line-height: 1.7;
}

.legal-content ul {
    margin-bottom: 16px;
    padding-left: 24px;
}

.legal-content li {
    margin-bottom: 8px;
    color: var(--text-color);
}

.legal-footer {
    background: var(--white);
    border-top: 1px solid var(--border-color);
    padding: 24px 16px;
    text-align: center;
}

.legal-footer p {
    color: var(--text-light);
    font-size: 14px;
}

.legal-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

/* ========================================
   Responsive Styles
   ======================================== */
@media (max-width: 768px) {
    :root {
        --header-height: 56px;
        --nav-width: 260px;
    }

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

    .search-container {
        max-width: 180px;
    }

    .search-input {
        padding: 8px 32px 8px 12px;
        font-size: 13px;
    }

    .posts-grid {
        gap: 12px;
    }

    .post-content {
        padding: 12px;
    }

    .post-title {
        font-size: 0.875rem;
    }

    .carousel-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .carousel-btn-prev {
        left: 8px;
    }

    .carousel-btn-next {
        right: 8px;
    }

    .carousel-slide-title {
        font-size: 1rem;
    }

    .carousel-slide-desc {
        display: none;
    }

    .pagination-btn {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .search-container {
        max-width: 140px;
    }

    .carousel-section {
        padding: 12px;
    }

    .posts-section {
        padding: 0 12px 16px;
    }

    .posts-grid {
        gap: 10px;
    }

    .post-content {
        padding: 10px;
    }

    .post-title {
        font-size: 0.8rem;
    }

    .post-meta {
        font-size: 0.7rem;
    }
}

/* Large screens */
@media (min-width: 1024px) {
    .posts-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
