/* ============================================================
   LeanGauge — shared stylesheet
   ============================================================ */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eceef2;
  --ink: #171a21;
  --ink-2: #4a5160;
  --ink-3: #7c8494;
  --line: #dfe3ea;
  --accent: #e8631a;
  --accent-soft: #fbe6d7;
  --cut: #2f9e73;
  --maintain: #c8912b;
  --surplus: #d1495b;
  --shadow: 0 1px 2px rgba(20,26,33,.05), 0 8px 24px rgba(20,26,33,.06);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101319; --surface: #191d26; --surface-2: #21262f; --ink: #eef1f6;
    --ink-2: #b3bccb; --ink-3: #7f8798; --line: #2b313c; --accent: #ff7a33;
    --accent-soft: #3a2317; --cut: #3fbe8c; --maintain: #e0b34a; --surplus: #e46374;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  }
}
:root[data-theme="light"] {
  --bg: #f4f5f7; --surface: #fff; --surface-2: #eceef2; --ink: #171a21;
  --ink-2: #4a5160; --ink-3: #7c8494; --line: #dfe3ea; --accent: #e8631a;
  --accent-soft: #fbe6d7; --cut: #2f9e73; --maintain: #c8912b; --surplus: #d1495b;
  --shadow: 0 1px 2px rgba(20,26,33,.05), 0 8px 24px rgba(20,26,33,.06);
}
:root[data-theme="dark"] {
  --bg: #101319; --surface: #191d26; --surface-2: #21262f; --ink: #eef1f6;
  --ink-2: #b3bccb; --ink-3: #7f8798; --line: #2b313c; --accent: #ff7a33;
  --accent-soft: #3a2317; --cut: #3fbe8c; --maintain: #e0b34a; --surplus: #e46374;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); line-height: 1.55; -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
a { color: var(--accent); }

/* header */
header { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; font-size: 19px; text-decoration: none; color: var(--ink); }
.logo .mark {
  width: 26px; height: 26px; border-radius: 7px; position: relative;
  background: conic-gradient(from 220deg, var(--cut), var(--maintain), var(--surplus) 75%, var(--surface-2) 75%);
}
.logo .mark::after { content: ""; position: absolute; inset: 5px; border-radius: 4px; background: var(--surface); }
.logo b { color: var(--accent); }
nav a { color: var(--ink-2); text-decoration: none; font-size: 14px; margin-left: 18px; }
nav a:hover { color: var(--ink); }

/* breadcrumb + hero */
.crumb { font-size: 13px; color: var(--ink-3); padding: 18px 0 0; }
.crumb a { color: var(--ink-3); text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.hero { padding: 14px 0 8px; }
.hero h1 { font-size: clamp(28px, 4vw, 42px); line-height: 1.08; letter-spacing: -.03em; margin: 0 0 10px; text-wrap: balance; }
.hero p { color: var(--ink-2); max-width: 62ch; margin: 0; font-size: 17px; }

/* ad slots */
.ad {
  border: 1px dashed var(--line); border-radius: 10px; background: var(--surface-2);
  color: var(--ink-3); font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.ad-leaderboard { min-height: 90px; margin: 22px 0; }
.ad-rect { min-height: 250px; max-width: 336px; margin: 0 auto 28px; }

/* calculator layout */
.calc { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 8px 0 28px; }
@media (max-width: 760px) { .calc { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card h2 { margin: 0 0 18px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
input[type="number"], select {
  width: 100%; padding: 11px 12px; font-size: 15px; font-family: var(--font);
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 9px; -webkit-appearance: none; appearance: none;
}
input[type="number"]:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237c8494' d='M6 8 0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--ink-2); font-family: var(--font); font-size: 13px; font-weight: 600; padding: 7px 14px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--accent); color: #fff; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.toprow { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

/* results */
.result-wrap { display: flex; flex-direction: column; align-items: center; }
.big { font-size: 56px; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); }
.big-unit { font-size: 14px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em; margin-top: 6px; }
.big-label { font-size: 13px; color: var(--ink-2); margin-top: 2px; text-align: center; }
canvas { max-width: 100%; height: auto; }

.goals { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 18px; width: 100%; }
.goal { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.goal .g-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 9px; }
.goal .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.goal .g-cal { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 16px; }
.goal .g-cal small { color: var(--ink-3); font-weight: 500; font-size: 12px; }

.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 10px; }
.macro { text-align: center; padding: 16px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.macro .m-val { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.macro .m-val small { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.macro .m-name { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-top: 3px; }
.macro.p .m-val { color: var(--surplus); }
.macro.c .m-val { color: var(--maintain); }
.macro.f .m-val { color: var(--cut); }
.note { font-size: 12px; color: var(--ink-3); text-align: center; margin: 12px 0 0; }

/* affiliate */
.aff { margin-top: 16px; padding: 16px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent-soft); display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.aff p { margin: 0; font-size: 14px; color: var(--ink); }
.aff a { background: var(--accent); color: #fff; text-decoration: none; font-weight: 700; font-size: 14px; padding: 10px 18px; border-radius: 9px; white-space: nowrap; }
.aff .tag { font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .1em; }

/* content / SEO */
.content { max-width: 72ch; margin: 40px auto; }
.content h2 { font-size: 24px; letter-spacing: -.02em; margin: 34px 0 12px; }
.content h3 { font-size: 17px; margin: 24px 0 6px; }
.content p { color: var(--ink-2); margin: 0 0 14px; }
details { border-top: 1px solid var(--line); padding: 14px 0; }
details summary { cursor: pointer; font-weight: 600; font-size: 16px; }
details p { margin-top: 10px; }

/* related tools grid (homepage + cross-links) */
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin: 24px 0 8px; }
.tool { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; transition: transform .12s ease, border-color .12s ease; }
.tool:hover { transform: translateY(-2px); border-color: var(--accent); }
.tool .t-ic { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 18px; margin-bottom: 12px; }
.tool h3 { margin: 0 0 4px; font-size: 17px; letter-spacing: -.01em; }
.tool p { margin: 0; font-size: 13px; color: var(--ink-3); }

footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 40px; }
.foot { padding: 26px 0; color: var(--ink-3); font-size: 13px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.foot a { color: var(--ink-3); }
.disc { max-width: 60ch; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
