/* =============================================================
   Sundry — a tin of small things
   -------------------------------------------------------------
   Direction: a lacquered keepsake tin on a green baize table.
   Deep petrol enamel, aged brass, oxblood wax, card stock.

   The romantic register comes from materials and ornament —
   engraved rules, wax, tape, deckled paper, letterpress depth —
   rather than from script fonts and hearts, which would read as
   greeting-card. Fraunces italic carries the sentiment instead.

   Spend the boldness on the tin. Everything else stays quiet.
   ============================================================= */

:root {
  /* enamel + metal */
  --ink:        #14100E;
  --tin:        #21403B;
  --tin-deep:   #122523;

  --brass:      #B98C3F;
  --brass-lit:  #E8C989;
  --brass-dim:  #8A6526;

  /* paper */
  --card:       #EDE6D6;
  --card-warm:  #F6F0E1;
  --card-deep:  #DED4BE;

  /* the one warm accent: sealing wax */
  --wax:        #8E2F2B;
  --wax-lit:    #B8483C;
  --rose:       #C97A6D;

  --wash:       #9FB0A9;
  --wash-dim:   #728179;

  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body:    "Karla", system-ui, -apple-system, sans-serif;
  --mono:    "DM Mono", ui-monospace, "SF Mono", monospace;

  --step--2: 0.6875rem;
  --step--1: 0.8125rem;
  --step-0:  0.9375rem;
  --step-1:  1.125rem;
  --step-2:  1.5rem;
  --step-3:  2.25rem;
  --step-4:  3.25rem;

  --rule: rgba(20, 16, 14, 0.16);
  --lift:    0 1px 2px rgba(6, 14, 13, 0.24), 0 8px 22px rgba(6, 14, 13, 0.2);
  --lift-lg: 0 2px 5px rgba(6, 14, 13, 0.3), 0 26px 56px rgba(6, 14, 13, 0.4);
  --emboss: inset 0 1px 0 rgba(255, 252, 244, 0.5), inset 0 -1px 0 rgba(20, 16, 14, 0.1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--card);
  background-color: var(--tin-deep);
  background-image:
    radial-gradient(120% 80% at 50% -10%, rgba(90, 130, 120, 0.34), transparent 62%),
    radial-gradient(90% 70% at 50% 110%, rgba(0, 0, 0, 0.5), transparent 60%),
    linear-gradient(180deg, var(--tin) 0%, var(--tin-deep) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* fine grain, so no surface is ever flat colour */
.bg-grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* a brass double rule inset from the edge: the page as a printed plate */
.bg-frame {
  position: fixed;
  inset: 12px;
  z-index: 0;
  pointer-events: none;
  border: 1px solid rgba(185, 140, 63, 0.28);
  box-shadow: inset 0 0 0 3px rgba(20, 16, 14, 0.18), inset 0 0 0 4px rgba(185, 140, 63, 0.13);
}

.view { position: relative; z-index: 1; }
.view[hidden] { display: none; }

.skip { position: absolute; left: -9999px; top: 0; z-index: 99; padding: 10px 16px;
        background: var(--brass); color: var(--ink); font-weight: 700; }
.skip:focus { left: 20px; top: 20px; }

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

/* ---------------------------------------------------------------
   masthead
   --------------------------------------------------------------- */
.masthead {
  display: flex;
  align-items: center;
  gap: 15px;
  max-width: 1140px;
  margin: 0 auto;
  padding: 34px 30px 4px;
}

.mark {
  position: relative;
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  color: var(--brass-lit);
  background: linear-gradient(150deg, rgba(232, 201, 137, 0.16), rgba(0, 0, 0, 0.3));
  border: 1px solid rgba(185, 140, 63, 0.5);
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(232, 201, 137, 0.28), 0 4px 12px rgba(0, 0, 0, 0.3);
}
.mark svg { width: 30px; height: 30px; }

.masthead-text { flex: 1; min-width: 0; }

.wordmark {
  margin: 0;
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: var(--step-3);
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--card-warm);
  font-variation-settings: "SOFT" 48, "WONK" 1;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.tagline {
  margin: 5px 0 0;
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  color: var(--wash);
}

/* ---------------------------------------------------------------
   ornament
   --------------------------------------------------------------- */
.fleuron {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  color: rgba(185, 140, 63, 0.55);
}
.fleuron svg { width: 44px; height: 16px; flex-shrink: 0; }
.fleuron-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(185, 140, 63, 0.45), transparent);
}

