:root {
  --mc-forest: #062a1f;
  --mc-forest-2: #0b3a2c;
  --mc-ink: #0a1f17;
  --mc-muted: #52655e;
  --mc-ivory: #f3f6f2;
  --mc-paper: #f8faf7;
  --mc-white: #ffffff;
  --mc-mint: #35e89a;
  --mc-mint-soft: #dff8ec;
  --mc-saffron: #f4a72c;
  --mc-line: rgba(6, 42, 31, 0.14);
  --mc-display: "Fraunces", Georgia, serif;
  --mc-body: "Karla", system-ui, -apple-system, sans-serif;
  --mc-mono: "IBM Plex Mono", ui-monospace, monospace;
  --mc-shadow: 0 24px 70px rgba(6, 42, 31, 0.12);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
  background: var(--mc-paper);
}

body {
  color: var(--mc-ink);
  background: var(--mc-paper);
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  opacity: 0.32;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.03'/%3E%3C/svg%3E");
}

::selection {
  color: var(--mc-forest);
  background: var(--mc-mint);
}

:focus-visible {
  outline: 3px solid var(--mc-saffron) !important;
  outline-offset: 3px !important;
}

.skip-link {
  position: fixed;
  top: 0.65rem;
  left: 0.65rem;
  z-index: 1000;
  padding: 0.75rem 1rem;
  color: var(--mc-white);
  background: var(--mc-forest);
  border-radius: 0.7rem;
  font: 700 0.85rem/1 var(--mc-body);
  text-decoration: none;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.mc-global-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.8rem;
  padding: 0.65rem max(1rem, calc((100% - 1240px) / 2));
  gap: 1.5rem;
  color: var(--mc-ink);
  background: rgba(248, 250, 247, 0.9);
  border-bottom: 1px solid rgba(6, 42, 31, 0.1);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.mc-global-brand {
  display: inline-flex;
  width: clamp(12.5rem, 20vw, 17rem);
  flex: none;
}

.mc-global-brand img {
  display: block;
  width: 100%;
  height: auto;
}

.mc-global-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.mc-global-links a {
  position: relative;
  min-height: 42px;
  padding: 0.75rem 0.8rem;
  color: var(--mc-muted);
  border-radius: 999px;
  font: 700 0.86rem/1.2 var(--mc-body);
  text-decoration: none;
}

.mc-global-links a:hover,
.mc-global-links a[aria-current="page"] {
  color: var(--mc-forest);
  background: var(--mc-mint-soft);
}

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 400;
  width: 100%;
  height: 3px;
  pointer-events: none;
}

.reading-progress i {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--mc-mint);
  transform: scaleX(0);
  transform-origin: left;
}

