/* ============================================================
   GRANT DOES MORTGAGE — Design System
   Deep Forest (#2D4A3E) + Gold (#C6A24E)
   Fraunces (headings) + DM Sans (body)
   ============================================================ */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;0,9..144,800;1,9..144,400;1,9..144,600&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* --- Tokens --- */
:root {
  /* Primary */
  --forest: #2D4A3E;
  --forest-deep: #1E332B;
  --forest-light: #3D5F50;
  --forest-muted: #4A6B5C;
  --gold: #C6A24E;
  --gold-light: #D4B76A;
  --gold-dark: #A8873C;
  --gold-glow: rgba(198, 162, 78, 0.15);

  /* Neutrals */
  --cream: #FAF8F2;
  --cream-warm: #F5F0E6;
  --warm-gray: #E8E2D6;
  --text-primary: #2D4A3E;
  --text-secondary: #5A6F64;
  --text-muted: #8A9A90;
  --white: #FFFFFF;
  --border: rgba(45, 74, 62, 0.12);
  --border-strong: rgba(45, 74, 62, 0.25);

  /* Accent */
  --sage: #7BA68A;
  --sage-light: #A3C4AF;
  --coral: #C45A42;
  --sky: #4A82B0;

  /* Typography */
  --font-display: 'Fraunces', serif;
  --font-body: 'DM Sans', sans-serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(45, 74, 62, 0.08);
  --shadow-md: 0 4px 12px rgba(45, 74, 62, 0.1);
  --shadow-lg: 0 8px 30px rgba(45, 74, 62, 0.12);
  --shadow-xl: 0 16px 50px rgba(45, 74, 62, 0.15);
  --shadow-gold: 0 4px 20px rgba(198, 162, 78, 0.25);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  overflow-x: hidden;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--cream);
  word-wrap: break-word;
  overflow-wrap: break-word;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  color: var(--forest);
  text-wrap: balance;
}
h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.5rem); letter-spacing: -0.015em; }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.75rem); letter-spacing: -0.01em; }
p { color: var(--text-secondary); max-width: 65ch; text-wrap: pretty; }
.text-gold { color: var(--gold); }
.text-forest { color: var(--forest); }

/* --- Container --- */
.container { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 var(--space-xl); }
.container-narrow { max-width: 800px; }
.container-wide { max-width: 1600px; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--font-body); font-weight: 600; font-size: 0.95rem;
  padding: 0.75rem 1.75rem; border-radius: var(--radius-pill); border: 2px solid transparent;
  transition: all var(--duration-normal) var(--ease-out);
  white-space: nowrap;
}
.btn-primary {
  background: var(--gold); color: var(--forest-deep); border-color: var(--gold);
}
.btn-primary:hover {
  background: var(--gold-light); border-color: var(--gold-light);
  box-shadow: var(--shadow-gold); transform: translateY(-1px);
}
.btn-secondary {
  background: transparent; color: var(--forest); border-color: var(--forest);
}
.btn-secondary:hover {
  background: var(--forest); color: var(--cream);
}
.btn-ghost {
  background: transparent; color: var(--cream); border-color: rgba(255,255,255,0.3);
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.5);
}
.btn-lg { padding: 1rem 2.25rem; font-size: 1.05rem; }

