/* ═══════════════════════════════════════════════════════════════════
   RAVENS FROIDNOISE
   Pure HTML + CSS. No build step, no JavaScript, no external requests.

   THE DIALS — change these first, everything else follows:
   --tilt        how crooked the paper sits (0deg = perfectly square)
   --stamp       the NEW badge colour (set to var(--ink) for mono ink)
   --grain-amt   paper texture strength
   ═══════════════════════════════════════════════════════════════════ */

:root {
  /* ═══ THE STAMP ═══════════════════════════════════════════════════
     Bump these two whenever you change something and post it.
     They're the ONLY thing you edit to cut a new version, and each
     appears in two places on the receipt (header docket + footer),
     the way a real receipt repeats its transaction number.
     Quotes are required — these are CSS strings.
     ═════════════════════════════════════════════════════════════════ */
  --build: 'RFN-0006';
  --date: '2026-10-30';

  /* Type — installed system font only, never loaded over the network.
     Android has no Courier New and falls through to monospace. Fine. */
  --font: 'Courier New', Courier, 'Nimbus Mono PS', monospace;

  /* Ink & paper */
  --ground: #cfc9bd; /* the surface the paper lies on */
  --paper: #f4f1ea;
  --ink: #1a1917; /* warm near-black; print is never pure #000 */
  --ink-mid: #504b42;
  --ink-soft: #665f54; /* checked: ~5.2:1 on --paper, passes AA */
  --rule: rgba(26, 25, 23, 0.32);
  --stamp: #9c3b2e; /* faded stamp red; ~6:1 on --paper */

  --tilt: -0.4deg;
  --grain-amt: 0.06;

  /* Paper fibre / print noise. ~400 bytes, no image request. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23g)'/%3E%3C/svg%3E");
}

/* ─── Reset ──────────────────────────────────────────────────────── */

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden; /* --tilt must not create a scrollbar */
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  font-variant-ligatures: none;
}

/* ─── The paper ──────────────────────────────────────────────────── */

.page {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px calc(48px + env(safe-area-inset-bottom));
}

.receipt {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 28px 22px 22px;
  background: var(--paper);
  transform: rotate(var(--tilt));
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.1),
    0 10px 26px rgba(0, 0, 0, 0.1);
}

.grain {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none; /* clicks pass straight through */
  background-image: var(--grain);
  background-size: 140px 140px;
  mix-blend-mode: multiply;
  opacity: var(--grain-amt);
}

/* ─── Header ─────────────────────────────────────────────────────── */

.logo {
  /* ready for when you uncomment the <img> */
  display: block;
  width: clamp(84px, 26vw, 120px);
  height: auto;
  margin: 0 auto 16px;
}

.wordmark {
  margin: 0;
  font-size: clamp(25px, 8.6vw, 38px); /* 25px min so it breathes at 320px */
  font-weight: 700; /* Courier New is thin; 700 or it washes out */
  letter-spacing: 0.1em; /* monospace already has wide sidebearings */
  line-height: 1.12;
  text-transform: uppercase;
  text-align: center;
}

.tagline {
  margin: 12px 0 0;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  color: var(--ink-soft);
}

.docket {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 20px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mid);
}

.docket__row {
  display: flex;
  justify-content: space-between;
}

/* The two stamp values are printed from the --date / --build tokens so one
   edit updates every place they appear. Fallbacks keep the receipt readable
   if a browser ever refuses a custom property in content. */
.val--date::after {
  content: var(--date, '\2014');
}
.val--build::after {
  content: var(--build, '\2014');
}

/* ─── Rules ──────────────────────────────────────────────────────── */

.rule {
  border: 0;
  border-top: 1px dashed var(--rule);
  margin: 16px 0;
}

.rule--heavy {
  border-top: 3px double var(--ink);
}

/* ─── Line items ─────────────────────────────────────────────────── */

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px; /* thumb target; non-negotiable on mobile */
  padding: 8px 6px;
  color: inherit;
  text-decoration: none;
  font-size: 17px; /* Courier's small x-height reads under size */
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px dashed var(--rule);
  transition:
    background-color 120ms linear,
    color 120ms linear;
}

.items .item:last-child {
  border-bottom: 0;
}

.item__label {
  flex: 1 1 auto;
}

.item__meta {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}

.item--featured {
  min-height: 64px;
  font-size: 20px;
  border-bottom: 0;
}

.stamp {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 5px;
  border: 1px solid var(--stamp);
  border-radius: 2px;
  color: var(--stamp);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  vertical-align: middle;
  transform: rotate(-3deg);
}

/* Pressed state inverts the row like a stamped impression. This is the
   feedback that actually matters on a phone. */
.item:active {
  background: var(--ink);
  color: var(--paper);
}
.item:active .item__meta {
  color: var(--paper);
}
.item:active .stamp {
  color: var(--paper);
  border-color: var(--paper);
}

@media (hover: hover) {
  .item:hover {
    background: rgba(26, 25, 23, 0.06);
  }
}

/* ─── Subtotal ───────────────────────────────────────────────────── */

.subtotal {
  display: flex;
  justify-content: space-between;
  padding: 2px 6px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mid);
}

/* ─── Socials ────────────────────────────────────────────────────── */

/* A 2-column grid, not a wrapping row: four items in a flex row orphan the
   last one onto its own line at ~390px. The grid stays balanced at every
   width, and each cell is a comfortable tap target. */
.socials {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px 0;
}

.social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 8px;
  color: var(--ink);
  text-decoration: none;
  text-underline-offset: 4px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition:
    background-color 120ms linear,
    color 120ms linear;
}

.social:active {
  background: var(--ink);
  color: var(--paper);
}

@media (hover: hover) {
  .social:hover {
    text-decoration: underline;
  }
}

/* ─── Footer ─────────────────────────────────────────────────────── */

.foot {
  text-align: center;
}

.thanks {
  margin: 12px 0 16px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mid);
}

/* Irregular bar widths so it doesn't read as a stripe pattern */
.barcode {
  display: block;
  max-width: 220px;
  height: 46px;
  margin: 0 auto 12px;
  cursor: default;
  background-image: repeating-linear-gradient(
    90deg,
    var(--ink) 0 2px,
    transparent 2px 5px,
    var(--ink) 5px 6px,
    transparent 6px 9px,
    var(--ink) 9px 12px,
    transparent 12px 13px,
    var(--ink) 13px 14px,
    transparent 14px 18px,
    var(--ink) 18px 21px,
    transparent 21px 23px
  );
}

.serial {
  margin: 0;
  white-space: nowrap; /* never break at the RFN- hyphen */
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ─── Focus, motion, print ───────────────────────────────────────── */

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

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

@media print {
  body {
    background: #fff;
  }
  .receipt {
    max-width: none;
    transform: none;
    box-shadow: none;
  }
  .grain {
    display: none;
  }
}
