/* Postbox Fox builder. Palette: red #D1261D, cream #F4ECD9, charcoal #1F1F1F, mustard #F0B429. */
:root {
  --red: #D1261D; --red-dark: #B81F17; --cream: #F4ECD9; --paper: #FFFDF8; --ink: #1F1F1F;
  --mute: #6B665C; --line: #E3D9C3; --line-dark: #D8CDB4; --line-hover: #B8A98A; --mustard: #F0B429;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); font-family: Inter, system-ui, sans-serif; color: var(--ink); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--ink); } a:hover { color: var(--red); }
input, textarea, button { font-family: inherit; }
input[type=text], input[type=email], textarea { width: 100%; border: 1.5px solid var(--line-dark); border-radius: 10px; padding: 12px 14px; font-size: 16px; color: var(--ink); background: var(--paper); }
input[type=text]:focus, textarea:focus { outline: 2px solid var(--red); outline-offset: 1px; border-color: var(--red); }
/* Headlines in the wordmark's own cut of Fraunces: weight 700, optical size 144, soft 50 */
h1, h2.display { font-family: Fraunces, Georgia, serif; font-weight: 700; font-variation-settings: "opsz" 144, "SOFT" 50; letter-spacing: -0.02em; margin: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mute { color: var(--mute); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }

header.site { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--line); background: var(--cream); }
header.site .logo img { height: 44px; width: auto; display: block; }
header.site .tag { font-size: 14px; color: var(--mute); font-weight: 500; }
@media (max-width: 600px) { header.site .tag { display: none; } }

.banner { max-width: 1200px; width: 100%; margin: 16px auto -16px; padding: 0 24px; }
.banner > div { background: var(--paper); border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 16px; font-size: 15px; display: flex; gap: 12px; align-items: center; }
.banner > div.warn { border-color: var(--mustard); }

main.screen { flex: 1; width: 100%; margin: 0 auto; padding: 40px 24px 56px; display: flex; flex-direction: column; }
#screen-build { gap: 36px; max-width: 1200px; }
#screen-details { gap: 28px; max-width: 1000px; }
#screen-done { gap: 22px; max-width: 560px; align-items: center; justify-content: center; text-align: center; padding: 64px 24px; }

.intro { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.intro h1 { font-size: 44px; line-height: 1.1; max-width: 720px; }
.intro p { margin: 0; font-size: 17px; color: var(--mute); max-width: 560px; }
@media (max-width: 600px) { .intro h1 { font-size: 32px; } }

.builder { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; justify-content: center; }
.col { flex: 1 1 200px; max-width: 260px; display: flex; flex-direction: column; gap: 10px; }
.col h2 { margin: 0 0 4px; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); }
.stage { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 18px; width: 340px; max-width: 100%; }
@media (max-width: 860px) {
  .col { max-width: none; flex-basis: 100%; }
  .stage { order: -1; width: 100%; }
}

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 860px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 1.5px solid var(--line); background: var(--paper); border-radius: 14px; padding: 14px 8px 12px; min-height: 98px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; text-align: center; line-height: 1.2; }
.tile:hover { border-color: var(--line-hover); }
.tile.on { border: 2px solid var(--red); padding: 13px 7px 11px; background: #fff; }
.icimg { width: 48px; height: 48px; border-radius: 12px; flex: none; object-fit: cover; display: block; border: 1px solid rgba(0,0,0,.08); }

.pick { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 1.5px solid var(--line); background: var(--paper); border-radius: 12px; padding: 12px 14px; min-height: 48px; font-size: 15px; font-weight: 500; color: var(--ink); cursor: pointer; }
.pick:hover { border-color: var(--line-hover); }
.pick.on { border: 2px solid var(--red); padding: 11px 13px; background: #fff; }
.pick .hint { font-size: 12px; font-weight: 400; color: var(--mute); display: block; margin-top: 2px; }

.pal { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 4px 2px 0; }
.palbtn { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); padding: 0; cursor: pointer; box-shadow: inset 0 0 0 2px #fff; }
.palbtn:hover { border-color: var(--line-hover); }
.palbtn.on { border-color: var(--red); }

.btn-primary { border: none; border-radius: 12px; background: var(--red); color: var(--cream); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; font-size: 16px; text-decoration: none; }
.btn-primary:hover { background: var(--red-dark); }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-ghost { border: 1.5px solid var(--line-dark); border-radius: 10px; background: var(--paper); color: var(--ink); font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; font-size: 14px; }
.btn-ghost:hover { border-color: var(--line-hover); }
.btn-link { background: none; border: none; color: var(--mute); text-decoration: underline; font-size: 13px; cursor: pointer; min-height: 44px; padding: 0 12px; }
.zbtn { min-width: 44px; min-height: 44px; border: 1.5px solid var(--line-dark); border-radius: 10px; background: var(--paper); font-size: 18px; font-weight: 600; cursor: pointer; color: var(--ink); }

/* The card on the stage: a white sheet with the printed front inside. */
.sheet { position: relative; width: 340px; height: 468px; background: #fff; border-radius: 6px; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 18px 40px -12px rgba(0,0,0,.28); padding: 10px; }
.sheet .a5 { position: absolute; top: -12px; right: -12px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; color: var(--mute); }
@media (max-width: 380px) { .sheet { transform: scale(.9); transform-origin: top center; margin-bottom: -47px; } }

/* The front itself, 320 x 448 design px (7x5 inch). Everything inside is positioned absolutely from layoutFront(). */
.front { position: relative; width: 320px; height: 448px; overflow: hidden; border-radius: 2px; }
.front .layer { position: absolute; inset: 0; pointer-events: none; }
.front .art { width: 100%; height: 100%; object-fit: cover; display: block; }
.front .win { position: absolute; background: #fff; }
.front .inner { position: absolute; overflow: hidden; background: #e8e4dc; }
.front .inner.has-photo { background: #fff; }
.front .pwin { touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.front .pwin:active { cursor: grabbing; }
.front .photo { position: absolute; left: 50%; top: 50%; max-width: none; display: block; pointer-events: none; }
.front .cap { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 10px; }
.front .greet { text-align: center; max-width: 100%; line-height: 1.05; white-space: nowrap; overflow: visible; }  /* visible: hidden chopped descenders; the card itself clips at its edges */
.front .namel { text-align: center; line-height: 1.1; opacity: .85; }
.front .below { position: absolute; left: 24px; right: 24px; display: flex; flex-direction: column; align-items: center; }
.front .badge { position: absolute; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; line-height: 1; transform: rotate(8deg); box-shadow: 0 6px 14px -6px rgba(0,0,0,.45); border: 3px solid #fff; }
.front .tape { position: absolute; height: 20px; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.front .empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 16px; border: 2px dashed #bdb7ad; border-radius: inherit; }
.front .empty .btn-primary { min-height: 44px; padding: 0 16px; border-radius: 10px; font-size: 14px; }
.front .empty-overlay { position: absolute; left: 36px; right: 36px; top: 50%; transform: translateY(-50%); height: 230px; background: rgba(255,253,248,.96); border-radius: 14px; box-shadow: 0 10px 30px -10px rgba(0,0,0,.4); }
.front .empty-overlay .empty { border-color: #cfc6b4; border-radius: 12px; inset: 6px; }

.photo-controls { display: flex; gap: 10px; flex-wrap: nowrap; justify-content: center; align-items: center; width: 100%; }
.photo-controls .btn-ghost { padding: 0 14px; white-space: nowrap; }
.zoom-row { display: flex; gap: 4px; align-items: center; }
.zoom-row .pct { min-width: 40px; text-align: center; font-size: 13px; font-weight: 600; color: var(--mute); }
.zoom-row .btn-link { padding: 0 6px; }
.zoom { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; margin-top: -8px; }
.field { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--mute); }
.field-row { width: 100%; display: flex; gap: 10px; align-items: flex-end; }
.field-row .field.age { flex: 0 0 92px; }
.continue { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.continue .btn-primary { width: 100%; min-height: 52px; font-size: 17px; }
.warn-line { color: #8a5a00; font-size: 12px; text-align: center; }

.what { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; border-top: 1px solid var(--line); padding-top: 32px; }
.what h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.what p { margin: 0; font-size: 14px; color: var(--mute); line-height: 1.5; }
@media (max-width: 700px) { .what { grid-template-columns: 1fr; } }

/* Screen 2 */
.back { align-self: flex-start; background: none; border: none; padding: 0; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; font-size: 15px; color: var(--mute); cursor: pointer; }
#screen-details h1 { font-size: 36px; }
.details { display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-start; }
.details form { flex: 999 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.msg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.msg-head label { font-weight: 600; font-size: 15px; }
.seg { display: inline-flex; border: 1.5px solid var(--line-dark); border-radius: 10px; overflow: hidden; }
.seg button { min-height: 44px; padding: 0 16px; border: none; background: var(--paper); font-size: 14px; font-weight: 600; color: var(--mute); cursor: pointer; }
.seg button.on { background: var(--red); color: var(--cream); }
.msg-hint { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
textarea::placeholder { color: #a39d93; opacity: 1; }
.inside.example { color: #a39d93; }   /* the suggestion, shown faint until they write their own */
.inside-label { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); }
.inside { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 22px 24px; min-height: 120px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.02); color: #2b2117; white-space: pre-line; overflow-wrap: anywhere; }
.inside.hand { font-family: Caveat, cursive; font-size: 22px; line-height: 1.35; }
.inside.print { font-family: Inter, system-ui, sans-serif; font-size: 15px; line-height: 1.6; }
fieldset { border: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
legend { font-weight: 600; font-size: 15px; padding: 0; margin-bottom: 4px; }
fieldset .field label { font-weight: 400; }
.two { display: flex; gap: 12px; }
.two .field:first-child { flex: 1 1 60%; } .two .field:last-child { flex: 1 1 40%; }
.radio { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--line); background: var(--paper); border-radius: 12px; padding: 14px; cursor: pointer; }
.radio.on { border: 2px solid var(--red); padding: 13px; background: #fff; }
.radio input { margin-top: 3px; width: 18px; height: 18px; }
.radio .body { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.radio .body b { font-weight: 600; font-size: 15px; }
.radio .body span { font-size: 13px; color: var(--mute); }
.radio .price { font-weight: 600; }
.summary { flex: 1 1 280px; max-width: 340px; display: flex; flex-direction: column; gap: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.summary .item { display: flex; gap: 14px; align-items: center; }
.mini { width: 74px; height: 104px; flex: none; background: #fff; padding: 3px; border-radius: 3px; box-shadow: 0 4px 12px -4px rgba(0,0,0,.3); overflow: hidden; }
.mini .front { transform: scale(0.2125); transform-origin: top left; }
.summary .rule { height: 1px; background: var(--line); }
.summary .line { display: flex; justify-content: space-between; font-size: 14px; }
.summary .total { display: flex; justify-content: space-between; font-weight: 600; font-size: 18px; }
.pay { min-height: 52px; border: none; border-radius: 12px; background: var(--ink); color: #fff; font-size: 17px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.pay:disabled { opacity: .6; cursor: default; }
.error { color: var(--red); font-size: 14px; font-weight: 500; }

/* Screen 3 */
#screen-done h1 { font-size: 40px; }
#screen-done p { margin: 0; font-size: 17px; color: var(--mute); line-height: 1.5; }
.remind { display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--line); background: var(--paper); border-radius: 12px; padding: 14px 16px; cursor: pointer; text-align: left; width: 100%; }
.remind input { width: 20px; height: 20px; accent-color: var(--red); }
.remind b { font-weight: 600; font-size: 15px; display: block; }
.remind span { font-size: 13px; color: var(--mute); }

footer.site { padding: 20px 24px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; font-size: 13px; color: var(--mute); }
footer.site .brand { display: inline-flex; align-items: center; gap: 10px; }
footer.site .brand img { width: 22px; height: 22px; display: block; }
footer.site nav { display: flex; gap: 16px; }
