/* ============================================================
   Fawad's Financial Tools — "Precision Ledger" design system
   Zero-build static site. Everything themed via tokens below.
   ============================================================ */

/* ---------- Fonts (self-hosted variable fonts) ---------- */
@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/Fraunces-var.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Public Sans';
  src: url('../fonts/PublicSans-var.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Spline Sans Mono';
  src: url('../fonts/SplineSansMono-var.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}

/* ---------- Design tokens ---------- */
:root {
  /* Paper (light) theme */
  --bg: #f6f4ec;
  --bg-deep: #efece1;
  --card: #fffefa;
  --card-2: #fbf9f2;
  --ink: #1b2a20;
  --ink-2: #4b5a4f;
  --ink-3: #7c887e;
  --line: rgba(27, 42, 32, 0.14);
  --line-soft: rgba(27, 42, 32, 0.08);
  --gold: #8a6d24;          /* text-safe loonie gold */
  --gold-bright: #c9a648;   /* surfaces, charts */
  --gold-soft: rgba(201, 166, 72, 0.16);
  --pos: #1e7a46;           /* gains, savings */
  --pos-soft: rgba(30, 122, 70, 0.12);
  --neg: #b3382f;           /* costs, interest */
  --neg-soft: rgba(179, 56, 47, 0.10);
  --blue: #2b5d8a;          /* neutral comparison series */
  --blue-soft: rgba(43, 93, 138, 0.12);
  --focus: rgba(138, 109, 36, 0.45);
  --shadow: 0 1px 2px rgba(27, 42, 32, 0.05), 0 8px 24px -12px rgba(27, 42, 32, 0.18);
  --shadow-lift: 0 2px 4px rgba(27, 42, 32, 0.06), 0 16px 40px -16px rgba(27, 42, 32, 0.28);
  --radius: 14px;
  --radius-sm: 9px;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Public Sans', -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Spline Sans Mono', ui-monospace, 'SF Mono', monospace;

  --chart-1: #c9a648; --chart-2: #2b5d8a; --chart-3: #1e7a46;
  --chart-4: #b3382f; --chart-5: #7c6bb0; --chart-6: #4b5a4f;
}

html[data-theme='dark'] {
  --bg: #0e1512;
  --bg-deep: #0a100d;
  --card: #17211b;
  --card-2: #131c17;
  --ink: #ece7d8;
  --ink-2: #aab3a6;
  --ink-3: #75816f;
  --line: rgba(236, 231, 216, 0.16);
  --line-soft: rgba(236, 231, 216, 0.08);
  --gold: #d4b45c;
  --gold-bright: #d4b45c;
  --gold-soft: rgba(212, 180, 92, 0.14);
  --pos: #4cc47e;
  --pos-soft: rgba(76, 196, 126, 0.13);
  --neg: #e06b5f;
  --neg-soft: rgba(224, 107, 95, 0.12);
  --blue: #6aa5d8;
  --blue-soft: rgba(106, 165, 216, 0.14);
  --focus: rgba(212, 180, 92, 0.5);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.35), 0 16px 40px -16px rgba(0, 0, 0, 0.6);

  --chart-1: #d4b45c; --chart-2: #6aa5d8; --chart-3: #4cc47e;
  --chart-4: #e06b5f; --chart-5: #a99bd8; --chart-6: #aab3a6;
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}
/* paper grain */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.028'/%3E%3C/svg%3E");
}
img, svg { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); }
h3 { font-size: 1.12rem; font-family: var(--font-body); font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--gold-soft); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px); }
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--ink-2); }
.small { font-size: 0.85rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.site-header .wrap { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-size: 1.02rem; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand .coin { width: 30px; height: 30px; flex: none; }
.brand > span { white-space: nowrap; }
@media (max-width: 860px) { .brand small { display: none; } }
@media (max-width: 720px) { .header-nav a { display: none; } }
.brand small { display: block; font-family: var(--font-body); font-weight: 500; font-size: 0.68rem; color: var(--ink-3); letter-spacing: 0.08em; text-transform: uppercase; }
.header-nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.header-nav a { color: var(--ink-2); font-size: 0.9rem; font-weight: 600; padding: 7px 11px; border-radius: 8px; }
.header-nav a:hover { color: var(--ink); background: var(--gold-soft); text-decoration: none; }
.theme-toggle {
  appearance: none; border: 1px solid var(--line); background: var(--card);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: var(--ink-2); transition: transform 0.2s ease;
}
.theme-toggle:hover { transform: rotate(15deg); color: var(--gold); }
.theme-toggle svg { width: 17px; height: 17px; }
html[data-theme='dark'] .theme-toggle .icon-moon { display: none; }
html:not([data-theme='dark']) .theme-toggle .icon-sun { display: none; }

/* ---------- Breadcrumb / tool header ---------- */
.tool-head { padding: clamp(24px, 4vw, 44px) 0 clamp(14px, 2vw, 22px); }
.crumbs { font-size: 0.82rem; color: var(--ink-3); margin-bottom: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--ink-3); font-weight: 600; }
.crumbs a:hover { color: var(--gold); }
.crumbs .sep { opacity: 0.5; }
.tool-head .lede { max-width: 64ch; color: var(--ink-2); font-size: 1.02rem; margin: 0; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gold); background: var(--gold-soft);
  padding: 4px 10px; border-radius: 99px; margin-bottom: 12px;
}

