@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --ink-navy: #0E2A47;
  --blueprint-blue: #123A63;
  --blueprint-blue-deep: #0A2038;
  --line-cyan: #38BDF8;
  --line-cyan-dim: rgba(56, 189, 248, 0.35);
  --paper: #F6F8FA;
  --paper-line: rgba(14, 42, 71, 0.07);
  --border: rgba(14, 42, 71, 0.13);
  --shadow-card: 0 1px 2px rgba(14, 42, 71, 0.04), 0 10px 28px rgba(14, 42, 71, 0.08);
  --shadow-card-hover: 0 1px 2px rgba(14, 42, 71, 0.05), 0 14px 34px rgba(14, 42, 71, 0.11);
  --approval-amber: #E8A33D;
  --approval-amber-deep: #C97F1E;
  --slate: #5B7188;
  --white: #FFFFFF;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* This modern rule reserves space for the scrollbar so content never jumps */
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink-navy);
  background: var(--paper);
  line-height: 1.5;
}

a { color: inherit; }

img, svg { display: block; max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--line-cyan);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Title-block nav ---------- */

.titlebar {
  background: var(--blueprint-blue-deep);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.titlebar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--white);
  flex-shrink: 0; /* never let the logo get squeezed — nav should shrink/scroll instead */
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.01em;
  white-space: nowrap; /* stop "Finance Friend" from wrapping onto 2 lines and overlapping the nav */
}

.titlebar nav {
  min-width: 0; /* the crucial part — without this, flexbox won't let nav shrink below its
                   full content width, so .tabs never actually gets to overflow/scroll and
                   the brand gets squeezed instead. This makes nav (and .tabs inside it) the
                   thing that gives way on narrow screens. */
  overflow: hidden;
}

.tabs {
  display: flex;
  flex-wrap: nowrap; /* Forces the tabs to stay in a single horizontal line */
  overflow-x: auto; /* Enables horizontal scrolling when they exceed the screen width */
  -webkit-overflow-scrolling: touch; /* Enables buttery-smooth scrolling on iPhones */
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tabs li {
  flex-shrink: 0; /* Prevents the browser from squishing the tab text */
}

/* Hide the scrollbar since the tabs already look like a nav bar, not a scroll area */
.tabs::-webkit-scrollbar { display: none; }
.tabs {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.tabs a {
  display: block;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 3px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tabs a:hover { color: var(--white); }

.tabs a.active {
  color: var(--line-cyan);
  border-color: var(--line-cyan-dim);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  background:
    linear-gradient(180deg, var(--blueprint-blue) 0%, var(--blueprint-blue-deep) 100%);
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 40px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 40px);
  pointer-events: none;
}

.hero .wrap {
  position: relative;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
  padding-top: 72px;
  padding-bottom: 72px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--line-cyan);
  margin: 0 0 16px;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(32px, 4vw, 46px);
  line-height: 1.12;
  color: var(--white);
  margin: 0 0 18px;
}

.hero p.lede {
  font-size: 17px;
  color: rgba(255,255,255,0.75);
  max-width: 46ch;
  margin: 0 0 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 13px 22px;
  border-radius: 3px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn-amber {
  background: var(--approval-amber);
  color: var(--blueprint-blue-deep);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(201,127,30,0.2), 0 4px 12px rgba(201,127,30,0.18);
}

.btn-amber:hover {
  background: var(--approval-amber-deep);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(201,127,30,0.25), 0 8px 20px rgba(201,127,30,0.25);
}

.btn-amber:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--white);
  border-color: rgba(255,255,255,0.3);
}

.btn-ghost:hover { border-color: var(--line-cyan); color: var(--line-cyan); }

/* Blueprint house diagram */

.diagram { width: 100%; height: auto; }
.diagram .line { fill: none; stroke: var(--line-cyan); stroke-width: 2; }
.diagram .dim { fill: none; stroke: rgba(255,255,255,0.4); stroke-width: 1; }
.diagram .dim-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  fill: rgba(255,255,255,0.75);
  letter-spacing: 0.04em;
}
.diagram .callout-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  fill: var(--approval-amber);
}

/* ---------- Sections on paper ---------- */

.section { padding: 64px 0; }

.section-head { max-width: 60ch; margin: 0 0 40px; }

.section-head .eyebrow { color: var(--approval-amber-deep); }

.section-head h2 {
  font-family: var(--font-display);
  font-size: 28px;
  margin: 0 0 10px;
}

.section-head p { color: var(--slate); margin: 0; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 26px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.card-icon {
  width: 34px;
  height: 34px;
  margin-bottom: 16px;
  color: var(--blueprint-blue);
}

.card h3 {
  font-family: var(--font-display);
  font-size: 17px;
  margin: 0 0 8px;
}

.card p {
  color: var(--slate);
  font-size: 14.5px;
  margin: 0;
}

.cta-banner {
  background: var(--ink-navy);
  border-radius: 8px;
  padding: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.cta-banner h3 {
  font-family: var(--font-display);
  color: var(--white);
  font-size: 20px;
  margin: 0 0 6px;
}

.cta-banner p {
  color: rgba(255,255,255,0.65);
  margin: 0;
  font-size: 14.5px;
}

/* ---------- Footer ---------- */

footer {
  border-top: 1px solid var(--paper-line);
  padding: 28px 0;
  margin-top: auto;
  flex-shrink: 0;
}

footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--slate);
}

