/* Same colors, font and shapes as the landing page at savewithluna.com */
:root {
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --primary: 205 85% 65%;
  --link: 205 85% 38%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 40%;
  --border: 214.3 31.8% 91.4%;
  --cta-from: 205 85% 58%;
  --cta-to: 205 85% 72%;
  --page-from: 220 60% 95%;
  --page-via: 0 0% 99.5%;
  --page-to: 220 60% 96%;
  --radius: 0.75rem;
}
:root.dark {
  --background: 224 71% 4%;
  --foreground: 213 31% 91%;
  --card: 222 47% 11%;
  --link: 205 85% 70%;
  --muted: 223 47% 11%;
  --muted-foreground: 215 20% 65%;
  --border: 216 34% 17%;
  --cta-from: 205 75% 48%;
  --cta-to: 205 75% 58%;
  --page-from: 224 71% 4%;
  --page-via: 224 50% 6%;
  --page-to: 224 71% 4%;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Nunito, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: hsl(var(--foreground));
  background: hsl(var(--background)) linear-gradient(135deg, hsl(var(--page-from)), hsl(var(--page-via)) 50%, hsl(var(--page-to))) fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: hsl(var(--link)); }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 2px solid hsl(var(--primary)); outline-offset: 3px; border-radius: 6px; }
.muted { color: hsl(var(--muted-foreground)); }

/* navigation */
.nav-wrap { position: sticky; top: 0; z-index: 10; padding: 14px 16px 0; }
.nav {
  max-width: 1040px; margin: 0 auto; padding: 8px 10px 8px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid hsl(var(--border)); border-radius: 999px;
  background: hsl(var(--background) / 0.82);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.logo { display: flex; align-items: center; flex: none; }
.logo img { height: 40px; width: auto; display: block; }
.logo-dark, .dark .logo-light { display: none; }
.dark .logo-dark { display: block; }
.nav-links { display: flex; align-items: center; gap: 2px; min-width: 0; }
.nav-links a {
  padding: 8px 12px; border-radius: 999px; font-size: 15px; font-weight: 700;
  color: hsl(var(--muted-foreground)); text-decoration: none; white-space: nowrap;
}
.nav-links a:hover, .nav-links a[aria-current] { color: hsl(var(--foreground)); }
#theme-toggle {
  display: grid; place-items: center; width: 40px; height: 40px; margin-left: 4px; flex: none;
  border: 1px solid hsl(var(--border)); border-radius: 999px; background: transparent;
  color: hsl(var(--foreground)); cursor: pointer;
}
.icon-moon, .dark .icon-sun { display: none; }
.dark .icon-moon { display: block; }
@media (max-width: 640px) {
  .nav-links a.nav-landing { display: none; }
}

/* layout */
main { max-width: 760px; margin: 0 auto; padding: 44px 16px 24px; }
h1, h2, h3 { line-height: 1.2; font-weight: 800; text-wrap: balance; }
h1 { font-size: clamp(2rem, 6vw, 2.9rem); margin: 0 0 16px; letter-spacing: -0.01em; }
.hero { margin-bottom: 32px; }
.lead { font-size: 1.15rem; color: hsl(var(--muted-foreground)); margin: 0; max-width: 60ch; }

.meta {
  display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0;
  font-size: 0.9rem; color: hsl(var(--muted-foreground));
}

/* cards */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.card {
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  background: hsl(var(--card) / 0.85);
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: hsl(var(--primary) / 0.7); transform: translateY(-2px); }
.card-link { display: block; padding: 22px 24px; color: inherit; text-decoration: none; }
.card h2, .card h3 { font-size: 1.35rem; margin: 8px 0; }
.card .summary { margin: 0 0 12px; color: hsl(var(--muted-foreground)); }
.read-more { font-weight: 700; color: hsl(var(--link)); }

