/* ============================================
   MortgageWave.ca — Master Stylesheet
   Modern, mobile-first, professional
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; color: #1a2b3c; line-height: 1.7; background: #fff; }
img { max-width: 100%; height: auto; display: block; }
a { color: #0066cc; text-decoration: none; transition: color .2s; }
a:hover { color: #004a99; }
ul, ol { list-style: none; }
h1, h2, h3, h4, h5, h6 { line-height: 1.3; font-weight: 700; }
h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; margin-bottom: 1rem; }
h3 { font-size: 1.5rem; margin-bottom: .75rem; }
p { margin-bottom: 1rem; }

/* --- Colors --- */
:root {
  --primary: #0a3d62;
  --primary-light: #1e6fa0;
  --accent: #27ae60;
  --accent-dark: #1e8449;
  --bg-light: #f4f8fb;
  --bg-dark: #0a2a3f;
  --text: #1a2b3c;
  --text-light: #5a6a7a;
  --white: #ffffff;
  --border: #dde4ea;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
  --radius: 8px;
  --radius-lg: 16px;
  --max-width: 1200px;
}

/* --- Utility --- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem; }
.section { padding: 5rem 0; }
.section-alt { background: var(--bg-light); }
.text-center { text-align: center; }
.text-light { color: var(--text-light); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.section-header { text-align: center; max-width: 700px; margin: 0 auto 3rem; }
.section-header p { color: var(--text-light); font-size: 1.125rem; }

/* --- Buttons --- */
.btn { display: inline-block; padding: .875rem 2rem; border-radius: var(--radius); font-weight: 600; font-size: 1rem; cursor: pointer; border: none; transition: all .25s; text-align: center; }
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: var(--accent-dark); color: var(--white); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-secondary { background: var(--white); color: var(--primary); border: 2px solid var(--primary); }
.btn-secondary:hover { background: var(--primary); color: var(--white); }
.btn-outline-white { background: transparent; color: var(--white); border: 2px solid var(--white); }
.btn-outline-white:hover { background: var(--white); color: var(--primary); }
.btn-sm { padding: .625rem 1.25rem; font-size: .875rem; }
.btn-lg { padding: 1rem 2.5rem; font-size: 1.125rem; }
.btn-block { display: block; width: 100%; }

/* --- Sticky Header --- */
.top-bar { background: var(--primary); color: var(--white); padding: .5rem 0; font-size: .875rem; }
.top-bar .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; }
.top-bar a { color: var(--white); }
.top-bar a:hover { color: var(--accent); }

header.main-header { background: var(--white); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 1000; }
header .container { display: flex; justify-content: space-between; align-items: center; padding-top: .75rem; padding-bottom: .75rem; }
.logo { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.logo span { color: var(--accent); }

nav.main-nav ul { display: flex; gap: 1.75rem; align-items: center; }
nav.main-nav a { color: var(--text); font-weight: 500; font-size: .95rem; padding: .25rem 0; position: relative; }
nav.main-nav a:hover, nav.main-nav a.active { color: var(--primary); }
nav.main-nav a.active::after { content: ''; position: absolute; bottom: -4px; left: 0; right: 0; height: 2px; background: var(--accent); border-radius: 2px; }

/* Dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown > a::after { content: ' ▾'; font-size: .7em; }
.dropdown-menu { position: absolute; top: 100%; left: 0; background: var(--white); box-shadow: var(--shadow-lg); border-radius: var(--radius); min-width: 220px; padding: .5rem 0; opacity: 0; visibility: hidden; transform: translateY(8px); transition: all .2s; z-index: 100; }
.nav-dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu a { display: block; padding: .5rem 1.25rem; white-space: nowrap; }
.dropdown-menu a:hover { background: var(--bg-light); color: var(--primary); }

.header-cta { display: none; }
@media(min-width:1024px) { .header-cta { display: inline-block; } }

/* Mobile Nav */
.mobile-toggle { display: none; background: none; border: none; cursor: pointer; padding: .5rem; }
.mobile-toggle span { display: block; width: 24px; height: 2px; background: var(--text); margin: 5px 0; transition: all .3s; border-radius: 2px; }
.mobile-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.mobile-toggle.active span:nth-child(2) { opacity: 0; }
.mobile-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

@media(max-width:1023px) {
  .mobile-toggle { display: block; }
  nav.main-nav { position: fixed; top: 0; right: -100%; width: 80%; max-width: 360px; height: 100vh; background: var(--white); box-shadow: var(--shadow-lg); padding: 5rem 2rem 2rem; transition: right .3s; z-index: 999; overflow-y: auto; }
  nav.main-nav.open { right: 0; }
  nav.main-nav ul { flex-direction: column; gap: .25rem; }
  nav.main-nav a { display: block; padding: .75rem 0; font-size: 1.1rem; }
  .dropdown-menu { position: static; box-shadow: none; opacity: 1; visibility: visible; transform: none; padding-left: 1rem; }
  .nav-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 998; display: none; }
  .nav-overlay.show { display: block; }
}

