@import url('https://fonts.googleapis.com/css2?family=Merriweather:ital,wght@0,300;0,400;1,300&family=Playfair+Display:wght@600;700&display=swap');

:root {
    --blog-safe-top: 80px;
    --blog-bg: #0a0d13;
    --blog-bg-top: #10182a;
    --blog-surface: #131825;
    --blog-surface-hover: #181e2e;
    --blog-text: #eef2ff;
    --blog-muted: #b5bed6;
    --blog-meta: #8d99b5;
    --blog-accent: #ffd166;
    --blog-accent-dim: rgba(255, 209, 102, 0.55);
    --blog-border: rgba(255, 209, 102, 0.22);
    --blog-border-soft: rgba(255, 209, 102, 0.10);
}

/* ===================================
   BLOG MAIN CONTAINER
   =================================== */

.blog-main {
    width: min(980px, 92vw);
    margin-top: calc(var(--blog-safe-top) + 2.5rem);
    margin-inline: auto;
    margin-bottom: 3rem;
    padding: 2rem 1.75rem;
    border-radius: 18px;
    background: linear-gradient(180deg, var(--blog-bg-top) 0%, var(--blog-bg) 40%, #080b11 100%);
    color: var(--blog-text);
}

/* Cancel global section styles from the main site stylesheet inside blog pages. */
.blog-main section {
    max-width: none;
    padding: 0;
    content-visibility: visible;
    contain-intrinsic-size: auto;
}

/* Reset margins on sections EXCEPT the hero which needs its own spacing */
.blog-main section:not(.blog-hero) {
    margin: 0;
}

.blog-main a {
    color: var(--blog-accent);
    transition: color 0.2s ease;
}

.blog-main a:hover {
    color: #ffe299;
    text-decoration: underline;
}

/* ===================================
   BLOG INDEX — HERO
   =================================== */

.blog-hero {
    background: none;
    border: none;
    border-bottom: 1px solid var(--blog-border);
    border-radius: 0;
    padding: 1rem 0.25rem 1.25rem;
    margin-bottom: 3rem;
    box-shadow: none;
}

.blog-hero h1 {
    margin: 0 0 0.375rem;
    font-family: "Playfair Display", serif;
    font-size: clamp(1.6rem, 3.5vw, 2.1rem);
    font-weight: 700;
    text-transform: none;
    letter-spacing: -0.01em;
    line-height: 1.12;
    color: #ffd700;
}

.blog-hero p {
    margin: 0;
    max-width: none;
    color: var(--blog-muted);
    font-size: 1.05rem;
    line-height: 1.65;
}

/* ===================================
   BLOG INDEX — SECTION TITLES
   =================================== */

.blog-section {
    max-width: 780px;
    margin: 0 auto 1.1rem;
}

.blog-section-title {
    margin: 0 0 0.75rem;
    color: var(--blog-accent-dim);
    font-size: 0.875rem;
    /* Min 14px */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    line-height: 1.2;
}

.blog-empty {
    max-width: 780px;
    margin: 0 auto;
    color: var(--blog-muted);
}

/* ===================================
   BLOG INDEX — POST CARDS
   =================================== */

.post-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

.post-card {
    background: var(--blog-surface);
    border: none;
    border-left: 2px solid var(--blog-accent);
    border-radius: 0 12px 12px 0;
    box-shadow: none;
    transition: background 0.25s ease, border-color 0.25s ease;
}

.post-card:hover {
    background: var(--blog-surface-hover);
    border-left-color: #ffd700;
    transform: none;
    box-shadow: none;
}

.post-card-link {
    display: block;
    padding: 1.15rem 1.25rem;
    color: inherit;
    text-decoration: none;
}

.post-card-link:hover {
    text-decoration: none;
}

.post-card-link:focus-visible {
    outline: 2px solid var(--blog-accent);
    outline-offset: 2px;
    border-radius: 0 12px 12px 0;
}

.post-card-title {
    margin: 0 0 0.6rem;
    max-width: none;
    font-family: "Playfair Display", serif;
    font-size: clamp(1.25rem, 2.8vw, 1.55rem);
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.3;
    color: var(--blog-text);
    overflow-wrap: anywhere;
}

.post-card-desc {
    margin: 0 0 1rem;
    max-width: none;
    color: var(--blog-muted);
    font-size: 1rem;
    line-height: 1.75;
    overflow-wrap: anywhere;
}

.post-card-meta {
    margin: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
    font-size: 0.9rem;
    line-height: 1.3;
    color: var(--blog-meta);
    padding-top: 0.75rem;
    border-top: 1px solid var(--blog-border-soft);
}

.meta-sep {
    color: var(--blog-meta);
    line-height: 1;
}

/* ===================================
   BLOG POST — BACK NAVIGATION
   =================================== */

.blog-post-nav {
    margin-bottom: 0.75rem;
}

.blog-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    /* Min 14px */
    font-weight: 600;
    color: var(--blog-meta);
    text-decoration: none;
    letter-spacing: 0.01em;
    transition: color 0.2s ease;
    padding: 0.25rem 0;
}

.blog-back-link:hover {
    color: var(--blog-accent);
    text-decoration: none;
}

