/* ==========================================================================
   Learning Reverse Mortgage — Modern Design System
   Primary: #1e3a5f (deep navy) | Accent: #0d9488 (teal) | Warm: #f8fafc
   Fonts: Merriweather (headings) | Source Sans 3 (body)
   Senior-friendly: 17px base, high contrast, 48px+ touch targets
   ========================================================================== */

/* --- Reset & Base --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 17px; scroll-behavior: smooth; }
body {
  font-family: 'Source Sans 3', 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.8;
  color: #334155;
  background: #fff;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: #0d9488; text-decoration: none; transition: color .2s; }
a:hover { color: #1e3a5f; }

h1, h2, h3, h4 { font-family: 'Merriweather', Georgia, serif; color: #1e3a5f; line-height: 1.3; font-weight: 700; }
h1 { font-size: 2.8rem; margin-bottom: 1rem; }
h2 { font-size: 2rem; margin-bottom: .85rem; }
h3 { font-size: 1.4rem; margin-bottom: .65rem; }
p { margin-bottom: 1.15rem; }
::selection { background: #0d9488; color: #fff; }
:focus-visible { outline: 3px solid #0d9488; outline-offset: 2px; }

/* --- Layout --- */
.container { max-width: 1140px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 820px; margin: 0 auto; padding: 0 24px; }
.text-center { text-align: center; }

