/* ===================== base.css ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: none; text-size-adjust: none;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility; scroll-behavior: smooth;
  scroll-padding-top: var(--space-16);
}
body { min-height: 100dvh; line-height: 1.6; font-family: var(--font-body, sans-serif); font-size: var(--text-base); color: var(--color-text); background-color: var(--color-bg); }
img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }
ul[role="list"], ol[role="list"] { list-style: none; }
input, button, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4, h5, h6 { text-wrap: balance; line-height: 1.15; }
p, li, figcaption { text-wrap: pretty; }
::selection { background: color-mix(in oklab, var(--color-primary) 25%, transparent); color: var(--color-text); }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: var(--radius-sm); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; } }
button { cursor: pointer; background: none; border: none; }
table { border-collapse: collapse; width: 100%; }
a, button, [role="button"], input, textarea, select { transition: color var(--transition-interactive), background var(--transition-interactive), border-color var(--transition-interactive), box-shadow var(--transition-interactive), transform var(--transition-interactive); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border-width: 0; }

/* ===================== design tokens ===================== */
:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3rem);

  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem;
  --space-12: 3rem; --space-16: 4rem; --space-20: 5rem; --space-24: 6rem; --space-32: 8rem;

  --radius-sm: 0.375rem; --radius-md: 0.625rem; --radius-lg: 0.9rem; --radius-xl: 1.25rem; --radius-full: 9999px;
  --transition-interactive: 160ms cubic-bezier(0.16, 1, 0.3, 1);

  --font-display: 'Cabinet Grotesk', 'General Sans', sans-serif;
  --font-body: 'Satoshi', 'General Sans', sans-serif;
}

:root, [data-theme="light"] {
  --color-bg: #FAF6F0;
  --color-surface: #FFFFFF;
  --color-surface-2: #FEFCF9;
  --color-surface-offset: #F2EBE0;
  --color-surface-dynamic: #ECE2D3;
  --color-divider: #EAE1D3;
  --color-border: #DED2BF;
  --color-text: #2A231C;
  --color-text-muted: #7A6F60;
  --color-text-faint: #B7AA96;
  --color-text-inverse: #FBF6EE;

  --color-primary: #BE5030;
  --color-primary-hover: #9E4126;
  --color-primary-active: #7C321D;
  --color-primary-highlight: #F1D9CB;

  --color-navy: #223A3C;
  --color-navy-highlight: #D9E3E2;

  --color-success: #3E7A4F;
  --color-success-highlight: #D7E6DA;
  --color-warning: #B9821F;
  --color-warning-highlight: #EEDFC2;
  --color-error: #AC3D3D;
  --color-error-highlight: #E9D3D2;

  --shadow-sm: 0 1px 2px oklch(0.2 0.02 40 / 0.07);
  --shadow-md: 0 6px 18px oklch(0.2 0.02 40 / 0.09);
  --shadow-lg: 0 16px 40px oklch(0.2 0.02 40 / 0.14);
  --content-wide: 1180px;
}

[data-theme="dark"] {
  --color-bg: #17130F;
  --color-surface: #1E1914;
  --color-surface-2: #241E17;
  --color-surface-offset: #241E18;
  --color-surface-dynamic: #2C2519;
  --color-divider: #2C2419;
  --color-border: #3C3223;
  --color-text: #EEE5D8;
  --color-text-muted: #A89984;
  --color-text-faint: #6E6252;
  --color-text-inverse: #241E17;

  --color-primary: #E38358;
  --color-primary-hover: #EA9A73;
  --color-primary-active: #F2B091;
  --color-primary-highlight: #4A3428;

  --color-navy: #85B3B0;
  --color-navy-highlight: #253938;

  --color-success: #7FB98D;
  --color-success-highlight: #2C3E2C;
  --color-warning: #DBAE55;
  --color-warning-highlight: #423823;
  --color-error: #DE8686;
  --color-error-highlight: #402A2A;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.3);
  --shadow-md: 0 6px 18px oklch(0 0 0 / 0.35);
  --shadow-lg: 0 16px 40px oklch(0 0 0 / 0.45);
}

/* ===================== layout ===================== */
.wrap { max-width: var(--content-wide); margin-inline: auto; padding-inline: var(--space-6); }

