@font-face { font-family: "Marcellus"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/marcellus-400.woff2") format("woff2"); }
@font-face { font-family: "Jost"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/jost-400.woff2") format("woff2"); }
@font-face { font-family: "Jost"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/jost-500.woff2") format("woff2"); }
@font-face { font-family: "Jost"; font-style: italic; font-weight: 400; font-display: swap; src: url("/fonts/jost-400-italic.woff2") format("woff2"); }

:root {
  --lacquer: #0b0a08;
  --brass: #c9a24a;
  --brass-ink: #2a1d05;
  --ivory: #efe6d2;
  --ivory-soft: rgba(239, 230, 210, 0.78);
  --ivory-ink: #1a1610;
  --ivory-ink-soft: #5a5142;
  --oxblood: #5a1a1a;
  --oxblood-bright: #7e2626;
  --display: "Marcellus", "Cochin", "Times New Roman", serif;
  --body: "Jost", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --plate-shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.95), 0 2px 4px -2px rgba(0, 0, 0, 0.8);
  --paper-shadow: 0 24px 44px -20px rgba(0, 0, 0, 0.95);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--lacquer); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--lacquer);
  color: var(--ivory);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--brass); color: var(--lacquer); }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 4px; }
p { margin: 0; }
h1, h2 { margin: 0; font-weight: 400; }
.prose a, .foot a, .replay { color: var(--brass); text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
.prose a:hover, .foot a:hover, .replay:hover { color: var(--ivory); }

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 10;
  padding: 0.5rem 1rem; background: var(--brass); color: var(--lacquer);
  font-family: var(--body); text-decoration: none;
}
.skip:focus { top: 1rem; }

