/* ==========================================================================
   personalloaned.com — stylesheet
   --------------------------------------------------------------------------
   Direction: "ledger" — a precise, document-like register for financial
   education. Flat hairline-bordered surfaces (no drop shadows), pill CTAs,
   uppercase kickers above section headings, a spec-sheet key-facts strip,
   ledger grids with 1px dividers, and a two-column shell with a sticky aside.

   Class contract: CONTRACTS.md §4 (renderer <-> stylesheet).
   Brand palette sampled from the owner-supplied logo:
     navy         #002a66   (wordmark "personal" / ".com", headings, footer)
     blue         #004e90   (the hand)
     green        #128a42   (wordmark "loaned", the cash)
     deep green   #0c6130   (primary button, white text = 7.59:1)
     paper        #f6f8fb
   No imports, no external fonts, no JavaScript. System font stack only.
   ========================================================================== */

/* ------------------------------------------------------------------ tokens */
:root {
  /* Brand — verified against sampled logo pixels */
  --green: #128a42;        /* brand green: wordmark "loaned" / cash */
  --green-700: #0c6130;    /* deep green: primary button background */
  --green-800: #0b5f2e;    /* text links (7.80:1 on #fff) */
  --green-900: #08431f;    /* focus ring / hover */
  --green-050: #e8f5ec;    /* green tint */
  --brown: #004e90;        /* brand blue: the hand (secondary accent) */
  --brown-900: #002a66;    /* brand navy: headings, footer, trust bar */
  --brown-050: #e7f0fa;    /* blue tint (bands) */
  --navy: #002a66;         /* alias: --brown-900 */
  --blue: #004e90;         /* alias: --brown */
  --cream: #f6f8fb;        /* page background: cool paper */
  --paper: #f6f8fb;        /* alias: --cream */
  --ink: #101d33;          /* body text: near-black navy */
  --ink-soft: #33425c;     /* secondary text */
  --muted: #5a6b85;        /* meta / disclosure (5.09:1 on paper) */
  --money: #128a42;        /* money/positive green */
  --card: #ffffff;
  --line: #dde5ee;         /* component hairlines */
  --line-strong: #c6d3e2;  /* input borders */
  --hairline: #e6ebf2;     /* section rules inside panels */

  /* Type & space */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --wrap: 1120px;
  --header-h: 62px;        /* sticky masthead height; used by the sticky aside */
}

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

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

/* ------------------------------------------------------------ body / base */
body.site {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main#main {
  flex: 1 0 auto;
  padding-block: 1.25rem 3rem;
  scroll-margin-top: calc(var(--header-h) + 0.5rem);
  min-width: 0;
}

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

h1,
h2,
h3 {
  color: var(--navy);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.01em;
  margin: 1.5em 0 0.5em;
}

h1 {
  font-size: clamp(1.7rem, 1.15rem + 2.3vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.022em;
}

h2 {
  font-size: clamp(1.2rem, 1.08rem + 0.55vw, 1.4375rem);
}

h3 {
  font-size: 1.0625rem;
}

p {
  margin: 0 0 1rem;
}

ul,
ol {
  margin: 0 0 1rem;
}

a {
  color: var(--green-800);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--green-900);
}

strong {
  font-weight: 700;
}

small {
  font-size: 0.8125rem;
  color: var(--muted);
}

::selection {
  background: #d9e6f5;
  color: var(--ink);
}

/* Focus: dark green ring passes 3:1 against paper and white */
:focus-visible {
  outline: 3px solid var(--green-900);
  outline-offset: 2px;
}

/* --------------------------------------------------------------- skip link */
.skip {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  transform: translateY(-250%);
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.15s ease;
}

.skip:focus {
  transform: none;
  color: var(--paper);
}

/* ------------------------------------------------------------------- wrap */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.15rem;
}

/* --------------------------------------------------------------- masthead */
.masthead {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.masthead-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  padding-block: 0.55rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1 1 auto;
  min-width: 0;
  text-decoration: none;
  color: var(--navy);
}

