/*
 * Sunshine Files articles: one design for every article.
 *
 * Loaded by app/templates/sunshine_files/_article_layout.html. An article's
 * markdown should use the components below instead of carrying its own
 * <style> block; a piece that needs a one-off chart or table can still add
 * a small block for that piece only.
 *
 * Type: DM Serif Display for headlines (the same face as the homepage),
 * Source Serif 4 for reading text, Source Sans 3 for labels and figures.
 * Text colours are all at least 4.5:1 on their background.
 *
 * Components
 *   .article-stat-row > .article-stat > .article-stat-val + .article-stat-label
 *                        figures on ruled lines (add .article-stat--wide to span)
 *   .article-pullquote > blockquote + cite     a quote pulled out large
 *   .article-quote > p + .article-quote-source a quoted passage from a document
 *   .article-chart, -title, -sub               a chart panel
 *   .article-source                            a source line under a chart or table
 *   .article-sources                           the source list at the end
 *   .article-caveat                            a note the reader must not miss
 *   .legal-accordion ...                       fold-away legal detail
 *   .def-wrap > .def-term + .def-box           click-to-open definition
 */

.cf-page {
    --art-ink: #1c1916;
    --art-soft: #5f5a55;        /* 6.6:1 on white, 5.8:1 on the cream */
    --art-rule: #d9d0c2;
    --art-green: #1a5c54;
    --art-gold: #c9902a;
    --art-paper: #f5f0e8;
    --art-serif: 'Source Serif 4', Georgia, serif;
    --art-sans: 'Source Sans 3', -apple-system, 'Segoe UI', sans-serif;
    --art-display: 'DM Serif Display', Georgia, serif;
    background: var(--art-paper);
    min-height: 100vh;
    padding: 0;
}
.cf-container { max-width: 740px; margin: 0 auto; }

