/* site.css — shared by every site; each site sets its accent in :root via site.json */
:root {
  --bg: #fbfaf8; --surface: #ffffff; --surface-2: #f4f1ec; --text: #1d1b18; --muted: #5f5a53;
  --line: #e4ded5; --accent: var(--brand, #b6461b); --accent-ink: #ffffff; --accent-soft: var(--brand-soft, #fbeee7);
  --ok: #1f7a4d; --err: #b42318; --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151413; --surface: #1e1c1a; --surface-2: #262320; --text: #f1ede7; --muted: #a8a198; --line: #36322d;
    --accent: var(--brand-dark, #f08a5d); --accent-ink: #1a0f0a; --accent-soft: #2e211a; --shadow: none; }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.65 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
.wrap-outer { flex: 1; }
a { color: var(--accent); text-underline-offset: 2px; }
img, svg { max-width: 100%; height: auto; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 12px 28px; min-height: 96px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.logo { display: flex; align-items: center; gap: 14px; font-weight: 800; font-size: clamp(1.9rem, 4vw, 2.9rem); line-height: 1.1; color: var(--text); text-decoration: none; letter-spacing: -.02em; }
.logo svg { width: clamp(44px, 6vw, 64px); height: clamp(44px, 6vw, 64px); color: var(--accent); flex: 0 0 auto; }
.nav { display: flex; gap: 4px; flex-wrap: nowrap; margin-left: auto; max-width: 100%; overflow-x: auto; scrollbar-width: none; font-size: clamp(1rem, 1.35vw, 1.2rem); font-weight: 650; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--text); text-decoration: none; padding: 8px 12px; border-radius: 99px; white-space: nowrap; } .nav a:hover { color: var(--accent); background: var(--accent-soft); }
@media (max-width: 700px) { .nav { margin-left: 0; width: 100%; } .nav a { padding: 6px 12px; background: var(--surface-2); } }

/* breadcrumbs */
.crumbs { font-size: .85rem; color: var(--muted); margin: 18px 0 6px; }
.crumbs a { color: var(--muted); } .crumbs span { margin: 0 6px; }

/* layout */
.page { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; padding-bottom: 48px; }
@media (max-width: 920px) { .page { grid-template-columns: minmax(0, 1fr); } .sidebar { display: none; } }
h1 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); line-height: 1.2; margin: 4px 0 8px; letter-spacing: -.02em; }
h2 { font-size: 1.4rem; line-height: 1.3; margin: 2em 0 .5em; letter-spacing: -.01em; }
h3 { font-size: 1.1rem; margin: 1.5em 0 .4em; }
.lead { color: var(--muted); font-size: 1.08rem; margin: 0 0 20px; }
.meta-line { font-size: .85rem; color: var(--muted); margin: 0 0 16px; }

