/* The Magic Mailroom: "Made for Ian". The plaque's tap target in the room, and the quiet letter it opens.
   Shared by the Mailroom (index.html) and the classic calendar (north-pole-post.html). */

/* ---- the plaque's button: invisible, laid over the brass plate in the 3D room ----------------------------------- */
#hud > .ianPlaque { position: absolute; left: 0; top: 0; z-index: 1; margin: 0; padding: 0; border: 0; border-radius: 10px; background: transparent;
  cursor: pointer; transform-origin: 0 0; pointer-events: auto; -webkit-tap-highlight-color: transparent; }
#hud > .ianPlaque:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 7px rgba(255, 214, 110, .55); }
#hud.busy > .ianPlaque { pointer-events: none; }
.ianSr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* ---- the letter ------------------------------------------------------------------------------------------------- */
html.ianOpen, html.ianOpen body { overflow: hidden; }
.ianDialog { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent;
  color: #2d2117; overflow: hidden; }
.ianDialog::backdrop { background: rgba(5, 6, 26, .74); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.ianScroll { position: absolute; inset: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y;
  display: flex; flex-direction: column; align-items: center; box-sizing: border-box;
  padding: max(18px, env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) max(26px, env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px)); }
.ianPaper { --pad: clamp(20px, 5.4vw, 56px); position: relative; box-sizing: border-box; width: min(660px, 100%); margin: auto 0; padding: 0 var(--pad) clamp(26px, 4.6vw, 48px);
  border-radius: 6px; color: #2d2117;
  background: radial-gradient(ellipse at 50% 0%, #fffaf0 0%, #fbf3e1 55%, #f3e6c8 100%);
  box-shadow: 0 0 0 1px rgba(160, 120, 50, .35), inset 0 0 0 7px #fbf3e1, inset 0 0 0 8px rgba(200, 154, 58, .55), 0 24px 60px rgba(0, 0, 0, .55); }
.ianDialog.in .ianPaper { animation: ianIn .45s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes ianIn { from { opacity: 0; transform: translateY(16px) scale(.985); } }

/* Back to the Mailroom: always in reach, it rides along at the top of the letter */
.ianBar { position: sticky; top: 0; z-index: 2; margin: 9px calc(9px - var(--pad)) 0; padding: 6px calc(var(--pad) - 15px) 14px;
  background: linear-gradient(#fcf6e8 72%, rgba(251, 243, 225, 0)); border-radius: 4px 4px 0 0; }
.ianBack { display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 0 18px 0 10px; border-radius: 999px; cursor: pointer;
  font: 700 16px/1 'Chakra Petch', system-ui, sans-serif; letter-spacing: .03em; color: #ffe39a;
  border: 2px solid transparent; background: linear-gradient(#1b2a66, #0d1640) padding-box, linear-gradient(150deg, #fff6c4, #ffd45a 35%, #e8962a 65%, #fff6c4) border-box;
  box-shadow: 0 3px 0 rgba(40, 20, 0, .45), 0 6px 14px rgba(0, 0, 0, .2); transition: transform .12s, filter .12s; }
.ianBack svg { width: 22px; height: 22px; flex: none; }
.ianBack:hover { filter: brightness(1.15); transform: translateY(-1px); }
.ianBack:active { transform: translateY(2px); }
.ianBack:focus-visible { outline: 3px solid #14204a; outline-offset: 3px; }

.ianRobin { position: absolute; z-index: 1; right: clamp(8px, 3vw, 26px); top: clamp(62px, 9vw, 70px); width: clamp(70px, 16vw, 104px); height: auto; pointer-events: none;
  filter: drop-shadow(0 4px 5px rgba(60, 30, 10, .3)); transform: scaleX(-1); }
.ianTitle { margin: clamp(6px, 2vw, 18px) 0 clamp(14px, 2.4vw, 22px); padding-right: clamp(60px, 14vw, 96px); font: 600 clamp(34px, 7.4vw, 54px)/1.05 Fraunces, Georgia, serif;
  color: #14204a; letter-spacing: -.005em; }
.ianTitle:focus { outline: none; }
.ianLetter p, .ianGive p { margin: 0 0 1em; font: 400 clamp(17px, 2.3vw, 19.5px)/1.62 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  text-wrap: pretty; hyphens: manual; }
.ianNb { white-space: nowrap; }
.ianSign { margin: .2em 0 0 !important; font: 600 clamp(38px, 7vw, 48px)/1 Caveat, cursive !important; color: #7a1a14; transform: rotate(-3deg); transform-origin: 0 50%; }

.ianRule { display: flex; align-items: center; gap: 10px; margin: clamp(22px, 4vw, 34px) 0 clamp(18px, 3vw, 26px); }
.ianRule i { flex: 1; height: 0; border-top: 1px solid rgba(160, 112, 40, .45); }
.ianRule b { width: 9px; height: 9px; transform: rotate(45deg); background: linear-gradient(135deg, #ffe39a, #c8892a); box-shadow: 0 0 0 3px #fbf3e1, 0 0 0 4px rgba(160, 112, 40, .45); }

.ianGive { padding: clamp(16px, 3vw, 24px) clamp(16px, 3vw, 26px) clamp(4px, 1vw, 8px); border-radius: 12px; background: rgba(214, 178, 112, .16); border: 1px solid rgba(160, 112, 40, .28); }
.ianGive h3 { margin: 0 0 .6em; font: 600 clamp(20px, 3.2vw, 25px)/1.2 Fraunces, Georgia, serif; color: #14204a; }
.ianPaper a { color: #9b1c1c; font-weight: 700; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; border-radius: 3px; }
.ianPaper a:hover { color: #c8232f; }
.ianPaper a:focus-visible { outline: 3px solid #14204a; outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) { .ianDialog.in .ianPaper { animation: none; } .ianBack { transition: none; } }
