/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 5.5rem; scrollbar-color: #17191c #f7f8f6; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
a, button, summary { touch-action: manipulation; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; line-height: 1.5; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
h1, h2, h3, p { margin: 0; font-size: inherit; font-weight: inherit; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: inherit; }
input { margin: 0; font: inherit; color: inherit; }
svg { display: block; }
summary { display: list-item; }

@font-face {
  font-family: 'Geist';
  src: url('fonts/GeistVF.woff') format('woff');
  font-weight: 100 900;
  font-display: swap;
}

/* Martian Mono, latin subset. At its condensed width (75%) each character is
   0.6em wide, the same as the Geist Mono it replaced, so no line breaks moved. */
@font-face {
  font-family: 'Martian Mono';
  src: url('fonts/MartianMonoVF.woff2') format('woff2');
  font-weight: 100 800;
  font-stretch: 75% 112.5%;
  font-display: swap;
}

.page {
  --font-geist-sans: 'Geist';
  --font-mono: 'Martian Mono';
  font-stretch: 75%;
}

/* RecurShield marketing page: one receipt, printed from DECLINED to PAID. */

.page {
  --paper: #f7f8f6;
  --ink: #17191c;
  --ink-soft: #4a4e55;
  --rule: #8d9197;
  --sheet: #ffffff;
  --declined: #c9361f;
  --chasing: #dfa416;
  --paid: #128a4b;
  --paid-ink: #0c7038;
  --slot-text: #dcdeda;
  --slot-edge: #0a0b0d;
  --light-off: #3b3e44;
  --light-declined: #ff5b3d;
  --light-chasing: #ffc531;
  --light-paid: #35d982;
  --pad: clamp(1.25rem, 6vw, 4.5rem);
  --mono: var(--font-mono), ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --sans: var(--font-geist-sans), system-ui, sans-serif;
  --out: cubic-bezier(0.16, 1, 0.3, 1);

  min-height: 100vh;
  background-color: var(--declined);
  color: var(--ink);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* The legal pages have no counter layers; their counter is a plain fill. */
.page:not([data-counter-root])[data-state='chasing'] {
  background-color: var(--chasing);
}

.page:not([data-counter-root])[data-state='paid'] {
  background-color: var(--paid);
}

/* The counter on the home page. The page's own fill stays Declined (the
   colour with no script); Chasing and Paid are two fixed layers stacked over
   it, under the paper, and the state cross-fades them with opacity, so a
   change of state repaints nothing. A layer is lit when the state is at or
   past it, which makes every step a plain mix of two adjacent colours. */
.page[data-counter-root] {
  isolation: isolate;
}

.page[data-counter-root]::before,
.page[data-counter-root]::after {
  content: '';
  position: fixed;
  z-index: -1;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease;
}

.page[data-counter-root]::before {
  background-color: var(--chasing);
}

.page[data-counter-root]::after {
  background-color: var(--paid);
}

.page[data-counter-root]:is([data-state='chasing'], [data-state='paid'])::before,
.page[data-counter-root][data-state='paid']::after {
  opacity: 1;
  transition: opacity 700ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .page[data-counter-root]::before,
  .page[data-counter-root]::after,
  .page[data-counter-root]:is([data-state='chasing'], [data-state='paid'])::before,
  .page[data-counter-root][data-state='paid']::after {
    transition: opacity 300ms linear;
  }
}

.page ::selection {
  background: var(--ink);
  color: var(--paper);
}

.page :focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

:where(.page) :is(h1, h2, h3, p) {
  color: inherit;
  margin: 0;
}

/* The printer slot */

.slot {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
  padding: 0.75rem clamp(1rem, 4vw, 3.5rem);
  background: var(--ink);
  border-bottom: 4px solid var(--slot-edge);
  box-shadow: 0 14px 22px -12px rgba(0, 0, 0, 0.55);
  color: var(--paper);
}

.slot :focus-visible {
  outline-color: var(--paper);
}

.brand {
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--paper);
  text-decoration: none;
}

.slotNav {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2.2vw, 2rem);
  font-size: 0.9375rem;
}

