/* Brightdeep Coffee: the shop as one printed cupping form. Print is black; your marks are red pencil. */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo.woff2") format("woff2");
  font-weight: 100 900; font-stretch: 62% 125%; font-style: normal; font-display: swap;
}

:root {
  --stock: #e9eee6;        /* form stock */
  --stock-hi: #f3f6f1;     /* the plotted sheet, labels */
  --stock-2: #dfe6db;      /* the order slip, a second carbon */
  --rule: #c3d0c5;         /* minor rules */
  --rule-2: #9db1a2;       /* major rules */
  --ink: #121412;
  --ink-2: #474f49;        /* secondary print, 7:1 on stock */
  --red: #d7322b;          /* pencil */
  --red-ink: #b0241d;      /* pencil when it has to be read as text */
  --blue: #2b5bd7;         /* ballpoint: focus only */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --gutter: clamp(1rem, 0.4rem + 2.6vw, 2.75rem);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; scrollbar-color: var(--rule-2) var(--stock); }
body {
  margin: 0; background: var(--stock); color: var(--ink);
  font: 400 1rem/1.5 "Archivo", system-ui, sans-serif; font-stretch: 100%;
  -webkit-font-smoothing: antialiased; caret-color: var(--red);
}
body.has-slip { overflow: hidden; }
h1, h2, h3, p, dl, dd, ol, figure, fieldset, legend { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
ol { list-style: none; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; }
button, a, label, [role="application"] { touch-action: manipulation; }
button, label { -webkit-user-select: none; user-select: none; }
::selection { background: var(--ink); color: var(--stock); }
:focus-visible { outline: 2.5px solid var(--blue); outline-offset: 3px; border-radius: 2px; }
.num { font-variant-numeric: tabular-nums lining-nums; }
.sr, .defs { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; left: 1rem; top: 1rem; z-index: 100; padding: 0.6rem 0.9rem; background: var(--ink); color: var(--stock); transform: translateY(-300%); }
.skip:focus-visible { transform: none; }

/* Field labels: the form's condensed caps. */
.lbl, dt, legend, .rows-head, .axis {
  font-size: 0.72rem; font-weight: 600; font-stretch: 72%; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-2);
}

/* ---------- Masthead: the top strip of the form ---------- */

.masthead {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.5rem;
  padding: 0.7rem var(--gutter); background: var(--stock); border-bottom: 2px solid var(--ink);
}
.brand { display: grid; text-decoration: none; line-height: 1; }
.brand-word { font-weight: 900; font-stretch: 125%; font-size: 1.3rem; text-transform: uppercase; letter-spacing: -0.01em; }
.brand-sub { font-size: 0.72rem; font-weight: 600; font-stretch: 72%; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-2); margin-top: 0.25rem; }
.formhead { display: flex; justify-content: center; gap: 0; }
.formhead > div { padding: 0 1rem; border-left: 1px solid var(--rule-2); }
.formhead > div:last-child { border-right: 1px solid var(--rule-2); }
.formhead dd { font-size: 0.9rem; font-weight: 500; }
.bagbtn {
  display: inline-flex; align-items: center; gap: 0.6rem; min-height: 44px; padding: 0 0.4rem 0 0.9rem;
  background: none; border: 1.5px solid var(--ink); border-radius: 2px; cursor: pointer;
  font-weight: 600; font-stretch: 80%; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem;
  transition: background-color 160ms ease, color 160ms ease, transform 140ms var(--ease-out);
}
.bagcount { display: grid; place-items: center; min-width: 1.9rem; height: 1.9rem; background: var(--ink); color: var(--stock); font-size: 0.85rem; letter-spacing: 0; }
.bagbtn:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .bagbtn:hover { background: var(--ink); color: var(--stock); } .bagbtn:hover .bagcount { background: var(--stock); color: var(--ink); } }
@media (max-width: 47.99em) { .formhead { display: none; } .masthead { grid-template-columns: 1fr auto; } }

