/* The Deltan — articles: stories, columns and Featured Voices (docs/REDESIGN.md, "Articles").
   One reading column of 720px inside the page container; the "More from" band underneath uses
   the full container. Story cards, the band, the Spotlight promo, the newsletter box and the
   advertising slot come from cards.css; buttons and fields from main.css. */

.article-page { --article-column: 720px; padding-top: 40px; }
.article,
.article-page__newsletter,
.article-comments { max-width: var(--article-column); margin-left: auto; margin-right: auto; }

/* ---------- Header: kicker, headline, standfirst ---------- */
.article__kicker { margin: 0 0 10px; font: 500 14px/1.5 var(--font-ui); }
.article__section { color: var(--deltan-red-ink); }
.article__section:hover, .article__section:focus-visible { color: var(--deltan-red-press); }
.article__subsection { font-weight: 400; color: var(--ink-muted); }
.article__subsection a { color: inherit; }
.article__subsection a:hover, .article__subsection a:focus-visible { color: var(--deltan-red-ink); }
.article__title {
    margin: 0; font: 600 46px/1.1 var(--font-heading); color: var(--ink);
    overflow-wrap: break-word; text-wrap: balance;
}
.article__standfirst { margin: 16px 0 0; font: 400 21px/1.45 var(--font-reading); color: var(--ink-soft); }
.article__standfirst a { text-decoration: underline; text-underline-offset: .15em; }

/* ---------- Meta row: byline and date left, share buttons right, between hairlines ---------- */
.article__meta {
    margin-top: 20px; padding: 12px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
    font: 400 13px/1.5 var(--font-ui); color: var(--ink-muted);
}
.article__byline { display: flex; align-items: center; gap: 12px; min-width: 0; }
.article__avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.article__meta-text { margin: 0; }