.mc-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 2.5rem;
  color: var(--mc-muted);
  font: 600 0.68rem/1.4 var(--mc-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mc-breadcrumbs a {
  color: var(--mc-forest-2);
  text-decoration: none;
}

/* Editorial articles and legal pages */
body.is-read main,
body.is-page main {
  width: min(calc(100% - 2rem), 860px) !important;
  max-width: 860px !important;
  margin: 0 auto !important;
  padding: clamp(3rem, 8vw, 7rem) 0 clamp(4rem, 9vw, 8rem) !important;
  color: var(--mc-ink);
  font-family: var(--mc-body);
  font-size: clamp(1.03rem, 1.3vw, 1.16rem);
  line-height: 1.78;
}

body.is-read main article {
  max-width: none;
}

body.is-read .fileline,
body.is-read .kicker,
body.is-page .fileline,
body.is-page .code {
  margin: 0 0 1.1rem;
  color: var(--mc-forest-2);
  font: 700 0.7rem/1.4 var(--mc-mono);
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

body.is-read h1,
body.is-page h1 {
  max-width: 16ch;
  margin: 0 0 1.3rem;
  color: var(--mc-forest);
  font-family: var(--mc-display);
  font-size: clamp(3rem, 8vw, 6.5rem);
  font-weight: 580;
  letter-spacing: -0.055em;
  line-height: 0.94;
  text-wrap: balance;
}

body.is-page h1 {
  max-width: 14ch;
  font-size: clamp(3rem, 7vw, 5.4rem);
}

body.is-read .standfirst,
body.is-page main > p:first-of-type:not(.fileline):not(.code) {
  max-width: 46rem;
  margin: 0 0 2.5rem;
  color: var(--mc-muted);
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  line-height: 1.55;
}

body.is-read main h2,
body.is-page main h2 {
  display: block;
  width: auto;
  margin: clamp(3.2rem, 7vw, 5rem) 0 1rem;
  padding: 0;
  color: var(--mc-forest);
  border: 0;
  font-family: var(--mc-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

body.is-read main h2::before,
body.is-page main h2::before {
  display: block;
  width: 3rem;
  height: 4px;
  margin-bottom: 1rem;
  content: "";
  background: var(--mc-mint);
  border-radius: 4px;
}

body.is-read main h3,
body.is-page main h3 {
  color: var(--mc-forest);
  font-family: var(--mc-display);
  font-size: 1.45rem;
}

body.is-read main p,
body.is-page main p {
  margin: 0 0 1.3rem;
}

body.is-read main a,
body.is-page main a {
  color: var(--mc-forest-2);
  text-decoration-color: var(--mc-mint);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

body.is-read main ul,
body.is-read main ol,
body.is-page main ul,
body.is-page main ol {
  margin: 1rem 0 1.7rem;
  padding-left: 1.25rem;
}

body.is-read main li,
body.is-page main li {
  margin: 0.7rem 0;
  padding-left: 0.35rem;
}

body.is-read main li::marker,
body.is-page main li::marker {
  color: var(--mc-forest-2);
  font-weight: 800;
}

body.is-read .inshort,
body.is-read .note,
body.is-read .callout,
body.is-page .stampbox,
body.is-page .mailcard {
  margin: 2.2rem 0 !important;
  padding: clamp(1.4rem, 3vw, 2rem) !important;
  color: var(--mc-ink) !important;
  background: var(--mc-mint-soft) !important;
  border: 0 !important;
  border-left: 5px solid var(--mc-mint) !important;
  border-radius: 0 1.25rem 1.25rem 0 !important;
  box-shadow: none !important;
  transform: none !important;
}

body.is-read .inshort .k,
body.is-read .note .k,
body.is-read .more .k,
body.is-page .mailcard .k {
  color: var(--mc-forest-2) !important;
  font: 700 0.7rem/1.4 var(--mc-mono) !important;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

body.is-read hr.ledger {
  height: 1px;
  margin: 3.5rem 0;
  background: var(--mc-line);
  border: 0;
}

body.is-read table {
  display: table;
  width: 100%;
  margin: 2rem 0;
  border: 1px solid var(--mc-line);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 1rem;
  overflow: hidden;
  font-size: 0.94rem;
}

body.is-read th {
  color: var(--mc-ivory);
  background: var(--mc-forest);
  font-family: var(--mc-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

body.is-read th,
body.is-read td {
  padding: 1rem;
  border-right: 1px solid var(--mc-line);
  border-bottom: 1px solid var(--mc-line);
}

body.is-read tr:last-child td {
  border-bottom: 0;
}

body.is-read td:last-child,
body.is-read th:last-child {
  border-right: 0;
}

body.is-read .author {
  display: grid;
  grid-template-columns: 4rem 1fr;
  align-items: start;
  margin: 4rem 0 0;
  padding: 2rem;
  gap: 1.1rem;
  background: var(--mc-white);
  border: 1px solid var(--mc-line);
  border-radius: 1.25rem;
  box-shadow: 0 16px 45px rgba(6, 42, 31, 0.07);
}

body.is-read .author .seal {
  display: grid;
  width: 3.7rem;
  height: 3.7rem;
  padding: 0;
  background: none;
  border: 0;
  place-items: center;
}

body.is-read .author .seal img {
  width: 100%;
  height: 100%;
}

body.is-read .more {
  margin: 2rem 0 0;
  padding: 2rem;
  color: var(--mc-ivory);
  background: var(--mc-forest);
  border-radius: 1.25rem;
}

body.is-read .more .k {
  color: var(--mc-mint) !important;
}

body.is-read .more a {
  display: block;
  margin-top: 0.9rem;
  color: var(--mc-ivory);
  text-decoration-color: var(--mc-mint);
}

.mc-universal-footer {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  padding: 3rem max(1rem, calc((100% - 1100px) / 2));
  gap: 3rem;
  color: #bdd0c6;
  background: #031d15;
  font: 0.9rem/1.6 var(--mc-body);
}

.mc-universal-footer img {
  display: block;
  width: min(100%, 18rem);
  filter: brightness(0) invert(1);
}

.mc-universal-footer p {
  max-width: 36rem;
  margin: 1rem 0 0;
}

.mc-universal-footer nav {
  display: flex;
  align-items: start;
  justify-content: end;
  flex-wrap: wrap;
  gap: 0.7rem 1.2rem;
}

.mc-universal-footer a {
  color: var(--mc-ivory);
  text-decoration: none;
}

/* Tool shell: keep each calculator's functionality, replace the visual frame. */
body.is-tool {
  background: var(--mc-paper) !important;
}

body.is-tool .mc-global-header {
  min-height: 4.2rem;
}

body.is-tool > header:not(.mc-global-header) {
  top: 4.2rem !important;
}

body.is-tool:not(.is-apna) > main,
body.is-tool:not(.is-apna) > main.wrap {
  width: min(calc(100% - 1rem), 820px) !important;
  max-width: 820px !important;
  margin-inline: auto !important;
}

body.is-tool .top h1,
body.is-tool header.top h1 {
  color: var(--mc-forest) !important;
  font-family: var(--mc-display) !important;
  font-size: clamp(2.5rem, 7vw, 4.8rem) !important;
  font-weight: 580 !important;
  letter-spacing: -0.05em !important;
  line-height: 0.96 !important;
}

body.is-tool .kicker,
body.is-tool .section-label {
  color: var(--mc-forest-2) !important;
  font-family: var(--mc-mono) !important;
  letter-spacing: 0.1em !important;
}

body.is-tool .card,
body.is-tool .inputs,
body.is-tool .gauge-card,
body.is-tool .ledger,
body.is-tool .chartwrap,
body.is-tool .break,
body.is-tool .result,
body.is-tool .result-card {
  background: var(--mc-white) !important;
  border-color: var(--mc-line) !important;
  border-radius: 1.25rem !important;
  box-shadow: 0 14px 40px rgba(6, 42, 31, 0.07) !important;
}

body.is-tool input,
body.is-tool select,
body.is-tool textarea {
  min-height: 48px;
  color: var(--mc-ink) !important;
  background-color: var(--mc-white) !important;
  border-color: rgba(6, 42, 31, 0.2) !important;
  border-radius: 0.75rem !important;
}

body.is-tool input:focus,
body.is-tool select:focus,
body.is-tool textarea:focus {
  border-color: var(--mc-forest-2) !important;
  box-shadow: 0 0 0 3px rgba(53, 232, 154, 0.2) !important;
  outline: 0 !important;
}

body.is-tool .btn-primary,
body.is-tool button.primary,
body.is-tool .calculate,
body.is-tool .cta {
  color: var(--mc-ivory) !important;
  background: var(--mc-forest) !important;
  border-color: var(--mc-forest) !important;
}

body.is-tool .hero-card,
body.is-tool .result-hero,
body.is-tool .verdict {
  color: var(--mc-ivory) !important;
  background: var(--mc-forest) !important;
  border: 0 !important;
  border-radius: 1.35rem !important;
}

body.is-tool .tile,
body.is-tool .q,
body.is-tool .barcard {
  border-color: var(--mc-line) !important;
  border-radius: 1rem !important;
}

body.is-finance-desk {
  --paper: var(--mc-paper);
  --surface: var(--mc-white);
  --ink: var(--mc-ink);
  --muted: var(--mc-muted);
  --line: var(--mc-line);
  --maroon: var(--mc-forest);
  --maroon-d: #031d15;
  --saffron: var(--mc-mint);
  --saffron-soft: var(--mc-mint-soft);
  --green: #087a55;
}

body.is-finance-desk > header:not(.mc-global-header) {
  background: linear-gradient(135deg, var(--mc-forest), #031d15) !important;
}

body.is-finance-desk > main {
  padding-top: 1rem !important;
}

body.is-apna .mc-global-header {
  width: 100vw;
  margin-left: calc(50% - 50vw);
}

body.is-apna {
  --deep: var(--mc-forest);
  --moss: #0b3a2c;
  --moss2: #14513d;
  --bg: var(--mc-paper);
  --card: var(--mc-white);
  --line: var(--mc-line);
  --gold: var(--mc-mint);
  --gold-deep: #087a55;
}

.scroll-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 90;
  display: grid;
  width: 3rem;
  height: 3rem;
  color: var(--mc-forest);
  background: var(--mc-mint);
  border: 0;
  border-radius: 50%;
  box-shadow: var(--mc-shadow);
  font-size: 1.15rem;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.8rem);
  transition: 180ms ease;
}

.scroll-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

@media (max-width: 720px) {
  .mc-global-header {
    min-height: 4.4rem;
    padding-inline: 0.75rem;
    gap: 0.4rem;
  }

  .mc-global-brand {
    width: 11.5rem;
  }

  .mc-global-links {
    gap: 0;
  }

  .mc-global-links a {
    min-height: 40px;
    padding: 0.7rem 0.52rem;
    font-size: 0.75rem;
  }

  .mc-global-links a:first-child,
  .mc-global-links a:last-child {
    display: none;
  }

  body.is-tool > header:not(.mc-global-header) {
    top: 4.4rem !important;
  }

  body.is-read main,
  body.is-page main {
    width: min(calc(100% - 1.35rem), 860px) !important;
    padding-top: 3.5rem !important;
  }

  body.is-read h1,
  body.is-page h1 {
    font-size: clamp(2.75rem, 13vw, 4.4rem);
  }

  body.is-read table {
    display: block;
    overflow-x: auto;
  }

  body.is-read .author {
    grid-template-columns: 3rem 1fr;
    padding: 1.25rem;
  }

  .mc-universal-footer {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .mc-universal-footer nav {
    justify-content: start;
  }
}

@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;
  }
}