/* ---------- Buttons: ruled boxes; pressing inverts ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; min-height: 44px; padding: 0 1rem;
  background: transparent; color: var(--ink); border: 1.5px solid var(--ink); border-radius: 2px; cursor: pointer;
  font-weight: 650; font-stretch: 80%; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem; white-space: nowrap;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 140ms var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--ink); color: var(--stock); }
@media (hover: hover) and (pointer: fine) {
  .btn:not(.btn--primary):hover { background: var(--ink); color: var(--stock); }
  .btn--primary:hover { background: #2a2f2b; }
}
.btn-tick { width: 1.1rem; height: 1.1rem; margin-left: -0.2rem; display: none; overflow: visible; }
.btn-tick path { fill: none; stroke: var(--red); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.btn.is-added { background: var(--stock-hi); color: var(--red-ink); border-color: var(--red); }
.btn.is-added .btn-tick { display: block; }
.btn--wide { width: 100%; min-height: 54px; font-size: 0.9rem; justify-content: space-between; padding: 0 1.25rem; }
.btn--wide .btn-tick { margin-left: 0; }
.btn-total { font-stretch: 100%; letter-spacing: 0; font-size: 1rem; }

/* ---------- The shop: intro, the plotted map, the sorted form ---------- */

.shop {
  display: grid; gap: 1.5rem var(--gutter); padding: clamp(1.25rem, 3vh, 2.25rem) var(--gutter) 3rem;
  grid-template-areas: "intro" "plot" "rows";
}
.shop-intro { grid-area: intro; max-width: 36rem; }
.shop-intro h1 { font-weight: 800; font-stretch: 118%; font-size: clamp(2.1rem, 1.1rem + 3.4vw, 4.1rem); line-height: 0.96; letter-spacing: -0.025em; text-wrap: balance; }
.shop-intro p { margin-top: 0.85rem; color: var(--ink-2); font-size: clamp(1rem, 0.95rem + 0.2vw, 1.0625rem); max-width: 34rem; text-wrap: pretty; }
.plot-wrap { grid-area: plot; }
.form-rows { grid-area: rows; }
@media (min-width: 64em) {
  .shop { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "intro rows" "plot rows"; align-items: start; }
  .form-rows { grid-row: 1 / span 2; }
  .shop-intro h1 { font-size: clamp(2.4rem, 1rem + 2.6vw, 3.6rem); }
  .plot-wrap { width: min(100%, calc(100svh - 24rem)); min-width: 22rem; position: sticky; top: 5rem; }
}

