/* ======================================================
   Excelergy Mortgages - brand layer
   Tokens, topbar, panels and footer are copied verbatim from
   Excelergy Budget's base.css (see Pension/docs/brand.md) so the
   family looks identical. Mortgage-specific styles live in
   compare.css; prose (FAQ, blog) styles are at the bottom here.
   Dark theme activates when <html data-theme="dark">.
   ====================================================== */

:root {
  /* Theme B: light + electric blue (default) */
  --bg: #ffffff;
  --bg-soft: #f5f8fb;
  --card: rgba(255, 255, 255, 0.92);
  --card-solid: #ffffff;
  --border: #dee7ef;
  --border-strong: #b9c8d6;
  --text: #010E26;
  --muted: #5a6378;
  --primary: #014BC1;
  --primary-dark: #013592;
  --primary-soft: #e0ecfb;
  --accent: #00C4F0;
  --accent-soft: #d4f3fb;
  --topbar-bg: rgba(255, 255, 255, 0.85);
  --topbar-border: rgba(184, 200, 218, 0.85);
  --nav-pill-bg: #eef4fa;
  --table-head-bg: #f5f8fb;
  --table-head-text: #5a6378;
  --table-row-hover: #f5f8fb;
  --hero-glow: rgba(0, 196, 240, 0.10);
  --tile-glow: rgba(0, 196, 240, 0.10);
  --focus-ring: rgba(1, 75, 193, 0.18);
  --primary-shadow: 0 8px 18px rgba(1, 75, 193, 0.30);
  --shadow: 0 16px 36px rgba(1, 14, 38, 0.10);
  --shadow-soft: 0 4px 14px rgba(1, 14, 38, 0.06);
  --radius: 22px;
  --tag-text: var(--primary-dark);
}

/* Theme A: dark mode (logo-native) */
:root[data-theme="dark"] {
  --bg: #000713;
  --bg-soft: #011330;
  --card: rgba(1, 19, 48, 0.92);
  --card-solid: #011330;
  --border: #013592;
  --border-strong: #014BC1;
  --text: #ecf1f8;
  --muted: #7b8aa8;
  --primary: #017FEE;
  --primary-dark: #014BC1;
  --primary-soft: rgba(1, 127, 238, 0.20);
  --accent: #00C4F0;
  --accent-soft: rgba(0, 196, 240, 0.18);
  --topbar-bg: rgba(0, 7, 19, 0.85);
  --topbar-border: rgba(1, 53, 146, 0.55);
  --nav-pill-bg: rgba(1, 19, 48, 0.7);
  --table-head-bg: rgba(1, 53, 146, 0.30);
  --table-head-text: #7b8aa8;
  --table-row-hover: rgba(1, 127, 238, 0.10);
  --hero-glow: rgba(0, 196, 240, 0.10);
  --tile-glow: rgba(0, 196, 240, 0.12);
  --focus-ring: rgba(1, 127, 238, 0.40);
  --primary-shadow: 0 8px 18px rgba(0, 196, 240, 0.30);
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.40);
  --tag-text: var(--accent);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at top right, var(--hero-glow), transparent 28rem), var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background .18s ease, color .18s ease;
}
button, input, select { font: inherit; }

