﻿/* page.css – Long-form article typography
   Scope: .article (and its BEM children)
   Depends on layout.css variables: colors, spacing, header height, etc. */

/* 1) Article container & tokens */
.article {
    /* Reading measure & rhythm */
    --article-max-width: 72ch; /* ~65–75 characters for comfortable measure */
    --article-leading: 1.75;
    --article-paragraph-spacing: var(--spacing-lg);
    --article-muted: #767676; /* matches footer copy color */

    color: var(--color-text);
    line-height: var(--article-leading);
    max-width: var(--article-max-width);
    margin-inline: auto;
}

.article ul {
    list-style: disc;
    margin-left: 1.5rem;
}

.article ol {
    list-style: decimal;
    margin-left: 1.5rem;
}

    .article ol li::marker {
        font-family: Georgia, 'Times New Roman', serif; /* complimentary serif */
        font-weight: 600; /* slightly bolder */
        font-size: 1.05em; /* just a touch bigger */
        color: #333; /* darker than body text for contrast */
    }

.article__header p {
    font-size: 0.8em; /* slightly smaller than body */
    color: #999; /* softer, subtle contrast */
    font-style: italic; /* gives it a byline "voice" */
    margin-top: 0.2rem;
    margin-bottom: 1rem;
}
/* Make the date stand out a bit more */
.article__header time {
    color: #666; /* darker gray than #999 */
    font-style: italic; /* keep same style for consistency */
}
.article__header h1 {
    font-family: 'system-ui', Georgia, serif;
    font-weight: 700; /* use the loaded weight */
    font-size: 2rem; /* ~32px on desktop */
    line-height: 1.2;
    margin-bottom: 0.5em;
    color: #222; /* slightly darker than body for emphasis */
}

@media (min-width: 768px) {
    .article__header h1 {
        font-size: 2.5rem; /* scale up on desktop (~40px) */
    }
}
/* Optional: opt-in serif body for long-form by adding .article--serif */
.article--serif {
    font-family: var(--font-family-serif);
}



/* 2) Sections */

.article__figure {
    margin: var(--spacing-lg) 0;
}

    .article__figure img {
        display: block;
        max-width: 100%;
        height: auto;
        border-radius: 8px;
    }

.article__header,
.article__footer {
    max-width: var(--article-max-width);
    margin-inline: auto;
}

.article__header {
    margin-block: var(--spacing-lg) var(--spacing-md);
}

.article__footer {
    margin-block: var(--spacing-xl) 0;
    font-size: 0.95rem;
    color: var(--article-muted);
}

/* 3) Baseline text defaults */
.article__content {
    font-size: 1rem; /* inherits base 18px from layout.css via html */
    text-wrap: pretty; /* nicer breaks for body text (progressive enhancement) */
    -webkit-hyphens: auto; /* soft hyphenation where supported */
    -ms-hyphens: auto;
    hyphens: auto;
    margin-block-start: var(--spacing-lg);
}

    /* Vertical rhythm: give every sibling some top space */
    .article__content > * + * {
        margin-block-start: var(--article-paragraph-spacing);
    }

    /* Paragraphs */
    .article__content p {
        margin: 0; /* spacing handled by the rhythm rule above */
    }

    /* Lead/kicker paragraph (optional) */
    .article__content .lead {
        font-size: clamp(1.0625rem, 0.8vw + 1rem, 1.25rem);
        line-height: 1.8;
        color: var(--color-heading);
    }

/* 4) Headings (responsive scale, balanced wrapping) */
.article h1, .article h2, .article h3, .article h4, .article h5, .article h6 {
    color: var(--color-heading);
    line-height: 1.25;
    text-wrap: balance; /* nicer multi-line headings where supported */
    margin: 0; /* rhythm handled separately */
    scroll-margin-top: calc(var(--header-height) + var(--spacing-md)); /* anchor offset under fixed header */
}

