/* =============================================================
   LeaseMathHub — styles.css
   1. Tokens · 2. Reset · 3. Utilities · 4. Typography
   5. Components · 6. Sections · 7. Effects · 8. Responsive
   ============================================================= */

@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('assets/fonts/source-sans-3-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url('assets/fonts/source-serif-4-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* 1. Tokens ---------------------------------------------------- */
:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-2: #eef3f0;
  --ink: #0f1a16;
  --muted: #4c5c55;
  --line: #d6e0db;
  --accent: #0c7457;
  --accent-ink: #ffffff;
  --accent-soft: #dff2ea;
  --warn: #8a5100;
  --warn-soft: #fff1d9;
  --bad: #b3261e;
  --bad-soft: #fde9e7;
  --good: #0c7457;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 26, 22, .06), 0 10px 30px rgba(15, 26, 22, .07);
  --sans: "Source Sans 3", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --wrap: 1100px;
}
/* Dark theme: explicit choice, or system preference when no choice was made */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1311;
  --surface: #151e1a;
  --surface-2: #1b2622;
  --ink: #ecf3ef;
  --muted: #a9bab3;
  --line: #2a3832;
  --accent: #45d0a0;
  --accent-ink: #04201a;
  --accent-soft: #163128;
  --warn: #f3b860;
  --warn-soft: #2e2413;
  --bad: #ff8f85;
  --bad-soft: #3a1c1a;
  --good: #45d0a0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .3);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1311;
    --surface: #151e1a;
    --surface-2: #1b2622;
    --ink: #ecf3ef;
    --muted: #a9bab3;
    --line: #2a3832;
    --accent: #45d0a0;
    --accent-ink: #04201a;
    --accent-soft: #163128;
    --warn: #f3b860;
    --warn-soft: #2e2413;
    --bad: #ff8f85;
    --bad-soft: #3a1c1a;
    --good: #45d0a0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .3);
  }
}

/* 2. Reset ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select { font: inherit; color: inherit; }
a { color: var(--accent); }
p { text-wrap: pretty; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; line-height: 1.15; letter-spacing: -0.01em; }
body { transition: background-color .25s var(--ease-out), color .25s var(--ease-out); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* 3. Utilities ------------------------------------------------- */
.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  padding: .6rem 1rem; background: var(--surface); color: var(--ink);
  border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 1rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

/* 4. Typography ------------------------------------------------ */
h1 { font-size: clamp(1.8rem, 4.8vw, 2.6rem); font-weight: 700; }
h2 { font-size: clamp(1.3rem, 3vw, 1.65rem); font-weight: 750; margin: 2.2rem 0 .8rem; }
h3 { font-size: 1.1rem; font-weight: 700; margin: 1.4rem 0 .5rem; }
.prose p, .prose ul, .prose ol { margin-bottom: 1rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: .35rem; }
.formula {
  font-family: var(--mono); font-size: .92rem;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  padding: .8rem 1rem; border-radius: var(--radius-sm);
  overflow-x: auto; white-space: pre-wrap; margin-bottom: 1rem;
}
.prose table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; font-size: .95rem; }
.prose th, .prose td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.prose th { font-weight: 650; }