/* ---------- Home price tool page ---------- */

.tool-header { padding: 56px 0 8px; }

.tool-header .eyebrow { color: var(--approval-amber-deep); }

.tool-header h1 {
  font-family: var(--font-display);
  font-size: 32px;
  margin: 0 0 10px;
}

.tool-header p { color: var(--slate); max-width: 58ch; margin: 0; }

.tool-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 3px solid var(--ink-navy);
  border-radius: 10px;
  padding: 32px;
  margin: 32px 0 64px;
  box-shadow: var(--shadow-card);
}

.tool-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 8px;
}

select#state-select {
  font-family: var(--font-body);
  font-size: 15px;
  padding: 12px 38px 12px 14px;
  border: 1px solid rgba(14,42,71,0.22);
  border-radius: 5px;
  background: var(--white);
  color: var(--ink-navy);
  min-width: 240px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235B7188' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 12px 8px;
  background-position: right 14px center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select#state-select:hover { border-color: rgba(14,42,71,0.35); }

select#state-select:focus {
  outline: none;
  border-color: var(--line-cyan);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.18);
}

.tool-controls .field { flex: 1; min-width: 220px; }

.result {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px dashed var(--paper-line);
  display: none;
}

.result.visible { display: block; }

.result-state {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--slate);
  margin: 0 0 6px;
}

.result-value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(36px, 5vw, 52px);
  color: var(--ink-navy);
  margin: 0 0 4px;
}

.result-caption {
  font-size: 13px;
  color: var(--slate);
  margin: 0 0 24px;
}

.compare-row { margin-bottom: 14px; }

.compare-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--slate);
  margin-bottom: 6px;
}

.compare-track {
  height: 10px;
  background: var(--paper);
  border-radius: 5px;
  overflow: hidden;
}

.compare-fill {
  height: 100%;
  border-radius: 5px;
  width: 0%;
  transition: width 0.5s ease;
}

.compare-fill.state { background: var(--approval-amber); }
.compare-fill.national { background: var(--line-cyan); }

.state-select-fill { background: var(--blueprint-blue); }

.msg {
  font-size: 14.5px;
  padding: 14px 16px;
  border-radius: 5px;
  margin-top: 20px;
  display: none;
}

.msg.visible { display: block; }

.msg.error {
  background: rgba(193, 68, 60, 0.08);
  color: #A5342C;
  border: 1px solid rgba(193, 68, 60, 0.2);
}

.msg a { color: inherit; text-decoration: underline; }

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
  .hero .wrap { grid-template-columns: 1fr; padding-top: 48px; padding-bottom: 40px; }
  .card-grid { grid-template-columns: 1fr; }
  .tabs a { padding: 8px 10px; font-size: 12px; }
  .cta-banner { flex-direction: column; align-items: flex-start; }
}

/* ==================== Calculators (auto loan / auto lease) ==================== */

.calc-header { padding: 56px 0 8px; }
.calc-header .eyebrow { color: var(--approval-amber-deep); }
.calc-header h1 { font-family: var(--font-display); font-size: 32px; margin: 0 0 10px; }
.calc-header p { color: var(--slate); max-width: 60ch; margin: 0; }

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
  margin: 36px 0 48px;
}

.calc-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 4px solid var(--ink-navy);
  border-radius: 12px;
  padding: 28px;
  box-shadow: var(--shadow-card);
}

.calc-tabs {
  display: flex;
  gap: 4px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: -6px -6px 24px;
  padding: 4px;
}

.calc-tabs button {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 11px 4px;
  color: var(--slate);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.calc-tabs button:hover:not(.active) { color: var(--ink-navy); }

.calc-tabs button.active {
  color: var(--ink-navy);
  background: var(--white);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(14,42,71,0.08), 0 2px 8px rgba(14,42,71,0.08);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }
.tab-panel[hidden] { display: none; }

.input-row {
  display: grid;
  grid-template-columns: 1fr 138px;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--paper-line);
}

.input-row:last-of-type { border-bottom: none; }

.input-row label {
  font-size: 13.5px;
  color: var(--ink-navy);
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1.3;
}

.input-row .hint {
  color: var(--slate);
  font-size: 11px;
  border: 1px solid var(--slate);
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: help;
}

.input-wrap { position: relative; display: flex; align-items: center; }

