/* ============================================================
   CONTENT STYLES — prose pages: FAQ, reports, blog, 404, oauth,
   eurostat-check.

   Load AFTER style.css (design tokens, fonts, buttons, .site-header
   all live there). This file styles bare semantic elements only:
   prose lives in <article>, collapsible Q&A in <details>/<summary>
   — the markup needs no .content-* wrapper classes.

   Safe to load on demand inside the dashboard app (Report tab):
   the app renders no <article>, <details> or <summary> outside
   prose content, and every rule below is scoped to those elements
   or to content-specific classes, so nothing leaks into the app
   chrome.
   ============================================================ */

/* ── The prose container ─────────────────────────────────────── */

article {
    max-width: 52rem;
    margin: var(--space-6) auto;
    padding: var(--space-6);
    background: var(--clr-surface);
    border: var(--micro-1) solid var(--clr-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ── Prose typography ────────────────────────────────────────── */

article h1 {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--clr-accent);
    margin: 0 0 var(--space-4);
    line-height: 1.2;
}

article h2 {
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--clr-accent);
    margin: var(--space-8) 0 var(--space-5);
    letter-spacing: var(--tracking-tight);
}

article h3 {
    font-size: var(--text-lg);
    font-weight: 700;
    margin: var(--space-5) 0 var(--space-2);
}

article > h1:first-child,
article > h2:first-child {
    margin-top: 0;
}

article p,
article li {
    font-size: var(--text-base);
    line-height: var(--leading-loose);
    text-align: justify;
    hyphens: auto;
}

article p {
    margin: 0 0 0.5em;
}

article li {
    padding: 0.15rem 0;
}

article ol,
article ul {
    padding-left: var(--em-xl);
    margin: 0.3em 0 0.6em;
}

article a {
    color: var(--clr-accent);
}

article code {
    font-size: var(--em-sm);
}

article hr {
    border: none;
    border-top: var(--micro-1) solid var(--clr-border);
    margin: var(--space-6) 0;
}

article blockquote {
    border-left: var(--micro-4) solid var(--clr-highlight);
    background: var(--clr-highlight-light);
    padding: var(--space-3) var(--space-4);
    margin: var(--space-3) 0 var(--space-4);
}

article blockquote p:last-child {
    margin-bottom: 0;
}

article table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-3) 0 var(--space-5);
    font-size: var(--text-sm);
}

article th,
article td {
    padding: var(--space-1) var(--space-2);
    border-bottom: var(--micro-1) solid var(--clr-border);
    text-align: left;
}

article thead th {
    border-bottom: var(--micro-2) solid var(--clr-accent);
    color: var(--clr-accent);
}

article tbody tr:nth-child(even) {
    background: var(--clr-surface-alt);
}

article tbody tr:hover {
    background: var(--clr-accent-light);
}

/* ── Trailing note of a prose document (reports, FAQ, blog) ──── */

article > footer {
    border-top: var(--micro-1) solid var(--clr-border);
    margin-top: var(--space-6);
    padding-top: var(--space-3);
    color: var(--clr-text-muted);
    font-size: var(--text-sm);
}

/* ── Post byline (blog articles) ─────────────────────────────── */

.post-meta {
    color: var(--clr-text-muted);
    font-size: var(--text-sm);
}

/* ── Accordion (FAQ) ─────────────────────────────────────────── */

article details {
    border: var(--micro-1) solid var(--clr-border);
    border-radius: 0;
    overflow: hidden;
}

article details:first-of-type,
article .faq-section + details {
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}

article details + details {
    border-top: none;
}

article details:last-of-type,
article details:has(+ .faq-section),
article details:has(+ .faq-back),
article details:has(+ footer) {
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    margin-bottom: var(--space-1);
}

article summary {
    cursor: pointer;
    font-weight: 600;
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-base);
    list-style: none;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    transition:
        background var(--transition),
        color var(--transition);
}

article summary::before {
    content: "›";
    display: inline-block;
    font-size: var(--em-lg);
    font-weight: 700;
    color: var(--clr-text-muted);
    transition:
        transform 0.2s ease,
        color 0.2s ease;
    flex-shrink: 0;
    width: var(--em-md);
    text-align: center;
}

article summary::-webkit-details-marker {
    display: none;
}

article details[open] summary::before {
    transform: rotate(90deg);
    color: var(--clr-accent);
}

article summary:hover {
    background: var(--clr-bg);
    color: var(--clr-accent);
}