/* ==========================================================================
   HEADER
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

/* Logo */
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none !important; }
.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #0d9488, #1e3a5f);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .95rem;
}
.logo-text {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.1rem; font-weight: 700; color: #1e3a5f; line-height: 1.2;
}
.logo-text span { color: #0d9488; }

/* Nav */
.main-nav ul { list-style: none; display: flex; align-items: center; gap: 4px; }
.main-nav a {
  display: block; padding: 10px 16px;
  font-size: .95rem; font-weight: 600; color: #475569;
  border-radius: 8px; transition: all .2s; text-decoration: none !important;
}
.main-nav a:hover { color: #0d9488; background: #f0fdfa; }
.main-nav a.active { color: #0d9488; }
.nav-cta {
  background: #0d9488 !important; color: #fff !important;
  padding: 10px 22px !important; border-radius: 8px !important; font-weight: 600 !important;
}
.nav-cta:hover { background: #0f766e !important; }

/* Hamburger */
.nav-toggle {
  display: none; background: none; border: none; cursor: pointer;
  padding: 10px; min-width: 44px; min-height: 44px;
}
.nav-toggle span {
  display: block; width: 24px; height: 2.5px;
  background: #1e3a5f; margin: 5px 0; border-radius: 2px; transition: .3s;
}

/* Nav Overlay */
.nav-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.3); z-index: 90;
}
.nav-overlay.active { display: block; }

/* ==========================================================================
   HERO
   ========================================================================== */
.hero {
  background: linear-gradient(160deg, #1e3a5f 0%, #0d4a6b 50%, #0d9488 100%);
  color: #fff;
  padding: 100px 0 110px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0L60 30L30 60L0 30Z' fill='none' stroke='rgba(255,255,255,0.03)' stroke-width='1'/%3E%3C/svg%3E") repeat;
}
.hero > .container { position: relative; z-index: 2; }
.hero h1 { color: #fff; font-size: 3rem; max-width: 750px; margin: 0 auto 1rem; }
.hero h1 span { color: #99f6e4; }
.hero p { color: rgba(255,255,255,.88); font-size: 1.2rem; max-width: 600px; margin: 0 auto 2rem; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 28px; border-radius: 8px;
  font-weight: 600; font-size: 1rem; cursor: pointer;
  border: none; transition: all .2s; text-decoration: none !important;
  font-family: 'Source Sans 3', sans-serif; letter-spacing: .3px;
  min-height: 48px;
}
.btn-primary { background: #0d9488; color: #fff; }
.btn-primary:hover { background: #0f766e; color: #fff; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(13,148,136,.3); }
.btn-outline { border: 2px solid #0d9488; color: #0d9488; background: transparent; }
.btn-outline:hover { background: #0d9488; color: #fff; }
.btn-outline-white { border: 2px solid rgba(255,255,255,.5); color: #fff; background: transparent; }
.btn-outline-white:hover { background: rgba(255,255,255,.15); color: #fff; }
.btn-white { background: #fff; color: #0d9488; }
.btn-white:hover { background: #f0fdfa; color: #0f766e; }
.btn-lg { padding: 16px 36px; font-size: 1.05rem; }

/* ==========================================================================
   STATS BAR
   ========================================================================== */
.stats-bar { background: #1e293b; padding: 0; }
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); }
.stat-item {
  text-align: center; padding: 28px 16px;
  border-right: 1px solid rgba(255,255,255,.06);
}
.stat-item:last-child { border-right: none; }
.stat-item h3 {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 1.8rem; color: #5eead4; margin-bottom: 2px; font-weight: 700;
}
.stat-item p { color: rgba(255,255,255,.5); font-size: .8rem; text-transform: uppercase; letter-spacing: 1.5px; margin: 0; }

/* ==========================================================================
   SECTIONS
   ========================================================================== */
.section { padding: 80px 0; }
.section-alt { background: #f8fafc; }
.section-header { text-align: center; max-width: 640px; margin: 0 auto 48px; }
.section-header p { color: #64748b; font-size: 1.1rem; }

/* ==========================================================================
   STEPS
   ========================================================================== */
.steps-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 40px; }
.step-item { text-align: center; }
.step-number {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, #0d9488, #1e3a5f);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: 'Merriweather', serif; font-size: 1.4rem; font-weight: 700;
  margin: 0 auto 16px;
  box-shadow: 0 4px 12px rgba(13,148,136,.2);
}
.step-item p { color: #64748b; font-size: .95rem; margin: 0; }

/* ==========================================================================
   TOPIC CARDS
   ========================================================================== */
.topic-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; }
.topic-card {
  background: #fff; border-radius: 12px; padding: 32px 28px;
  border: 1px solid #e2e8f0;
  text-decoration: none !important; color: inherit;
  transition: all .3s;
  display: flex; flex-direction: column;
}
.topic-card:hover {
  border-color: #0d9488;
  box-shadow: 0 8px 30px rgba(13,148,136,.08);
  transform: translateY(-3px);
}
.topic-icon {
  width: 52px; height: 52px;
  background: #f0fdfa; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.topic-icon i { font-size: 1.3rem; color: #0d9488; }
.topic-card h3 { font-size: 1.15rem; color: #1e3a5f; margin-bottom: 8px; }
.topic-card p { color: #64748b; font-size: .92rem; margin: 0 0 auto; flex: 1; }
.topic-card .read-more {
  display: inline-flex; align-items: center; gap: 6px;
  color: #0d9488; font-weight: 600; font-size: .9rem;
  margin-top: 16px; transition: gap .2s;
}
.topic-card:hover .read-more { gap: 10px; }

/* ==========================================================================
   FEATURE CARDS
   ========================================================================== */
.feature-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 24px; }
.feature-card {
  background: #fff; border-radius: 12px; padding: 32px 24px;
  border: 1px solid #e2e8f0; text-align: center;
  transition: all .3s;
}
.feature-card:hover { box-shadow: 0 8px 30px rgba(0,0,0,.06); transform: translateY(-3px); }
.feature-card .icon-wrap {
  width: 52px; height: 52px;
  background: #f0fdfa; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.feature-card .icon-wrap i { font-size: 1.3rem; color: #0d9488; }
.feature-card p { color: #64748b; font-size: .92rem; margin: 0; }

/* ==========================================================================
   CONTENT SPLIT
   ========================================================================== */
.content-split { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; }
.content-split.reverse { direction: rtl; }
.content-split.reverse > * { direction: ltr; }

/* Checklist */
.checklist { list-style: none; padding: 0; margin: 16px 0; }
.checklist li {
  padding: 8px 0; font-size: .95rem;
  display: flex; align-items: flex-start; gap: 12px;
}
.checklist i { color: #0d9488; margin-top: 5px; font-size: .85rem; }

/* ==========================================================================
   FAQ ACCORDION
   ========================================================================== */
.faq-list { max-width: 800px; margin: 0 auto; }
.faq-item { border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.faq-question {
  width: 100%; background: #fff; border: none;
  padding: 20px 24px; font-size: 1.05rem; font-weight: 600;
  color: #1e3a5f; text-align: left; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  font-family: 'Source Sans 3', sans-serif; transition: background .2s;
  min-height: 48px;
}
.faq-question:hover { background: #f8fafc; }
.faq-question i { color: #0d9488; transition: transform .3s; font-size: .85rem; }
.faq-item.active .faq-question { background: #f0fdfa; }
.faq-item.active .faq-question i { transform: rotate(180deg); }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height .4s ease; }
.faq-answer-inner { padding: 0 24px 20px; color: #475569; line-height: 1.8; }
.faq-answer-inner ul { margin: 8px 0 8px 20px; }

/* ==========================================================================
   CTA BANNER
   ========================================================================== */
.cta-banner {
  background: linear-gradient(135deg, #0d9488, #1e3a5f);
  padding: 72px 0; text-align: center; color: #fff;
}
.cta-banner h2 { color: #fff; font-size: 2.1rem; margin-bottom: 12px; }
.cta-banner p { font-size: 1.1rem; max-width: 520px; margin: 0 auto 28px; opacity: .9; }

/* ==========================================================================
   FORMS
   ========================================================================== */
.form-wrapper {
  max-width: 640px; margin: 0 auto;
  background: #fff; border-radius: 16px; padding: 48px 40px;
  box-shadow: 0 4px 24px rgba(0,0,0,.06); border: 1px solid #e2e8f0;
}
.form-wrapper h2 { text-align: center; margin-bottom: 6px; }
.form-subtitle { text-align: center; color: #64748b; margin-bottom: 32px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; color: #1e3a5f; font-size: .92rem; }
.form-group .required { color: #dc2626; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 13px 16px; min-height: 48px;
  border: 1.5px solid #cbd5e1; border-radius: 8px;
  font-size: 1rem; font-family: 'Source Sans 3', sans-serif;
  transition: border-color .2s, box-shadow .2s; background: #f8fafc;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13,148,136,.1); background: #fff;
}
.form-group textarea { resize: vertical; min-height: 120px; }
.form-group .error-msg { color: #dc2626; font-size: .8rem; margin-top: 4px; display: none; }
.form-group.has-error input, .form-group.has-error select, .form-group.has-error textarea { border-color: #dc2626; }
.form-group.has-error .error-msg { display: block; }
.form-consent { font-size: .85rem; color: #64748b; margin-bottom: 20px; display: flex; gap: 10px; align-items: flex-start; }
.form-consent input[type="checkbox"] { margin-top: 4px; accent-color: #0d9488; min-width: 18px; min-height: 18px; }
.form-consent.has-error { color: #dc2626; }
.btn-submit { width: 100%; padding: 16px; font-size: 1.05rem; }
.form-success, .form-error { display: none; padding: 16px; border-radius: 10px; margin-top: 16px; font-weight: 600; text-align: center; }
.form-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.form-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* ==========================================================================
   BREADCRUMBS
   ========================================================================== */
.breadcrumbs {
  background: #f8fafc; padding: 12px 0;
  font-size: .85rem; color: #94a3b8; border-bottom: 1px solid #e2e8f0;
}
.breadcrumbs a { color: #0d9488; font-weight: 500; }
.breadcrumbs i { font-size: .6rem; margin: 0 8px; color: #cbd5e1; }

/* ==========================================================================
   ARTICLE CONTENT
   ========================================================================== */
.article-meta {
  display: flex; gap: 16px; align-items: center;
  margin-bottom: 32px; font-size: .88rem; color: #94a3b8;
}
.article-meta span { display: flex; align-items: center; gap: 5px; }
.article-meta .category {
  background: #f0fdfa; color: #0d9488; padding: 4px 12px;
  border-radius: 20px; font-weight: 600; font-size: .8rem;
}

.key-takeaways {
  background: #f0fdfa; border-left: 4px solid #0d9488;
  border-radius: 0 12px 12px 0; padding: 24px 28px; margin-bottom: 32px;
}
.key-takeaways h3 { font-size: 1.05rem; color: #0d9488; margin-bottom: 12px; font-family: 'Source Sans 3', sans-serif; }
.key-takeaways ul { margin: 0; padding-left: 20px; }
.key-takeaways li { margin-bottom: 6px; color: #334155; font-size: .95rem; }

.article-content h2 { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid #e2e8f0; }
.article-content h2:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.article-content h3 { margin-top: 1.8rem; }
.article-content ul, .article-content ol { margin-bottom: 1.25rem; padding-left: 1.5rem; }
.article-content li { margin-bottom: .5rem; }
.article-content blockquote {
  border-left: 4px solid #0d9488; background: #f8fafc;
  margin: 2rem 0; padding: 20px 24px; border-radius: 0 8px 8px 0;
  font-style: italic; color: #475569;
}
.article-content a { color: #0d9488; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.article-content a.btn { color: #fff; text-decoration: none; font-weight: 600; }
.article-content table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; }
.article-content th { background: #1e3a5f; color: #fff; padding: 12px 16px; text-align: left; font-size: .9rem; }
.article-content td { padding: 12px 16px; border-bottom: 1px solid #e2e8f0; font-size: .92rem; }
.article-content tr:nth-child(even) { background: #f8fafc; }

/* Reading progress bar */
.reading-progress { position: fixed; top: 0; left: 0; height: 3px; background: #0d9488; z-index: 200; transition: width .1s; }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer { background: #0f172a; color: rgba(255,255,255,.55); padding: 60px 0 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 48px; margin-bottom: 32px; }
.footer-about .logo-text { color: #fff; font-size: 1.15rem; margin-bottom: 12px; }
.footer-about p { font-size: .88rem; line-height: 1.7; }
.footer-links h4 {
  color: #5eead4; font-size: .8rem; margin-bottom: 16px;
  text-transform: uppercase; letter-spacing: 1.5px;
  font-family: 'Source Sans 3', sans-serif; font-weight: 700;
}
.footer-links ul { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: rgba(255,255,255,.55); font-size: .88rem; }
.footer-links a:hover { color: #5eead4; }

.footer-disclosure {
  border-top: 1px solid rgba(255,255,255,.06); padding: 20px 0; margin-top: 8px;
}
.footer-disclosure p { font-size: .75rem; color: rgba(255,255,255,.35); margin-bottom: 8px; line-height: 1.6; }
.footer-disclosure p:first-child { font-weight: 600; color: rgba(255,255,255,.5); }
.footer-disclosure p:last-child { margin-bottom: 0; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.06); padding: 20px 0;
  display: flex; justify-content: space-between; align-items: center; font-size: .8rem;
}
.footer-bottom p { margin: 0; }
.footer-legal { display: flex; gap: 20px; }
.footer-legal a { color: rgba(255,255,255,.35); }
.footer-legal a:hover { color: #5eead4; }

/* ==========================================================================
   STICKY MOBILE CTA
   ========================================================================== */
.sticky-cta {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid #e2e8f0;
  padding: 10px 16px; display: none; align-items: center;
  z-index: 90; box-shadow: 0 -2px 12px rgba(0,0,0,.06);
}
.sticky-cta .btn-primary { flex: 1; text-align: center; justify-content: center; }
.sticky-cta.visible { display: flex; }

/* ==========================================================================
   404 ERROR PAGE
   ========================================================================== */
.error-page { padding: 120px 0; text-align: center; }
.error-page h1 { font-size: 6rem; color: #e2e8f0; margin-bottom: 0; font-family: 'Source Sans 3', sans-serif; }
.error-page h2 { font-size: 2rem; margin-bottom: 16px; }
.error-page p { color: #64748b; margin-bottom: 28px; font-size: 1.05rem; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 968px) {
  .topic-grid, .feature-grid { grid-template-columns: repeat(2,1fr); }
  .content-split { grid-template-columns: 1fr; gap: 32px; }
  .content-split.reverse { direction: ltr; }
  .footer-grid { grid-template-columns: 1fr; gap: 32px; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .steps-grid { grid-template-columns: 1fr; gap: 24px; }
  h1 { font-size: 2.2rem; }
  .hero { padding: 70px 0 80px; }
  .hero h1 { font-size: 2.4rem; }
}

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .main-nav {
    position: fixed; top: 0; right: -100%; width: 280px; height: 100vh;
    background: #fff; box-shadow: -4px 0 20px rgba(0,0,0,.08);
    transition: right .3s; z-index: 200; padding: 80px 24px 24px;
  }
  .main-nav.open { right: 0; }
  .main-nav ul { flex-direction: column; gap: 0; }
  .main-nav li { border-bottom: 1px solid #f1f5f9; }
  .main-nav a { display: block; padding: 14px 0; border-radius: 0; }
  .nav-cta { margin-top: 8px; text-align: center !important; display: block !important; }
  .topic-grid, .feature-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .form-wrapper { padding: 28px 20px; }
  .footer-bottom { flex-direction: column; gap: 12px; text-align: center; }
  .section { padding: 56px 0; }
}

@media (min-width: 769px) {
  .sticky-cta { display: none !important; }
}

/* Print styles */
@media print {
  .site-header, .sticky-cta, .cta-banner, .nav-overlay { display: none !important; }
  .hero { background: #1e3a5f !important; padding: 40px 0; }
  .section { padding: 32px 0; }
  body { font-size: 12pt; }
}