.input-wrap input, .input-wrap select {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 13.5px;
  padding: 9px 10px;
  border: 1px solid rgba(14,42,71,0.22);
  border-radius: 5px;
  background: var(--white);
  color: var(--ink-navy);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-wrap input:hover, .input-wrap select:hover { border-color: rgba(14,42,71,0.35); }

.input-wrap input:focus, .input-wrap select:focus {
  outline: none;
  border-color: var(--line-cyan);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.18);
}

.input-wrap select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235B7188' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 12px 8px;
  background-position: right 10px center;
  padding-right: 28px;
}

.input-row input[type="checkbox"],
.checkbox-row input[type="checkbox"] {
  accent-color: var(--approval-amber);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.input-wrap.suffix input { padding-right: 24px; }
.input-wrap .unit {
  position: absolute;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--slate);
  pointer-events: none;
}

.input-wrap.prefix input { padding-left: 20px; }
.input-wrap.prefix .unit { left: 10px; right: auto; }

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 14px 0 4px;
  font-size: 13px;
  color: var(--ink-navy);
}

.checkbox-row input { margin-top: 2px; }

.calc-actions { margin-top: 20px; }
.calc-actions .btn { width: 100%; justify-content: center; border: none; }

.results-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 4px solid var(--approval-amber);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.results-headline {
  background: var(--ink-navy);
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 18px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 18px);
  padding: 22px 28px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.results-headline .label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
}

.results-headline .value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 26px;
  color: var(--approval-amber);
}

.stat-list { padding: 6px 28px; }

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--paper-line);
  font-size: 13.5px;
}

.stat-row:last-child { border-bottom: none; }
.stat-row .stat-label { color: var(--slate); }
.stat-row .stat-value { font-family: var(--font-mono); color: var(--ink-navy); font-weight: 500; white-space: nowrap; }
.stat-row.total { border-top: 1px dashed var(--paper-line); margin-top: 4px; padding-top: 14px; }
.stat-row.total .stat-value { font-weight: 600; }

.chart-card {
  padding: 22px 28px 28px;
  display: flex;
  align-items: center;
  gap: 22px;
  border-top: 1px solid var(--paper-line);
}

.chart-card .donut-wrap { width: 120px; height: 120px; flex-shrink: 0; position: relative; }
.chart-legend { font-size: 12.5px; }
.chart-legend div { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.chart-legend .swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }

.results-panel.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 340px;
  color: var(--slate);
  font-size: 14px;
  text-align: center;
  padding: 40px;
  border-top: 1px dashed var(--border);
  background: var(--paper);
}

.results-panel.empty .empty-icon {
  width: 44px;
  height: 44px;
  color: var(--slate);
  opacity: 0.5;
}

.results-panel.empty span { max-width: 30ch; }

.schedule-section { margin: 8px 0 48px; }
.schedule-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.schedule-head h2 { font-family: var(--font-display); font-size: 22px; margin: 0; }

.schedule-toggle { display: flex; gap: 8px; }
.schedule-toggle button {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 7px 14px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--slate);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.schedule-toggle button:hover:not(.active) { border-color: var(--ink-navy); color: var(--ink-navy); }
.schedule-toggle button.active { background: var(--ink-navy); color: var(--white); border-color: var(--ink-navy); }

.schedule-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; max-height: 420px; overflow-y: auto; box-shadow: var(--shadow-card); }
table.schedule-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.schedule-table th {
  position: sticky;
  top: 0;
  background: var(--paper);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate);
  text-align: right;
  padding: 10px 16px;
  border-bottom: 1px solid var(--paper-line);
}
table.schedule-table th:first-child, table.schedule-table td:first-child { text-align: left; }
table.schedule-table td {
  text-align: right;
  padding: 8px 16px;
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--paper-line);
  color: var(--ink-navy);
}
table.schedule-table tr:last-child td { border-bottom: none; }
table.schedule-table tr:nth-child(even) { background: rgba(14,42,71,0.015); }
table.schedule-table tbody tr:hover { background: rgba(56,189,248,0.08); }

.line-chart-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
  margin: 0 0 56px;
  box-shadow: var(--shadow-card);
}
.line-chart-card h3 { font-family: var(--font-display); font-size: 16px; margin: 0 0 12px; }
.line-chart-card .chart-wrap { height: 280px; }
.line-chart-card .chart-wrap svg { display: block; }

.line-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
}
.line-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--slate);
}
.line-legend-item .swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.disclaimer-note {
  font-size: 12.5px;
  color: var(--slate);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 22px;
  line-height: 1.55;
}

@media (max-width: 860px) {
  .calc-grid { grid-template-columns: 1fr; }
  .chart-card { flex-direction: column; align-items: flex-start; }
  .input-row { grid-template-columns: 1fr 116px; }
}

.about-profile-pic {
  width: 400px;
  height: 400px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 10px 20px rgba(0,0,0,0.15);
  margin-bottom: 2rem;
}

/* Mobile Safari renders <input type="date"> with its own native chrome (gray pill
   background, extra internal padding) that ignores width/background from utility
   classes unless appearance is explicitly reset first. */
input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  background-color: #fff;
}
