/* Pahuncha: a courier waybill stuck on a kraft box. */
:root {
  --kraft: #b88a5a;
  --kraft-dark: #9c7146;
  --paper: #ffffff;
  --ink: #14213d;
  --ink-soft: #4a5570;
  --stamp: #c1121f;
  --tape: rgba(236, 222, 196, 0.78);
  --rule: 1.5px solid var(--ink);
  --font: "Archivo", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-variation-settings: "wdth" 100;
  color: var(--ink);
  line-height: 1.5;
  background-color: var(--kraft);
  /* corrugated-board fibres */
  background-image:
    repeating-linear-gradient(90deg, rgba(0,0,0,.035) 0 2px, transparent 2px 7px),
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.08), transparent 40%);
  min-height: 100vh;
}

a { color: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

/* top bar, printed straight on the box */
.site-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 2rem;
}
.brand {
  font-weight: 800;
  font-variation-settings: "wdth" 125;
  font-size: 1.375rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.site-head nav a {
  font-weight: 600;
  text-underline-offset: 3px;
}

.intro { max-width: 50rem; margin-bottom: 2rem; }
.intro h1 {
  font-size: clamp(2rem, 5.4vw, 3.6rem);
  line-height: 1.02;
  font-weight: 800;
  font-variation-settings: "wdth" 125;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
.intro p { font-size: 1.125rem; margin: 0; max-width: 34rem; }

/* ---------- the waybill ---------- */
.label {
  position: relative;
  background: var(--paper);
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(0,0,0,.25), 0 14px 30px -18px rgba(40,20,0,.55);
  border: var(--rule);
}
.label + .label { margin-top: 2.5rem; }

/* packing tape across the top corner */
.label.taped::before {
  content: "";
  position: absolute;
  top: -14px; left: 8%;
  width: 140px; height: 30px;
  background: var(--tape);
  transform: rotate(-3deg);
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
}

.label-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1rem;
  border-bottom: var(--rule);
}
.label-top strong {
  font-variation-settings: "wdth" 125;
  font-weight: 800;
  font-size: 1.05rem;
}
.barcode {
  width: 168px;
  height: 34px;
  flex: none;
  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 16px);
}

.label-body {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
}
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-right: var(--rule);
}

.field {
  padding: .7rem 1rem .8rem;
  border-bottom: var(--rule);
}
.field:nth-child(odd) { border-right: var(--rule); }
.field.wide { grid-column: 1 / -1; border-right: 0; }
.field:last-child, .field.last-row { border-bottom: 0; }

.field label {
  display: block;
  font-size: .8125rem;
  font-weight: 500;
  font-variation-settings: "wdth" 75;
  color: var(--ink-soft);
  margin-bottom: .2rem;
}
.field .input-row { display: flex; align-items: baseline; gap: .3rem; }
.field .unit { font-weight: 600; color: var(--ink-soft); }
.field input {
  width: 7ch;
  field-sizing: content;
  min-width: 2ch;
  max-width: 100%;
  border: 0;
  border-bottom: 1.5px dashed transparent;
  padding: 0;
  font: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: transparent;
}
.field input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.field input::-webkit-inner-spin-button,
.field input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.field input:hover { border-bottom-color: var(--ink-soft); }
.field input:focus { outline: none; border-bottom-color: var(--stamp); }
.field .hint { font-size: .75rem; color: var(--ink-soft); margin: .15rem 0 0; }

/* result side */
.result {
  position: relative;
  padding: 1.25rem 1.25rem 7rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;
}
.result h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  font-variation-settings: "wdth" 85;
}
.loss {
  font-size: clamp(2.6rem, 6vw, 4rem);
  font-weight: 900;
  font-variation-settings: "wdth" 112;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin: 0;
}
.loss-year { margin: 0; font-weight: 600; }

