/* North Pole Post: an airmail service from the North Pole. */

:root {
  --page: #f5f7f9;
  --paper: #ffffff;
  --ink: #1c2541;
  --muted: #55607a;
  --line: #d9dfe7;
  --spruce: #17392f;
  --red: #c42b2b;
  --navy: #1c2541;
  --brass: #b8913a;
  --blueprint: #1d4a78;
  --on-accent: #ffffff;
  --serif: "Alegreya", Georgia, serif;
  --sans: "Alegreya Sans", system-ui, sans-serif;
  --measure: 66ch;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0d1d18;
    --paper: #14302a;
    --ink: #e9eef2;
    --muted: #a9b7b2;
    --line: #2a4a41;
    --spruce: #2f6b58;
    --red: #e0524f;
    --navy: #8fa3d6;
    --brass: #d6b25e;
    --blueprint: #1d4a78;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #0d1d18; --paper: #14302a; --ink: #e9eef2; --muted: #a9b7b2; --line: #2a4a41;
  --spruce: #2f6b58; --red: #e0524f; --navy: #8fa3d6; --brass: #d6b25e; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 18px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.15; margin: 0; }
h2 { font-size: 2.1rem; font-weight: 800; }
h3 { font-size: 1.45rem; font-weight: 600; }
p { margin: 0 0 0.8em; }
a { color: inherit; text-decoration-color: var(--red); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
[hidden] { display: none !important; }

main { max-width: 1160px; margin: 0 auto; padding: 0 16px; }

/* ------------------------------------------------------------ masthead */
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1160px; margin: 0 auto; padding: 18px 16px;
}
.wordmark {
  font: italic 600 1.5rem var(--serif); text-decoration: none; color: var(--red);
}
.masthead nav { display: flex; gap: 20px; font-size: 0.95rem; }
.masthead nav a { text-decoration: none; color: var(--muted); }
.masthead nav a:hover { color: var(--ink); }

/* ------------------------------------------------------------ buttons */
.btn {
  font: 700 1rem var(--sans); cursor: pointer;
  background: var(--red); color: var(--on-accent);
  border: 0; border-radius: 6px; padding: 12px 20px;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; filter: none; }
.btn-quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }

