/* ── Shared styles for all content/learn/calculator pages ── */

/* ── Nav overrides (extends styles.css) ── */
.site-header .logo { text-decoration: none; }

.main-nav { display: flex; align-items: center; }
.nav-list  {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0; padding: 0;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 7px 13px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: color 150ms, background 150ms;
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active { color: #fff; background: rgba(255,255,255,.08); }
.nav-link.active { color: #fff; }
.caret { font-size: 0.7rem; transition: transform 150ms; }
.has-dropdown.open .caret { transform: rotate(180deg); }

/* Dropdown */
.has-dropdown { position: relative; }
.dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 230px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 6px;
  list-style: none;
  box-shadow: 0 8px 32px rgba(0,0,0,.35);
  z-index: 200;
}
.has-dropdown:hover .dropdown,
.has-dropdown.open .dropdown { display: block; }
.dropdown a {
  display: block;
  padding: 9px 12px;
  border-radius: 7px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.86rem;
  transition: background 120ms, color 120ms;
}
.dropdown a:hover { background: rgba(255,255,255,.08); color: #fff; }
.dropdown a.active { color: #60a5fa; }

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: #94a3b8;
  border-radius: 2px;
  transition: transform 200ms, opacity 200ms;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
  .nav-hamburger { display: flex; }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: #0f172a;
    border-top: 1px solid #1e293b;
    padding: 12px 20px 20px;
    z-index: 300;
  }
  .main-nav.open { display: block; }
  .nav-list { flex-direction: column; align-items: stretch; gap: 2px; }
  .nav-link { justify-content: space-between; }
  .dropdown { position: static; box-shadow: none; border: none; background: #1e293b; margin: 4px 0 4px 12px; border-radius: 8px; }
  .has-dropdown:hover .dropdown { display: none; }
  .has-dropdown.open .dropdown { display: block; }
  .site-header { position: relative; }
}

/* ── Full-width footer ── */
.site-footer-full {
  background: #0f172a;
  color: #64748b;
  margin-top: 60px;
  font-size: 0.85rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  padding: 48px 20px;
}
.footer-brand p { margin-top: 10px; line-height: 1.7; max-width: 240px; }
.footer-col h4 { color: #e2e8f0; font-size: 0.82rem; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 12px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { color: #64748b; text-decoration: none; transition: color 150ms; }
.footer-col a:hover { color: #cbd5e1; }
.footer-bottom { border-top: 1px solid #1e293b; padding: 16px 0; text-align: center; font-size: 0.78rem; }
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ── Page hero ── */
.page-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  color: #fff;
  padding: 52px 0 48px;
}
.page-hero .breadcrumb {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 14px;
}
.page-hero .breadcrumb a { color: #64748b; text-decoration: none; }
.page-hero .breadcrumb a:hover { color: #94a3b8; }
.page-hero .breadcrumb span { margin: 0 6px; }
.page-hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}
.page-hero .lead {
  font-size: 1.05rem;
  color: #94a3b8;
  max-width: 640px;
  line-height: 1.7;
}
.page-hero .hero-meta {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.hero-meta span { font-size: 0.8rem; color: #64748b; display: flex; align-items: center; gap: 5px; }

/* ── Content layout ── */
.content-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 40px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 20px 60px;
  align-items: start;
}
@media (max-width: 900px) {
  .content-layout { grid-template-columns: 1fr; }
  .sidebar { display: contents; }
}

/* ── Article prose ── */
.article-body { min-width: 0; }
.article-body h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  margin: 44px 0 14px;
  padding-top: 8px;
  border-top: 2px solid #f0f4f8;
}
.article-body h2:first-child { margin-top: 0; border-top: none; }
.article-body h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  margin: 28px 0 10px;
}
.article-body p { color: #334155; line-height: 1.8; margin-bottom: 14px; }
.article-body ul, .article-body ol {
  color: #334155;
  line-height: 1.8;
  padding-left: 22px;
  margin-bottom: 16px;
}
.article-body li { margin-bottom: 6px; }
.article-body strong { color: #0f172a; }
.article-body a { color: #2563eb; text-decoration: underline; text-underline-offset: 3px; }
.article-body a:hover { color: #1d4ed8; }

/* ── Callout / info box ── */
.callout {
  background: #eff6ff;
  border-left: 4px solid #2563eb;
  border-radius: 0 10px 10px 0;
  padding: 16px 20px;
  margin: 24px 0;
}
.callout.green { background: #f0fdf4; border-color: #10b981; }
.callout.amber { background: #fffbeb; border-color: #f59e0b; }
.callout p { margin: 0; font-size: 0.95rem; }
.callout strong { display: block; margin-bottom: 4px; }

/* ── Comparison table ── */
.compare-table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 0.9rem; }
.compare-table th {
  background: #0f172a;
  color: #fff;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
}
.compare-table th:not(:first-child) { text-align: right; }
.compare-table td { padding: 11px 16px; border-bottom: 1px solid #e2e8f0; color: #334155; }
.compare-table td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.compare-table tr:nth-child(even) td { background: #f8fafc; }
.compare-table .positive { color: #10b981; font-weight: 600; }
.compare-table .highlight td { background: #eff6ff !important; font-weight: 600; }

/* ── Formula display ── */
.formula-box {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 24px 28px;
  margin: 20px 0;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
}
.formula-box .formula-main { font-size: 1.4rem; color: #60a5fa; margin-bottom: 16px; }
.formula-vars { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 0.85rem; }
.formula-vars dt { color: #60a5fa; font-weight: 700; }
.formula-vars dd { color: #94a3b8; margin: 0; }

/* ── Step-by-step ── */
.steps { list-style: none; padding: 0; margin: 20px 0; counter-reset: step; }
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  margin-bottom: 16px;
  align-items: start;
}
.steps li::before {
  content: counter(step);
  background: #2563eb;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.steps li p { margin: 0; color: #334155; line-height: 1.7; }
.steps li code {
  background: #f0f4f8;
  border-radius: 4px;
  padding: 2px 7px;
  font-family: monospace;
  font-size: 0.9em;
  color: #1e293b;
}

/* ── FAQ ── */
.faq { margin: 8px 0; }
.faq-item { border-bottom: 1px solid #e2e8f0; }
.faq-item:first-child { border-top: 1px solid #e2e8f0; }
.faq-q {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 16px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  font-family: inherit;
  gap: 12px;
}
.faq-q .faq-icon { font-size: 1.1rem; color: #2563eb; flex-shrink: 0; transition: transform 200ms; }
.faq-item.open .faq-icon { transform: rotate(45deg); }
.faq-a { display: none; padding: 0 4px 16px; color: #475569; line-height: 1.8; font-size: 0.93rem; }
.faq-item.open .faq-a { display: block; }

/* ── Mini calculator widget ── */
.mini-calc-widget {
  background: #fff;
  border: 1px solid #dde3ec;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
  margin: 28px 0;
}
.mini-calc-widget h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mini-calc-widget h3::before {
  content: '⚡';
  font-size: 1rem;
}
.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 480px) { .mini-grid { grid-template-columns: 1fr; } }
.mini-field label { display: block; font-size: 0.78rem; font-weight: 600; color: #64748b; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.mini-field input, .mini-field select {
  width: 100%;
  border: 1.5px solid #dde3ec;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 0.95rem;
  font-family: inherit;
  color: #0f172a;
  background: #f8fafc;
  transition: border-color 150ms;
  box-sizing: border-box;
}
.mini-field input:focus, .mini-field select:focus { outline: none; border-color: #2563eb; background: #fff; }
.mini-results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (max-width: 400px) { .mini-results { grid-template-columns: 1fr 1fr; } }
.mini-result {
  background: #f0f4f8;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.mini-result:first-child { background: rgba(16,185,129,.1); }
.mini-label { display: block; font-size: 0.7rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.mini-value { display: block; font-size: 1.05rem; font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; }
.mini-result:first-child .mini-value { color: #10b981; }
.btn-full-calc {
  display: block;
  text-align: center;
  padding: 11px;
  background: #2563eb;
  color: #fff !important;
  border-radius: 8px;
  text-decoration: none !important;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 150ms;
}
.btn-full-calc:hover { background: #1d4ed8; color: #fff !important; }

/* ── Sidebar ── */
.sidebar { position: sticky; top: 80px; }
.sidebar-card {
  background: #fff;
  border: 1px solid #dde3ec;
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.sidebar-card h4 { font-size: 0.82rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 14px; }
.sidebar-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.sidebar-links a {
  display: block;
  padding: 8px 10px;
  border-radius: 7px;
  color: #334155;
  text-decoration: none;
  font-size: 0.875rem;
  transition: background 120ms, color 120ms;
}
.sidebar-links a:hover { background: #f0f4f8; color: #2563eb; }
.sidebar-links a.current { background: #eff6ff; color: #2563eb; font-weight: 600; }

/* ── Related cards grid ── */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.related-card {
  display: block;
  background: #fff;
  border: 1px solid #dde3ec;
  border-radius: 12px;
  padding: 18px;
  text-decoration: none;
  transition: box-shadow 150ms, border-color 150ms, transform 150ms;
}
.related-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); border-color: #2563eb; transform: translateY(-2px); }
.related-card .rc-tag { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #2563eb; margin-bottom: 6px; }
.related-card .rc-title { font-size: 0.95rem; font-weight: 700; color: #0f172a; margin-bottom: 6px; }
.related-card .rc-desc { font-size: 0.82rem; color: #64748b; line-height: 1.6; }

/* ── Key stat highlight ── */
.stat-row { display: flex; gap: 16px; flex-wrap: wrap; margin: 20px 0; }
.stat-box {
  flex: 1;
  min-width: 140px;
  background: #fff;
  border: 1px solid #dde3ec;
  border-radius: 12px;
  padding: 16px 18px;
  text-align: center;
}
.stat-box .stat-val { font-size: 1.6rem; font-weight: 800; color: #2563eb; display: block; }
.stat-box .stat-lbl { font-size: 0.78rem; color: #64748b; margin-top: 2px; }

code { background: #f0f4f8; border-radius: 4px; padding: 2px 6px; font-family: monospace; font-size: 0.9em; color: #1e293b; }

/* ── Embedded full calculator (embed-calc.js) ── */
#embed-calc-container {
  background: #fff;
  border: 1px solid #dde3ec;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
  margin: 32px 0;
}
.ec-top {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 28px;
  align-items: start;
  margin-bottom: 28px;
}
@media (max-width: 700px) { .ec-top { grid-template-columns: 1fr; } }

.ec-heading { font-size: 1rem; font-weight: 700; color: #0f172a; margin: 0 0 18px; }

.ec-field { margin-bottom: 14px; }
.ec-field label { display: flex; align-items: center; justify-content: space-between; font-size: 0.82rem; font-weight: 600; color: #334155; margin-bottom: 5px; }
.ec-iw {
  display: flex;
  align-items: center;
  border: 1.5px solid #dde3ec;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 150ms;
}
.ec-iw:focus-within { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.ec-pre, .ec-suf {
  padding: 0 9px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  background: #f8fafc;
  height: 38px;
  display: flex;
  align-items: center;
  white-space: nowrap;
}
.ec-pre { border-right: 1.5px solid #dde3ec; }
.ec-suf { border-left: 1.5px solid #dde3ec; }
.ec-iw input, .ec-iw select {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 0.95rem; font-weight: 500;
  color: #0f172a; padding: 0 10px; height: 38px; min-width: 0;
}
.ec-sel-w { position: relative; }
.ec-sel-w::after { content: '▾'; position: absolute; right: 10px; color: #64748b; pointer-events: none; font-size: 0.8rem; }
.ec-sel-w select { appearance: none; padding-right: 28px; cursor: pointer; }

.ec-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}
.ec-s-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
}
.ec-s-hi { background: rgba(16,185,129,.1); border-color: rgba(16,185,129,.25); grid-column: 1 / -1; }
.ec-s-lbl { display: block; font-size: 0.68rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.ec-s-val { display: block; font-size: 1.05rem; font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; }
.ec-s-hi .ec-s-val { font-size: 1.4rem; color: #10b981; }

.ec-chart-col { min-width: 0; }
.ec-chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ec-chart-lbl { font-size: 0.82rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .06em; }

.ec-table-section { border-top: 1px solid #e2e8f0; padding-top: 20px; }

/* Loan payment widget */
.loan-payment-widget {
  background: #f8fafc;
  border: 1px solid #dde3ec;
  border-radius: 12px;
  padding: 20px 22px;
  margin: 20px 0;
}
.loan-payment-widget h3 { font-size: 0.95rem; font-weight: 700; color: #0f172a; margin: 0 0 16px; }
.lpw-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
@media (max-width: 500px) { .lpw-grid { grid-template-columns: 1fr 1fr; } }
.lpw-field label { display: block; font-size: 0.72rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.lpw-field input {
  width: 100%; border: 1.5px solid #dde3ec; border-radius: 7px;
  padding: 8px 10px; font-size: 0.95rem; font-family: inherit; box-sizing: border-box;
  background: #fff; color: #0f172a;
}
.lpw-field input:focus { outline: none; border-color: #2563eb; }
.lpw-results { display: flex; gap: 10px; flex-wrap: wrap; }
.lpw-result { flex: 1; min-width: 110px; background: #fff; border: 1px solid #dde3ec; border-radius: 9px; padding: 10px 12px; text-align: center; }
.lpw-result:first-child { background: rgba(37,99,235,.07); border-color: rgba(37,99,235,.2); }
.lpw-lbl { display: block; font-size: 0.68rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.lpw-val { display: block; font-size: 1.05rem; font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; }