/* --- Hero --- */
.hero { background: linear-gradient(135deg, var(--primary) 0%, var(--bg-dark) 100%); color: var(--white); padding: 5rem 0 4rem; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; top: -50%; right: -20%; width: 600px; height: 600px; background: radial-gradient(circle, rgba(39,174,96,.15) 0%, transparent 70%); border-radius: 50%; }
.hero .container { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; position: relative; z-index: 1; }
.hero-content h1 { font-size: 3rem; margin-bottom: 1.25rem; }
.hero-content h1 span { color: var(--accent); }
.hero-content p { font-size: 1.2rem; margin-bottom: 2rem; opacity: .9; }
.hero-buttons { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 2rem; margin-top: 2.5rem; }
.hero-stat { text-align: center; }
.hero-stat .number { font-size: 2rem; font-weight: 800; color: var(--accent); display: block; }
.hero-stat .label { font-size: .85rem; opacity: .8; }
.hero-visual { display: flex; justify-content: center; align-items: center; }

@media(max-width:768px) {
  .hero .container { grid-template-columns: 1fr; text-align: center; }
  .hero-content h1 { font-size: 2rem; }
  .hero-buttons { justify-content: center; }
  .hero-stats { justify-content: center; }
  .hero-visual { display: none; }
}

/* --- Rate Cards --- */
.rate-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 1.5rem; }
.rate-card { background: var(--white); border-radius: var(--radius-lg); padding: 2rem; text-align: center; box-shadow: var(--shadow); border: 1px solid var(--border); transition: transform .2s, box-shadow .2s; }
.rate-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.rate-card.featured { border-color: var(--accent); position: relative; }
.rate-card.featured::before { content: 'Most Popular'; position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--white); padding: .25rem 1rem; border-radius: 20px; font-size: .8rem; font-weight: 600; }
.rate-card .term { font-size: .9rem; color: var(--text-light); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem; }
.rate-card .rate { font-size: 2.75rem; font-weight: 800; color: var(--primary); }
.rate-card .rate small { font-size: .9rem; font-weight: 400; }
.rate-card .type { color: var(--text-light); margin: .5rem 0 1.5rem; }
.rate-card .btn { width: 100%; }

/* --- Features / Services Grid --- */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 2rem; }
.feature-card { background: var(--white); padding: 2rem; border-radius: var(--radius-lg); box-shadow: var(--shadow); border: 1px solid var(--border); transition: transform .2s; }
.feature-card:hover { transform: translateY(-2px); }
.feature-card .icon { font-size: 2.5rem; margin-bottom: 1rem; }
.feature-card h3 { margin-bottom: .5rem; }
.feature-card p { color: var(--text-light); margin-bottom: 1rem; }

