/* $REFUND — the page is a thermal receipt. Cream paper, black ink, one red stamp. */
:root {
  --counter: #e7e1d4;      /* the surface the receipt lies on */
  --paper: #fbf8f1;        /* receipt paper */
  --paper-2: #f3eee3;      /* shaded paper: panels, inputs */
  --ink: #16130f;          /* thermal black */
  --ink-soft: #57524a;     /* faded print */
  --ink-faint: #716b60;    /* very faded print, rules; 4.9:1 on paper */
  --rule: #c9c2b3;
  --stamp: #d1242f;        /* the only color: refunded */
  --stamp-ink: #b81d28;    /* stamp text on paper, for contrast */
  --display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  /* spacing scale, 4px base */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --receipt: 720px;
  --pad: clamp(20px, 5vw, 48px);  /* inside the receipt */
  --section: clamp(40px, 6vw, 64px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  background-color: var(--counter);
  /* faint grain on the counter */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.35 0 0 0 0 0.25 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font: 400 14px/1.6 var(--mono);
  -webkit-font-smoothing: antialiased;
  padding: var(--s7) var(--s4) var(--s8);
}
::selection { background: var(--stamp); color: var(--paper); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--stamp); outline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; } ::-webkit-scrollbar-thumb { background: var(--rule); } ::-webkit-scrollbar-track { background: var(--counter); }

/* ── the receipt ── */
.receipt {
  position: relative;
  width: min(var(--receipt), 100%);
  margin: 0 auto;
  background: var(--paper);
  padding: var(--s6) var(--pad) var(--s7);
  box-shadow: 0 2px 2px rgba(40, 30, 10, .05), 0 24px 48px -28px rgba(40, 30, 10, .45);
  animation: print 1.1s cubic-bezier(.16, 1, .3, 1) both;
}
/* torn zigzag edges */
.receipt::before, .receipt::after {
  content: ""; position: absolute; left: 0; right: 0; height: 10px;
  background: linear-gradient(135deg, var(--paper) 50%, transparent 50%) 0 0 / 14px 10px repeat-x,
              linear-gradient(225deg, var(--paper) 50%, transparent 50%) 0 0 / 14px 10px repeat-x;
}
.receipt::before { top: -10px; transform: rotate(180deg); }
.receipt::after { bottom: -10px; }
@keyframes print { from { clip-path: inset(0 0 100% 0); transform: translateY(-12px); } to { clip-path: inset(-20px 0 -20px 0); transform: none; } }

