/* ==========================================================================
   MoneyZio.com — Design System
   Palettes and rules exactly as specified in the MoneyZio brand brief.
   ========================================================================== */

:root {
  /* 1. High-Contrast Warm Palette (PRIMARY) */
  --mz-bg: #F9F8F6;
  --mz-text: #1A202C;
  --mz-accent: #0D7A70;
  --mz-accent-hover: #0A5F57;

  /* 2. Clean Modern Minimalist Palette (SECONDARY / structural UI) */
  --mz-white: #FFFFFF;
  --mz-slate: #1E293B;
  --mz-indigo: #4338CA;
  --mz-indigo-hover: #362DAF;

  /* 4. Ad component colours */
  --ad-bg: #FFFFFF;
  --ad-border: #E0E0E0;

  /* 5. Share button colours */
  --share-bg: #F9F8F6;
  --share-text: #1A202C;

  /* Structural tokens */
  --radius: 8px;
  --space: 4px;
  --shadow-soft: 0 2px 8px rgba(26, 32, 44, 0.08);
  --shadow-soft-lg: 0 8px 24px rgba(26, 32, 44, 0.10);
  --border-default: #E2E8F0;

  --font-display: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", "Helvetica Neue", Arial, sans-serif;
}

/* 3. Dark Mode (Soft) — applied via [data-theme="dark"] on <html> */
[data-theme="dark"] {
  --mz-bg: #121826;
  --mz-text: #F1F5F9;
  --mz-accent: #10B981;
  --mz-accent-hover: #0EA271;

  --mz-white: #1A2233;
  --mz-slate: #F1F5F9;
  --mz-indigo: #818CF8;
  --mz-indigo-hover: #A5B4FC;

  --ad-bg: #1A2233;
  --ad-border: #2D3748;

  --share-bg: #1A2233;
  --share-text: #F1F5F9;

  --border-default: #2D3748;
  --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-soft-lg: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
body {
  margin: 0;
  background: var(--mz-bg);
  color: var(--mz-text);
  font-family: var(--font-body);
  line-height: 1.55;
  font-size: 16px;
  transition: background-color 0.2s ease, color 0.2s ease;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--mz-text);
  line-height: 1.2;
  margin: 0 0 16px;
}
h1 { font-size: clamp(1.9rem, 4vw, 2.75rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 16px; }
a { color: var(--mz-accent); }
img { max-width: 100%; display: block; }

/* ---------- Layout ---------- */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}
.site-main { padding: 40px 0 80px; }

/* ---------- Navigation (secondary palette) ---------- */
.site-header {
  background: var(--mz-white);
  border-bottom: 1px solid var(--border-default);
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  max-width: 1120px;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { height: 34px; width: auto; }
.nav-links { display: flex; gap: 28px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  color: var(--mz-slate);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 2px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.nav-links a:hover, .nav-links a:focus-visible { border-color: var(--mz-indigo); color: var(--mz-indigo); }
.nav-actions { display: flex; align-items: center; gap: 12px; }

.theme-toggle {
  background: var(--mz-bg);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:hover { border-color: var(--mz-indigo); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.08s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--mz-accent); color: #FFFFFF; box-shadow: var(--shadow-soft); }
.btn-primary:hover { background: var(--mz-accent-hover); }
.btn-secondary { background: transparent; color: var(--mz-indigo); border-color: var(--mz-indigo); }
.btn-secondary:hover { background: var(--mz-indigo); color: #FFFFFF; }
.btn:focus-visible { outline: 3px solid var(--mz-indigo); outline-offset: 2px; }

/* ---------- Cards ---------- */
.card {
  background: var(--mz-white);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-soft);
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}
.tool-card {
  background: var(--mz-white);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-decoration: none;
  color: var(--mz-text);
  display: block;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.tool-card:hover, .tool-card:focus-visible {
  box-shadow: var(--shadow-soft-lg);
  border-color: var(--mz-accent);
  transform: translateY(-2px);
}
.tool-card .tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mz-accent);
  background: color-mix(in srgb, var(--mz-accent) 12%, transparent);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}

/* ---------- Hero ---------- */
.hero { padding: 64px 0 48px; text-align: center; }
.hero p.lead { font-size: 1.15rem; max-width: 640px; margin: 0 auto 28px; color: var(--mz-text); opacity: 0.85; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- Forms / Inputs ---------- */
.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--mz-text);
}
.field .hint { font-size: 0.82rem; opacity: 0.7; margin-top: 4px; }
input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 2px solid var(--border-default);
  background: var(--mz-white);
  color: var(--mz-text);
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color 0.15s ease;
}
input:focus-visible, select:focus-visible {
  outline: none;
  border-color: var(--mz-accent);
}
.toggle-row { display: flex; align-items: center; gap: 10px; }