/* Share links: the five networks the site already offered, as quiet outlined buttons. */
.article-share { display: flex; align-items: center; gap: 10px; }
.article-share__list { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.article-share__btn {
    display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
    border: 1px solid #b5b5b5; border-radius: 50%; background: #fff; color: var(--ink);
}
.article-share__btn:hover, .article-share__btn:focus-visible { background: var(--ink); border-color: var(--ink); color: #fff; }
.article-share__icon { width: 18px; height: 18px; }

/* ---------- Lead image ---------- */
.article__figure { margin: 24px 0 0; }
.article__image { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: #f1f1f1; }
/* Editors can ask for the crop to keep the top of the picture (deltan_single_image_top()). */
.article--image-top .article__image { object-position: top center; }
.article__caption { margin-top: 8px; font: 400 12px/1.5 var(--font-ui); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); }

/* ---------- Article text ---------- */
.article__body {
    display: flow-root; margin-top: 28px;
    font: 400 19px/1.65 var(--font-reading); color: #1a1a1a; overflow-wrap: break-word;
}
.article__body p { margin: 0 0 20px; }
.article__body > :last-child,
.article__body > .initial-letter > :last-child { margin-bottom: 0; }
.article__body b, .article__body strong { font-weight: 600; }
/* Links in running text are underlined: colour alone does not mark them for everyone. */
.article__body a { color: var(--deltan-red-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .15em; }
.article__body a:hover, .article__body a:focus-visible { color: var(--deltan-red-press); }
.article__body h1, .article__body h2, .article__body h3,
.article__body h4, .article__body h5, .article__body h6 {
    margin: 36px 0 12px; font-family: var(--font-heading); font-weight: 600; line-height: 1.2; color: var(--ink);
}
.article__body h1, .article__body h2 { font-size: 28px; }
.article__body h3 { font-size: 23px; }
.article__body h4 { font-size: 20px; }
.article__body h5, .article__body h6 { font-size: 18px; }
.article__body ul, .article__body ol { margin: 0 0 20px; padding: 0 0 0 1.3em; }
.article__body li + li { margin-top: 6px; }
/* Drop cap: the Initial Letter plugin wraps the text in .initial-letter and prints its own grey
   60px rule in the page head; this one is more specific and replaces it. */
.article__body .initial-letter p:first-of-type::first-letter {
    float: left; margin: 6px 10px 0 0; padding: 0;
    font: 700 64px/.8 var(--font-heading); color: var(--deltan-red-ink);
}
/* Pull quote, as on the mock-up: ink rule above, hairline below, heading face. */
.article__body blockquote {
    margin: 28px 0; padding: 18px 0; border-top: 2px solid var(--rule-strong); border-bottom: 1px solid var(--rule);
    font: 600 28px/1.25 var(--font-heading); color: var(--ink);
}
.article__body blockquote p { margin: 0 0 .5em; }
.article__body blockquote > :last-child { margin-bottom: 0; }
.article__body blockquote cite { display: block; margin-top: 10px; font: 400 13px/1.5 var(--font-ui); color: var(--ink-muted); }
.article__body img { max-width: 100%; height: auto; }
.article__body figure, .article__body .wp-caption { max-width: 100%; margin: 28px 0; }
.article__body figcaption, .article__body .wp-caption-text { margin: 8px 0 0; font: 400 13px/1.5 var(--font-ui); color: var(--ink-muted); }
.article__body .aligncenter { display: block; margin-left: auto; margin-right: auto; clear: both; }
.article__body .wp-caption.aligncenter img { margin-left: auto; margin-right: auto; }
.article__body .alignleft { float: left; max-width: 50%; margin: 6px 24px 12px 0; }
.article__body .alignright { float: right; max-width: 50%; margin: 6px 0 12px 24px; }
.article__body iframe, .article__body video, .article__body embed { max-width: 100%; }
.article__body hr { margin: 32px 0; border: 0; border-top: 1px solid var(--rule); }
.article__body table { width: 100%; margin: 0 0 20px; border-collapse: collapse; font: 400 15px/1.5 var(--font-ui); }
.article__body td, .article__body th { padding: 10px 12px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.article__body th { font-weight: 700; border-bottom-color: var(--rule-strong); }
.article__body .ad-slot { clear: both; }
.article__pages { margin-top: 24px; font: 500 14px/1.5 var(--font-ui); }

/* ---------- "More on" row ---------- */
.article-topics {
    margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--rule);
    display: flex; align-items: baseline; gap: 10px; font: 400 13px/1.5 var(--font-ui);
}
.article-topics__label { flex: none; margin: 0; color: var(--ink-muted); }
.article-topics__list { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0; }
.article-topics__link { display: block; padding: 6px 12px; border: 1px solid #b5b5b5; color: var(--ink); }
.article-topics__link:hover, .article-topics__link:focus-visible { border-color: var(--ink); color: var(--deltan-red-ink); }

/* ---------- Newsletter box and "More from" band ---------- */
.article-page__newsletter { margin-top: 40px; }
/* The mock-up's box is roomier than the rail version: 24px 28px, 22px title. */
.article-page__newsletter .newsletter-block--box { padding: 24px 28px; gap: 16px; }
.article-page__newsletter .newsletter-block__title { font-size: 22px; }
.article-more { --story-title-size: 18px; margin-top: 48px; }

/* ---------- Comments ---------- */
.article-comments { margin-top: 48px; padding-top: 10px; border-top: 2px solid var(--rule-strong); }
.article-comments__title { margin: 0; font: 700 22px/1.2 var(--font-heading); color: var(--ink); }
.article-comments__count { margin-left: 6px; font: 400 14px/1 var(--font-ui); color: var(--ink-muted); }
.article-comments__list, .article-comments__list ol { margin: 0; padding: 0; list-style: none; }
.article-comments__list { margin-top: 8px; overflow-wrap: break-word; }
.article-comments__list .children { margin-left: 22px; padding-left: 16px; border-left: 1px solid var(--rule); }
.article-comments__list .comment-body { padding: 16px 0; border-bottom: 1px solid var(--rule); }
.article-comments__list .comment-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font: 400 13px/1.5 var(--font-ui); color: var(--ink-muted); }
.article-comments__list .comment-author { display: flex; align-items: center; gap: 10px; }
.article-comments__list .comment-author .fn { font: 500 15px/1.4 var(--font-ui); color: var(--ink); }
.article-comments__list .comment-author .fn a { color: inherit; }
.article-comments__list .says { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
.article-comments__list .avatar { border-radius: 50%; }
.article-comments__list .comment-metadata a { color: inherit; }
.article-comments__list .comment-metadata a:hover, .article-comments__list .comment-metadata a:focus-visible { color: var(--deltan-red-ink); }
.article-comments__list .edit-link { margin-left: 8px; }
.article-comments__list .comment-awaiting-moderation { flex-basis: 100%; }
.article-comments__list .comment-content { margin-top: 8px; font: 400 17px/1.6 var(--font-reading); color: #1a1a1a; }
.article-comments__list .comment-content p { margin: 0 0 12px; }
.article-comments__list .comment-content > :last-child { margin-bottom: 0; }
.article-comments__list .comment-content a { text-decoration: underline; text-underline-offset: .15em; }
.article-comments__list .reply { margin-top: 4px; font: 500 13px/1.5 var(--font-ui); }
.article-comments__list .comment-reply-link { display: inline-flex; align-items: center; min-height: 32px; }
.article-comments__closed { margin: 16px 0 0; color: var(--ink-muted); }
.article-comments .comments-pagination, .article-comments .comment-navigation { padding: 16px 0 0; font: 500 14px/1.5 var(--font-ui); }
.article-comments .comments-pagination .nav-links { display: flex; flex-wrap: wrap; gap: 8px 16px; }

.article-comments__respond { margin-top: 24px; }
.article-comments__list .article-comments__respond { margin: 0; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.article-comments__respond .comment-reply-title { margin: 0; font: 600 20px/1.25 var(--font-heading); color: var(--ink); }
.article-comments__respond .comment-reply-title small { margin-left: 12px; font: 500 13px/1.5 var(--font-ui); white-space: nowrap; }
.article-comments__form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 8px; }
.article-comments__form > * { grid-column: 1 / -1; margin: 0; }
.article-comments__form > .article-comments__field { grid-column: auto; }
.article-comments__form > .article-comments__field--comment { grid-column: 1 / -1; }
.article-comments__form .comment-notes, .article-comments__form .logged-in-as { font-size: 13px; color: var(--ink-muted); }
.article-comments__field label { display: block; margin-bottom: 6px; font: 500 14px/1.4 var(--font-ui); color: var(--ink); }
.article-comments__form .required { color: var(--deltan-red-ink); }
.article-comments__field .field { display: block; width: 100%; }
.article-comments__field textarea.field { min-height: 150px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
.article-comments__form .comment-form-cookies-consent { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--ink-soft); }
.article-comments__form .comment-form-cookies-consent input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--ink); }

/* ---------- Tablet (<= 1024px) ---------- */
@media (max-width: 1024px) {
    .article__title { font-size: 40px; }
}

/* ---------- Phone (<= 767px) ---------- */
@media (max-width: 767px) {
    .article-page { padding-top: 24px; }
    .article__kicker { margin-bottom: 8px; }
    /* 44px touch area for the section links; padding on an inline link moves no text. */
    .article__kicker a { padding-block: 14px 13px; }
    .article__title { font-size: 30px; line-height: 1.15; }
    .article__standfirst { margin-top: 12px; font-size: 18px; line-height: 1.5; }
    .article__meta { margin-top: 16px; padding: 10px 0; }
    /* Share buttons become full 44px tap targets on their own line. */
    .article-share { flex: 1 1 100%; }
    .article-share__list { gap: 8px; }
    .article-share__btn { width: 44px; height: 44px; }
    .article__figure { margin-top: 20px; }
    .article__body { margin-top: 24px; font-size: 18px; }
    .article__body .initial-letter p:first-of-type::first-letter { font-size: 58px; }
    .article__body blockquote { margin: 24px 0; padding: 16px 0; font-size: 23px; }
    .article__body h1, .article__body h2 { font-size: 24px; }
    .article__body h3 { font-size: 21px; }
    .article__body h4 { font-size: 19px; }
    .article__body table { display: block; overflow-x: auto; } /* a wide table scrolls; the page does not */
    .article-topics { margin-top: 28px; flex-direction: column; gap: 8px; }
    .article-topics__list { gap: 8px; }
    .article-topics__link { display: flex; align-items: center; min-height: 44px; padding: 0 14px; }
    .article-page__newsletter { margin-top: 32px; }
    .article-page__newsletter .newsletter-block--box { padding: 20px 18px; }
    .article-page__newsletter .newsletter-block__cta { width: 100%; min-height: 48px; }
    .article-more, .article-comments { margin-top: 36px; }
    /* Two across from here down: an odd last item takes the full row instead of leaving a gap. */
    .article-more__grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
    .article-comments__form { grid-template-columns: minmax(0, 1fr); }
    .article-comments__list .children { margin-left: 8px; padding-left: 12px; }
    .article-comments__list .comment-reply-link { min-height: 44px; }
}
@media (max-width: 544px) {
    /* Pictures set into the text take the full column; "More from" stays two-up so the band does
       not turn into four full-width pictures. */
    .article__body .alignleft, .article__body .alignright { float: none; max-width: 100%; margin: 24px auto; }
    .article-more { --story-title-size: 16px; }
    .article-more__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 16px; }
}

/* ---------- Motion ---------- */
/* Numbers refer to the motion plan in docs/REDESIGN.md. Nothing here runs under "reduce motion". */
@media (prefers-reduced-motion: no-preference) {
    /* 3: share buttons and topic links answer like the other buttons — colour, and a 1px press */
    .article-share__btn, .article-topics__link {
        transition: background-color var(--motion-fast) linear, border-color var(--motion-fast) linear, color var(--motion-fast) linear;
    }
    .article-share__btn:active, .article-topics__link:active { transform: translateY(1px); }

    /* 8: reading progress — a 3px red bar under the sticky header that fills as the article is
       read: empty while the top of the article is at the top of the window, full when its last
       line reaches the bottom. Driven by scroll position in CSS alone; browsers without
       scroll-driven animations simply show no bar (no script fallback, on purpose). */
    @supports (animation-timeline: scroll()) and (timeline-scope: --article-read) {
        body.deltan-article { timeline-scope: --article-read; }
        .article { view-timeline: --article-read block; }
        .deltan-article .site-header::after {
            content: ""; position: absolute; top: 100%; left: 0; width: 100%; height: 3px;
            background: var(--deltan-red-ink); transform: scaleX(0); transform-origin: left center;
            pointer-events: none;
            animation: article-read linear both;
            animation-timeline: --article-read;
            animation-range: contain 0% contain 100%;
        }
    }
}
@keyframes article-read { from { transform: scaleX(0); } to { transform: scaleX(1); } }