/* ---------------------------------------------------------------
   buttons
   --------------------------------------------------------------- */
.brass-btn {
  display: inline-block;
  width: 100%;
  padding: 15px 22px;
  font-family: var(--body);
  font-size: var(--step-0);
  font-weight: 700;
  letter-spacing: 0.015em;
  text-align: center;
  text-decoration: none;
  color: #2A1E06;
  background: linear-gradient(178deg, #F3DCA9 0%, var(--brass-lit) 18%, var(--brass) 62%, #8E6A28 100%);
  border: 1px solid rgba(80, 56, 14, 0.5);
  border-radius: 3px;
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 226, 0.8),
    inset 0 -2px 4px rgba(110, 78, 22, 0.35),
    var(--lift);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.14s ease, box-shadow 0.14s ease;
}
.brass-btn:hover { filter: brightness(1.07) saturate(1.05); }
.brass-btn:active { transform: translateY(1px); box-shadow: inset 0 2px 5px rgba(90, 62, 16, 0.45); }
.brass-btn[disabled] { opacity: 0.42; cursor: not-allowed; filter: grayscale(0.5); }

.ghost-btn {
  display: inline-block;
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: var(--step--1);
  color: var(--card);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(237, 230, 214, 0.24);
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.ghost-btn:hover { background: rgba(232, 201, 137, 0.12); border-color: var(--brass); color: var(--brass-lit); }
.ghost-btn--wide { display: block; width: 100%; text-align: center; }

/* ---------------------------------------------------------------
   bench
   --------------------------------------------------------------- */
.bench {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: 34px;
  align-items: start;
  max-width: 1140px;
  margin: 0 auto;
  padding: 26px 30px 56px;
}

.bay-title {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 4px;
  font-family: var(--mono);
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--brass);
}

.bay-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(185, 140, 63, 0.4), transparent);
}

.bay-sub { margin: 0 0 16px; font-size: var(--step--1); color: var(--wash); }
.bay--tin .bay-title { margin-bottom: 14px; }

/* ---------------------------------------------------------------
   THE TIN
   --------------------------------------------------------------- */