/* the rubber stamp: the one loud thing on the page */
.stamp {
  position: absolute;
  right: 1.1rem;
  bottom: 1.3rem;
  transform: rotate(-11deg);
  border: 4px solid var(--stamp);
  border-radius: 6px;
  color: var(--stamp);
  padding: .35rem .7rem .3rem;
  font-weight: 900;
  font-variation-settings: "wdth" 125;
  font-size: 1.15rem;
  line-height: 1.05;
  text-align: center;
  opacity: .88;
  mix-blend-mode: multiply;
  /* worn ink */
  -webkit-mask-image: radial-gradient(circle at 30% 40%, #000 60%, rgba(0,0,0,.55) 61%, #000 75%);
          mask-image: radial-gradient(circle at 30% 40%, #000 60%, rgba(0,0,0,.55) 61%, #000 75%);
  pointer-events: none;
}
.stamp small { display: block; font-size: .7rem; font-variation-settings: "wdth" 100; font-weight: 700; }
.stamp.thunk { animation: thunk .42s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes thunk {
  0% { transform: rotate(-11deg) scale(1.7); opacity: 0; }
  70% { transform: rotate(-11deg) scale(.96); opacity: .95; }
  100% { transform: rotate(-11deg) scale(1); opacity: .88; }
}

/* itemised like a courier invoice */
.breakdown {
  width: 100%;
  border-collapse: collapse;
  font-size: .9375rem;
  font-variant-numeric: tabular-nums;
}
.breakdown td { padding: .3rem 0; border-bottom: 1px dotted var(--ink-soft); }
.breakdown td:last-child { text-align: right; font-weight: 700; }
.breakdown tr:last-child td { border-bottom: 0; }
.parcels { margin: 0; color: var(--ink-soft); font-size: .9375rem; }

/* ---------- second label: savings + email ---------- */
.label-pad { padding: 1.5rem 1.25rem; }
.save-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}
.save-grid h2 {
  margin: 0 0 .5rem;
  font-size: 1.5rem;
  line-height: 1.15;
  font-weight: 800;
  font-variation-settings: "wdth" 112;
}
.save-range {
  font-size: 2rem;
  font-weight: 900;
  font-variation-settings: "wdth" 112;
  font-variant-numeric: tabular-nums;
  margin: .25rem 0 .5rem;
}
.save-range small { display: block; font-size: 1rem; font-weight: 600; font-variation-settings: "wdth" 100; }
.muted { color: var(--ink-soft); font-size: .9375rem; }

form.capture { display: grid; gap: .6rem; }
form.capture label { font-weight: 600; }
.capture-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.capture-row input {
  flex: 1 1 14rem;
  font: inherit;
  font-size: 1rem;
  padding: .75rem .8rem;
  border: var(--rule);
  border-radius: 3px;
  color: var(--ink);
}
.btn {
  font: inherit;
  font-weight: 800;
  font-variation-settings: "wdth" 112;
  font-size: 1rem;
  padding: .8rem 1.2rem;
  border: 0;
  border-radius: 3px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { background: #24345c; }
.btn[disabled] { opacity: .6; cursor: wait; }
.form-status { min-height: 1.5em; margin: 0; font-size: .9375rem; }
.form-status.error { color: var(--stamp); font-weight: 600; }

/* ---------- plain sections printed on the box ---------- */
.on-box { margin-top: 3rem; max-width: 44rem; }
.on-box h2 {
  font-size: 1.75rem;
  font-weight: 800;
  font-variation-settings: "wdth" 118;
  line-height: 1.1;
  margin: 0 0 1rem;
}
.on-box ol { padding-left: 1.4rem; margin: 0; }
.on-box li { margin-bottom: .6rem; font-size: 1.0625rem; }
.on-box p { font-size: 1.0625rem; }

.site-foot {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1.5px solid var(--kraft-dark);
  font-size: .875rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ---------- kit page: packing slip ---------- */
.slip-list { list-style: none; margin: 0; padding: 0; }
.slip-list li {
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  gap: .5rem;
  padding: .85rem 1.25rem;
  border-bottom: var(--rule);
}
.slip-list li:last-child { border-bottom: 0; }
.slip-list .qty { font-weight: 800; font-variant-numeric: tabular-nums; }
.slip-list strong { display: block; font-weight: 700; }
.slip-list span { color: var(--ink-soft); font-size: .9375rem; }

.price-row { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; }
.price {
  font-size: 3rem;
  font-weight: 900;
  font-variation-settings: "wdth" 112;
  line-height: 1;
}
.price-later { color: var(--ink-soft); font-size: 1.25rem; font-weight: 600; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .label-body, .save-grid { grid-template-columns: 1fr; }
  .fields { border-right: 0; border-bottom: var(--rule); }
  .stamp { font-size: 1rem; }
  .save-range { font-size: 1.6rem; }
  .barcode { width: 110px; }
}
@media (max-width: 420px) {
  .fields { grid-template-columns: 1fr; }
  .field:nth-child(odd) { border-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .stamp.thunk { animation: none; }
}
