:root {
  color-scheme: light;
  --paper: #f4f3ef;
  --sheet: #fcfcfa;
  --ink: #111111;
  --ink-2: #4a4a46;
  --ink-3: #8a8983;
  --line: rgba(17, 17, 17, 0.12);
  --done: #1f8a4c;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  background: var(--paper);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  margin: 0;
  background: var(--paper);
  line-height: 1.5;
}

.shell {
  width: min(100% - 2.5rem, 74rem);
  margin-inline: auto;
}

.narrow {
  width: min(100% - 2.5rem, 38rem);
  margin-inline: auto;
}

a {
  color: inherit;
  font-weight: 550;
  text-decoration-color: rgba(17, 17, 17, 0.3);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

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

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

code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(17, 17, 17, 0.06);
  font-family: var(--mono);
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

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

.kicker {
  margin: 0;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* A row of perforation holes, used as the section divider. */
.perforation {
  height: 6px;
  margin: 0;
  border: 0;
  background: radial-gradient(circle, rgba(17, 17, 17, 0.22) 1.4px, transparent 1.9px) center / 10px 6px repeat-x;
}

/* Torn top and bottom edges for anything receipt-shaped. */
.torn {
  --tooth: 12px;
  -webkit-mask:
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / var(--tooth) 51% repeat-x,
    conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / var(--tooth) 51% repeat-x;
  mask:
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / var(--tooth) 51% repeat-x,
    conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / var(--tooth) 51% repeat-x;
}

/* Header and footer */

.site-header .shell,
.site-header .narrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 4.25rem;
}

.brand {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  text-decoration: none;
}

.brand img {
  width: 1.45rem;
  height: 1.45rem;
}

.site-footer {
  margin-top: auto;
}

.site-footer .shell,
.site-footer .narrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  padding-block: 1.5rem calc(1.5rem + env(safe-area-inset-bottom));
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--ink-2);
  font-weight: 500;
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0 1.2rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.button-primary {
  background: var(--ink);
  color: var(--paper);
}

.button-primary:hover {
  background: #2b2b2b;
}

.button-quiet {
  border-color: rgba(17, 17, 17, 0.2);
  background: transparent;
  color: var(--ink);
}

.button-quiet:hover {
  border-color: var(--ink);
}

.site-header .button {
  min-height: 2.4rem;
  padding-inline: 1rem;
  font-size: 0.85rem;
}

/* Type */

h1,
h2 {
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(3rem, 15vw, 7rem);
  font-weight: 640;
  letter-spacing: -0.06em;
  line-height: 0.9;
}

h1 span {
  display: block;
  color: var(--ink-3);
}