.tin {
  position: relative;
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(0, 0, 0, 0.14)),
    linear-gradient(158deg, #2D544D 0%, #1B3733 55%, #142A27 100%);
  box-shadow:
    inset 0 0 0 1px rgba(237, 230, 214, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -14px 30px rgba(0, 0, 0, 0.3),
    var(--lift-lg);
  overflow: hidden;
}

/* rivets down the sides, so it reads as a made object */
.tin::before,
.tin::after {
  content: "";
  position: absolute;
  top: 96px;
  bottom: 16px;
  width: 5px;
  background-image: radial-gradient(circle, var(--brass-lit) 0 1.4px, rgba(0,0,0,0.35) 1.6px, transparent 2.2px);
  background-size: 5px 26px;
  opacity: 0.5;
  pointer-events: none;
}
.tin::before { left: 5px; }
.tin::after { right: 5px; }

/* lid: brushed metal band */
.tin-lid {
  position: relative;
  padding: 18px 18px 16px;
  background:
    repeating-linear-gradient(93deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, #3E6A61 0%, #2A4C45 52%, #1E3833 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.tin-lid::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(232, 201, 137, 0.5), transparent);
}

/* address plate, screwed on */
.tin-lid-plate {
  position: relative;
  padding: 15px 20px 16px;
  background: linear-gradient(178deg, var(--card-warm) 0%, var(--card) 62%, var(--card-deep) 100%);
  border-radius: 2px;
  box-shadow:
    var(--emboss),
    0 1px 0 rgba(255, 255, 255, 0.25),
    0 8px 18px rgba(0, 0, 0, 0.38);
}

.tin-lid-plate::before,
.tin-lid-plate::after {
  content: "";
  position: absolute;
  top: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, var(--brass-lit), var(--brass-dim) 70%, #5F450F);
  box-shadow: 0 0 0 1px rgba(20, 16, 14, 0.22), inset 0 -1px 1px rgba(0,0,0,0.35);
}
.tin-lid-plate::before { left: 7px; }
.tin-lid-plate::after { right: 7px; }

.stamp-label {
  display: block;
  font-family: var(--mono);
  font-size: var(--step--2);
  font-weight: 500;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: #948D7B;
}
.stamp-label--inside { color: var(--wash-dim); margin-bottom: 6px; letter-spacing: 0.2em; }

.plate-in {
  display: block;
  width: 100%;
  margin: 2px 0 0;
  padding: 2px 0 5px;
  font-family: var(--display);
  font-size: var(--step-2);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px dashed transparent;
  outline: none;
  font-variation-settings: "SOFT" 40, "WONK" 1;
}
.plate-in::placeholder { color: #B3AB98; font-weight: 400; font-style: italic; }
.plate-in:focus { border-bottom-color: var(--wax); }

.plate-rule {
  height: 1px;
  margin: 11px 0 10px;
  background-image: linear-gradient(90deg, var(--rule) 58%, transparent 58%);
  background-size: 8px 1px;
}

.plate-read {
  display: block;
  font-family: var(--display);
  font-size: var(--step-2);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  word-break: break-word;
  font-variation-settings: "SOFT" 40, "WONK" 1;
}

.tin-hinge {
  height: 5px;
  margin: 15px -18px -16px;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.48), rgba(255,255,255,0.07)),
    repeating-linear-gradient(90deg, rgba(232,201,137,0.16) 0 2px, transparent 2px 9px);
}

/* inside */
.tin-body {
  padding: 22px 18px 20px;
  background: linear-gradient(180deg, rgba(0,0,0,0.22), transparent 90px);
}

.tin-msg {
  display: block;
  width: 100%;
  margin-bottom: 18px;
  padding: 12px 13px;
  font-family: var(--display);
  font-style: italic;
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--card-warm);
  background: rgba(0, 0, 0, 0.27);
  border: 1px solid rgba(237, 230, 214, 0.15);
  border-radius: 3px;
  resize: vertical;
  outline: none;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.25);
}
.tin-msg::placeholder { color: #6F817A; }
.tin-msg:focus { border-color: var(--brass); }

.tin-empty {
  margin: 0;
  padding: 30px 14px;
  font-family: var(--mono);
  font-size: var(--step--1);
  text-align: center;
  color: #6E7F78;
  border: 1px dashed rgba(237, 230, 214, 0.2);
  border-radius: 3px;
  background: rgba(0,0,0,0.14);
}

.tin-contents { display: flex; flex-direction: column; gap: 9px; }
.tin-contents:empty { display: none; }

.packed {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 11px;
  background: linear-gradient(178deg, rgba(255,255,255,0.075), rgba(255,255,255,0.03));
  border: 1px solid rgba(237, 230, 214, 0.14);
  border-left: 2px solid rgba(185, 140, 63, 0.55);
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  animation: dropIn 0.34s cubic-bezier(0.2, 1.1, 0.4, 1);
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-10px) rotate(-1.5deg); }
  to { opacity: 1; transform: none; }
}

.packed-chip {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--brass-lit);
  background: radial-gradient(circle at 40% 30%, rgba(232,201,137,0.16), rgba(0,0,0,0.4));
  border: 1px solid rgba(185, 140, 63, 0.3);
  border-radius: 2px;
}
.packed-chip svg { width: 21px; height: 21px; }

.packed-text { flex: 1; min-width: 0; }

.packed-kind {
  display: block;
  font-family: var(--mono);
  font-size: var(--step--2);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass);
}

.packed-desc {
  display: block;
  font-size: var(--step--1);
  color: var(--card);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.packed-acts { display: flex; gap: 3px; flex-shrink: 0; }

.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  color: var(--wash-dim);
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  transition: color 0.14s ease, border-color 0.14s ease;
}
.icon-btn:hover { color: var(--card-warm); border-color: rgba(237,230,214,0.28); }
.icon-btn svg { width: 15px; height: 15px; }

/* ---------------------------------------------------------------
   the brass scale
   --------------------------------------------------------------- */
