/* ==========================================
   THE MORTGAGE COMPANY — Design Tokens & Styles
   Dark navy + gold accent + teal CTA
   ========================================== */

/* === BASE RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  hanging-punctuation: first last;
  scroll-padding-top: 5rem;
}
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; max-width: 72ch; }
::selection { background: oklch(from var(--color-teal) l c h / 0.3); color: #fff; }
:focus-visible { outline: 2px solid var(--color-teal); 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'], [role='link'], input, textarea, select {
  transition: color var(--transition-interactive), background var(--transition-interactive), border-color var(--transition-interactive), box-shadow 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 {
  /* Type Scale */
  --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, 3.5rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 5rem);

  /* Spacing */
  --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 */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;

  /* Fonts */
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Satoshi', 'Inter', sans-serif;
}

/* === DARK THEME (default) === */
:root, [data-theme='dark'] {
  --color-bg: #0c0f1a;
  --color-surface: #111528;
  --color-surface-2: #161a30;
  --color-surface-offset: #0e1224;
  --color-border: #252a42;
  --color-divider: #1e2238;

  --color-text: #e0dfd8;
  --color-text-muted: #8b8e9e;
  --color-text-faint: #565969;

  --color-gold: #d4a547;
  --color-gold-hover: #e0b85a;
  --color-gold-dim: #b08a38;

  --color-teal: #2aaa8a;
  --color-teal-hover: #35c49f;
  --color-teal-active: #228f74;

  --color-warning: #c47030;
  --color-error: #d45050;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
}

/* === LIGHT THEME === */
[data-theme='light'] {
  --color-bg: #f5f3ee;
  --color-surface: #ffffff;
  --color-surface-2: #fafaf7;
  --color-surface-offset: #edeae4;
  --color-border: #d4d0c8;
  --color-divider: #e0ddd6;

  --color-text: #1a1d2e;
  --color-text-muted: #5c5f70;
  --color-text-faint: #9b9da8;

  --color-gold: #b88a28;
  --color-gold-hover: #a07520;
  --color-gold-dim: #8a6518;

  --color-teal: #1a8a6f;
  --color-teal-hover: #15755e;
  --color-teal-active: #116350;

  --color-warning: #b06020;
  --color-error: #c04040;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.15);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --color-bg: #f5f3ee;
    --color-surface: #ffffff;
    --color-surface-2: #fafaf7;
    --color-surface-offset: #edeae4;
    --color-border: #d4d0c8;
    --color-divider: #e0ddd6;
    --color-text: #1a1d2e;
    --color-text-muted: #5c5f70;
    --color-text-faint: #9b9da8;
    --color-gold: #b88a28;
    --color-gold-hover: #a07520;
    --color-gold-dim: #8a6518;
    --color-teal: #1a8a6f;
    --color-teal-hover: #15755e;
    --color-teal-active: #116350;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.15);
  }
}

/* === LAYOUT === */
.container {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-4);
}
@media (min-width: 768px) {
  .container { padding-inline: var(--space-8); }
}

.section {
  padding-block: clamp(var(--space-12), 6vw, var(--space-24));
}

.section__header {
  text-align: center;
  margin-bottom: clamp(var(--space-8), 4vw, var(--space-16));
  max-width: 680px;
  margin-inline: auto;
}
.section__eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-teal);
  margin-bottom: var(--space-3);
}
.section__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--color-gold);
  margin-bottom: var(--space-4);
  font-weight: 400;
}
.section__desc {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  max-width: 60ch;
  margin-inline: auto;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 700;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition-interactive), transform var(--transition-interactive), box-shadow var(--transition-interactive);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--color-teal);
  color: #fff;
}
.btn--primary:hover {
  background: var(--color-teal-hover);
  box-shadow: 0 4px 20px rgba(42, 170, 138, 0.3);
}
.btn--primary:active { background: var(--color-teal-active); }

.btn--full { width: 100%; }
.btn--lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

/* === NAVIGATION === */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(12, 15, 26, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
  transition: background 0.3s ease;
}
[data-theme='light'] .nav {
  background: rgba(245, 243, 238, 0.9);
}

.nav__inner {
  max-width: var(--content-wide);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  gap: var(--space-4);
}
@media (min-width: 768px) {
  .nav__inner { padding-inline: var(--space-8); }
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--color-text);
  flex-shrink: 0;
}
.nav__logo svg { width: 32px; height: 32px; flex-shrink: 0; }
.nav__logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.nav__logo-the {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.nav__logo-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--color-gold);
  font-weight: 400;
}

