/* ==========================================================================
   LeaseKit — "Statutory Ledger"
   An editorial-technical system for financial reporting tools. Warm paper,
   deep ink, hairline rules, tabular figures. Built to look like something an
   auditor would accept, because that is the whole job.
   ========================================================================== */

/* --- Tokens --------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  --paper: #faf7f0;
  --paper-2: #f3efe4;
  --paper-3: #ebe5d6;
  --ink: #17170f;
  --ink-2: #4a4a3e;
  --ink-3: #7a7768;
  --rule: #ddd6c4;
  --rule-strong: #c3b9a1;
  --accent: #0b4f4a;
  --accent-2: #0e6e66;
  --accent-ink: #faf7f0;
  --flag: #a8412a;
  --ok: #2f6b3a;
  --shadow: 14px 14px 0 -4px rgb(23 23 15 / 0.06);

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Archivo", "Helvetica Neue", Helvetica, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --measure: 34rem;
  --page: 74rem;
  --gap: clamp(1.25rem, 3vw, 2.5rem);
  --radius: 3px;
}

/* Dark theme is declared twice on purpose: once behind the media query for
   visitors who have never touched the toggle, and once on [data-theme] so an
   explicit choice beats the system preference in both directions. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12130f;
    --paper-2: #1b1c16;
    --paper-3: #23241c;
    --ink: #ede8dc;
    --ink-2: #b5b0a0;
    --ink-3: #857f6e;
    --rule: #2d2f26;
    --rule-strong: #454838;
    --accent: #6fc9b7;
    --accent-2: #8fdccb;
    --accent-ink: #0b1310;
    --flag: #e28a6b;
    --ok: #7fbe8c;
    --shadow: 14px 14px 0 -4px rgb(0 0 0 / 0.35);
  }
}

:root[data-theme="dark"] {
  --paper: #12130f;
  --paper-2: #1b1c16;
  --paper-3: #23241c;
  --ink: #ede8dc;
  --ink-2: #b5b0a0;
  --ink-3: #857f6e;
  --rule: #2d2f26;
  --rule-strong: #454838;
  --accent: #6fc9b7;
  --accent-2: #8fdccb;
  --accent-ink: #0b1310;
  --flag: #e28a6b;
  --ok: #7fbe8c;
  --shadow: 14px 14px 0 -4px rgb(0 0 0 / 0.35);
}

/* --- Reset ---------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
  line-height: 1.65;
  font-feature-settings: "kern" 1;
  overflow-x: hidden;
}

/* Paper grain. Cheap, static, and it does more for the "printed document"
   feeling than any amount of border-radius. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body::before { opacity: 0.055; }
}
:root[data-theme="dark"] body::before { opacity: 0.055; }

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

/* --- Typography ----------------------------------------------------------- */

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.25rem, 1.5rem + 3.4vw, 4rem); }
h2 { font-size: clamp(1.6rem, 1.25rem + 1.4vw, 2.35rem); margin-top: 2.5em; }
h3 { font-size: clamp(1.15rem, 1.05rem + 0.5vw, 1.45rem); margin-top: 2em; }
h4 { font-family: var(--sans); font-size: 1rem; font-weight: 600; margin-top: 1.75em; }

p { margin: 0 0 1.15em; }
p, li { max-width: var(--measure); }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { color: var(--flag); }

strong { font-weight: 600; }

code, .mono, .num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.92em;
}

/* Small-caps label — the workhorse of the whole system. */
.label {
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.lede {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 1.05rem + 0.6vw, 1.5rem);
  line-height: 1.45;
  color: var(--ink-2);
  max-width: 40rem;
}

/* Docket line: mimics a standard's reference header. */
.docket {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: baseline;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2rem;
}

/* --- Layout --------------------------------------------------------------- */

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

@media (max-width: 30rem) {
  .wrap { width: calc(100% - 1.75rem); }
}

.stack > * + * { margin-top: var(--gap); }

section { scroll-margin-top: 5rem; }

/* Editorial two-column: prose in the measure, notes in the margin. */
.editorial {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) minmax(0, 15rem);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
}

@media (max-width: 60rem) {
  .editorial { grid-template-columns: minmax(0, 1fr); }
}

/* Marginal note, hung beside the prose like a standard's commentary. */
.note {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--ink-2);
  border-left: 2px solid var(--accent);
  padding: 0.1rem 0 0.1rem 1rem;
  max-width: none;
}
.note p { max-width: none; }
.note p:last-child { margin-bottom: 0; }
.note .label { display: block; margin-bottom: 0.35rem; }

