/* ==========================================================================
   NODDIE NIGHT — blog.css
   The Noddie Night Journal: minimalist sleep-education blog. Loaded on
   /blog/ (index) and /blog/<slug>.html (post) pages only, AFTER site.css
   and pages.css (tokens, base type, buttons, header/footer, .prose,
   .callout, .table, page-hero/page-wrap/breadcrumb/page-title/page-lede/
   article-meta/page-body/page-layout/.toc/.page-prose/.article-figure/
   .fine-print all live there and are reused verbatim by the blog).

   Order: shared post-card component · index (intro, category chips,
   featured, category grid sections) · post (measure, blockquote, inline
   images, "In this article" tweak, FAQ, quiet CTA, keep reading,
   disclaimer) · print · reduced motion.

   Mobile-first. Nothing here may cause horizontal scroll at 360px.
   Class reference: _audit/partials/README.md
   ========================================================================== */


/* ==== 1. POST CARD (index grid, category sections, "keep reading") ======= */
/* The whole card is one <a>: a single tab stop, no nested interactive
   content (h3/p/span inside <a> is valid HTML5 flow content). */
.post-card {
    display: flex;
    flex-direction: column;
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--navy);
    min-width: 0;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.post-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-soft);
}
.post-card:focus-visible {
    outline-offset: 3px;
}
.post-card-media {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--alt-bg);
    border-bottom: 1px solid var(--border);
}
.post-card-media img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 3px 3px 0 0;
    transition: transform 0.5s ease;
}
.post-card:hover .post-card-media img { transform: scale(1.03); }
.post-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.5rem;
    padding: 1.5rem;
}
.post-card-cat {
    color: var(--amber-ink);
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.06em;
}
.post-card-title {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 1.3rem;
    line-height: 1.25;
}
.post-card-excerpt {
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.6;
    flex: 1;
}
.post-card-meta {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--muted);
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 1.75rem;
}
/* Belt-and-braces 3 / 2 / 1 columns at the site's own breakpoints, in case a
   card's content ever forces a wider minimum than 300px. */
@media (min-width: 700px) and (max-width: 999px) {
    .post-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1000px) {
    .post-grid { grid-template-columns: repeat(3, 1fr); }
}


/* ==== 2. BLOG INDEX ======================================================= */
.blog-index-body { padding: 3rem 0 4rem; }
@media (min-width: 900px) {
    .blog-index-body { padding: 4rem 0 6rem; }
}

.blog-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 0 0 3rem;
    list-style: none;
}
.blog-filters a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--navy);
    box-shadow: inset 0 0 0 1px var(--border-strong);
    transition: background 0.3s, color 0.3s, box-shadow 0.3s;
}
.blog-filters a:hover {
    background: var(--navy);
    color: var(--ivory);
    box-shadow: inset 0 0 0 1px var(--navy);
}

/* Featured: one large card, image beside copy on wide screens */
.post-featured {
    display: flex;
    flex-direction: column;
    background: var(--white);
    border: 1px solid var(--border);
    margin-bottom: 4rem;
    color: var(--navy);
}
.post-featured:hover { box-shadow: var(--shadow-soft); }
.post-featured-media {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--alt-bg);
}
.post-featured-media img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
.post-featured-body {
    padding: 1.75rem clamp(1.25rem, 4vw, 2.5rem) clamp(1.75rem, 4vw, 2.5rem);
}
.post-featured-body .post-card-cat { font-size: 0.78rem; }
.post-featured-title {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: clamp(1.6rem, 3.4vw, 2.35rem);
    line-height: 1.15;
    margin: 0.5rem 0 0.85rem;
    max-width: 24ch;
}
.post-featured-excerpt {
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.65;
    max-width: 60ch;
}
.post-featured-meta {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--muted);
}
@media (min-width: 800px) {
    .post-featured { flex-direction: row; align-items: stretch; }
    .post-featured-media { flex: 0 0 46%; aspect-ratio: auto; }
    .post-featured-body { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: clamp(2rem, 4vw, 3rem); }
}

