/* ToolsCloset — one shared stylesheet for every page */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1c2230;
  --muted: #5b6475;
  --border: #e2e5eb;
  --brand: #2f6fed;
  --brand-dark: #1f55c4;
  --brand-soft: #e8f0ff;
  --good: #1f9d55;
  --warn: #d9822b;
  --bad: #d64545;
  --under: #3b8fd9;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 30, 50, .06), 0 4px 16px rgba(20, 30, 50, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151c;
    --surface: #1a2029;
    --text: #e7eaf0;
    --muted: #9aa3b2;
    --border: #2c3441;
    --brand: #6b9bff;
    --brand-dark: #8fb3ff;
    --brand-soft: #1f2b44;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
img, svg { max-width: 100%; }
.wrap { max-width: 1040px; 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: 12px; }
.logo { font-weight: 800; font-size: 1.25rem; text-decoration: none; color: var(--text); letter-spacing: -.02em; }
.logo span { color: var(--brand); }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; color: var(--text); font-size: 1rem; cursor: pointer; }
.site-nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; flex-wrap: wrap; }
.site-nav a { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: .95rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; width: 100%; }
  .site-nav.open { display: block; }
  .site-header .wrap { flex-wrap: wrap; }
  .site-nav ul { flex-direction: column; padding-bottom: 10px; }
}

/* Breadcrumbs */
.breadcrumbs { font-size: .875rem; color: var(--muted); margin: 18px 0 0; }
.breadcrumbs a { color: var(--muted); }

/* Headings & text */
h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.2; margin: 12px 0 8px; letter-spacing: -.02em; }
h2 { font-size: 1.45rem; line-height: 1.3; margin: 40px 0 12px; }
h3 { font-size: 1.15rem; margin: 24px 0 8px; }
.lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 20px; max-width: 70ch; }
.content p, .content li { max-width: 75ch; }
.updated { font-size: .85rem; color: var(--muted); }

/* Tool card */
.tool {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin: 20px 0 28px;
}
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 760px) { .tool-grid { grid-template-columns: 1fr; } }
.field { margin-bottom: 14px; }
.field label, .label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
input, select {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.unit-wrap { position: relative; }
.unit-wrap input { padding-right: 44px; }
.unit-wrap .unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .9rem; pointer-events: none; }
.tabs { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 3px; margin-bottom: 16px; }
.tabs button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; font: inherit; font-size: .92rem; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.btn {
  display: inline-block; border: 0; border-radius: 8px; padding: 11px 18px; font: inherit; font-weight: 600;
  background: var(--brand); color: #fff; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--brand-dark); color: #fff; }
.btn-ghost { background: none; color: var(--brand); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--brand-soft); color: var(--brand); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.error { color: var(--bad); font-size: .9rem; min-height: 1.2em; margin: 6px 0 0; }

/* Results */
.result { background: var(--brand-soft); border-radius: var(--radius); padding: 18px; min-height: 100%; }
.result .big { font-size: 2.6rem; font-weight: 800; line-height: 1.1; margin: 4px 0; }
.result .tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: .9rem; color: #fff; }
.result dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 14px 0 0; }
.result dt { color: var(--muted); }
.result dd { margin: 0; font-weight: 600; }
.placeholder { color: var(--muted); }
.scale { position: relative; height: 12px; border-radius: 6px; margin: 16px 0 6px;
  background: linear-gradient(90deg, var(--under) 0 14%, var(--good) 14% 40%, var(--warn) 40% 60%, var(--bad) 60% 100%); }
.scale .pin { position: absolute; top: -5px; width: 4px; height: 22px; background: var(--text); border-radius: 2px; transform: translateX(-2px); transition: left .3s; }
.scale-labels { position: relative; height: 1.2em; font-size: .75rem; color: var(--muted); }
.scale-labels span { position: absolute; transform: translateX(-50%); }
.scale-labels span:first-child { transform: none; }
.scale-labels span:last-child { transform: translateX(-100%); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; margin: 10px 0 18px; background: var(--surface); font-size: .95rem; }
th, td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; vertical-align: top; }
th { background: var(--brand-soft); }
.courses td { padding: 6px; }
.courses input, .courses select { padding: 8px; }
.courses .del { background: none; border: 0; color: var(--muted); font-size: 1.2rem; cursor: pointer; padding: 4px 8px; }
.courses .del:hover { color: var(--bad); }

/* Info boxes */
.note { border-left: 4px solid var(--brand); background: var(--surface); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 18px 0; }
.note.warn { border-color: var(--warn); }
.formula { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; overflow-x: auto; }

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; margin: 10px 0; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: 10px 0 0; }

/* Cards on home and "related tools" */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 16px 0; }
.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; }
.card:hover { border-color: var(--brand); transform: translateY(-2px); color: var(--text); }
.card .ico { font-size: 1.6rem; }
.card h3 { margin: 8px 0 4px; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: .92rem; }
.hero { padding: 36px 0 8px; }

/* Ad slots: reserve space so ads don't push content around (good for Core Web Vitals) */
.ad-slot { min-height: 100px; margin: 24px 0; }
.ad-slot:empty { display: none; }

/* Footer */
.site-footer { margin-top: 56px; border-top: 1px solid var(--border); background: var(--surface); padding: 28px 0; font-size: .92rem; color: var(--muted); }
.site-footer ul { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-footer a { color: var(--muted); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