/* ---------- Tool page layout ---------- */
.tool-layout {
  display: grid; grid-template-columns: minmax(300px, 380px) 1fr;
  gap: clamp(18px, 3vw, 30px); align-items: start;
  padding-bottom: clamp(40px, 6vw, 72px);
}
@media (max-width: 900px) { .tool-layout { grid-template-columns: 1fr; } }

/* ---------- Panels & cards ---------- */
.panel {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.inputs-panel { padding: clamp(18px, 2.5vw, 26px); position: sticky; top: 76px; }
@media (max-width: 900px) { .inputs-panel { position: static; } }
.inputs-panel h2 {
  font-family: var(--font-body); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 18px;
}
.panel-section { border-top: 1px solid var(--line-soft); margin-top: 18px; padding-top: 16px; }
.panel-section > h3 { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 14px; font-family: var(--font-body); }

/* ---------- Inputs ---------- */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.field-label label { font-size: 0.88rem; font-weight: 600; color: var(--ink-2); }
.field-hint { font-size: 0.78rem; color: var(--ink-3); }

.control { position: relative; display: flex; align-items: center; }
.control .prefix, .control .suffix {
  position: absolute; font-size: 0.9rem; color: var(--ink-3); pointer-events: none; font-family: var(--font-mono);
}
.control .prefix { left: 12px; }
.control .suffix { right: 12px; }
.field > select,
.control input[type='text'], .control input[type='number'], .control select {
  width: 100%; height: 42px; padding: 0 12px;
  font: 500 0.98rem var(--font-mono); font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--card-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.control.has-prefix input { padding-left: 28px; }
.control.has-suffix input { padding-right: 34px; }
.control input:hover, .control select:hover, .field > select:hover { border-color: var(--ink-3); }
.control input:focus, .control select:focus, .field > select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.field > select, .control select { font-family: var(--font-body); font-weight: 600; cursor: pointer; appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237c887e' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }

input[type='range'] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 8px 0 0;
  background: transparent; cursor: pointer;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 5px; border-radius: 3px;
  background: linear-gradient(to right, var(--gold-bright) 0 var(--fill, 50%), var(--line) var(--fill, 50%) 100%);
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6.5px;
  border-radius: 50%; background: var(--card); border: 2.5px solid var(--gold-bright);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); transition: transform 0.12s ease;
}
input[type='range']::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type='range']::-moz-range-track { height: 5px; border-radius: 3px; background: var(--line); }
input[type='range']::-moz-range-progress { height: 5px; border-radius: 3px; background: var(--gold-bright); }
input[type='range']::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--card); border: 2.5px solid var(--gold-bright); }