article details[open] summary {
    background: var(--clr-accent-light);
    border-bottom: var(--micro-1) solid var(--clr-border);
    color: var(--clr-accent);
}

article details[open] > *:not(summary) {
    padding: var(--space-2) var(--space-4) var(--space-2) 2.2rem;
}

article details[open] > *:first-of-type:not(summary) {
    padding-top: var(--space-3);
}

article details[open] > *:last-child {
    padding-bottom: var(--space-3);
}

/* ── Content index (report catalog, blog index/archives/tags) ── */

/* The list is not a card of its own: it always lives inside <article>,
   which already provides the surface — no frame within a frame. */
.content-list {
    list-style: none;
    padding: 0;
}

.content-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-2) 0;
    /* Undo the prose defaults (article li): catalog lines are short labels,
       not paragraphs — justifying and hyphenating them rips them apart. */
    text-align: left;
    hyphens: manual;
}

/* Hairline between top-level entries only; nested levels are told apart by
   indentation, not by more rules. */
.content-list > li + li {
    border-top: var(--micro-1) solid var(--clr-border);
}

.content-list li > a {
    flex: 1 1 auto;
}

/* Nested CN hierarchy (report catalog): a level's children are a plain
   indented list on their own row, never squeezed into the parent's row. */
.content-list li > ul {
    flex: 1 0 100%;
    list-style: none;
    padding-left: var(--space-5);
    margin: 0;
}

.content-list a {
    color: var(--clr-accent);
    font-weight: 600;
    text-decoration: none;
}

.content-list a:hover {
    text-decoration: underline;
}

.content-list time,
.content-list .meta {
    color: var(--clr-text-muted);
    font-size: var(--text-sm);
    white-space: nowrap;
}

/* Hierarchy level without its own report: a plain, muted heading that
   chapeaus its sub-code entries (report catalog). */
.report-placeholder > span {
    font-weight: 600;
    color: var(--clr-text-muted);
}

/* "Alternative date ranges" sublist label (report catalog). */
.report-alt-ranges {
    color: var(--clr-text-muted);
    font-size: var(--text-sm);
}

/* Language tag of a catalog entry. */
.report-lang {
    color: var(--clr-text-muted);
    font-size: var(--text-xs, 0.75rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── FAQ-only functionality ──────────────────────────────────── */

.faq-section {
    margin-top: var(--space-5);
    margin-bottom: var(--space-2);
    font-size: var(--text-base);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    color: var(--clr-accent);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.faq-section::after {
    content: "";
    flex: 1;
    height: var(--micro-2);
    background: linear-gradient(
        to right,
        rgba(212, 149, 46, 0.45),
        transparent
    );
}

.faq-back {
    margin-top: var(--space-5);
    font-size: var(--text-base);
    font-weight: 600;
}

.faq-back a {
    padding: var(--space-2) var(--space-4);
}

/* ── Report CTA (funnel entry point above the report body) ───── */

.report-cta {
    max-width: 46rem;
    margin: var(--space-6) auto 0;
    text-align: center;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 1024px) {
    article {
        margin: var(--space-5) var(--space-4);
        padding: var(--space-5);
    }
}

@media (max-width: 768px) {
    article {
        margin: var(--space-3);
        padding: var(--space-4);
        max-width: 100%;
    }
    article h2 {
        font-size: var(--text-md);
    }
    article details[open] > *:not(summary) {
        padding-left: var(--space-4);
    }
}

@media (max-width: 480px) {
    article {
        margin: var(--space-2);
        padding: var(--space-3);
    }
}

/* ── Print (also what the PDF report render uses) ────────────── */

@media print {
    @page {
        margin: 2cm; /* print-only metric: physical page margin */
        @bottom-center {
            content: counter(page) " / " counter(pages);
            font-family: var(--font-stack);
            font-size: var(--text-sm);
            color: var(--clr-text-muted);
        }
    }
    html {
        background: var(--clr-surface);
    }
    /* Letterhead: keep the brand block, drop the interactive chrome. */
    .site-header {
        position: static;
        box-shadow: none;
        padding: 0;
    }
    .header-help,
    .skip-link,
    .report-cta {
        display: none;
    }
    article {
        max-width: none;
        margin: 0;
        padding: 0;
        border: none;
        box-shadow: none;
    }
    article a {
        color: var(--clr-text);
        text-decoration: none;
    }
    article h1,
    article h2,
    article h3 {
        break-after: avoid;
    }
    article table,
    article blockquote {
        break-inside: avoid;
    }
}