/* ===================================
   BLOG POST — TITLE / HEADER
   =================================== */

.blog-post-page {
    max-width: 780px;
    margin: 0 auto;
}

.blog-post-titlebar {
    background: none;
    border: none;
    border-bottom: 1px solid var(--blog-border);
    border-radius: 0;
    padding: 0 0 1rem;
    margin-bottom: 1.1rem;
}

.blog-post-titlebar h1 {
    margin: 0 0 0.5rem;
    font-family: "Playfair Display", serif;
    font-size: clamp(1.55rem, 3.5vw, 2.15rem);
    font-weight: 700;
    text-transform: none;
    letter-spacing: -0.01em;
    line-height: 1.16;
    color: #ffd700;
}

.blog-post-meta {
    margin: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.42rem;
    font-size: 0.875rem;
    /* Min 14px */
    line-height: 1.28;
    color: var(--blog-meta);
}

/* ===================================
   BLOG POST — CONTENT PANEL
   =================================== */

.blog-post-panel {
    max-width: 780px;
    margin: 0;
    background: var(--blog-surface);
    border: 1px solid var(--blog-border-soft);
    border-radius: 16px;
    padding: 1.5rem 1.35rem;
}

.blog-post-content p,
.blog-post-content li {
    margin-top: 0;
    margin-bottom: 1.5rem;
    max-width: none;
    font-family: "Merriweather", serif;
    line-height: 1.85;
    color: #e8ebf5;
    font-size: 1.05rem;
}

.blog-post-content p:last-child,
.blog-post-content li:last-child {
    margin-bottom: 0;
}

.blog-post-content h2,
.blog-post-content h3 {
    font-family: "Playfair Display", serif;
    text-transform: none;
    letter-spacing: 0;
    color: #ffd700;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.blog-post-content h2 {
    font-size: clamp(1.25rem, 2.8vw, 1.6rem);
}

.blog-post-content h3 {
    font-size: clamp(1.1rem, 2.4vw, 1.35rem);
}

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

.blog-post-content a {
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: var(--blog-accent-dim);
    transition: text-decoration-color 0.2s ease;
}

.blog-post-content a:hover {
    text-decoration-color: var(--blog-accent);
}

.blog-post-content hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--blog-border) 30%, var(--blog-border) 70%, transparent 100%);
    margin: 1.75rem 0;
}

.blog-post-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    background: rgba(255, 209, 102, 0.08);
    border: 1px solid var(--blog-border-soft);
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    font-size: 0.88em;
}

.blog-post-content blockquote {
    border-left: 2px solid var(--blog-accent);
    padding-left: 1.1rem;
    margin: 1.5rem 0;
    color: var(--blog-muted);
    font-style: italic;
}

/* ===================================
   RESPONSIVE — TABLET / MOBILE
   =================================== */

@media (max-width: 700px) {
    .blog-main {
        width: min(980px, 95vw);
        margin-top: calc(var(--blog-safe-top) + 1.5rem);
        margin-bottom: 2rem;
        padding: 1.5rem 1.25rem;
        border-radius: 14px;
    }

    .blog-hero {
        padding: 0.75rem 0.25rem 1.25rem;
        margin-bottom: 4rem;
    }

    .blog-hero h1 {
        font-size: clamp(1.7rem, 6vw, 2.2rem);
    }

    .blog-hero p {
        font-size: 1.05rem;
        line-height: 1.65;
    }

    .blog-section-title {
        font-size: 0.875rem;
        /* Min 14px */
        margin-bottom: 1rem;
    }

    .blog-post-titlebar {
        padding: 0 0 1rem;
        margin-bottom: 1rem;
    }

    .blog-post-panel {
        padding: 1.35rem 1.1rem;
        border-radius: 14px;
    }

    .post-card-link {
        padding: 1.15rem 1.25rem;
    }

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

    .post-card-desc {
        font-size: 1rem;
        line-height: 1.72;
    }

    .post-card-meta {
        font-size: 0.9rem;
        gap: 0.45rem;
    }

    /* Mobile nav menu links — larger tap targets and text */
    .nav-links.active a {
        font-size: 1.2rem;
        padding: 0.85rem 1rem;
        letter-spacing: 0.01em;
    }

    .blog-section {
        margin-bottom: 1rem;
    }
}

/* ===================================
   RESPONSIVE — SMALL PHONE
   =================================== */

@media (max-width: 430px) {
    .blog-main {
        width: min(980px, 96vw);
        padding: 1rem 0.75rem;
    }

    .blog-hero h1 {
        font-size: 1.65rem;
    }

    .blog-hero p {
        font-size: 1rem;
    }

    .post-card {
        border-radius: 0 10px 10px 0;
    }

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

    .post-card-desc {
        font-size: 1rem;
        line-height: 1.7;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .post-card-meta {
        gap: 0.35rem;
        font-size: 0.88rem;
    }

    .blog-post-panel {
        padding: 1.25rem 1rem;
    }

    .blog-post-content p,
    .blog-post-content li {
        font-size: 1.02rem;
        line-height: 1.82;
        margin-bottom: 1.35rem;
    }
}

@media (max-width: 360px) {
    .post-card-meta .meta-sep {
        display: none;
    }
}