:root {
  color-scheme: light dark;
  --paper: #f2f6f0;
  --sheet: #fcfdfb;
  --ink: #14213d;
  --ink-soft: #4a5873;
  --green: #1f6f54;
  --green-ink: #ffffff;
  --red: #b3261e;
  --rule: #c5d6ca;
  --margin: #e6a9a4;
  --edge: #d3e0d6;
  --gold: #c9a84c;
  --band: #1a2e4a;
  --band-ink: #f3f5f8;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1726;
    --sheet: #152238;
    --ink: #e9eef3;
    --ink-soft: #a9b6c6;
    --green: #5cc49b;
    --green-ink: #08261b;
    --red: #ff9a91;
    --rule: #2c3e57;
    --margin: #6b3f46;
    --edge: #0a111d;
    --gold: #e8c46a;
    --band: #12233a;
    --band-ink: #e9eef3;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.65 var(--sans);
}

.wrap {
  max-width: 68rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

a { color: var(--green); text-underline-offset: 0.2em; }
a:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; border-radius: 2px; }

/* Header */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  padding-block: 1.25rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font: 600 1.3rem var(--serif);
  color: var(--ink);
  text-decoration: none;
}
.brand img { display: block; padding: 2px; border-radius: 0.35rem; background: var(--sheet); }
.bar nav { display: flex; gap: 0.5rem 1.75rem; }
.bar nav a { color: var(--ink-soft); text-decoration: none; }
.bar nav a:hover { color: var(--ink); text-decoration: underline; }
.bar nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; }

/* Type */
h1 {
  margin: 0 0 1.25rem;
  font: 600 clamp(2.25rem, 5vw, 3.25rem)/1.08 var(--serif);
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h2 { margin: 0 0 0.75rem; font: 600 1.75rem/1.2 var(--serif); }
h3 { margin: 1.5rem 0 0.25rem; font: 650 1.1rem/1.35 var(--sans); }
p { margin: 0 0 1rem; }
.lede { max-width: 34rem; margin-bottom: 1.5rem; font-size: 1.25rem; line-height: 1.55; color: var(--ink-soft); }
.prose { max-width: 38rem; }
.prose > :last-child { margin-bottom: 0; }

/* Hero */
.hero { display: grid; gap: 2.5rem; padding-block: clamp(1.5rem, 6vw, 4.5rem); }
@media (min-width: 56rem) {
  .hero { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center; gap: 4rem; }
}

/* Sections: a ruled line, then heading beside text */
.section { padding-block: clamp(2rem, 5vw, 3.25rem); border-top: 1px solid var(--rule); }
.split { display: grid; gap: 0.75rem 3rem; }
@media (min-width: 56rem) {
  .split { grid-template-columns: 14rem minmax(0, 1fr); }
}

/* Buttons and links */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; }
.button {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  border-radius: 0.25rem;
  background: var(--green);
  color: var(--green-ink);
  font-weight: 600;
  text-decoration: none;
}
.button:hover { filter: brightness(1.08); }
.button:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

/* Margin-line aside, like a note written beside the ruled lines */
.aside {
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 2px solid var(--margin);
}
.aside p:last-child { margin-bottom: 0; }

/* Product block on the home page */
.product { max-width: 38rem; padding-left: 1.25rem; border-left: 0.3rem solid var(--green); }
.product h3 { margin-top: 0; font: 600 1.5rem/1.2 var(--serif); }

/* What it keeps: a ruled list */
.keeps { max-width: 38rem; margin: 0; padding: 0; list-style: none; }
.keeps li { padding: 0.9rem 0; border-bottom: 1px solid var(--rule); }
.keeps li:first-child { padding-top: 0; }
.keeps strong { display: block; font: 600 1.15rem var(--serif); }
.keeps span { color: var(--ink-soft); }

/* The example ledger sheet */
.ledger {
  position: relative;
  margin: 0;
  padding: 1.25rem 1.25rem 1.25rem 3.25rem;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 2px;
  box-shadow: 0.5rem 0.5rem 0 var(--edge);
}
.ledger::before {
  content: "";
  position: absolute;
  inset-block: 0;
  left: 2.25rem;
  width: 2px;
  background: var(--margin);
}
.ledger figcaption { margin-bottom: 0.75rem; font: 600 1.05rem var(--serif); }
.ledger table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ledger th {
  padding: 0.4rem 0 0.4rem 0.75rem;
  border-bottom: 2px solid var(--ink);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: right;
}
.ledger td { padding: 0.55rem 0 0.55rem 0.75rem; border-bottom: 1px solid var(--rule); text-align: right; white-space: nowrap; }
.ledger th:first-child, .ledger td:first-child { padding-left: 0; text-align: left; }
.ledger td:first-child { white-space: normal; }
.ledger tfoot td { border-top: 2px solid var(--ink); border-bottom: 0; font-weight: 700; }
.ledger .owed { color: var(--red); }
.ledger dl { display: grid; grid-template-columns: 1fr auto; gap: 0.35rem 1rem; margin: 1rem 0 0; font-variant-numeric: tabular-nums; }
.ledger dt { color: var(--ink-soft); }
.ledger dd { margin: 0; font-weight: 600; text-align: right; }
.ledger .fine { margin: 1rem 0 0; font-size: 0.8rem; color: var(--ink-soft); }

