/* TankMath — shared styles */
:root {
  --bg: #f6f9fa;
  --surface: #ffffff;
  --surface-2: #eef4f6;
  --text: #13252b;
  --muted: #55707a;
  --border: #d6e2e6;
  --accent: #0b7a8a;
  --accent-strong: #075f6c;
  --accent-soft: #dff1f3;
  --warn-bg: #fff6e0;
  --warn-border: #f0c96a;
  --ok: #1f7a4d;
  --bad: #b3261e;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(19, 37, 43, .06), 0 4px 16px rgba(19, 37, 43, .05);
  --max: 1080px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1719;
    --surface: #132124;
    --surface-2: #1a2c30;
    --text: #e3eef0;
    --muted: #9bb3ba;
    --border: #27403f;
    --accent: #3fc1cf;
    --accent-strong: #6fd6e0;
    --accent-soft: #163a3f;
    --warn-bg: #2f2814;
    --warn-border: #7a6224;
    --ok: #5fd39a;
    --bad: #ff8a80;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
h1, h2, h3 { line-height: 1.25; margin: 1.6em 0 .5em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); margin-top: .4em; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.12rem; }
p, ul, ol { margin: 0 0 1em; }
code, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .92em; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 16px; }
.brand { font-weight: 800; font-size: 1.25rem; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 18px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.nav a:hover { color: var(--accent); }

/* Breadcrumb */
.crumbs { font-size: .88rem; color: var(--muted); margin: 18px 0 0; }
.crumbs a { color: var(--muted); }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 32px; align-items: start; }
@media (max-width: 880px) { .layout { grid-template-columns: 1fr; } }
.lede { font-size: 1.08rem; color: var(--muted); margin-bottom: 1.4em; }

/* Calculator card */
.calc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin: 0 0 28px;
}
.calc h2 { margin-top: 0; font-size: 1.15rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 14px; }
.field label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 4px; }
.field .hint { display: block; font-size: .8rem; color: var(--muted); margin-top: 3px; }
input[type="number"], input[type="text"], input[type="email"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 14px; flex-wrap: wrap; }
.seg button {
  font: inherit; font-size: .9rem; padding: 7px 14px; border: 0; background: var(--bg); color: var(--muted); cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .seg button[aria-pressed="true"] { color: #062026; } }
.btn {
  display: inline-block; font: inherit; font-weight: 600; padding: 10px 18px; border-radius: 8px; border: 0;
  background: var(--accent); color: #fff; cursor: pointer; text-decoration: none;
}
@media (prefers-color-scheme: dark) { .btn { color: #062026; } }
.btn:hover { background: var(--accent-strong); color: #fff; }

/* Results */
.result { background: var(--accent-soft); border-radius: 10px; padding: 16px 18px; margin-top: 6px; }
.result-main { font-size: 1.6rem; font-weight: 800; line-height: 1.2; }
.result-main small { font-size: .95rem; font-weight: 600; color: var(--muted); }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.result-grid div { background: var(--surface); border-radius: 8px; padding: 8px 10px; }
.result-grid b { display: block; font-size: 1.05rem; }
.result-grid span { font-size: .8rem; color: var(--muted); }
.result-note { font-size: .88rem; color: var(--muted); margin: 10px 0 0; }
.status-ok { color: var(--ok); font-weight: 700; }
.status-bad { color: var(--bad); font-weight: 700; }

.callout { background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: 10px; padding: 12px 16px; font-size: .95rem; margin: 1em 0; }

/* Content */
article table { width: 100%; border-collapse: collapse; margin: 0 0 1.2em; font-size: .95rem; display: block; overflow-x: auto; }
article th, article td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
article th { background: var(--surface-2); }
.formula { background: var(--surface-2); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 6px; font-family: ui-monospace, Consolas, monospace; font-size: .92rem; overflow-x: auto; margin: 0 0 1em; }
details { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; background: var(--surface); }
details summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: 6px; }
.sources { font-size: .88rem; color: var(--muted); }
.updated { font-size: .85rem; color: var(--muted); }

/* Sidebar */
.side { position: sticky; top: 16px; }
@media (max-width: 880px) { .side { position: static; } }
.side-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.side-box h3 { margin: 0 0 8px; font-size: 1rem; }
.side-box ul { list-style: none; padding: 0; margin: 0; }
.side-box li { padding: 5px 0; border-bottom: 1px solid var(--border); font-size: .93rem; }
.side-box li:last-child { border-bottom: 0; }
.side-box a { text-decoration: none; }
.side-box a[aria-current="page"] { font-weight: 700; color: var(--text); }

/* Ad slots: keep space reserved to avoid layout shift once AdSense is added */
.ad-slot { min-height: 0; margin: 20px 0; }

/* Home grid */
.hero { padding: 36px 0 12px; }
.hero p { font-size: 1.12rem; color: var(--muted); max-width: 680px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin: 20px 0 40px; }
.tool-card {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); color: var(--text); }
.tool-card h3 { margin: 0 0 6px; font-size: 1.05rem; color: var(--accent); }
.tool-card p { margin: 0; font-size: .92rem; color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 48px; padding: 28px 0; font-size: .9rem; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.site-footer a { color: var(--muted); margin-right: 14px; }
.disclaimer { flex-basis: 100%; font-size: .82rem; }
