/* Ramesh Chit Chat, Bangarpet.
 *
 * Rebuilt. The first version was a dark editorial page with a big 1984 on it,
 * which was the same page shape as every other demo in a different colour.
 * That is not personalisation.
 *
 * This one IS the paper bill you are handed at a chaat counter. One narrow
 * strip, torn top and bottom, thermal cream stock, monospace, dotted leader
 * rules, itemised lines, a rubber stamp banged on after the total.
 *
 * Forty two years read as line items. The total is the years, not a price.
 *
 * No header bar, no hero, no fixed dock. A bill has none of those.
 */

:root {
  --counter: #17140f;  /* the dark counter the bill lies on */
  --paper:   #f8f5ec;  /* thermal receipt stock, faintly warm */
  --ink:     #26231f;
  --faint:   #6c655c;  /* where the print runs weak */
  --stamp:   #a8321f;  /* rubber stamp red */

  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
          "Liberation Mono", monospace;
  --kn:   "Noto Sans Kannada", system-ui, sans-serif;
}

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

body {
  margin: 0;
  background: var(--counter);
  color: var(--paper);   /* body text never renders on the counter; .paper sets ink */
  font-family: var(--mono);
  font-size: 13.5px; line-height: 1.65;
  padding: clamp(1rem, 5vw, 3.5rem) 1rem;
  background-image: radial-gradient(circle at 30% 18%, rgb(255 255 255 / .03) 0, transparent 55%);
}

/* Kannada has no monospace to fall back on, so it gets its own face. */
[lang="kn"] { font-family: var(--kn); letter-spacing: 0; }

body [lang="kn"] { display: none; }
:root[data-lang="kn"] body [lang="en"] { display: none; }
:root[data-lang="kn"] body [lang="kn"] { display: inline; }
.lang button[lang="kn"] { display: inline; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); color: var(--ink); padding: .6rem .9rem; }

/* ── the strip ──────────────────────────────────────────────────────── */

.bill {
  max-width: 27rem; margin: 0 auto;
  filter: drop-shadow(0 18px 34px rgb(0 0 0 / .5));
}
.paper { background: var(--paper); color: var(--ink); padding: 1.6rem clamp(1.1rem, 5vw, 2rem) 2rem; }