.slotLink {
  color: var(--slot-text);
  text-decoration: none;
  white-space: nowrap;
}

.slotBtn {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
  padding: 0.55rem 0.95rem;
  text-decoration: none;
  white-space: nowrap;
  border: 2px solid var(--paper);
  transition: background-color 150ms var(--out), color 150ms var(--out), transform 160ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .slotBtn:hover {
    background: transparent;
    color: var(--paper);
  }
}

/* Skip link: hidden until it takes keyboard focus, then shown over the brand
   in the slot button's colours. */
.skip {
  /* Fixed, so focusing it with Shift+Tab mid-page does not scroll to the top. */
  position: fixed;
  z-index: 30;
  top: 0.75rem;
  left: clamp(1rem, 4vw, 3.5rem);
  padding: 0.55rem 0.95rem;
  background: var(--paper);
  border: 2px solid var(--paper);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.skip:not(:focus) {
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
}

.page .skip:focus-visible {
  outline-color: var(--paper);
}

/* The paper */

.feed {
  width: min(940px, calc(100% - 2rem));
  margin: 0 auto;
  padding-bottom: clamp(3rem, 8vw, 6rem);
  position: relative;
  isolation: isolate;
}

.seg {
  background: var(--paper);
  padding: clamp(3rem, 7vw, 4.75rem) var(--pad) clamp(2.5rem, 6vw, 4rem);
}

.segFirst {
  padding-top: clamp(2rem, 4vw, 3rem);
}

.tear {
  position: relative;
  height: 22px;
  margin-block: -0.5px;
  background:
    radial-gradient(circle at 0 50%, transparent 10px, var(--paper) 10.5px) left / 50.1% 100% no-repeat,
    radial-gradient(circle at 100% 50%, transparent 10px, var(--paper) 10.5px) right / 50.1% 100% no-repeat;
}

.tear::after {
  content: '';
  position: absolute;
  left: 22px;
  right: 22px;
  top: calc(50% - 1px);
  border-top: 2px dashed var(--rule);
}

.zig {
  height: 16px;
  margin-top: -0.5px;
  background: var(--paper);
  -webkit-mask: conic-gradient(from -45deg at 50% 100%, #0000, #000 1deg 89deg, #0000 90deg) 50% / 22px 100% repeat-x;
  mask: conic-gradient(from -45deg at 50% 100%, #0000, #000 1deg 89deg, #0000 90deg) 50% / 22px 100% repeat-x;
}

/* Type */

.wordWrap {
  margin: 1.1rem calc(var(--pad) * -1) 0;
  padding-inline: clamp(0.4rem, 1.2vw, 0.9rem);
}

.word {
  display: block;
  width: 100%;
  height: auto;
  color: var(--ink);
}

.paidWord {
  display: block;
  width: 100%;
  height: auto;
  color: var(--paid);
}

.h1 {
  margin-top: 1.9rem;
  max-width: 31ch;
  font-size: clamp(1.7rem, 1.1rem + 2.1vw, 2.55rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.h2 {
  max-width: 26ch;
  font-size: clamp(1.45rem, 1.1rem + 1.5vw, 2.15rem);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lede {
  margin-top: 0.9rem;
  max-width: 48rem;
  font-family: var(--sans);
  font-size: 1.1875rem;
  line-height: 1.55;
}

.prose {
  margin-top: 0.9rem;
  max-width: 36rem;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
}

.note {
  margin-top: 1.25rem;
  max-width: 36rem;
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* The one grid: code, item, value */

.rows {
  margin: 1.6rem 0 0;
  padding: 0.35rem 0 0;
  list-style: none;
  border-top: 2px solid var(--ink);
}

.rowsBare {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.rowsNo {
  margin-top: 0.9rem;
}

.row {
  display: grid;
  grid-template-columns: 5.5rem fit-content(64%) minmax(1.5rem, 1fr) auto;
  column-gap: 0.9rem;
  align-items: baseline;
  padding: 0.72rem 0;
  font-size: 1.0625rem;
  line-height: 1.35;
}

.rowPlain {
  grid-template-columns: fit-content(80%) minmax(1.5rem, 1fr) auto;
}

.code {
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.item {
  text-wrap: balance;
}

.row > .item:last-child {
  grid-column: 2 / -1;
}

/* The dotted leader a receipt runs from the item to its amount */
.leader {
  align-self: baseline;
  height: 0;
  border-bottom: 2px dotted var(--rule);
  transform: translateY(-0.22em);
}

.val {
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.valText {
  max-width: 17rem;
  font-weight: 600;
  text-align: right;
}

.key .item,
.key .valText {
  font-weight: 700;
}

.rowBig {
  padding-block: 0.6rem;
  font-size: 1.25rem;
  font-weight: 700;
}

.rowBig .field {
  font-size: 1.5rem;
}

/* Double-size print for the line that matters */
.total {
  margin-top: 0.45rem;
  padding-block: 0.85rem;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  font-size: 1.5rem;
  font-weight: 700;
}
.paidRow .item,
.paidRow .val,
.paidRow .code {
  color: var(--paid-ink);
  font-weight: 700;
}

.void .item {
  color: inherit;
}

.void .val {
  color: var(--ink-soft);
  font-weight: 600;
}

/* Inputs on the receipt */

.field {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  background: var(--sheet);
  border: 2px solid var(--ink);
  font-weight: 700;
}

.field:focus-within {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.field input {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: right;
  caret-color: var(--declined);
}

.field input:focus-visible {
  outline: none;
}

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

/* Nine digits and two commas. */
.inputMoney {
  width: 11ch;
}

.inputPct {
  width: 4ch;
}

.fieldSm {
  display: inline-flex;
  align-items: baseline;
  gap: 0.15rem;
  margin-inline: 0.1rem;
  padding: 0.05rem 0.45rem;
  background: var(--sheet);
  border: 2px solid var(--ink);
  font-weight: 700;
}

.fieldSm:focus-within {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.fieldSm input {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: right;
  caret-color: var(--declined);
}

.fieldSm input:focus-visible {
  outline: none;
}

/* Actions */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.75rem;
  margin-top: 1.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1rem 1.4rem;
  background: var(--ink);
  border: 2px solid var(--ink);
  color: var(--paper);
  font-size: 1.0625rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 150ms var(--out), color 150ms var(--out), transform 160ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    background: var(--paper);
    color: var(--ink);
  }
}

.btn svg {
  width: 1.1rem;
  height: 1.1rem;
  flex: none;
}

.link {
  color: var(--ink);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.28em;
}

@media (hover: hover) and (pointer: fine) {
  .link:hover {
    text-decoration-thickness: 3px;
  }
}

/* Expanding rows: the emails and the questions */


.fold > summary {
  list-style: none;
  border-bottom: 0;
  cursor: pointer;
}

.fold > summary::-webkit-details-marker {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .fold > summary:hover .item {
    text-decoration: underline;
    text-underline-offset: 0.28em;
  }
}

/* Touch has no hover: a press underlines the row instead. */
summary:active .item {
  text-decoration: underline;
  text-underline-offset: 0.28em;
}

.chev {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  margin-left: 0.6rem;
  vertical-align: -0.05em;
  transition: transform 220ms var(--out);
}

.fold[open] .chev {
  transform: rotate(180deg);
}

.letter {
  max-width: 34rem;
  margin: 0.35rem 0 1.4rem 6.4rem;
  padding: 1.3rem 1.5rem 1.5rem;
  border: 2px dashed var(--rule);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
}

.letterMeta {
  padding-bottom: 0.8rem;
  margin-bottom: 1rem;
  border-bottom: 1px dotted var(--rule);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.letter p + p {
  margin-top: 0.75rem;
}

.letterBtn {
  display: inline-block;
  margin: 0.4rem 0;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
}

.answer {
  max-width: 36rem;
  margin: 0 0 1.2rem;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
}

/* Close */

.foot {
  display: grid;
  gap: 1.1rem;
  /* Keeps the one column at its content width rather than stretched. */
  justify-content: space-between;
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 2px solid var(--ink);
  font-size: 0.875rem;
}

/* Narrow screens */

@media (max-width: 720px) {
  /* A phone is the width of a real receipt. The code sits on its own line;
     rows without an amount keep their code beside the item. */
  .row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 0.6rem;
    row-gap: 0.2rem;
    font-size: 1rem;
  }

  .row > .code {
    flex: 0 0 2.6rem;
  }

  .row > .item {
    flex: 1 1 0;
    min-width: 0;
  }

  /* A row with an amount prints the item first, then its code, the leader
     and the amount together on the line below. */
  .row:has(> .leader) > .item {
    order: 1;
    flex: 0 0 100%;
  }

  .row:has(> .leader) > .code {
    order: 2;
    flex: 0 0 auto;
  }

  .row:has(> .leader) > .leader {
    order: 3;
  }

  .row:has(> .leader) > .val,
  .row:has(> .leader) > .valText {
    order: 4;
  }

  .leader {
    flex: 1 1 1.25rem;
    min-width: 1.25rem;
  }

  .val,
  .valText {
    flex: 0 0 auto;
    max-width: 100%;
    margin-left: auto;
    text-align: right;
    white-space: normal;
  }

  .rowPlain {
    flex-wrap: nowrap;
  }

  .rowBig {
    font-size: 1.0625rem;
  }

  .rowBig .field {
    font-size: 1.25rem;
  }

  .total {
    font-size: 1.25rem;
  }

  .letter {
    margin-left: 0;
    padding-inline: 1rem;
  }
  .lede {
    font-size: 1.0625rem;
  }

  .btn {
    width: 100%;
    justify-content: space-between;
    padding: 0.95rem 1rem;
    font-size: 0.9375rem;
    white-space: nowrap;
  }
}

/* The closing button's address does not fit on one line on the narrowest
   phones: smaller type, and the label may wrap before the address. */
@media (max-width: 380px) {
  #contact .btn {
    font-size: 0.875rem;
    white-space: normal;
  }
}

/* The paper prints */

/* A line prints: burned in two hard bands, top then bottom. No fade, no
   slide; the paper moves, the lines do not. */
@keyframes print {
  from {
    clip-path: inset(0 0 100% 0);
  }
  to {
    clip-path: inset(0);
  }
}

/* A dot row of a state word is on or off. */
@keyframes ink {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Each thermal dot lands a little large and settles as it burns in. */
@keyframes burn {
  from {
    transform: scale(1.28);
  }
  to {
    transform: scale(1);
  }
}

@keyframes feed {
  from {
    transform: translateY(-2.75rem);
  }
  to {
    transform: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  /* The paper feeds one step per tick, 8 ticks. */
  .feed {
    animation: feed calc(var(--tick) * 8) steps(8, end) both;
  }

  /* DECLINED rides out on the paper: one row per tick from the second tick.
     Plays with or without a script. */
  .wordWrap:not(.late) .word g {
    animation: ink 1ms steps(1, end) backwards;
    animation-delay: calc(var(--tick) + var(--row) * var(--tick));
  }

  .word circle {
    transform-box: fill-box;
    transform-origin: center;
  }

  .wordWrap:not(.late) .word circle {
    animation: burn 240ms var(--ease-out) backwards;
    animation-delay: calc(var(--tick) + var(--row) * var(--tick));
  }

  /* PENDING and PAID wait, hidden, until the script reaches them. The hide
     hangs off data-js, which the script sets itself. */
  .page[data-js] .late:not([data-inview]) g {
    opacity: 0;
  }

  .page[data-js] .late[data-inview='print'] g {
    animation: ink 1ms steps(1, end) backwards;
    animation-delay: calc(var(--row) * var(--tick-act));
  }

  .page[data-js] .late[data-inview='print'] circle {
    animation: burn 240ms var(--ease-out) backwards;
    animation-delay: calc(var(--row) * var(--tick-act));
  }
}

@media (prefers-reduced-motion: reduce) {
  .page,
  .chev,
  .btn,
  .slotBtn,
  .slotLink,
  .copy,
  .copy > span {
    transition: none;
  }
}

/* ==========================================================================
   Structure added in the second pass: status lights, three acts, footer
   ========================================================================== */

.page {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --spring: cubic-bezier(0.23, 1, 0.32, 1);
  --foot-gap: clamp(3rem, 8vw, 6rem);
  /* The printer's one clock. Lines print in two hard bands per tick; the dot
     rows of a state word print one per tick (one per act tick for PENDING
     and PAID, which print alone). */
  --tick: 70ms;
  --tick-act: 90ms;
  --print: steps(2, end);
}

@supports (transition-timing-function: linear(0, 1)) {
  .page {
    /* An underdamped spring (damping ratio 0.55, settled by 600ms) for the dot
       matrix settling back: it passes its rest size by 12.6%, so a dot let go
       at 1.45 dips to about 0.94 before it settles. */
    --spring: linear(0, 0.026 2.5%, 0.096 5%, 0.196 7.5%, 0.313 10%, 0.437 12.5%, 0.561 15%, 0.679 17.5%, 0.785 20%, 0.878 22.5%, 0.955 25%, 1.017 27.5%, 1.063 30%, 1.095 32.5%, 1.115 35%, 1.125 37.5%, 1.126 40%, 1.12 42.5%, 1.11 45%, 1.096 47.5%, 1.081 50%, 1.065 52.5%, 1.05 55%, 1.035 57.5%, 1.022 60%, 1.011 62.5%, 1.002 65%, 0.995 67.5%, 0.99 70%, 0.987 72.5%, 0.985 75%, 0.984 80%, 0.987 85%, 0.991 90%, 0.994 95%, 1);
  }
}

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

.nowrap {
  white-space: nowrap;
}

/* The paper's shadow sits on one layer behind the strip, so nothing that
   moves on the paper has to repaint it. */
.feed::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0 0 calc(var(--foot-gap) + 16px) 0;
  box-shadow: 0 26px 34px rgba(0, 0, 0, 0.3);
}

/* Status lights in the slot: which state the invoice on screen is in */

.status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: clamp(0.25rem, 2vw, 1.5rem);
  margin-right: auto;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slot-text);
}

.led {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--light-off);
  /* A lamp is on or off: the colour switches, only the size eases. */
  transition: transform 160ms var(--ease-out);
}

/* The lit light is a brighter fill and a touch larger; no glow. */
.page[data-state='declined'] .ledDeclined {
  background: var(--light-declined);
  transform: scale(1.3);
}

.page[data-state='chasing'] .ledChasing {
  background: var(--light-chasing);
  transform: scale(1.3);
}

.page[data-state='paid'] .ledPaid {
  background: var(--light-paid);
  transform: scale(1.3);
}

.statusWord {
  display: inline-grid;
  margin-left: 0.35rem;
}

/* The readout flips, like a terminal's. */
.statusWord > span {
  grid-area: 1 / 1;
  opacity: 0;
}

.page[data-state='declined'] .swDeclined,
.page[data-state='chasing'] .swChasing,
.page[data-state='paid'] .swPaid {
  opacity: 1;
}

/* Section links: the underline draws in, and stays on the section in view */

.slotLink {
  padding-bottom: 0.2rem;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0% 2px no-repeat;
  transition: background-size 200ms var(--ease-out), color 150ms ease;
}

.slotLink[aria-current] {
  color: var(--paper);
  background-size: 100% 2px;
}

@media (hover: hover) and (pointer: fine) {
  .slotLink:hover {
    color: var(--paper);
    background-size: 100% 2px;
  }
}

/* Acts and sub-sections */

.wordWrap + .h2 {
  margin-top: 2.25rem;
}

.h3 {
  margin-top: clamp(2.75rem, 6vw, 3.75rem);
  max-width: 30ch;
  font-size: clamp(1.2rem, 1rem + 0.9vw, 1.3rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.h3 + .rows {
  margin-top: 1.1rem;
}

.totalTop {
  margin-top: 0;
}

.h2Close {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}

/* Cancelled reminders: the line is struck by hand, left to right */

.strike {
  color: var(--ink-soft);
  background: linear-gradient(currentColor, currentColor) 0 56% / 100% 2px no-repeat;
}

.swap {
  display: inline-grid;
  justify-items: end;
}

.swap > * {
  grid-area: 1 / 1;
}

.swapA {
  opacity: 0;
}

/* Copy the address */

.copy {
  display: inline-grid;
  padding: 0.35rem 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms var(--ease-out);
}

.copy > span {
  grid-area: 1 / 1;
  justify-self: start;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.28em;
  transition: opacity 200ms ease, filter 200ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .copy:hover > span {
    text-decoration-thickness: 3px;
  }
}

/* The button only works with a script, which removes this. */
.copy[hidden] {
  display: none;
}

.copyB {
  opacity: 0;
  filter: blur(3px);
}

.copy[data-copied] .copyA {
  opacity: 0;
  filter: blur(3px);
}

.copy[data-copied] .copyB {
  opacity: 1;
  filter: none;
}

/* Footer */

.footNav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.6rem;
}

.footLine {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  /* 1.1rem plus the word space the old inline line had (1ch in a mono face). */
  gap: 0.5rem calc(1.1rem + 1ch);
  color: var(--ink-soft);
}

.slotNav {
  margin-left: auto;
  margin-right: clamp(0.25rem, 1.2vw, 1rem);
}

/* The slot at narrower widths. It is never more than two rows, and no link or
   button breaks inside itself. */

/* 1040px and below: brand, status and the email button on row one, the five
   section links on row two. (The legal pages keep their two links on row one
   while they fit; see further down.) */
@media (max-width: 1040px) {
  html {
    scroll-padding-top: 7.25rem;
  }

  .slot {
    flex-wrap: wrap;
    row-gap: 0.5rem;
    padding-inline: 0.85rem;
  }

  .slotNav {
    order: 4;
    flex: 1 0 100%;
    flex-wrap: nowrap;
    gap: 0.9rem;
    margin-inline: 0;
    font-size: 0.875rem;
  }

  .slotLink {
    padding-top: 0.4rem;
  }

  .page:not([data-counter-root]) .slotNav {
    order: 0;
    flex: none;
    margin-left: auto;
  }
}

/* 720px and below: the links stay as one row that scrolls sideways when it
   does not fit. The row runs to both edges of the slot, has no visible
   scrollbar, and fades out at its trailing edge so a cut-off link reads as
   more to come. The end padding keeps the last link clear of the fade once
   scrolled. */
@media (max-width: 720px) {
  .slot {
    row-gap: 0;
    padding-block: 0.5rem 0;
  }

  .slotNav {
    align-self: stretch;
    min-height: 44px;
    margin-inline: -0.85rem;
    padding-inline: 0.85rem 2.5rem;
    scroll-padding-inline: 0.85rem 2.5rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to left, transparent, #000 2.25rem);
    mask-image: linear-gradient(to left, transparent, #000 2.25rem);
  }

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

  .page:not([data-counter-root]) .slot {
    padding-block: 0.75rem;
  }

  .page:not([data-counter-root]) .slotNav {
    min-height: 0;
    margin-inline: 0 clamp(0.25rem, 1.2vw, 1rem);
    padding-inline: 0;
    overflow: visible;
    -webkit-mask-image: none;
    mask-image: none;
  }
}

/* On a phone the first row still holds brand, status and the button. */
@media (max-width: 480px) {
  .slot {
    column-gap: 0.6rem;
  }

  .brand {
    font-size: 1.05rem;
  }

  .slotBtn {
    padding: 0.45rem 0.7rem;
    font-size: 0.875rem;
  }
}

/* The legal pages, where brand, two links and button no longer fit on one
   row: brand and button on row one, the two links below. */
@media (max-width: 540px) {
  .page:not([data-counter-root]) .slot {
    padding-block: 0.5rem 0;
  }

  .page:not([data-counter-root]) .slotNav {
    order: 4;
    flex: 1 0 100%;
    align-self: stretch;
    min-height: 44px;
    margin-inline: 0;
  }
}

/* Below about 400px the status word goes; the three lights stay. */
@media (max-width: 400px) {
  .statusWord {
    display: none;
  }
}

/* Touch: every control is at least 44px tall. Where a taller box would change
   the look, an invisible hit area is added instead. */
@media (pointer: coarse) {
  .brand,
  .slotLink,
  .copy,
  .actions > .link,
  .fieldSm {
    position: relative;
  }

  .brand::after,
  .slotLink::after,
  .slotBtn::after,
  .copy::after,
  .actions > .link::after,
  .fieldSm::after {
    content: '';
    position: absolute;
    left: -0.2rem;
    right: -0.2rem;
    top: 50%;
    min-height: 100%;
    height: 44px;
    transform: translateY(-50%);
  }

  .slotLink::after {
    left: -0.45rem;
    right: -0.45rem;
  }

  .footNav {
    row-gap: 0;
  }

  /* Room for the row-one hit areas, which reach 2.5px past their boxes. */
  @media (max-width: 720px) {
    .slot {
      row-gap: 3px;
    }
  }

  .footNav .link,
  .footLine .link {
    padding-block: 0.75rem;
  }
}

/* Reduced motion: the status lights and word switch without a transition,
   and the lit light is not scaled. */
@media (prefers-reduced-motion: reduce) {
  .led,
  .statusWord > span {
    transition: none;
  }

  .page[data-state] .led {
    transform: none;
  }

  /* These come after the base rules they soften, so they win. The copy label
     keeps a plain 300ms fade: a change, not a movement. */
  .slotLink,
  .copy {
    transition: none;
  }

  .copy > span,
  .copyB,
  .copy[data-copied] .copyA {
    filter: none;
    transition: opacity 300ms linear;
  }
}

/* ==========================================================================
   Motion. Three rules: the paper prints (stepped or wiped top to bottom),
   state changes cross-fade, and controls answer a press. Everything below is
   skipped or softened when the visitor asks for reduced motion, and the page
   is complete without any of it.
   ========================================================================== */

/* Press feedback */

.btn:active,
.slotBtn:active,
.copy:active {
  transform: scale(0.97);
}

@media (prefers-reduced-motion: no-preference) {
  .btn svg {
    transition: transform 220ms var(--ease-out);
  }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .btn:hover svg {
    transform: translateX(4px);
  }
}

@media (prefers-reduced-motion: no-preference) {
  /* On load the first segment prints line by line under the state word, on
     the printer's clock. Each line carries its own start (--at) in the HTML:
     the header slowly, the body faster. CSS only, so it plays without a
     script too. */
  .ln {
    animation: print var(--tick) var(--print) backwards;
    animation-delay: var(--at, 0ms);
  }

  /* The headline is two lines on a wide screen: one band per line. */
  .h1.ln {
    animation-duration: calc(var(--tick) * 2);
  }

  /* A figure that reprints needs a box to clip (app.js does the printing). */
  .page[data-js] [data-fig] {
    display: inline-block;
  }

  /* The timeline waits, then plays the stop-on-payment moment once:
     the second reminder goes out, the customer pays, the rest are struck.
     Values are reprinted, not dissolved. */
  .page[data-js] .timeline:not([data-play]) .swapA {
    opacity: 1;
  }

  .page[data-js] .timeline:not([data-play]) .swapB {
    opacity: 0;
  }

  .page[data-js] .timeline:not([data-play]) .tlPaid {
    opacity: 0;
    clip-path: inset(0 0 100% 0);
  }

  .page[data-js] .timeline:not([data-play]) .strike {
    color: var(--ink);
    background-size: 0% 2px;
  }

  .page[data-js] .timeline:not([data-play]) .void .val {
    color: var(--ink);
  }

  /* Every swap is a hard switch at its moment (1ms, one step). */
  .timeline[data-play] .swap > * {
    transition: opacity 1ms steps(1, end);
  }

  .timeline[data-play] .tlSent .swap > * {
    transition-delay: 150ms;
  }

  /* The one green line prints like every other line: two bands, one tick each. */
  .timeline[data-play] .tlPaid {
    clip-path: inset(-0.5rem);
    transition: clip-path calc(var(--tick) * 2) var(--print) 650ms, opacity 1ms steps(1, end) 650ms;
  }

  /* The strike is drawn by hand, so it eases. The struck text greys on the
     frame the pen reaches the end. */
  .timeline[data-play] .strike {
    transition: background-size 520ms var(--ease-in-out), color 1ms steps(1, end);
  }

  .timeline[data-play] .void .val {
    transition: color 1ms steps(1, end);
  }

  /* Each Cancelled prints on the frame its strike finishes:
     1250 + 520 = 1770ms, 1500 + 520 = 2020ms. */
  .timeline[data-play] .tlVoid1 .strike {
    transition-delay: 1250ms, 1770ms;
  }

  .timeline[data-play] .tlVoid1 .swap > *,
  .timeline[data-play] .tlVoid1 .val {
    transition-delay: 1770ms;
  }

  .timeline[data-play] .tlVoid2 .strike {
    transition-delay: 1500ms, 2020ms;
  }

  .timeline[data-play] .tlVoid2 .swap > *,
  .timeline[data-play] .tlVoid2 .val {
    transition-delay: 2020ms;
  }

  /* The receipt's last total prints when the visitor reaches it: two ticks,
     like the other double-size lines. The clip sits on the row, not on the
     list the observer watches: a fully clipped element counts as 0% on
     screen, so the list itself must stay unclipped or it is never seen. */
  .page[data-js] .lateLine:not([data-inview]) > li {
    clip-path: inset(0 0 100% 0);
  }

  .page[data-js] .lateLine[data-inview] > li {
    animation: print calc(var(--tick) * 2) var(--print) backwards;
  }
}

/* Folds open and close at their own height where the browser can do it, and
   only the height moves. */
@supports (interpolate-size: allow-keywords) {
  @media (prefers-reduced-motion: no-preference) {
    .page {
      interpolate-size: allow-keywords;
    }

    .fold::details-content {
      block-size: 0;
      overflow: clip;
      transition: block-size 260ms var(--ease-out), content-visibility 260ms allow-discrete;
    }

    .fold[open]::details-content {
      block-size: auto;
    }
  }
}

/* Where the height cannot animate it snaps open, so the contents print. */
@supports not (interpolate-size: allow-keywords) {
  @media (prefers-reduced-motion: no-preference) {
    .fold[open] > .letter,
    .fold[open] > .answer {
      animation: print var(--tick) var(--print) backwards;
    }
  }
}

/* The dot matrix swells under the pointer and springs back. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .word circle {
    transition: transform 600ms var(--spring);
  }

  /* Swelling follows the pointer closely; only the release is a spring. */
  .word[data-hot] circle {
    transition: transform 110ms var(--ease-out);
  }
}

/* ==========================================================================
   Documents: the privacy policy and terms pages. Same paper, set for reading.
   ========================================================================== */

.doc .h1 {
  max-width: 24ch;
}

.doc .lede,
.doc .prose,
.doc .note {
  max-width: 40rem;
}

.doc .h3 {
  margin-top: clamp(2.25rem, 5vw, 3rem);
}

.docList {
  max-width: 40rem;
  margin: 0.9rem 0 0;
  padding-left: 1.25rem;
  list-style: square;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
}

.docList li + li {
  margin-top: 0.45rem;
}
