/* Money Map Makers — design system
   Palette: navy / teal / sand / orange. Original identity: route lines,
   compass marks, and fold-map motifs. No financial/bank styling. */

:root {
  --navy-900: #0b2340;
  --navy-800: #122d50;
  --navy-700: #1b3f6b;
  --navy-600: #2a5586;
  --teal-600: #0e8c86;
  --teal-500: #14a398;
  --teal-100: #e3f3f1;
  --sand-50: #fbf7ef;
  --sand-100: #f5eedd;
  --sand-200: #ecdfc2;
  --orange-600: #d2601c;
  --orange-500: #e8793c;
  --orange-100: #fbe6d4;
  --ink-900: #1b2430;
  --ink-700: #3c4552;
  --ink-500: #5c6576;
  --white: #ffffff;
  --border: #e3dac8;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(11, 35, 64, 0.08);
  --shadow-md: 0 8px 24px rgba(11, 35, 64, 0.12);
  --max-width: 1180px;
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink-900);
  background: var(--sand-50);
  line-height: 1.6;
  font-size: 17px;
}

img, svg { max-width: 100%; display: block; }
main { display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--navy-900);
  line-height: 1.2;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(1.9rem, 3.4vw, 2.75rem); }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); margin-top: 2.2em; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1.1em; }
a { color: var(--teal-600); text-decoration-thickness: from-font; }
a:hover { color: var(--navy-700); }
ul, ol { padding-left: 1.4em; }
table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: 0.96rem; }
caption { text-align: left; font-weight: 600; margin-bottom: 0.5em; color: var(--navy-800); }
th, td { border: 1px solid var(--border); padding: 0.6em 0.75em; text-align: left; }
thead th { background: var(--navy-900); color: var(--white); font-family: var(--font-body); }
tbody tr:nth-child(even) { background: var(--sand-100); }

:focus-visible {
  outline: 3px solid var(--orange-600);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--orange-600);
  color: var(--white);
  padding: 0.6em 1em;
  z-index: 100;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--navy-900);
  color: var(--sand-50);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: var(--orange-500); }
.brand .mark { width: 34px; height: 34px; flex-shrink: 0; }

.main-nav { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.main-nav a {
  color: var(--sand-100);
  text-decoration: none;
  font-size: 0.97rem;
  font-weight: 500;
  padding: 0.3em 0.1em;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover, .main-nav a[aria-current="page"] {
  color: var(--white);
  border-bottom-color: var(--orange-500);
}
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--sand-200);
  color: var(--white);
  border-radius: var(--radius-sm);
  padding: 0.4em 0.7em;
  font-size: 0.95rem;
}

@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; align-items: center; gap: 0.4em; }
  .main-nav { display: none; width: 100%; flex-direction: column; align-items: flex-start; gap: 0.2rem; padding-top: 0.6rem; }
  .main-nav.is-open { display: flex; }
  .site-header .wrap { flex-wrap: wrap; }
}

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
  background: var(--sand-100);
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35em; padding: 0.6em 0; margin: 0; }
.breadcrumbs li:not(:last-child)::after { content: "›"; margin-left: 0.5em; color: var(--ink-500); }
.breadcrumbs a { color: var(--navy-700); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs li[aria-current] { color: var(--ink-500); }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 60%, var(--teal-600) 130%);
  color: var(--sand-50);
  padding: 3.4rem 0 3rem;
  position: relative;
  overflow: hidden;
}
.hero .wrap { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 2.5rem; align-items: center; }
.hero h1 { color: var(--white); }
.hero p.lede { font-size: 1.1rem; color: var(--sand-100); max-width: 34em; }
.hero-art { justify-self: end; }
@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-art { justify-self: start; max-width: 260px; }
}