/* 5. Components ------------------------------------------------ */
/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 60px; }
.logo { display: flex; align-items: center; gap: .55rem; font-family: var(--display); font-size: 1.2rem; font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.logo svg { width: 28px; height: 28px; }
.logo span b { color: var(--accent); }
.nav { display: flex; gap: 1rem; font-size: .95rem; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }

/* Hero */
.hero { padding: 1.4rem 0 .6rem; }
.hero p.sub { color: var(--muted); margin-top: .4rem; max-width: 62ch; }

/* Tool card */
.tool-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem; margin-top: 1rem;
  display: grid; gap: 1.2rem;
}
.tool-form { display: grid; gap: .8rem; grid-template-columns: 1fr; }
.field > label, .field-head { min-height: 34px; display: flex; align-items: flex-end; }
.field { display: grid; gap: .25rem; min-width: 0; align-content: start; }
.field.full { grid-column: 1 / -1; }
.field label, .field .label { font-size: .92rem; font-weight: 650; color: var(--ink); }
.field small { font-size: .84rem; color: var(--muted); line-height: 1.45; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .pre, .input-wrap .post {
  position: absolute; color: var(--muted); font-size: .9rem; pointer-events: none;
}
.input-wrap .pre { left: .7rem; }
.input-wrap .post { right: .7rem; }
.input-wrap input[type="number"] { padding-left: 1.6rem; }
.input-wrap.has-post input[type="number"] { padding-right: 2.6rem; }
.input-wrap.no-pre input[type="number"] { padding-left: .7rem; }
input[type="number"], input[type="text"], select {
  width: 100%; min-height: 44px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .55rem .7rem;
  font-size: 1.05rem; font-weight: 500; font-variant-numeric: tabular-nums;
  transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[aria-invalid="true"] { border-color: var(--bad); }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { margin: 0; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { padding: .35rem .7rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.field-head { justify-content: space-between; gap: .5rem; }
.field-head label { padding-bottom: 2px; }

/* Result */
.result {
  background: var(--accent-soft); border-radius: var(--radius-sm);
  padding: 1rem; display: grid; gap: .8rem;
}
.result-main { display: grid; gap: .1rem; }
.result-main .label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.result-main .big { font-family: var(--sans); font-size: clamp(2.2rem, 8vw, 3rem); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.result-main .big small { font-size: 1rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.result-list { display: grid; gap: .3rem; list-style: none; padding: 0; font-size: .97rem; }
.result-list li { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px dashed var(--line); padding: .25rem 0; }
.result-list li:last-child { border-bottom: 0; }
.result-list b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.verdict { padding: .7rem .9rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .95rem; background: var(--surface); }
.verdict.good { color: var(--good); }
.verdict.bad { color: var(--bad); background: var(--bad-soft); }
.verdict.warn { color: var(--warn); background: var(--warn-soft); }
.error-msg { color: var(--bad); font-size: .9rem; font-weight: 600; }
.error-msg:empty { display: none; }

.bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--line); }
.bar span { display: block; height: 100%; transition: width .4s var(--ease-out); }
.bar .b1 { background: var(--accent); }
.bar .b2 { background: #e0a43a; }
.bar .b3 { background: #7c8e86; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .8rem; color: var(--muted); list-style: none; padding: 0; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }

.tool-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 40px; padding: .5rem 1rem; border-radius: var(--radius-sm);
  font-weight: 650; font-size: .9rem; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out);
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.privacy-badge { font-size: .85rem; color: var(--muted); display: flex; gap: .45rem; align-items: flex-start; }
.privacy-badge svg { width: 16px; height: 16px; flex: none; margin-top: 3px; color: var(--accent); }
.disclaimer { font-size: .82rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: .8rem; }
.noscript-msg { background: var(--warn-soft); color: var(--warn); padding: .8rem 1rem; border-radius: var(--radius-sm); font-weight: 600; }

/* Ad slots — placeholders only */
.ad-slot {
  min-height: 120px; margin: 1.6rem 0;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
}
.ad-slot.tall { min-height: 250px; }

/* How it works steps */
.steps { display: grid; gap: .8rem; list-style: none; padding: 0; counter-reset: s; }
.steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .9rem 1rem .9rem 3.2rem; position: relative; }
.steps li::before {
  counter-increment: s; content: counter(s);
  position: absolute; left: 1rem; top: .9rem;
  width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: .85rem;
  display: grid; place-items: center;
}

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: .6rem; }
.faq summary { cursor: pointer; padding: .9rem 1rem; font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-weight: 800; }
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 1rem 1rem; color: var(--ink); }

/* Tool grid (more tools / home) */
.tool-grid { display: grid; gap: .8rem; grid-template-columns: 1fr; list-style: none; padding: 0; }
.tool-link {
  display: grid; gap: .3rem; height: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; text-decoration: none; color: var(--ink);
  transition: border-color .2s var(--ease-out), transform .2s var(--ease-out);
}
.tool-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-link strong { font-size: 1.05rem; }
.tool-link span { color: var(--muted); font-size: .9rem; }
.tool-link em { font-style: normal; color: var(--accent); font-weight: 650; font-size: .88rem; }


/* Header tools: language menu + theme toggle */
.header-tools { display: flex; align-items: center; gap: .4rem; }
.site-header .wrap { flex-wrap: nowrap; }
.site-header nav.nav { margin-left: auto; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  min-width: 40px; height: 40px; padding: 0 .6rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: .85rem; font-weight: 650; cursor: pointer; list-style: none;
  transition: border-color .2s var(--ease-out), background .2s var(--ease-out);
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
.lang-menu { position: relative; }
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu ul {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  min-width: 190px; list-style: none; padding: .35rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.lang-menu a {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .55rem .7rem; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .95rem;
}
.lang-menu a:hover { background: var(--surface-2); }
.lang-menu a[aria-current="true"] { color: var(--accent); font-weight: 700; }
.lang-menu a span { color: var(--muted); font-size: .8rem; text-transform: uppercase; }

/* Mobile sticky summary of the main result */
.mobile-sum {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  padding: .7rem 1rem; border-radius: 14px;
  background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow);
  text-decoration: none; font-weight: 650; font-size: .92rem;
  transform: translateY(140%); transition: transform .3s var(--ease-out);
}
.mobile-sum b { font-family: var(--sans); font-weight: 700; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.mobile-sum.show { transform: none; }
@media (min-width: 960px) { .mobile-sum { display: none; } }

.verdict:empty { display: none; }
.result-main .label { font-size: .92rem; }

/* 6. Sections -------------------------------------------------- */
main { padding-bottom: 2rem; }
.content { max-width: 760px; }
.breadcrumbs { font-size: .82rem; color: var(--muted); padding-top: 1rem; }
.breadcrumbs a { color: var(--muted); }
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 1.6rem 0; font-size: .88rem; color: var(--muted); }
.site-footer .wrap { display: grid; gap: .8rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.site-footer a { color: var(--muted); }

/* 7. Effects --------------------------------------------------- */
.flash { animation: flash .5s var(--ease-out); }
@keyframes flash { from { opacity: .45; } to { opacity: 1; } }

/* 8. Responsive (mobile-first) ---------------------------------- */
.nav a { white-space: nowrap; }
@media (max-width: 719px) {
  .site-header nav.nav { display: none; }
  .header-tools { margin-left: auto; }
}
@media (min-width: 720px) {
  .nav a.show-sm { display: none; }
}
@media (min-width: 540px) {
  .tool-grid { grid-template-columns: 1fr 1fr; }
  .tool-form { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 960px) {
  .tool-card { grid-template-columns: 1.15fr 1fr; padding: 1.4rem; align-items: start; }
  .tool-card .privacy-badge, .tool-card .disclaimer, .tool-card noscript { grid-column: 1 / -1; }
  .result { position: sticky; top: 1rem; }
  .tool-grid { grid-template-columns: repeat(3, 1fr); }
}

@media print {
  .site-header, .site-footer, .ad-slot, .tool-actions, .faq, .more-tools { display: none !important; }
  body { background: #fff; color: #000; }
}
