/* ========================================
   Apple-Style Mortgage Site CSS
   Modern, minimal design system
   ======================================== */

/* CSS Reset & Base Styles */
:where(*, *::before, *::after) {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:where(html) {
  font-family: system-ui, -apple-system, Inter, 'SF Pro Text', Roboto, Arial, sans-serif;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

:where(body) {
  background: #ffffff;
  color: #1a202c;
  overflow-x: hidden;
}

:where(img, picture, video, canvas, svg) {
  display: block;
  max-width: 100%;
  height: auto;
}

:where(input, button, textarea, select) {
  font: inherit;
}

/* Design Tokens */
:root {
  /* Colors */
  --color-primary: #1a365d;
  --color-secondary: #2d3748;
  --color-accent: #3182ce;
  --color-success: #38a169;
  --color-neutral-50: #f7fafc;
  --color-neutral-100: #edf2f7;
  --color-neutral-200: #e2e8f0;
  --color-neutral-300: #cbd5e0;
  --color-neutral-400: #a0aec0;
  --color-neutral-500: #718096;
  --color-neutral-600: #4a5568;
  --color-neutral-700: #2d3748;
  --color-neutral-800: #1a202c;
  --color-neutral-900: #171923;

  /* Typography Scale */
  --text-xs: 0.75rem;      /* 12px */
  --text-sm: 0.875rem;     /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg: 1.125rem;     /* 18px */
  --text-xl: 1.25rem;      /* 20px */
  --text-2xl: 1.5rem;      /* 24px */
  --text-3xl: 1.75rem;     /* 28px */
  --text-4xl: 2.125rem;    /* 34px */
  --text-5xl: 2.75rem;     /* 44px */
  --text-6xl: 3.5rem;      /* 56px */

  /* Spacing Scale */
  --space-1: 0.25rem;      /* 4px */
  --space-2: 0.5rem;       /* 8px */
  --space-3: 0.75rem;      /* 12px */
  --space-4: 1rem;         /* 16px */
  --space-6: 1.5rem;       /* 24px */
  --space-8: 2rem;         /* 32px */
  --space-12: 3rem;        /* 48px */
  --space-16: 4rem;        /* 64px */

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  /* Shadows */
  --shadow-sm: 0 2px 20px rgba(0,0,0,0.06);
  --shadow-md: 0 8px 30px rgba(0,0,0,0.12);

  /* Breakpoints */
  --breakpoint-sm: 480px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;

  /* Motion */
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --duration-slow: 320ms;
  --easing-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --easing-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0ms;
    --duration-normal: 0ms;
    --duration-slow: 0ms;
  }
  
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus Styles */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Container System */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

@container (min-width: 768px) {
  .container {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

@container (min-width: 1024px) {
  .container {
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }
}

/* Typography */
.text-6xl {
  font-size: var(--text-6xl);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.text-5xl {
  font-size: var(--text-5xl);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.text-4xl {
  font-size: var(--text-4xl);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.text-3xl {
  font-size: var(--text-3xl);
  line-height: 1.3;
  font-weight: 600;
}

.text-2xl {
  font-size: var(--text-2xl);
  line-height: 1.4;
  font-weight: 600;
}

.text-xl {
  font-size: var(--text-xl);
  line-height: 1.5;
  font-weight: 500;
}

.text-lg {
  font-size: var(--text-lg);
  line-height: 1.6;
}

.text-base {
  font-size: var(--text-base);
  line-height: 1.6;
}

.text-sm {
  font-size: var(--text-sm);
  line-height: 1.5;
}

.text-xs {
  font-size: var(--text-xs);
  line-height: 1.4;
}

/* Header Component */
.header {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-neutral-200);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: all var(--duration-normal) var(--easing-smooth);
}

.header__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.header__logo {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--easing-smooth);
}

.header__logo:hover {
  color: var(--color-accent);
}

.header__nav {
  display: none;
  gap: var(--space-8);
}

@media (min-width: 1024px) {
  .header__nav {
    display: flex;
  }
}

.header__nav-link {
  color: var(--color-neutral-700);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--duration-fast) var(--easing-smooth);
  position: relative;
}

.header__nav-link:hover {
  color: var(--color-primary);
}

.header__nav-link--active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-accent);
  border-radius: 1px;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* Button Components */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--easing-smooth);
  white-space: nowrap;
}

.btn--primary {
  background: var(--color-primary);
  color: white;
}

.btn--primary:hover {
  background: var(--color-accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn--secondary {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-neutral-300);
}

.btn--secondary:hover {
  border-color: var(--color-primary);
  background: var(--color-neutral-50);
}

.btn--large {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
}

/* Hero Component */
.hero {
  position: relative;
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, var(--color-neutral-50) 0%, var(--color-neutral-100) 100%);
  overflow: hidden;
}

.hero__container {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-12);
  align-items: center;
  position: relative;
  z-index: 2;
}