/* ------------------------------------------------------------ hero */
.hero {
  display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center;
  padding: 48px 0 80px;
}
.hero h1 { font-size: clamp(2.4rem, 5vw, 3.9rem); font-weight: 800; letter-spacing: -0.01em; margin-bottom: 20px; }
.lede { font-size: 1.2rem; color: var(--muted); max-width: 34em; }
.hero-form { margin-top: 28px; max-width: 30em; }
.hero-form label { display: block; font-weight: 700; margin-bottom: 6px; }
.hero-row { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-row input { flex: 1 1 14em; }

input, select {
  font: inherit; color: var(--ink); background: var(--paper);
  border: 2px solid var(--line); border-radius: 6px; padding: 10px 12px; width: 100%;
}
input:focus, select:focus { border-color: var(--brass); outline: none; }

/* The envelope: the one loud thing on the page. */
.envelope {
  position: relative; aspect-ratio: 3 / 2; background: var(--paper); color: var(--ink);
  border: 14px solid transparent;
  border-image: repeating-linear-gradient(-45deg, var(--red) 0 16px, var(--paper) 16px 24px, var(--navy) 24px 40px, var(--paper) 40px 48px) 14;
  box-shadow: 0 30px 60px -30px rgb(23 57 47 / 0.45);
  transform: rotate(-2.5deg);
  padding: 28px 32px;
  animation: arrive 900ms cubic-bezier(0.2, 0.9, 0.25, 1.15) both;
}
@keyframes arrive {
  from { transform: translateY(-40px) rotate(-9deg); opacity: 0; }
  to { transform: rotate(-2.5deg); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .envelope { animation: none; } }
.envelope-stamp {
  position: absolute; top: 18px; right: 22px; width: 96px; height: 118px;
  display: grid; place-items: center; align-content: center; gap: 4px;
  color: var(--on-accent); background: var(--spruce);
  font: 600 0.8rem var(--sans);
  border: 6px solid var(--paper);
  outline: 2px dotted var(--line); outline-offset: -2px;
}
.envelope-postmark {
  position: absolute; top: 58px; right: 92px; width: 110px; height: 110px;
  border: 3px solid var(--navy); border-radius: 50%; opacity: 0.55;
  display: grid; place-content: center; text-align: center; transform: rotate(-14deg);
  font: 700 0.95rem/1.2 var(--serif); color: var(--navy);
}
.envelope-address {
  position: absolute; left: 34%; bottom: 22%; right: 6%;
  font: italic 1.25rem/1.45 var(--serif);
}
.envelope-address p { margin: 0; border-bottom: 1px solid var(--line); }
.envelope-to { font-size: 1.7rem; }
#env-name { font-weight: 600; color: var(--red); }
.envelope-from { position: absolute; left: 32px; top: 28px; font-size: 0.85rem; color: var(--muted); max-width: 19em; }

/* ------------------------------------------------------------ catalogue */
.catalogue { padding: 24px 0 40px; }
.section-lede { color: var(--muted); margin-top: 8px; max-width: 46em; }
.tier { margin-top: 44px; }
.tier-head { display: grid; grid-template-columns: minmax(0, 18em) minmax(0, 1fr); gap: 8px 32px; align-items: baseline; margin-bottom: 18px; border-top: 2px solid var(--ink); padding-top: 14px; }
.tier-head p { margin: 0; color: var(--muted); }
.stamps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }

/* Perforated postage stamp: page-coloured holes punched round a coloured edge. */
.stamp {
  --edge: var(--red);
  padding: 9px;
  background:
    radial-gradient(circle, var(--page) 4.5px, transparent 5px) -7px -7px / 14px 14px,
    var(--edge);
}
.stamp--sleigh { --edge: var(--spruce); }
.stamp--aurora { --edge: var(--navy); }
.stamp-inner {
  background: var(--paper); height: 100%; padding: 18px 18px 20px;
  display: flex; flex-direction: column; gap: 6px;
}
.stamp-denomination { font: 800 0.95rem var(--serif); color: var(--edge); margin: 0; }
.stamp h4 { font-size: 1.35rem; font-weight: 800; }
.stamp-character { font: italic 1rem var(--serif); color: var(--muted); margin: 0; }
.stamp-blurb { font-size: 0.98rem; flex: 1; margin: 6px 0 8px; }
.stamp-includes { font-size: 0.92rem; font-weight: 700; margin: 0 0 14px; }
.tier-head .tier-price { margin: 2px 0 0; font-weight: 700; color: var(--ink); }
.btn-stamp { align-self: flex-start; background: var(--edge); }

/* ------------------------------------------------------------ desk */
.desk {
  position: relative; margin-top: 24px; padding: 32px; scroll-margin-top: 12px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 8px;
}
.desk-close {
  position: absolute; top: 16px; right: 16px; font: 700 0.95rem var(--sans); color: var(--muted);
  background: none; border: 0; cursor: pointer; padding: 6px 8px;
}
.desk-close:hover { color: var(--ink); }
.desk .teaser, .desk input, .desk select { background: var(--page); }
.desk-head { max-width: var(--measure); margin-bottom: 28px; }
.desk-character { font: italic 1.1rem var(--serif); color: var(--red); margin-bottom: 4px; }
#desk-blurb { color: var(--muted); margin-top: 10px; }
.desk-includes { font-weight: 700; margin: 0; }
.desk-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px; align-items: start; }
.order-form .field { margin-bottom: 16px; }
.order-form label { display: block; font-weight: 700; margin-bottom: 5px; }
.optional { font-weight: 400; color: var(--muted); }
.hint { font-size: 0.88rem; color: var(--muted); margin: 4px 0 0; }
.form-error { color: var(--red); font-weight: 700; min-height: 1.2em; }
.fine { font-size: 0.86rem; color: var(--muted); margin-top: 12px; }

.sealed { min-width: 0; }
.sealed-empty {
  border: 2px dashed var(--line); border-radius: 8px; padding: 40px 28px; color: var(--muted);
  text-align: center;
}
dhali-premium { display: block; }
.teaser {
  background: var(--paper); border: 2px solid var(--line); border-radius: 8px; padding: 24px 24px 12px; margin-bottom: 12px;
  position: relative;
}
.teaser-seal {
  position: absolute; top: -18px; right: 22px; width: 64px; height: 64px; border-radius: 50%;
  background: var(--red); color: var(--on-accent);
  display: grid; place-items: center; font: italic 700 0.85rem var(--serif); transform: rotate(10deg);
  box-shadow: inset 0 0 0 4px rgb(255 255 255 / 0.25);
}
.teaser-text { font: italic 1.4rem/1.35 var(--serif); max-width: 22em; padding-right: 60px; }
.result-tools { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ------------------------------------------------------------ the dispatch */
.dispatch {
  background: var(--paper); color: var(--ink); border-radius: 4px;
  padding: clamp(20px, 4vw, 44px); box-shadow: 0 20px 50px -30px rgb(28 37 65 / 0.5);
  font: 1.12rem/1.65 var(--serif);
}
.dispatch-from { font: italic 1.05rem var(--serif); color: var(--red); margin-bottom: 4px; }
.dispatch-head h3 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); font-weight: 800; margin-bottom: 20px; }
.dispatch-text { max-width: var(--measure); }
.dispatch-part { margin-top: 1.3em; }
.dispatch-part h4 { font-size: 1.2rem; font-weight: 800; margin-bottom: 0.3em; }
.dispatch-greeting { font-size: 1.25rem; }
.dispatch-signoff { margin-top: 1.4em; font-style: italic; font-size: 1.2rem; }
.dispatch-line b { font-family: var(--sans); color: var(--red); margin-right: 0.3em; }