header.site-header {
  border-bottom: 1px solid var(--color-divider);
  padding-block: var(--space-5);
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in oklab, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(10px);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.brand { display: flex; align-items: center; gap: var(--space-3); }
.brand-mark { width: 34px; height: 34px; flex-shrink: 0; }
.brand-text { font-family: var(--font-display); font-weight: 700; font-size: var(--text-lg); letter-spacing: -0.01em; }
.brand-sub { display: block; font-family: var(--font-body); font-weight: 400; font-size: var(--text-xs); color: var(--color-text-muted); letter-spacing: 0.02em; }

.theme-toggle {
  width: 38px; height: 38px; border-radius: var(--radius-full);
  display: grid; place-items: center;
  border: 1px solid var(--color-border); color: var(--color-text-muted);
}
.theme-toggle:hover { background: var(--color-surface-offset); color: var(--color-text); }

main { padding-block: var(--space-10) var(--space-24); }

.hero { padding-block: var(--space-8) var(--space-10); }
.hero h1 { font-family: var(--font-display); font-weight: 700; font-size: var(--text-xl); letter-spacing: -0.01em; max-width: 46ch; }
.hero p { color: var(--color-text-muted); font-size: var(--text-base); max-width: 62ch; margin-top: var(--space-3); }

.grid-layout { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: var(--space-8); align-items: start; }
@media (max-width: 900px) { .grid-layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}
.panel + .panel { margin-top: var(--space-6); }
.panel h2 { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; margin-bottom: var(--space-1); }
.panel .panel-sub { color: var(--color-text-muted); font-size: var(--text-sm); margin-bottom: var(--space-5); }

.field { margin-bottom: var(--space-5); }
.field label { display: block; font-size: var(--text-sm); font-weight: 600; margin-bottom: var(--space-2); }
.field .hint { display: block; font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-1); font-weight: 400; }

.input-money {
  position: relative;
}
.input-money::before {
  content: '$'; position: absolute; left: var(--space-4); top: 50%; transform: translateY(-50%);
  color: var(--color-text-muted); font-weight: 600; pointer-events: none;
}
.input-money input[type="number"] { padding-left: var(--space-8) !important; }

input[type="text"], input[type="number"] {
  width: 100%; padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface-2); font-size: var(--text-base);
  font-variant-numeric: tabular-nums lining-nums;
}
input[type="text"]:focus, input[type="number"]:focus { border-color: var(--color-primary); outline: none; box-shadow: 0 0 0 3px var(--color-primary-highlight); }

.combo { position: relative; }
.combo-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); max-height: 280px; overflow-y: auto; display: none;
}
.combo-list.open { display: block; }
.combo-list button {
  display: flex; justify-content: space-between; gap: var(--space-3); width: 100%;
  text-align: left; padding: var(--space-3) var(--space-4); font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-divider);
}
.combo-list button:last-child { border-bottom: none; }
.combo-list button:hover, .combo-list button.active { background: var(--color-surface-offset); }
.combo-list .price { color: var(--color-text-muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }

.slider-field { margin-bottom: var(--space-6); }
.slider-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--space-2); }
.slider-head label { font-size: var(--text-sm); font-weight: 600; }
.slider-value { font-family: var(--font-display); font-weight: 700; font-size: var(--text-base); color: var(--color-primary); font-variant-numeric: tabular-nums; }

input[type="range"] {
  width: 100%; height: 6px; border-radius: var(--radius-full);
  background: var(--color-surface-offset); appearance: none; -webkit-appearance: none;
  accent-color: var(--color-primary);
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--color-primary); border: 3px solid var(--color-surface); box-shadow: var(--shadow-sm); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: var(--color-primary); border: 3px solid var(--color-surface); box-shadow: var(--shadow-sm); cursor: pointer;
}
.slider-scale { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--color-text-faint); margin-top: var(--space-1); }

.advanced-toggle {
  display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); font-weight: 600;
  color: var(--color-primary); margin-top: var(--space-2);
}
.advanced-toggle svg { transition: transform var(--transition-interactive); }
.advanced-toggle.open svg { transform: rotate(180deg); }
.advanced-panel { display: none; margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--color-divider); }
.advanced-panel.open { display: block; }
.advanced-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4) var(--space-4); }
@media (max-width: 480px) { .advanced-grid { grid-template-columns: 1fr; } }