.nav__links {
  display: none;
  align-items: center;
  gap: var(--space-6);
}
@media (min-width: 1024px) {
  .nav__links { display: flex; }
}
.nav__link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  position: relative;
  padding: var(--space-1) 0;
}
.nav__link:hover { color: var(--color-text); }
.nav__link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-gold);
  transition: width 0.3s var(--ease-out);
}
.nav__link:hover::after { width: 100%; }

.nav__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.nav__phone {
  display: none;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
}
@media (min-width: 768px) {
  .nav__phone { display: flex; }
}
.nav__phone svg { color: var(--color-gold); }
.nav__phone:hover { color: var(--color-gold); }

.nav__cta {
  display: none;
  padding: var(--space-2) var(--space-5);
  font-size: var(--text-xs);
}
@media (min-width: 768px) {
  .nav__cta { display: inline-flex; }
}

.nav__theme {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  transition: color var(--transition-interactive), background var(--transition-interactive);
}
.nav__theme:hover {
  color: var(--color-gold);
  background: var(--color-surface);
}

/* Hamburger */
.nav__hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}
.nav__hamburger span {
  width: 20px;
  height: 2px;
  background: var(--color-text);
  transition: transform 0.3s var(--ease-out), opacity 0.3s var(--ease-out);
  border-radius: 1px;
}
.nav__hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__hamburger.active span:nth-child(2) { opacity: 0; }
.nav__hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
@media (min-width: 1024px) {
  .nav__hamburger { display: none; }
}

/* Mobile Menu */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}
.mobile-menu.active {
  opacity: 1;
  pointer-events: auto;
}
.mobile-menu__nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
}
.mobile-menu__link {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-text);
  text-decoration: none;
  transition: color var(--transition-interactive);
}
.mobile-menu__link:hover { color: var(--color-gold); }
.mobile-menu__phone {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-gold);
}

/* === HERO === */
.hero {
  position: relative;
  padding-top: calc(5rem + var(--space-12));
  padding-bottom: var(--space-4);
  overflow: hidden;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero__bg-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background:
    radial-gradient(ellipse 50% 60% at 70% 20%, var(--color-gold) 0%, transparent 70%),
    radial-gradient(ellipse 40% 50% at 20% 80%, var(--color-teal) 0%, transparent 70%);
  pointer-events: none;
}

.hero__inner {
  max-width: var(--content-wide);
  margin-inline: auto;
  padding-inline: var(--space-4);
  display: grid;
  gap: var(--space-8);
  align-items: center;
}
@media (min-width: 768px) {
  .hero__inner { padding-inline: var(--space-8); }
}
@media (min-width: 900px) {
  .hero__inner {
    grid-template-columns: 1fr 420px;
    gap: var(--space-12);
  }
}

.hero__content { padding-block: var(--space-8) var(--space-4); }

.hero__title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  line-height: 1.05;
  color: var(--color-text);
  margin-bottom: var(--space-6);
  font-weight: 400;
}
.hero__title-line { display: block; }
.hero__title-line--gold { color: var(--color-gold); }

.hero__sub {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  max-width: 48ch;
  line-height: 1.7;
}
.hero__sub strong { color: var(--color-text); font-weight: 600; }

.hero__trust {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  flex-wrap: wrap;
}
.hero__trust svg { flex-shrink: 0; }
.hero__trust-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-text-faint);
}

/* Hero Form */
.hero__form-wrapper { width: 100%; max-width: 420px; justify-self: end; }

.hero-form {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
}
.hero-form__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-gold);
  margin-bottom: var(--space-1);
  font-weight: 400;
}
.hero-form__sub {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
}

.hero-form__field {
  margin-bottom: var(--space-4);
}
.hero-form__field label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}
.hero-form__field input,
.hero-form__field select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text);
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive);
}
.hero-form__field input:focus,
.hero-form__field select:focus {
  outline: none;
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px rgba(42, 170, 138, 0.15);
}
.hero-form__field input::placeholder { color: var(--color-text-faint); }
.hero-form__field select { appearance: none; cursor: pointer; }

.hero-form .btn { margin-top: var(--space-2); }

.hero-form__disclaimer {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-3);
  line-height: 1.5;
}