.scale {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  padding: 14px 17px;
  background: linear-gradient(178deg, rgba(255,255,255,0.05), rgba(0,0,0,0.28));
  border: 1px solid rgba(237, 230, 214, 0.13);
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.scale-face { flex-shrink: 0; width: 96px; }
.scale-face svg { width: 100%; display: block; }
.scale-arc { stroke: rgba(237, 230, 214, 0.26); }
.scale-arc-warn { stroke: var(--wax-lit); opacity: 0.8; }
.scale-pin { fill: var(--brass); }

.scale-needle {
  stroke: var(--brass-lit);
  transform-origin: 60px 56px;
  transform: rotate(-90deg);
  transition: transform 0.6s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.scale-read { min-width: 0; }

.scale-num {
  font-family: var(--display);
  font-size: var(--step-3);
  font-weight: 600;
  line-height: 0.9;
  color: var(--card-warm);
}

.scale-unit { font-family: var(--mono); font-size: var(--step--1); color: var(--wash); margin-left: 4px; }
.scale-note { margin: 6px 0 0; font-size: var(--step--1); line-height: 1.4; color: var(--wash); }
.scale.is-heavy .scale-note { color: var(--rose); }
.scale.is-heavy .scale-needle { stroke: var(--wax-lit); }

/* ---------------------------------------------------------------
   the tray
   --------------------------------------------------------------- */
.tray {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin-bottom: 24px;
}

.tray-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  text-align: left;
  color: var(--card);
  background: linear-gradient(178deg, rgba(255,255,255,0.08), rgba(255,255,255,0.025));
  border: 1px solid rgba(237, 230, 214, 0.15);
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.tray-item:hover {
  transform: translateY(-2px);
  border-color: rgba(185, 140, 63, 0.75);
  background: linear-gradient(178deg, rgba(232,192,126,0.16), rgba(255,255,255,0.035));
  box-shadow: 0 6px 16px rgba(0,0,0,0.28);
}

.tray-icon {
  flex-shrink: 0;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  color: var(--brass-lit);
}
.tray-icon svg { width: 26px; height: 26px; }

.tray-name { display: block; font-size: var(--step-0); font-weight: 700; line-height: 1.2; }
.tray-hint { display: block; font-size: 11.5px; line-height: 1.3; color: var(--wash); }

/* ---------------------------------------------------------------
   dispatch + colophon
   --------------------------------------------------------------- */
.dispatch {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  background: linear-gradient(178deg, rgba(255,255,255,0.05), rgba(0,0,0,0.26));
  border: 1px solid rgba(237, 230, 214, 0.13);
  border-radius: 4px;
}

.dispatch-note {
  margin: 3px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--wash-dim);
  text-align: center;
}

.colophon { max-width: 1140px; margin: 0 auto; padding: 0 30px 46px; }
.colophon p {
  margin: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--wash-dim);
  max-width: 60ch;
}

.credit {
  margin-top: 12px !important;
  font-family: var(--body) !important;
  font-size: var(--step--1) !important;
  color: var(--wash) !important;
}
.credit a { color: var(--brass-lit); text-decoration: none; border-bottom: 1px solid rgba(232,201,137,0.4); }
.credit a:hover { border-bottom-color: var(--brass-lit); }

.credit-tip {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 15px;
  font-family: var(--mono);
  font-size: var(--step--1);
  color: var(--brass-lit);
  text-decoration: none;
  border: 1px solid rgba(185, 140, 63, 0.5);
  border-radius: 3px;
}
.credit-tip:hover { background: rgba(232, 201, 137, 0.12); }

/* ---------------------------------------------------------------
   sheet
   --------------------------------------------------------------- */
.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(6, 14, 13, 0.66);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade 0.18s ease;
}
.sheet-scrim[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  width: min(580px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(178deg, var(--card-warm) 0%, var(--card) 70%, var(--card-deep) 100%);
  border-radius: 10px 10px 0 0;
  box-shadow: var(--lift-lg), inset 0 1px 0 rgba(255,255,255,0.6);
  animation: rise 0.28s cubic-bezier(0.2, 1, 0.4, 1);
}
@keyframes rise { from { transform: translateY(28px); opacity: 0; } to { transform: none; opacity: 1; } }

.sheet-grip { width: 40px; height: 4px; margin: 10px auto 0; border-radius: 2px; background: rgba(20,16,14,0.2); }

.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--rule);
}

.sheet-title {
  flex: 1;
  margin: 0;
  font-family: var(--display);
  font-size: var(--step-2);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  font-variation-settings: "SOFT" 44, "WONK" 1;
}

.sheet-close {
  width: 34px; height: 34px;
  flex-shrink: 0;
  font-size: 14px;
  color: var(--ink);
  background: none;
  border: 1px solid var(--rule);
  border-radius: 3px;
  cursor: pointer;
}
.sheet-close:hover { background: rgba(20,16,14,0.07); }

.sheet-body { padding: 18px 20px 22px; overflow-y: auto; color: var(--ink); }

/* forms */
.f-row { margin-bottom: 15px; }

.f-label {
  display: block;
  margin-bottom: 5px;
  font-family: var(--mono);
  font-size: var(--step--2);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #857E6C;
}

