/*
Theme Name: Main Street Calc
Theme URI: https://mainstreetcalc.com/
Description: Brand theme for Main Street Calc, a US loan and personal finance calculator site. Built on Twenty Twenty-Five.
Author: Main Street Calc
Template: twentytwentyfive
Version: 1.0.0
Text Domain: mainstreet-calc
*/

/* ---------- Brand tokens (see docs/brand-guide.md) ---------- */
:root {
  --msc-navy: #0B2A4A;
  --msc-green: #17805C;
  --msc-green-bright: #2BB673;
  --msc-amber: #F2A516;
  --msc-brick: #A8322A;
  --msc-ink: #1B2430;
  --msc-slate: #5A6777;
  --msc-mist: #F4F7FA;
  --msc-line: #DCE3EB;
  --msc-white: #FFFFFF;
  --msc-radius: 14px;
  --msc-shell: 1180px;
}

/* ---------- Base ---------- */
body {
  background: var(--msc-white);
  color: var(--msc-ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 {
  color: var(--msc-navy);
  letter-spacing: -0.015em;
  line-height: 1.2;
}
h1 { font-weight: 700; font-size: clamp(2rem, 3.6vw, 2.9rem); }
h2 { font-weight: 700; font-size: 1.65rem; margin-top: 2.2rem; }
h3 { font-weight: 600; font-size: 1.15rem; }
a { color: var(--msc-green); text-underline-offset: 3px; }
a:focus-visible, .msc-btn:focus-visible, .msc-card:focus-visible {
  outline: 3px solid var(--msc-amber);
  outline-offset: 3px;
}
img, svg { max-width: 100%; }

/* Reading measure for text in content areas. Sections and grids may use the full shell width. */
.entry-content > p,
.entry-content > ul,
.entry-content > ol,
.entry-content > h2,
.entry-content > h3,
.entry-content > table,
.entry-content > .usa-calc-disclaimer,
.entry-content > .msc-byline,
.entry-content > .msc-lead {
  max-width: 72ch;
}
.entry-content > ul, .entry-content > ol { padding-left: 1.3rem; }

/* Page titles on the homepage come from the hero, so the theme title is hidden there. */
body.home .wp-block-post-title { display: none; }

/* ---------- Header ---------- */
.msc-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--msc-white);
  border-bottom: 1px solid var(--msc-line);
}
.msc-header__inner {
  max-width: var(--msc-shell);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.msc-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.msc-brand__mark { width: 36px; height: 36px; display: block; }
.msc-brand__name {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--msc-navy);
  letter-spacing: -0.01em;
}
.msc-brand__name span { color: var(--msc-green); }
.msc-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.msc-nav a {
  display: block;
  padding: 8px 11px;
  border-radius: 8px;
  color: var(--msc-navy);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}
.msc-nav a:hover { background: var(--msc-mist); color: var(--msc-green); }
@media (max-width: 640px) {
  .msc-nav { width: 100%; overflow-x: auto; }
  .msc-nav ul { flex-wrap: nowrap; }
}

