/* Shared stylesheet: mobile-first, system fonts, no external requests. */
:root {
  --accent: #0b5d7a;
  --accent-dark: #083f53;
  --ink: #14212b;
  --muted: #55636f;
  --line: #d9e0e6;
  --bg: #f6f8fa;
  --card: #ffffff;
  --ok: #17703a;
  --warn: #8a5300;
  --bad: #a3261b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 16px rgba(16,24,40,.05);
  color-scheme: light;
}
*,*::before,*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink); background: var(--bg); }
img, svg { max-width: 100%; vertical-align: middle; }
a { color: var(--accent-dark); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.wrap { width: 100%; max-width: 1060px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; top: 0; background: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
h1, h2, h3 { line-height: 1.25; color: #0d1820; }
h1 { font-size: 1.75rem; margin: .2em 0 .3em; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; margin: 1.8em 0 .5em; }
h3 { font-size: 1.08rem; margin: 1.4em 0 .4em; }
p, ul, ol { margin: 0 0 1em; }
.muted { color: var(--muted); }
.big { font-size: 1.15rem; }

/* header */
.site-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 12px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 1.15rem; }
.nav-toggle { display: inline-block; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 12px; font: inherit; font-size: .95rem; cursor: pointer; }
.site-nav { display: none; width: 100%; }
.site-nav.open { display: block; }
.site-nav ul { list-style: none; margin: 0; padding: 0 0 12px; display: flex; flex-direction: column; gap: 2px; }
.site-nav a { display: block; padding: 10px 8px; text-decoration: none; color: var(--ink); border-radius: 8px; font-size: .97rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--bg); color: var(--accent-dark); }
@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .site-nav { display: block; width: auto; }
  .site-nav ul { flex-direction: row; padding: 0; gap: 4px; }
  .site-nav a { padding: 8px 10px; font-size: .93rem; }
}