.f-in, .f-area, .f-sel {
  display: block;
  width: 100%;
  padding: 11px 12px;
  font-family: var(--body);
  font-size: var(--step-0);
  color: var(--ink);
  background: #FFFCF3;
  border: 1px solid rgba(20, 16, 14, 0.2);
  border-radius: 3px;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(20,16,14,0.07);
}
.f-in:focus, .f-area:focus, .f-sel:focus {
  border-color: var(--wax);
  box-shadow: 0 0 0 3px rgba(142, 47, 43, 0.14), inset 0 1px 2px rgba(20,16,14,0.07);
}
.f-area { min-height: 120px; resize: vertical; line-height: 1.6; }

.f-help { margin: 6px 0 0; font-size: 12px; line-height: 1.45; color: #857E6C; }
.f-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.f-actions { display: flex; gap: 10px; margin-top: 20px; }
.f-actions .brass-btn { flex: 2; }

.f-cancel {
  flex: 1;
  padding: 15px 16px;
  font-family: var(--body);
  font-size: var(--step-0);
  font-weight: 700;
  color: var(--ink);
  background: none;
  border: 1px solid rgba(20,16,14,0.28);
  border-radius: 3px;
  cursor: pointer;
}
.f-cancel:hover { background: rgba(20,16,14,0.06); }

.f-err {
  margin: 12px 0 0;
  padding: 10px 12px;
  font-size: 12.5px;
  color: #5F1C15;
  background: rgba(142, 47, 43, 0.1);
  border-left: 2px solid var(--wax);
}
.f-err[hidden] { display: none; }

/* repeatable lines */
.line-host { margin-bottom: 8px; }
.line-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.line-row .f-in { flex: 1; }

.line-bullet { flex-shrink: 0; width: 5px; height: 5px; border-radius: 50%; background: var(--brass); }

.line-del {
  width: 40px; flex-shrink: 0;
  color: var(--ink);
  background: none;
  border: 1px solid rgba(20,16,14,0.18);
  border-radius: 3px;
  cursor: pointer;
}
.line-del:hover { background: rgba(142,47,43,0.1); border-color: var(--wax); }

.line-add {
  padding: 9px 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink);
  background: none;
  border: 1px dashed rgba(20,16,14,0.3);
  border-radius: 3px;
  cursor: pointer;
}
.line-add:hover { border-color: var(--wax); color: var(--wax); }