.brand-mark {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.brand-word {
  font-weight: 800;
  font-size: 1.0625rem;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.masthead-cta {
  order: 2;
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0.45rem 1rem;
  font-size: 0.9375rem;
}

.mainnav {
  order: 3;
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  gap: 0.1rem;
  margin: 0 -0.35rem;
  padding: 0.05rem 0.35rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.mainnav::-webkit-scrollbar {
  display: none;
}

.navlink {
  position: relative;
  flex: 0 0 auto;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.navlink:hover {
  color: var(--navy);
  background: var(--paper);
}

.navlink.is-current {
  color: var(--navy);
  font-weight: 700;
}

.navlink.is-current::after {
  content: "";
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  bottom: 0.05rem;
  height: 2px;
  border-radius: 2px;
  background: var(--green);
}

/* ------------------------------------------------------------ breadcrumbs */
.breadcrumbs {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0.1rem 0 0.9rem;
}

.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
}

.breadcrumbs li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.breadcrumbs li + li::before {
  content: "/";
  color: var(--line-strong);
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--green-800);
  text-decoration: underline;
}

.breadcrumbs [aria-current="page"] {
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 22ch;
}

/* ------------------------------------------------------------------- hero */
.hero {
  padding: 0.35rem 0 1.15rem;
  margin: 0 0 1.5rem;
  border-bottom: 1px solid var(--hairline);
}

.hero .page-title {
  margin: 0.15rem 0 0.6rem;
  text-wrap: balance;
}

.hero .lede {
  max-width: 68ch;
}

.hero .disclosure {
  margin-bottom: 0;
}

/* Uppercase micro-label with a green rule. Sits above h2s and in asides. */
.kicker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.45rem;
  color: var(--blue);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.4;
  text-transform: uppercase;
}

.kicker::before {
  content: "";
  flex: 0 0 auto;
  width: 22px;
  height: 2px;
  background: var(--green);
}

.lede {
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 66ch;
  margin: 0 0 1.15rem;
}

.meta-line {
  font-size: 0.8125rem;
  color: var(--muted);
  letter-spacing: 0.01em;
  margin: 0.2rem 0 1.1rem;
}

.meta-line strong {
  color: var(--ink-soft);
  font-weight: 600;
}

/* ------------------------------------------------------------- page shell */
.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}

.page-main {
  min-width: 0;
}

.page-aside {
  min-width: 0;
}

/* ----------------------------------------------------------------- panels */
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  margin: 0 0 1.25rem;
}

/* tools.js emits `class="tool card"`; keep .card as a panel alias. */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  margin: 0 0 1.25rem;
}

.panel > :first-child,
.card > :first-child {
  margin-top: 0;
}

.panel > :last-child,
.card > :last-child {
  margin-bottom: 0;
}

/* Tinted band for the "rules where you live" section and similar asides. */
.band {
  background: var(--brown-050);
  border: 1px solid #d7e5f6;
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  margin: 0 0 1.25rem;
}

.band > :first-child {
  margin-top: 0;
}

.band > :last-child {
  margin-bottom: 0;
}

.band .kicker {
  color: var(--navy);
}

/* ---------------------------------------------------------------- ledger */
/* Hairline-divided grids: no shadows, 1px rules between the cells. */
.steps,
.toolgrid,
.facts,
.facts4 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  list-style: none;
  padding: 0;
}

.steps > *,
.toolgrid > *,
.facts > *,
.facts4 > * {
  min-width: 0;
  border-top: 1px solid var(--line);
}

.steps > :first-child,
.toolgrid > :first-child,
.facts > :first-child,
.facts4 > :first-child {
  border-top: 0;
}

.steps {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.step {
  background: var(--card);
  padding: 1.1rem 1.15rem;
}

.step h3 {
  margin: 0.6rem 0 0.35rem;
}

.step p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--green-050);
  color: var(--green-800);
  font-size: 0.8125rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.toolgrid {
  margin: 1rem 0;
}