/* --- Testimonials --- */
.testimonials-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px,1fr)); gap: 2rem; }
.testimonial { background: var(--white); padding: 2rem; border-radius: var(--radius-lg); box-shadow: var(--shadow); border-left: 4px solid var(--accent); }
.testimonial .stars { color: #f39c12; margin-bottom: .75rem; font-size: 1.1rem; }
.testimonial blockquote { font-style: italic; color: var(--text-light); margin-bottom: 1rem; line-height: 1.8; }
.testimonial .author { font-weight: 600; }
.testimonial .author span { color: var(--text-light); font-weight: 400; }

/* --- Calculator Widget --- */
.calculator-widget { background: var(--white); border-radius: var(--radius-lg); padding: 2.5rem; box-shadow: var(--shadow-lg); max-width: 600px; margin: 0 auto; }
.calculator-widget h3 { text-align: center; margin-bottom: 1.5rem; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: .375rem; font-size: .95rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: .75rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 1rem; font-family: inherit; transition: border-color .2s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(10,61,98,.1); }
.calc-result { background: var(--bg-light); padding: 1.5rem; border-radius: var(--radius); text-align: center; margin-top: 1.5rem; }
.calc-result .amount { font-size: 2.25rem; font-weight: 800; color: var(--primary); }
.calc-result .label { color: var(--text-light); }

/* --- CTA Banner --- */
.cta-banner { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); color: var(--white); padding: 4rem 0; text-align: center; }
.cta-banner h2 { color: var(--white); margin-bottom: 1rem; }
.cta-banner p { font-size: 1.125rem; opacity: .9; margin-bottom: 2rem; max-width: 600px; margin-left: auto; margin-right: auto; }
.cta-banner .btn { margin: 0 .5rem; }

/* --- Contact Form --- */
.contact-section { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start; }
@media(max-width:768px) { .contact-section { grid-template-columns: 1fr; } }
.contact-form { background: var(--white); padding: 2.5rem; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.contact-info-card { background: var(--primary); color: var(--white); padding: 2.5rem; border-radius: var(--radius-lg); }
.contact-info-card h3 { color: var(--white); margin-bottom: 1.5rem; }
.contact-info-item { display: flex; gap: 1rem; margin-bottom: 1.5rem; align-items: flex-start; }
.contact-info-item .icon { font-size: 1.5rem; flex-shrink: 0; }
.contact-info-item a { color: var(--white); }

.inline-form { background: var(--white); padding: 2rem; border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.inline-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media(max-width:600px) { .inline-form .form-row { grid-template-columns: 1fr; } }

/* --- Blog --- */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px,1fr)); gap: 2rem; }
.blog-card { background: var(--white); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); transition: transform .2s; }
.blog-card:hover { transform: translateY(-3px); }
.blog-card-img { height: 200px; background: linear-gradient(135deg, var(--primary-light), var(--primary)); display: flex; align-items: center; justify-content: center; color: var(--white); font-size: 3rem; }
.blog-card-body { padding: 1.5rem; }
.blog-card-body .meta { font-size: .85rem; color: var(--text-light); margin-bottom: .5rem; }
.blog-card-body h3 { margin-bottom: .5rem; }
.blog-card-body h3 a { color: var(--text); }
.blog-card-body h3 a:hover { color: var(--primary); }
.blog-card-body p { color: var(--text-light); font-size: .95rem; }

.blog-post { max-width: 800px; margin: 0 auto; }
.blog-post .post-meta { color: var(--text-light); margin-bottom: 2rem; font-size: .95rem; }
.blog-post h2 { margin-top: 2.5rem; }
.blog-post h3 { margin-top: 2rem; }
.blog-post ul, .blog-post ol { margin: 1rem 0 1rem 1.5rem; }
.blog-post li { margin-bottom: .5rem; list-style: disc; }
.blog-post ol li { list-style: decimal; }
.blog-post .highlight-box { background: var(--bg-light); border-left: 4px solid var(--accent); padding: 1.25rem 1.5rem; margin: 1.5rem 0; border-radius: 0 var(--radius) var(--radius) 0; }
.blog-post table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.blog-post th, .blog-post td { padding: .75rem 1rem; border: 1px solid var(--border); text-align: left; }
.blog-post th { background: var(--bg-light); font-weight: 600; }

/* --- Location Pages --- */
.location-hero { background: linear-gradient(135deg, var(--primary) 0%, var(--bg-dark) 100%); color: var(--white); padding: 4rem 0 3rem; }
.location-hero h1 { margin-bottom: .75rem; }
.location-hero p { font-size: 1.15rem; opacity: .9; max-width: 700px; }