/* photo + doodle */
.drop {
  display: grid; place-items: center; gap: 8px;
  padding: 32px 16px;
  text-align: center;
  background: #FFFCF3;
  border: 1px dashed rgba(20,16,14,0.3);
  border-radius: 3px;
  cursor: pointer;
}
.drop:hover { border-color: var(--wax); }
.drop svg { width: 32px; height: 32px; color: #9C9583; }
.drop-txt { font-size: 13px; color: #857E6C; }

.shot-prev {
  display: block; width: 100%;
  max-height: 240px; object-fit: contain;
  background: var(--card-deep);
  border-radius: 3px;
}

.pad {
  display: block; width: 100%; height: auto;
  aspect-ratio: 300 / 210;
  background: #FFFCF3;
  background-image:
    linear-gradient(rgba(33, 64, 59, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(33, 64, 59, 0.12) 1px, transparent 1px);
  background-size: 15px 15px;
  border: 1px solid rgba(20,16,14,0.2);
  border-radius: 3px;
  touch-action: none;
  cursor: crosshair;
}

.pad-tools { display: flex; align-items: center; gap: 8px; margin-top: 10px; }

.swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.22);
  cursor: pointer;
}
.swatch[aria-pressed="true"] { border-color: var(--ink); }

.pad-undo {
  margin-left: auto;
  padding: 7px 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  background: none;
  border: 1px solid rgba(20,16,14,0.26);
  border-radius: 3px;
  cursor: pointer;
}

.link-out {
  display: block; width: 100%;
  padding: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  background: #FFFCF3;
  border: 1px solid rgba(20,16,14,0.2);
  border-radius: 3px;
  word-break: break-all;
}

.link-steps { margin: 16px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.65; color: #5C564A; }
.link-steps li { margin-bottom: 5px; }

/* ---------------------------------------------------------------
   recipient
   --------------------------------------------------------------- */
.view--recipient {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 40px 24px 48px;
}

.stage { width: min(660px, 100%); }
.sealed { text-align: center; }

.sealed-eyebrow {
  margin: 0 0 22px;
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brass);
}

.tin--sealed { max-width: 430px; margin: 0 auto 40px; animation: breathe 6s ease-in-out infinite; }

@keyframes breathe {
  0%, 100% { transform: translateY(0) rotate(-0.3deg); }
  50% { transform: translateY(-7px) rotate(0.3deg); }
}

.tin-lid--closed { padding: 26px 24px 30px; }
.tin-lid-plate--read { padding: 20px 22px 21px; text-align: left; }

.wax {
  position: absolute;
  left: 50%;
  bottom: -20px;
  transform: translateX(-50%) rotate(-6deg);
  width: 62px; height: 62px;
  display: grid; place-items: center;
  border-radius: 48% 52% 50% 50% / 52% 48% 52% 48%;
  background: radial-gradient(circle at 34% 28%, var(--wax-lit), var(--wax) 52%, #5E1B16 100%);
  box-shadow: 0 4px 10px rgba(0,0,0,0.4), inset 0 -3px 7px rgba(0,0,0,0.35), inset 0 2px 4px rgba(255,180,160,0.2);
}

.wax span {
  font-family: var(--display);
  font-size: 27px;
  font-weight: 700;
  color: rgba(255, 233, 220, 0.78);
  text-shadow: 0 1px 1px rgba(0,0,0,0.35);
}

.brass-btn--open { max-width: 320px; margin: 26px auto 0; }
.brass-btn--own { max-width: 300px; margin: 0 auto 14px; }

.tin--opening .tin-lid { animation: lidOff 0.9s cubic-bezier(0.5, 0, 0.3, 1) forwards; }
.tin--opening .wax { animation: waxCrack 0.3s ease forwards; }

@keyframes waxCrack { to { transform: translateX(-50%) rotate(-30deg) scale(0.85); opacity: 0; } }

@keyframes lidOff {
  35% { transform: translateY(-14px) rotate(-1.2deg); }
  100% { transform: translateY(-180px) rotate(-10deg); opacity: 0; }
}

.opened-msg {
  max-width: 44ch;
  margin: 0 auto 34px;
  font-family: var(--display);
  font-size: var(--step-3);
  font-weight: 400;
  font-style: italic;
  line-height: 1.3;
  text-align: center;
  color: var(--card-warm);
  font-variation-settings: "SOFT" 70, "WONK" 1;
  text-shadow: 0 1px 0 rgba(0,0,0,0.3);
}

/* the felt tray the objects sit in */
.felt {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 16px;
  padding: 24px 20px;
  background:
    radial-gradient(130% 100% at 50% 0%, rgba(0,0,0,0.14), rgba(0,0,0,0.4)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23f)' opacity='0.28'/%3E%3C/svg%3E");
  border-radius: 6px;
  box-shadow:
    inset 0 0 0 1px rgba(237,230,214,0.1),
    inset 0 0 0 4px rgba(0,0,0,0.18),
    inset 0 4px 18px rgba(0,0,0,0.4);
}

.thing {
  position: relative;
  padding: 0;
  color: var(--ink);
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0;
  animation: lift 0.55s cubic-bezier(0.2, 1, 0.4, 1) forwards;
  transition: transform 0.18s ease, filter 0.18s ease;
}
.thing:hover { transform: translateY(-5px) rotate(0deg) scale(1.02) !important; filter: brightness(1.03); }

@keyframes lift {
  from { opacity: 0; transform: translateY(22px) scale(0.93); }
  to { opacity: 1; }
}

/* card stock with a deckled bottom edge */
.thing-face {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  min-height: 132px;
  padding: 15px 14px 16px;
  text-align: left;
  background: linear-gradient(178deg, var(--card-warm) 0%, var(--card) 68%, var(--card-deep) 100%);
  border-radius: 2px;
  box-shadow:
    var(--emboss),
    0 2px 5px rgba(0,0,0,0.28),
    0 14px 26px rgba(0,0,0,0.24);
}

.thing-face::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background-image: radial-gradient(circle at 3px -1px, transparent 3px, var(--card-deep) 3.2px);
  background-size: 6px 6px;
  opacity: 0.55;
}

.thing-kind {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #948D7B;
}

.thing-title {
  font-family: var(--display);
  font-size: var(--step-1);
  font-weight: 600;
  line-height: 1.22;
  color: var(--ink);
  font-variation-settings: "SOFT" 40, "WONK" 1;
}

.thing-peek {
  font-size: 12px;
  line-height: 1.45;
  color: #6E6759;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.thing-icon { margin-top: auto; align-self: flex-end; color: var(--wax); opacity: 0.5; }
.thing-icon svg { width: 21px; height: 21px; display: block; }

.thing-shot {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--card-deep);
  box-shadow: inset 0 0 0 1px rgba(20,16,14,0.12);
}

/* photo and doodle become polaroids */
.thing--shot .thing-face,
.thing--draw .thing-face { padding: 11px 11px 13px; gap: 9px; }
.thing--shot .thing-title,
.thing--draw .thing-title {
  font-size: var(--step--1);
  font-style: italic;
  font-weight: 400;
  text-align: center;
  color: #6E6759;
}

/* a strip of tape holding them down */
.tape {
  position: absolute;
  top: -8px; left: 50%;
  transform: translateX(-50%) rotate(-2.5deg);
  width: 58px; height: 17px;
  background: linear-gradient(178deg, rgba(240, 232, 205, 0.85), rgba(222, 212, 182, 0.8));
  box-shadow: 0 1px 2px rgba(0,0,0,0.18);
  opacity: 0.9;
}
.tape::before, .tape::after {
  content: "";
  position: absolute; top: 0; bottom: 0; width: 3px;
  background-image: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.06) 40%);
}
.tape::before { left: 0; }
.tape::after { right: 0; }