.blog-cat-section { margin-top: 3.5rem; }
.blog-cat-section:first-of-type { margin-top: 0; }
.blog-cat-heading {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: clamp(1.4rem, 2.6vw, 1.75rem);
    line-height: 1.2;
    margin-bottom: 1.5rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--border);
}
.blog-cat-section:first-of-type .blog-cat-heading { padding-top: 0; border-top: 0; }

.blog-start-here {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}


/* ==== 3. POST ARTICLE ====================================================== */
/* Editorial measure: 68ch, generous line-height (body already sets 1.7). */
.blog-post .page-prose { max-width: 68ch; }
.blog-post .page-layout { align-items: start; }

/* "In this article" reuses .toc / .toc-title from pages.css; only the
   heading copy changes, set directly in the markup. */

/* Blockquote: not covered by .page-prose (policies have none) */
.page-prose blockquote {
    margin: 1.75rem 0;
    padding: 0.25rem 0 0.25rem 1.5rem;
    border-left: 3px solid var(--amber);
    font-family: var(--font-serif);
    font-size: 1.2rem;
    line-height: 1.5;
    color: var(--navy);
}
.page-prose blockquote p + p { margin-top: 0.75rem; }
.page-prose blockquote cite {
    display: block;
    margin-top: 0.6rem;
    font-family: var(--font-sans);
    font-style: normal;
    font-size: 0.85rem;
    color: var(--muted);
}

/* Inline body images (markdown ![alt](url)); the hero uses .article-figure
   instead and is untouched by this rule. */
.page-prose img:not(.article-figure img) {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 3px;
    margin: 0.5rem 0;
}
.page-prose figure:not(.article-figure) { margin: 1.75rem 0; }
.page-prose figure:not(.article-figure) figcaption {
    margin-top: 0.6rem;
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
}

/* FAQ */
.article-faq { margin-top: 3.5rem; }
.article-faq-title {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}
.article-faq .accordion-list { margin-top: 1.25rem; }

/* Quiet CTA card — owner's wish: no hard sell. End of article only. No
   price, no "buy now", no health claim. */
.quiet-cta {
    margin-top: 3.5rem;
    padding: clamp(1.75rem, 4vw, 2.5rem);
    background: var(--alt-bg);
    border-left: 3px solid var(--amber);
}
.quiet-cta .eyebrow { margin-bottom: 0.6rem; }
.quiet-cta-line {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 1.4rem;
    line-height: 1.3;
    margin-bottom: 0.6rem;
}
.quiet-cta-copy {
    color: var(--muted);
    max-width: 48ch;
    margin-bottom: 1rem;
}

/* Keep reading */
.keep-reading {
    margin-top: 4rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--border);
}
.keep-reading-title {
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--amber-ink);
    margin-bottom: 1.25rem;
}
.keep-reading .post-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
@media (min-width: 1000px) {
    .keep-reading .post-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Newsletter line + disclaimer under the article, above "keep reading" */
.article-newsletter-line {
    margin-top: 2.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--white);
    border: 1px solid var(--border);
}


/* ==== 4. PRINT (articles) ================================================= */
@media print {
    .blog-filters, .quiet-cta, .keep-reading, .article-newsletter-line,
    .post-featured, .post-grid { display: none !important; }
    .article-faq { break-inside: avoid; }
    .article-faq .accordion-list details { break-inside: avoid; }
    /* Print every FAQ answer open; a closed <details> hides its content natively. */
    .article-faq .accordion-list details .details-content { display: block !important; }
    .page-prose blockquote { border-left-color: #000; }
}


/* ==== 5. REDUCED MOTION ==================================================== */
@media (prefers-reduced-motion: reduce) {
    .post-card, .post-card-media img, .post-featured { transition: none !important; }
    .post-card:hover .post-card-media img { transform: none; }
}