.toolcard {
  display: block;
  background: var(--card);
  padding: 0.95rem 1.05rem;
  color: var(--ink);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.toolcard:hover {
  background: var(--green-050);
}

.toolcard-name {
  display: block;
  font-weight: 700;
  color: var(--navy);
  text-transform: capitalize;
  letter-spacing: -0.005em;
}

.toolcard:hover .toolcard-name {
  color: var(--green-800);
}

.toolcard-note {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
}

/* key-facts strip (city pages use .facts4 for a 4-across spec band) */
.facts,
.facts4 {
  margin: 0 0 1.25rem;
}

.fact {
  background: var(--card);
  padding: 0.8rem 1rem;
  min-width: 0;
}

.fact-label {
  display: block;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.fact-value {
  display: block;
  margin-top: 0.25rem;
  color: var(--navy);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.fact-value a {
  color: var(--navy);
  text-decoration-color: rgba(0, 78, 144, 0.45);
}

.fact-value a:hover {
  color: var(--green-800);
}

/* ------------------------------------------------------------------- CTA */
.cta-row,
.cta-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 1.05rem 0 0.35rem;
}

.cta-block {
  margin: 1.25rem 0 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 44px;
  padding: 0.65rem 1.35rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease;
}

/* White on deep green: 7.59:1 — passes WCAG AA for the button label. */
.btn-primary {
  background: var(--green-700);
  color: #fff;
  border-color: var(--green-700);
}

.btn-primary:hover {
  background: var(--green-900);
  border-color: var(--green-900);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--navy);
  border-color: var(--line-strong);
}

.btn-outline:hover {
  background: var(--card);
  border-color: var(--navy);
  color: var(--navy);
}

/* Legacy alias kept so older markup keeps its outline treatment. */
.btn-ghost {
  background: transparent;
  color: var(--navy);
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  background: var(--card);
  border-color: var(--navy);
  color: var(--navy);
}

.disclosure {
  max-width: 78ch;
  margin: 0.55rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--muted);
}

.disclosure a {
  color: var(--green-800);
}

/* ---------------------------------------------------------------- aside */
.aside-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  margin: 0 0 1.25rem;
}

.aside-head {
  margin: 0 0 0.4rem;
  color: var(--navy);
  font-size: 1.0625rem;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.aside-btn {
  display: flex;
  width: 100%;
  margin: 0.6rem 0 0.55rem;
}

.aside-link {
  display: block;
  margin: 0 0 0.7rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.aside-disclosure {
  margin: 0;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.55;
}

.aside-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
}

.aside-list li {
  padding: 0.4rem 0;
  border-top: 1px solid var(--hairline);
  font-size: 0.875rem;
  line-height: 1.5;
}

.aside-list li:first-child {
  border-top: 0;
}

.aside-list a {
  font-weight: 600;
  text-decoration: none;
}

.aside-list a:hover {
  text-decoration: underline;
}

/* Table of contents (guide aside) */
.toc {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  margin: 0 0 1.25rem;
}

.toc-list {
  list-style: none;
  counter-reset: toc;
  margin: 0.35rem 0 0;
  padding: 0;
}

.toc-list li {
  counter-increment: toc;
  border-top: 1px solid var(--hairline);
  font-size: 0.875rem;
}

.toc-list li:first-child {
  border-top: 0;
}

.toc-list a {
  display: flex;
  gap: 0.55rem;
  padding: 0.4rem 0;
  color: var(--ink-soft);
  font-weight: 600;
  text-decoration: none;
  line-height: 1.45;
}

.toc-list a::before {
  content: counter(toc, decimal-leading-zero);
  flex: 0 0 auto;
  color: var(--green-800);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.toc-list a:hover {
  color: var(--green-900);
  text-decoration: underline;
}

/* -------------------------------------------------------------------- FAQ */
.faq {
  padding-bottom: 0.5rem;
}

.faq-item {
  border-top: 1px solid var(--hairline);
}

.faq-item summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  color: var(--navy);
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  flex: 0 0 auto;
  color: var(--green-800);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
}

.faq-item[open] summary {
  color: var(--green-900);
}

.faq-item[open] summary::after {
  content: "\2013";
}

.faq-answer {
  max-width: 72ch;
  padding: 0 0 1rem;
  color: var(--ink-soft);
  line-height: 1.7;
}

.faq-answer > :first-child {
  margin-top: 0;
}

.faq-answer > :last-child {
  margin-bottom: 0;
}

/* ------------------------------------------------------------------ prose */
.prose > h2,
.prose > h3 {
  margin-top: 1.6em;
}

.prose > h2:first-child,
.prose > h3:first-child {
  margin-top: 0;
}

.prose p,
.prose li,
.prose h2,
.prose h3,
.prose blockquote {
  max-width: 68ch;
}

.prose ul,
.prose ol {
  padding-left: 1.3rem;
}

.prose li {
  margin-bottom: 0.4rem;
}

.prose a {
  color: var(--green-800);
  text-decoration: underline;
  text-decoration-color: rgba(11, 95, 46, 0.4);
}

.prose a:hover {
  text-decoration-color: currentColor;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin: 1.25rem 0;
}

.prose th,
.prose td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.prose thead th {
  background: var(--paper);
  color: var(--navy);
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-strong);
}