/* ---------- Buttons and links ---------- */
.msc-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.msc-btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border: 2px solid transparent;
}
.msc-btn--primary { background: var(--msc-amber); color: var(--msc-navy); }
.msc-btn--primary:hover { background: #E39A0D; }
.msc-btn--ghost { border-color: var(--msc-navy); color: var(--msc-navy); background: transparent; }
.msc-btn--ghost:hover { background: var(--msc-mist); }
.msc-link { font-weight: 600; text-decoration: none; }
.msc-link:hover { text-decoration: underline; }

/* ---------- Homepage hero ---------- */
.msc-hero {
  display: grid;
  gap: 40px;
  align-items: center;
  padding: 56px 24px 40px;
  max-width: var(--msc-shell);
  margin: 0 auto;
  background: linear-gradient(180deg, var(--msc-mist) 0%, var(--msc-white) 100%);
}
@media (min-width: 900px) {
  .msc-hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); padding: 72px 24px 56px; }
}
.msc-eyebrow {
  margin: 0 0 12px;
  color: var(--msc-green);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.msc-hero__title { margin: 0; }
.msc-hero__lead { margin: 18px 0 0; font-size: 1.12rem; color: var(--msc-ink); max-width: 60ch; }
.msc-example {
  background: var(--msc-white);
  border: 1px solid var(--msc-line);
  border-top: 4px solid var(--msc-green);
  border-radius: var(--msc-radius);
  padding: 24px;
  box-shadow: 0 12px 32px rgba(11, 42, 74, 0.08);
}
.msc-example__label {
  margin: 0 0 12px;
  color: var(--msc-slate);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.msc-example__list { margin: 0; }
.msc-example__list > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--msc-line);
}
.msc-example__list dt { color: var(--msc-slate); }
.msc-example__list dd {
  margin: 0;
  font-weight: 700;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  color: var(--msc-navy);
}
.msc-example__list > div:last-child dd { color: var(--msc-brick); }
.msc-example__note { margin: 14px 0 0; color: var(--msc-slate); font-size: 0.88rem; }

/* ---------- Trust bar ---------- */
.msc-trust { background: var(--msc-navy); color: var(--msc-white); }
.msc-trust__list {
  list-style: none;
  margin: 0 auto;
  padding: 22px 24px;
  max-width: var(--msc-shell);
  display: grid;
  gap: 16px;
}
@media (min-width: 900px) { .msc-trust__list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; } }
.msc-trust__list li { display: flex; gap: 10px; font-size: 0.95rem; line-height: 1.5; }
.msc-trust__list strong { display: block; color: var(--msc-white); }
.msc-trust__icon { flex: 0 0 22px; color: var(--msc-green-bright); }
.msc-trust__icon svg { width: 22px; height: 22px; }

/* ---------- Sections and grids ---------- */
.msc-section { max-width: var(--msc-shell); margin: 0 auto; padding: 48px 24px 8px; }
.msc-lead { color: var(--msc-slate); margin: 6px 0 22px; max-width: 70ch; }
.msc-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.msc-grid--trust { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
/* Grid items stretch to the row height, and the card fills its item. A percentage height here overflowed. */
.msc-grid > li { display: flex; }
.msc-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  background: var(--msc-white);
  border: 1px solid var(--msc-line);
  border-radius: var(--msc-radius);
  padding: 20px;
  color: var(--msc-ink);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.msc-card:hover { border-color: var(--msc-green); box-shadow: 0 10px 24px rgba(11, 42, 74, 0.08); transform: translateY(-2px); }
.msc-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--msc-mist);
  color: var(--msc-navy);
}
.msc-card__icon svg { width: 24px; height: 24px; }
/* Visual semantics: debt and interest in brick, savings and budgeting in green, the rest in navy. */
.msc-card__icon[data-topic="debt"],
.msc-card__icon[data-topic="credit-card"],
.msc-card__icon[data-topic="interest"] { color: var(--msc-brick); background: #FBECEA; }
.msc-card__icon[data-topic="savings"],
.msc-card__icon[data-topic="retirement"],
.msc-card__icon[data-topic="budget"] { color: var(--msc-green); background: #E7F5EE; }
.msc-card__title { margin: 14px 0 6px; font-size: 1.1rem; }
.msc-card__text { color: var(--msc-slate); font-size: 0.95rem; flex: 1; }
.msc-card__meta { margin-top: 14px; color: var(--msc-green); font-size: 0.85rem; font-weight: 700; }
.msc-card--plain { border-style: dashed; }

/* ---------- How-to steps ---------- */
.msc-steps__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 18px;
  counter-reset: step;
}
@media (min-width: 900px) { .msc-steps__list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.msc-steps__list li {
  counter-increment: step;
  position: relative;
  padding: 22px 20px 20px 72px;
  background: var(--msc-mist);
  border-radius: var(--msc-radius);
}
.msc-steps__list li::before {
  content: counter(step);
  position: absolute;
  left: 20px;
  top: 20px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--msc-navy);
  color: var(--msc-white);
  font-weight: 700;
}
.msc-steps__list h3 { margin: 0 0 6px; font-size: 1.05rem; }
.msc-steps__list p { margin: 0; color: var(--msc-slate); font-size: 0.95rem; }

/* ---------- Blog cards ---------- */
.msc-post { display: flex; flex: 1; flex-direction: column; text-decoration: none; color: var(--msc-ink); background: var(--msc-white); border: 1px solid var(--msc-line); border-radius: var(--msc-radius); padding: 20px; transition: border-color 0.15s ease; }
.msc-post:hover { border-color: var(--msc-green); }
.msc-post__title { margin: 0 0 8px; font-size: 1.08rem; }
.msc-post__text { color: var(--msc-slate); font-size: 0.95rem; flex: 1; }
.msc-post__meta { margin-top: 14px; color: var(--msc-slate); font-size: 0.82rem; font-weight: 600; }

/* ---------- FAQ ---------- */
.msc-faq { max-width: var(--msc-shell); }
.msc-faq__item { padding: 16px 0; border-bottom: 1px solid var(--msc-line); }
.msc-faq__item h3 { margin: 0 0 6px; font-size: 1.05rem; }
.msc-faq__item p { margin: 0; color: var(--msc-slate); max-width: 72ch; }

/* ---------- Breadcrumbs, bylines and disclaimers ---------- */
.usa-breadcrumb { margin: 8px 0 18px; }
.usa-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
  color: var(--msc-slate);
}
.usa-breadcrumb li + li::before { content: "\203A"; margin-right: 8px; color: var(--msc-slate); }
.usa-breadcrumb a { color: var(--msc-slate); }
.usa-breadcrumb li[aria-current="page"] { color: var(--msc-ink); font-weight: 600; }
.msc-byline {
  margin: 0 0 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--msc-line);
  color: var(--msc-slate);
  font-size: 0.92rem;
}
.msc-byline__author { color: var(--msc-navy); font-weight: 600; }
.usa-calc-disclaimer { color: var(--msc-slate); font-size: 0.9rem; margin-top: 0.5rem; }
.usa-hub-list li { margin-bottom: 0.6rem; }

