/* Styles for the real pages of the site (generated from the ledger). */
.topbar nav { font-size: 0.95rem; }
.page { padding-block: 1rem 2rem; }
.page h1 { color: var(--ink); font-size: clamp(2rem, 6vw, 3rem); line-height: 1.1; margin: 0.2rem 0 0.8rem; }
.page__kicker { margin: 0; font-family: var(--font-mono); color: var(--pencil-soft); }
.page__blurb { font-size: 1.2rem; max-width: 40rem; }
.page__note { color: var(--pencil-soft); max-width: 40rem; }
.page-list { list-style: none; padding: 0; display: grid; gap: 0.4rem; grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr)); }
.page-list li { background: var(--card); border: 2px dashed var(--line); border-radius: 10px; padding: 0.55rem 0.8rem; }
.page-list code { display: block; font-family: var(--font-mono); font-size: 0.85rem; color: var(--pencil-soft); }
.page-list li[hidden] { display: none; }

/* Home page: the counter illustration and the letters that will come back. */
.hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; align-items: center; margin-bottom: 1rem; }
@media (min-width: 52rem) { .hero { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }
.hero__art { width: 100%; height: auto; background: var(--card); border: 2.5px solid var(--pencil); border-radius: var(--radius); box-shadow: var(--shadow); }
.page h2 { color: var(--pencil); margin: 2rem 0 0.4rem; }
.letters { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr)); }
.mini-letter {
  position: relative;
  display: grid;
  gap: 0.2rem;
  min-height: 6.4rem;
  padding: 1.5rem 1rem 0.9rem;
  background: var(--card);
  border: 9px solid transparent;
  border-image: repeating-linear-gradient(-45deg, var(--ink) 0 12px, var(--card) 12px 20px, var(--sky) 20px 32px, var(--card) 32px 40px) 9;
  outline: 2.5px solid var(--pencil);
  box-shadow: var(--shadow);
  color: var(--pencil);
  text-decoration: none;
  transition: transform 0.15s var(--ease-out);
}
.mini-letter:hover { transform: translateY(-3px) rotate(-1deg); color: var(--pencil); }
/* The envelope's flap: it lifts when you point at the letter, as if you could peek inside. */
.mini-letter::before {
  content: '';
  position: absolute;
  top: 0;
  left: 18%;
  right: 18%;
  height: 1.15rem;
  background: linear-gradient(#fff6d6, #f5dc95);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: 50% 0;
  transition: transform 0.4s var(--ease-spring);
}
.mini-letter:hover::before, .mini-letter:focus-visible::before { transform: scaleY(-1) translateY(0.1rem); }
.mini-letter:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
.mini-letter__to { font: 1.6rem/1.1 var(--font-hand); overflow-wrap: anywhere; }
.mini-letter__why { font-size: 0.9rem; color: var(--pencil-soft); }
.mini-letter::after {
  content: '404';
  position: absolute;
  top: 0.3rem;
  right: 0.5rem;
  padding: 0.1rem 0.4rem;
  border: 2px double var(--ink);
  border-radius: 999px;
  color: var(--ink);
  font: 700 0.65rem/1.2 var(--font-mono);
  transform: rotate(8deg);
}
.steps { padding-left: 1.2rem; max-width: 42rem; }
.steps li { margin-bottom: 0.4rem; }

/* "Delivered by Mothball": shown once when you arrive through a forwarding note. */
.delivered {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  margin: 0 0 1.2rem;
  padding: 0.7rem 1rem;
  background: #dff1e6;
  border: 2.5px solid var(--pencil);
  border-radius: 12px;
  box-shadow: var(--shadow);
  animation: delivered-in 0.5s var(--ease-spring);
}
.delivered strong { color: #1f5a3c; }
.delivered span { flex: 1 1 14rem; }
@keyframes delivered-in { from { transform: translateY(-14px) rotate(-1deg); opacity: 0; } }

@font-face {
  font-family: 'Patrick Hand';
  src: url('/assets/fonts/patrick-hand-latin-400.woff2') format('woff2');
  font-display: swap;
}

/* ---------- The Dead Letter Office: a museum hall of framed near misses ---------- */
.museum__plaque {
  max-width: 42rem;
  margin: 1.2rem 0 1.6rem;
  padding: 0.9rem 1.1rem;
  background: #fbe59a;
  border: 2.5px solid var(--pencil);
  border-radius: 6px;
  box-shadow: inset 0 0 0 4px #fbe59a, inset 0 0 0 6px #c8962f, var(--shadow);
}
.museum__plaque p { margin: 0.25rem 0; }
.museum__count b { font: 700 1.5rem/1 var(--font-mono); color: var(--ink); }
.museum__rules { font-size: 0.92rem; color: var(--pencil-soft); }
.museum__plaque s, .exhibit__addr s { text-decoration-color: var(--ink); text-decoration-thickness: 2px; }
.exhibits {
  list-style: none;
  margin: 0;
  padding: 1.5rem 0 0.5rem;
  display: grid;
  gap: 2.2rem 1.4rem;
  grid-template-columns: repeat(auto-fill, minmax(min(15.5rem, 100%), 1fr));
}
.exhibit {
  position: relative;
  padding: 1rem 1rem 0.85rem;
  background: var(--card);
  /* A thin gilt frame on a dark wooden one. */
  border: 10px solid #7a4f22;
  box-shadow: inset 0 0 0 2px #e2a33c, 0 6px 0 -2px rgb(54 50 63 / 0.25), 0 14px 22px rgb(120 80 0 / 0.18);
  transform: rotate(var(--tilt, -0.8deg));
}
.exhibit:nth-child(3n + 2) { --tilt: 0.9deg; }
.exhibit:nth-child(3n) { --tilt: -0.3deg; }
/* The nail and the string it hangs from. */
.exhibit::before {
  content: '';
  position: absolute;
  top: -1.55rem;
  left: 50%;
  width: 3.4rem;
  height: 1.3rem;
  transform: translateX(-50%);
  background: linear-gradient(to top right, transparent calc(50% - 1px), #5b5566 50%, transparent calc(50% + 1px)) left / 50% 100% no-repeat,
    linear-gradient(to top left, transparent calc(50% - 1px), #5b5566 50%, transparent calc(50% + 1px)) right / 50% 100% no-repeat;
}
.exhibit::after { content: ''; position: absolute; top: -1.85rem; left: 50%; width: 0.6rem; height: 0.6rem; margin-left: -0.3rem; border-radius: 50%; background: #5b5566; }
.exhibit p { margin: 0; }
.exhibit__no { font: 700 0.75rem/1.2 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); }
.exhibit__addr { margin: 0.35rem 0 0.2rem !important; font: 2rem/1.1 var(--font-hand); overflow-wrap: anywhere; }
.exhibit__note { font-style: italic; }
.exhibit__to { margin-top: 0.35rem !important; font-weight: 700; }
.exhibit__meta { margin-top: 0.45rem !important; padding-top: 0.4rem; border-top: 1px dashed var(--line); font-size: 0.82rem; color: var(--pencil-soft); }
.exhibit--empty { grid-column: 1 / -1; max-width: 32rem; }
/* Point at a frame and it swings on its nail, then settles. */
.exhibit { transform-origin: 50% -1.7rem; }
.exhibit:hover { animation: swing 1.4s var(--ease-out); }
@keyframes swing {
  0% { transform: rotate(var(--tilt, -0.8deg)); }
  18% { transform: rotate(4.5deg); }
  40% { transform: rotate(-3.2deg); }
  62% { transform: rotate(1.8deg); }
  82% { transform: rotate(-0.6deg); }
  100% { transform: rotate(var(--tilt, -0.8deg)); }
}
.exhibit:target { box-shadow: inset 0 0 0 2px #e2a33c, 0 0 0 5px var(--sky), 0 14px 22px rgb(120 80 0 / 0.18); }
.room__try { margin: 1.5rem 0 0.5rem; }

/* ---------- The engine room: machines on one long pipe ---------- */
.engine { list-style: none; margin: 1.5rem 0; padding: 0 0 0 2.4rem; position: relative; max-width: 46rem; counter-reset: machine; }
.engine::before {
  content: '';
  position: absolute;
  left: 0.85rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 0.7rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #8a6a2a, #e2a33c 45%, #8a6a2a);
  box-shadow: inset 0 0 0 1.5px var(--pencil);
}
.machine {
  position: relative;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem 0.95rem;
  background: var(--card);
  border: 2.5px solid var(--pencil);
  border-radius: 12px;
  box-shadow: var(--shadow);
  counter-increment: machine;
}
/* A pressure gauge where each machine joins the pipe. */
.machine::before {
  content: counter(machine);
  position: absolute;
  left: -2.35rem;
  top: 0.8rem;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 2.5px solid var(--pencil);
  border-radius: 50%;
  background: radial-gradient(circle, #fffbea 55%, #fbe59a 56%);
  font: 700 0.8rem/1 var(--font-mono);
  color: var(--ink);
}
.page .machine h2 { margin: 0 0 0.35rem; font-size: 1.15rem; color: var(--ink); display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.6rem; }
.machine__part { font: 700 0.75rem/1.3 var(--font-mono); letter-spacing: 0.04em; color: var(--sky); text-transform: uppercase; }
/* Each machine has a little cog turning in its corner, as long as the page is open. */
.machine::after {
  content: '';
  position: absolute;
  top: 0.7rem;
  right: 0.8rem;
  width: 1.6rem;
  height: 1.6rem;
  background: #c8962f;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10.3 1h3.4l.5 3a8 8 0 0 1 2.2.9l2.5-1.8 2.4 2.4-1.8 2.5a8 8 0 0 1 .9 2.2l3 .5v3.4l-3 .5a8 8 0 0 1-.9 2.2l1.8 2.5-2.4 2.4-2.5-1.8a8 8 0 0 1-2.2.9l-.5 3h-3.4l-.5-3a8 8 0 0 1-2.2-.9l-2.5 1.8-2.4-2.4 1.8-2.5a8 8 0 0 1-.9-2.2l-3-.5v-3.4l3-.5a8 8 0 0 1 .9-2.2L3.1 5.5l2.4-2.4L8 4.9a8 8 0 0 1 2.2-.9zM12 8.5a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10.3 1h3.4l.5 3a8 8 0 0 1 2.2.9l2.5-1.8 2.4 2.4-1.8 2.5a8 8 0 0 1 .9 2.2l3 .5v3.4l-3 .5a8 8 0 0 1-.9 2.2l1.8 2.5-2.4 2.4-2.5-1.8a8 8 0 0 1-2.2.9l-.5 3h-3.4l-.5-3a8 8 0 0 1-2.2-.9l-2.5 1.8-2.4-2.4 1.8-2.5a8 8 0 0 1-.9-2.2l-3-.5v-3.4l3-.5a8 8 0 0 1 .9-2.2L3.1 5.5l2.4-2.4L8 4.9a8 8 0 0 1 2.2-.9zM12 8.5a3.5 3.5 0 1 0 0 7 3.5 3.5 0 0 0 0-7z'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: cog 6s linear infinite;
}
.machine:nth-child(even)::after { animation-direction: reverse; animation-duration: 4.5s; }
.page .machine h2 { padding-right: 2rem; }
@keyframes cog { to { transform: rotate(360deg); } }
.machine p { margin: 0; }
.machine b { color: var(--pencil); font-family: var(--font-mono); }
.machine .is-tick { animation: tick 0.6s var(--ease-out); display: inline-block; }
@keyframes tick { 0% { transform: scale(1.35); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .machine .is-tick, .delivered, .machine::after, .exhibit:hover, .mini-letter::before { animation: none; transition: none; } }