/* --- Header --------------------------------------------------------------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px) saturate(1.1);
  border-bottom: 1px solid var(--rule);
}

.site-head__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 3.75rem;
}

.brand {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand span { color: var(--accent); }

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.6rem);
}

.site-nav a {
  font-size: 0.875rem;
  color: var(--ink-2);
  text-decoration: none;
}
.site-nav a:hover { color: var(--accent); text-decoration: underline; }

@media (max-width: 46rem) {
  .site-nav .hide-sm { display: none; }
}

.theme-toggle {
  appearance: none;
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  color: var(--ink-2);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.3rem 0.55rem;
  line-height: 1;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* --- Hero ----------------------------------------------------------------- */

.hero {
  padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(1.5rem, 3vw, 2.5rem);
  position: relative;
}

/* Ledger rules bleeding off the right edge — decorative, cheap, on-theme. */
.hero::after {
  content: "";
  position: absolute;
  top: 0;
  right: -10vw;
  width: 40vw;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 1.7rem,
    var(--rule) 1.7rem 1.75rem
  );
  mask-image: linear-gradient(to left, black, transparent 78%);
  -webkit-mask-image: linear-gradient(to left, black, transparent 78%);
  opacity: 0.7;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}
.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: var(--accent);
}

/* --- Panels --------------------------------------------------------------- */

.panel {
  background: var(--paper-2);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2rem);
}

.panel--raised { box-shadow: var(--shadow); }

.panel__head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 0.85rem;
  margin-bottom: 1.4rem;
  border-bottom: 1px solid var(--rule-strong);
}
.panel__head h2,
.panel__head h3 { margin: 0; }

/* --- Calculator form ------------------------------------------------------ */

.calc {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  gap: clamp(1.5rem, 3.5vw, 3rem);
  align-items: start;
}

@media (max-width: 62rem) {
  .calc { grid-template-columns: minmax(0, 1fr); }
}

.field-grid {
  display: grid;
  gap: 1rem 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
}

.field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.field--wide { grid-column: 1 / -1; }

.field > label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-2);
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.field .hint {
  font-size: 0.75rem;
  color: var(--ink-3);
  line-height: 1.4;
  max-width: none;
}

.input-wrap { position: relative; display: flex; align-items: stretch; }

.input-wrap__affix {
  display: grid;
  place-items: center;
  padding-inline: 0.6rem;
  background: var(--paper-3);
  border: 1px solid var(--rule-strong);
  border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-3);
}
.input-wrap__affix + input { border-radius: 0 var(--radius) var(--radius) 0; }

.input-wrap__suffix {
  order: 2;
  border-left: 0;
  border-right: 1px solid var(--rule-strong);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.input-wrap:has(.input-wrap__suffix) input { border-radius: var(--radius) 0 0 var(--radius); }

input[type="text"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 0.5rem 0.65rem;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

select { font-family: var(--sans); }

input:hover, select:hover { border-color: var(--ink-3); }

input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

/* Kill the spinners — they are useless for money and they steal clicks. */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

input[aria-invalid="true"] { border-color: var(--flag); }

.field-error {
  font-size: 0.75rem;
  color: var(--flag);
  font-weight: 500;
  max-width: none;
}
.field-error:empty { display: none; }

fieldset {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 0.5rem 0 0;
  padding: 1.25rem 0 0;
}
fieldset > legend {
  padding: 0 0.6rem 0 0;
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

details.advanced { margin-top: 0.5rem; }
details.advanced > summary {
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
  padding: 0.35rem 0;
  list-style: none;
}
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before {
  content: "+ ";
  font-family: var(--mono);
}
details.advanced[open] > summary::before { content: "− "; }
details.advanced > .field-grid { margin-top: 0.85rem; }

/* --- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.6rem 1.1rem;
  background: var(--accent);
  color: var(--accent-ink);
  transition: transform 100ms ease, background 140ms ease, color 140ms ease;
}
.btn:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--accent-ink); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--ghost { background: transparent; color: var(--accent); }
.btn--ghost:hover { background: var(--accent); color: var(--accent-ink); }

.btn--quiet {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--rule-strong);
  font-weight: 500;
}
.btn--quiet:hover { background: var(--paper-3); color: var(--ink); border-color: var(--ink-3); }

.btn--lg { padding: 0.8rem 1.5rem; font-size: 0.9375rem; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center; }

/* --- Key figures ---------------------------------------------------------- */

.figures {
  display: grid;
  /* Each cell carries its own border rather than letting a background show
     through 1px gaps. A partly-filled last row then leaves page background,
     not an orphaned block of rule colour. */
  gap: 0.6rem;
  /* 13rem minimum: a seven-figure sum in tabular mono needs roughly 11rem of
     inner width, and clipping a number is the one thing this page cannot do. */
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.figure {
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 0.95rem 1.1rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

/* Reserve two lines for every label so a wrapped one ("Right-of-use asset")
   does not push its value out of line with its neighbours. */
.figure .label {
  line-height: 1.3;
  min-height: 2.6em;
}

.figure__value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.1rem, 1rem + 0.55vw, 1.4rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.15;
  color: var(--ink);
  /* Very large figures shrink rather than spill out of the cell. */
  overflow-wrap: anywhere;
}
.figure--headline .figure__value { color: var(--accent); }
.figure--flag .figure__value { color: var(--flag); }

.figure__sub {
  font-size: 0.75rem;
  color: var(--ink-3);
  line-height: 1.4;
  max-width: none;
}

/* --- Tables --------------------------------------------------------------- */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--paper);
  max-height: 30rem;
  overflow-y: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--paper-3);
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-align: right;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--rule-strong);
  white-space: nowrap;
}
thead th:first-child { text-align: left; }

