/* One column, like a letter on a desk: airmail band on top, three steps, the card itself as the preview. */
:root {
  --paper: #f3efe6;
  --ink: #23232a;
  --muted: #6b6760;
  --airmail-red: #b8423a;
  --airmail-blue: #2f4c86;
  --line: #d9d2c3;
  --display: "Alfa Slab One", Rockwell, Georgia, serif;
  --body: Karla, "Helvetica Neue", Arial, sans-serif;
  --type: "Courier Prime", "Courier New", monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.55 var(--body);
}
.airmail {
  height: 10px;
  background: repeating-linear-gradient(-45deg,
    var(--airmail-red) 0 14px, var(--paper) 14px 20px,
    var(--airmail-blue) 20px 34px, var(--paper) 34px 40px);
}
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding-block: 40px 72px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid;
  gap: 48px;
}
.intro { display: grid; gap: 12px; }
.intro p { margin: 0; max-width: 60ch; }
.eyebrow {
  font: 700 13px/1 var(--type);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--airmail-red);
}
h1 {
  margin: 0 0 8px;
  font: 400 clamp(38px, 9vw, 56px)/1.05 var(--display);
  color: var(--airmail-blue);
  text-wrap: balance;
}
h2 {
  margin: 0;
  font: 700 15px/1.3 var(--type);
  letter-spacing: .12em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}
.num {
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  letter-spacing: 0;
}
.deadline { color: var(--airmail-red); font-size: 15px; font-weight: 600; }
.intro h2.how { margin-top: 8px; font: 700 17px/1.4 var(--body); letter-spacing: 0; text-transform: none; }
.steps { display: grid; gap: 40px; }
.step { display: grid; gap: 16px; }
.file, .hp { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pick, .btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 52px;
  padding: 0 28px;
  border-radius: 999px;
  font: 600 17px/1 var(--body);
  cursor: pointer;
  justify-self: start;
}
.pick { border: 1.5px solid var(--ink); background: transparent; color: var(--ink); }
.file:focus-visible + .pick { outline: 3px solid var(--airmail-blue); outline-offset: 3px; }
.btn { border: 0; background: var(--airmail-blue); color: var(--paper); }
.btn:focus-visible { outline: 3px solid var(--airmail-red); outline-offset: 3px; }
.btn:disabled { opacity: .5; cursor: default; }
.field { display: grid; gap: 6px; font-size: 15px; color: var(--muted); }
textarea, input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fffdf8;
  color: var(--ink);
  font: 17px/1.5 var(--body);
  resize: vertical;
}
textarea:focus, input[type="text"]:focus { outline: none; border-color: var(--airmail-blue); }
.count { justify-self: end; font: 13px var(--type); font-variant-numeric: tabular-nums; }
.count.near { color: var(--airmail-red); }
.card-wrap { margin: 0; display: grid; gap: 8px; }
.card-wrap figcaption { font-size: 14px; color: var(--muted); }
.card {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  box-shadow: 0 1px 2px rgba(35,35,42,.12), 0 8px 24px rgba(35,35,42,.12);
}
.card.portrait { width: auto; max-height: 78vh; max-width: 100%; justify-self: center; }
.error { margin: 0; color: var(--airmail-red); font-weight: 600; }
.done, .closed { display: grid; gap: 20px; }
.done h2, .closed h2 { font: 400 28px/1.15 var(--display); letter-spacing: 0; text-transform: none; color: var(--airmail-blue); }
.done p, .closed p { margin: 0; }
@media (prefers-reduced-motion: no-preference) {
  .card { transition: opacity .2s; }
}
.lang { justify-self: end; display: flex; gap: 2px; margin-bottom: -32px; }
.lang button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 700 13px/1 var(--type);
  letter-spacing: .12em;
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.lang button[aria-pressed="true"] { color: var(--ink); background: rgba(35,35,42,.07); }
.lang button:focus-visible { outline: 2px solid var(--airmail-blue); outline-offset: 2px; }
.movable { cursor: grab; touch-action: none; }
.movable:active { cursor: grabbing; }
.zoom { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.zoom input { flex: 1; min-width: 0; accent-color: var(--airmail-blue); }
.hint { margin: 0; font-size: 14px; color: var(--muted); }
.choices { display: flex; flex-wrap: wrap; gap: 12px; }
.intro, .deadline, .done, .closed { max-width: 640px; }
/* Photo and message side by side, each preview straight under its heading; one column on a phone. */
.cards { display: grid; grid-template-columns: 1fr; gap: 40px; align-items: start; }
.cards .col { display: grid; gap: 16px; min-width: 0; }
.cards .col h2 label { cursor: pointer; }
.cards .col h2:not(:first-child) { margin-top: 12px; }
@media (min-width: 820px) {
  .cards { grid-template-columns: 1fr 1fr; }
}
.tools { display: grid; gap: 8px; }
#frontWrap .card.portrait { max-height: 60vh; }
.sendbar { display: grid; justify-items: center; gap: 12px; }
.btn.big { justify-self: center; width: min(100%, 420px); min-height: 64px; font-size: 19px; }
.btn.big:disabled { opacity: 1; background: var(--line); color: var(--muted); cursor: default; }
.pick.small { min-height: 40px; padding: 0 18px; font-size: 15px; }
.card.empty { cursor: pointer; }
.card.empty:focus-visible { outline: 3px solid var(--airmail-blue); outline-offset: 3px; }
/* On a phone the button stays in view at the bottom while the form is on screen. */
@media (max-width: 819px) {
  .sendbar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px)));
    padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--paper);
    box-shadow: 0 -6px 16px rgba(35,35,42,.08);
  }
}
/* The message is typed on the card itself: a box over the card's message area, sized by app.js to the print. */
.oncard { position: relative; }
.mbox { position: absolute; overflow: hidden; }
.notch { float: right; }
.message {
  margin: 0; padding: 0; border: 0; border-radius: 0;
  background: transparent;
  color: #22325a;
  font-family: Caveat, "Bradley Hand", "Segoe Print", cursive;
  font-weight: 500;
  line-height: 1.18;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  min-height: 100%;
  outline: none;
  cursor: text;
}
.message.blank::before { content: attr(data-placeholder); color: rgba(34,50,90,.4); pointer-events: none; }
.message:focus { box-shadow: 0 0 0 2px rgba(47,76,134,.18); border-radius: 4px; }
/* Phones: a sheet of the card's paper for writing at a readable size. */
.sheet {
  position: fixed; left: 0; right: 0; top: 0;
  height: var(--sheet-h, 100%);
  z-index: 20;
  display: flex; flex-direction: column; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
  background: #faf6ec;
}
.sheet-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-top .btn { min-height: 44px; padding: 0 22px; }
.sheet-slot { flex: 1; min-height: 0; display: flex; }
.sheet-slot .message {
  position: static; flex: 1;
  width: 100%; min-height: 0;
  font-size: 26px !important; line-height: 1.3;
  white-space: pre-wrap;
  overflow-y: auto;
  padding: 4px 2px;
  box-shadow: none;
}
.sheet .count { justify-self: end; margin: 0; text-align: right; }
body.writing > .airmail, body.writing > main { display: none; }
.oncard .card.portrait { max-height: 60vh; }