@media (max-width: 30rem) {
  .ledger { padding-left: 2.5rem; }
  .ledger::before { left: 1.6rem; }
  .ledger td, .ledger th { font-size: 0.9rem; }
}

/* The rows write in once when the page loads */
@media (prefers-reduced-motion: no-preference) {
  @keyframes write-in { from { opacity: 0; transform: translateY(0.35rem); } }
  .ledger tbody tr { animation: write-in 0.5s ease both; }
  .ledger tbody tr:nth-child(2) { animation-delay: 0.12s; }
  .ledger tbody tr:nth-child(3) { animation-delay: 0.24s; }
  .ledger tbody tr:nth-child(4) { animation-delay: 0.36s; }
}

/* Privacy policy */
.doc { max-width: 42rem; padding-block: clamp(1rem, 4vw, 3rem) 3rem; }
.doc h2 { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.doc .updated { color: var(--ink-soft); }
.doc ul { padding-left: 1.25rem; }
.doc li { margin-bottom: 0.5rem; }

/* Footer */
.site-footer { margin-top: 2rem; padding-block: 2rem 3rem; border-top: 1px solid var(--rule); color: var(--ink-soft); font-size: 0.95rem; }
.site-footer p { margin: 0 0 0.35rem; }
.site-footer a { color: inherit; }

.fine-print { max-width: 34rem; margin: 1.25rem 0 0; font-size: 0.95rem; color: var(--ink-soft); }

/* Accents and motion */
a:hover { text-decoration-thickness: 2px; }

.hero h1::after {
  content: "";
  display: block;
  width: 3.5rem;
  height: 3px;
  margin-top: 1rem;
  background: var(--gold);
}

/* A short gold tab where each ruled section line starts */
.section { position: relative; }
.section::after {
  content: "";
  position: absolute;
  top: -2px;
  left: 0;
  width: 1.75rem;
  height: 3px;
  background: var(--gold);
}

/* The total gets an accountant's double underline */
.ledger .total {
  padding-bottom: 0.4rem;
  background:
    linear-gradient(var(--gold), var(--gold)) left bottom / 100% 2px no-repeat,
    linear-gradient(var(--gold), var(--gold)) left calc(100% - 5px) / 100% 2px no-repeat;
}

.button { transition: transform 0.15s ease, box-shadow 0.15s ease; }
.button:hover { transform: translate(-2px, -2px); box-shadow: 0.25rem 0.25rem 0 var(--gold); filter: none; }
.button:active { transform: none; box-shadow: none; }

.keeps li { transition: padding-left 0.2s ease, box-shadow 0.2s ease; }
.keeps li:hover { padding-left: 0.75rem; box-shadow: inset 0.25rem 0 0 var(--gold); }

@media (prefers-reduced-motion: no-preference) {
  /* The sheet lifts off the page, its rows are written in, then the total is underlined */
  .ledger { animation: lift 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
  @keyframes lift { from { box-shadow: 0 0 0 var(--edge); } }

  .ledger .total { animation: underline 0.7s ease 0.9s both; }
  @keyframes underline {
    from { background-size: 0 2px, 0 2px; }
    to { background-size: 100% 2px, 100% 2px; }
  }

  .hero h1::after { animation: draw-tab 0.6s ease 0.2s both; }
  @keyframes draw-tab { from { width: 0; } }

  /* The torch flickers when you point at the brand */
  .brand:hover img { animation: flicker 0.7s ease-in-out; }
  @keyframes flicker {
    0%, 100% { transform: scale(1) rotate(0); }
    25% { transform: scale(1.1) rotate(-4deg); }
    60% { transform: scale(1.05) rotate(3deg); }
  }

  /* Ruled section lines are drawn as they scroll into view, where the browser supports it */
  @supports (animation-timeline: view()) {
    .section { border-top-color: transparent; }
    .section::before {
      content: "";
      position: absolute;
      top: -1px;
      left: 0;
      right: 0;
      height: 1px;
      background: var(--rule);
      transform-origin: left;
      animation: draw-rule linear both;
      animation-timeline: view();
      /* noinspection CssInvalidPropertyValue: valid CSS, the IDE's grammar predates timeline range names */
      animation-range: entry 0% entry 70%;
    }
    @keyframes draw-rule { from { transform: scaleX(0); } }
  }
}

/* Home page hero art: the torch, lit once on load */
.torch { justify-self: center; width: clamp(7rem, 22vw, 12rem); }
.torch svg { display: block; width: 100%; height: auto; overflow: visible; }
/* The navy parts of the holder need a light backing in dark mode */
@media (prefers-color-scheme: dark) {
  .torch { padding: 1.25rem; border-radius: 50%; background: var(--sheet); width: clamp(9rem, 26vw, 14.5rem); }
}
@media (prefers-reduced-motion: no-preference) {
  .torch .flame { transform-origin: 16px 22px; animation: ignite 1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.3s both; }
  @keyframes ignite { from { transform: scale(0.15); opacity: 0; } 60% { opacity: 1; } }
}

/* Front page */
/* A warm light, as if from the torch, sits in the corner of the page so the frosted header has something to blur */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(60rem 38rem at 88% -8%, color-mix(in srgb, var(--gold) 22%, transparent), transparent 70%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 55%, transparent);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .topbar { background: var(--paper); }
}

/* On a phone the two-row header would cover too much of the screen, so it scrolls away */
@media (max-width: 40rem) { .topbar { position: static; } }

.torch-stage { position: relative; justify-self: center; display: grid; place-items: center; padding: 2.5rem; }
.torch-stage::before {
  content: "";
  position: absolute;
  inset: -20%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--gold) 50%, transparent), transparent);
  opacity: 0.75;
}
.torch-stage .torch { position: relative; }