tbody td {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding: 0.42rem 0.7rem;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
  color: var(--ink);
}
tbody td:first-child { text-align: left; color: var(--ink-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--paper-2); }

tfoot td {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding: 0.55rem 0.7rem;
  border-top: 1px solid var(--rule-strong);
  font-weight: 600;
  background: var(--paper-3);
  white-space: nowrap;
}
tfoot td:first-child { text-align: left; font-family: var(--sans); }

.neg { color: var(--flag); }

/* --- Journal -------------------------------------------------------------- */

.journal { border: 1px solid var(--rule-strong); border-radius: var(--radius); overflow: hidden; }
.journal table { font-size: 0.8125rem; }
.journal .dr { padding-left: 0.7rem; }
.journal .cr td:first-child { padding-left: 2.2rem; }
.journal .cr td:first-child::before { content: "› "; color: var(--ink-3); }

.balanced-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ok);
}
.balanced-badge::before { content: "✓"; }
.balanced-badge[data-balanced="false"] { color: var(--flag); }
.balanced-badge[data-balanced="false"]::before { content: "✕"; }

/* --- Callouts ------------------------------------------------------------- */

.callout {
  border-left: 3px solid var(--accent);
  background: var(--paper-2);
  padding: 1rem 1.2rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.callout p:last-child { margin-bottom: 0; }
.callout p { max-width: none; }
.callout--flag { border-left-color: var(--flag); }

/* --- Conversion card ------------------------------------------------------ */

.cta {
  position: relative;
  overflow: hidden;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 4vw, 2.75rem);
}
.cta::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 1.7rem,
    color-mix(in oklab, var(--accent-ink) 14%, transparent) 1.7rem 1.75rem
  );
  mask-image: linear-gradient(to left, black, transparent 65%);
  -webkit-mask-image: linear-gradient(to left, black, transparent 65%);
}
.cta > * { position: relative; z-index: 1; }
.cta h2, .cta h3 { color: var(--accent-ink); margin-top: 0; }
.cta p { color: color-mix(in oklab, var(--accent-ink) 84%, transparent); }
.cta .label { color: color-mix(in oklab, var(--accent-ink) 70%, transparent); }
.cta .btn {
  background: var(--accent-ink);
  color: var(--accent);
  border-color: var(--accent-ink);
}
.cta .btn:hover { background: var(--paper); color: var(--accent); border-color: var(--paper); }
.cta .btn--ghost {
  background: transparent;
  color: var(--accent-ink);
  border-color: color-mix(in oklab, var(--accent-ink) 45%, transparent);
}
.cta .btn--ghost:hover { background: var(--accent-ink); color: var(--accent); }

/* --- Tool index cards ---------------------------------------------------- */

.tool-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
}

.tool-card {
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem 1.6rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: background 140ms ease, border-color 140ms ease;
}
.tool-card:hover { background: var(--paper-2); border-color: var(--accent); color: inherit; }
.tool-card h3 {
  margin: 0;
  font-size: 1.15rem;
  transition: color 140ms ease;
}
.tool-card:hover h3 { color: var(--accent); }
.tool-card p { margin: 0; font-size: 0.875rem; color: var(--ink-2); max-width: none; }
.tool-card__go {
  margin-top: auto;
  padding-top: 0.75rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent);
}
.tool-card__go::after { content: " →"; }

/* --- FAQ ------------------------------------------------------------------ */

.faq { border-top: 1px solid var(--rule); }
.faq details {
  border-bottom: 1px solid var(--rule);
  padding: 0.25rem 0;
}
.faq summary {
  cursor: pointer;
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 500;
  padding: 0.85rem 2rem 0.85rem 0;
  position: relative;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 0.2rem;
  top: 0.8rem;
  font-family: var(--mono);
  color: var(--accent);
}
.faq details[open] summary::after { content: "−"; }
.faq details > *:not(summary) { padding-bottom: 0.5rem; }
.faq details p { color: var(--ink-2); }