/* --- Nav / Header --- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(250, 248, 242, 0.92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background var(--duration-normal) var(--ease-out);
}
.site-header.scrolled {
  background: rgba(250, 248, 242, 0.97);
  box-shadow: var(--shadow-sm);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1400px; margin: 0 auto; padding: 0.85rem var(--space-xl);
}
.nav-inner > nav { display: flex; align-items: center; }
.nav-logo {
  font-family: var(--font-display); font-weight: 700; font-size: 1.25rem;
  color: var(--forest); display: flex; align-items: center; gap: 0.5rem;
}
.nav-logo .logo-accent { color: var(--gold); }
.nav-links { display: flex; align-items: center; gap: 0.25rem; list-style: none; }
.nav-links > li > a, .nav-links > li > .dropdown-trigger {
  font-family: var(--font-body); font-size: 0.9rem; font-weight: 500;
  color: var(--text-secondary); padding: 0.5rem 0.85rem; border-radius: var(--radius-pill);
  transition: all var(--duration-fast) ease; text-decoration: none; cursor: pointer;
  display: flex; align-items: center; gap: 3px;
}
.nav-links > li > a:hover, .nav-links > li > a.active,
.nav-links > li > .dropdown-trigger:hover, .nav-links > li > .dropdown-trigger.active {
  color: var(--forest); background: rgba(45, 74, 62, 0.06);
}
.nav-cta .btn { padding: 0.55rem 1.25rem; font-size: 0.85rem; }
.nav-pill { padding: 0.35rem 0.9rem; border-radius: var(--radius-pill); font-weight: 600; font-size: 0.85rem; transition: all 0.15s; }
.nav-pill-agents { border: 1.5px solid var(--forest); background: var(--gold-glow); color: var(--forest) !important; }
.nav-pill-agents:hover { background: var(--forest); color: var(--cream) !important; }
.nav-pill-grant { border: 1.5px solid var(--gold); background: var(--white); color: var(--gold-dark) !important; }
.nav-pill-grant:hover { background: var(--gold); color: var(--white) !important; }

/* Dropdown nav */
.nav-dropdown { position: relative; }
.dropdown-arrow { transition: transform var(--duration-fast) ease; margin-top: 1px; }
.nav-dropdown:hover .dropdown-arrow { transform: rotate(180deg); }
.dropdown-menu {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); min-width: 250px; padding: 0.5rem 0;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--duration-fast) ease, visibility var(--duration-fast) ease;
  z-index: 100; list-style: none; margin-top: 0;
}
/* Invisible bridge to prevent hover gap */
.nav-dropdown::after {
  content: ''; position: absolute; top: 100%; left: 0; right: 0; height: 12px;
}
.nav-dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; pointer-events: auto; }
.dropdown-menu li a {
  display: block; padding: 0.6rem 1rem; font-size: 0.84rem; font-weight: 500;
  color: var(--text-primary); border-radius: 0; white-space: nowrap; text-decoration: none;
}
.dropdown-menu li a:hover { background: var(--cream); color: var(--gold-dark); }
.dropdown-soon {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 1rem; font-size: 0.84rem; color: var(--text-muted); opacity: 0.55;
}
.soon-badge {
  font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--cream-warm); color: var(--text-muted); padding: 1px 6px; border-radius: var(--radius-pill);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none; background: none; border: none; padding: 0.5rem;
  color: var(--forest);
}
.nav-toggle svg { width: 24px; height: 24px; }

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: center; background: var(--cream);
    border-bottom: 1px solid var(--border); padding: var(--space-md);
    box-shadow: var(--shadow-md);
  }
  .nav-links.open { display: flex; }
  .nav-links > li { width: 100%; text-align: center; }
  .nav-links > li > a, .nav-links > li > .dropdown-trigger { padding: 0.75rem 1rem; width: 100%; justify-content: center; }
  .nav-cta { display: none; }
  /* Mobile dropdowns */
  .dropdown-menu {
    position: static; transform: none; box-shadow: none; border: none;
    background: rgba(45,74,62,0.03); margin: 0; padding: 0;
    max-height: 0; overflow: hidden; opacity: 1; visibility: visible; pointer-events: auto;
    transition: max-height 0.3s ease;
  }
  .nav-dropdown.open .dropdown-menu { max-height: 300px; padding: 0.25rem 0; }
  .dropdown-menu li a { padding-left: 2rem; }
  .dropdown-soon { padding-left: 2rem; }
}