/* ---------- The one component: an engraved brass plate ---------- */
.plate {
  position: relative;
  background: #c9a24a url("/img/brass.webp") var(--bp, 50% 50%) / var(--bs, cover) no-repeat;
  color: var(--brass-ink);
  font-family: var(--display);
  text-transform: uppercase;
  box-shadow: var(--plate-shadow);
}
.cut { filter: url(#engrave); }
.plaque-name, .plate--heading { filter: url(#engrave-deep); }
/* each plate is its own cut of the sheet: grain scale and specular land differently */
.plate--small, .plate--stamp { --bs: 820px auto; }
.plate--heading { --bs: 1100px auto; }
.plate--button { --bs: 900px auto; --bp: 40% 30%; }
.submit { --bp: 70% 75%; }
main > section:nth-of-type(2n) .plate--heading { --bp: 75% 60%; }
main > section:nth-of-type(3n) .plate--heading { --bp: 20% 80%; }
:is(.board-row, .step, .ledger-row):nth-child(3n+1) .plate { --bp: 18% 30%; }
:is(.board-row, .step, .ledger-row):nth-child(3n+2) .plate { --bp: 64% 72%; }
:is(.board-row, .step, .ledger-row):nth-child(3n) .plate { --bp: 86% 20%; }
.plate--heading {
  display: inline-block;
  padding: 0.55rem 1.1rem 0.5rem;
  font-size: clamp(1.1rem, 0.9rem + 1vw, 1.5rem);
  letter-spacing: 0.14em;
  line-height: 1.2;
  margin-bottom: 1.5rem;
}
.plate--small {
  display: inline-block;
  padding: 0.35rem 0.75rem 0.3rem;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  line-height: 1.3;
  white-space: nowrap;
}
.plate--stamp {
  display: inline-block;
  padding: 0.35rem 0.75rem 0.3rem;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  line-height: 1.3;
  white-space: nowrap;
}
.plate--button {
  display: inline-flex; align-items: center; gap: 0.75rem;
  padding: 0.95rem 1.75rem 0.9rem;
  font-size: 1rem;
  letter-spacing: 0.18em;
  line-height: 1.2;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.25s var(--ease-out);
}
.plate--button::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: 0 22px 34px -14px rgba(0, 0, 0, 0.95);
  opacity: 0; transition: opacity 0.25s var(--ease-out);
}
.plate--button:hover { transform: translateY(-1px); color: var(--brass-ink); }
.plate--button:hover::after { opacity: 1; }
.plate--button:active { transform: translateY(1px); }
.plate--button:focus-visible { outline: 2px solid var(--ivory); outline-offset: 4px; }

/* ---------- Door: first viewport ---------- */
.door {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  padding: clamp(2rem, 6vh, 4rem) 1.25rem clamp(2rem, 5vh, 3rem);
  gap: clamp(2rem, 5vh, 3.5rem);
}

.plaque {
  text-align: center;
  padding: clamp(1.75rem, 3.5vw, 2.5rem) clamp(2rem, 5vw, 3.75rem);
  max-width: min(100%, 40rem);
  -webkit-box-reflect: below 4px linear-gradient(transparent 72%, rgba(0, 0, 0, 0.16));
}
.plaque-fittings { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.plaque-rule { fill: none; stroke: #3a2a08; stroke-width: 1.2; filter: url(#engrave); }
.screw { position: absolute; width: 13px; height: 13px; }
.screw--tl { top: 8px; left: 8px; }
.screw--tr { top: 8px; right: 8px; }
.screw--bl { bottom: 8px; left: 8px; }
.screw--br { bottom: 8px; right: 8px; }
.plaque-name {
  font-size: clamp(2rem, 1.2rem + 4.2vw, 4.25rem);
  letter-spacing: 0.14em;
  line-height: 1.05;
  text-wrap: balance;
}
.plaque-line {
  margin-top: 0.9rem;
  font-family: var(--body);
  font-weight: 500;
  text-transform: none;
  font-size: clamp(0.95rem, 0.85rem + 0.5vw, 1.15rem);
  letter-spacing: 0.04em;
  line-height: 1.45;
}

/* ---------- Paper: the slip and the card ---------- */
.paper {
  background: var(--ivory);
  color: var(--ivory-ink);
  box-shadow: var(--paper-shadow);
}

.exchange {
  width: 100%;
  max-width: 58rem;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
  align-self: center;
}
.slip {
  margin: 0;
  position: relative;
  padding: 1.25rem 1.4rem 1.6rem;
  border-top: 1px solid var(--oxblood);
  transform: rotate(-0.6deg);
}
.slip::before { content: ""; position: absolute; left: 0; right: 0; top: 3px; height: 1px; background: var(--oxblood); }
.slip-head {
  display: flex; justify-content: space-between; gap: 1rem;
  font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ivory-ink-soft);
  margin-bottom: 0.9rem;
}
.slip-msg { font-size: 1.15rem; line-height: 1.45; min-height: 4.4em; }
.slip-caret {
  display: none; width: 2px; height: 1em; vertical-align: -0.15em;
  background: var(--oxblood); margin-left: 2px;
}
.slip.is-typing .slip-caret { display: inline-block; animation: caret 1s steps(2, start) infinite; }
.slip-msg--reply {
  min-height: 0;
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  font-size: 1.05rem;
  color: var(--oxblood);
}
.slip-reply-name {
  font-family: var(--display); letter-spacing: 0.1em; text-transform: uppercase;
  font-size: 0.85rem; margin-right: 0.5rem;
}
.slip-note {
  position: absolute; right: 0.9rem; bottom: 0.5rem;
  font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; font-style: italic;
  color: var(--ivory-ink-soft);
}
@keyframes caret { to { opacity: 0; } }

.ledger { list-style: none; margin: 0; padding: 0.25rem 0 0; display: grid; gap: 1.1rem; }
.ledger-row { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; }
.ledger-task { font-size: 1rem; }
.ledger-row .plate--stamp { opacity: 0; transform: scale(1.25); }
.ledger-row.is-handled .plate--stamp { animation: stamp 0.55s var(--ease-out) forwards; }
@keyframes stamp {
  0% { opacity: 0; transform: scale(1.25); }
  55% { opacity: 1; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1); }
}

/* ---------- Bell ---------- */
.door-bell { display: grid; justify-items: center; gap: 0.9rem; }
.bell-icon { width: 1.25rem; height: 1.25rem; }
.bell:hover .bell-icon { animation: ring 0.7s var(--ease-out); transform-origin: 50% 15%; }
@keyframes ring { 0%{rotate:0} 20%{rotate:14deg} 45%{rotate:-11deg} 70%{rotate:6deg} 100%{rotate:0} }
.replay { background: none; border: 0; padding: 0.25rem 0.5rem; font-family: var(--body); font-size: 0.85rem; letter-spacing: 0.04em; cursor: pointer; }

/* ---------- Sections ---------- */
main > section, .foot {
  width: 100%;
  max-width: 44rem;
  margin-inline: auto;
  padding: clamp(3.5rem, 9vh, 6rem) 1.25rem 0;
}
.prose { display: grid; gap: 1.1rem; font-size: 1.1rem; max-width: 62ch; }
.intro { color: var(--ivory-soft); margin-bottom: 1.8rem; max-width: 60ch; }

.board { margin: 0; display: grid; gap: 1.4rem; }
.board-row { display: grid; grid-template-columns: minmax(11rem, 0.8fr) 1.6fr; gap: 1.25rem; align-items: start; }
.board dt { justify-self: stretch; text-align: center; }
.board dd { margin: 0; color: var(--ivory-soft); padding-top: 0.2rem; }
.js .board-row .plate { opacity: 0.7; transition: opacity 0.7s var(--ease-out); }
.js .board-row.is-lit .plate { opacity: 1; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.6rem; }
.step { display: grid; grid-template-columns: 9.5rem 1fr; gap: 1.25rem; align-items: start; }
.step .plate { justify-self: stretch; text-align: center; }
.step p { font-size: 1.08rem; padding-top: 0.2rem; }


/* ---------- The card (form) ---------- */
.card-section { padding-bottom: 1rem; }
.card {
  padding: clamp(1.5rem, 4vw, 2.5rem);
  display: grid; gap: 1.25rem;
}
.field { display: grid; gap: 0.4rem; }
.field label {
  font-family: var(--display); font-size: 0.82rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--oxblood);
}
.field input, .field textarea {
  font: inherit; font-size: 1.05rem;
  color: var(--ivory-ink);
  background: transparent;
  border: 0; border-bottom: 1px solid rgba(26, 22, 16, 0.45);
  border-radius: 0;
  padding: 0.45rem 0.1rem;
  caret-color: var(--oxblood);
  transition: border-color 0.2s;
}
.field textarea { resize: vertical; min-height: 4.5rem; line-height: 1.45; }
.field input::placeholder, .field textarea::placeholder { color: var(--ivory-ink-soft); font-style: italic; }
.field input:focus, .field textarea:focus { outline: none; border-bottom-color: var(--oxblood); border-bottom-width: 2px; }
.field.is-invalid input, .field.is-invalid textarea { border-bottom-color: var(--oxblood-bright); border-bottom-width: 2px; }
.field--trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.card-error { color: var(--oxblood-bright); font-size: 0.95rem; font-style: italic; }
.submit { justify-self: start; }
.submit[disabled] { cursor: progress; }
.submit[disabled] .submit-label { visibility: hidden; }
.submit-busy { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; }
.submit[disabled] .submit-busy { display: flex; animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
.card-fine { font-size: 0.85rem; color: var(--ivory-ink-soft); font-style: italic; }

.received {
  padding: clamp(1.75rem, 4vw, 2.75rem);
  display: grid; gap: 0.75rem; justify-items: start;
  animation: settle 0.6s var(--ease-out);
}
.received:focus { outline: none; }
.received-stamp {
  font-family: var(--display); font-size: 1.1rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--oxblood);
  padding: 0.35rem 0.8rem; border: 2px solid var(--oxblood);
  transform: rotate(-3deg);
}
.received-line { font-size: 1.15rem; }
@keyframes settle { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Foot ---------- */
.foot { padding-top: clamp(3rem, 8vh, 5rem); padding-bottom: 3rem; display: grid; gap: 0.35rem; }
.foot-line { font-size: 0.9rem; color: var(--ivory-soft); }
.foot-line--quiet { font-family: var(--display); letter-spacing: 0.04em; font-size: 0.85rem; color: var(--brass); }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .door { padding-top: 2.25rem; gap: 2rem; grid-template-rows: auto auto auto; min-height: auto; }
  .exchange { grid-template-columns: 1fr; gap: 1.5rem; }
  .slip { transform: none; }
  .slip-msg { min-height: 0; }
  .ledger { padding-top: 0; }
  .board-row { grid-template-columns: 1fr; gap: 0.5rem; }
  .step { grid-template-columns: 1fr; gap: 0.5rem; }
  .step p { font-size: 1.02rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .slip.is-typing .slip-caret { animation: none; }
  .ledger-row .plate--stamp, .ledger-row.is-handled .plate--stamp { animation: none; opacity: 1; transform: none; }
  .js .board-row .plate { opacity: 1; transition: none; }
  .bell:hover .bell-icon { animation: none; }
  .plate--button { transition: none; }
  .received { animation: none; }
  .submit[disabled] .submit-busy { animation: none; }
}
