/*
 * folko.io — body components of the older translated pages (features/, compare/, use-cases/), phase 3 of the
 * 2026-10 redesign. The markup and every data-i18n binding are unchanged (so all 15 translations keep working);
 * this file restyles it in the After dark system. Loads after site.css and pages.css.
 *
 * Rules of the system applied here: no decorative icon grids (the emoji icons are hidden, cards become ruled rows),
 * amber only as a signal, hairlines instead of boxes, Plus Jakarta Sans at weights <= 700.
 *
 * Reading pages follow the system light/dark setting (spec §3): html.reading swaps the tokens under
 * prefers-color-scheme: light. Contrast of the light set is computed by __tests__/websitePhase3Pages.test.ts.
 */

/* ── Light set for reading pages ───────────────────────── */
@media (prefers-color-scheme: light) {
  html.reading {
    --ground: #FAFAF9; --raised: #F5F5F4; --surface: #FFFFFF; --line: #E7E5E4;
    --text: #1C1917; --text-2: #44403C; --muted: #57534E; --dim: #78716C; --clay: #A8521F;
    --in: #15803D; --out: #B91C1C; --bezel: #1C1917;
    color-scheme: light;
  }
  /* Amber is ~2:1 on this ground: the focus ring (a non-text UI element, needs 3:1) uses clay on reading pages. */
  html.reading :focus-visible { outline-color: var(--clay); }
}

.content-body { max-width: var(--wrap); margin-inline: auto; padding: clamp(48px, 7vw, 96px) var(--gutter) clamp(64px, 9vw, 128px); }
.content-body > .section:first-child { border-top: 0; padding-top: 0; }
.page-hero--text .wrap > div { max-width: 820px; }
.page-hero--text h1 em, .page-hero--text h1 span { font-style: normal; color: var(--dim); }
html.reading .page-hero--text h1 em, html.reading .page-hero--text h1 span { color: var(--muted); }

/* ── Sections and prose ────────────────────────────────── */
.content-body .section { padding-block: clamp(40px, 6vw, 72px); border-top: 1px solid var(--line); margin: 0; max-width: none; }
.content-body .section > h2 { font-size: clamp(26px, 3vw, 38px); line-height: 1.1; font-weight: 600; letter-spacing: -0.03em; margin-bottom: 20px; max-width: 24ch; text-wrap: balance; }
.content-body .section > p, .content-body .section-intro, .content-body .prose p { font-size: 17px; line-height: 1.7; color: var(--text-2); max-width: 66ch; margin-bottom: 18px; }
.content-body .section-intro { margin-bottom: 36px; }
.content-body strong { color: var(--text); font-weight: 600; }
.content-body a { color: var(--text); text-decoration-color: var(--dim); text-underline-offset: 4px; }
.content-body .section-label, .content-body .section-intro + .section-label { display: block; margin-bottom: 14px; font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--clay); }
.content-body .divider { display: none; }
.content-body .prose { max-width: 66ch; }

/* ── Cards become ruled rows; decorative icons are hidden ─ */
.card-icon, .use-case-icon, .pf-icon, .fi-icon, .cr-icon, .why-check, .source-badge + .x-none { display: none !important; }
.cards-grid, .feature-grid, .use-cases, .perfect-for-grid, .why-grid, .cashbook-example, .cashbook-structure, .cashbook-list, .format-grid, .currency-grid.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 0 clamp(24px, 4vw, 56px); margin-top: 28px; }
.content-body .card, .feature-item, .use-case, .perfect-for-item, .why-item, .cashbook-item, .cb-item, .cashbook-row, .format-card {
  background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 22px 0; margin: 0; display: block; transition: none; }
.content-body .card:hover { background: none; border-color: var(--line); }
.card h3, .feature-item h3, .use-case h3, .perfect-for-item h3, .why-item h3, .cashbook-item h3, .cb-item h3, .format-card h3, .cr-info h3 {
  font-size: 18px; font-weight: 600; letter-spacing: -0.012em; margin: 0 0 8px; color: var(--text); }
.card p, .feature-item p, .use-case p, .perfect-for-item p, .why-item p, .cashbook-item p, .cb-item p, .format-card p, .cr-info p {
  font-size: 16px; line-height: 1.6; color: var(--muted); margin: 0; }
