/* LeafLedgerCo — cream / teal / sage / sand, mobile-first */

@font-face {
  font-family: "DM Serif Display";
  src: url("../fonts/dm-serif-display.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DM Sans";
  src: url("../fonts/dm-sans.woff") format("woff");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --cream: #fdf7e9;
  --cream-2: #f7f4ed;
  --white: #ffffff;
  --teal: #0c4e58;
  --teal-mid: #2f5d62;
  --sage: #a9c19d;
  --sage-dark: #5e8b7e;
  --sand: #c9a66b;
  --ink: #263238;
  --muted: #5c6b68;
  --line: #d7e0dc;
  --danger: #8a3b2b;
  --ok: #2f5d62;
  --shadow: 0 10px 30px rgba(12, 78, 88, 0.07);
  --radius: 16px;
  --wrap: 70rem;
  --header-h: 4.25rem;
  color-scheme: light;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 400;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; }

a { color: var(--teal); }
a:hover { color: var(--teal-mid); }

:focus-visible {
  outline: 3px solid var(--sand);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  background: var(--teal);
  color: var(--white);
  padding: 0.5rem 0.9rem;
  border-radius: 0 0 0.5rem 0.5rem;
  z-index: 200;
  text-decoration: none;
}
.skip-link:focus { top: 0; color: var(--white); }

.wrap {
  width: min(100% - 1.75rem, var(--wrap));
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(253, 247, 233, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--teal);
  flex-shrink: 0;
}
.brand img { width: 2.5rem; height: 2.5rem; }
.wordmark {
  font-family: "DM Serif Display", serif;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  line-height: 1;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--teal);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}
.nav-toggle[aria-expanded="true"] { background: var(--white); }

.site-nav {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: var(--header-h);
  background: var(--cream);
  border-bottom: 1px solid var(--line);
  padding: 0.5rem 0 1rem;
  flex-direction: column;
}
.site-nav.is-open { display: flex; }
.site-nav a {
  text-decoration: none;
  color: var(--teal-mid);
  font-weight: 600;
  padding: 0.65rem 1.25rem;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--teal); }
.site-nav .nav-cta { color: var(--teal); }

@media (min-width: 860px) {
  .nav-toggle { display: none; }
  .site-nav {
    display: flex;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 0.15rem 1.15rem;
    border: 0;
    padding: 0;
    background: transparent;
  }
  .site-nav a { padding: 0.35rem 0; font-size: 0.95rem; }
}

/* Hero & typography */
.kicker {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sand);
  margin: 0 0 0.7rem;
}

h1, h2, h3, .serif {
  font-family: "DM Serif Display", serif;
  font-weight: 400;
  color: var(--teal);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); margin: 0 0 0.85rem; }
h2 { font-size: clamp(1.6rem, 3vw, 2.15rem); margin: 0 0 0.75rem; }
h3 { font-size: 1.25rem; margin: 0 0 0.45rem; }

.lede {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 40rem;
  margin: 0 0 1.5rem;
}

.hero {
  padding: 2.75rem 0 2.25rem;
}
.hero-grid {
  display: grid;
  gap: 2rem;
}
@media (min-width: 800px) {
  .hero-grid {
    grid-template-columns: 1.2fr 0.8fr;
    align-items: center;
  }
}

.rule {
  width: 3.25rem;
  height: 3px;
  background: var(--sand);
  border: 0;
  margin: 0 0 1.25rem;
}

/* Buttons */
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-decoration: none;
  font-weight: 650;
  font-size: 0.98rem;
  border-radius: 999px;
  padding: 0.75rem 1.25rem;
  border: 2px solid var(--teal);
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
}
.btn-primary { background: var(--teal); color: var(--white); }
.btn-primary:hover { background: var(--teal-mid); color: var(--white); border-color: var(--teal-mid); }
.btn-ghost { background: transparent; color: var(--teal); }
.btn-ghost:hover { background: var(--white); color: var(--teal); }
.btn-sand { background: var(--sand); border-color: var(--sand); color: var(--teal); }
.btn-sand:hover { filter: brightness(0.96); color: var(--teal); }

/* Cards & sections */
main { flex: 1; }

section { padding: 2.25rem 0; }

.section-alt { background: var(--cream-2); }

.card-grid {
  display: grid;
  gap: 1rem;
}
@media (min-width: 700px) {
  .card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
  .card-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
  .card-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 980px) {
  .card-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
}

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem 1.3rem 1.4rem;
  box-shadow: var(--shadow);
}
.card p { margin: 0 0 0.85rem; color: var(--muted); }
.card p:last-child { margin-bottom: 0; }
.card a.card-link {
  font-weight: 700;
  text-decoration: none;
}
.card a.card-link::after { content: " →"; }

.who-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}
.who-list li {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}
.who-list strong { color: var(--teal); display: block; font-size: 1.05rem; margin-bottom: 0.2rem; }
.who-list span { color: var(--muted); }

/* Free download highlight */
.download-banner {
  display: grid;
  gap: 1rem;
  background: var(--teal);
  color: var(--cream);
  border-radius: 20px;
  padding: 1.6rem 1.5rem;
  box-shadow: var(--shadow);
}
.download-banner h2 { color: var(--cream); }
.download-banner p { margin: 0 0 1rem; color: #e7efe8; }
.download-banner .btn-primary {
  background: var(--sand);
  border-color: var(--sand);
  color: var(--teal);
}
.download-banner .btn-primary:hover { filter: brightness(1.05); color: var(--teal); }
@media (min-width: 760px) {
  .download-banner {
    grid-template-columns: 1.4fr auto;
    align-items: center;
    padding: 2rem 2.1rem;
  }
}

/* Tools layout */
.page-head { padding: 2.2rem 0 0.5rem; }
.tool-layout {
  display: grid;
  gap: 1.25rem;
  padding: 1.25rem 0 2.75rem;
}
@media (min-width: 900px) {
  .tool-layout { grid-template-columns: 1fr 1fr; align-items: start; }
}

label { display: block; font-weight: 650; color: var(--teal-mid); margin: 0 0 0.3rem; font-size: 0.95rem; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.85rem; margin-top: 0.15rem; }

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  font: inherit;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--sage-dark);
  outline: 3px solid color-mix(in srgb, var(--sage) 55%, transparent);
}