.dispatch-media { margin: 0 0 24px; }
.dispatch-media[data-state="pending"], .dispatch-media[data-state="queued"], .dispatch-media[data-state="rendering"] {
  border: 2px dashed var(--line); border-radius: 6px; padding: 18px; color: var(--muted);
}
.dispatch-wait { margin: 0 0 8px; font: italic 1rem var(--serif); }
.dispatch-media img, .dispatch-media video { display: block; width: 100%; height: auto; border-radius: 4px; }
.dispatch-media audio { width: 100%; }
.dispatch-download {
  display: inline-block; margin-top: 8px; padding: 0; border: 0; background: none; cursor: pointer;
  font: 500 0.92rem var(--sans); color: inherit; text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 3px;
}
.dispatch-downloads { margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--line); font: 0.92rem var(--sans); color: var(--muted); }
.dispatch-downloads .btn { margin-bottom: 8px; }
.dispatch-downloads p { margin: 0 0 6px; }
[aria-invalid="true"] { border-color: var(--red); }

/* Layouts by product */
.dispatch--certificate { text-align: center; border: 3px double var(--brass); outline: 10px solid var(--paper); }
.dispatch--certificate .dispatch-text { margin: 0 auto; }
.dispatch--certificate .dispatch-head h3 { color: var(--spruce); }
.dispatch--report .dispatch-part { border-left: 4px solid var(--red); padding-left: 16px; font-family: var(--sans); }
.dispatch--blueprint { background: var(--blueprint); color: #eaf2fb; background-image: linear-gradient(rgb(255 255 255 / 0.07) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 0.07) 1px, transparent 1px); background-size: 24px 24px; }
.dispatch--blueprint .dispatch-from, .dispatch--blueprint .dispatch-downloads { color: #b9d2ee; }
.dispatch--blueprint .dispatch-downloads { border-color: rgb(255 255 255 / 0.25); }
.dispatch--clues .dispatch-part { border: 2px dashed var(--muted); border-radius: 6px; padding: 14px 18px; break-inside: avoid; }
.dispatch--notice .dispatch-head { border-bottom: 6px double var(--brass); margin-bottom: 20px; }
.dispatch--story .dispatch-part p:first-of-type::first-letter { font-size: 2.6em; float: left; line-height: 0.9; margin: 0.06em 0.08em 0 0; color: var(--red); font-weight: 800; }
.dispatch--radio .dispatch-part { font-family: var(--sans); }

@media (min-width: 900px) {
  .dispatch--certificate .dispatch-media--image, .dispatch--notice .dispatch-media--image { max-width: 520px; margin-left: auto; margin-right: auto; }
}

/* ------------------------------------------------------------ how */
.how { padding: 56px 0 72px; border-top: 2px solid var(--ink); }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 28px 0 36px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.steps li { counter-increment: step; }
.steps li::before { content: counter(step); display: block; font: 800 2.4rem var(--serif); color: var(--red); line-height: 1; margin-bottom: 8px; }
.steps h3 { margin-bottom: 6px; }
.steps p { color: var(--muted); }
.notes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; font-size: 0.98rem; }
.notes b { display: block; font-family: var(--serif); font-size: 1.1rem; }

.footer { text-align: center; color: var(--muted); font-size: 0.9rem; padding: 24px 16px 40px; }
.loading { color: var(--muted); font-style: italic; }

/* ------------------------------------------------------------ small screens */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding: 24px 0 56px; }
  .envelope { padding: 18px; }
  .envelope-stamp { width: 66px; height: 82px; top: 10px; right: 12px; }
  .envelope-stamp svg { width: 40px; height: 40px; }
  .envelope-postmark { width: 78px; height: 78px; top: 40px; right: 62px; font-size: 0.75rem; }
  .envelope-address { left: 18px; right: 18px; bottom: 14%; font-size: 1rem; }
  .envelope-to { font-size: 1.25rem; }
  .envelope-from { left: 18px; top: 16px; font-size: 0.75rem; max-width: 11em; }
  .tier-head, .desk-grid, .steps, .notes { grid-template-columns: 1fr; }
  .desk-grid { gap: 28px; }
  .desk { padding: 48px 16px 24px; }
  .masthead nav { gap: 14px; }
}

/* ------------------------------------------------------------ print: the dispatch only */
@media print {
  body { background: #fff; color: #000; }
  .masthead, .hero, .catalogue > h2, .catalogue > .section-lede, .tier, .desk-close, .how, .footer, .order-form, .desk-head, .result-tools,
  dhali-premium > iframe, .dispatch-download, .dispatch-downloads, .dispatch-media--audio, .dispatch-media--video { display: none !important; }
  .desk { padding: 0; margin: 0; border: 0; background: none; }
  .desk-grid { display: block; }
  .dispatch { box-shadow: none; }
  .dispatch--blueprint { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