/* ── Top of the article (white) ── */
.cf-header { background: #fff; padding: calc(var(--sd-header-h, 64px) + 30px) 24px 40px; border-bottom: 1px solid #e0d8cc; }
.cf-back { display: inline-block; margin: 0 0 18px; font-family: var(--art-sans); font-size: 12.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--art-green); text-decoration: none; }
.cf-back:hover { text-decoration: underline; }
.cf-title { font-family: var(--art-display); font-weight: 400; font-size: clamp(31px, 4.6vw, 50px); line-height: 1.08; letter-spacing: -.01em; color: var(--art-ink); margin: 0 0 18px; }
.cf-tagline { font-family: var(--art-serif); font-size: 20px; line-height: 1.5; color: #24423d; border-left: 3px solid var(--art-gold); padding-left: 16px; margin: 0 0 20px; }
.cf-byline { font-family: var(--art-sans); font-size: 14px; color: var(--art-soft); margin: 0; }
.cf-byline strong { color: var(--art-ink); font-weight: 600; }
.cf-preview-badge { display: inline-flex; align-items: center; margin: 14px 0 0; padding: 4px 9px; border-radius: 3px; background: #f2e6c8; color: #765316; font-family: var(--art-sans); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

/* The photo runs wider than the text column where there is room. */
.cf-hero { width: min(960px, calc(100vw - 48px)); margin: 32px 0 0 50%; transform: translateX(-50%); }
.cf-hero img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; }
.cf-hero-caption { margin: 9px 0 0; font-family: var(--art-sans); font-size: 13px; line-height: 1.5; color: var(--art-soft); }

/* ── Reading text (cream) ── */
.cf-content-area { padding: 2.75rem 24px 72px; }
.cf-body { font-family: var(--art-serif); font-weight: 400; font-size: 18px; line-height: 1.75; color: var(--art-ink); }
.cf-body a { color: var(--art-green); text-decoration: underline; text-underline-offset: 2px; }
.cf-body a:hover { color: #0d3d38; }
.cf-body p { margin: 0 0 1.4rem; }
.cf-body h2 { font-family: var(--art-display); font-weight: 400; font-size: 29px; line-height: 1.2; color: var(--art-ink); margin: 2.9rem 0 .9rem; }
.cf-body h3 { font-family: var(--art-sans); font-weight: 700; font-size: 19px; line-height: 1.3; color: var(--art-ink); margin: 2rem 0 .5rem; }
.cf-body ul, .cf-body ol { padding-left: 1.35rem; margin: 0 0 1.4rem; }
.cf-body li { margin-bottom: .45rem; }
.cf-body hr { border: 0; border-top: 1px solid var(--art-rule); margin: 2.75rem 0; }
.cf-body blockquote { border-left: 3px solid var(--art-gold); padding-left: 16px; margin: 20px 0; font-style: italic; color: #3f3a36; }
.cf-body code { font-size: .88em; background: #ebe4d7; padding: 1px 5px; border-radius: 3px; }

/* ── Tables ── */
.cf-body table { width: 100%; border-collapse: collapse; font-family: var(--art-sans); font-size: 14.5px; line-height: 1.45; margin: 16px 0 24px; font-variant-numeric: tabular-nums; }
.cf-body thead th { background: #07312f; color: #fff; font-weight: 600; text-align: left; padding: 10px 14px; }
.cf-body tbody tr:nth-child(odd) { background: #fff; }
.cf-body tbody tr:nth-child(even) { background: #fbf9f5; }
.cf-body tbody td { padding: 10px 14px; border: 1px solid #e0d8cc; vertical-align: top; }

/* ── Figures on ruled lines ── */
.article-stat-row { display: flex; flex-wrap: wrap; gap: 24px 28px; margin: 2.4rem 0; }
.article-stat { flex: 1 1 150px; border-top: 2px solid var(--art-ink); padding-top: 12px; min-width: 0; }
.article-stat--wide { flex-basis: 100%; }
.article-stat-val { font-family: var(--art-sans); font-size: 31px; font-weight: 700; line-height: 1.1; color: var(--art-ink); font-variant-numeric: tabular-nums; }
.article-stat-val.red { color: #8a1c1c; }
.article-stat-label { font-family: var(--art-sans); font-size: 14px; line-height: 1.45; color: var(--art-soft); margin-top: 6px; }

/* ── Quotes ── */
.article-pullquote { margin: 2.6rem 0; padding: .2rem 0 .2rem 1.5rem; border-left: 3px solid var(--art-gold); font-family: var(--art-display); font-size: 27px; line-height: 1.3; color: var(--art-ink); }
.article-pullquote blockquote { margin: 0 0 .7rem; padding: 0; border: 0; font-style: normal; color: inherit; }
.article-pullquote cite { display: block; font-family: var(--art-sans); font-size: 12.5px; font-weight: 600; font-style: normal; letter-spacing: .06em; text-transform: uppercase; color: var(--art-soft); }
.article-quote { margin: 2rem 0; padding: .1rem 0 .1rem 1.25rem; border-left: 3px solid var(--art-rule); }
.article-quote p { font-style: italic; color: #3f3a36; margin: 0 0 .5rem; }
.article-quote-source { font-family: var(--art-sans); font-size: 13.5px; color: var(--art-soft); }

/* ── Chart panel and source lines ── */
.article-chart { margin: 2.5rem 0; background: #fff; border: 1px solid #e0d8cc; border-radius: 6px; padding: 1.5rem; }
.article-chart-title { font-family: var(--art-sans); font-size: 13px; font-weight: 700; color: var(--art-green); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.article-chart-sub { font-family: var(--art-sans); font-size: 13px; color: var(--art-soft); margin-bottom: 1.25rem; }
.article-source { font-family: var(--art-sans); font-size: 13px; line-height: 1.5; color: var(--art-soft); margin-top: 10px; }
.article-sources { font-family: var(--art-sans); font-size: 14px; line-height: 1.75; color: var(--art-soft); margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--art-rule); }
.article-sources strong:first-child { display: block; margin-bottom: .5rem; font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--art-ink); }
.article-caveat { margin: 2rem 0; padding: 14px 18px; background: #fbf4e2; border-left: 3px solid var(--art-gold); font-family: var(--art-sans); font-size: 15px; line-height: 1.6; color: #3f3a36; }

/* ── Fold-away legal detail ── */
.legal-accordion { border: 1px solid #e0d8cc; border-radius: 6px; overflow: hidden; margin: 2.5rem 0; background: #fff; }
.legal-header { padding: 1.15rem 1.5rem; cursor: pointer; display: flex; justify-content: space-between; align-items: center; user-select: none; transition: background .15s; }
.legal-header:hover { background: #fbf9f5; }
.legal-title { font-family: var(--art-sans); font-size: 16px; font-weight: 700; color: var(--art-ink); margin-bottom: 3px; }
.legal-subtitle { font-family: var(--art-sans); font-size: 13.5px; color: var(--art-soft); }
.legal-chevron { font-size: 20px; color: var(--art-soft); transition: transform .2s ease; flex-shrink: 0; margin-left: 1rem; }
.legal-chevron.open { transform: rotate(180deg); }
.legal-body { display: none; padding: 0 1.5rem; border-top: 1px solid #e0d8cc; }
.legal-body.open { display: block; }
.statute-item { padding: 1.6rem 0; border-bottom: 1px solid #eee8dd; }
.statute-item:last-child { border-bottom: none; }
.statute-tag { font-family: var(--art-sans); font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--art-soft); margin-bottom: 5px; }
.statute-name { font-family: var(--art-sans); font-size: 16px; font-weight: 700; color: var(--art-ink); margin-bottom: .8rem; }
.cf-body .statute-body p { font-family: var(--art-sans); font-size: 15px; line-height: 1.7; color: #3f3a36; margin-bottom: .75rem; }
.cf-body .statute-body p:last-child { margin-bottom: 0; }
.statute-body strong { color: var(--art-ink); font-weight: 700; }

/* ── Click-to-open definitions ── */
.def-wrap { position: relative; display: inline; }
.def-term { border-bottom: 1px dotted var(--art-soft); cursor: pointer; }
.def-box { display: none; background: #fff; border: 1px solid #e0d8cc; border-radius: 6px; padding: 12px 32px 12px 12px; margin: 6px 0; font-family: var(--art-sans); font-size: 14px; font-weight: 400; line-height: 1.6; color: #3f3a36; position: relative; }
.def-box.open { display: block; }
.def-close { position: absolute; top: 6px; right: 10px; font-family: var(--art-sans); font-size: 14px; color: var(--art-soft); cursor: pointer; line-height: 1; }
.def-close:hover { color: var(--art-ink); }

/* ── Glossary terms with a hover note ── */
.term-tooltip { position: relative; border-bottom: 1px dashed var(--art-green); cursor: help; color: inherit; }
.term-tooltip::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: #07312f; color: #fff; font-family: var(--art-sans); font-size: 13.5px; font-weight: 400; line-height: 1.5; padding: 8px 12px; border-radius: 6px; white-space: normal; width: 240px; text-align: left; z-index: 100; opacity: 0; pointer-events: none; transition: opacity .15s; }
.term-tooltip:hover::after, .term-tooltip:focus::after { opacity: 1; }

/* ── End of the article: search the records, then more to read ── */
.article-end { max-width: 740px; margin: 3.5rem auto 0; font-family: var(--art-sans); }
.article-end h2 { font-family: var(--art-display); font-weight: 400; font-size: 26px; line-height: 1.2; color: var(--art-ink); margin: 0 0 6px; }
.article-end-note { font-size: 15.5px; line-height: 1.55; color: var(--art-soft); margin: 0 0 16px; }
.article-search { border-top: 2px solid var(--art-ink); padding-top: 22px; }
.article-search-form { display: flex; gap: 10px; margin: 0 0 16px; }
.article-search-form input { flex: 1 1 auto; min-width: 0; height: 50px; padding: 0 16px; border: 1px solid #b9b0a2; border-radius: 8px; background: #fff; font: 400 16px var(--art-sans); color: var(--art-ink); }
.article-search-form input:focus { outline: 3px solid #f2c466; outline-offset: 1px; border-color: var(--art-green); }
.article-search-form button { flex: 0 0 auto; height: 50px; padding: 0 24px; border: 0; border-radius: 8px; background: #e8a020; color: #20242b; font: 700 15px var(--art-sans); cursor: pointer; }
.article-search-form button:hover { background: #d4911a; }
.article-search-links { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin: 0; padding: 0; list-style: none; font-size: 14.5px; }
.article-search-links li { margin: 0; }
.article-search-links .label { color: var(--art-soft); margin-right: 2px; }
.article-search-links a { display: inline-block; padding: 6px 13px; border: 1px solid #b9b0a2; border-radius: 999px; background: #fff; color: var(--art-ink); text-decoration: none; font-weight: 600; }
.article-search-links a:hover { border-color: var(--art-green); color: var(--art-green); }
.article-ask { margin: 16px 0 0; font-size: 15px; color: var(--art-soft); }
.article-ask a { color: var(--art-green); font-weight: 600; }

.article-more { margin-top: 3.25rem; border-top: 2px solid var(--art-ink); padding-top: 22px; }
.article-more-list { list-style: none; margin: 14px 0 0; padding: 0; }
.article-more-list li { border-top: 1px solid var(--art-rule); }
.article-more-list li:first-child { border-top: 0; }
.article-more-list a { display: flex; gap: 18px; align-items: center; padding: 16px 0; color: inherit; text-decoration: none; }
.article-more-list img { flex: 0 0 132px; width: 132px; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 4px; background: #e6dfd2; }
.article-more-title { display: block; font-family: var(--art-display); font-size: 21px; line-height: 1.22; color: var(--art-ink); }
.article-more-list a:hover .article-more-title { color: var(--art-green); text-decoration: underline; text-underline-offset: 3px; }
.article-more-date { display: block; margin-top: 5px; font-size: 13.5px; color: var(--art-soft); }
.article-more-all { display: inline-block; margin-top: 14px; font-size: 15px; font-weight: 700; color: var(--art-green); text-decoration: none; }
.article-more-all:hover { text-decoration: underline; }

/* ── Phones ── */
@media (max-width: 700px) {
    .cf-header { padding: calc(var(--sd-header-h, 58px) + 22px) 18px 30px; }
    .cf-hero { width: 100%; margin: 26px 0 0; transform: none; }
    .cf-tagline { font-size: 18px; }
    .cf-content-area { padding: 2.25rem 18px 56px; }
    .cf-body { font-size: 17px; }
    .cf-body h2 { font-size: 25px; }
    .cf-body table { font-size: 13.5px; }
    .cf-body thead th, .cf-body tbody td { padding: 8px 10px; }
    .article-stat-row { gap: 20px 18px; }
    .article-stat { flex-basis: calc(50% - 9px); }
    .article-stat-val { font-size: 26px; }
    .article-pullquote { font-size: 22px; margin: 2rem 0; }
    .article-chart { padding: 1rem; }
    .legal-header { padding: 1rem 1.15rem; }
    .legal-body { padding: 0 1.15rem; }
    .article-search-form { flex-direction: column; }
    .article-search-form button { width: 100%; }
    .article-more-list img { flex-basis: 96px; width: 96px; }
    .article-more-title { font-size: 18.5px; }
}
