/*
 * Time Is Luck — Blog stylesheet
 * Lives at /blog/blog.css on production. Loaded by every blog article and the
 * blog index. Also styles content injected by /blog/blog.js (header, footer,
 * method CTA partials) so layout reserves correct space before injection
 * (no FOUC layout shift).
 *
 * Single source of truth: edit this file, upload it, every page picks it up
 * on next view. No regeneration of articles required.
 */

:root {
    --brand: #C4554F;
    --brand-light: #D4736E;
    --brand-dark: #A3413C;
    --text: #1a1a1a;
    --text-light: #555;
    --text-muted: #888;
    --bg: #fafafa;
    --card-bg: #fff;
    --border: #eee;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'DM Sans', -apple-system, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* Header. The .site-header element on the page is the slot itself; the
   <nav class="header-inner"> inside is injected from /blog/_partials/header.html */
.site-header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 65px; /* reserve space so layout doesn't shift on injection */
}
.header-inner {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.site-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--brand);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.site-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    flex-shrink: 0;
}
.header-cta {
    display: inline-block;
    padding: 0.375rem 1rem;
    background: var(--brand);
    color: white;
    border-radius: 0.375rem;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.15s;
}
.header-cta:hover { background: var(--brand-dark); }

/* Article */
.article-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

.article-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

h1 {
    font-family: 'DM Serif Display', serif;
    font-size: 2.25rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.article-body h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.5rem;
    margin: 2.5rem 0 1rem;
    color: var(--text);
    line-height: 1.3;
}
.article-body h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 2rem 0 0.75rem;
    color: var(--text);
}

.article-body p {
    margin-bottom: 1.25rem;
    color: var(--text-light);
    font-size: 1.05rem;
}

.article-body blockquote {
    border-left: 3px solid var(--brand);
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    background: #fdf6f5;
    border-radius: 0 0.5rem 0.5rem 0;
    font-style: italic;
    color: var(--text);
}
.article-body blockquote p { margin-bottom: 0.5rem; color: var(--text); }
.article-body blockquote p:last-child { margin-bottom: 0; }

.article-body ul, .article-body ol {
    margin: 1rem 0 1.25rem 1.5rem;
    color: var(--text-light);
}
.article-body li { margin-bottom: 0.5rem; font-size: 1.05rem; }

.article-body a {
    color: var(--brand);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article-body strong { color: var(--text); }

/* Hero image. height:auto lets HTML width/height attrs act as aspect-ratio
   hints (CLS fix) without forcing literal pixel sizes when scaled into a
   narrower container. */
.hero-image {
    width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}

/* Promo slots — outer wrapper only. Visual styling lives on .promo-card
   inside the injected /blog/promos/promo-{1,2,3}.html. Keeping the wrapper
   bare means :empty hides cleanly before JS injection (no flash). */
.promo-slot { margin: 2rem 0; }
.promo-slot:empty { display: none; }

/* In-body CTA card. Outer .cta-card is the slot itself; .cta-card-inner
   and children are injected from /blog/_partials/cta-card.html */
.cta-card {
    max-width: 720px;
    margin: 1rem auto 2.5rem;
    padding: 0 1.5rem;
    min-height: 240px; /* reserve space pre-injection to avoid layout shift */
}
.cta-card-inner {
    background: linear-gradient(135deg, #fdf6f5 0%, #fff 100%);
    border: 1px solid var(--border);
    border-left: 4px solid var(--brand);
    border-radius: 0.75rem;
    padding: 1.75rem 1.75rem 2rem;
}
.cta-card-eyebrow {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brand);
    margin-bottom: 0.5rem;
}
.cta-card-title {
    font-family: 'DM Serif Display', serif;
    font-size: 1.5rem;
    line-height: 1.25;
    color: var(--text);
    margin-bottom: 0.75rem;
}
.cta-card-body {
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
}
.cta-card-button-primary,
.cta-card-button-secondary {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    border-radius: 0.375rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.15s;
}
.cta-card-button-primary {
    background: var(--brand);
    color: white;
    border: 1px solid var(--brand);
    margin-right: 0.5rem;
}
.cta-card-button-primary:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}
.cta-card-button-secondary {
    background: transparent;
    color: var(--brand);
    border: 1px solid var(--brand);
}
.cta-card-button-secondary:hover {
    background: var(--brand);
    color: white;
}

/* Stack buttons vertically on narrow screens */
@media (max-width: 480px) {
    .cta-card-button-primary,
    .cta-card-button-secondary {
        display: block;
        text-align: center;
        margin: 0;
    }
    .cta-card-button-primary { margin-bottom: 0.625rem; }
}

/* In-body promo card. Junior sibling of .cta-card — same visual DNA
   (gradient bg, brand left-border, eyebrow + serif title + body + button)
   but smaller and single-button by default, so the end-of-article cta-card
   stays the visual climax. Loaded from /blog/promos/promo-{1,2,3}.html into
   .promo-slot wrappers. */
.promo-card {
    background: linear-gradient(135deg, #fdf6f5 0%, #fff 100%);
    border: 1px solid var(--border);
    border-left: 3px solid var(--brand);
    border-radius: 0.625rem;
    padding: 1.25rem 1.5rem 1.5rem;
}
.promo-card-eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brand);
    margin-bottom: 0.4rem;
}
/* Visual title only — uses a <div>, not a heading tag, so it doesn't
   pollute the article's H2/H3 outline that Google reads. */