/* breadcrumbs + language */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 16px 0 0; font-size: .87rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 6px; color: #9aa5ae; }
.lang-switch ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 10px 0 0; }
.lang-switch a { display: inline-block; font-size: .82rem; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; background: #fff; color: var(--muted); }
.lang-switch a[aria-current="true"] { border-color: var(--accent); color: var(--accent-dark); font-weight: 600; }

/* page */
.content { padding: 8px 0 40px; }
.page-head { margin: 14px 0 18px; }
.lead { font-size: 1.08rem; color: #33424e; max-width: 70ch; }
.updated { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; margin: 0; }
.prose { max-width: 72ch; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin: 0 0 18px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid-cards { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 14px 0 24px; }
@media (min-width: 640px) { .grid-cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .grid-cards.three { grid-template-columns: 1fr 1fr 1fr; } }
.tile { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--accent); transform: translateY(-1px); color: var(--ink); }
.tile h3 { margin: 0 0 4px; color: var(--accent-dark); font-size: 1.05rem; }
.tile p { margin: 0; color: var(--muted); font-size: .94rem; }
.tile .tag { display: inline-block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-dark); background: color-mix(in srgb, var(--accent) 10%, white); border-radius: 6px; padding: 1px 7px; margin-bottom: 6px; }
.hero { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%); color: #fff; border-radius: 16px; padding: 26px 20px; margin: 16px 0 8px; }
.hero h1, .hero p { color: #fff; }
.hero .lead { color: rgba(255,255,255,.92); }
.hero .updated { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.3); }

/* calculator */
.calc { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin: 8px 0 24px; }
@media (min-width: 880px) { .calc { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; } .calc .results { position: sticky; top: 76px; } }
.calc form, .calc .results { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.calc h2 { margin: 0 0 12px; font-size: 1.1rem; }
.field { margin: 0 0 14px; }
.field label, .field .label { display: block; font-weight: 600; font-size: .93rem; margin-bottom: 5px; }
.field .hint { display: block; font-weight: 400; color: var(--muted); font-size: .83rem; margin-top: 4px; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: end; }
.calc form > *, .row2 > * { min-width: 0; }
.field input, .field select { max-width: 100%; }
input[type=number], input[type=text], select { width: 100%; font: inherit; font-size: 1rem; padding: 10px 12px; border: 1px solid #b9c4cd; border-radius: 9px; background: #fff; color: var(--ink); min-height: 44px; }
input:focus, select:focus { border-color: var(--accent); }
.input-affix { display: flex; align-items: stretch; }
.input-affix span { display: inline-flex; align-items: center; padding: 0 10px; background: var(--bg); border: 1px solid #b9c4cd; color: var(--muted); font-size: .92rem; }
.input-affix span:first-child { border-right: 0; border-radius: 9px 0 0 9px; }
.input-affix span:last-child { border-left: 0; border-radius: 0 9px 9px 0; }
.input-affix input { border-radius: 0; }
.input-affix span:first-child + input { border-radius: 0 9px 9px 0; }
.input-affix input:first-child { border-radius: 9px 0 0 9px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; margin: 0 0 14px; }
.seg legend { font-weight: 600; font-size: .93rem; margin-bottom: 6px; padding: 0; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: inline-block; padding: 8px 14px; border: 1px solid #b9c4cd; border-radius: 999px; cursor: pointer; font-size: .92rem; background: #fff; }
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .94rem; margin: 0 0 12px; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); }
.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 9px; padding: 11px 18px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; min-height: 44px; }
.btn:hover { background: var(--accent-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--accent-dark); border: 1px solid var(--accent); }
.btn-small { padding: 6px 12px; min-height: 36px; font-size: .9rem; }
.linkbtn { background: none; border: 0; color: var(--bad); cursor: pointer; font: inherit; font-size: .88rem; padding: 6px; min-height: 36px; }
.result-main { font-size: 2rem; font-weight: 750; color: var(--accent-dark); line-height: 1.15; margin: 2px 0 4px; font-variant-numeric: tabular-nums; }
.result-sub { color: var(--muted); margin: 0 0 12px; font-size: .95rem; }
.kv { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; margin: 6px 0 4px; }
.kv th, .kv td { padding: 8px 4px; border-bottom: 1px solid #edf1f4; text-align: left; font-size: .95rem; vertical-align: top; }
.kv td { text-align: right; white-space: nowrap; }
@media (max-width: 520px) { .kv td { white-space: normal; overflow-wrap: anywhere; } }
.kv tr.total th, .kv tr.total td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; }
.status { border-radius: 9px; padding: 10px 12px; font-size: .94rem; margin: 10px 0; }
.status.ok { background: #e9f6ee; color: var(--ok); }
.status.warn { background: #fff4e0; color: var(--warn); }
.status.bad { background: #fdecea; color: var(--bad); }
.bar { height: 10px; background: #edf1f4; border-radius: 99px; overflow: hidden; margin: 4px 0 10px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.dyn-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 8px; }
.dyn-row .field { margin: 0; }
.dyn-row label { font-size: .8rem; }
@media (max-width: 520px) { .dyn-row { grid-template-columns: 1fr 1fr !important; } .dyn-row .field:first-child { grid-column: 1 / -1; } .dyn-row .linkbtn { justify-self: start; } }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: .93rem; font-variant-numeric: tabular-nums; }
table.data caption { text-align: left; padding: 10px 12px 0; color: var(--muted); font-size: .86rem; caption-side: top; }
table.data th, table.data td { padding: 9px 12px; border-bottom: 1px solid #edf1f4; text-align: left; }
table.data thead th { background: var(--bg); font-weight: 650; }
table.data td.num, table.data th.num { text-align: right; }
.note { background: #fff; border-left: 4px solid var(--accent); padding: 12px 14px; border-radius: 0 10px 10px 0; margin: 0 0 18px; font-size: .95rem; }
.note.warn { border-left-color: #d08a00; background: #fffaf0; }
.formula { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #fff; border: 1px solid var(--line); padding: 10px 12px; border-radius: 9px; overflow-x: auto; font-size: .9rem; }

/* FAQ, sources */
.faq-item { background: #fff; border: 1px solid var(--line); border-radius: 10px; margin: 0 0 8px; }
.faq-item summary { cursor: pointer; padding: 13px 16px; font-weight: 600; list-style: none; position: relative; padding-right: 40px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 16px; top: 10px; font-size: 1.3rem; color: var(--accent); }
.faq-item[open] summary::after { content: "–"; }
.faq-a { padding: 0 16px 6px; color: #2c3a45; }
.sources ul { padding-left: 1.1em; font-size: .93rem; }
.sources li { margin-bottom: 4px; }

/* ads + partners: hidden until real code is added; preview with ?showads=1 */
.ad-slot { display: none; }
.ad-slot.is-live { display: block; margin: 22px 0; min-height: 90px; text-align: center; }
.show-ads .ad-slot { display: flex; align-items: center; justify-content: center; min-height: 100px; margin: 22px 0; border: 2px dashed #c3ccd4; border-radius: 10px; color: #8a96a1; font-size: .85rem; background: repeating-linear-gradient(45deg, #fafbfc, #fafbfc 10px, #f3f5f7 10px, #f3f5f7 20px); }
.show-ads .ad-slot::before { content: "AD SLOT (empty): " attr(data-ad-slot-name); }
.partner-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 18px 0; }
.show-ads .partner-box[hidden] { display: block; border-style: dashed; }
.partner-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 4px; }

/* footer */
.site-footer { background: #0f1b24; color: #c9d3db; padding: 28px 0 34px; font-size: .92rem; }
.site-footer a { color: #e6edf2; }
.footer-brand { display: flex; align-items: center; gap: 8px; color: #fff; margin-bottom: 8px; flex-wrap: wrap; }
.footer-brand span { color: #9fb0bd; }
.footer-links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0; }
.footer-note { max-width: 80ch; color: #aab8c3; }
.copy { color: #8597a5; font-size: .85rem; margin: 0; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .site-header, .site-footer, .ad-slot, .partner-box, .nav-toggle { display: none !important; } body { background: #fff; } }
