/* =====================================================================
   Ari's Mailbox page.  Loads after css/style.css and reuses its tokens
   (--u design unit, --cream, --ink, fonts, .card, .card-title …).
   ===================================================================== */

body.mailbox-page { overflow-x: hidden; }          /* the sent envelope slides off the page edge */

/* ---------------------------------------------------------------- header
   Same honeycomb art as the other pages, but (as in the Figma "Mailbox"
   frame) no nav hexagons and no drop shadow; logo + title sit together
   in the middle.                                                        */
.mailbox-header .header-art-wrap { filter: none; }

.mb-brand {
  position: absolute;
  left: 50%;
  top: calc(245 * var(--u));
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: calc(115 * var(--u));
  pointer-events: none;
}
.mb-logo {
  flex: none;
  width: calc(520 * var(--u));
  height: calc(520 * var(--u));
  pointer-events: auto;
  transform-origin: 50% 55%;
  filter: drop-shadow(calc(14 * var(--u)) calc(15 * var(--u)) calc(29 * var(--u)) rgba(0, 0, 0, 0.25)) contrast(1);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.35s ease;
}
.mb-logo img { width: 100%; height: 100%; object-fit: cover; }
.mb-logo:hover,
.mb-logo:focus-visible {
  transform: rotate(-3deg) scale(1.06);
  filter: drop-shadow(calc(22 * var(--u)) calc(26 * var(--u)) calc(40 * var(--u)) rgba(0, 0, 0, 0.32)) contrast(1.15);
  outline: none;
}
.mb-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: calc(112 * var(--u));
  line-height: 0.8976;
  white-space: nowrap;
  color: var(--ink);
  text-shadow: 0 calc(21 * var(--u)) calc(25.5 * var(--u)) rgba(0, 0, 0, 0.23);
  user-select: none;
  -webkit-user-select: none;
}

@media (max-width: 980px) {
  .mb-brand { flex-direction: column; gap: calc(6 * var(--u)); top: calc(265 * var(--u)); }
  .mb-logo { width: calc(280 * var(--u)); height: calc(280 * var(--u)); }
  .mb-title { font-size: calc(72 * var(--u)); text-align: center; }
}

/* ---------------------------------------------------------------- stage */
.mb-page { padding-bottom: calc(160 * var(--u)); }

.mb-stage {
  --cw: min(calc(1500 * var(--u)), 760px);       /* postcard width */
  --ew: calc(var(--cw) * 0.62);                  /* envelope width */
  --eh: calc(var(--ew) / 1.45);                  /* envelope height */
  --paper: #fbf3dc;
  --paper-ink: #3b2800;
  position: relative;
  width: var(--cw);
  margin: 0 auto;
  padding-bottom: 36px;
}
@media (max-width: 980px) {
  .mb-stage {
    --cw: min(92vw, 560px);
    --ew: calc(var(--cw) * 0.84);
    --eh: calc(var(--ew) / 1.3);
  }
}

/* ---------------------------------------------------------------- postcard */
.postcard {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  padding: clamp(20px, 4.2%, 32px) clamp(20px, 4.2%, 32px) clamp(30px, 6.4%, 42px);
  box-sizing: border-box;
  border-radius: 10px;
  color: var(--paper-ink);
  background: var(--paper);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.45), 0 4px 10px rgba(0, 0, 0, 0.3);
  transform-origin: 50% 0;
  z-index: 1;
  font-size: clamp(14px, calc(38 * var(--u)), 18px);
}
/* airmail-style border in honey colours */
.postcard::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 9px;
  background: repeating-linear-gradient(135deg, #e6b03c 0 14px, var(--paper) 14px 22px, #563b00 22px 36px, var(--paper) 36px 44px);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}
/* faint paper grain (uses the same texture as the photo cards) */
.postcard::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: url("../images/textures/print-grain.jpg") 0 0 / 640px 640px;
  mix-blend-mode: soft-light;
  opacity: 0.7;
  pointer-events: none;
}

.pc-body {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: clamp(14px, 3.4%, 28px);
}

