/* =========================================================================
   Blog — index listing and article body. Shared by /blog and /blog/{slug}.
   Adapts to the light/dark theme via the [data-theme] attribute on <html>.
   ========================================================================= */

.blog-wrap {
    max-width: 820px;
    margin: 0 auto;
    padding: 2rem 1.25rem 4rem;
}

.blog-header {
    margin-bottom: 2.5rem;
    text-align: center;
}

/* The global `header` rule in style.css paints every <header> with a dark
   var(--text-strong) band. In dark mode the light title on that band is fine, but in
   light mode the dark title becomes unreadable — so use an Off White band. */
[data-theme="light"] .blog-header,
[data-theme="light"] .article-hero {
    background: var(--bg-1);
}

.blog-header__title {
    margin: 0 0 0.5rem;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-strong);
}

.blog-header__subtitle {
    margin: 0;
    font-size: 1.05rem;
    color: var(--text-muted);
}

[data-theme="dark"] .blog-header__title {
    color: var(--text-strong);
}

[data-theme="dark"] .blog-header__subtitle {
    color: var(--text-muted);
}

/* ── Article cards on the index page ─────────────────────────────────── */

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.blog-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.blog-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--text) 10%, transparent);
}

[data-theme="dark"] .blog-card {
    background: var(--bg-1);
    border-color: var(--line);
}

.blog-card__image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: var(--bg-0);
}

[data-theme="dark"] .blog-card__image {
    background: var(--bg-1);
}

.blog-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.1rem 1.25rem 1.4rem;
}

.blog-card__date {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.blog-card__title {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.35;
}

.blog-card__excerpt {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text);
    flex: 1;
}

[data-theme="dark"] .blog-card__excerpt {
    color: var(--text-muted);
}

.blog-empty {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

/* ── Single article body ─────────────────────────────────────────────── */

.article-hero {
    margin-bottom: 2rem;
    text-align: center;
}

.article-hero__eyebrow {
    display: inline-block;
    margin-bottom: 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.article-hero__title {
    margin: 0 0 0.75rem;
    font-size: 2.3rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.article-hero__meta {
    font-size: 0.92rem;
    color: var(--text-muted);
}

.article-hero__image {
    width: 100%;
    max-height: 360px;
    object-fit: cover;
    border-radius: 12px;
    margin-top: 1.5rem;
}

.article-body {
    font-size: 1.08rem;
    line-height: 1.75;
    color: var(--text);
}

[data-theme="dark"] .article-body {
    color: var(--text);
}

.article-body p {
    margin: 0 0 1.1rem;
}

.article-body h2 {
    margin: 2.2rem 0 0.8rem;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.article-body h3 {
    margin: 1.8rem 0 0.6rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.article-body ul,
.article-body ol {
    margin: 0 0 1.1rem;
    padding-left: 1.5rem;
}

.article-body li {
    margin-bottom: 0.4rem;
}

.article-body blockquote {
    margin: 1.5rem 0;
    padding: 0.5rem 1.2rem;
    border-left: 4px solid var(--line);
    color: var(--text-muted);
    font-style: italic;
}

[data-theme="dark"] .article-body blockquote {
    border-color: var(--line);
    color: var(--text-muted);
}

.article-body code {
    padding: 0.15rem 0.4rem;
    font-size: 0.88em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: rgba(138, 130, 121, 0.18);
    border-radius: 4px;
}

.article-body pre {
    padding: 1rem 1.2rem;
    overflow-x: auto;
    background: var(--bg-1);
    border-radius: 8px;
    margin: 1.5rem 0;
}

.article-body pre code {
    padding: 0;
    background: none;
    color: var(--text-strong);
}

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

.article-body hr {
    border: none;
    border-top: 2px solid var(--line);
    margin: 2.5rem 0;
}

[data-theme="dark"] .article-body hr {
    border-color: var(--line);
}

/* Call-to-action linking from an article back to its puzzle. */
.article-cta {
    margin: 2.5rem 0 1rem;
    padding: 1.5rem;
    text-align: center;
    background: var(--bg-0);
    border: 1px solid var(--line);
    border-radius: 12px;
}

[data-theme="dark"] .article-cta {
    background: var(--bg-1);
    border-color: var(--line);
}

.article-cta__title {
    margin: 0 0 0.4rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.article-cta__text {
    margin: 0 0 1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

[data-theme="dark"] .article-cta__text {
    color: var(--text-muted);
}

.article-cta__btn {
    display: inline-block;
    padding: 0.7rem 1.6rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--accent-contrast);
    background: var(--accent);
    border-radius: 8px;
    transition: background 0.15s ease;
}

.article-cta__btn:hover {
    background: var(--accent-hover);
}

/* "Back to blog" link at the foot of an article. */
.article-back {
    display: inline-block;
    margin-top: 2rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.article-back:hover {
    text-decoration: underline;
}

@media (max-width: 600px) {
    .blog-header__title,
    .article-hero__title {
        font-size: 1.7rem;
    }
    .blog-wrap {
        padding: 1.5rem 1rem 3rem;
    }
}