/* calculator */
.calc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.calc-inputs { padding: 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.field .hint { display: block; font-size: .8rem; color: var(--muted); margin-top: 4px; }
.control { display: flex; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.control:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.control input, .control select { border: 0; background: transparent; color: var(--text); font: inherit; padding: 10px 12px; min-width: 0; width: 100%; outline: none; }
.control select.unit { width: auto; flex: 0 0 auto; border-left: 1px solid var(--line); background: var(--surface-2); font-size: .92rem; padding: 10px 8px; cursor: pointer; }
.control .prefix, .control .suffix { display: flex; align-items: center; padding: 0 10px; color: var(--muted); background: var(--surface-2); font-size: .92rem; }
.calc-actions { display: flex; gap: 10px; padding: 0 20px 20px; flex-wrap: wrap; }
.btn { font: inherit; font-size: .92rem; font-weight: 600; border-radius: 8px; padding: 9px 16px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.calc-results { background: var(--accent-soft); border-top: 1px solid var(--line); padding: 18px 20px; }
.calc-results h2 { font-size: 1rem; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.result-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.result-row:last-of-type { border-bottom: 0; }
.result-row .label { font-weight: 600; }
.result-row .value { font-size: 1.35rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.result-row.primary .value { font-size: 1.8rem; color: var(--accent); }
.result-row select { font: inherit; font-size: .85rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); padding: 2px 4px; margin-left: 6px; }
.result-row .suffix { color: var(--muted); font-size: .95rem; margin-left: 4px; }
.calc-error { color: var(--err); font-weight: 600; min-height: 0; }
.has-error .result-row { opacity: .4; }
.calc-note { color: var(--muted); font-size: .9rem; margin-top: 8px; }

/* article */
.article { margin-top: 8px; }
.article table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .95rem; font-variant-numeric: tabular-nums; }
.article th, .article td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.article th { background: var(--surface-2); }
.table-scroll { overflow-x: auto; }
.formula { background: var(--surface-2); border-left: 4px solid var(--accent); border-radius: 6px; padding: 12px 16px; font-family: var(--mono); font-size: .95rem; overflow-x: auto; }
.example { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 20px; }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { font-weight: 650; cursor: pointer; }
.faq details p { margin: 8px 0 0; }
.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; padding: 0; list-style: none; }
.related a, .card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; text-decoration: none; color: var(--text); font-weight: 600; }
.related a:hover, .card:hover { border-color: var(--accent); }
.card small { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }

/* sidebar */
.sidebar .box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.sidebar h2 { font-size: 1rem; margin: 0 0 8px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; font-size: .95rem; }
.sidebar li { padding: 4px 0; }
.sticky { position: sticky; top: 16px; }

/* home */
.hero { padding: 40px 0 24px; }
.hero-home { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 32px; align-items: center; padding: 48px 0 32px; }
.hero-home h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.08; }
.hero-home .lead { font-size: 1.18rem; }
.hero-visual { display: flex; justify-content: center; }
.hero-art { width: 100%; max-width: 400px; height: auto; }
.ha-ring { fill: none; stroke: var(--line); stroke-width: 2; stroke-dasharray: 6 8; }
.ha-soft { fill: var(--accent-soft); }
.ha-body { fill: var(--surface); stroke: var(--accent); stroke-width: 3; }
.ha-screen { fill: var(--accent); }
.ha-line { fill: none; stroke: var(--accent-ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ha-key { fill: var(--surface-2); stroke: var(--line); } .ha-key-acc { fill: var(--accent); }
.ha-bub { fill: var(--surface); stroke: var(--line); stroke-width: 2; } .ha-ico { color: var(--accent); }
.search { position: relative; }
.search-ico { position: absolute; left: 14px; top: 50%; width: 22px; height: 22px; transform: translateY(-50%); color: var(--muted); }
.hero-home .search input { padding: 15px 16px 15px 46px; font-size: 1.05rem; box-shadow: var(--shadow); }
.chips { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; font-size: .9rem; font-weight: 600; }
.chips .ico { width: 18px; height: 18px; color: var(--accent); }
.sec-title { font-size: clamp(1.4rem, 2.6vw, 1.85rem); margin: 48px 0 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.tile-ico { width: 48px; height: 48px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.tile-ico .ico { width: 28px; height: 28px; }
.tile-name { font-weight: 750; font-size: 1.15rem; } .tile-intro { color: var(--muted); font-size: .93rem; flex: 1; }
.tile-count { color: var(--accent); font-weight: 700; font-size: .9rem; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; counter-reset: s; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.steps p { margin: 8px 0 0; }
.step-n { display: inline-flex; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; align-items: center; justify-content: center; }
.feats { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.feat { background: var(--accent-soft); border-radius: 14px; padding: 18px; }
.feat .ico { width: 30px; height: 30px; color: var(--accent); }
.feat h3 { margin: 8px 0 4px; font-size: 1.08rem; } .feat p { margin: 0; color: var(--text); font-size: .95rem; }
.h-ico { width: 24px; height: 24px; color: var(--accent); vertical-align: -4px; margin-right: 8px; }
.about-home { max-width: 820px; }
.home .faq { max-width: 820px; padding-bottom: 32px; }
.searching .home-extra { display: none; }
@media (max-width: 820px) { .hero-home { grid-template-columns: minmax(0, 1fr); padding-top: 28px; } .hero-art { max-width: 260px; } }
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); }
.search { display: flex; max-width: 560px; margin-top: 16px; }
.search input { flex: 1; font: inherit; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.cat-block { margin: 28px 0; }
.cat-block h2 { margin: 0 0 12px; font-size: 1.25rem; }
.cat-block h2 a { color: var(--text); text-decoration: none; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 1px 8px; margin-left: 6px; vertical-align: middle; }
[hidden] { display: none !important; }

/* ads: reserved space avoids layout shift; only rendered when AdSense is configured */
.ad-slot { margin: 24px 0; min-height: 280px; display: flex; align-items: center; justify-content: center; }

/* footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 28px 0; font-size: .9rem; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }
.site-footer nav { display: flex; gap: 8px 16px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }
.prose { max-width: 760px; padding-bottom: 48px; }

/* figures */
figure { margin: 1.5em 0; }
figure svg, figure img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
figcaption { font-size: .88rem; color: var(--muted); margin-top: 6px; }