/* --- Footer --------------------------------------------------------------- */

.site-foot {
  margin-top: clamp(3rem, 8vw, 6rem);
  border-top: 1px solid var(--rule);
  padding: 2.5rem 0 3.5rem;
  font-size: 0.875rem;
  color: var(--ink-2);
}
.site-foot__grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}
.site-foot a { color: var(--ink-2); }
.site-foot a:hover { color: var(--accent); }
.site-foot ul { list-style: none; padding: 0; margin: 0.6rem 0 0; }
.site-foot li { margin-bottom: 0.35rem; max-width: none; }
.site-foot__legal {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.8125rem;
  color: var(--ink-3);
}
.site-foot__legal p { max-width: 52rem; }

/* --- Utilities ------------------------------------------------------------ */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: top 120ms ease;
}
.skip-link:focus { top: 0.5rem; color: var(--accent-ink); }

.rule { border: 0; border-top: 1px solid var(--rule); margin: var(--gap) 0; }
[hidden] { display: none !important; }
.text-center { text-align: center; }

/* --- Motion --------------------------------------------------------------- */

.reveal { animation: rise 620ms cubic-bezier(0.2, 0.7, 0.25, 1) backwards; }
.reveal:nth-child(1) { animation-delay: 40ms; }
.reveal:nth-child(2) { animation-delay: 120ms; }
.reveal:nth-child(3) { animation-delay: 200ms; }
.reveal:nth-child(4) { animation-delay: 280ms; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

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

/* --- Print ---------------------------------------------------------------- */
/* Accountants file their workings. A schedule that prints badly is a schedule
   that does not get used, so this is a feature, not a nicety. */

@media print {
  :root {
    --paper: #fff; --paper-2: #fff; --paper-3: #f2f2f2;
    --ink: #000; --ink-2: #333; --ink-3: #555;
    --rule: #bbb; --rule-strong: #888; --accent: #000; --shadow: none;
  }
  body { font-size: 10pt; }
  body::before,
  .site-head, .site-foot, .cta, .btn, .theme-toggle, .hero::after,
  .faq, form, .note { display: none !important; }
  .panel { border: 1px solid #888; box-shadow: none; break-inside: avoid; }
  .table-scroll { max-height: none; overflow: visible; border: 1px solid #888; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
  a[href]::after { content: ""; }
  .print-only { display: block !important; }
}

.print-only { display: none; }

/* --- Email my results ------------------------------------------------------ */

.email-results {
  margin-top: 2rem;
  padding: 1.25rem 1.5rem 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-2);
}
.email-results h3 { margin: 0 0 0.35rem; }
.email-results__hint { margin: 0 0 0.85rem; color: var(--ink-2); font-size: 0.925rem; }
.email-results__form { display: flex; flex-direction: column; gap: 0.85rem; }
.email-results__row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.email-results__form input[type="email"] {
  flex: 1 1 16rem;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
/* Consent is an explicit choice rather than a default, so it is given its own
   panel instead of sitting under the button as a single easily-missed tick. */
.email-results__consent {
  margin: 0;
  padding: 0.8rem 1rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
}
.email-results__consent legend {
  padding: 0 0.4rem;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 600;
}
.email-results__consent-lead { margin: 0 0 0.5rem; color: var(--ink-2); font-size: 0.85rem; }
.email-results__benefits {
  margin: 0 0 0.8rem;
  padding-left: 1.15rem;
  color: var(--ink-2);
  font-size: 0.85rem;
  line-height: 1.5;
}
.email-results__benefits li { margin: 0.15rem 0; }
.email-results__choices { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.email-results__choices label {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  color: var(--ink-2);
  font-size: 0.875rem;
  cursor: pointer;
}
.email-results__consent[data-invalid="true"] { border-color: var(--accent-2); }
.email-results__status { margin: 0.6rem 0 0; font-size: 0.9rem; color: var(--accent-2); min-height: 1.2em; }
.email-results__small { margin: 0.5rem 0 0; font-size: 0.78rem; color: var(--ink-3); }
.email-results__small a { color: inherit; }

/* Post-send continuation. Revealed by initEmailResults only after a successful
   send, so it never competes with the form itself for attention. `hidden` is
   set on the element in markup; the attribute selector keeps it hidden even
   though the rule below sets `display`. */
.email-results__next {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.email-results__next[hidden] { display: none; }
.email-results__next p { margin: 0 0 0.75rem; color: var(--ink-2); font-size: 0.925rem; }

@media print { .email-results { display: none; } }