.promo-card-title {
    font-family: 'DM Serif Display', serif;
    font-size: 1.2rem;
    line-height: 1.3;
    color: var(--text);
    margin-bottom: 0.6rem;
}
.promo-card-body {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.55;
    margin-bottom: 1rem;
}
/* Button rules are scoped under .promo-card so they outrank the
   .article-body a rule (which would otherwise force red text + underline
   on every link inside the article body — including these buttons —
   making the primary button render as red-on-red and invisible). */
.promo-card a { text-decoration: none; }
.promo-card .promo-card-button-primary,
.promo-card .promo-card-button-secondary {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.15s;
}
.promo-card .promo-card-button-primary {
    background: var(--brand);
    color: white;
    border: 1px solid var(--brand);
    margin-right: 0.4rem;
}
.promo-card .promo-card-button-primary:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
}
.promo-card .promo-card-button-secondary {
    background: transparent;
    color: var(--brand);
    border: 1px solid var(--brand);
}
.promo-card .promo-card-button-secondary:hover {
    background: var(--brand);
    color: white;
}
@media (max-width: 480px) {
    .promo-card .promo-card-button-primary,
    .promo-card .promo-card-button-secondary {
        display: block;
        text-align: center;
        margin: 0;
    }
    .promo-card .promo-card-button-primary { margin-bottom: 0.5rem; }
}

/* Author */
/* Hub CTA box — injected by related.js when a hub/method page exists for this avatar */
#hub-cta-slot { max-width: 720px; margin: 0 auto; padding: 0 1.5rem; }
.hub-cta-box {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    background: #fafafa;
}
/* Secondary “keep reading” path — visually quieter than the main cta-card above */
.hub-cta-box--reading {
    border-style: dashed;
    background: #fff;
}
.hub-cta-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}
.hub-cta-note {
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 0 0 0.75rem;
    line-height: 1.45;
}
.hub-cta-link {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--brand);
    text-decoration: none;
}
.hub-cta-link:hover { text-decoration: underline; }

/* Hub / method page footer — references, related articles, author */
.hub-page-article {
    padding-bottom: 1.5rem;
}
.hub-page-footer {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
}
.hub-footer-section {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    padding-bottom: 0.25rem;
}
.hub-footer-section h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.5rem;
    line-height: 1.3;
    color: var(--text);
    margin: 0 0 0.35rem;
}
.hub-footer-expand {
    margin: 0;
}
.hub-footer-expand summary {
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--brand);
    padding: 0.15rem 0;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.hub-footer-expand summary::before {
    content: '▸';
    font-size: 0.75rem;
    transition: transform 0.15s;
    color: var(--text-muted);
}
.hub-footer-expand[open] > summary::before { transform: rotate(90deg); }
.hub-footer-expand summary::-webkit-details-marker { display: none; }
.hub-references-list {
    margin: 0.5rem 0 0;
    padding: 0;
    list-style: none;
}
.hub-references-list li {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}
.hub-footer-expand ul {
    margin: 0.35rem 0 0.25rem 1.25rem;
    padding: 0;
}
.hub-footer-expand li {
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
    color: var(--text-light);
}
.hub-footer-expand li a {
    color: var(--text-light);
    text-decoration: none;
}
.hub-footer-expand li a:hover {
    color: var(--brand);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.hub-footer-section--author {
    padding-bottom: 0.5rem;
}
.hub-footer-section--author .author-inner {
    border-top: none;
    padding-top: 0.25rem;
}

/* Hub page hero image */
.hub-hero-image {
    width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    display: block;
}

.author-sig {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
}
.author-inner {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--brand);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
}
.author-name { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.author-bio { color: var(--text-muted); font-size: 0.85rem; }

/* Footer. Outer .site-footer is the slot itself; .footer-inner and children
   are injected from /blog/_partials/footer.html */
.site-footer {
    background: #1a1a1a;
    color: #999;
    padding: 3rem 1.5rem;
    font-size: 0.85rem;
    text-align: center;
    min-height: 180px; /* reserve space pre-injection */
}
.footer-inner {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding: 0 0.5rem;
    box-sizing: border-box;
}
.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem 1.75rem;
    margin-bottom: 1rem;
    width: 100%;
}
.footer-links a {
    color: #ccc;
    text-decoration: none;
}
.footer-links a:hover { color: white; }

/* Blog index page (the listing page at /blog/) */
.page-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

/* Index: jump nav + avatar sections */
.index-nav {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}
.index-nav-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
}
.index-nav-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.25rem;
}
.index-nav-list a {
    font-size: 0.95rem;
    color: var(--brand);
    text-decoration: none;
}
.index-nav-list a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}
.index-avatar-section {
    margin-bottom: 2.5rem;
    scroll-margin-top: 5rem;
}
.index-avatar-section h2 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.5rem;
    line-height: 1.3;
    color: var(--text);
    margin-bottom: 0.85rem;
}
.index-avatar-section .article-list {
    margin-top: 0;
}

.article-list {
    list-style: none;
}

.article-item {
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
}
.article-item:first-child { padding-top: 0; }
.article-item:last-child { border-bottom: none; }

.article-item a {
    text-decoration: none;
    display: block;
}
.article-item a:hover .article-title {
    color: var(--brand);
}

.article-title {
    font-family: 'DM Serif Display', serif;
    font-size: 1.35rem;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 0.4rem;
    transition: color 0.15s;
}

.article-desc {
    font-size: 0.95rem;
    color: var(--text-light);
    line-height: 1.6;
}

.article-eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--brand);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}

@media (max-width: 640px) {
    h1 { font-size: 1.75rem; }
    .article-body h2 { font-size: 1.25rem; }
    .article-container { padding: 1.5rem 1rem 3rem; }
    .article-title { font-size: 1.15rem; }
    .page-container { padding: 1.5rem 1rem 3rem; }
}