.cta-row { display: flex; gap: 0.9rem; flex-wrap: wrap; margin-top: 1.5rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.75em 1.4em;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
  font-size: 1rem;
  cursor: pointer;
}
.btn-primary { background: var(--orange-500); color: var(--navy-900); }
.btn-primary:hover { background: var(--orange-600); color: var(--white); }
.btn-secondary { background: transparent; border-color: var(--sand-100); color: var(--white); }
.btn-secondary:hover { background: rgba(255,255,255,0.12); }
.btn-outline { background: var(--white); border-color: var(--navy-700); color: var(--navy-800); }
.btn-outline:hover { background: var(--sand-100); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--navy-800); }
.btn-ghost:hover { background: var(--sand-100); }
.btn-small { padding: 0.5em 1em; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Sections / layout ---------- */
.section { padding: 3rem 0; }
.section-tight { padding: 1.8rem 0; }
.section-alt { background: var(--sand-100); }
.section-navy { background: var(--navy-900); color: var(--sand-50); }
.section-navy h2 { color: var(--white); }
.section-head { max-width: 46em; margin-bottom: 1.8rem; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--teal-600);
}

.grid { display: grid; gap: 1.4rem; }
.grid > * { min-width: 0; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 920px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* Any two/three-column layout built with CSS Grid needs min-width: 0 on
   its direct children, otherwise a child's intrinsic content width (long
   text, inputs, etc.) can force the track wider than its 1fr share and
   push later columns outside the viewport. */
.calc-layout > *,
.hero .wrap > *,
.footer-grid > *,
.article-layout > * {
  min-width: 0;
}

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.card h3 { margin-top: 0.2em; }
.card h3 a { color: var(--navy-900); text-decoration: none; }
.card h3 a:hover { color: var(--teal-600); }
.card .meta { font-size: 0.82rem; color: var(--ink-500); display: flex; gap: 0.6em; flex-wrap: wrap; }
.card-icon { width: 42px; height: 42px; color: var(--teal-600); }
.card-link { margin-top: auto; font-weight: 600; text-decoration: none; }

.cat-card { border-top: 4px solid var(--teal-600); }
.cat-card .count { color: var(--ink-500); font-size: 0.85rem; }

.card-thumb {
  display: block;
  margin: -1.4rem -1.4rem 0.4rem;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  overflow: hidden;
  aspect-ratio: 1200 / 630;
  background: var(--sand-200);
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s ease; }
.card-thumb:hover img { transform: scale(1.04); }
@media (prefers-reduced-motion: reduce) { .card-thumb img { transition: none; } .card-thumb:hover img { transform: none; } }
.cat-card .card-thumb { margin-top: -1.4rem; }

.photo { margin: 0 0 1.6rem; }
.photo img {
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  background: var(--sand-200);
}
.photo figcaption { font-size: 0.78rem; color: var(--ink-500); margin-top: 0.5em; }
.photo figcaption a { color: var(--ink-500); }
.section-photo { padding-bottom: 0; }
.section-photo .photo img { max-height: 360px; }
.section-head .photo { max-width: 46em; margin-top: 1rem; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22em 0.65em;
  border-radius: 999px;
  background: var(--teal-100);
  color: var(--teal-600);
  font-size: 0.76rem;
  font-weight: 700;
}
.badge-orange { background: var(--orange-100); color: var(--orange-600); }
.badge-navy { background: var(--navy-700); color: var(--sand-50); }