.plot-wrap { padding: 1.6rem 1.6rem 0; -webkit-user-select: none; user-select: none; }
.plot {
  position: relative; aspect-ratio: 1; background: var(--stock-hi); border: 1.5px solid var(--ink);
  cursor: crosshair; touch-action: none; outline-offset: 6px;
}
.plot svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.grid-minor { stroke: var(--rule); stroke-width: 1; fill: none; vector-effect: non-scaling-stroke; }
.grid-major { stroke: var(--rule-2); stroke-width: 1; fill: none; vector-effect: non-scaling-stroke; }
.grid-axis { stroke: var(--ink-2); stroke-width: 1.5; fill: none; vector-effect: non-scaling-stroke; }
.sample circle { fill: var(--stock-hi); stroke: var(--ink); stroke-width: 3; transition: fill 200ms ease; }
.sample text { font: 700 25px "Archivo", sans-serif; font-stretch: 75%; text-anchor: middle; fill: var(--ink); transition: fill 200ms ease; }
.sample { cursor: pointer; }
.sample .dot { transform-box: fill-box; transform-origin: center; }
.sample.is-near circle { fill: var(--ink); }
.sample.is-near text { fill: var(--stock); }
.cross path { fill: none; stroke: var(--red); stroke-width: 6; stroke-linecap: round; }
.hint path { fill: none; stroke: var(--red); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.hint text { font: 600 34px "Archivo", sans-serif; font-stretch: 75%; fill: var(--red-ink); text-transform: uppercase; letter-spacing: 0.06em; }
.marks .loop { fill: none; stroke: var(--red); stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; }
.trail { fill: none; stroke: #5d665f; stroke-opacity: 0.32; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.axis { position: absolute; white-space: nowrap; color: var(--ink); }
.axis--top { left: 50%; bottom: calc(100% + 0.35rem); transform: translateX(-50%); }
.axis--bottom { left: 50%; top: calc(100% + 0.35rem); transform: translateX(-50%); }
.axis--left { right: calc(100% + 0.35rem); top: 50%; transform: translate(50%, -50%) rotate(-90deg) translateY(-50%); transform-origin: center; }
.axis--right { left: calc(100% + 0.35rem); top: 50%; transform: translate(-50%, -50%) rotate(90deg) translateY(-50%); transform-origin: center; }
.plot-now { margin-top: 2.1rem; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.5rem 1rem; align-items: center; padding: 0.7rem 0 0.7rem; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule-2); }
.plot-now #plot-now { display: flex; gap: 0.6rem; align-items: baseline; font-weight: 700; font-size: 1.1rem; min-width: 0; }
.plot-now #plot-now .lbl { color: var(--red-ink); flex: none; }
.now-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-price { display: grid; justify-items: end; line-height: 1.1; font-weight: 700; }
.now-price .lbl { font-size: 0.66rem; }

/* The form rows. */
.rows-head, .row { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr) 4.4rem 8.6rem; gap: 0 1rem; align-items: start; }
.rows-head { padding: 0 0 0.45rem; border-bottom: 2px solid var(--ink); }
.rows-head span:nth-child(n+3) { text-align: right; }
.row { position: relative; padding: 0.95rem 0; border-bottom: 1px solid var(--rule-2); background: var(--stock); }
.row-no { position: relative; width: 2.6rem; height: 2.6rem; display: grid; place-items: center; font-weight: 700; font-stretch: 75%; font-size: 1.05rem; }
.row-loop { position: absolute; inset: -0.55rem; width: calc(100% + 1.1rem); height: calc(100% + 1.1rem); overflow: visible; pointer-events: none; }
.row-loop path { fill: none; stroke: var(--red); stroke-width: 2.4; stroke-linecap: round; }
.row-what h3 { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.row-what h3 a { text-decoration: none; }
.row-what h3 a::after { content: ""; position: absolute; inset: 0; z-index: 0; }
@media (hover: hover) and (pointer: fine) { .row-what h3 a:hover { text-decoration: underline; } .row:hover { background: var(--stock-hi); } }
.row-proc { font-size: 0.8rem; color: var(--ink-2); font-stretch: 85%; margin-top: 0.15rem; }
.row-notes { margin-top: 0.3rem; font-size: 0.95rem; }
.row-scales { display: none; margin-top: 0.75rem; gap: 0.35rem; max-width: 22rem; }
.row.is-lead .row-scales { display: grid; }
.row.is-lead { background: var(--stock-hi); }
.row.is-lead .row-what h3 { font-size: 1.35rem; }
.row-score { text-align: right; display: grid; justify-items: end; font-weight: 600; padding-top: 0.15rem; }
.row-score .lbl { display: none; }
.row-buy { display: grid; justify-items: end; gap: 0.45rem; position: relative; z-index: 1; }
.price { display: grid; justify-items: end; line-height: 1.1; font-weight: 700; font-size: 1.1rem; padding-top: 0.15rem; }
.price .lbl { display: none; }
.row .btn { min-height: 40px; padding: 0 0.75rem; font-size: 0.74rem; position: relative; z-index: 1; }
.row-no, .row-score { position: relative; z-index: 1; pointer-events: none; }

@media (max-width: 47.99em) {
  .rows-head { display: none; }
  .row { grid-template-columns: 2.7rem minmax(0, 1fr) auto; }
  .row-score { grid-column: 2; grid-row: 2; justify-items: start; display: flex; gap: 0.4rem; align-items: baseline; margin-top: 0.35rem; font-size: 0.9rem; }
  .row-score .lbl { display: inline; }
  .row-buy { grid-column: 3; grid-row: 1 / span 2; }
  .price .lbl { display: block; }
  .plot-wrap { padding: 0; margin: 0 calc(var(--gutter) * -1); }
  .plot { border-left: 0; border-right: 0; }
  .axis { z-index: 1; padding: 0.15rem 0.35rem; background: var(--stock-hi); pointer-events: none; }
  .axis--top { top: 0.4rem; bottom: auto; }
  .axis--bottom { bottom: 0.4rem; top: auto; }
  .axis--left { left: 0.4rem; right: auto; transform: translateY(-50%); writing-mode: vertical-rl; rotate: 180deg; }
  .axis--right { right: 0.4rem; left: auto; transform: translateY(-50%); writing-mode: vertical-rl; }
  .sample .dot { transform: scale(1.45); }
  .plot-now { margin: 0.9rem 0 0; padding-left: var(--gutter); padding-right: var(--gutter); }
  .plot-now #plot-now { font-size: 1rem; }
  .now-name { white-space: normal; }
}

/* Printed scales: 6 to 10, quarter-point ticks, a red pencil stroke at the score. */
.scale { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) 2.8rem; align-items: center; gap: 0.75rem; }
.scale dd { display: contents; }
.scale-track { position: relative; height: 18px; display: block; }
.scale-track > svg:first-child { width: 100%; height: 18px; display: block; overflow: visible; }
.scale-track line { stroke: var(--ink-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.scale-track line.maj { stroke: var(--ink); stroke-width: 1.5; }
.scale-track line.base { stroke: var(--ink); stroke-width: 1.5; }
.scale-mark { position: absolute; top: -8px; width: 14px; height: 30px; transform: translateX(-50%); overflow: visible; }
.scale-mark path { fill: none; stroke: var(--red); stroke-width: 4; stroke-linecap: round; }
.scale-track span { position: absolute; top: 21px; transform: translateX(-50%); font-size: 0.7rem; font-weight: 600; font-stretch: 75%; color: var(--ink-2); }
.scale-v { text-align: right; font-weight: 600; font-size: 0.9rem; }
.scale--compact { grid-template-columns: 4.5rem minmax(0, 1fr) 2.6rem; }
.scale--compact .scale-v { font-size: 0.8rem; }

/* The key: the form's legend. */
.key { margin: 0 var(--gutter) 3rem; border-top: 2px solid var(--ink); padding-top: 1rem; }
.key h2 { font-weight: 800; font-stretch: 118%; font-size: 1.35rem; letter-spacing: -0.01em; }
.key-grid { margin-top: 1rem; display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--rule-2); border-left: 1px solid var(--rule-2); }
.key-grid > div { padding: 0.9rem 1rem 1.1rem; border-right: 1px solid var(--rule-2); border-bottom: 1px solid var(--rule-2); }
.key-grid dd { margin-top: 0.35rem; font-size: 0.95rem; max-width: 34ch; }
.key-wide { grid-column: 1 / -1; }
@media (min-width: 40em) { .key-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 64em) { .key-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- A coffee's sheet ---------- */

.sheet { display: grid; gap: 1.5rem var(--gutter); padding: 1.25rem var(--gutter) 3.5rem; }
.sheet > * { min-width: 0; }
.back { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 44px; width: max-content; text-decoration: none; font-weight: 600; font-stretch: 80%; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.78rem; }
.back svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2; }
@media (hover: hover) and (pointer: fine) { .back:hover { text-decoration: underline; } }
.sheet-bag { display: grid; place-items: center; }
@media (max-width: 63.99em) { .sheet-bag .pouch { width: min(62vw, 15rem); } }
@media (min-width: 64em) {
  .sheet { grid-template-columns: minmax(0, 0.85fr) minmax(0, 40rem); column-gap: clamp(2rem, 6vw, 6rem); align-items: start; }
  .sheet > :not(.sheet-bag) { grid-column: 2; }
  .back { grid-column: 1 / -1 !important; }
  .sheet-bag { grid-column: 1; grid-row: 2 / span 5; position: sticky; top: 6rem; min-height: calc(100svh - 9rem); }
}
.sheet-bar { display: none; }
@media (max-width: 63.99em) {
  .sheet-bar {
    position: fixed; z-index: 15; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 0.7rem var(--gutter) calc(0.7rem + env(safe-area-inset-bottom)); background: var(--stock); border-top: 2px solid var(--ink);
    transform: translateY(105%); transition: transform 320ms var(--ease-out);
  }
  .sheet-bar.is-on { transform: none; }
  .sheet-bar > span { display: grid; min-width: 0; }
  .sheet-bar-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
.pouch { width: min(100%, 25rem); overflow: visible; filter: drop-shadow(0 22px 26px rgb(30 44 32 / 0.2)); }
.pouch-body { transform-box: fill-box; transform-origin: 50% 100%; transition: transform 520ms var(--ease-out); }
.pouch-body.is-big { transform: scale(1.07, 1.15); }
.pouch-shape { fill: #1b1e1c; }
.pouch-seal { stroke: #333834; stroke-width: 2; fill: none; }
.pouch-valve { fill: #232724; stroke: #3d433e; stroke-width: 2; }
.pouch-sheen { stroke: rgb(255 255 255 / 0.06); stroke-width: 22; stroke-linecap: round; fill: none; }
.label rect { fill: var(--stock-hi); }
.label line { stroke: var(--ink); stroke-width: 1; }
.label text { fill: var(--ink); font-family: "Archivo", sans-serif; }
.l-brand { font-weight: 900; font-stretch: 125%; font-size: 21px; }
.l-lbl { font-size: 8px; font-weight: 600; font-stretch: 72%; letter-spacing: 0.08em; fill: var(--ink-2) !important; }
.l-no { font-size: 11px; font-weight: 700; }
.l-name { font-size: 15px; font-weight: 700; font-stretch: 90%; }
.l-small { font-size: 9px; font-weight: 500; font-stretch: 85%; }
.l-opt { font-size: 9.5px; font-weight: 500; font-stretch: 85%; }
.l-box { fill: none; stroke: var(--ink); stroke-width: 1; }
.l-tick { fill: none; stroke: var(--red); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.sheet-head { border-bottom: 2px solid var(--ink); padding-bottom: 1.1rem; }
.sheet-no { display: flex; gap: 0.5rem; align-items: baseline; font-weight: 700; font-stretch: 80%; }
.sheet-head h1 { margin-top: 0.4rem; font-weight: 800; font-stretch: 118%; font-size: clamp(2rem, 1.2rem + 2.8vw, 3.6rem); line-height: 0.98; letter-spacing: -0.025em; text-wrap: balance; }
.sheet-notes { margin-top: 0.8rem; font-size: 1.15rem; font-weight: 500; }
.origin { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--rule-2); border-left: 1px solid var(--rule-2); }
.origin > div { padding: 0.6rem 0.8rem 0.75rem; border-right: 1px solid var(--rule-2); border-bottom: 1px solid var(--rule-2); }
.origin > div:last-child:nth-child(odd) { grid-column: 1 / -1; }
.origin dd { margin-top: 0.15rem; font-size: 0.95rem; }

.order { display: grid; gap: 1.25rem; padding: 1.25rem; background: var(--stock-hi); border: 1.5px solid var(--ink); }
.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem 1rem; }
.opts legend { margin-bottom: 0.5rem; }
.opt { position: relative; display: flex; align-items: center; gap: 0.6rem; min-height: 44px; cursor: pointer; font-weight: 500; }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt .box { flex: none; width: 1.45rem; height: 1.45rem; border: 1.5px solid var(--ink); background: var(--stock-hi); display: grid; place-items: center; }
.opt .box svg { width: 1.6rem; height: 1.6rem; overflow: visible; }
.opt .box path { fill: none; stroke: var(--red); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; filter: url(#pencil); }
.opt input:focus-visible + .box { outline: 2.5px solid var(--blue); outline-offset: 3px; }
.opt-price { font-weight: 600; color: var(--ink-2); }
.qty-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--rule-2); padding-top: 1rem; }
.qty { display: inline-grid; grid-template-columns: 44px 2.6rem 44px; border: 1.5px solid var(--ink); }
.qty button { min-height: 44px; background: none; border: 0; cursor: pointer; font-size: 1.15rem; transition: background-color 140ms ease; }
.qty button:active { background: var(--ink); color: var(--stock); }
.qty output { display: grid; place-items: center; font-weight: 700; border-left: 1px solid var(--rule-2); border-right: 1px solid var(--rule-2); }

.card { border-top: 2px solid var(--ink); padding-top: 1rem; }
.card h2 { font-weight: 800; font-stretch: 118%; font-size: 1.25rem; margin-bottom: 1rem; }
.scales { display: grid; gap: 1.6rem; }
.final { margin-top: 1.75rem; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--rule-2); padding-top: 1rem; }
.final-v { position: relative; font-weight: 800; font-stretch: 110%; font-size: 1.9rem; padding: 0 0.6rem; }
.final-v svg { position: absolute; inset: -0.6rem -0.9rem; width: calc(100% + 1.8rem); height: calc(100% + 1.2rem); overflow: visible; pointer-events: none; }
.final-v path { fill: none; stroke: var(--red); stroke-width: 2.4; stroke-linecap: round; vector-effect: non-scaling-stroke; }

/* ---------- The order slip: a carbon pulled off the pad ---------- */

.slip[hidden], .slip-scrim[hidden] { display: none; }
.slip-scrim { position: fixed; inset: 0; z-index: 40; background: rgb(18 20 18 / 0.32); opacity: 0; transition: opacity 320ms ease; }
.slip-scrim.is-open { opacity: 1; }
.slip {
  position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; width: min(29rem, 100vw);
  display: grid; grid-template-rows: auto 1fr; background: var(--stock-2);
  box-shadow: -18px 0 40px rgb(20 30 22 / 0.18);
  transform: translateX(104%) rotate(1.2deg); transform-origin: 100% 0;
  transition: transform 420ms var(--ease-out);
}
.slip::before { /* the perforation it was torn along */
  content: ""; position: absolute; left: -5px; top: 0; bottom: 0; width: 10px;
  background: radial-gradient(circle at 5px 50%, var(--stock-2) 3px, transparent 3.5px) 0 0 / 10px 14px repeat-y;
}
.slip.is-open { transform: none; }
.slip-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem 0.9rem; border-bottom: 2px solid var(--ink); }
.slip-head h2 { font-weight: 800; font-stretch: 118%; font-size: 1.4rem; }
.slip-close { width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 1.5px solid var(--ink); border-radius: 2px; cursor: pointer; }
.slip-close svg { width: 1.1rem; height: 1.1rem; stroke: currentColor; stroke-width: 2; fill: none; }
.slip-close:active { transform: scale(0.97); }
.slip-body { overflow: auto; overscroll-behavior: contain; padding: 0 1.25rem calc(1.5rem + env(safe-area-inset-bottom)); display: grid; align-content: start; gap: 1rem; }
.slip-empty { padding-top: 1.5rem; color: var(--ink-2); }
.lines { border-bottom: 2px solid var(--ink); }
.line { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "what what strike" "qty price price"; gap: 0.6rem 0.75rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--rule-2); transition: opacity 260ms ease; }
.line:last-child { border-bottom: 0; }
.line-what { grid-area: what; display: flex; gap: 0.75rem; align-items: baseline; }
.line-no { font-weight: 700; font-stretch: 75%; }
.line-what h3 { font-size: 1rem; font-weight: 700; }
.line-what p { font-size: 0.85rem; color: var(--ink-2); }
.line-qty { grid-area: qty; justify-self: start; }
.line-price { grid-area: price; justify-self: end; font-weight: 700; }
.line-strike { grid-area: strike; min-height: 44px; padding: 0 0.6rem; background: none; border: 0; cursor: pointer; font-size: 0.72rem; font-weight: 600; font-stretch: 72%; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-2); text-decoration: underline; text-underline-offset: 0.25em; }
.strike { position: absolute; left: 0; right: 0; top: 50%; width: 100%; height: 20px; transform: translateY(-50%); pointer-events: none; overflow: visible; }
.strike path { fill: none; stroke: var(--red); stroke-width: 3; stroke-linecap: round; }
.line.is-struck { opacity: 0.55; }
.slip-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.25rem; font-weight: 800; }
.slip-note { font-size: 0.85rem; color: var(--ink-2); }
.placed { padding-top: 2rem; display: grid; gap: 1rem; justify-items: start; }
.placed h3 { font-weight: 800; font-stretch: 118%; font-size: 1.6rem; line-height: 1.05; }
.stamp {
  justify-self: center; margin: 0.5rem 0 1rem; padding: 0.35rem 0.9rem; border: 3px solid var(--red); border-radius: 4px;
  color: var(--red); font-weight: 900; font-stretch: 125%; text-transform: uppercase; font-size: 1.5rem; letter-spacing: 0.02em;
  transform: rotate(-8deg); mix-blend-mode: multiply; opacity: 0.9;
}
@media (max-width: 47.99em) {
  .slip { top: auto; left: 0; width: 100%; max-height: 88dvh; transform: translateY(104%); border-top: 2px solid var(--ink); box-shadow: 0 -16px 40px rgb(20 30 22 / 0.2); }
  .slip::before { display: none; }
}

/* ---------- Footer ---------- */

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 2rem; padding: 1.25rem var(--gutter) calc(1.5rem + env(safe-area-inset-bottom)); border-top: 2px solid var(--ink); font-size: 0.85rem; color: var(--ink-2); }
.foot a { color: var(--ink); font-weight: 600; }

/* Page changes cross-fade quickly; the sheet itself never moves. */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 220ms; }

@media (prefers-reduced-motion: reduce) {
  .slip, .slip-scrim, .pouch-body, .btn, .bagbtn { transition: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
