/* Viracash — shared design system for blog articles, guide chapters and lexicon pages.
   One source for tokens, typography and the content components every article uses.
   Page-specific widgets (calculators, charts, landing heroes) keep their own small <style>. */

:root {
  --ink: #0d0d0d;
  --paper: #fafaf7;
  --accent: #d62839;        /* brand red: borders, rules, decorative marks */
  --accent-strong: #d62839; /* buttons with white text (AA contrast) */
  --accent-text: #b4232f;   /* red text and links on light backgrounds (AA contrast) */
  --muted: #5c6370;
  --border: #e5e5e0;
  --card-bg: #f4f4ef;
  --green: #15803d;
  --blue: #1d4ed8;
  --amber: #b45309;
  --radius: 10px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { max-width: 100%; overflow-x: clip; }
body { font-family: 'DM Sans', 'DM Sans Fallback', system-ui, sans-serif; background: var(--paper); color: var(--ink); line-height: 1.75; overflow-x: clip; }
h1, h2, h3, h4 { font-family: 'Space Grotesk', 'Space Grotesk Fallback', 'DM Sans', 'DM Sans Fallback', sans-serif; line-height: 1.2; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
/* Links inside running text are underlined: colour alone does not identify them (WCAG 1.4.1). */
.article-body a:not([class]), .article-wrap > p a, .article-wrap > ul a, .article-wrap > ol a,
.highlight-box a, .green-box a, .blue-box a, .warning-box a, .example-box a, .breadcrumb a, .related-links a, .disclaimer a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex="0"]:focus-visible { outline: 3px solid #f5a623; outline-offset: 3px; border-radius: 3px; }
img, svg { max-width: 100%; }

/* ── Article frame ── */
.article-wrap { max-width: 720px; margin: 0 auto; padding: 3.5rem 2rem 4rem; }
.article-header { margin-bottom: 2.5rem; }
.breadcrumb { font-size: 0.82rem; color: var(--muted); margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--ink); }
.article-tag, .tag { display: inline-block; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; color: var(--accent-text); margin-bottom: 1rem; }
.article-wrap h1 { font-size: 2rem; margin-bottom: 1rem; letter-spacing: -0.5px; }
.article-meta { color: var(--muted); font-size: 0.88rem; margin-bottom: 2.5rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); }
.article-header .article-meta { margin-bottom: 0; }

/* ── Body typography ── */
.article-body h2, .article-wrap > h2 { font-size: 1.45rem; margin: 2.5rem 0 1rem; color: var(--ink); }
.article-body h3, .article-wrap > h3 { font-size: 1.15rem; margin: 1.75rem 0 0.6rem; color: var(--ink); }
.article-body p, .article-wrap > p { margin-bottom: 1.25rem; }
.article-body ul, .article-body ol, .article-wrap > ul, .article-wrap > ol { margin: 0.5rem 0 1.25rem 1.5rem; }
.article-body li, .article-wrap > ul li, .article-wrap > ol li { margin-bottom: 0.5rem; }
.article-body strong { font-weight: 600; }
.article-body blockquote { border-left: 3px solid var(--border); padding-left: 1rem; color: var(--muted); margin: 1.5rem 0; }