/* ---------- Expense shortcuts ---------- */
.shortcut-list { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.shortcut {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.55em 1.1em;
  text-decoration: none;
  color: var(--navy-800);
  font-weight: 600;
  font-size: 0.92rem;
}
.shortcut:hover { border-color: var(--teal-600); color: var(--teal-600); }
.shortcut svg { width: 18px; height: 18px; }

/* ---------- Article ---------- */
.article-head { max-width: 46em; }
.article-dates { font-size: 0.85rem; color: var(--ink-500); margin-bottom: 1rem; }
.article-dates .author { color: var(--navy-700); font-weight: 600; }
.article-body { max-width: 46em; }
.article-layout { display: grid; grid-template-columns: minmax(0, 46em) 260px; gap: 2.5rem; align-items: start; }
@media (max-width: 980px) { .article-layout { grid-template-columns: 1fr; } }

.toc {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.3rem;
  margin: 1.6rem 0 2rem;
}
.toc h2 { margin-top: 0; font-size: 1.05rem; }
.toc ol { margin: 0; padding-left: 1.2em; }
.toc a { text-decoration: none; }

.rail-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.4rem;
}
.rail-card h2 { font-size: 0.95rem; margin-top: 0; text-transform: uppercase; letter-spacing: 0.04em; color: var(--teal-600); }
.rail-card ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6em; }
.rail-card a { text-decoration: none; font-weight: 600; font-size: 0.93rem; }

.example-block {
  background: var(--teal-100);
  border-left: 4px solid var(--teal-600);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.3rem;
  margin: 1.6rem 0;
}
.example-block table, .example-block ul { background: var(--white); }
.example-block > .caption { font-weight: 700; color: var(--navy-800); margin-bottom: 0.6em; }

.callout {
  background: var(--sand-100);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.3rem;
  margin: 1.6rem 0;
}
.callout h3 { margin-top: 0; }

.mistakes-list li { margin-bottom: 0.6em; }

.faq details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.7em;
  background: var(--white);
}
.faq summary {
  padding: 0.9em 1.1em;
  font-weight: 600;
  cursor: pointer;
  color: var(--navy-900);
}
.faq summary::marker { color: var(--teal-600); }
.faq-answer { padding: 0 1.1em 1em; color: var(--ink-700); }

.sources-list { font-size: 0.92rem; color: var(--ink-700); }

.related-articles .grid { margin-top: 1rem; }

/* ---------- Calculator ---------- */
.calc-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 2.2rem; align-items: start; }
@media (max-width: 980px) { .calc-layout { grid-template-columns: 1fr; } }

.calc-form fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.3rem 1.3rem;
  margin: 0 0 1.2rem;
  background: var(--white);
}
.calc-form legend {
  float: left;
  width: 100%;
  padding: 0;
  margin: 0 0 0.9rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--navy-900);
}
.calc-form legend + * { clear: both; }
.calc-form, .results-panel { color: var(--ink-900); }
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.3em; font-size: 0.92rem; color: var(--ink-900); }
.field .hint { font-size: 0.82rem; color: var(--ink-500); margin-top: 0.25em; }
.field input[type="text"],
.field input[type="number"],
.field select {
  width: 100%;
  padding: 0.6em 0.75em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--white);
  color: var(--ink-900);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 500px) { .field-row { grid-template-columns: 1fr; } }

.style-toggle { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.style-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.style-toggle label {
  flex: 1;
  text-align: center;
  padding: 0.6em 0.5em;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  min-width: 100px;
  color: var(--ink-700);
  background: var(--white);
}
.style-toggle input:checked + label { border-color: var(--teal-600); background: var(--teal-100); color: var(--teal-600); }
.style-toggle input:focus-visible + label { outline: 3px solid var(--orange-600); outline-offset: 2px; }

.range-field input[type="range"] { width: 100%; }
.range-value { font-weight: 700; color: var(--teal-600); }

.calc-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 1rem; }
.calc-status {
  min-height: 1.5em;
  margin: 0.8rem 0 0;
  padding: 0;
  font-weight: 600;
  color: var(--teal-600);
}
.calc-status.is-visible {
  background: var(--teal-100);
  border-left: 4px solid var(--teal-600);
  border-radius: var(--radius-sm);
  padding: 0.6em 0.9em;
}
@media print { .calc-status { display: none; } }

