/* ==========================================================================
   My Calculator Mortgage — Global Design System
   Clean, modern, teal-accented. Inspired by leading mortgage calculators.
   ========================================================================== */

:root {
  /* Brand palette */
  --teal-50: #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-400: #2dd4bf;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-800: #115e59;

  /* Neutrals */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* Semantic */
  --text: var(--slate-800);
  --text-muted: var(--slate-500);
  --heading: var(--slate-900);
  --border: var(--slate-200);
  --bg: var(--slate-50);
  --card: #ffffff;
  --accent: var(--teal-600);
  --accent-hover: var(--teal-700);
  --accent-soft: var(--teal-50);

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --container: 1140px;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  color: var(--heading);
  line-height: 1.2;
  margin: 0 0 0.5em;
  font-weight: 700;
}

h1 {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

h3 {
  font-size: 1.25rem;
}

p {
  margin: 0 0 1em;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Header ---------- */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--heading);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
  color: var(--heading);
}

.brand__mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-700));
  color: #fff;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.brand__mark svg {
  width: 20px;
  height: 20px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--slate-600);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav__link:hover {
  background: var(--slate-100);
  color: var(--heading);
  text-decoration: none;
}

.nav__link.is-active {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--slate-700);
}

@media (max-width: 860px) {
  .nav-toggle {
    display: block;
  }

  .nav {
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px 20px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    display: none;
  }

  .nav.is-open {
    display: flex;
  }

  .nav__link {
    padding: 12px 14px;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  padding: 13px 22px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}

.btn--secondary {
  background: #fff;
  color: var(--accent);
  border-color: var(--slate-300);
}

.btn--secondary:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  text-decoration: none;
}

.btn--ghost {
  background: transparent;
  color: var(--slate-600);
  border-color: var(--slate-300);
}

.btn--block {
  width: 100%;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card--pad {
  padding: 24px;
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg) 100%);
  padding: 48px 0 56px;
  border-bottom: 1px solid var(--border);
}

.hero__grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}

.hero__eyebrow {
  display: inline-block;
  background: var(--teal-100);
  color: var(--teal-800);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.hero h1 {
  margin-bottom: 14px;
}

.hero__lead {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 46ch;
}

.hero__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 24px;
}

.hero__stat {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--slate-600);
  font-size: 0.9rem;
  font-weight: 600;
}

.hero__stat svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
  flex: 0 0 auto;
}

/* ---------- Forms ---------- */
.field {
  margin-bottom: 18px;
}

.field__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--slate-700);
  margin-bottom: 6px;
}

.field__hint {
  font-weight: 500;
  color: var(--slate-400);
  font-size: 0.8rem;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group__prefix,
.input-group__suffix {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate-500);
  font-weight: 600;
  font-size: 0.95rem;
  pointer-events: none;
}

.input-group__prefix {
  left: 14px;
}

.input-group__suffix {
  right: 14px;
}

.input {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--heading);
  background: #fff;
  border: 1.5px solid var(--slate-300);
  border-radius: 10px;
  padding: 12px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}

.input-group__prefix + .input {
  padding-left: 30px;
}

.input-group__suffix + .input {
  padding-right: 44px;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--teal-100);
}

.input--error {
  border-color: #dc2626;
}

select.input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.field__error {
  color: #dc2626;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 4px;
  min-height: 1.2em;
}

.field--inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.seg-toggle {
  display: inline-flex;
  background: var(--slate-100);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.seg-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg-toggle label {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--slate-500);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
}

.seg-toggle input:checked + label {
  background: #fff;
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.seg-toggle input:focus-visible + label {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ---------- Results ---------- */
.results {
  background: var(--slate-900);
  color: #fff;
  border-radius: var(--radius);
  padding: 28px;
  position: relative;
  overflow: hidden;
}

.results__label {
  color: var(--slate-300);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.results__amount {
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.1;
  margin: 6px 0 6px;
}

.results__note {
  color: var(--slate-400);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.breakdown__item {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 14px;
}

.breakdown__label {
  color: var(--slate-400);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.breakdown__value {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 2px;
}

/* ---------- Donut chart ---------- */
.donut-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin: 16px 0;
}

.donut {
  position: relative;
  width: 190px;
  height: 190px;
  flex: 0 0 auto;
}

.donut__center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.donut__center-value {
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--heading);
}

.donut__center-label {
  color: var(--slate-500);
  font-size: 0.8rem;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.9rem;
}

.donut-legend__row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.donut-legend__dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.donut-legend__label {
  color: var(--slate-600);
  font-weight: 600;
}

.donut-legend__value {
  margin-left: auto;
  font-weight: 700;
  color: var(--heading);
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 560px;
}

th,
td {
  text-align: right;
  padding: 11px 14px;
  border-bottom: 1px solid var(--slate-100);
}

th:first-child,
td:first-child {
  text-align: left;
}

thead th {
  background: var(--slate-50);
  color: var(--slate-600);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--slate-50);
}

/* ---------- Ad slots ---------- */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--slate-100);
  border: 1px dashed var(--slate-300);
  border-radius: var(--radius-sm);
  color: var(--slate-400);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  overflow: hidden;
}