/* ── store header ── */
.store { text-align: center; }
.logo { display: inline-block; text-decoration: none; }
.logo img { display: block; width: 88px; height: 88px; margin: 0 auto var(--s4); }
.logo b {
  display: block; font: 900 clamp(56px, 13vw, 104px)/.85 var(--display); font-stretch: 62%;
  letter-spacing: -.01em; text-transform: uppercase;
}
.store .addr { margin-top: var(--s3); color: var(--ink-soft); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
nav { margin-top: var(--s4); display: flex; flex-wrap: wrap; justify-content: center; gap: 0 var(--s4); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
nav a { padding: var(--s2) 0; text-decoration: none; color: var(--ink-soft); }
nav a:hover, nav a.on { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }

/* rules between receipt sections */
.cut { border: 0; border-top: 2px dashed var(--rule); margin: var(--section) 0 var(--s6); }

/* ── hero ── */
.hero { text-align: center; padding-top: var(--s5); }
.status { display: inline-flex; align-items: center; gap: var(--s2); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 2px solid currentColor; }
.status.pulse { color: var(--stamp-ink); }
.status.pulse::before { background: var(--stamp); border-color: var(--stamp); animation: blink 2s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }
h1 {
  margin-top: var(--s5);
  font: 900 clamp(44px, 9vw, 84px)/.88 var(--display); font-stretch: 62%;
  text-transform: uppercase; letter-spacing: -.005em; text-wrap: balance;
}
.lede { margin: var(--s5) auto 0; max-width: 46ch; color: var(--ink-soft); font-size: 15px; text-wrap: pretty; }
.actions { margin-top: var(--s6); display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s3); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 var(--s5);
  background: var(--ink); color: var(--paper); text-decoration: none; border: 2px solid var(--ink);
  font: 600 13px var(--mono); text-transform: uppercase; letter-spacing: .08em; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.btn:hover { background: var(--stamp); border-color: var(--stamp); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn[disabled] { opacity: .5; cursor: wait; }

/* the stamp: the one loud moment */
.stamp-wrap { margin-top: var(--s6); padding: var(--s4) 0; display: flex; justify-content: center; overflow: hidden; } /* the slam starts oversized; keep it inside */
.stamp {
  display: inline-block; color: var(--stamp); border: 5px solid var(--stamp); border-radius: 8px;
  padding: var(--s2) var(--s5) var(--s1);
  font: 900 clamp(40px, 8vw, 64px)/1 var(--display); font-stretch: 62%; text-transform: uppercase; letter-spacing: .04em;
  transform: rotate(-7deg); mix-blend-mode: multiply; filter: url(#ink); opacity: .92;
  animation: stamp .45s cubic-bezier(.16, 1, .3, 1) .9s both;
}
@keyframes stamp { from { transform: rotate(-16deg) scale(1.9); opacity: 0; } to { transform: rotate(-7deg) scale(1); opacity: .92; } }

/* ── line items (label .......... value) ── */
.sec-title { font: 900 clamp(28px, 5vw, 40px)/.95 var(--display); font-stretch: 62%; text-transform: uppercase; }
.sec-sub { margin-top: var(--s2); color: var(--ink-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.items { list-style: none; margin-top: var(--s5); display: grid; gap: var(--s3); }
.item { display: flex; align-items: baseline; gap: var(--s2); }
.item .k { white-space: nowrap; }
.item .lead { flex: 1; min-width: var(--s5); border-bottom: 2px dotted var(--ink-faint); transform: translateY(-4px); }
.item .v { white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.item .v small { font-weight: 400; color: var(--ink-soft); margin-left: var(--s1); }
.item.big .k, .item.big .v { font: 900 26px/1 var(--display); font-stretch: 62%; text-transform: uppercase; }
.ca { margin-top: var(--s5); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s3); padding: var(--s3) var(--s4); background: var(--paper-2); }
.ca span { word-break: break-all; font-weight: 600; }
.ca button { background: none; border: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: var(--s2) 0; }
.note { margin-top: var(--s4); color: var(--ink-soft); font-size: 13px; }

/* ── how it works ── */
.steps { list-style: none; margin-top: var(--s5); counter-reset: step; display: grid; gap: var(--s5); }
.steps li { counter-increment: step; display: grid; grid-template-columns: 40px 1fr; gap: var(--s3); }
.steps li::before { content: counter(step, decimal-leading-zero); font: 900 26px/1 var(--display); font-stretch: 62%; color: var(--ink-faint); }
.steps h3 { font: 700 15px var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.steps p { margin-top: var(--s1); color: var(--ink-soft); }
.meter { margin-top: var(--s5); padding: var(--s4); background: var(--paper-2); }
.meter-row { display: flex; justify-content: space-between; gap: var(--s3); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin-bottom: var(--s2); }
.cells { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; }
.cells i { height: 14px; background: repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px 3px); }
.cells i.f { background: var(--ink); }

/* ── claim panel ── */
[hidden] { display: none !important; }
.panel { margin-top: var(--s5); display: grid; gap: var(--s6); }
.step > p { color: var(--ink-soft); max-width: 62ch; }
.step > p.hint { margin-top: var(--s3); font-size: 12px; color: var(--ink-faint); }
.step .btn { margin-top: var(--s4); }
.msg { margin-top: var(--s3); min-height: 1.2em; font-size: 13px; }
.msg.err { color: var(--stamp-ink); }
.kv { display: grid; gap: var(--s3); }
.kv div { display: flex; align-items: baseline; gap: var(--s2); }
.kv span { white-space: nowrap; color: var(--ink-soft); }
.kv i { flex: 1; min-width: var(--s4); border-bottom: 2px dotted var(--ink-faint); transform: translateY(-4px); }
.kv b { text-align: right; word-break: break-all; }
.fields { margin-top: var(--s4); display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s4); }
.fields label { display: grid; gap: var(--s2); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.fields label.wide { grid-column: 1 / -1; }
.fields input, .fields select {
  min-height: 48px; padding: var(--s3); width: 100%; font-size: 15px; text-transform: none; letter-spacing: 0; color: var(--ink);
  background: var(--paper-2); border: 0; border-bottom: 2px solid var(--ink); border-radius: 0;
}
.fields input:focus, .fields select:focus { outline: none; border-bottom-color: var(--stamp); background: #fff; }
.fields input[type=file] { padding: var(--s3) var(--s2); }
.step h3 { font: 700 13px var(--mono); text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--s2); }

/* ── payouts: every row is a refund with its stamp ── */
.history, .returns { list-style: none; display: grid; }
.history li, .returns li {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s2) var(--s4);
  padding: var(--s4) 0; border-bottom: 2px dotted var(--ink-faint);
}
.returns { margin-top: var(--s5); border-top: 2px dotted var(--ink-faint); }
.returns li.empty, .history li.empty { color: var(--ink-faint); justify-content: center; text-align: center; }
.returns a, .history a { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.tag-paid { color: var(--stamp-ink); font-weight: 700; text-transform: uppercase; border: 2px solid var(--stamp); padding: 0 var(--s2); transform: rotate(-4deg); display: inline-block; }
.tag-rejected { color: var(--ink-faint); text-decoration: line-through; }
.tag-s { color: var(--ink-soft); }

/* ── rules (native disclosure) ── */
.rules { margin-top: var(--s5); border-top: 2px dotted var(--ink-faint); }
.rules details { border-bottom: 2px dotted var(--ink-faint); }
.rules summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: var(--s4); padding: var(--s4) 0; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.rules summary::-webkit-details-marker { display: none; }
.rules summary::after { content: "+"; font-weight: 400; }
.rules details[open] summary::after { content: "−"; }
.rules details p { padding-bottom: var(--s4); color: var(--ink-soft); max-width: 62ch; }

/* ── footer: barcode + thank you ── */
.foot { text-align: center; }
.barcode {
  height: 56px; margin: 0 auto var(--s3); width: min(320px, 100%);
  background: repeating-linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 5px, transparent 5px 8px, var(--ink) 8px 11px, transparent 11px 12px, var(--ink) 12px 13px, transparent 13px 17px);
}
.foot p { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.foot .thanks { margin-top: var(--s4); font: 900 24px var(--display); font-stretch: 62%; color: var(--ink); letter-spacing: .02em; }
.foot nav { margin-top: var(--s3); }

.reveal { opacity: 0; transform: translateY(10px); transition: opacity .6s cubic-bezier(.16, 1, .3, 1), transform .6s cubic-bezier(.16, 1, .3, 1); }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 520px) {
  body { padding: var(--s6) var(--s2) var(--s7); }
  .item.big .k, .item.big .v { font-size: 22px; }
  .steps li { grid-template-columns: 32px 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