/* Topbar - identical pattern to Excelergy main site */
.topbar {
  position: sticky; top: 0; z-index: 20; min-height: 68px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  backdrop-filter: blur(18px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.02em; color: var(--text); }
.brand-mark { display: block; width: 34px; height: 34px; flex-shrink: 0; border-radius: 12px; box-shadow: var(--shadow-soft); }
.brand-suffix { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; margin-left: 2px; }
.topbar-nav { display: flex; gap: 8px; background: var(--nav-pill-bg); padding: 5px; border-radius: 999px; border: 1px solid var(--border); }
.topbar-nav a { font-size: 13px; font-weight: 700; color: var(--muted); text-decoration: none; padding: 9px 14px; border-radius: 999px; }
.topbar-nav a.active, .topbar-nav a:hover { color: var(--text); background: var(--card-solid); box-shadow: var(--shadow-soft); }

.topbar-actions {
  display: inline-flex; align-items: center; gap: 8px;
}
.theme-toggle, .feedback-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 999px;
  background: transparent; border: 1px solid var(--border); color: var(--text);
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
  padding: 0; flex-shrink: 0;
  text-decoration: none;
}
/* Preserve the original 10px gap when theme toggle is alone (no wrapper). */
.topbar > .theme-toggle { margin-left: 10px; }
.topbar > .feedback-toggle { margin-left: 10px; }
.theme-toggle:hover, .feedback-toggle:hover {
  background: var(--bg-soft); border-color: var(--border-strong); color: var(--primary);
}
.theme-toggle:focus, .feedback-toggle:focus { outline: 2px solid var(--primary); outline-offset: 2px; }
.theme-toggle .icon-dark { display: none; } .theme-toggle .icon-light { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-light { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-dark { display: block; }

/* Hero */
.hero { max-width: 1520px; margin: 22px auto 0; padding: 28px; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.eyebrow { margin: 0 0 8px; color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.hero h1 { max-width: 860px; margin: 0; font-size: clamp(30px, 4vw, 54px); line-height: 1.02; letter-spacing: -.055em; }
.hero-copy { max-width: 660px; color: var(--muted); font-size: 16px; margin: 14px 0 0; }
.hero-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.secondary-link {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px;
  padding: 0 14px; border-radius: 12px; background: var(--card-solid);
  border: 1px solid var(--border); color: var(--text); font-weight: 700; font-size: 13px;
  text-decoration: none; box-shadow: var(--shadow-soft);
}

main { display: flex; flex-direction: column; gap: 20px; min-width: 0; max-width: 1520px; margin: 0 auto; padding: 0 28px 28px; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-soft); backdrop-filter: blur(16px); }
.panel h3 { font-size: 12px; font-weight: 800; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; text-transform: uppercase; }
.section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.section-title h3 { margin: 0; color: var(--text); font-size: 18px; letter-spacing: -.02em; text-transform: none; }

.footer { text-align: center; font-size: 12px; color: var(--muted); padding: 24px; }
.footer .build-stamp {
  margin: 6px 0 0; font-size: 10px; opacity: 0.55;
  font-family: ui-monospace, Consolas, "SF Mono", monospace;
  letter-spacing: .02em;
}

/* Extra tokens used by Mortgages */
:root { --good: #0f7a43; --good-soft: #e3f6ec; }
:root[data-theme="dark"] { --good: #4ade80; --good-soft: rgba(74, 222, 128, 0.12); }

/* Narrower content column than Budget: this is a single tool, not a dashboard */
main { max-width: 1120px; padding-top: 4px; }
.hero { max-width: 1120px; padding: 28px 28px 8px; }
.hero h1 { font-size: clamp(30px, 4vw, 46px); }
.footer a { color: var(--primary); font-weight: 700; text-decoration: none; }
.footer .disclaimer { max-width: 760px; margin: 0 auto 8px; line-height: 1.55; }

/* Prose pages: FAQ and blog */
main.prose { max-width: 820px; margin: 24px auto; padding: 0 24px 48px; display: block; }
.prose h1 { font-size: clamp(28px, 3vw, 40px); letter-spacing: -.04em; line-height: 1.1; margin: 6px 0 10px; }
.prose .lead { color: var(--muted); font-size: 15px; margin: 0 0 24px; line-height: 1.6; }
.prose .panel { margin-bottom: 14px; }
.prose .toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }
.prose .toc a { padding: 6px 12px; background: var(--card-solid); border: 1px solid var(--border); border-radius: 999px;
  color: var(--text); text-decoration: none; font-size: 13px; font-weight: 600; }
.prose .toc a:hover { border-color: var(--primary); color: var(--primary); }
.prose details { border-top: 1px solid var(--border); padding: 12px 0; }
.prose details:first-of-type { border-top: 0; padding-top: 4px; }
.prose details:last-of-type { padding-bottom: 0; }
.prose summary { cursor: pointer; font-weight: 700; font-size: 15px; color: var(--text); list-style: none;
  display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.prose summary::-webkit-details-marker { display: none; }
.prose summary::before { content: "+"; display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 6px; background: var(--primary); color: #fff; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.prose details[open] summary::before { content: "\2212"; }
.prose details > div { padding: 8px 0 4px 28px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.prose details > div p { margin: 0 0 8px; }
.prose details > div p:last-child { margin-bottom: 0; }
.prose details > div ul { margin: 4px 0 8px; padding-left: 20px; }
.prose a { color: var(--primary); }

/* Blog index */
.blog-card { display: block; padding: 22px 26px; margin-bottom: 14px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s; }
.blog-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.blog-card .eyebrow { font-size: 11px; margin: 0 0 6px; }
.blog-card h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: -.02em; color: var(--text); }
.blog-card .blurb { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.blog-card .meta { margin: 12px 0 0; color: var(--muted); font-size: 12px; font-weight: 600; }

/* Blog article */
.article { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 32px; box-shadow: var(--shadow-soft); }
.article p, .article li { font-size: 16px; line-height: 1.7; color: var(--text); }
.article h2 { font-size: 22px; letter-spacing: -.02em; margin: 28px 0 8px; }
.article .meta { color: var(--muted); font-size: 13px; font-weight: 600; margin: 0 0 18px; }
.article table { width: 100%; border-collapse: collapse; margin: 12px 0 18px; font-size: 14px; }
.article th, .article td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.article th:first-child, .article td:first-child { text-align: left; }
.article th { color: var(--table-head-text); background: var(--table-head-bg); font-weight: 700; font-size: 12px; }
.article .callout { background: var(--primary-soft); border-radius: 14px; padding: 14px 18px; margin: 18px 0; }
.article .callout p { margin: 0; font-size: 15px; }
.back-link { display: inline-block; margin: 0 0 14px; font-size: 13px; font-weight: 700; color: var(--primary); text-decoration: none; }
.cta { display: inline-flex; align-items: center; min-height: 42px; padding: 0 18px; border-radius: 12px; font-weight: 800; font-size: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff !important; text-decoration: none; box-shadow: var(--primary-shadow); }

@media (max-width: 760px) {
  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .topbar-nav { width: 100%; }
  .topbar-nav a { flex: 1; text-align: center; }
  .topbar-nav { gap: 2px; flex-wrap: wrap; justify-content: center; border-radius: 18px; order: 3; }
  .topbar-nav a { flex: 0 1 auto; padding: 7px 9px; font-size: 12px; white-space: nowrap; }
  .hero { padding: 22px 16px 4px; }
  main { padding: 0 16px 20px; }
  main.prose { padding: 0 16px 32px; }
  .article { padding: 20px 18px; }
}

/* Nine nav items don't fit beside the logo below ~1220px: give the nav its own row. */
@media (max-width: 1220px) {
  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .topbar-nav { order: 3; width: 100%; flex-wrap: wrap; justify-content: center; border-radius: 18px; }
}

/* On phones the wrapped header is tall, so let it scroll away instead of sticking. */
@media (max-width: 760px) {
  .topbar { position: static; }
}
