:root {
    --primary: #f26222;
    --primary-dark: #d5531b;
    --bg: #fafafa;
    --surface: #ffffff;
    --text: #333333;
    --text-secondary: #666666;
    --border: #eaeaea;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    overflow-x: hidden;
}

html {
    overflow-x: hidden;
}

/* HEADER & NAV */
header {
    background: var(--surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    text-decoration: none;
    color: var(--text);
    font-weight: 800;
    font-size: 1.5rem;
    text-transform: uppercase;
}

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

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

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

nav a {
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s;
}

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

.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: var(--text);
    border-radius: 3px;
    transition: 0.3s;
}

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    min-height: 60vh;
}

/* HOMEPAGE SPECIFIC */
.home-hero {
    background: var(--surface);
    padding: 4rem 2rem;
    border-radius: 12px;
    margin-bottom: 3rem;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.home-hero h1 {
    font-size: 2.5rem;
    color: var(--text);
    margin-top: 0;
}

.home-hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto;
}

.home-hero img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 2rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.section-title {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
}

.read-more-btn {
    display: block;
    width: fit-content;
    margin: 2rem auto 0;
    padding: 12px 32px;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    transition: background 0.2s, transform 0.2s;
    text-align: center;
}

.read-more-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* GRID & CARDS */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.post-card {
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.1);
}

.post-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #f0f0f0;
    border-bottom: 1px solid var(--border);
}

.post-card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.post-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
    line-height: 1.4;
}

.post-card a {
    text-decoration: none;
    color: var(--text);
}

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

.post-card .meta {
    margin-bottom: 0;
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* SINGLE POST / PAGE */
.article-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--surface);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border);
}

h1 {
    font-size: 2.2rem;
    margin-top: 0;
    line-height: 1.3;
}

.meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.content a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-bottom-color 0.2s;
}

.content a:hover {
    border-bottom-color: var(--primary);
}

.content h2,
.content h3 {
    margin-top: 2.5rem;
}

/* RESPONSIVE TABLES & CHARTS - FULLSCREEN */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1.5rem 0;
}

.content table {
    width: 100%;
    border-collapse: collapse;
}

.content th,
.content td {
    border: 1px solid var(--border);
    padding: 0.75rem;
    text-align: left;
    white-space: normal;
    word-wrap: break-word;
}

.content th {
    background: #f9f9f9;
    font-weight: 600;
}

.content figure {
    margin: 1.5rem 0;
    width: 100%;
    max-width: 100%;
}

.content figure img {
    width: 100%;
    height: auto;
}

.content iframe,
.content canvas,
.content svg {
    max-width: 100%;
    width: 100%;
    height: auto;
}

/* RELATED POSTS */
.related {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.related h3 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.related .post-thumbnail {
    height: 140px;
    object-fit: cover;
}

/* FOOTER */
footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 3rem 1rem 1.5rem;
    margin-top: 4rem;
}

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

.footer-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

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

.copyright {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 1.5rem;
}

@media (max-width: 768px) {
    .header-container {
        align-items: center;
        position: relative;
    }

    .menu-toggle {
        display: flex;
    }

    nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--surface);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        padding: 1rem;
        border-top: 1px solid var(--border);
        z-index: 99;
    }

    nav.active {
        display: block;
    }

    nav ul {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }

    main {
        padding: 0 0.5rem;
        margin: 1rem auto;
    }

    .article-container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.6rem;
    }

    .home-hero {
        padding: 1.5rem 0.75rem;
        margin-bottom: 1.5rem;
        border-radius: 8px;
    }

    .home-hero h1 {
        font-size: 1.6rem;
    }

    .home-hero p {
        font-size: 0.95rem;
    }

    .home-hero img {
        margin: 1rem 0;
    }

    .section-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    /* Mobile homepage grid - 2 columns, compact cards */
    .post-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .post-thumbnail {
        height: 120px;
        object-fit: cover;
    }

    .post-card-content {
        padding: 0.75rem;
    }

    .post-card h3 {
        font-size: 0.85rem;
        line-height: 1.3;
    }

    .post-card .meta {
        font-size: 0.75rem;
        margin-top: 0.5rem;
    }

    /* Make tables/charts truly fullscreen on mobile */
    .content table {
        font-size: 0.85rem;
    }

    .content th,
    .content td {
        padding: 0.5rem;
    }

    .article-container {
        padding: 1rem;
    }

    /* Mobile overrides for Related Posts - 2x2 with bigger images */
    .related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .related .post-thumbnail {
        height: 160px;
        width: 100%;
        object-fit: contain;
    }

    .related .post-card-content {
        padding: 0.75rem;
    }

    .related .post-card h3 {
        font-size: 0.8rem;
        line-height: 1.3;
        margin-bottom: 0;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}