/* segmented control */
.seg { display: flex; background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.seg button {
  flex: 1; appearance: none; border: 0; background: transparent; cursor: pointer;
  font: 600 0.85rem var(--font-body); color: var(--ink-2);
  padding: 7px 10px; border-radius: 7px; transition: all 0.15s ease; white-space: nowrap;
}
.seg button[aria-pressed='true'] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.seg button:hover:not([aria-pressed='true']) { color: var(--ink); }

/* checkbox / switch */
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.88rem; font-weight: 600; color: var(--ink-2); }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 38px; height: 22px; flex: none; border-radius: 99px; background: var(--line); position: relative; transition: background 0.18s ease; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.18s ease; }
.switch input:checked + .track { background: var(--gold-bright); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Results ---------- */
.results { display: flex; flex-direction: column; gap: clamp(14px, 2vw, 20px); min-width: 0; }

.result-hero {
  padding: clamp(20px, 3vw, 30px);
  background:
    radial-gradient(120% 160% at 100% 0%, var(--gold-soft) 0%, transparent 45%),
    var(--card);
  border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.result-hero .kicker { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.result-hero .big {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em;
  font-size: clamp(2.2rem, 5.5vw, 3.4rem); line-height: 1.05; color: var(--ink);
  font-variant-numeric: lining-nums;
}
.result-hero .big .unit { font-size: 0.45em; font-weight: 600; color: var(--ink-2); margin-left: 2px; }
.result-hero .sub { margin: 8px 0 0; color: var(--ink-2); font-size: 0.95rem; }

.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 12px; }
.metric {
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.metric .k { font-size: 0.76rem; font-weight: 600; color: var(--ink-3); margin-bottom: 4px; letter-spacing: 0.02em; }
.metric .v { font-family: var(--font-mono); font-weight: 600; font-size: 1.18rem; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.metric .d { font-size: 0.76rem; color: var(--ink-3); margin-top: 3px; }

/* verdict banner (rent-vs-buy style) */
.verdict { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--radius-sm); border: 1px solid; font-size: 0.95rem; }
.verdict.good { background: var(--pos-soft); border-color: color-mix(in srgb, var(--pos) 35%, transparent); }
.verdict.bad { background: var(--neg-soft); border-color: color-mix(in srgb, var(--neg) 35%, transparent); }
.verdict.info { background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 35%, transparent); }
.verdict .t { font-weight: 700; margin-bottom: 2px; }
.verdict p { margin: 0; color: var(--ink-2); font-size: 0.9rem; }

/* ---------- Chart card ---------- */
.chart-card { padding: clamp(16px, 2.5vw, 22px); }
.chart-card h3 { margin-bottom: 2px; }
.chart-card .chart-sub { font-size: 0.84rem; color: var(--ink-3); margin-bottom: 12px; }
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line-soft); stroke-width: 1; }
.chart .axis-label { fill: var(--ink-3); font-family: var(--font-mono); font-size: 11px; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5; opacity: 0;
  background: var(--ink); color: var(--bg); border-radius: 8px;
  padding: 8px 11px; font-size: 0.8rem; line-height: 1.45;
  box-shadow: var(--shadow-lift); transition: opacity 0.12s ease;
  white-space: nowrap; transform: translate(-50%, calc(-100% - 12px));
}
.chart-tip .tip-title { font-weight: 700; opacity: 0.75; font-size: 0.72rem; margin-bottom: 2px; }
.chart-tip .row { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.chart-tip .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.legend .item { display: flex; align-items: center; gap: 7px; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); }
.legend .swatch { width: 11px; height: 11px; border-radius: 3.5px; flex: none; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
table.data th, table.data td { padding: 9px 14px; text-align: right; white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th {
  font-family: var(--font-body); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--ink-3);
  background: var(--card-2); border-bottom: 1px solid var(--line); position: sticky; top: 0;
}
table.data td { font-family: var(--font-mono); font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line-soft); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--gold-soft); }
table.data tr.milestone td { background: var(--pos-soft); font-weight: 600; }

/* ---------- Explain / methodology ---------- */
details.explain { background: var(--card-2); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 0; overflow: hidden; }
details.explain summary {
  cursor: pointer; list-style: none; padding: 16px 20px;
  font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; gap: 10px; user-select: none;
}
details.explain summary::-webkit-details-marker { display: none; }
details.explain summary::before { content: '+'; font-family: var(--font-mono); color: var(--gold); font-size: 1.1rem; width: 18px; }
details.explain[open] summary::before { content: '−'; }
details.explain .explain-body { padding: 0 20px 18px; color: var(--ink-2); font-size: 0.92rem; max-width: 75ch; }
details.explain .explain-body h4 { font-family: var(--font-body); font-size: 0.9rem; font-weight: 700; color: var(--ink); margin: 1.1em 0 0.35em; }
details.explain .explain-body code { font-family: var(--font-mono); font-size: 0.85em; background: var(--gold-soft); padding: 1px 5px; border-radius: 4px; }