.cashbook-item .cb-label, .format-ext, .cr-who { display: inline-block; margin-bottom: 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--clay); background: none; padding: 0; }
.cr-who { margin-inline-start: 0; }
.fi-top { display: block; margin: 0; }
.cashbook-row { display: block; }

/* ── Ordered sequences ─────────────────────────────────── */
.content-body .steps, .tax-steps { max-width: 760px; display: block; margin: 28px 0 0; padding: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; overflow: visible; }
.content-body .step, .tax-step { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 4px 16px; align-items: start; padding: 22px 0; margin: 0; border-bottom: 1px solid var(--line); background: none; flex-direction: row; }
.content-body .step:last-child, .tax-step:last-child { border-bottom: 1px solid var(--line); }
.tax-step:hover { background: none; }
.step-num, .tax-step-num { width: auto; height: auto; min-width: 0; background: none; border: 0; border-radius: 0; color: var(--dim); font-size: 28px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.1; display: block; margin: 0; font-variant-numeric: tabular-nums; }
.step-body, .step-content, .tax-step > div:last-child { min-width: 0; }
.step-body h3, .step-content h3, .tax-step h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 6px; color: var(--text); }
.step-body p, .step-content p, .tax-step p { font-size: 16px; line-height: 1.6; color: var(--muted); margin: 0; }

/* ── Worked examples, notes, callouts ──────────────────── */
.example-box, .source-box, .chart-mock, .scenario-box, .tier-note, .price-callout { max-width: 760px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: clamp(20px, 3vw, 32px); margin: 28px 0; }
.scenario-box { border-inline-start: 3px solid var(--line); border-radius: 0 16px 16px 0; }
html[dir="rtl"] .scenario-box { border-radius: 16px 0 0 16px; }
.scenario-box p { font-size: 17px; line-height: 1.7; color: var(--text-2); margin: 0; }
.example-box h3, .chart-mock-title { margin: 0 0 18px; font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--clay); }
.example-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 16px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.example-row:last-child { border-bottom: 0; }
.example-arrow { color: var(--dim); font-weight: 600; }
.result-row { margin-top: 16px; padding: 14px 16px; background: var(--raised); border-radius: 10px; font-size: 16px; font-weight: 600; color: var(--text); line-height: 1.5; }
.tier-note { background: var(--raised); font-size: 16px; line-height: 1.6; color: var(--text-2); }
.tier-note strong { color: var(--text); }
.source-row { display: flex; gap: 14px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--line); }
.source-row:first-child { padding-top: 0; } .source-row:last-child { border-bottom: 0; padding-bottom: 0; }
.source-badge { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--clay); background: none; padding: 0; white-space: nowrap; }
.source-info h4 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.source-info p { margin: 0; font-size: 15px; color: var(--muted); line-height: 1.55; }
.price-callout { display: flex; flex-wrap: wrap; gap: 24px; }
.price-item { flex: 1; min-width: 180px; }
.price-item .label { margin-bottom: 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.price-item .value { font-size: 36px; font-weight: 600; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; color: var(--text-2); }
.price-item.folko .value { color: var(--text); }
.price-item .sub { margin-top: 2px; font-size: 14px; color: var(--muted); }

/* ── Mock charts and chips ─────────────────────────────── */
.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.bar-label { width: 96px; flex: none; font-size: 14px; color: var(--muted); }
.bar-track { flex: 1; height: 8px; background: var(--raised); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--text-2); }
.bar-amount { width: 56px; flex: none; text-align: end; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.period-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.period-tab { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--muted); }
.period-tab.active { color: var(--text); border-color: var(--text-2); }
.currency-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin: 24px 0; }
.currency-chip { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); text-align: center; }
.currency-chip.more { color: var(--muted); }
.rails-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.rail-chip { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; background: #F5F5F4; border-radius: 10px; font-size: 14px; font-weight: 600; color: #1C1917; border: 0; transition: none; }
.rail-chip:hover { background: #F5F5F4; transform: none; border: 0; }
.rail-chip img { display: block; width: auto; max-width: 96px; }

/* ── Questions, related links, closing bands ───────────── */
.content-body .faq { display: block; margin-top: 24px; border-top: 1px solid var(--line); max-width: 760px; }
.content-body .faq-item { padding: 24px 0; border-bottom: 1px solid var(--line); }
.content-body .faq-item:last-child { border-bottom: 1px solid var(--line); }
.faq-item h3 { font-size: 19px; font-weight: 600; letter-spacing: -0.012em; margin: 0 0 10px; }
.faq-item p { margin: 0; font-size: 16px; color: var(--muted); line-height: 1.65; }
.related-links { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter) 40px; }
.related-links h3 { margin: 0 0 14px; font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--clay); }
.related-links ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.related-links a { display: inline-block; padding: 9px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; font-size: 15px; font-weight: 500; text-decoration: none; color: var(--text); }
.related-links a:hover { border-color: var(--muted); }
.cta-band, .cta-section, .cta-block { background: var(--raised); border: 0; border-top: 1px solid var(--line); border-radius: 0; margin: 0; padding: clamp(56px, 8vw, 104px) max(var(--gutter), calc((100% - var(--wrap)) / 2 + var(--gutter))); text-align: start; max-width: none; }
.cta-block { margin-top: 56px; border: 1px solid var(--line); border-radius: 16px; padding: clamp(28px, 4vw, 44px); }
.cta-band h2, .cta-section h2, .cta-block h2 { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.08; font-weight: 600; letter-spacing: -0.03em; color: var(--text); margin: 0 0 14px; max-width: 18ch; text-wrap: balance; }
.cta-band p, .cta-section p, .cta-block p { color: var(--text-2); font-size: 17px; max-width: 54ch; margin: 0 0 28px; }
.btn-dark, .btn-cta { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border-radius: 12px; border: 0; background: var(--amber); color: var(--amber-ink); font: 600 16px/1 var(--font); text-decoration: none; }
.btn-dark:hover, .btn-cta:hover { background: var(--amber-hover); color: var(--amber-ink); transform: none; opacity: 1; }