/* Stats Bar */
.stats-bar {
  margin-top: var(--space-8);
  padding-inline: var(--space-4);
}
@media (min-width: 768px) {
  .stats-bar { padding-inline: var(--space-8); }
}
.stats-bar__inner {
  max-width: var(--content-wide);
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
  padding: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
}
@media (min-width: 768px) {
  .stats-bar__inner { grid-template-columns: repeat(4, 1fr); padding: var(--space-8); }
}

.stat { text-align: center; }
.stat__number {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-gold);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.stat__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* === SERVICES === */
.services__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: var(--space-6);
}

.service-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive), transform var(--transition-interactive);
}
.service-card:hover {
  border-color: var(--color-gold-dim);
  box-shadow: 0 8px 30px rgba(212, 165, 71, 0.08);
  transform: translateY(-2px);
}

.service-card__icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 165, 71, 0.08);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
}
[data-theme='light'] .service-card__icon {
  background: rgba(184, 138, 40, 0.1);
}

.service-card__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
  margin-bottom: var(--space-2);
  font-weight: 400;
}
.service-card__desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-4);
}
.service-card__benefit {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-teal);
  padding: var(--space-1) var(--space-3);
  background: rgba(42, 170, 138, 0.1);
  border-radius: var(--radius-full);
}

/* === HOW IT WORKS === */
.how-it-works {
  background: var(--color-surface-offset);
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 800px;
  margin-inline: auto;
}
@media (min-width: 768px) {
  .steps {
    flex-direction: row;
    gap: 0;
    max-width: 100%;
  }
}

.step {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4) 0;
}
@media (min-width: 768px) {
  .step {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 var(--space-3);
  }
}

.step__number {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-teal);
  color: #fff;
  font-weight: 700;
  font-size: var(--text-base);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.step__connector {
  display: none;
}
@media (min-width: 768px) {
  .step__connector {
    display: block;
    position: absolute;
    top: 24px;
    left: calc(50% + 28px);
    width: calc(100% - 56px);
    height: 2px;
    background: var(--color-border);
  }
  .step:last-child .step__connector { display: none; }
}
/* Vertical connector on mobile */
.step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 23px;
  top: 64px;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
}
@media (min-width: 768px) {
  .step:not(:last-child)::after { display: none; }
}

.step__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
  margin-bottom: var(--space-1);
  font-weight: 400;
}
.step__desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* === CALCULATORS === */
.calc-tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-2);
  justify-content: center;
  flex-wrap: wrap;
}
.calc-tab {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: transparent;
  white-space: nowrap;
  transition: all var(--transition-interactive);
}
.calc-tab:hover {
  color: var(--color-text);
  border-color: var(--color-gold-dim);
}
.calc-tab.active {
  background: var(--color-gold);
  color: #0c0f1a;
  border-color: var(--color-gold);
}
[data-theme='light'] .calc-tab.active {
  color: #fff;
}

.calc-panel {
  display: none;
}
.calc-panel.active {
  display: block;
}

.calc__layout {
  display: grid;
  gap: var(--space-8);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}
@media (min-width: 768px) {
  .calc__layout {
    grid-template-columns: 1fr 1fr;
    padding: var(--space-8);
  }
}

.calc__field {
  margin-bottom: var(--space-4);
}
.calc__field label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}
.calc__field input,
.calc__field select,
.calc__field textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text);
}
.calc__field textarea {
  resize: vertical;
  min-height: 100px;
}
.calc__field input:focus,
.calc__field select:focus,
.calc__field textarea:focus {
  outline: none;
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px rgba(42, 170, 138, 0.15);
}
.calc__hint {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-1);
  display: block;
}

.calc__row {
  display: flex;
  gap: var(--space-2);
}

.input-prefix, .input-suffix {
  display: flex;
  align-items: center;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive);
}
.input-prefix:focus-within, .input-suffix:focus-within {
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px rgba(42, 170, 138, 0.15);
}
.input-prefix span, .input-suffix span {
  padding: 0 var(--space-3);
  color: var(--color-text-faint);
  font-size: var(--text-sm);
  font-weight: 600;
  flex-shrink: 0;
}
.input-prefix input, .input-suffix input {
  border: none;
  background: transparent;
  padding: var(--space-3) var(--space-3);
  flex: 1;
  min-width: 0;
}
.input-prefix input:focus, .input-suffix input:focus {
  outline: none;
  box-shadow: none;
}