/* ── Boxes ── */
.highlight-box, .green-box, .blue-box, .warning-box { padding: 1.25rem 1.5rem; border-radius: 0 8px 8px 0; margin: 1.5rem 0 1.75rem; }
.highlight-box { background: var(--card-bg); border-left: 3px solid var(--accent); }
.green-box { background: #f0fdf4; border-left: 3px solid var(--green); }
.blue-box { background: #eff6ff; border-left: 3px solid var(--blue); }
.warning-box { background: #fffbeb; border-left: 3px solid #d97706; }
.highlight-box p, .green-box p, .blue-box p, .warning-box p { margin: 0; }
.highlight-box p + p, .green-box p + p, .blue-box p + p, .warning-box p + p { margin-top: 0.75rem; }

.example-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin: 2rem 0; }
.example-box .example-header { font-family: 'Space Grotesk', 'Space Grotesk Fallback', sans-serif; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-text); margin-bottom: 0.5rem; }
.example-box h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.example-box p:last-child { margin-bottom: 0; }
.calc-line { display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0; border-bottom: 1px dashed var(--border); font-size: 0.92rem; }
.calc-line:last-child { border-bottom: none; }
.calc-line.total { font-family: 'Space Grotesk', 'Space Grotesk Fallback', sans-serif; font-weight: 700; border-top: 2px solid var(--ink); border-bottom: none; margin-top: 0.25rem; padding-top: 0.5rem; font-size: 1rem; }
.calc-line.total .val { color: var(--accent-text); }

.formula-box { background: #fff; border: 2px solid var(--ink); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin: 2rem 0; text-align: center; }
.formula-box .formula-title { font-family: 'Space Grotesk', 'Space Grotesk Fallback', sans-serif; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.75rem; }
.formula-box .formula-text { font-family: 'Space Grotesk', 'Space Grotesk Fallback', sans-serif; font-size: 1.05rem; font-weight: 600; line-height: 1.5; margin-bottom: 0; }
.formula-box .formula-text .plus { color: var(--muted); font-weight: 400; }

/* ── Steps ── */
.step-list { list-style: none; padding: 0; margin: 1.5rem 0; }
.step-list li { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.step-num { flex-shrink: 0; width: 2rem; height: 2rem; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; font-family: 'Space Grotesk', 'Space Grotesk Fallback', sans-serif; font-weight: 700; font-size: 0.9rem; }
.step-body { flex: 1; }
.step-body strong { display: block; margin-bottom: 0.2rem; font-size: 1rem; }
.step-body p { margin-bottom: 0; font-size: 0.93rem; color: var(--muted); }

/* ── Tables: wide tables scroll inside their own box ── */
.table-wrap, .data-table-wrap, .month-table-wrap, .year-table-wrap { overflow-x: auto; margin: 1.75rem 0; border-radius: var(--radius); border: 1px solid var(--border); -webkit-overflow-scrolling: touch; }
.table-wrap .data-table, .data-table-wrap .data-table { margin: 0; }
.data-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.92rem; }
.data-table th { text-align: left; padding: 0.6rem 1rem; background: var(--card-bg); font-family: 'Space Grotesk', 'Space Grotesk Fallback', sans-serif; font-weight: 600; border-bottom: 2px solid var(--border); }
.data-table td { padding: 0.6rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tr:last-child td { border-bottom: none; }
.data-table .num { font-family: 'Space Grotesk', 'Space Grotesk Fallback', sans-serif; font-weight: 600; text-align: right; white-space: nowrap; }
.badge-good { color: var(--green); font-weight: 600; }
.badge-ok { color: var(--amber); font-weight: 600; }
.badge-bad { color: var(--accent-text); font-weight: 600; }
.badge-green, .badge-blue, .badge-red { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: 4px; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-red { background: #fee2e2; color: #b91c1c; }

/* ── Calls to action ── */
.cta-inline { background: var(--ink); color: #fff; border-radius: 12px; padding: 2rem 2.5rem; margin: 2.5rem 0; text-align: center; }
.cta-inline h3 { font-size: 1.2rem; margin: 0 0 0.5rem; color: #fff; }
.cta-inline p { color: #d1d5db; margin-bottom: 1.25rem; font-size: 0.95rem; }
.btn-cta, .cta-btn, .cta-inline > a { display: inline-block; background: var(--accent-strong); color: #fff !important; padding: 0.8rem 2rem; border-radius: 8px; font-family: 'Space Grotesk', 'Space Grotesk Fallback', sans-serif; font-weight: 600; font-size: 0.95rem; text-decoration: none !important; transition: background 0.15s; }
.btn-cta:hover, .cta-btn:hover, .cta-inline > a:hover { background: #b4232f; }

/* ── Share buttons ── */
.share-buttons { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 1.5rem 0; }
.share-label { font-family: 'Space Grotesk', 'Space Grotesk Fallback', sans-serif; font-size: 0.8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-right: 0.25rem; }
.share-btn { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 40px; padding: 0.45rem 0.9rem; border-radius: 6px; font-size: 0.82rem; font-weight: 500; font-family: 'DM Sans', 'DM Sans Fallback', sans-serif; border: 1px solid var(--border); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none !important; transition: border-color 0.15s, color 0.15s; }
.share-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.share-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.share-copied { background: var(--green) !important; color: #fff !important; border-color: var(--green) !important; }

/* ── Related content and footnotes ── */
.related, .related-links { margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.related h2, .related h3, .related-links h2, .related-links h3 { font-family: 'Space Grotesk', 'Space Grotesk Fallback', sans-serif; font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 1rem; }
.related-links ul { list-style: none; padding: 0; margin: 0; }
.related-links li { margin-bottom: 0.6rem; }
/* Verification date, official sources and author, after the article body. */
.article-sources { margin: 2.5rem 0 1.5rem; padding: 1.25rem 1.5rem; background: var(--card-bg); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); font-size: 0.92rem; line-height: 1.6; }
.article-sources h2 { font-family: 'Space Grotesk', 'Space Grotesk Fallback', sans-serif; font-size: 1.05rem; margin: 0 0 0.5rem; padding: 0; border: 0; color: var(--ink); }
.article-sources p { margin: 0 0 0.6rem; color: var(--ink); }
.article-sources .article-sources-date { color: var(--ink); }
.article-sources ul { margin: 0 0 0.6rem; padding-left: 1.2rem; }
.article-sources li { margin-bottom: 0.3rem; }
.article-sources a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; overflow-wrap: anywhere; }
.article-author { display: flex; align-items: center; gap: 0.85rem; margin: 0 0 1.5rem; }
.article-author p { margin: 0; font-size: 0.92rem; color: var(--muted); line-height: 1.5; }
.article-author strong { color: var(--ink); }
.article-author-avatar { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--ink); color: #fff; font-family: 'Space Grotesk', 'Space Grotesk Fallback', sans-serif; font-weight: 700; }
.disclaimer { font-size: 0.8rem; color: var(--muted); border-top: 1px solid var(--border); margin-top: 2.5rem; padding-top: 1.25rem; line-height: 1.5; }

/* ── Guide chapters (Guide patrimoine) ── */
.guide-header { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 2.5rem; }
.guide-header-label { font-family: 'Space Grotesk', 'Space Grotesk Fallback', sans-serif; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin-bottom: 0.75rem; }
.guide-progress { font-family: 'Space Grotesk', 'Space Grotesk Fallback', sans-serif; font-size: 1rem; font-weight: 700; color: var(--ink); margin-bottom: 1rem; }
.guide-progress span { color: var(--accent-text); }
.guide-toc { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.guide-toc li { font-size: 0.88rem; }
.guide-toc li a { color: var(--muted); }
.guide-toc li a:hover { color: var(--ink); }
.guide-toc li.current { font-weight: 600; }
.guide-toc li.current span { color: var(--ink); }
.guide-toc .chap-num { font-family: 'Space Grotesk', 'Space Grotesk Fallback', sans-serif; font-size: 0.75rem; color: var(--muted); margin-right: 0.35rem; }
.guide-toc li.current .chap-num { color: var(--accent-text); }
.sommaire-back { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; color: var(--muted); margin-bottom: 1.25rem; font-weight: 500; }
.sommaire-back:hover { color: var(--accent-text); text-decoration: none; }
.chapter-nav { display: flex; gap: 1rem; margin: 3rem 0 1rem; flex-wrap: wrap; }
.prev-chapter, .next-chapter { flex: 1; min-width: 200px; display: flex; align-items: center; justify-content: space-between; border-radius: 12px; padding: 1.25rem 1.5rem; text-decoration: none !important; transition: transform 0.15s, box-shadow 0.15s; }
.prev-chapter { background: var(--card-bg); border: 1px solid var(--border); justify-content: flex-start; }
.next-chapter { background: var(--ink); color: #fff; }
.prev-chapter:hover, .next-chapter:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); }
.chapter-nav-arrow { font-size: 1.25rem; flex-shrink: 0; }
.prev-chapter .chapter-nav-arrow { color: var(--muted); margin-right: 0.75rem; }
.next-chapter .chapter-nav-arrow { color: #ff8a8f; margin-left: 0.75rem; }
.chapter-nav-label { font-size: 0.72rem; font-family: 'Space Grotesk', 'Space Grotesk Fallback', sans-serif; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 0.3rem; }
.prev-chapter .chapter-nav-label { color: var(--muted); }
.next-chapter .chapter-nav-label { color: #d1d5db; }
.chapter-nav-title { font-family: 'Space Grotesk', 'Space Grotesk Fallback', sans-serif; font-size: 0.92rem; font-weight: 700; }
.prev-chapter .chapter-nav-title { color: var(--ink); }
.next-chapter .chapter-nav-title { color: #fff; }

/* ── Icons (SVG sprite, see /img/icons.svg) ── */
.vs-icon { display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 700px) {
  .data-table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table td, .data-table th { min-width: 6.5rem; }
  .table-wrap .data-table, .data-table-wrap .data-table, .month-table-wrap .data-table, .year-table-wrap .data-table { display: table; }
}
@media (max-width: 640px) {
  .article-wrap { padding: 2rem 1.25rem 3rem; }
  .article-wrap h1 { font-size: 1.5rem; }
  .cta-inline { padding: 1.5rem; }
  .data-table { font-size: 0.82rem; }
  .share-buttons { gap: 0.4rem; }
  .share-btn { padding: 0.4rem 0.7rem; font-size: 0.78rem; }
  .share-label { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Lot 5b — AA contrast on dark backgrounds */
.cta-inline a:not([class]) { color: #ff8a8f; text-decoration: underline; }