/* article */
.crumbs { display: flex; gap: 8px; margin-bottom: 20px; font-size: 0.9rem; color: hsl(var(--muted-foreground)); }
.crumbs a { color: inherit; }
.updated {
  display: inline-block; margin: 14px 0 0; padding: 4px 12px; border-radius: 999px;
  font-size: 0.85rem; font-weight: 700;
  background: hsl(var(--primary) / 0.14); color: hsl(var(--foreground));
}
.prose { margin-top: 32px; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose h2, .faq h2, .related h2 { font-size: 1.65rem; margin: 2.2em 0 0.6em; scroll-margin-top: 90px; }
.prose h3 { font-size: 1.25rem; margin: 1.8em 0 0.5em; scroll-margin-top: 90px; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.15em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-bottom: 0.4em; }
.prose blockquote {
  margin: 1.5em 0; padding: 4px 0 4px 18px;
  border-left: 3px solid hsl(var(--primary)); color: hsl(var(--muted-foreground));
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose img { border-radius: var(--radius); display: block; margin: 1.5em auto; }
.prose hr { border: 0; border-top: 1px solid hsl(var(--border)); margin: 2.4em 0; }
.prose code { font-size: 0.9em; padding: 2px 6px; border-radius: 6px; background: hsl(var(--muted)); }
.prose pre { overflow-x: auto; padding: 16px; border-radius: var(--radius); background: hsl(var(--muted)); }
.prose pre code { padding: 0; background: none; }
.table-wrap { overflow-x: auto; margin: 1.5em 0; border: 1px solid hsl(var(--border)); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid hsl(var(--border)); }
th { font-weight: 800; background: hsl(var(--muted)); }
tr:last-child td { border-bottom: 0; }

.faq-item { padding: 18px 0; border-top: 1px solid hsl(var(--border)); }
.faq-item h3 { font-size: 1.1rem; margin: 0 0 6px; }
.faq-item p { margin: 0; color: hsl(var(--muted-foreground)); }

.cta {
  margin: 48px 0 0; padding: 30px 26px; text-align: center;
  border: 1px solid hsl(var(--primary) / 0.45); border-radius: var(--radius);
  background: hsl(var(--card) / 0.85);
}
.cta h2 { font-size: 1.5rem; margin: 0 0 8px; }
.cta p { margin: 0 auto 20px; max-width: 46ch; color: hsl(var(--muted-foreground)); }
.button {
  display: inline-block; padding: 13px 28px; border-radius: 999px;
  font-weight: 800; color: #fff; text-decoration: none;
  background: linear-gradient(90deg, hsl(var(--cta-from)), hsl(var(--cta-to)));
  text-shadow: 0 1px 2px hsl(205 85% 25% / 0.45);
  transition: transform 0.15s, filter 0.15s;
}
.button:hover { transform: translateY(-1px); filter: brightness(1.05); }
.related h3 { font-size: 1.15rem; }
.back { margin: 40px 0 0; font-weight: 700; }
.back a { text-decoration: none; }

/* footer */
.footer { padding: 40px 16px 32px; }
.footer-card {
  max-width: 896px; margin: 0 auto; padding: 28px;
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  background: hsl(var(--card) / 0.85); font-size: 0.95rem;
}
.footer-grid { display: grid; gap: 24px; grid-template-columns: 1.6fr 1fr 1fr 1fr; }
.footer-grid p { margin: 0 0 8px; }
.footer-brand { font-size: 1.15rem; font-weight: 800; }
.footer-title { font-weight: 800; }
.footer-grid a { display: block; padding: 3px 0; color: hsl(var(--muted-foreground)); text-decoration: none; }
.footer-grid a:hover { color: hsl(var(--foreground)); }
.footer-copy {
  margin: 24px 0 0; padding-top: 18px; border-top: 1px solid hsl(var(--border));
  text-align: center; font-size: 0.85rem; color: hsl(var(--muted-foreground));
}
@media (max-width: 640px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
  main { padding-top: 32px; }
  .card-link { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .button { transition: none; }
}

/* ---------- calculators ---------- */
.tool header .lead { margin-top: 4px; }
.calc-card { margin: 28px 0 8px; padding: 22px; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card, var(--background))); }
.calc-form { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 0.95rem; position: relative; }
.field em { font-style: normal; font-weight: 400; font-size: 0.85rem; color: hsl(var(--muted-foreground)); }
.calc-form input, .calc-form select, .debt-row input {
  font: inherit; font-weight: 700; padding: 10px 12px; border-radius: 10px; width: 100%; box-sizing: border-box;
  border: 1px solid hsl(var(--border)); background: hsl(var(--background)); color: hsl(var(--foreground));
}
.calc-form input:focus, .calc-form select:focus, .debt-row input:focus { outline: 2px solid hsl(var(--primary)); outline-offset: 1px; }
.calc-result { margin-top: 22px; padding-top: 18px; border-top: 1px solid hsl(var(--border)); }
.result-label { margin: 0; font-weight: 700; color: hsl(var(--muted-foreground)); }
.result-main { margin: 4px 0 8px; font-size: clamp(1.8rem, 6vw, 2.4rem); font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.result-sub, .result-extra { margin: 0 0 6px; }
.result-extra:empty, .calc-table:empty { display: none; }
.calc-table h3 { font-size: 1rem; margin: 14px 14px 6px; }
.debts { grid-column: 1 / -1; display: grid; gap: 10px; }
.debt-row { display: grid; grid-template-columns: 1.4fr 1fr 0.8fr 0.9fr auto; gap: 8px; align-items: end; }
.debt-row label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; font-weight: 700; color: hsl(var(--muted-foreground)); }
.debt-row .remove, .link-button { font: inherit; font-weight: 700; cursor: pointer; border: 0; background: none; color: hsl(var(--link)); padding: 10px 6px; }
.link-button { grid-column: 1 / -1; justify-self: start; padding-left: 0; }
@media (max-width: 560px) {
  .debt-row { grid-template-columns: 1fr 1fr 1fr; }
  .debt-row .d-name { grid-column: 1 / -1; }
  .debt-row .remove { grid-column: 3; justify-self: end; }
}
.field.wide { grid-column: 1 / -1; }
.grid-sub { grid-column: 1 / -1; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-sub[hidden] { display: none; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 700; align-self: end; padding: 10px 0; }
.check input { width: 20px; height: 20px; accent-color: hsl(var(--primary)); }
.calc-note { margin: 14px 0 0; font-size: 0.85rem; color: hsl(var(--muted-foreground)); }
.lang-switch { margin: 0 0 12px; font-weight: 700; }
.lang-switch a { text-decoration: none; }
.lang-badge { display: inline-block; margin-left: 12px; font-size: 0.85rem; font-weight: 700; color: hsl(var(--muted-foreground)); }