/* Results */
.calc__total {
  text-align: center;
  padding: var(--space-6);
  background: rgba(42, 170, 138, 0.06);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
}
.calc__total-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-2);
}
.calc__total-value {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--color-teal);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.calc__chart-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-4);
}
.calc__chart-wrap canvas {
  max-width: 200px;
  max-height: 200px;
}

.calc__breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.calc__breakdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}
.calc__breakdown-item span:last-child {
  margin-left: auto;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}
.calc__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.calc__cta { margin-top: var(--space-4); }

/* Affordability results */
.calc__afford-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.afford-item {
  padding: var(--space-4);
  background: var(--color-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}
.afford-item__label {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}
.afford-item__value {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-gold);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.afford-item small {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-1);
  display: block;
}

/* Refinance results */
.calc__refi-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.refi-stat {
  padding: var(--space-4);
  background: var(--color-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  text-align: center;
}
.refi-stat--wide { grid-column: 1 / -1; }
.refi-stat__label {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}
.refi-stat__value {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-teal);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.refi-stat__value--muted { color: var(--color-text); font-size: var(--text-lg); }

/* === BROKER COMPARISON === */
.broker { background: var(--color-bg); }

.broker__comparison {
  display: grid;
  gap: var(--space-6);
  align-items: start;
  max-width: 900px;
  margin-inline: auto;
  position: relative;
}
@media (min-width: 768px) {
  .broker__comparison {
    grid-template-columns: 1fr auto 1fr;
    gap: var(--space-8);
    align-items: center;
  }
}

.broker__col {
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
}
.broker__col--bank {
  background: var(--color-surface);
  opacity: 0.7;
}
.broker__col--us {
  background: var(--color-surface);
  border-color: var(--color-gold-dim);
  box-shadow: 0 0 30px rgba(212, 165, 71, 0.08);
}

.broker__col-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}
.broker__col-header svg { flex-shrink: 0; color: var(--color-text-muted); }
.broker__col--us .broker__col-header svg { color: var(--color-gold); }
.broker__col-header h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 400;
  color: var(--color-text);
}

.broker__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.broker__list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.5;
}
.broker__list li svg { flex-shrink: 0; margin-top: 2px; }
.broker__col--us .broker__list li { color: var(--color-text); }

.broker__vs {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-gold);
  color: #0c0f1a;
  font-weight: 700;
  font-size: var(--text-sm);
  margin-inline: auto;
  flex-shrink: 0;
}

/* === TEAM === */
.team { background: var(--color-surface-offset); }

.team__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: var(--space-6);
}

.team-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  text-align: center;
}

.team-card__photo {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-surface-2);
  border: 2px solid var(--color-border);
  margin: 0 auto var(--space-4);
  color: var(--color-text-faint);
}

.team-card__name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  color: var(--color-text);
  font-weight: 400;
  margin-bottom: var(--space-1);
}
.team-card__title {
  font-size: var(--text-sm);
  color: var(--color-gold);
  font-weight: 500;
  margin-bottom: var(--space-1);
}
.team-card__nmls {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-bottom: var(--space-3);
}
.team-card__bio {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-4);
}

.team-card__contact {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.team-card__link {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-decoration: none;
}
.team-card__link:hover { color: var(--color-teal); }

/* === TESTIMONIALS === */
.testimonials__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: var(--space-6);
}

.testimonial-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}

.testimonial-card__stars {
  display: flex;
  gap: 2px;
  margin-bottom: var(--space-4);
}
.testimonial-card__stars svg { width: 16px; height: 16px; }

.testimonial-card__quote {
  font-size: var(--text-base);
  color: var(--color-text);
  line-height: 1.7;
  margin-bottom: var(--space-5);
  font-style: normal;
}

.testimonial-card__author {
  border-top: 1px solid var(--color-divider);
  padding-top: var(--space-4);
}
.testimonial-card__name {
  display: block;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: var(--space-1);
}
.testimonial-card__detail {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* === RATES TABLE === */
.rates { background: var(--color-surface-offset); }

.rates__table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
}

.rates__table {
  min-width: 560px;
}
.rates__table thead {
  background: rgba(212, 165, 71, 0.06);
}
.rates__table th {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-gold);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.rates__table td {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm);
  color: var(--color-text);
  border-bottom: 1px solid var(--color-divider);
  font-variant-numeric: tabular-nums;
}
.rates__table tbody tr:last-child td { border-bottom: none; }
.rates__table tbody tr:hover {
  background: rgba(42, 170, 138, 0.04);
}

