@font-face { font-family: PostOfficeSerif; src: url('/post-office/fonts/NotoSerif-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: PostOfficeSerifItalic; src: url('/post-office/fonts/NotoSerif-Italic.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: PostOfficeSignature; src: url('/fonts/GreatVibes.ttf') format('truetype'); font-display: swap; }
body.storybook[data-product="north-pole-post-office"] { min-width:0; --post-office-footer-height:136px; --post-office-preview-height:clamp(180px,calc(100svh - 430px),600px); }
body[data-product="north-pole-post-office"] [hidden] { display:none !important; }
body[data-product="north-pole-post-office"] .topbar { display:grid; grid-template-columns:44px minmax(0,1fr) auto; width:min(1180px,calc(100% - 40px)); margin:0 auto; padding:12px 0; gap:16px; }
body[data-product="north-pole-post-office"] .topbar .ever-wonder-brand { justify-self:center; min-width:0; }
body[data-product="north-pole-post-office"] .topbar .ew-header-nav { display:flex; flex-direction:row; align-items:center; gap:8px; margin:0; }
body[data-product="north-pole-post-office"] .topbar .ever-wonder-logo { width:44px; height:44px; flex-basis:44px; }
body[data-product="north-pole-post-office"] .topbar .ever-wonder-slogan { display:none; }
body[data-product="north-pole-post-office"] .topbar .ever-wonder-brand-copy { max-width:250px; }
body[data-product="north-pole-post-office"] main { width:min(1180px,calc(100% - 40px)); margin:0 auto; }
.post-office-screen { min-width:0; padding-bottom:calc(var(--post-office-footer-reserve,var(--post-office-footer-height)) + 24px + env(safe-area-inset-bottom,0px)); }
body[data-product="north-pole-post-office"] .post-office-back { display:grid; place-items:center; width:44px; height:44px; min-width:44px; min-height:44px; padding:0; margin:0; font-size:36px; line-height:1; text-decoration:none; }
.post-office-intro { max-width:760px; margin:12px auto 22px; text-align:center; }
body[data-product="north-pole-post-office"] .post-office-intro h1 { margin:0; font-size:clamp(32px,4vw,44px); line-height:1.08; }
body[data-product="north-pole-post-office"] .post-office-intro p { margin:8px 0 0; font-size:20px; line-height:1.3; }
.post-office-layout { display:grid; grid-template-columns:minmax(220px,280px) minmax(0,1fr); grid-template-areas:"personal preview" "information preview"; grid-template-rows:auto 1fr; column-gap:36px; row-gap:18px; align-items:start; }
.post-office-controls { grid-area:personal; align-self:end; min-width:0; padding-top:42px; }
.post-office-review { grid-area:preview; min-width:0; }
#post-office-form { display:flex; flex-direction:column; gap:8px; }
#post-office-form label { font-size:22px; line-height:1.25; }
#post-office-form input { box-sizing:border-box; width:100%; min-width:0; min-height:52px; border:1px solid #dfb87a80; border-radius:10px; padding:10px 12px; background:#071122; color:var(--cream,#f4e5c8); font:inherit; font-size:22px; line-height:1.25; }
#post-office-form input:focus-visible { outline:2px solid var(--brand-heading-ink,#f5f2ec); outline-offset:3px; }
#post-office-form input[aria-invalid="true"] { border-color:#f1aa93; }
/* Keep the genuine select node and event path as the accessible tab backing. */
#post-office-kind.post-office-kind-native { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); margin:0; padding:0; border:0; }
body[data-product="north-pole-post-office"] .post-office-name-error { margin:0; font-size:17px; line-height:1.3; color:#f1c2ae; }
body[data-product="north-pole-post-office"] .post-office-status { margin:10px 0 0; font-size:17px; line-height:1.3; overflow-wrap:anywhere; }
body[data-product="north-pole-post-office"] .post-office-status:empty { display:none; }
.post-office-tabs { display:flex; justify-content:center; width:min(100%,400px); margin:0 auto 12px; border:1px solid #dfb87a80; border-radius:10px; overflow:hidden; }
body[data-product="north-pole-post-office"] .post-office-tabs button { flex:1; min-width:0; min-height:48px; margin:0; padding:8px 14px; border:0; border-radius:0; background:transparent; color:var(--cream,#f4e5c8); font:inherit; font-size:21px; line-height:1.2; cursor:pointer; }
body[data-product="north-pole-post-office"] .post-office-tabs button[aria-selected="true"] { color:#09101a; background:#e6c589; }
body[data-product="north-pole-post-office"] .post-office-tabs button:focus-visible { outline:2px solid var(--brand-heading-ink,#f5f2ec); outline-offset:-4px; }
.post-office-preview-frame { position:relative; display:grid; place-items:center; width:min(100%,calc(var(--post-office-preview-height)*var(--post-office-preview-ratio,1.3368))); margin-inline:auto; min-height:0; overflow:hidden; border:0; border-radius:0; background:transparent; }
.post-office-preview-frame::after { content:''; position:absolute; z-index:3; inset:0; pointer-events:none; opacity:0; transform:translateX(-130%); background:linear-gradient(112deg,transparent 35%,#f8d99138 49%,#fff5ce55 50%,#f8d99138 51%,transparent 65%); }
.post-office-preview-frame[data-state="shimmer"]::after { animation:post-office-page-shimmer 1.25s ease-out both; }
body[data-product="north-pole-post-office"] #post-office-preview-empty { max-width:320px; margin:0; padding:26px 12px; text-align:center; font-size:19px; line-height:1.3; }
#post-office-preview { display:block; width:100%; height:auto; max-height:var(--post-office-preview-height); background:transparent; }
#post-office-preview text { font-weight:400; }
.post-office-preview-actions { display:flex; justify-content:center; min-height:44px; margin-top:4px; }
body[data-product="north-pole-post-office"] .post-office-replay { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; margin:0; padding:6px 12px; border:0; background:none; color:var(--cream,#f4e5c8); font:inherit; font-size:18px; }
body[data-product="north-pole-post-office"] .post-office-replay span { font-size:24px; }
.post-office-options { grid-area:information; min-width:0; width:100%; margin:0; }
.post-office-options > summary,.post-office-wording-review > summary { display:flex; align-items:center; justify-content:space-between; min-height:48px; padding:8px 12px; border:1px solid #dfb87a80; border-radius:10px; font-size:19px; line-height:1.25; list-style:none; cursor:pointer; touch-action:manipulation; }
.post-office-options > summary::after,.post-office-wording-review > summary::after { content:'+'; margin-left:14px; font-size:24px; }
.post-office-options[open] > summary::after,.post-office-wording-review[open] > summary::after { content:'−'; }
.post-office-options > summary::-webkit-details-marker,.post-office-wording-review > summary::-webkit-details-marker { display:none; }
.post-office-options > summary:focus-visible,.post-office-wording-review > summary:focus-visible { outline:2px solid var(--brand-heading-ink,#f5f2ec); outline-offset:3px; }
.post-office-options-panel { position:fixed; z-index:130; left:50%; bottom:calc(var(--post-office-footer-reserve,var(--post-office-footer-height)) + 8px); transform:translateX(-50%); box-sizing:border-box; width:min(540px,calc(100vw - 32px)); max-height:max(120px,calc(100dvh - var(--post-office-footer-reserve,var(--post-office-footer-height)) - 32px)); overflow:auto; overscroll-behavior:contain; padding:18px; border:1px solid #dfb87a80; border-radius:14px; background:#020610; box-shadow:0 12px 50px #0009; }
.post-office-options:not([open]) > .post-office-options-panel { display:none; }
body[data-product="north-pole-post-office"] .post-office-options-panel p { margin:0 0 12px; font-size:17px; line-height:1.4; }
.post-office-options-actions { display:flex; flex-direction:column; align-items:center; gap:12px; }
.post-office-options-actions .button { width:fit-content; margin:0; }
.post-office-page-size { display:block; margin:8px 0; font-size:16px; }
.post-office-wording-review { margin:12px 0; }
.post-office-wording { border-top:1px solid #dfb87a55; padding:12px 4px; font-family:PostOfficeSerif,Georgia,serif !important; font-size:17px; line-height:1.5; white-space:pre-line; overflow-wrap:anywhere; }
.post-office-primary-wrap { position:fixed; z-index:110; inset:auto 0 0; display:flex; flex-direction:column; align-items:center; gap:4px; min-height:var(--post-office-footer-height); padding:12px 16px calc(12px + max(env(safe-area-inset-bottom,0px),var(--post-office-keyboard,0px))); pointer-events:none; background:linear-gradient(transparent,#020610 12px); }
body[data-product="north-pole-post-office"] #post-office-price { margin:0; font-size:18px !important; line-height:1.2; }
body[data-product="north-pole-post-office"] #post-office-purchase-status { width:min(600px,calc(100vw - 32px)); margin:0; text-align:center; font-size:16px !important; line-height:1.25; overflow-wrap:anywhere; }
.post-office-primary-actions { display:flex; justify-content:center; width:100%; margin-top:4px; }
html[data-ew-action-buttons="ready"] body[data-product="north-pole-post-office"] .post-office-primary-wrap .button.primary { pointer-events:auto; min-height:56px !important; min-width:180px; max-width:min(340px,calc(100vw - 32px)); margin:0; padding:14px 28px; }
.post-office-skip { position:fixed; top:8px; left:8px; z-index:200; min-height:48px; padding:12px; transform:translateY(-150%); color:var(--cream,#f4e5c8); background:#020610; }
.post-office-skip:focus { transform:none; }
#post-office-preview .post-office-writing-mask { width: var(--post-office-writing-width); }
#post-office-preview:is([data-state="name"], [data-state="greeting"], [data-state="body"]) .post-office-writing-mask[data-reveal-phase="signature"],
#post-office-preview:is([data-state="greeting"], [data-state="name"]) .post-office-writing-mask[data-reveal-phase="body"] { width: 0; }
#post-office-preview[data-state="name"] .post-office-writing-mask[data-reveal-phase="name"],
#post-office-preview[data-state="greeting"] .post-office-writing-mask[data-reveal-phase="greeting"],
#post-office-preview[data-state="body"] .post-office-writing-mask[data-reveal-phase="body"],
#post-office-preview[data-state="signature"] .post-office-writing-mask[data-reveal-phase="signature"] { animation: post-office-writing-reveal var(--post-office-writing-duration) var(--post-office-writing-delay) linear both; }
#post-office-preview .post-office-writing-tip { opacity: 0; pointer-events: none; }
#post-office-preview .post-office-seal-light { opacity: 0; pointer-events: none; }
#post-office-preview[data-document-kind="certificate"][data-state="seal"] .post-office-seal-light,
#post-office-preview[data-document-kind="letter"][data-state="seal"] .post-office-seal-light { animation: post-office-original-seal-light 1.15s ease-in-out both; }
#post-office-preview[data-state="name"] .post-office-writing-tip[data-reveal-phase="name"],
#post-office-preview[data-state="greeting"] .post-office-writing-tip[data-reveal-phase="greeting"],
#post-office-preview[data-state="body"] .post-office-writing-tip[data-reveal-phase="body"],
#post-office-preview[data-state="signature"] .post-office-writing-tip[data-reveal-phase="signature"] { animation: post-office-writing-tip var(--post-office-writing-duration) var(--post-office-writing-delay) linear both; }
.post-office-particles { position: absolute; z-index: 2; inset: 0; overflow: hidden; pointer-events: none; }
.post-office-particles i { --particle-x: -112px; --particle-y: 72px; position: absolute; left: 50%; top: 48%; width: 3px; height: 3px; border-radius: 50%; background: #f2c772; box-shadow: 0 0 5px #ffe3a8; opacity: 0; }
.post-office-preview-frame[data-state="name"] .post-office-particles i { animation: post-office-particle-gather 2.15s ease-out both; }
.post-office-particles i:nth-child(2) { --particle-x: -72px; --particle-y: -56px; animation-delay: .1s; }
.post-office-particles i:nth-child(3) { --particle-x: -30px; --particle-y: 88px; animation-delay: .05s; }
.post-office-particles i:nth-child(4) { --particle-x: 42px; --particle-y: -64px; animation-delay: .12s; }
.post-office-particles i:nth-child(5) { --particle-x: 96px; --particle-y: 62px; animation-delay: .02s; }
.post-office-particles i:nth-child(6) { --particle-x: 118px; --particle-y: -18px; animation-delay: .08s; }
@keyframes post-office-writing-reveal { from { width: 0; } to { width: var(--post-office-writing-width); } }
@keyframes post-office-writing-tip { 0% { opacity: 0; transform: translateX(0); } 8%, 90% { opacity: .75; } 100% { opacity: 0; transform: translateX(var(--post-office-writing-width)); } }
@keyframes post-office-original-seal-light { 0%, 100% { opacity: 0; } 48% { opacity: .22; } }
@keyframes post-office-page-shimmer { 0% { opacity: 0; transform: translateX(-130%); } 25% { opacity: .65; } 75% { opacity: .65; } 100% { opacity: 0; transform: translateX(130%); } }
@keyframes post-office-particle-gather { 0% { opacity: 0; transform: translate(var(--particle-x), var(--particle-y)) scale(.3); } 22% { opacity: .65; } 85% { opacity: .3; } 100% { opacity: 0; transform: translate(0, 0) scale(1); } }
@media (max-width:760px) {
  body.storybook[data-product="north-pole-post-office"] { --post-office-footer-height:126px; --post-office-preview-height:clamp(180px,calc(100svh - 500px),430px); }
  body[data-product="north-pole-post-office"] .topbar { width:calc(100% - 32px); grid-template-columns:44px minmax(0,1fr) auto; gap:8px; padding:8px 0; }
  body[data-product="north-pole-post-office"] main { width:calc(100% - 32px); }
  body[data-product="north-pole-post-office"] .topbar .ever-wonder-logo { width:28px; height:28px; flex-basis:28px; }
  body[data-product="north-pole-post-office"] .topbar .ever-wonder-brand { gap:6px; }
  body[data-product="north-pole-post-office"] .topbar .ever-wonder-brand-copy { max-width:142px; }
  body[data-product="north-pole-post-office"] .post-office-back { width:44px; min-width:44px; }
  .post-office-intro { margin:4px auto 14px; }
  body[data-product="north-pole-post-office"] .post-office-intro h1 { font-size:32px; }
  body[data-product="north-pole-post-office"] .post-office-intro p { display:none; }
  .post-office-layout { grid-template-columns:minmax(0,1fr); grid-template-areas:"personal" "preview" "information"; grid-template-rows:auto; gap:12px; }
  .post-office-controls { padding-top:0; }
  #post-office-form { gap:6px; }
  #post-office-form label { font-size:19px; }
  #post-office-form input { min-height:48px; padding:8px 12px; font-size:21px; }
  body[data-product="north-pole-post-office"] .post-office-status { margin:6px 0 0; font-size:16px; }
  .post-office-tabs { margin-bottom:8px; }
  body[data-product="north-pole-post-office"] .post-office-tabs button { min-height:44px; font-size:19px; }
  .post-office-options { width:min(100%,440px); margin-inline:auto; }
  .post-office-preview-actions { min-height:44px; }
  body[data-product="north-pole-post-office"] .post-office-replay { min-height:44px; }
  body[data-product="north-pole-post-office"] #post-office-price { font-size:18px; }
  .post-office-primary-wrap { padding-top:10px; }
}
@media (max-width:480px) {
  body[data-product="north-pole-post-office"] .topbar .ew-header-nav { gap:4px; }
  body[data-product="north-pole-post-office"] .topbar .ew-header-nav :is(.ew-header-menu-toggle,.ew-header-home) { min-width:44px; min-height:44px; padding-inline:4px; font-size:16px !important; }
  body[data-product="north-pole-post-office"] .topbar .ever-wonder-brand-copy { max-width:120px; }
}
@media (max-width:350px) {
  body[data-product="north-pole-post-office"] .topbar { gap:4px; grid-template-columns:44px minmax(0,1fr) auto; }
  body[data-product="north-pole-post-office"] .topbar .ever-wonder-brand-copy { max-width:96px; }
  body[data-product="north-pole-post-office"] .topbar .ever-wonder-logo { width:24px; height:24px; flex-basis:24px; }
  body[data-product="north-pole-post-office"] .post-office-back { width:44px; min-width:44px; }
}
@media (max-height:620px) and (min-width:761px) {
  body.storybook[data-product="north-pole-post-office"] { --post-office-preview-height:clamp(180px,calc(100svh - 285px),340px); }
  .post-office-intro { margin:2px auto 12px; }
  body[data-product="north-pole-post-office"] .post-office-intro p { display:none; }
  .post-office-controls { padding-top:28px; }
}
/* Short landscape screens keep the whole document above the same primary
   action. Compact status sits beside it rather than consuming another row. */
@media (max-height:500px) and (orientation:landscape) {
  body.storybook[data-product="north-pole-post-office"] { --post-office-footer-height:84px; --post-office-preview-height:clamp(130px,calc(100svh - 210px),260px); }
  body[data-product="north-pole-post-office"] .topbar { padding-block:0; }
  .post-office-intro { position:absolute; width:1px; height:1px; margin:0; overflow:hidden; clip-path:inset(50%); }
  .post-office-controls { padding-top:12px; }
  .post-office-primary-wrap { display:grid; grid-template-columns:minmax(0,1fr) minmax(180px,280px) minmax(0,1fr); align-items:center; column-gap:12px; min-height:84px; padding:8px 16px calc(8px + max(env(safe-area-inset-bottom,0px),var(--post-office-keyboard,0px))); }
  .post-office-primary-actions { grid-column:2; grid-row:1; margin:0; }
  body[data-product="north-pole-post-office"] #post-office-price { grid-column:1; grid-row:1; text-align:center; font-size:16px !important; }
  body[data-product="north-pole-post-office"] #post-office-purchase-status { grid-column:3; grid-row:1; width:auto; font-size:14px !important; }
  html[data-ew-action-buttons="ready"] body[data-product="north-pole-post-office"] .post-office-primary-wrap .button.primary { min-width:180px; padding-inline:20px; }
}
@media (prefers-reduced-motion:reduce) {
  body[data-product="north-pole-post-office"] *,body[data-product="north-pole-post-office"] *::before,body[data-product="north-pole-post-office"] *::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; }
  #post-office-preview .post-office-writing-mask { width:var(--post-office-writing-width) !important; }
  .post-office-particles,#post-office-preview .post-office-writing-tip,#post-office-preview .post-office-seal-light,.post-office-preview-frame::after { display:none !important; }
}
@media print { body[data-product="north-pole-post-office"] .post-office-primary-wrap { display:none; } }

/* Portrait letters use their available reading width. Ordinary page scrolling
   keeps the whole document and Replay clear of the measured action area. */
@media (max-width:760px) {
 .post-office-preview-frame[data-document-kind="letter"] {
  --post-office-preview-height:min(calc(100svh - var(--post-office-footer-reserve,var(--post-office-footer-height)) - 60px),calc((100vw - 32px)/var(--post-office-preview-ratio,.748)));
 }
}
