/* kaalustalla.ee — mobile-first, system fonts, zero external assets */
:root {
  --bg: #ffffff; --bg2: #f4f7f5; --text: #1a2b23; --muted: #5b6f64;
  --accent: #0e7a55; --accent2: #0a5c40; --border: #dde5e0;
  --ok: #0e7a55; --warn: #b97a08; --bad: #b3372b; --info: #2b6cb0;
  --radius: 12px; --maxw: 46rem;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #101814; --bg2: #182219; --text: #e8f0ea; --muted: #9db3a6; --border: #2a3a30; --accent: #35b285; --accent2: #6fd0aa; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1rem; }
a { color: var(--accent); }
h1 { font-size: 1.55rem; line-height: 1.25; margin: .9rem 0 .35rem; }
h2 { font-size: 1.25rem; margin: 1.8rem 0 .5rem; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 .4rem; }
p, li { max-width: 65ch; }
.lead { color: var(--muted); margin-top: 0; }

/* Header */
header.site { border-bottom: 1px solid var(--border); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; padding: .6rem 1rem; }
.logo { font-weight: 700; text-decoration: none; color: var(--text); font-size: 1.05rem; }
.logo span { color: var(--accent); }
.langsw { font-size: .85rem; text-decoration: none; padding: .35rem .6rem; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); }
nav.tools { display: flex; gap: .5rem; overflow-x: auto; margin: .25rem 0 1rem; padding-bottom: .3rem; scrollbar-width: none; }
nav.tools::-webkit-scrollbar { display: none; }
nav.tools a { white-space: nowrap; font-size: .85rem; text-decoration: none; color: var(--muted); border: 1px solid var(--border); padding: .3rem .7rem; border-radius: 999px; }
nav.tools a[aria-current="page"] { color: var(--accent); border-color: var(--accent); font-weight: 600; }

/* Calculator card */
.calc { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin: 1rem 0 1.25rem; }
.calc .grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.calc label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: .25rem; }
.calc input[type="number"], .calc select {
  width: 100%; padding: .7rem .75rem; font-size: 1.05rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; min-height: 48px;
}
.calc input:focus, .calc select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.seg { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; padding: .7rem; font-size: 1rem; background: var(--bg); color: var(--muted); border: 0; min-height: 48px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 600; }
.full { grid-column: 1 / -1; }

/* Result — space always reserved: zero CLS */
.result { min-height: 8.5rem; margin-top: 1rem; padding: 1rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.result .big { font-size: 2.1rem; font-weight: 800; line-height: 1.1; }
.result .cat { font-weight: 700; }
.result .cat.ok { color: var(--ok); } .result .cat.warn { color: var(--warn); }
.result .cat.bad { color: var(--bad); } .result .cat.info { color: var(--info); }
.result .sub { color: var(--muted); font-size: .9rem; margin-top: .35rem; }
.result table { width: 100%; border-collapse: collapse; margin-top: .5rem; font-size: .95rem; }
.result td { padding: .3rem 0; border-bottom: 1px solid var(--border); }
.result td:last-child { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* BMI scale bar */
.scale { position: relative; height: 14px; border-radius: 7px; margin: .8rem 0 .3rem;
  background: linear-gradient(90deg, #4aa3df 0 15%, #35b285 15% 47%, #e0a92e 47% 70%, #cf5b4c 70% 100%); }
.scale .dot { position: absolute; top: -5px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--text); border: 3px solid var(--bg); transform: translateX(-12px); transition: left .25s; }
.scale-labels { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); }

.actions { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }
.actions button { font-size: .85rem; padding: .5rem .9rem; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--muted); cursor: pointer; }

/* Content */
article { padding-bottom: 2rem; }
details { border: 1px solid var(--border); border-radius: 10px; padding: .7rem .9rem; margin: .5rem 0; }
details summary { font-weight: 600; cursor: pointer; }
details[open] summary { margin-bottom: .4rem; }
table.data { width: 100%; border-collapse: collapse; margin: .8rem 0; font-size: .95rem; }
table.data th, table.data td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--border); }
table.data th { font-size: .8rem; color: var(--muted); }
.note { background: var(--bg2); border-left: 3px solid var(--accent); padding: .6rem .9rem; border-radius: 0 8px 8px 0; font-size: .92rem; }
.reviewed { display: flex; gap: .5rem; align-items: center; color: var(--muted); font-size: .85rem; margin: .5rem 0 1rem; }

/* Back-to-calc pill */
#topill { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff;
  text-decoration: none; padding: .5rem 1rem; border-radius: 999px; font-size: .85rem; box-shadow: 0 2px 10px rgb(0 0 0 / .2);
  opacity: 0; pointer-events: none; transition: opacity .2s; }
#topill.show { opacity: 1; pointer-events: auto; }

/* Home tool cards */
.cards { display: grid; grid-template-columns: 1fr; gap: .75rem; padding: 0; margin: 1rem 0; list-style: none; }
.cards a { display: block; text-decoration: none; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; }
.cards a:active { background: var(--bg2); }
.cards b { color: var(--accent); }
.cards small { color: var(--muted); display: block; margin-top: .15rem; }

footer.site { border-top: 1px solid var(--border); margin-top: 2rem; padding: 1.25rem 0 2rem; color: var(--muted); font-size: .85rem; }
footer.site nav { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: .75rem; }
footer.site a { color: var(--muted); }
.disclaimer { font-size: .8rem; }

@media (min-width: 640px) {
  h1 { font-size: 1.9rem; }
  .cards { grid-template-columns: 1fr 1fr; }
  .calc .grid { grid-template-columns: 1fr 1fr 1fr; }
  .calc .grid.two { grid-template-columns: 1fr 1fr; }
}
@media print {
  header.site, footer.site, .calc, #topill { display: none; }
}