h2 {
  font-size: clamp(1.9rem, 7vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.lead {
  max-width: 30rem;
  margin: 1.25rem 0 0;
  color: var(--ink-2);
  font-size: clamp(1.05rem, 3.6vw, 1.2rem);
  line-height: 1.5;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.5rem;
}

/* Landing: hero */

.hero {
  display: grid;
  gap: 2.5rem;
  padding-block: clamp(1.75rem, 7vw, 5rem) clamp(2.5rem, 8vw, 5rem);
}

.demo {
  width: min(100%, 30rem);
  margin-inline: auto;
}

/* The scanner stage: chute behind, the receipt, then the scanner body in front. */
.stage {
  position: relative;
  aspect-ratio: 1;
  container-type: inline-size;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.stage svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.feed {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 47.9%;
  overflow: hidden;
}

.receipt {
  position: absolute;
  bottom: 0;
  left: 38.5%;
  width: 23%;
  aspect-ratio: 92 / 124;
}

.receipt .paper {
  --tooth: 2cqw;
  height: 100%;
  padding: 2.4cqw 1.9cqw 0;
  overflow: hidden;
  background: var(--sheet);
  color: #3a3a38;
  font-family: var(--mono);
  font-size: 8px;
  font-size: 1.9cqw;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

.receipt p,
.receipt ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.r-head {
  color: var(--ink);
  font-size: 1.3em;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-align: center;
}

.r-sub {
  margin-bottom: 0.5em !important;
  padding-bottom: 0.45em !important;
  border-bottom: 1px dashed rgba(17, 17, 17, 0.3);
  color: var(--ink-3);
  font-size: 0.82em;
  text-align: center;
}

.r-items li,
.r-total {
  display: flex;
  justify-content: space-between;
  gap: 0.5em;
}

.r-total {
  margin-top: 0.45em !important;
  padding-top: 0.4em;
  border-top: 1px dashed rgba(17, 17, 17, 0.3);
  color: var(--ink);
  font-weight: 700;
}

.scan-key,
.screen-progress {
  transform-box: fill-box;
}

.scan-key {
  transform-origin: center;
}

.screen-progress {
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* The real control sits over the drawn Scan key. */
.scan-hit {
  position: absolute;
  top: 65.8%;
  left: 68.5%;
  width: 14.9%;
  height: 7.9%;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.scan-hit:focus-visible {
  outline-color: rgba(255, 255, 255, 0.8);
  outline-offset: 1px;
}

.stage:has(.scan-hit:hover) #scan-accent {
  opacity: 1;
}

.scan-hint {
  position: absolute;
  top: 73%;
  left: 68.5%;
  width: 14.9%;
  color: #8b8b8f;
  font-family: var(--mono);
  font-size: 9px;
  font-size: 2.1cqw;
  letter-spacing: 0.06em;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

/* Scroll hint: fixed at the bottom of the first screen, gone once the page is scrolled. */
.scroll-cue {
  position: fixed;
  bottom: calc(0.75rem + env(safe-area-inset-bottom));
  left: 50%;
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  color: var(--ink-2);
  translate: -50% 0;
  transition: opacity 300ms ease;
}

.scroll-cue.gone {
  opacity: 0;
  pointer-events: none;
}

/* The books: newest line on top, older lines fade. */
.ledger {
  max-width: 22rem;
  height: 6.6rem;
  margin: 1.25rem auto 0;
  padding: 0;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.8rem;
  list-style: none;
}

.ledger li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 7rem;
  align-items: center;
  gap: 1rem;
  height: 2.2rem;
}

.ledger li + li {
  border-top: 1px solid var(--line);
}

.ledger li:nth-child(2) {
  opacity: 0.5;
}

.ledger li:nth-child(3) {
  opacity: 0.25;
}

.ledger li:nth-child(n + 4) {
  visibility: hidden;
}

.ledger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger .amount {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ledger .status {
  color: var(--done);
  font-weight: 700;
}

.ledger .duplicate .status {
  color: var(--ink-3);
  font-weight: 500;
}

.ledger .duplicate .merchant,
.ledger .duplicate .amount {
  color: var(--ink-3);
  text-decoration: line-through;
}

/* Landing: sections */

.steps {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 1.5rem 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  list-style: none;
}

.steps li {
  display: grid;
  grid-template-columns: 2rem 4rem 1fr;
}

.steps .n {
  color: var(--ink-3);
}

.steps b {
  font-weight: 700;
  letter-spacing: 0.08em;
}

.steps span:last-child {
  color: var(--ink-2);
}

.rely {
  display: grid;
  justify-items: center;
  padding-block: clamp(3rem, 10vw, 5.5rem);
}

.slip-shadow {
  width: min(100%, 23rem);
  filter: drop-shadow(0 14px 24px rgba(17, 17, 17, 0.08)) drop-shadow(0 1px 1px rgba(17, 17, 17, 0.06));
}

.slip {
  --tooth: 14px;
  padding: 2.25rem 1.6rem 2.5rem;
  background: var(--sheet);
  font-family: var(--mono);
  font-size: 0.84rem;
}

.slip h2 {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.6;
  text-align: center;
  text-transform: uppercase;
}

.slip h2 span {
  display: block;
  color: var(--ink-3);
  font-weight: 500;
}

.slip ul {
  margin: 1.1rem 0 0;
  padding: 1rem 0;
  border-block: 1px dashed rgba(17, 17, 17, 0.3);
  list-style: none;
}

.slip li {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding-block: 0.3rem;
}

.slip li i {
  flex: 1;
  min-width: 1rem;
  border-bottom: 1.5px dotted rgba(17, 17, 17, 0.35);
}

.slip li b {
  font-weight: 700;
}

/* A real Code 128 barcode for https://felixmrak.com; scanning or clicking it opens the site. */
.barcode-link {
  display: block;
  margin: 1.4rem 0.6rem 0.5rem;
}

.barcode {
  display: block;
  width: 100%;
  height: 3rem;
  fill: var(--ink);
}

.slip-foot {
  margin: 0;
  color: var(--ink-3);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-align: center;
}

.pilot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: clamp(2.5rem, 8vw, 4rem);
}

.pilot p {
  margin: 0;
  font-size: clamp(1.5rem, 5.5vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.pilot a {
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* Customer pages (/open/, /remember/) */

.page {
  padding-block: clamp(1.5rem, 7vw, 4rem) clamp(3rem, 10vw, 5rem);
}

.page h1 {
  font-size: clamp(2.4rem, 11vw, 3.75rem);
  letter-spacing: -0.055em;
  line-height: 0.95;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
}

.back:hover {
  color: var(--ink);
}

.back + h1 {
  margin-top: 1.5rem;
}

.help-steps {
  margin: 2rem 0 0;
  padding: 0;
  border-top: 1px dashed rgba(17, 17, 17, 0.3);
  list-style: none;
  counter-reset: help;
}

.help-step {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  gap: 0.5rem;
  padding-block: 1.1rem;
  border-bottom: 1px dashed rgba(17, 17, 17, 0.3);
}

.help-step::before {
  padding-top: 0.15rem;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 0.8rem;
  counter-increment: help;
  content: counter(help, decimal-leading-zero);
}

.help-step p {
  margin: 0.3rem 0 0;
  color: var(--ink-2);
  line-height: 1.55;
}

.notice {
  margin-top: 2rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--sheet);
}

.notice h2 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.notice p {
  margin: 0.35rem 0 0;
  color: var(--ink-2);
  line-height: 1.55;
}

.notice .actions {
  margin-top: 1rem;
}

.notice-error {
  border-color: rgba(17, 17, 17, 0.35);
}

.after-help {
  margin: 2rem 0 0;
  color: var(--ink-2);
  line-height: 1.6;
}

.opening {
  display: none;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 0.85rem;
}

html[data-opening] .opening {
  display: block;
}

html[data-opening] .help {
  display: none;
}

/* Wider screens */

@media (min-width: 40rem) {
  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
  }

  .steps li {
    grid-template-columns: 2rem 1fr;
  }

  .steps li span:last-child {
    grid-column: 2;
  }
}

@media (min-width: 62rem) {
  .hero {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    align-items: center;
    gap: 3rem;
    min-height: calc(100svh - 4.25rem);
    padding-block: 2rem 3rem;
  }

  .demo {
    margin-right: 0;
  }

  h1 {
    font-size: clamp(3rem, 7.2vw, 6.2rem);
  }
}

/* Small phones: shrink the header so the wordmark and button share one line. */

@media (max-width: 25rem) {
  .brand {
    font-size: 0.88rem;
  }

  .site-header .button {
    padding-inline: 0.8rem;
    font-size: 0.78rem;
  }
}

@media (max-width: 22.5rem) {
  .brand-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* One-time entrance; the demo itself runs from script. */

@media (prefers-reduced-motion: no-preference) {
  a,
  .button {
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, text-decoration-color 150ms ease;
  }

  .ledger li {
    transition: opacity 400ms ease;
  }

  #scan-accent {
    transition: opacity 150ms ease;
  }

  .scroll-cue:not(.gone) svg {
    animation: cue 2.4s ease-in-out infinite;
  }

  @keyframes cue {
    0%,
    100% {
      opacity: 0.45;
      transform: translateY(0);
    }

    50% {
      opacity: 1;
      transform: translateY(4px);
    }
  }

  .enter {
    animation: rise 700ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(0.5rem);
    }
  }
}