/* ===================== gauge ===================== */
.gauge-wrap { margin-top: var(--space-2); }
.gauge-legend { display: flex; gap: var(--space-4); flex-wrap: wrap; font-size: var(--text-xs); color: var(--color-text-muted); margin-bottom: var(--space-3); }
.gauge-legend span { display: inline-flex; align-items: center; gap: var(--space-2); }
.gauge-legend .dot { width: 9px; height: 9px; border-radius: 50%; }
.gauge-track { position: relative; height: 44px; border-radius: var(--radius-md); overflow: hidden; background: var(--color-surface-offset); }
.gauge-zone { position: absolute; top: 0; bottom: 0; height: 100%; }
.gauge-zone.comfortable { background: var(--color-success-highlight); }
.gauge-zone.stretch { background: var(--color-warning-highlight); }
.gauge-zone.reach { background: var(--color-error-highlight); }
.gauge-marker {
  position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--color-navy);
}
.gauge-marker .flag {
  position: absolute; top: -30px; left: 50%; transform: translateX(-50%);
  font-size: var(--text-xs); font-weight: 600; white-space: nowrap; color: var(--color-navy);
  background: var(--color-navy-highlight); padding: 2px 8px; border-radius: var(--radius-sm);
}
.gauge-input-overlay {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  background: transparent; opacity: 1; cursor: pointer;
}
.gauge-input-overlay::-webkit-slider-runnable-track { background: transparent; }
.gauge-input-overlay::-moz-range-track { background: transparent; }
.gauge-input-overlay::-webkit-slider-thumb { width: 22px; height: 56px; border-radius: 6px; background: var(--color-text); border: 3px solid var(--color-surface); box-shadow: var(--shadow-md); margin-top: -6px; }
.gauge-input-overlay::-moz-range-thumb { width: 22px; height: 56px; border-radius: 6px; background: var(--color-text); border: 3px solid var(--color-surface); box-shadow: var(--shadow-md); }
.gauge-scale { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--color-text-faint); margin-top: var(--space-2); }
.gauge-price-readout { display: flex; align-items: baseline; gap: var(--space-3); margin-top: var(--space-4); }
.gauge-price-readout .val { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.verdict-badge {
  display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
}
.verdict-badge.comfortable { background: var(--color-success-highlight); color: var(--color-success); }
.verdict-badge.stretch { background: var(--color-warning-highlight); color: var(--color-warning); }
.verdict-badge.reach { background: var(--color-error-highlight); color: var(--color-error); }

/* ===================== KPI + results ===================== */
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); margin-top: var(--space-6); }
@media (max-width: 720px) { .kpi-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .kpi-grid { grid-template-columns: 1fr; } }
.kpi-card {
  background: var(--color-surface-2); border: 1px solid var(--color-divider); border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
}
.kpi-card .label { font-size: var(--text-xs); color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; }
.kpi-card .value { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; margin-top: var(--space-1); font-variant-numeric: tabular-nums; }
.kpi-card .sub { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-1); }

.breakdown-row { display: flex; align-items: center; gap: var(--space-3); padding-block: var(--space-2); border-bottom: 1px solid var(--color-divider); font-size: var(--text-sm); }
.breakdown-row:last-child { border-bottom: none; font-weight: 700; padding-top: var(--space-3); }
.breakdown-row .swatch { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.breakdown-row .name { flex: 1; color: var(--color-text-muted); }
.breakdown-row:last-child .name { color: var(--color-text); }
.breakdown-row .amt { font-variant-numeric: tabular-nums; font-weight: 600; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-8); align-items: start; }
@media (max-width: 780px) { .two-col { grid-template-columns: 1fr; } }

.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; }

.rentbuy-summary {
  background: var(--color-surface-offset); border-radius: var(--radius-lg); padding: var(--space-5);
  margin-top: var(--space-5);
}
.rentbuy-summary .headline { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; }
.rentbuy-summary p { color: var(--color-text-muted); font-size: var(--text-sm); margin-top: var(--space-2); }

