/* --- Base Reset & Variable Assignment --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #ffffff;
    color: #1f2937;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- Exact Site Header --- */
header {
    background-color: #ffffff;
    border-bottom: 1px solid #f3f4f6;
    position: sticky;
    top: 0;
    z-index: 999;
}

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

.logo {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    text-decoration: none;
    letter-spacing: -0.025em;
}

nav {
    display: flex;
    align-items: center;
}

nav a {
    margin-left: 24px;
    text-decoration: none;
    color: #4b5563;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.15s ease;
}

nav a:hover {
    color: #111827;
}

/* --- Hamburger Menu Button --- */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    z-index: 1001;
}

.menu-toggle:hover {
    background-color: #f3f4f6;
}

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #374151;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-toggle span:nth-child(1) {
    margin-bottom: 5px;
}

.menu-toggle span:nth-child(2) {
    margin-bottom: 5px;
}

/* Hamburger → X animation */
.menu-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

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

/* --- Content Container Framework --- */
.main-container {
    max-width: 1200px;
    margin: 48px auto;
    padding: 0 20px;
}

/* --- True 3-Column Clean Card Layout --- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 48px 32px;
}

.blog-card {
    background: #ffffff;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

/* Precise Thumbnail Framing Placement Box */
.card-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background-color: #f3f4f6;
    overflow: hidden;
}

.card-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.fallback-banner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    color: #475569;
    font-size: 14px;
    font-weight: 600;
    padding: 16px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.card-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 20px 24px 24px;
}

.category-tag {
    font-size: 12px;
    color: #2563eb;
    font-weight: 600;
    margin-bottom: 8px;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.card-title a {
    color: #111827;
    text-decoration: none;
    transition: color 0.15s ease;
}

.card-title a:hover {
    color: #2563eb;
}

/* Meta Line Grid Setup (Author context tags) */
.card-meta {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.author-img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    margin-right: 8px;
    object-fit: cover;
}

.author-name {
    font-weight: 500;
    color: #374151;
}

.meta-separator {
    margin: 0 6px;
    color: #9ca3af;
}

.card-excerpt {
    color: #4b5563;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.read-more {
    color: #111827;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    transition: color 0.15s ease;
}

.read-more:hover {
    color: #2563eb;
}

/* --- Article Detail View Management CSS --- */
.single-post-container {
    max-width: 760px;
    margin: 56px auto;
}

.article-header {
    margin-bottom: 32px;
}

.article-featured-img {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 24px;
}

.article-title {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: #111827;
    margin-top: 12px;
    margin-bottom: 16px;
}

.article-content h2 {
    font-size: 22px;
    font-weight: 700;
    margin-top: 36px;
    margin-bottom: 14px;
    color: #111827;
}

.article-content h3 {
    font-size: 18px;
    font-weight: 700;
    margin-top: 24px;
    margin-bottom: 10px;
    color: #1f2937;
}

.article-content p {
    font-size: 16px;
    color: #374151;
    margin-bottom: 20px;
    line-height: 1.65;
}

/* --- Table of Contents --- */
.toc-wrapper {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 32px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.toc-wrapper:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.toc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: background-color 0.15s ease;
}

.toc-toggle:hover {
    background-color: #f1f5f9;
}

.toc-toggle-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toc-icon {
    width: 20px;
    height: 20px;
    color: #2563eb;
    flex-shrink: 0;
}

.toc-toggle-title {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.01em;
}

.toc-chevron {
    width: 18px;
    height: 18px;
    color: #94a3b8;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.toc-wrapper.open .toc-chevron {
    transform: rotate(180deg);
}

.toc-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.toc-wrapper.open .toc-content {
    max-height: 600px;
}

.toc-list {
    list-style: none;
    padding: 0 20px 16px;
    margin: 0;
}

.toc-list li {
    border-bottom: 1px solid #f1f5f9;
}

.toc-list li:last-child {
    border-bottom: none;
}

.toc-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    text-decoration: none;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    transition: color 0.15s ease;
}

.toc-list a:hover {
    color: #2563eb;
}

.toc-number {
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    min-width: 20px;
}

.toc-list li.toc-h3 a {
    padding-left: 30px;
    font-weight: 400;
    font-size: 13px;
    color: #6b7280;
}

.toc-list li.toc-h3 .toc-number {
    font-size: 11px;
}

/* --- Ad Container --- */
.ad-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 32px auto;
    padding: 0;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    clear: both;
}

.ad-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

/* --- Static Page --- */
.static-page-container {
    max-width: 760px;
    margin: 56px auto;
}

.page-title {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: #111827;
    margin-bottom: 24px;
}

.article-body p {
    font-size: 16px;
    color: #374151;
    margin-bottom: 20px;
    line-height: 1.65;
}

/* --- Footer Minimal UI --- */
footer {
    border-top: 1px solid #f3f4f6;
    padding: 32px 20px;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
    margin-top: 96px;
}

/* --- Mobile Screen Adaptive Scale Updates --- */
@media (max-width: 768px) {
    .header-container {
        flex-wrap: wrap;
        padding: 16px 20px;
    }

    .menu-toggle {
        display: flex;
    }

    nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding-top: 16px;
        border-top: 1px solid #f3f4f6;
        margin-top: 16px;
    }

    nav.active {
        display: flex;
        animation: slideDown 0.3s ease;
    }

    nav a {
        margin-left: 0;
        padding: 12px 0;
        font-size: 15px;
        border-bottom: 1px solid #f9fafb;
        color: #374151;
    }

    nav a:last-child {
        border-bottom: none;
    }

    nav a:hover {
        color: #2563eb;
    }

    .blog-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .article-title {
        font-size: 24px;
    }

    .ad-container {
        margin: 24px 16px;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}