.pc-message { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pc-label {
  font-weight: 800;
  font-style: italic;
  font-size: 1.35em;
  margin-bottom: 0.1em;
}
#question {
  --lh: 1.75em;
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  resize: none;
  border: 0;
  border-radius: 6px;
  padding: 0.05em 0.3em;
  font: inherit;
  font-size: 1.05em;
  line-height: var(--lh);
  color: var(--paper-ink);
  background-color: transparent;
  background-image: repeating-linear-gradient(transparent 0, transparent calc(var(--lh) - 2px), rgba(86, 59, 0, 0.32) calc(var(--lh) - 2px), rgba(86, 59, 0, 0.32) var(--lh));
  background-attachment: local;
}
#question::placeholder { color: rgba(59, 40, 0, 0.5); font-style: italic; }
#question:focus { outline: none; box-shadow: 0 0 0 3px rgba(230, 176, 60, 0.85); }
.pc-count { text-align: right; font-size: 0.8em; font-weight: 700; opacity: 0.7; padding-top: 4px; }
.pc-count.is-near { color: #8a3b00; opacity: 1; }

.pc-side {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.7em;
  min-width: 0;
  padding-left: clamp(12px, 3.4%, 24px);
  border-left: 2px solid rgba(86, 59, 0, 0.35);
}
.pc-stamp {
  align-self: flex-end;
  width: clamp(50px, 28%, 78px);
  aspect-ratio: 0.82;
  display: grid;
  place-items: center;
  border: 5px dotted #8a5a0a;
  background: linear-gradient(#f7d03c, #e6b03c);
  transform: rotate(3deg);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.35);
}
.pc-stamp svg { width: 70%; }
.pc-stamp polygon { fill: #563b00; }
.pc-stamp .in { fill: #f7d03c; }

.pc-address { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.55em; margin-top: 0.2em; }
.pc-line {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  padding-bottom: 2px;
  border-bottom: 2px solid rgba(86, 59, 0, 0.4);
}
.pc-line > span, .pc-line > label { font-weight: 800; font-size: 0.9em; opacity: 0.8; flex: none; }
.pc-line strong { font-weight: 800; }
#from {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  color: var(--paper-ink);
  padding: 2px 0;
}
#from::placeholder { color: rgba(59, 40, 0, 0.45); font-weight: 500; }
#from:focus { outline: none; box-shadow: 0 2px 0 0 #e6b03c; }
.pc-hint { margin: 0; font-size: 0.78em; opacity: 0.75; line-height: 1.3; }

.pc-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.pc-send {
  margin-top: auto;
  padding: 0.7em 1em;
  border: 3px solid #ffc23e;
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--cream);
  background: linear-gradient(180deg, #b06600, #4a2b00);
  box-shadow: 0 4px 0 #2a1900, 0 8px 16px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.pc-send:hover { filter: brightness(1.12); transform: translateY(-1px); }
.pc-send:active { transform: translateY(3px); box-shadow: 0 1px 0 #2a1900; }
.pc-send:focus-visible { outline: 3px solid #3b2800; outline-offset: 3px; }
.pc-send[disabled] { cursor: progress; filter: grayscale(0.4) brightness(0.9); }

.pc-fine, .pc-error {
  position: absolute;
  left: clamp(20px, 4.2%, 32px);
  right: clamp(20px, 4.2%, 32px);
  bottom: clamp(10px, 2.2%, 16px);
  margin: 0;
  z-index: 1;
  font-size: 0.74em;
  line-height: 1.2;
}
.pc-fine { opacity: 0.65; }
.pc-error { font-weight: 800; color: #8a1d00; }
.postcard.has-error .pc-fine { display: none; }

@media (max-width: 700px) {
  .postcard { aspect-ratio: auto; font-size: 16px; padding-bottom: 54px; }
  .pc-body { grid-template-columns: 1fr; gap: 14px; }
  #question { min-height: 11.5em; }
  .pc-side { position: static; border-left: 0; padding-left: 0; border-top: 2px solid rgba(86, 59, 0, 0.35); padding-top: 14px; }
  .pc-stamp { position: absolute; top: 24px; right: 26px; width: 40px; }
  .pc-label { min-height: 54px; padding-right: 60px; }
}

/* ---------------------------------------------------------------- envelope */
.envelope {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: var(--ew);
  height: var(--eh);
  margin-left: calc(var(--ew) / -2);
  perspective: 1400px;
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
}
.env-back {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 6px;
  background: linear-gradient(180deg, #a9710f, #8c5a08);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.5);
}
.env-flap {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 56%;
  z-index: 2;
  transform-origin: 50% 0;
  transform: rotateX(180deg);                       /* open */
  transform-style: preserve-3d;
}
.flap-face {
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.flap-out { background: linear-gradient(180deg, #f6d675, #e6ad3c); }
.flap-in  { background: linear-gradient(180deg, #7a4d06, #5f3a03); transform: rotateY(180deg); }

.env-slot { position: absolute; inset: 0; z-index: 3; }
.env-slot .postcard { position: absolute; left: 50%; top: 0; margin-left: calc(var(--cw) / -2); width: var(--cw); transform-origin: 50% 0; box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35); }

.env-front-wrap {
  position: absolute;
  inset: 0;
  z-index: 4;
  filter: drop-shadow(0 -3px 5px rgba(50, 25, 0, 0.35));
}
.env-front {
  position: absolute;
  inset: 0;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(180deg, #f3cf6b, #dca12f);
  clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
}
.fs-wrap {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 56%;
  z-index: 4;
  opacity: 0;
  filter: blur(4px);
  transform: translateY(6px);
}
.fs { position: absolute; inset: 0; background: rgba(50, 25, 0, 0.5); clip-path: polygon(0 0, 100% 0, 50% 100%); }

.env-postage {
  position: absolute;
  right: 6%;
  top: 25%;
  width: 15%;
  aspect-ratio: 0.8;
  z-index: 6;
  opacity: 0;
  display: grid;
  place-items: center;
  border: 5px dotted #fbf3dc;
  background: linear-gradient(#e7b64d, #c98d1b) padding-box;
  transform: rotate(4deg);
}
.env-postage svg { width: 62%; }
.env-postage polygon { fill: #563b00; }
.env-postmark {
  position: absolute;
  right: 15%;
  top: 26%;
  width: 24%;
  z-index: 6;
  opacity: 0;
  fill: none;
  stroke: rgba(70, 40, 0, 0.62);
  stroke-width: 3.2;
  stroke-linecap: round;
  transform: rotate(-9deg);
}
.env-seal {
  position: absolute;
  left: 50%;
  top: 56%;
  z-index: 7;
  width: calc(var(--ew) * 0.17);
  height: calc(var(--ew) * 0.196);
  transform: translate(-50%, -50%);
  opacity: 0;
  display: grid;
  place-items: center;
  clip-path: none;
}
.env-seal::before,
.env-seal::after {
  content: "";
  position: absolute;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.env-seal::before { inset: 0; background: linear-gradient(160deg, #8a5200, #3a2200); }
.env-seal::after { inset: 9%; background: linear-gradient(160deg, #5a3500, #2d1a00); box-shadow: inset 0 0 0 3px #ffc23e; }
.env-seal span {
  position: relative;
  z-index: 1;
  font-family: var(--display);
  font-size: calc(var(--ew) * 0.075);
  color: var(--cream);
  line-height: 1;
}
.env-seal .ripple {
  position: absolute;
  inset: -26%;
  border-radius: 50%;
  border: 3px solid rgba(255, 225, 126, 0.85);
  opacity: 0;
  pointer-events: none;
}

/* ---------------------------------------------------------------- status + answers */
.mb-status { text-align: center; min-height: 1.7em; margin: 10px 0 0; font-weight: 800; }

.mb-answers { width: min(calc(2200 * var(--u)), 920px); margin: calc(120 * var(--u)) auto 0; }
@media (max-width: 980px) { .mb-answers { width: min(92vw, 720px); margin-top: 56px; } }
.mb-answers .card-title { text-align: center; margin-bottom: 0.9em; }
.answers { display: grid; gap: clamp(14px, calc(50 * var(--u)), 26px); }
.answer-card { padding: var(--pad); }
.answer-card .q { margin: 0 0 0.7em; font-weight: 800; font-size: 1.12em; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
.answer-card .q small { display: block; margin-top: 0.3em; font-weight: 600; font-size: 0.72em; opacity: 0.7; }
.answer-card .a { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; padding-left: 0.9em; border-left: 4px solid #e6b03c; }
.answer-card .meta { display: flex; flex-wrap: wrap; gap: 0.4em 1em; margin-top: 0.9em; font-size: 0.8em; opacity: 0.8; }
.answer-card .meta a { font-weight: 800; }
.mb-more {
  display: block;
  margin: 22px auto 0;
  padding: 0.6em 1.4em;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: var(--card);
  color: var(--cream);
  font: inherit;
  font-weight: 800;
  box-shadow: inset 0 0 14px 2px rgba(0, 0, 0, 0.35);
}
.mb-more:hover { background: var(--cream); color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .mb-logo { transition: none; }
}