/* Top/bottom spacing tuned for rhythm */
.article h1 {
    margin-block: var(--spacing-lg) var(--spacing-md);
}

.article h2, .article h3, .article h4 {
    margin-block: var(--spacing-lg) var(--spacing-sm);
}

/* Fluid sizes (mobile → desktop) */
/* h1 now uses old h2 size */
.article h1 {
    font-size: clamp(1.45rem, 2.2vw + 1rem, 2rem);
}
/* h2 now uses old h3 size */
.article h2 {
    font-size: clamp(1.25rem, 1.4vw + 1rem, 1.5rem);
}
/* h3 steps down, close to old h4 size */
.article h3 {
    font-size: 1.125rem;
}
/* h4 and below shift accordingly */
.article h4 {
    font-size: 1rem;
    font-weight: 600;
}

.article h5 {
    font-size: 0.95rem;
    font-weight: 600;
}

.article h6 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--article-muted);
}

/* 5) Links & emphasis */
.article a {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 0.15em;
    text-decoration-thickness: from-font;
}

    .article a:hover,
    .article a:focus {
        text-decoration: underline;
        filter: brightness(0.9);
    }

.article strong {
    color: var(--color-heading);
    font-weight: 700;
}

.article em {
    font-style: italic;
}

/* 6) Lists */
.article ul,
.article ol {
    padding-left: 1.4rem;
}

.article li + li {
    margin-top: 0.4em;
}

.article li > ul,
.article li > ol {
    margin-top: 0.4em;
}

/* 7) Blockquotes */
.article blockquote {
    margin: 0; /* rhythm handled by sibling spacing */
    padding: var(--spacing-md) var(--spacing-lg);
    border-left: 4px solid var(--color-primary);
    background-color: var(--color-background-alt);
    color: var(--color-heading);
    font-style: italic;
}

    .article blockquote footer,
    .article cite {
        display: block;
        margin-top: var(--spacing-sm);
        font-size: 0.95rem;
        color: var(--article-muted);
        font-style: normal;
    }

/* 8) Code */
.article pre {
    padding: var(--spacing-md);
    border: 1px solid var(--color-border);
    background: var(--color-background-alt);
    overflow-x: auto;
    font-size: 0.95rem;
    border-radius: 6px;
    margin: 0; /* rhythm handled globally */
}

.article code {
    padding: 0.1em 0.35em;
    border-radius: 4px;
    background: var(--color-background-alt);
    border: 1px solid var(--color-border);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.95em; /* slightly smaller inline code */
}

/* 9) Images, figures, tables */
.article img,
.article video,
.article svg,
.article canvas {
    max-width: 100%;
    height: auto;
}

.article figure {
    margin: 0; /* rhythm handled globally */
}

.article figcaption {
    margin-top: var(--spacing-sm);
    font-size: 0.95rem;
    color: var(--article-muted);
    text-align: center;
}

/* Full-bleed (opt-in) for hero media inside .main container */
.article .full-bleed {
    width: 100vw;
    margin-left: 50%;
    transform: translateX(-50%);
}

/* Tables */
.article table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--color-border);
    font-size: 0.95rem;
}

.article th,
.article td {
    padding: 0.6rem 0.8rem;
    border-top: 1px solid var(--color-border);
    vertical-align: top;
}

.article thead th {
    text-align: left;
    background: var(--color-background-alt);
    font-weight: 600;
}

/* 10) Horizontal rule */
.article hr {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--color-border), transparent);
    margin: 0; /* rhythm handled globally */
}

/* 11) Utilities often produced by Markdown converters */
.article .footnotes {
    font-size: 0.95rem;
    color: var(--article-muted);
    border-top: 1px solid var(--color-border);
    padding-top: var(--spacing-md);
}

.article sup {
    line-height: 0;
}

/* 12) Desktop refinements */
@media (min-width: 992px) {
    .article {
        /* Tighter leading for larger viewports */
        --article-leading: 1.7;
    }

    .article__footer {
        font-size: 0.9rem;
    }
}