.ad-slot--leaderboard {
  min-height: 90px;
  max-width: 728px;
  margin: 0 auto 24px;
}

.ad-slot--rectangle {
  min-height: 250px;
  max-width: 336px;
  margin: 0 auto 24px;
}

.ad-slot--halfpage {
  min-height: 600px;
  max-width: 300px;
  margin: 0 auto;
}

/* ---------- Layout helpers ---------- */
.section {
  padding: 56px 0;
}

.section--tight {
  padding: 40px 0;
}

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 40px;
}

.section-head__kicker {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.section-head p {
  color: var(--text-muted);
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: start;
}

@media (max-width: 900px) {
  .two-col {
    grid-template-columns: 1fr;
  }

  .hero__grid {
    grid-template-columns: 1fr;
  }

  .breakdown {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- Blog cards ---------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s, transform 0.15s;
}

.post-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.post-card__thumb {
  height: 160px;
  background: linear-gradient(135deg, var(--teal-100), var(--teal-50));
  display: grid;
  place-items: center;
  color: var(--teal-700);
}

.post-card__thumb svg {
  width: 44px;
  height: 44px;
}

.post-card__body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.post-card__meta {
  font-size: 0.78rem;
  color: var(--slate-500);
  font-weight: 600;
  margin-bottom: 8px;
}

.post-card__title {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.post-card__title a {
  color: var(--heading);
  text-decoration: none;
}

.post-card__title a:hover {
  color: var(--accent);
}

.post-card__excerpt {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.post-card__more {
  margin-top: auto;
  font-weight: 700;
  font-size: 0.9rem;
}

/* ---------- Article (blog post) ---------- */
.article {
  max-width: 720px;
  margin: 0 auto;
}

.article__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-700));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.2rem;
  flex: 0 0 auto;
}

.article__author {
  font-weight: 700;
  color: var(--heading);
}

.article__date {
  color: var(--slate-500);
  font-size: 0.85rem;
}

.article h2 {
  margin-top: 1.6em;
}

.article p,
.article li {
  color: var(--slate-700);
}

.article ul,
.article ol {
  margin: 0 0 1.2em;
  padding-left: 1.4em;
}

.article blockquote {
  border-left: 4px solid var(--teal-400);
  background: var(--accent-soft);
  margin: 1.5em 0;
  padding: 14px 20px;
  border-radius: 0 10px 10px 0;
  color: var(--slate-700);
}

.article blockquote p {
  margin: 0;
}

.author-bio {
  background: var(--slate-50);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 32px;
}

.author-bio__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.author-bio__name {
  font-weight: 700;
  color: var(--heading);
}

.author-bio p {
  color: var(--slate-600);
  font-size: 0.9rem;
  margin: 0;
}

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
  font-size: 0.85rem;
  color: var(--slate-500);
  padding: 18px 0 0;
}

.breadcrumbs a {
  color: var(--slate-500);
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.breadcrumbs span {
  margin: 0 6px;
  color: var(--slate-300);
}

/* ---------- Callout / notice ---------- */
.callout {
  background: var(--accent-soft);
  border: 1px solid var(--teal-200);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  color: var(--slate-700);
  font-size: 0.92rem;
  margin: 20px 0;
}

.callout strong {
  color: var(--teal-800);
}

.callout--amber {
  background: #fffbeb;
  border-color: #fde68a;
}

.callout--amber strong {
  color: #92400e;
}

/* ---------- Feature grid ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.feature__icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}

.feature__icon svg {
  width: 22px;
  height: 22px;
}

.feature h3 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.feature p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--slate-900);
  color: var(--slate-400);
  margin-top: 56px;
}

.site-footer__top {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 32px;
  padding: 48px 0 32px;
}

.site-footer__brand {
  color: #fff;
  font-weight: 800;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.site-footer__about {
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.site-footer h4 {
  color: #fff;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer li {
  margin-bottom: 9px;
}

.site-footer a {
  color: var(--slate-400);
  font-size: 0.9rem;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--teal-400);
  text-decoration: underline;
}

.site-footer__bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 20px 0;
  font-size: 0.8rem;
}

.site-footer__bottom .disclaimer {
  margin-bottom: 12px;
  line-height: 1.5;
}

@media (max-width: 860px) {
  .site-footer__top {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .site-footer__top {
    grid-template-columns: 1fr;
  }
}

/* ---------- Calculator layout ---------- */
.calc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 24px;
  align-items: start;
  margin-top: 36px;
}

.results-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero__head {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.hero__head .hero__lead {
  margin: 0 auto;
}

@media (max-width: 900px) {
  .calc-layout {
    grid-template-columns: 1fr;
  }
}

/* ---------- Utility ---------- */
.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-muted);
}

.mt-0 {
  margin-top: 0;
}

.mt-1 {
  margin-top: 8px;
}

.mt-2 {
  margin-top: 16px;
}

.mt-3 {
  margin-top: 24px;
}

.mt-4 {
  margin-top: 32px;
}

.mb-0 {
  margin-bottom: 0;
}

.hidden {
  display: none !important;
}