.ember {
  position: absolute;
  top: 24%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0;
}
.e1 { margin-left: -14px; --dx: -1.2rem; --t: 5.5s; --d: 0s; }
.e2 { margin-left: 4px; --dx: 0.9rem; --t: 6.5s; --d: 1.1s; width: 4px; height: 4px; }
.e3 { margin-left: 16px; --dx: 1.8rem; --t: 5s; --d: 2.4s; }
.e4 { margin-left: -6px; --dx: -0.6rem; --t: 7s; --d: 3.2s; width: 3px; height: 3px; }
.e5 { margin-left: 10px; --dx: 0.4rem; --t: 6s; --d: 4.1s; width: 4px; height: 4px; }
.e6 { margin-left: -20px; --dx: -2rem; --t: 6.8s; --d: 5s; width: 3px; height: 3px; }

/* The product band */
.band { margin-top: clamp(2rem, 6vw, 4rem); padding-block: clamp(2.5rem, 7vw, 4.5rem); background: var(--band); color: var(--band-ink); border-top: 3px solid var(--gold); }
.band-inner > :last-child { margin-bottom: 0; }
.band h2 { max-width: 42rem; margin-bottom: 0.75rem; font-size: clamp(1.75rem, 4vw, 2.5rem); }
.band p { max-width: 36rem; margin-bottom: 1.5rem; color: color-mix(in srgb, var(--band-ink) 82%, transparent); }
.band .button { background: var(--gold); color: #1a2e4a; }
.band .button:hover { box-shadow: 0.25rem 0.25rem 0 color-mix(in srgb, var(--band-ink) 40%, transparent); }
.band .button:focus-visible { outline-color: var(--band-ink); }

@media (prefers-reduced-motion: no-preference) {
  .torch-stage::before { animation: glow 6s ease-in-out infinite alternate; }
  @keyframes glow { from { opacity: 0.55; transform: scale(0.96); } to { opacity: 0.85; transform: scale(1.05); } }

  .ember { animation: rise var(--t) ease-out var(--d) infinite; }
  @keyframes rise {
    0% { transform: translate(0, 0); opacity: 0; }
    12% { opacity: 0.9; }
    100% { transform: translate(var(--dx), -7rem); opacity: 0; }
  }
}

/* TORCH THEME (navy and gold, from the favicon). Delete everything from this comment down to go back to ledger green. */
:root {
  --paper: #f3f5f8;
  --sheet: #fdfdfe;
  --ink: #14213d;
  --ink-soft: #4a5873;
  --green: #1a2e4a;
  --green-ink: #ffffff;
  --rule: #cfd6e0;
  --margin: #c9a84c;
  --edge: #dde3ec;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b1626;
    --sheet: #12233a;
    --ink: #e9eef3;
    --ink-soft: #a9b6c6;
    --green: #e8c46a;
    --green-ink: #1a2e4a;
    --rule: #25364f;
    --margin: #8a7436;
    --edge: #070f1b;
  }
}
a { text-decoration-color: #c9a84c; }
.product { border-left-color: #c9a84c; }
/* END TORCH THEME */