.section-title { font-family: var(--font-display); font-weight: 700; font-size: var(--text-xl); margin-bottom: var(--space-2); }
.section-sub { color: var(--color-text-muted); max-width: 68ch; margin-bottom: var(--space-8); }

.compare-table { width: 100%; border-collapse: collapse; margin-top: var(--space-5); font-size: var(--text-sm); }
.compare-table th, .compare-table td { text-align: left; padding: var(--space-3) var(--space-3); border-bottom: 1px solid var(--color-divider); }
.compare-table th { color: var(--color-text-muted); font-weight: 600; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.03em; }
.compare-table td { font-variant-numeric: tabular-nums; }
.compare-table tr:last-child td { font-weight: 700; }

footer.site-footer { border-top: 1px solid var(--color-divider); padding-block: var(--space-10); margin-top: var(--space-16); }
.sources-list { font-size: var(--text-xs); color: var(--color-text-muted); line-height: 1.8; }
.sources-list a { color: var(--color-text-muted); text-decoration: underline; text-decoration-color: var(--color-border); }
.sources-list a:hover { color: var(--color-primary); }
.methodology { font-size: var(--text-sm); color: var(--color-text-muted); max-width: 72ch; margin-bottom: var(--space-6); }
.methodology strong { color: var(--color-text); }

.badge-pill { display: inline-block; font-size: var(--text-xs); font-weight: 600; padding: 2px 10px; border-radius: var(--radius-full); background: var(--color-primary-highlight); color: var(--color-primary); }

/* ===================== tooltips ===================== */
.label-row { display: flex; align-items: center; gap: var(--space-2); }
.field .label-row { margin-bottom: var(--space-2); }
.field .label-row label { margin-bottom: 0; }
.panel h2.label-row, .kpi-card .label.label-row { margin-bottom: var(--space-1); }
.slider-head .label-row { gap: var(--space-2); }

.tip-btn {
  position: relative;
  flex-shrink: 0;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 16px;
  text-align: center;
  border: 1px solid var(--color-border);
}
.tip-btn:hover, .tip-btn:focus-visible, .tip-btn.active { background: var(--color-primary); color: var(--color-text-inverse); border-color: var(--color-primary); }

.tip-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  background: var(--color-text);
  color: var(--color-text-inverse);
  font-size: var(--text-xs);
  font-weight: 400;
  font-style: normal;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.5;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(4px);
  transition: opacity var(--transition-interactive), transform var(--transition-interactive), visibility var(--transition-interactive);
  z-index: 20;
  pointer-events: none;
}
.tip-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--color-text);
}
.tip-btn:hover .tip-bubble,
.tip-btn:focus-visible .tip-bubble,
.tip-btn.active .tip-bubble {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
@media (max-width: 480px) {
  .tip-bubble { width: 200px; left: auto; right: -8px; transform: translateY(4px); }
  .tip-bubble::after { left: auto; right: 12px; transform: none; }
  .tip-btn:hover .tip-bubble, .tip-btn:focus-visible .tip-bubble, .tip-btn.active .tip-bubble { transform: translateY(0); }
}

/* ===================== how it works ===================== */
.how-it-works { margin-top: var(--space-10); margin-bottom: var(--space-10); }
.steps-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  margin-top: var(--space-5);
}
.step-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  margin-bottom: var(--space-3);
}
.step-card h3 { font-family: var(--font-display); font-size: var(--text-base); font-weight: 600; margin-bottom: var(--space-1); }
.step-card p { font-size: var(--text-sm); color: var(--color-text-muted); }

@media (max-width: 900px) { .steps-list { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .steps-list { grid-template-columns: 1fr; } }

/* ===================== faq ===================== */
.faq { margin-top: var(--space-12); margin-bottom: var(--space-4); }
.faq-list { margin-top: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.faq-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
}
.faq-item summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-base);
  list-style: none;
  position: relative;
  padding-right: var(--space-8);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  font-size: var(--text-lg);
  font-weight: 400;
  color: var(--color-primary);
  transition: transform var(--transition-interactive);
}
.faq-item[open] summary::after { content: "\2212"; }
.faq-item p { font-size: var(--text-sm); color: var(--color-text-muted); margin-top: var(--space-3); }