/* ---------- Calculator layout ---------- */
.calc-wrap {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
@media (max-width: 860px) {
  .calc-wrap { grid-template-columns: 1fr; }
}
.calc-form, .calc-results { background: var(--mz-white); border: 1px solid var(--border-default); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-soft); }

/* Results */
.metric-row { padding: 10px 0; border-bottom: 1px solid var(--border-default); }
.metric-row:last-child { border-bottom: none; }
.metric-row .label { display: block; font-weight: 600; opacity: 0.8; font-size: 0.82rem; margin-bottom: 2px; }
.metric-row .value { display: block; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.metric-row.total .value { color: var(--mz-accent); font-size: 1.3rem; }

.headline-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; margin-bottom: 20px; }
@media (max-width: 560px) { .headline-metrics { grid-template-columns: 1fr; } }
.metric-card { background: var(--mz-bg); border: 1px solid var(--border-default); border-radius: var(--radius); padding: 16px; text-align: center; }
.metric-card .num { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; color: var(--mz-accent); }
.metric-card .lbl { font-size: 0.8rem; opacity: 0.75; margin-top: 4px; }

table.breakdown { width: 100%; border-collapse: collapse; margin-top: 8px; }
table.breakdown th, table.breakdown td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border-default); font-size: 0.92rem; }
table.breakdown th { font-family: var(--font-display); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; opacity: 0.7; }
table.breakdown td.num, table.breakdown th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 50/30/20 benchmark bars ---------- */
.benchmark-row { margin-bottom: 14px; }
.benchmark-row .bm-label { display: flex; justify-content: space-between; font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; }
.benchmark-track { background: var(--mz-bg); border: 1px solid var(--border-default); border-radius: 999px; height: 10px; overflow: hidden; }
.benchmark-fill { height: 100%; border-radius: 999px; transition: width 0.2s ease; }
.benchmark-fill.needs { background: var(--mz-accent); }
.benchmark-fill.wants { background: var(--mz-indigo); }
.benchmark-fill.savings { background: #D97706; }

/* ---------- Ad slots ---------- */
.ad-slot {
  background: var(--ad-bg);
  border: 1px dashed var(--ad-border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--mz-text);
  opacity: 0.6;
  margin: 24px 0;
}

/* Left/right vertical ad columns — desktop only, collapse on mobile per spec */
.page-with-ad-columns {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 160px;
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
}
.ad-column {
  position: sticky;
  top: 80px;
  align-self: start;
  height: 600px;
}
.ad-column .ad-slot { height: 100%; display: flex; align-items: center; justify-content: center; margin: 0; }
.page-with-ad-columns > .container { padding: 0; max-width: none; }
@media (max-width: 1440px) {
  .page-with-ad-columns { grid-template-columns: 1fr; }
  .ad-column { display: none; }
}

/* ---------- Share row ---------- */
.share-row { background: var(--share-bg); color: var(--share-text); border: 1px solid var(--border-default); border-radius: var(--radius); padding: 16px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 20px; }
.share-row .lbl { font-weight: 700; font-size: 0.9rem; margin-right: 4px; }
.share-btn { border: 1px solid var(--border-default); background: var(--mz-white); color: var(--mz-text); border-radius: var(--radius); padding: 8px 14px; font-size: 0.85rem; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.share-btn:hover { border-color: var(--mz-indigo); color: var(--mz-indigo); }

/* ---------- Footer ---------- */
.site-footer { background: var(--mz-slate); color: #E2E8F0; padding: 40px 0 24px; margin-top: 60px; }
.site-footer a { color: #CBD5E1; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 24px; margin-bottom: 24px; }
.footer-grid h4 { color: #FFFFFF; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-bottom { border-top: 1px solid #334155; padding-top: 16px; font-size: 0.8rem; opacity: 0.75; }
.disclaimer-banner { background: #FDF6E3; border: 1px solid #E9D8A6; color: #6B5A1E; border-radius: var(--radius); padding: 12px 16px; font-size: 0.85rem; margin-bottom: 24px; }
[data-theme="dark"] .disclaimer-banner { background: #2A2410; border-color: #4A4020; color: #E9D8A6; }

/* Utility */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