/* Torn edges, cut with a repeating conic gradient rather than an image. */
.tear { height: 10px; background: var(--paper); }
.tear--top {
  -webkit-mask: repeating-conic-gradient(from -45deg at bottom, #0000 0deg 90deg, #000 90deg 180deg) 0 0/16px 100%;
          mask: repeating-conic-gradient(from -45deg at bottom, #0000 0deg 90deg, #000 90deg 180deg) 0 0/16px 100%;
}
.tear--bot {
  -webkit-mask: repeating-conic-gradient(from 135deg at top, #0000 0deg 90deg, #000 90deg 180deg) 0 0/16px 100%;
          mask: repeating-conic-gradient(from 135deg at top, #0000 0deg 90deg, #000 90deg 180deg) 0 0/16px 100%;
}

/* ── head ───────────────────────────────────────────────────────────── */

.head { text-align: center; }
.shop { margin: 0 0 .5rem; font-size: 1.32rem; font-weight: 700; letter-spacing: .16em; }
.addr { margin: 0; font-size: .72rem; letter-spacing: .1em; color: var(--faint); }
.addr + .addr { margin-top: .35rem; }

.rule { height: 0; border-top: 1px dashed rgb(38 35 31 / .4); margin: 1.05rem 0; }
.rule--heavy { border-top: 2px solid var(--ink); }

.lang {
  display: flex; justify-content: center; align-items: center; gap: .5rem;
  font-size: .7rem; letter-spacing: .12em; color: var(--faint);
}
.lang button {
  background: none; border: 0; font: inherit; font-family: var(--mono);
  color: var(--faint); cursor: pointer; padding: .15rem .2rem;
}
.lang button[lang="kn"] { font-family: var(--kn); }
.lang button[aria-pressed="true"] { color: var(--ink); font-weight: 700; text-decoration: underline; }

/* ── the one thing they invented ────────────────────────────────────── */

.star { text-align: center; padding: .3rem 0; }
.star__k { margin: 0 0 .45rem; font-size: 1.6rem; font-weight: 700; letter-spacing: .06em; color: var(--stamp); }
.star__v { margin: 0; font-size: .82rem; color: var(--faint); }

/* ── line items with dotted leaders ─────────────────────────────────── */

.items { list-style: none; margin: 0; padding: 0; }
.items li { display: flex; align-items: baseline; gap: .5rem; font-size: .82rem; padding: .32rem 0; }
.it { letter-spacing: .04em; }
/* Leader dots, drawn rather than typed, so they always reach the amount. */
.dots {
  flex: 1; height: 1px; align-self: center;
  background-image: radial-gradient(circle, rgb(38 35 31 / .55) .5px, transparent .6px);
  background-size: 5px 1px; background-repeat: repeat-x;
}
.am { font-weight: 700; letter-spacing: .06em; font-variant-numeric: tabular-nums; }

/* ── total ──────────────────────────────────────────────────────────── */

.total { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.total__k { margin: 0; font-size: .92rem; font-weight: 700; letter-spacing: .2em; }
.total__v { margin: 0; font-size: 2.5rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.total__v small { font-size: .3em; letter-spacing: .2em; margin-left: .35em; }

/* ── the stamp, banged on after the total ───────────────────────────── */

.stamp {
  margin: 1.5rem auto .4rem; width: max-content;
  border: 2.5px solid var(--stamp); color: var(--stamp);
  padding: .45rem 1rem; font-size: .95rem; font-weight: 700; letter-spacing: .18em;
  transform: rotate(-8deg) scale(2.4); opacity: 0;
}
.stamp.is-struck { animation: strike .42s cubic-bezier(.2,1.4,.5,1) forwards; }
@keyframes strike {
  0%   { transform: rotate(-8deg) scale(2.4); opacity: 0; }
  60%  { opacity: 1; }
  100% { transform: rotate(-8deg) scale(1); opacity: 1; }
}

/* ── photo slot, still a bill element ───────────────────────────────── */

.shotwrap {
  margin: 1.5rem 0 .4rem; aspect-ratio: 4 / 3; position: relative;
  display: grid; place-items: center;
  border: 1px dashed rgb(38 35 31 / .38);
  color: var(--faint); font-size: .68rem; letter-spacing: .16em;
}
.shotwrap::after {
  content: attr(data-slot); position: absolute; bottom: .5rem; left: 0; right: 0;
  text-align: center; font-size: .58rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint);
}

/* ── foot ───────────────────────────────────────────────────────────── */

.foot { text-align: center; }
.thanks { margin: 0 0 1rem; font-size: .78rem; letter-spacing: .16em; }

.ring {
  display: block; margin: 0 auto .5rem; width: 100%;
  text-decoration: none; text-align: center;
  border: 2px solid var(--ink); color: var(--ink);
  padding: .7rem 1rem; font-size: .95rem; font-weight: 700; letter-spacing: .12em;
  font-family: var(--mono);
}
.ring:hover { background: var(--ink); color: var(--paper); }
.ring--wa { border-color: var(--stamp); color: var(--stamp); }
.ring--wa:hover { background: var(--stamp); color: var(--paper); }

.hours { margin: .9rem 0 0; font-size: .64rem; letter-spacing: .12em; color: var(--faint); }
.hours::after {
  content: attr(data-slot); display: block; margin-top: .25rem;
  font-size: .56rem; text-transform: uppercase;
}

/* Barcode, built from a gradient. Every bill has one. */
.code {
  height: 34px; margin: 1.2rem 0 .7rem;
  background-image: repeating-linear-gradient(to right,
    var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 5px, transparent 5px 9px,
    var(--ink) 9px 12px, transparent 12px 13px, var(--ink) 13px 14px, transparent 14px 18px);
  opacity: .8;
}

.fine { margin: 0; font-size: .58rem; letter-spacing: .1em; color: var(--faint); }

/* ── floor ──────────────────────────────────────────────────────────── */

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .stamp { opacity: 1; transform: rotate(-8deg) scale(1); }
}

@media print {
  body { background: #fff; padding: 0; }
  .bill { filter: none; }
  .lang, .skip { display: none; }
}