/* an "open when" stays sealed on the felt */
.thing--openwhen .thing-face {
  align-items: center;
  justify-content: center;
  text-align: center;
  background: linear-gradient(178deg, #F3EBD8, #E2D8C0);
}
.thing--openwhen .thing-title { text-align: center; }

.thing-wax {
  width: 30px; height: 30px;
  margin-top: 8px;
  border-radius: 48% 52% 50% 50% / 52% 48% 52% 48%;
  background: radial-gradient(circle at 34% 28%, var(--wax-lit), var(--wax) 55%, #5E1B16);
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.3);
}

.thing-opened .thing-face { box-shadow: 0 0 0 2px var(--brass), 0 14px 26px rgba(0,0,0,0.24); }

.opened-foot { margin-top: 36px; text-align: center; }
.opened-foot .fleuron { justify-content: center; }
.opened-foot p { margin: 0 0 18px; font-family: var(--mono); font-size: var(--step--1); color: var(--wash); }

/* ---------------------------------------------------------------
   the full view of one thing
   --------------------------------------------------------------- */
.full { color: var(--ink); }

.full-kind {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: var(--step--2);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--wax);
}

.full-body { margin: 0; font-size: var(--step-0); line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.full-shot { display: block; width: 100%; border-radius: 3px; background: var(--card-deep); }
.full-cap { margin: 12px 0 0; font-family: var(--display); font-style: italic; font-size: var(--step-0); color: #6E6759; }
.full-list { margin: 0 0 18px; padding-left: 22px; font-size: var(--step-0); line-height: 1.75; }
.full-list li::marker { color: var(--wax); }

.full-link {
  display: inline-block;
  margin-top: 16px;
  padding: 11px 18px;
  font-family: var(--body);
  font-weight: 700;
  font-size: 13.5px;
  color: #2A1E06;
  text-decoration: none;
  background: linear-gradient(178deg, var(--brass-lit), var(--brass));
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255,248,226,0.7);
}

.full-doodle {
  display: block; width: 100%;
  background: #FFFCF3;
  background-image:
    linear-gradient(rgba(33,64,59,0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(33,64,59,0.1) 1px, transparent 1px);
  background-size: 15px 15px;
  border-radius: 3px;
}

/* letter */
.letter { padding: 4px 2px; }
.letter-open, .letter-sign {
  margin: 0;
  font-family: var(--display);
  font-style: italic;
  font-size: var(--step-1);
  color: var(--ink);
}
.letter-open { margin-bottom: 14px; }
.letter-sign { margin-top: 18px; text-align: right; }
.letter-body { margin: 0; font-size: var(--step-0); line-height: 1.8; white-space: pre-wrap; }

/* voucher */
.voucher {
  padding: 24px 20px;
  text-align: center;
  background: repeating-linear-gradient(135deg, #FFFCF3 0 10px, #F4EDDC 10px 20px);
  border: 2px dashed var(--wax);
  border-radius: 4px;
}
.voucher-good { font-family: var(--mono); font-size: var(--step--2); letter-spacing: 0.24em; text-transform: uppercase; color: var(--wax); }
.voucher-what { margin: 10px 0 0; font-family: var(--display); font-size: var(--step-3); font-weight: 600; line-height: 1.2; }
.voucher-fine { margin: 14px 0 0; font-family: var(--mono); font-size: 11px; color: #857E6C; }

/* quote */
.quote-body {
  margin: 0;
  padding-left: 18px;
  border-left: 2px solid var(--wax);
  font-family: var(--display);
  font-style: italic;
  font-size: var(--step-2);
  line-height: 1.45;
  white-space: pre-wrap;
}
.quote-who { margin: 14px 0 0; font-family: var(--mono); font-size: var(--step--1); color: #857E6C; }

/* countdown */
.count-face {
  display: grid; gap: 7px;
  padding: 26px 20px;
  text-align: center;
  background: #FFFCF3;
  border: 1px solid rgba(20,16,14,0.16);
  border-radius: 4px;
}
.count-days { font-family: var(--display); font-size: var(--step-4); font-weight: 600; line-height: 1; color: var(--wax); }
.count-what { font-size: var(--step-1); color: var(--ink); }
.count-date { font-family: var(--mono); font-size: var(--step--1); color: #857E6C; }

/* joke */
.punch { margin-top: 18px; }
.punch-btn {
  padding: 11px 18px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  background: none;
  border: 1px dashed rgba(20,16,14,0.32);
  border-radius: 3px;
  cursor: pointer;
}
.punch-btn:hover { border-color: var(--wax); color: var(--wax); }
.punch-line {
  margin: 0;
  font-family: var(--display);
  font-size: var(--step-2);
  font-weight: 600;
  line-height: 1.3;
  color: var(--wax);
  animation: rise 0.3s ease;
}

/* recipe + playlist */
.recipe-head {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: var(--step--2);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--wax);
}
.track-list { margin: 0; padding-left: 22px; font-size: var(--step-0); line-height: 1.9; }
.track-list li::marker { font-family: var(--mono); font-size: 12px; color: var(--wax); }

/* invitation */
.invite-face { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 4px 0; }
.invite-line { display: flex; gap: 14px; align-items: baseline; margin: 0; padding: 11px 0; font-size: var(--step-0); }
.invite-line + .invite-line { border-top: 1px solid var(--rule); }
.invite-line span {
  flex-shrink: 0; width: 56px;
  font-family: var(--mono);
  font-size: var(--step--2);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #857E6C;
}

/* broken */
.broken { max-width: 440px; margin: 0 auto; text-align: center; }
.broken-mark { color: var(--brass); opacity: 0.45; margin-bottom: 16px; }
.broken-mark svg { width: 52px; height: 52px; }
.broken h2 { margin: 0 0 12px; font-family: var(--display); font-size: var(--step-3); font-weight: 600; color: var(--card-warm); }
.broken p { margin: 0 0 26px; color: var(--wash); }
.broken .brass-btn { max-width: 280px; margin: 0 auto; }

/* toast */
.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  z-index: 90;
  transform: translate(-50%, 20px);
  padding: 12px 20px;
  font-family: var(--mono);
  font-size: 13px;
  color: #2A1E06;
  background: linear-gradient(178deg, var(--brass-lit), var(--brass));
  border-radius: 3px;
  box-shadow: var(--lift);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.noscript { max-width: 460px; margin: 70px auto; padding: 0 24px; text-align: center; }
.noscript h1 { font-family: var(--display); font-size: var(--step-3); margin: 0 0 12px; }

/* ---------------------------------------------------------------
   responsive
   --------------------------------------------------------------- */
@media (max-width: 900px) {
  .bench { grid-template-columns: 1fr; gap: 30px; }
}

@media (max-width: 620px) {
  :root { --step-2: 1.32rem; --step-3: 1.85rem; --step-4: 2.4rem; }
  .bg-frame { inset: 7px; }
  .masthead { padding: 22px 18px 4px; flex-wrap: wrap; gap: 12px; }
  .masthead .ghost-btn { order: 3; width: 100%; text-align: center; }
  .mark { width: 42px; height: 42px; }
  .mark svg { width: 25px; height: 25px; }
  .bench { padding: 18px 18px 44px; }
  .colophon { padding: 0 18px 34px; }
  .tray { grid-template-columns: 1fr; }
  .view--recipient { padding: 26px 16px 36px; }
  .felt { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; padding: 16px 13px; }
  .sheet { max-height: 94vh; }
  .f-two { grid-template-columns: 1fr; }
  .tin::before, .tin::after { display: none; }
}

@media (min-width: 621px) {
  .sheet-scrim { align-items: center; padding: 28px; }
  .sheet { border-radius: 8px; }
  .sheet-grip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