/* --- Footer --- */
.site-footer {
  background: var(--forest-deep); color: rgba(255,255,255,0.7); padding: var(--space-3xl) 0 var(--space-xl);
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-2xl); margin-bottom: var(--space-2xl);
}
.footer-brand h3 { color: var(--cream); margin-bottom: var(--space-md); font-size: 1.3rem; }
.footer-brand .logo-accent { color: var(--gold); }
.footer-brand p { color: rgba(255,255,255,0.6); font-size: 0.9rem; max-width: 300px; }
.footer-col h4 {
  font-family: var(--font-body); font-weight: 600; font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--gold); margin-bottom: var(--space-md);
}
.footer-col a {
  display: block; font-size: 0.9rem; color: rgba(255,255,255,0.6);
  padding: 0.25rem 0; transition: color var(--duration-fast) ease;
}
.footer-col a:hover { color: var(--cream); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1); padding-top: var(--space-lg);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.8rem; color: rgba(255,255,255,0.4);
}
.footer-bottom a { color: rgba(255,255,255,0.5); }
.footer-bottom a:hover { color: var(--gold); }
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--space-xl); }
  .footer-brand { grid-column: 1 / -1; text-align: center; }
  .footer-brand p { margin: 0 auto; }
  .footer-col { text-align: center; }
  .footer-bottom { flex-direction: column; gap: var(--space-sm); text-align: center; }
}
@media (max-width: 420px) {
  .footer-grid { grid-template-columns: 1fr; gap: var(--space-lg); }
  .footer-brand { grid-column: auto; }
}

/* --- Section --- */
.section { padding: var(--space-4xl) 0; }
.section-label {
  font-family: var(--font-body); font-weight: 600; font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--gold);
  margin-bottom: var(--space-sm);
}
.section-title { margin-bottom: var(--space-md); }
.section-subtitle { font-size: 1.1rem; color: var(--text-secondary); max-width: 55ch; }

/* --- Cards --- */
.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-xl);
  transition: all var(--duration-normal) var(--ease-out);
}
.card:hover {
  box-shadow: var(--shadow-md); border-color: var(--border-strong);
  transform: translateY(-2px);
}
.card-icon {
  width: 48px; height: 48px; border-radius: var(--radius-md);
  background: var(--gold-glow); display: flex; align-items: center; justify-content: center;
  color: var(--gold); margin-bottom: var(--space-md);
}

/* --- Forms --- */
.form-group { margin-bottom: var(--space-lg); }
.form-label {
  display: block; font-weight: 500; font-size: 0.85rem;
  color: var(--text-primary); margin-bottom: var(--space-xs);
}
.form-input, .form-textarea, .form-select {
  width: 100%; padding: 0.75rem 1rem; font-family: var(--font-body); font-size: 0.95rem;
  color: var(--text-primary); background: var(--white);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-md);
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.form-textarea { resize: vertical; min-height: 120px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* --- Animations --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.animate-fade-up {
  opacity: 0; animation: fadeUp 0.6s var(--ease-out) forwards;
}
.animate-fade-up.delay-1 { animation-delay: 0.1s; }
.animate-fade-up.delay-2 { animation-delay: 0.2s; }
.animate-fade-up.delay-3 { animation-delay: 0.3s; }
.animate-fade-up.delay-4 { animation-delay: 0.4s; }

/* --- Utility --- */
.text-center { text-align: center; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.visually-hidden { position: absolute; width: 1px; height: 1px; clip: rect(0,0,0,0); overflow: hidden; }

/* --- Global Responsive Safety Net --- */
img, video, svg, iframe, embed, object { max-width: 100%; height: auto; }
table { max-width: 100%; overflow-x: auto; display: block; }
pre, code { overflow-x: auto; max-width: 100%; }
section, div, aside, main, article { max-width: 100vw; }

@media (max-width: 600px) {
  h1 { font-size: clamp(1.5rem, 5vw, 2.2rem) !important; }
  h2 { font-size: clamp(1.2rem, 4vw, 1.6rem) !important; }
  .btn-lg { font-size: 0.95rem; padding: 0.75rem 1.5rem; }
  .btn { white-space: normal; text-align: center; max-width: 100%; }
  .container { padding: 0 var(--space-lg); }
}