.field { margin-bottom: 1rem; }
.field-row {
  display: grid;
  gap: 0.75rem;
}
@media (min-width: 540px) {
  .field-row.two { grid-template-columns: 1fr 1fr; }
  .field-row.three { grid-template-columns: 1fr 1fr 1fr; }
}

.check {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-weight: 500;
  color: var(--ink);
  margin: 0.4rem 0 1rem;
}
.check input { margin-top: 0.3rem; flex-shrink: 0; width: 1.1rem; height: 1.1rem; }
.check label { margin: 0; font-weight: 500; color: var(--ink); }

.results {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem 1.25rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: calc(var(--header-h) + 0.75rem);
}
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0 0 1rem;
}
.stat {
  background: var(--cream-2);
  border-radius: 12px;
  padding: 0.8rem 0.85rem;
}
.stat .lbl { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sage-dark); font-weight: 700; }
.stat .val { font-family: "DM Serif Display", serif; font-size: 1.45rem; color: var(--teal); line-height: 1.2; margin-top: 0.15rem; }
.stat.wide { grid-column: 1 / -1; }
.stat.accent { background: var(--teal); }
.stat.accent .lbl { color: var(--sage); }
.stat.accent .val { color: var(--cream); }
.stat.warn { background: #f6e6df; }
.stat.warn .val { color: var(--danger); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th, td { text-align: left; padding: 0.55rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sage-dark); font-weight: 700; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.bill-table input { padding: 0.45rem 0.5rem; }
.bill-table .actions { width: 2.5rem; }
.icon-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.25rem;
  border-radius: 6px;
}
.icon-btn:hover { color: var(--danger); background: #f6e6df; }

/* Disclaimer */
.disclaimer {
  border: 2px solid var(--sand);
  background: #fff8eb;
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  margin: 0 0 1.25rem;
}
.disclaimer h2, .disclaimer h3 { font-size: 1.05rem; margin-bottom: 0.4rem; color: var(--teal); }
.disclaimer p { margin: 0; color: var(--ink); font-size: 0.95rem; }

/* Guide article */
.article {
  max-width: 42rem;
  padding: 0 0 3rem;
}
.article p, .article li { font-size: 1.05rem; color: #33413f; }
.article h2 { margin-top: 2rem; }
.article ol, .article ul { padding-left: 1.2rem; }
.article li { margin: 0.4rem 0; }
.cta-box {
  margin-top: 2rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.3rem;
  box-shadow: var(--shadow);
}

/* Footer */
.site-footer {
  background: var(--teal);
  color: #d7e4df;
  padding: 2rem 0 1.6rem;
  margin-top: auto;
}
.site-footer a { color: var(--sage); }
.site-footer .wrap { display: grid; gap: 1rem; }
.site-footer .brand { color: var(--cream); }
.site-footer .wordmark { color: var(--cream); }
.foot-links { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; }
.foot-note { font-size: 0.85rem; margin: 0; max-width: 46rem; }
.foot-copy { font-size: 0.85rem; margin: 0; color: #b7c9c3; }

/* Paycheck columns */
.paycheck-cols {
  display: grid;
  gap: 0.85rem;
}
@media (min-width: 640px) {
  .paycheck-cols.n-2 { grid-template-columns: 1fr 1fr; }
  .paycheck-cols.n-3 { grid-template-columns: 1fr 1fr 1fr; }
  .paycheck-cols.n-4,
  .paycheck-cols.n-5 { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 980px) {
  .paycheck-cols.n-4 { grid-template-columns: repeat(4, 1fr); }
  .paycheck-cols.n-5 { grid-template-columns: repeat(3, 1fr); }
}
.pay-card h3 { font-size: 1.1rem; }
.pay-card .muted { color: var(--muted); font-size: 0.9rem; }
.short { color: var(--danger); font-weight: 700; }

/* 404 */
.not-found { padding: 4rem 0 5rem; text-align: center; }

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

/* Stack data tables on small screens so labels and values stay readable */
@media (max-width: 639px) {
  .stack-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .stack-table, .stack-table tbody, .stack-table tr, .stack-table th, .stack-table td {
    display: block;
    width: 100%;
  }
  .stack-table tr {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.7rem 0.8rem 0.55rem;
    margin-bottom: 0.7rem;
    background: var(--white);
  }
  .stack-table td {
    border: 0;
    padding: 0.28rem 0;
    text-align: left;
  }
  .stack-table td.num { text-align: left; }
  .stack-table td[data-label] {
    display: grid;
    grid-template-columns: 7.2rem 1fr;
    align-items: center;
    gap: 0.4rem;
  }
  .stack-table td[data-label]::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sage-dark);
  }
  .stack-table td.actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.2rem;
  }
  .bill-table input { width: 100%; }
}

td.date, th.date { white-space: nowrap; }

.more-tools-heading {
  margin: 1.6rem 0 0.7rem;
  font-size: 1.15rem;
}
.more-tools {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem 1.75rem;
}
@media (min-width: 700px) {
  .more-tools { grid-template-columns: 1fr 1fr; }
}
.more-tools a {
  text-decoration: none;
  font-weight: 650;
  color: var(--teal);
}
.more-tools a:hover { color: var(--teal-mid); text-decoration: underline; }