.results-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  position: sticky;
  top: 1rem;
  min-width: 0;
}
.preview-panel {
  border-top: 4px solid var(--orange-500);
  box-shadow: var(--shadow-md);
  position: static;
}
.preview-panel .eyebrow { margin-bottom: 0.6rem; }
.results-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; margin-bottom: 1.4rem; }
.results-summary > * { min-width: 0; }
.stat .value { overflow-wrap: break-word; }
@media (max-width: 560px) { .results-summary { grid-template-columns: 1fr; } }
.stat {
  background: var(--sand-100);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  text-align: center;
}
.stat .value { font-family: var(--font-display); font-size: 1.5rem; color: var(--navy-900); display: block; }
.stat .label { font-size: 0.78rem; color: var(--ink-500); text-transform: uppercase; letter-spacing: 0.04em; }

.bar-chart { list-style: none; margin: 0; padding: 0; }
.bar-chart li { margin-bottom: 0.7rem; }
.bar-row { display: flex; justify-content: space-between; font-size: 0.86rem; margin-bottom: 0.25em; }
.bar-track { background: var(--sand-100); border-radius: 999px; height: 12px; overflow: hidden; }
.bar-fill { background: linear-gradient(90deg, var(--teal-600), var(--teal-500)); height: 100%; border-radius: 999px; }

.scenario-table th:first-child, .scenario-table td:first-child { font-weight: 600; }

.drivers-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.calc-note {
  font-size: 0.85rem;
  color: var(--ink-500);
  border-top: 1px dashed var(--border);
  margin-top: 1.4rem;
  padding-top: 1rem;
}

@media print {
  .site-header, .site-footer, .breadcrumbs, .calc-form, .no-print, .calc-actions { display: none !important; }
  .calc-layout { grid-template-columns: 1fr; }
  .results-panel { position: static; border: none; box-shadow: none; }
  body { background: var(--white); }
}

/* ---------- Guide explorer ---------- */
.filter-bar {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.9rem;
  margin-bottom: 1.6rem;
}
@media (max-width: 920px) { .filter-bar { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .filter-bar { grid-template-columns: 1fr; } }
.filter-bar label { font-size: 0.82rem; font-weight: 700; display: block; margin-bottom: 0.3em; color: var(--navy-800); }
.filter-bar select, .filter-bar input { width: 100%; padding: 0.55em 0.7em; border: 1px solid var(--border); border-radius: var(--radius-sm); }

.results-count { font-size: 0.9rem; color: var(--ink-500); margin-bottom: 1rem; }
.empty-state { padding: 2rem; text-align: center; color: var(--ink-500); background: var(--white); border-radius: var(--radius-md); border: 1px dashed var(--border); }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-900); color: var(--sand-100); padding: 3rem 0 2rem; margin-top: 3rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 2rem; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h2 { color: var(--white); font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--font-body); }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5em; }
.site-footer a { color: var(--sand-100); text-decoration: none; font-size: 0.92rem; }
.site-footer a:hover { color: var(--orange-500); }
.footer-brand { display: flex; align-items: center; gap: 0.6em; color: var(--white); font-family: var(--font-display); font-size: 1.15rem; margin-bottom: 0.6em; }
.footer-brand .mark { width: 30px; height: 30px; }
.footer-note { font-size: 0.85rem; color: var(--sand-200); max-width: 32em; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.12); margin-top: 2.2rem; padding-top: 1.4rem; font-size: 0.82rem; color: var(--sand-200); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.updated-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.8rem; }
.updated-list li { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px dashed var(--border); padding-bottom: 0.8rem; }
.updated-list a { font-weight: 600; text-decoration: none; }
.updated-list time { font-size: 0.82rem; color: var(--ink-500); white-space: nowrap; }

.legal-content { max-width: 42em; }
.legal-content h2 { margin-top: 1.8em; }

.error-page { text-align: center; padding: 5rem 0; }
.error-page .mark-xl { width: 160px; margin: 0 auto 1.5rem; }

.search-field { position: relative; }
.search-field input { padding-left: 2.6em; }
.search-field svg { position: absolute; left: 0.85em; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-500); pointer-events: none; }
