:root {
  --paper: #f6f8fb;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #5b6475;
  --line: #e2e7ef;
  --accent: #1d4ed8;
  --accent-ink: #fff;
  --accent-soft: #eef3ff;
  --gold: #f97316;
  --err: #c2410c;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(28, 38, 34, 0.04), 0 8px 24px -12px rgba(28, 38, 34, 0.18);
  --serif: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light only;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--sans); }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
img, svg { display: block; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin: 0.2em 0 0.3em; }
h2 { font-size: 1.45rem; margin: 2rem 0 0.6rem; }
h3 { font-size: 1.1rem; margin: 1.2rem 0 0.4rem; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--card); padding: 8px 12px; z-index: 10; }

/* header */
.site-head { border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px); }
.site-head .wrap { display: flex; align-items: center; gap: 18px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
.logo-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 1.05rem; font-weight: 800; }
.logo em { color: var(--accent); font-style: normal; }
.icon-btn { background: none; border: 1px solid var(--line); color: var(--ink); width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

/* layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; padding-top: 26px; padding-bottom: 60px; }
.sidebar { position: relative; }
.sticky { position: sticky; top: 84px; display: grid; gap: 22px; }
@media (max-width: 1020px) { .layout { grid-template-columns: minmax(0, 1fr); } .sidebar .ad { display: none; } }
.crumbs { font-size: 0.85rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.lede { font-size: 1.1rem; color: var(--muted); margin: 0 0 1.4rem; max-width: 62ch; }
.prose { max-width: 70ch; }
.prose p { margin: 0 0 1em; }

/* calculator */
.calc-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
@media (max-width: 860px) { .calc-card { grid-template-columns: 1fr; } }
#calc { padding: 24px; display: grid; gap: 14px; align-content: start; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 5px; }
.field .hint { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.control { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper); overflow: hidden; transition: border-color 0.15s; }
.control:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.control input, .control select, .control textarea { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 1rem; padding: 10px 12px; outline: none; font-variant-numeric: tabular-nums; }
.control textarea { min-height: 120px; resize: vertical; }
.control .unit { display: flex; align-items: center; padding: 0 12px; color: var(--muted); font-size: 0.9rem; border-left: 1px solid var(--line); background: var(--card); white-space: nowrap; }
.control .unit.pre { order: -1; border-left: 0; border-right: 1px solid var(--line); }
.actions { display: flex; gap: 10px; margin-top: 2px; }
.actions .btn-ghost { font-weight: 500; font-size: 0.9rem; color: var(--muted); }
.actions .btn-ghost:hover { color: var(--accent); }
.btn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 11px 20px; font: 600 1rem var(--sans); cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 14px; font: 600 0.9rem var(--sans); cursor: pointer; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
#results { background: var(--accent-soft); padding: 24px; border-left: 1px solid var(--line); min-height: 200px; }
@media (max-width: 860px) { #results { border-left: 0; border-top: 1px solid var(--line); } }
.res-main { margin-bottom: 14px; }
.res-label { display: block; font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.res-value { display: block; font-family: var(--serif); font-size: clamp(1.7rem, 3.6vw, 2.3rem); font-weight: 800; letter-spacing: -0.02em; color: var(--accent); line-height: 1.2; font-variant-numeric: tabular-nums; word-break: break-word; }
.res-list { margin: 0; display: grid; gap: 0; }
.res-list > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-top: 1px dashed color-mix(in srgb, var(--accent) 30%, transparent); }
.res-list dt { color: var(--muted); font-size: 0.92rem; }
.res-list dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; white-space: pre-line; }
.res-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.res-msg { color: var(--muted); }
.res-msg.err { color: var(--err); font-weight: 600; }
.formula { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: 10px; padding: 14px 18px; }
.formula p:last-child { margin-bottom: 0; }
table.conv { border-collapse: collapse; width: 100%; max-width: 480px; font-variant-numeric: tabular-nums; background: var(--card); border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
table.conv th, table.conv td { padding: 8px 14px; text-align: left; border-bottom: 1px solid var(--line); }
table.conv th { background: var(--accent-soft); font-size: 0.85rem; }
details.faq { border-bottom: 1px solid var(--line); padding: 12px 0; }
details.faq summary { cursor: pointer; font-weight: 600; }
details.faq p { margin: 8px 0 0; }

/* cards & grids */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; text-decoration: none; color: var(--ink); transition: transform 0.12s, border-color 0.12s; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card b { display: block; font-family: var(--serif); font-size: 1rem; font-weight: 700; margin-bottom: 3px; color: var(--ink); }
.card span { font-size: 0.88rem; color: var(--muted); line-height: 1.45; display: block; }
.side-box { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.side-box h3 { margin: 0 0 8px; font-size: 1rem; }
.side-box ul { list-style: none; margin: 0; padding: 0; }
.side-box li { padding: 5px 0; border-top: 1px solid var(--line); font-size: 0.92rem; }
.side-box li:first-child { border-top: 0; }

/* home */
.hero { padding-top: 54px; padding-bottom: 30px; text-align: center; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); margin: 0 0 10px; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero p { color: var(--muted); font-size: 1.15rem; margin: 0 auto 26px; max-width: 54ch; }
.searchbox { max-width: 560px; margin: 0 auto; position: relative; }
.searchbox input { width: 100%; font: inherit; font-size: 1.1rem; padding: 16px 20px 16px 50px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); box-shadow: var(--shadow); outline: none; }
.searchbox input:focus { border-color: var(--accent); }
.searchbox svg { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.cats-unused { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 26px 0 0; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none; font-size: 0.92rem; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.cat-block { margin: 34px 0; }
.cat-block .head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; border-bottom: 2px solid var(--accent); padding-bottom: 6px; margin-bottom: 14px; }
.cat-block h2 { margin: 0; }
.cat-block .head a { font-size: 0.9rem; font-weight: 600; }

/* ads */
.ad { display: block; text-align: center; margin: 26px 0; min-height: 90px; }
.ad-label { font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.ad-ph { border: 1.5px dashed var(--line); border-radius: 10px; color: var(--muted); display: grid; place-items: center; font-size: 0.85rem; background: repeating-linear-gradient(45deg, transparent 0 10px, color-mix(in srgb, var(--line) 35%, transparent) 10px 20px); }
.ad-top .ad-ph, .ad-bottom .ad-ph, .ad-mid .ad-ph { height: 100px; }
.ad-side { margin: 0; }
.ad-side .ad-ph { height: 600px; }

/* footer */
.site-foot { border-top: 1px solid var(--line); padding: 36px 0 50px; color: var(--muted); font-size: 0.9rem; }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 30px; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr; } }
.site-foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-foot a { color: var(--muted); }
.site-foot select { font: inherit; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.foot-title { color: var(--ink); font-weight: 600; margin-bottom: 8px; }
[hidden] { display: none !important; }

.res-table { margin-top: 16px; }
.res-scroll { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--card); margin-top: 6px; }
.res-table table { border-collapse: collapse; width: 100%; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.res-table th, .res-table td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.res-table th { position: sticky; top: 0; background: var(--accent-soft); }
.res-table th:first-child, .res-table td:first-child { text-align: left; }
/* category mega menu */
.catmenu { position: relative; margin-left: auto; }
.catmenu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: 0.95rem; }
.catmenu summary::-webkit-details-marker { display: none; }
.catmenu summary:hover, .catmenu[open] summary { background: var(--accent-soft); color: var(--accent); }
.catmenu .panel { position: absolute; right: 0; top: calc(100% + 8px); width: min(640px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px; z-index: 20; }
.catmenu .panel a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 0.93rem; }
.catmenu .panel a:hover, .catmenu .panel a[aria-current] { background: var(--accent-soft); color: var(--accent); }
.catmenu .panel a small { color: var(--muted); margin-left: auto; }
.head-search { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 0 10px; height: 38px; color: var(--muted); }
.head-search input { border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 0.92rem; width: 200px; outline: none; padding: 0 6px; }
@media (max-width: 760px) { .head-search { display: none; } }

@media (max-width: 560px) {
  .site-head .wrap { gap: 8px; padding: 0 14px; }
  .logo { font-size: 1.08rem; gap: 8px; }
  .logo-mark { width: 30px; height: 30px; }
  .catmenu summary { padding: 8px; }
  .catmenu summary .lbl { display: none; }
  .catmenu .panel { position: fixed; left: 12px; right: 12px; top: 70px; width: auto; max-height: calc(100vh - 90px); overflow: auto; grid-template-columns: 1fr 1fr; }
}

/* home layout */
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 6px 12px; border-radius: 999px; margin: 0 0 18px; }
.badges { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; padding: 0; margin: 20px 0 0; color: var(--muted); font-size: 0.92rem; }
.badges li { display: inline-flex; align-items: center; gap: 6px; }
.badges svg { color: var(--accent); }
.muted-note { color: var(--muted); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.cat-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; display: flex; flex-direction: column; transition: border-color 0.15s, box-shadow 0.15s; }
.cat-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.cat-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cat-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.cat-count { font-size: 0.78rem; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 3px 10px; border-radius: 999px; }
.cat-card h3 { margin: 0 0 4px; font-size: 1.15rem; }
.cat-card h3 a { color: var(--ink); text-decoration: none; }
.cat-card p { margin: 0 0 10px; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.cat-card ul { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 2px; }
.cat-card li a { font-size: 0.92rem; color: var(--ink); text-decoration: none; display: block; padding: 3px 0; }
.cat-card li a:hover { color: var(--accent); text-decoration: underline; }
.cat-more { margin-top: auto; font-weight: 600; font-size: 0.9rem; text-decoration: none; }
.why, .steps, .home-faq { margin: 54px 0; }
.why h2, .steps h2, .home-faq h2 { margin: 0 0 18px; }
.why-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.why-grid > div { background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 12px; padding: 18px 20px; }
.why-grid b { font-family: var(--serif); font-size: 1.05rem; }
.why-grid p { margin: 6px 0 0; color: var(--muted); font-size: 0.93rem; }
.steps ol { list-style: none; counter-reset: s; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; padding: 0; margin: 0; }
.steps li { counter-increment: s; display: flex; flex-direction: column; gap: 4px; padding: 18px 20px 18px 66px; position: relative; background: var(--accent-soft); border-radius: 12px; }
.steps li::before { content: counter(s); position: absolute; left: 18px; top: 16px; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; display: grid; place-items: center; font-family: var(--serif); }
.steps span { color: var(--muted); font-size: 0.93rem; }
.home-faq { max-width: 760px; }
.cta { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; background: var(--accent); color: #fff; border-radius: 18px; padding: 28px 32px; margin: 54px 0 70px; }
.cta h2 { margin: 0 0 4px; color: #fff; }
.cta p { margin: 0; opacity: 0.9; }
.btn-light { background: #fff; color: var(--accent); text-decoration: none; display: inline-block; }
#search-results { margin: 10px 0 40px; }
#search-results .head { border-bottom: 2px solid var(--accent); padding-bottom: 6px; margin-bottom: 14px; }
#search-results h2 { margin: 0; }
/* hide ad spaces Google leaves unfilled (e.g. before approval) */
.ad:has(ins.adsbygoogle[data-ad-status="unfilled"]) { display: none; }
.ad ins.adsbygoogle:not([data-ad-status]) { min-height: 90px; }
.ad { min-height: 0; }