/* ---------- Tables ---------- */
.entry-content table { width: 100%; border-collapse: collapse; margin: 1.25rem 0; font-size: 0.95rem; display: block; overflow-x: auto; }
.entry-content th, .entry-content td { padding: 10px 12px; border-bottom: 1px solid var(--msc-line); text-align: left; vertical-align: top; }
.entry-content th { background: var(--msc-mist); color: var(--msc-navy); font-weight: 600; }

/* ---------- Footer ---------- */
.msc-footer { background: var(--msc-navy); color: #DCE6F2; margin-top: 56px; padding: 48px 24px 28px; }
.msc-footer__inner {
  max-width: var(--msc-shell);
  margin: 0 auto;
  display: grid;
  gap: 32px;
  grid-template-columns: 1fr;
}
@media (min-width: 760px) { .msc-footer__inner { grid-template-columns: 1.5fr 1fr 1fr 1fr; } }
.msc-footer__name { margin: 0 0 10px; font-size: 1.2rem; font-weight: 700; color: var(--msc-white); }
.msc-footer p { margin: 0; font-size: 0.93rem; line-height: 1.6; }
.msc-footer h2 {
  margin: 0 0 12px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9FB7CF;
}
.msc-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.msc-footer a { color: var(--msc-white); text-decoration: none; font-size: 0.95rem; }
.msc-footer a:hover { text-decoration: underline; }
.msc-footer__legal {
  max-width: var(--msc-shell);
  margin: 32px auto 0;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  color: #C8D4E3;
  font-size: 0.85rem;
}

/* ---------- Small screens ---------- */
@media (max-width: 480px) {
  h2 { font-size: 1.4rem; }
  .msc-hero { padding: 40px 18px 32px; }
  .msc-section { padding: 36px 18px 8px; }
  .msc-footer { padding: 36px 18px 24px; }
}