.rates__disclaimer {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  max-width: 72ch;
  margin-inline: auto;
  text-align: center;
  margin-top: var(--space-4);
  line-height: 1.6;
}

/* === RATE ALERT === */
.rate-alert {
  background: var(--color-bg);
}
.rate-alert__inner {
  display: grid;
  gap: var(--space-6);
  align-items: center;
  max-width: 800px;
  margin-inline: auto;
  padding: var(--space-8);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  text-align: center;
}
@media (min-width: 768px) {
  .rate-alert__inner {
    grid-template-columns: 1fr 1fr;
    text-align: left;
  }
}

.rate-alert__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-gold);
  margin-bottom: var(--space-2);
  font-weight: 400;
}
.rate-alert__desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.rate-alert__form { width: 100%; }
.rate-alert__input-wrap {
  display: flex;
  gap: var(--space-2);
}
.rate-alert__input {
  flex: 1;
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text);
}
.rate-alert__input:focus {
  outline: none;
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px rgba(42, 170, 138, 0.15);
}
.rate-alert__input::placeholder { color: var(--color-text-faint); }
.rate-alert__btn { flex-shrink: 0; }

.rate-alert__note {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-2);
}

/* === CONTACT === */
.contact__grid {
  display: grid;
  gap: var(--space-8);
}
@media (min-width: 768px) {
  .contact__grid {
    grid-template-columns: 1fr 1fr;
  }
}

.contact__info {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.contact__item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}
.contact__item svg { flex-shrink: 0; margin-top: 2px; }
.contact__item strong {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text);
  margin-bottom: 2px;
}
.contact__item a,
.contact__item span {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
}
.contact__item a:hover { color: var(--color-teal); }

.contact__form {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
}

/* === FOOTER === */
.footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-12) 0 var(--space-8);
  background: var(--color-surface-offset);
}

.footer__top {
  display: grid;
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}
@media (min-width: 768px) {
  .footer__top {
    grid-template-columns: 1fr 2fr;
  }
}

.footer__brand .nav__logo { margin-bottom: var(--space-3); }
.footer__tagline {
  font-family: var(--font-display);
  font-size: var(--text-base);
  color: var(--color-gold);
  margin-bottom: var(--space-2);
}
.footer__bilingual {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.footer__links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-6);
}
.footer__col h4 {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.footer__col a {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  padding: var(--space-1) 0;
}
.footer__col a:hover { color: var(--color-teal); }

.footer__social {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-6) 0;
  border-top: 1px solid var(--color-divider);
  border-bottom: 1px solid var(--color-divider);
}
.footer__social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  transition: all var(--transition-interactive);
}
.footer__social a:hover {
  color: var(--color-gold);
  border-color: var(--color-gold-dim);
}
.footer__social a svg { display: inline; width: 18px; height: 18px; }

.footer__bottom {
  padding-top: var(--space-6);
}
.footer__legal p {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  line-height: 1.7;
}
.footer__ehl {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  color: var(--color-text-muted) !important;
}
.footer__ehl svg { width: 24px; height: 24px; flex-shrink: 0; display: inline; }

/* === SCROLL ANIMATIONS === */
.fade-in {
  opacity: 1;
}
@supports (animation-timeline: scroll()) {
  .fade-in {
    opacity: 0;
    animation: revealFade linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 30%;
  }
}
@keyframes revealFade {
  to { opacity: 1; }
}

/* Fallback for browsers that don't support scroll-driven animations */
@supports not (animation-timeline: scroll()) {
  .fade-in {
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .fade-in.visible { opacity: 1; }
}

/* === PRINT === */
@media print {
  .nav, .mobile-menu, .nav__theme, .calc-tabs, .calc-panel, .rate-alert, .footer__social { display: none !important; }
  body { color: #000; background: #fff; }
  .hero { min-height: auto; padding-top: 2rem; }
}

/* A2P/TCPA Consent Styling */
.hero-form__consent {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
  cursor: pointer;
  margin-top: var(--space-3);
}
.hero-form__consent input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}
.consent-link {
  color: var(--color-primary);
  text-decoration: underline;
}
.consent-link:hover {
  color: var(--color-accent);
}