/* Numbered guide sections */
.guide-body > .gsec {
  border-top: 1px solid var(--hairline);
  padding-top: 1.25rem;
  margin-top: 1.25rem;
}

.guide-body > .gsec:first-child {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.gsec-num {
  display: block;
  margin: 0 0 0.1rem;
  color: var(--green-800);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.gsec h2 {
  margin-top: 0;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

/* ----------------------------------------------------------------- tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin: 0.5rem 0 0.25rem;
}

.data-table th,
.data-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.data-table thead th {
  background: var(--paper);
  color: var(--navy);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

.data-table tbody tr:last-child th,
.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table a {
  color: var(--green-800);
}

.data-table small {
  display: inline-block;
  margin-top: 0.15rem;
  line-height: 1.45;
}

.data-table tr[id] {
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

/* --------------------------------------------------------------- callouts */
.callout {
  max-width: 78ch;
  padding: 1rem 1.15rem;
  margin: 1.25rem 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius-sm);
}

.callout > :first-child {
  margin-top: 0;
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout-green {
  background: var(--green-050);
  border-color: #cfe6d6;
  border-left-color: var(--green-700);
}

.callout-warn {
  background: var(--brown-050);
  border-color: #d7e5f6;
  border-left-color: var(--blue);
}

/* -------------------------------------------------------------- link list */
.rulelist {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

.rulelist li {
  padding: 0.5rem 0;
  border-top: 1px solid var(--hairline);
  line-height: 1.55;
}

.rulelist li:first-child {
  border-top: 0;
  padding-top: 0;
}

.rulelist li:last-child {
  padding-bottom: 0;
}

.rulelist a {
  font-weight: 600;
  text-decoration: none;
}

.rulelist a:hover {
  text-decoration: underline;
}

/* --------------------------------------------------------------- city roll */
.cityroll {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  columns: 1;
  column-gap: 2rem;
}

.cityroll li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 0.9375rem;
  break-inside: avoid;
}

.cityroll a {
  color: var(--green-800);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.cityroll a:hover {
  text-decoration: underline;
}

.citypop {
  color: var(--muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ------------------------------------------------------------------- tool */
.tool {
  padding: 1.25rem;
}

.tool-form {
  display: grid;
  gap: 1rem;
  margin: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  color: var(--navy);
  font-size: 0.9375rem;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
}

.field input:hover,
.field select:hover {
  border-color: #b9c9dd;
}

.field input:focus,
.field select:focus {
  border-color: var(--green-700);
}

.field input::placeholder {
  color: var(--muted);
}

.tool-form .btn {
  justify-self: start;
}

.tool-result {
  margin-top: 1.25rem;
  padding: 1.1rem 1.2rem;
  background: var(--green-050);
  border: 1px solid #cfe6d6;
  border-radius: var(--radius-sm);
}

.tool-primary {
  margin: 0 0 0.35rem;
  color: var(--green-900);
  font-size: clamp(1.5rem, 1.15rem + 1.6vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.tool-result .data-table {
  margin-top: 0.6rem;
}

.tool-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.55;
}

.tool-result .tool-note + .tool-primary {
  margin-top: 0.5rem;
}

/* ----------------------------------------------------------------- footer */
.site-footer {
  margin-top: 3rem;
  background: var(--navy);
  color: #e8eef7;
}

.footer-top {
  display: grid;
  gap: 1.75rem;
  padding-block: 2.25rem 1.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.footer-lockup {
  display: block;
  width: 180px;
  height: auto;
  margin: 0 0 0.9rem;
}

.footer-note {
  max-width: 42ch;
  margin: 0;
  color: #b9c9dd;
  font-size: 0.875rem;
  line-height: 1.6;
}

.footer-callout {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  padding: 1.1rem;
}

.footer-callout-head {
  margin: 0 0 0.3rem;
  color: #fff;
  font-size: 1.0625rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.footer-callout-note {
  margin: 0;
  color: #b9c9dd;
  font-size: 0.875rem;
  line-height: 1.55;
}

.footer-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: 0.85rem 0 0.8rem;
}

.footer-cta-link {
  color: #dfe8f5;
  font-size: 0.9375rem;
  font-weight: 600;
  text-underline-offset: 2px;
}

.footer-cta-link:hover {
  color: #fff;
}

.footer-disclosure {
  margin: 0;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  color: #a9bbd4;
  font-size: 0.75rem;
  line-height: 1.55;
}

.footer-disclosure a {
  color: #dfe8f5;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.15rem;
  padding-block: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.875rem;
}

.footer-nav a {
  color: #dfe8f5;
  text-decoration: none;
}

.footer-nav a:hover {
  color: #fff;
  text-decoration: underline;
}

.footer-legal {
  padding-block: 1.1rem 2rem;
  color: #a9bbd4;
  font-size: 0.8125rem;
  line-height: 1.65;
}

.footer-legal p {
  max-width: 92ch;
  margin: 0 0 0.6rem;
}

.footer-legal p:last-child {
  margin-bottom: 0;
}

.footer-legal a {
  color: #dfe8f5;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* -------------------------------------------------------- small screens */
@media (max-width: 639px) {
  /* Sourced tables scroll inside their panel instead of widening the page. */
  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

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

  /* Guide/article tables have no .data-table class: same treatment. */
  .prose table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Key/value calculator results must wrap, not scroll */
  .tool-result .data-table {
    display: table;
    overflow: visible;
    white-space: normal;
  }

  .tool-result .data-table th,
  .tool-result .data-table td {
    white-space: normal;
  }

  .tool-result .data-table th {
    width: 55%;
    font-weight: 600;
  }
}

/* ------------------------------------------------------------ breakpoints */
@media (min-width: 640px) {
  .wrap {
    padding-inline: 1.5rem;
  }

  main#main {
    padding-block: 1.75rem 4rem;
  }

  .panel,
  .card,
  .band {
    padding: 1.4rem 1.5rem;
  }

  .facts,
  .facts4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .facts > *,
  .facts4 > * {
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .facts > :nth-child(odd),
  .facts4 > :nth-child(odd) {
    border-left: 0;
  }

  .facts > :nth-child(n + 3),
  .facts4 > :nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .steps > * {
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .steps > :first-child {
    border-left: 0;
  }

  .toolgrid,
  .toolgrid-2,
  .toolgrid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolgrid > *,
  .toolgrid-2 > *,
  .toolgrid-3 > * {
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .toolgrid > :nth-child(odd),
  .toolgrid-2 > :nth-child(odd),
  .toolgrid-3 > :nth-child(odd) {
    border-left: 0;
  }

  .toolgrid > :nth-child(n + 3),
  .toolgrid-2 > :nth-child(n + 3),
  .toolgrid-3 > :nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .cityroll {
    columns: 2;
  }

  .tool-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tool-form .btn {
    grid-column: 1 / -1;
  }

  .footer-top {
    grid-template-columns: 1.15fr 1fr;
  }
}

@media (min-width: 820px) {
  .mainnav {
    order: 1;
    flex: 0 1 auto;
    margin: 0 0 0 auto;
    padding: 0;
    overflow: visible;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }
}

@media (min-width: 900px) {
  .toolgrid,
  .toolgrid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .toolgrid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolgrid > *,
  .toolgrid-2 > *,
  .toolgrid-3 > * {
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .toolgrid > :nth-child(3n + 1),
  .toolgrid-3 > :nth-child(3n + 1) {
    border-left: 0;
  }

  .toolgrid-2 > :nth-child(odd) {
    border-left: 0;
  }

  .toolgrid > :nth-child(n + 4),
  .toolgrid-3 > :nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }

  .toolgrid-2 > :nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .facts4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .facts > *,
  .facts4 > * {
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .facts > :nth-child(3n + 1) {
    border-left: 0;
  }

  .facts4 > :nth-child(4n + 1) {
    border-left: 0;
  }

  .facts > :nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }

  .facts4 > :nth-child(n + 5) {
    border-top: 1px solid var(--line);
  }

  .cityroll {
    columns: 3;
  }

  .tool-form {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* Two-column shell with a sticky aside */
  .page-grid {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 2rem;
  }

  .page-aside {
    position: sticky;
    top: calc(var(--header-h) + 1rem);
    align-self: start;
    max-height: calc(100vh - var(--header-h) - 2rem);
    overflow-y: auto;
  }
}

/* --------------------------------------------------------- reduced motion */
@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;
    scroll-behavior: auto !important;
  }
}
