/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-text: #1f2937;
    --color-text-light: #6b7280;
    --color-text-lighter: #9ca3af;
    --color-bg: #ffffff;
    --color-bg-alt: #f9fafb;
    --color-bg-card: #ffffff;
    --color-border: #e5e7eb;
    --color-success: #059669;
    --color-error: #dc2626;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: Georgia, "Times New Roman", serif;
    --max-width: 1100px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    line-height: 1.7;
    color: var(--color-text);
    background: var(--color-bg-alt);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--color-primary-dark);
}

h1, h2, h3, h4 {
    line-height: 1.3;
    color: var(--color-text);
}

/* ============================================
   Layout
   ============================================ */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

.content-wrapper {
    display: block;
    padding: 1.5rem 0;
}

.main-content {
    width: 100%;
}

/* ============================================
   Header
   ============================================ */
.header {
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
}

.logo:hover {
    color: var(--color-primary);
}

.nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text);
    transition: transform 0.3s;
}

.nav-menu {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem;
    box-shadow: var(--shadow-md);
}

.nav-menu.active {
    display: block;
}

.nav-menu ul {
    list-style: none;
}

.nav-menu ul li {
    padding: 0.5rem 0;
}

.nav-menu ul li a {
    color: var(--color-text);
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-menu ul li a:hover,
.nav-menu ul li a.active {
    color: var(--color-primary);
}

/* ============================================
   Featured Section
   ============================================ */
.featured-section {
    margin-bottom: 2.5rem;
}

/* ============================================
   Post Card
   ============================================ */
.post-card {
    background: var(--color-bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s, transform 0.3s;
    display: flex;
    flex-direction: column;
}

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

/* Card with image */
.post-card-image {
    aspect-ratio: 16/9;
    overflow: hidden;
    display: block;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

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

.post-card-body {
    padding: 1.1rem 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.post-card-category {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    background: #eff6ff;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    align-self: flex-start;
    transition: background 0.2s, color 0.2s;
}

.post-card-category:hover {
    background: var(--color-primary);
    color: #fff;
}

.post-card-title {
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.post-card-title a {
    color: var(--color-text);
    transition: color 0.2s;
}

.post-card-title a:hover {
    color: var(--color-primary);
}

.post-card-excerpt {
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.6;
    flex-grow: 1;
}

.post-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
    margin-top: auto;
    gap: 0.75rem;
}

.post-card-meta {
    font-size: 0.8rem;
    color: var(--color-text-lighter);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.post-card-author {
    font-weight: 500;
    color: var(--color-text-light);
}

.post-card-dot {
    color: var(--color-border);
}

.post-card-read-more {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.post-card:hover .post-card-read-more {
    color: var(--color-primary-dark);
}

/* ============================================
   Post Grid
   ============================================ */
.post-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

.section-title {
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-primary);
    display: inline-block;
}

/* ============================================
   Post Detail
   ============================================ */
.post-detail {
    background: var(--color-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.post-header {
    margin-bottom: 1.5rem;
}

.post-header .post-category {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.post-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

.post-meta {
    font-size: 0.875rem;
    color: var(--color-text-light);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.post-image {
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
    overflow: hidden;
}

.post-content {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    line-height: 1.8;
}

.post-content h2 {
    font-family: var(--font-sans);
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
}

.post-content h3 {
    font-family: var(--font-sans);
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem;
}

.post-content p {
    margin-bottom: 1.25rem;
}

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

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

.post-content blockquote {
    border-left: 4px solid var(--color-primary);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    background: var(--color-bg-alt);
    font-style: italic;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.post-content img {
    border-radius: var(--radius);
    margin: 1.5rem 0;
}

.post-content a {
    text-decoration: underline;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

.post-content th,
.post-content td {
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    text-align: left;
}

.post-content th {
    background: var(--color-bg-alt);
    font-weight: 600;
}

/* ============================================
   Related Posts
   ============================================ */
.related-posts {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.related-posts h2 {
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
}

/* ============================================
   Breadcrumb
   ============================================ */
.breadcrumb {
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.breadcrumb a {
    color: var(--color-text-light);
}

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

.breadcrumb span {
    color: var(--color-text-lighter);
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    margin-top: 2rem;
}

.sidebar-inner {
    position: sticky;
    top: 76px;
}

.sidebar-widget {
    background: var(--color-bg);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}

.sidebar-widget h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-primary);
}

.sidebar-widget ul {
    list-style: none;
}

.sidebar-widget ul li {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-widget ul li:last-child {
    border-bottom: none;
}

.sidebar-widget ul li a {
    color: var(--color-text);
    font-size: 0.9rem;
}

.sidebar-widget ul li a:hover {
    color: var(--color-primary);
}

/* ============================================
   Ad Slots
   ============================================ */
.ad-slot {
    text-align: center;
    margin: 1.5rem 0;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
    padding: 0.25rem 0 0.75rem;
}

/* "ADVERTISEMENT" label on top */
.ad-slot::before {
    content: "ADVERTISEMENT";
    display: block;
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: #bbb;
    pointer-events: none;
}

/* Ensure AdSense ins element expands properly */
.ad-slot ins {
    display: block !important;
    width: 100%;
}

.ad-slot iframe {
    max-width: 100%;
}

/* In-article ad slots (in-content + after-content) */
.ad-slot-in-article {
    margin: 2rem 0;
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.5rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
}

.pagination a {
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.pagination a:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.pagination .current {
    background: var(--color-primary);
    color: white;
    border: 1px solid var(--color-primary);
}

.pagination .disabled {
    color: var(--color-text-lighter);
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background: var(--color-text);
    color: #d1d5db;
    padding: 2.5rem 0 1.5rem;
    margin-top: 3rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.footer h4 {
    color: white;
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.footer p {
    font-size: 0.875rem;
    line-height: 1.6;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    padding: 0.25rem 0;
}

.footer-links a {
    color: #d1d5db;
    font-size: 0.875rem;
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid #374151;
    padding-top: 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: #9ca3af;
}

/* ============================================
   Forms
   ============================================ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: var(--color-text);
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font-sans);
    transition: border-color 0.2s;
    background: var(--color-bg);
}

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

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: var(--font-sans);
}

.btn:hover {
    background: var(--color-primary-dark);
    color: white;
}

/* ============================================
   Messages / Alerts
   ============================================ */
.messages {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.alert-success {
    background: #ecfdf5;
    color: var(--color-success);
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: var(--color-error);
    border: 1px solid #fecaca;
}

/* ============================================
   Pages (About, Contact, Legal)
   ============================================ */
.page {
    background: var(--color-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.page h1 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.page h2 {
    font-size: 1.35rem;
    margin: 1.75rem 0 0.75rem;
}

.page h3 {
    font-size: 1.1rem;
    margin: 1.25rem 0 0.5rem;
}

.page p {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--color-text-light);
}

.page ul, .page ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.page li {
    margin-bottom: 0.4rem;
    font-size: 0.95rem;
    color: var(--color-text-light);
}

.page a {
    text-decoration: underline;
}

/* ============================================
   Category Header
   ============================================ */
.category-header {
    margin-bottom: 1.5rem;
}

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

.category-header p {
    color: var(--color-text-light);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-light);
}

.empty-state p {
    font-size: 1.1rem;
}

/* ============================================
   Responsive: Tablet (768px+)
   ============================================ */
@media (min-width: 768px) {
    .nav-toggle {
        display: none;
    }

    .nav-menu {
        display: block;
        position: static;
        background: none;
        border: none;
        padding: 0;
        box-shadow: none;
    }

    .nav-menu ul {
        display: flex;
        gap: 1.5rem;
    }

    .nav-menu ul li {
        padding: 0;
    }

    .content-wrapper {
        display: grid;
        grid-template-columns: 1fr 280px;
        gap: 2rem;
    }

    .sidebar {
        margin-top: 0;
    }

    .post-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .post-card-title {
        font-size: 1.1rem;
    }

    .footer-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .post-header h1 {
        font-size: 2rem;
    }

    .post-detail {
        padding: 2rem;
    }

    .page {
        padding: 2rem;
    }
}

/* ============================================
   Responsive: Desktop (1024px+)
   ============================================ */
@media (min-width: 1024px) {
    .post-card-title {
        font-size: 1.15rem;
    }

    .post-card-no-img .post-card-excerpt {
        -webkit-line-clamp: 4;
    }

    .post-header h1 {
        font-size: 2.25rem;
    }
}