@media (min-width: 1024px) {
  .hero__container {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-16);
  }
}

.hero__content {
  text-align: center;
}

@media (min-width: 1024px) {
  .hero__content {
    text-align: left;
  }
}

.hero__headline {
  margin-bottom: var(--space-6);
  color: var(--color-primary);
}

.hero__subheading {
  margin-bottom: var(--space-8);
  color: var(--color-neutral-600);
  max-width: 600px;
}

.hero__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: center;
}

@media (min-width: 768px) {
  .hero__actions {
    flex-direction: row;
    justify-content: center;
  }
}

@media (min-width: 1024px) {
  .hero__actions {
    justify-content: flex-start;
  }
}

.hero__image {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.hero__image img {
  width: 100%;
  height: auto;
  aspect-ratio: 4/3;
  object-fit: cover;
}

/* Animation Classes */
.fade-in {
  opacity: 0;
  animation: fadeIn var(--duration-slow) var(--easing-smooth) forwards;
}

.slide-up {
  opacity: 0;
  transform: translateY(40px);
  animation: slideUp var(--duration-slow) var(--easing-smooth) forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Section Components */
.section {
  padding: var(--space-16) 0;
}

.section--bg {
  background: var(--color-neutral-50);
}

.section__header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.section__title {
  margin-bottom: var(--space-4);
  color: var(--color-primary);
}

.section__subtitle {
  color: var(--color-neutral-600);
  max-width: 600px;
  margin: 0 auto;
}

/* Grid Components */
.grid {
  display: grid;
  gap: var(--space-8);
}

.grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid--4 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Card Components */
.card {
  background: white;
  border-radius: var(--radius-md);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--easing-smooth);
  height: 100%;
}

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

.card__icon {
  width: 48px;
  height: 48px;
  background: var(--color-accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-6);
}

.card__title {
  margin-bottom: var(--space-4);
  color: var(--color-primary);
}

.card__description {
  color: var(--color-neutral-600);
  margin-bottom: var(--space-6);
}

/* Footer Component */
.footer {
  background: var(--color-neutral-900);
  color: var(--color-neutral-300);
  padding: var(--space-16) 0 var(--space-8);
}

.footer__container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-8);
  margin-bottom: var(--space-12);
}

.footer__section {
  
}

.footer__title {
  color: white;
  margin-bottom: var(--space-6);
  font-weight: 600;
}

.footer__link {
  color: var(--color-neutral-400);
  text-decoration: none;
  transition: color var(--duration-fast) var(--easing-smooth);
  display: block;
  margin-bottom: var(--space-2);
}

.footer__link:hover {
  color: white;
}

.footer__bottom {
  border-top: 1px solid var(--color-neutral-700);
  padding-top: var(--space-8);
  text-align: center;
  color: var(--color-neutral-500);
}

.footer__bottom .footer__link {
  display: inline;
  margin-bottom: 0;
  margin-right: 0;
  color: var(--color-neutral-400);
}

/* Utility Classes */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }

.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }

.hidden { display: none; }

@media (min-width: 768px) {
  .md\:block { display: block; }
  .md\:hidden { display: none; }
}