/* ── Comparison tables (compare/) ──────────────────────── */
.compare-table-wrap { max-width: 960px; overflow-x: auto; margin: 28px 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.content-body table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 15px; }
.content-body thead { background: var(--raised); }
.content-body thead th { padding: 14px 16px; text-align: start; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); }
.content-body thead th.col-folko { color: var(--text); }
.content-body tbody tr { border-bottom: 1px solid var(--line); }
.content-body tbody tr:last-child { border-bottom: 0; }
.content-body td, .content-body tbody th { padding: 14px 16px; vertical-align: top; color: var(--text-2); }
.content-body tbody th.col-feature { color: var(--text); font-weight: 500; text-align: start; }
.content-body td.col-folko { background: color-mix(in srgb, var(--amber) 7%, var(--surface)); }
.content-body thead th.col-folko { box-shadow: inset 0 2px 0 var(--amber); }
.yes { color: var(--text); font-weight: 600; } .no { color: var(--muted); } .partial { color: var(--text-2); font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; margin: 28px 0; }
.choice-box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.choice-box h3 { margin: 0 0 10px; font-size: 16px; font-weight: 600; }
.choice-box ul { margin: 0; padding-inline-start: 18px; }
.choice-box li { margin-bottom: 6px; color: var(--text-2); font-size: 15px; }
.choice-box.folko-box { border-color: var(--text-2); }
.content-body ul:not(.related-links ul) { padding-inline-start: 20px; }
.content-body li { color: var(--text-2); line-height: 1.65; }
.content-body h2:not(.section > h2) { font-size: clamp(24px, 2.6vw, 32px); font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; margin: 56px 0 16px; }
.content-body h3:not(.card h3):not(.faq-item h3):not(.choice-box h3) { font-size: 18px; font-weight: 600; margin: 28px 0 10px; }
.content-body p { color: var(--text-2); line-height: 1.7; margin-bottom: 16px; max-width: 70ch; }
.page-label { display: none; }

@media (max-width: 640px) {
  .bar-label { width: 72px; }
  .content-body .step, .tax-step { grid-template-columns: 36px minmax(0, 1fr); }
}