/* --- FAQ --- */
.faq-list { max-width: 800px; margin: 0 auto; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden; }
.faq-question { width: 100%; background: var(--white); border: none; padding: 1.25rem 1.5rem; text-align: left; font-size: 1.05rem; font-weight: 600; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-family: inherit; color: var(--text); }
.faq-question:hover { background: var(--bg-light); }
.faq-question::after { content: '+'; font-size: 1.5rem; font-weight: 300; transition: transform .2s; flex-shrink: 0; margin-left: 1rem; }
.faq-item.open .faq-question::after { content: '−'; }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height .3s ease; }
.faq-answer-inner { padding: 0 1.5rem 1.25rem; color: var(--text-light); }

/* --- Footer --- */
footer.main-footer { background: var(--bg-dark); color: rgba(255,255,255,.8); padding: 4rem 0 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 3rem; }
@media(max-width:768px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media(max-width:480px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-col h4 { color: var(--white); margin-bottom: 1rem; font-size: 1.1rem; }
.footer-col p { font-size: .95rem; margin-bottom: .75rem; }
.footer-col a { color: rgba(255,255,255,.7); display: block; padding: .25rem 0; font-size: .95rem; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding: 1.5rem 0; text-align: center; font-size: .875rem; }

/* --- Page Header (interior pages) --- */
.page-header { background: linear-gradient(135deg, var(--primary) 0%, var(--bg-dark) 100%); color: var(--white); padding: 3.5rem 0 2.5rem; }
.page-header h1 { margin-bottom: .5rem; }
.page-header p { opacity: .9; font-size: 1.1rem; max-width: 600px; }
.breadcrumb { font-size: .875rem; margin-bottom: 1rem; opacity: .7; }
.breadcrumb a { color: var(--white); }
.breadcrumb span { margin: 0 .5rem; }

/* --- Two-column content --- */
.content-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 3rem; align-items: start; }
@media(max-width:768px) { .content-grid { grid-template-columns: 1fr; } }
.sidebar { position: sticky; top: 100px; }
.sidebar-card { background: var(--white); border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; border: 1px solid var(--border); }
.sidebar-card h4 { margin-bottom: 1rem; }

/* --- Trust Badges --- */
.trust-bar { display: flex; justify-content: center; gap: 3rem; flex-wrap: wrap; padding: 2rem 0; }
.trust-item { text-align: center; }
.trust-item .icon { font-size: 2rem; margin-bottom: .5rem; }
.trust-item .label { font-size: .85rem; color: var(--text-light); font-weight: 500; }

/* --- Exit Banner --- */
.exit-banner { position: fixed; bottom: 0; left: 0; right: 0; background: var(--primary); color: var(--white); padding: 1rem 0; transform: translateY(100%); transition: transform .4s; z-index: 900; }
.exit-banner.show { transform: translateY(0); }
.exit-banner .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.exit-banner p { margin: 0; font-size: 1.05rem; }
.exit-banner .close-banner { background: none; border: none; color: var(--white); font-size: 1.5rem; cursor: pointer; padding: .25rem .5rem; }

/* --- Misc --- */
.map-embed { border-radius: var(--radius-lg); overflow: hidden; margin-top: 2rem; }
.map-embed iframe { width: 100%; height: 400px; border: 0; }

/* Process / Steps */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 2rem; counter-reset: step; }
.step { text-align: center; position: relative; }
.step::before { counter-increment: step; content: counter(step); display: flex; align-items: center; justify-content: center; width: 50px; height: 50px; background: var(--accent); color: var(--white); border-radius: 50%; font-size: 1.25rem; font-weight: 700; margin: 0 auto 1rem; }

/* Form success */
.form-success { display: none; text-align: center; padding: 2rem; }
.form-success.show { display: block; }
.form-success .checkmark { font-size: 3rem; color: var(--accent); margin-bottom: 1rem; }

/* Animations */
@keyframes fadeInUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
.animate-in { animation: fadeInUp .6s ease forwards; }