.callout { padding: 13px 16px; border-radius: var(--radius-sm); background: var(--blue-soft); border: 1px solid color-mix(in srgb, var(--blue) 30%, transparent); font-size: 0.85rem; color: var(--ink-2); }
.callout.warn { background: var(--neg-soft); border-color: color-mix(in srgb, var(--neg) 30%, transparent); }
.callout strong { color: var(--ink); }

/* ---------- Buttons & actions ---------- */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: 600 0.86rem var(--font-body); padding: 9px 15px; border-radius: var(--radius-sm);
  cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  transition: all 0.15s ease;
}
.btn:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn svg { width: 14px; height: 14px; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { background: var(--gold); border-color: var(--gold); color: #fff; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* ---------- Homepage ---------- */
.hero { padding-top: clamp(44px, 8vw, 96px); padding-bottom: clamp(28px, 5vw, 56px); position: relative; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 0.76rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); margin-bottom: 18px; }
.hero .eyebrow::before { content: ''; width: 26px; height: 1.5px; background: var(--gold-bright); }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); font-weight: 600; max-width: 17ch; letter-spacing: -0.022em; }
.hero h1 em { font-style: italic; color: var(--gold); }
.hero .lede { font-size: clamp(1rem, 1.6vw, 1.18rem); color: var(--ink-2); max-width: 56ch; }
.hero-stats { display: flex; gap: clamp(20px, 4vw, 44px); margin-top: 30px; flex-wrap: wrap; }
.hero-stats .stat .n { font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; color: var(--ink); }
.hero-stats .stat .l { font-size: 0.8rem; color: var(--ink-3); font-weight: 600; }

.tool-search { position: relative; max-width: 520px; margin-top: 34px; }
.tool-search input {
  width: 100%; height: 52px; padding: 0 18px 0 46px;
  font: 500 1rem var(--font-body); color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.tool-search input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft), var(--shadow); }
.tool-search .search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-3); pointer-events: none; }
.tool-search kbd {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font: 600 0.72rem var(--font-mono); color: var(--ink-3);
  border: 1px solid var(--line); border-radius: 5px; padding: 2px 7px; background: var(--card-2);
}

.category { padding: clamp(18px, 3vw, 30px) 0; }
.category-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; }
.category-head h2 { margin: 0; }
.category-head .count { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-3); }
.category-head::after { content: ''; flex: 1; height: 1px; background: var(--line-soft); }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 14px; }
.tool-card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 18px; color: var(--ink); box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  position: relative;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--gold-bright) 50%, transparent); text-decoration: none; }
.tool-card .icon {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: var(--gold-soft); color: var(--gold); flex: none;
}
.tool-card .icon svg { width: 20px; height: 20px; }
.tool-card .t { font-weight: 700; font-size: 0.99rem; letter-spacing: -0.01em; }
.tool-card .d { font-size: 0.84rem; color: var(--ink-2); line-height: 1.45; margin: 0; }
.tool-card .new-badge {
  position: absolute; top: 14px; right: 14px;
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--pos); background: var(--pos-soft); padding: 3px 8px; border-radius: 99px;
}
.tool-card.hidden-by-search { display: none; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line-soft); margin-top: clamp(30px, 6vw, 60px); padding: clamp(26px, 4vw, 40px) 0; background: var(--bg-deep); }
.site-footer .cols { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.site-footer .fine { font-size: 0.78rem; color: var(--ink-3); max-width: 72ch; line-height: 1.6; }
.site-footer .fine strong { color: var(--ink-2); }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.84rem; font-weight: 600; }

/* ---------- Reveal animation ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(14px); animation: rise 0.55s cubic-bezier(0.19, 1, 0.22, 1) forwards; }
  .reveal:nth-child(2) { animation-delay: 0.06s; }
  .reveal:nth-child(3) { animation-delay: 0.12s; }
  .reveal:nth-child(4) { animation-delay: 0.18s; }
  .reveal:nth-child(5) { animation-delay: 0.24s; }
  @keyframes rise { to { opacity: 1; transform: none; } }
  .result-hero .big { transition: color 0.2s ease; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .actions, .theme-toggle, details.explain { display: none !important; }
  body { background: #fff; color: #000; }
  .panel, .metric, .result-hero { box-shadow: none; border-color: #ccc; }
  .tool-layout { grid-template-columns: 1fr; }
  .inputs-panel { position: static; }
}
