/* All fonts are self-hosted (no requests to Google). */
@font-face {
  font-family: 'Arimo';
  src: url('/fonts/Arimo-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: block;
}
@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/fraunces-latin-full-normal.woff2') format('woff2');
  font-style: normal; font-weight: 100 900; font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/fraunces-latin-full-italic.woff2') format('woff2');
  font-style: italic; font-weight: 100 900; font-display: swap;
}
@font-face {
  font-family: 'Instrument Sans';
  src: url('/fonts/instrument-sans-latin-wght-normal.woff2') format('woff2');
  font-style: normal; font-weight: 400 700; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
  font-style: normal; font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
  font-style: normal; font-weight: 500; font-display: swap;
}

:root {
  --bg: #f3eee3;
  --bg-deep: #e9e1d0;
  --surface: #fbf8f1;
  --ink: #1b1915;
  --ink-2: #4a453c;
  --muted: #7a7366;
  --line: #d8cfbd;
  --line-strong: #bfb39c;
  --red: #cf3f29;
  --blue: #213f8f;
  --ok: #2c7a4a;
  --warn: #a8501c;
  --sheet: #ffffff;
  --on-ink: #f6f1e7;
  --shadow-sheet: 0 1px 1px rgba(27, 25, 21, .06), 0 10px 20px -8px rgba(27, 25, 21, .18), 0 34px 60px -30px rgba(27, 25, 21, .45);
  --radius: 12px;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Instrument Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
  --airmail: repeating-linear-gradient(135deg, var(--red) 0 9px, transparent 9px 15px, var(--blue) 15px 24px, transparent 24px 30px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161512;
    --bg-deep: #0f0e0c;
    --surface: #1f1d19;
    --ink: #f2ede3;
    --ink-2: #cfc7b8;
    --muted: #978f80;
    --line: #37332c;
    --line-strong: #4d473d;
    --red: #e65a40;
    --blue: #7393ea;
    --ok: #5cbf83;
    --warn: #e08a52;
    --on-ink: #161512;
    --shadow-sheet: 0 1px 1px rgba(0, 0, 0, .4), 0 30px 60px -24px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='220' viewBox='0 0 520 220'%3E%3Cg fill='none' stroke='%23000' stroke-opacity='.07' stroke-width='3'%3E%3Cpath d='M0 30c32-18 64-18 96 0s64 18 96 0 64-18 96 0 64 18 96 0 64-18 96 0 64 18 96 0'/%3E%3Cpath d='M0 70c32-18 64-18 96 0s64 18 96 0 64-18 96 0 64 18 96 0 64-18 96 0 64 18 96 0'/%3E%3Cpath d='M0 110c32-18 64-18 96 0s64 18 96 0 64-18 96 0 64 18 96 0 64-18 96 0 64 18 96 0'/%3E%3Cpath d='M0 150c32-18 64-18 96 0s64 18 96 0 64-18 96 0 64 18 96 0 64-18 96 0 64 18 96 0'/%3E%3Cpath d='M0 190c32-18 64-18 96 0s64 18 96 0 64-18 96 0 64 18 96 0 64-18 96 0 64 18 96 0'/%3E%3C/g%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: no-repeat, repeat;
  background-position: right -60px top 40px, 0 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) {
  body { background-blend-mode: normal; }
  body::before {
    content: ''; position: fixed; inset: 0; pointer-events: none; z-index: -1;
    background: radial-gradient(1200px 600px at 75% -10%, rgba(115, 147, 234, .08), transparent 60%);
  }
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

/* ------------------------------------------------------------ top bar */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1200px; margin: 0 auto; padding: 20px 32px 4px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 24px; letter-spacing: -.02em; font-variation-settings: 'opsz' 48; }
.brand-name em { font-style: italic; font-weight: 500; color: var(--red); padding: 0 .04em; }
.brand-name .tld { font-weight: 400; color: var(--muted); font-size: .72em; letter-spacing: 0; }
/* Postage stamp: paper with perforated edges around a printed image.
   The mask keeps the content box solid and punches round holes only in the padding. */
.stamp-wrap {
  display: inline-block; flex: none;
  filter: drop-shadow(0 1px .5px rgba(27, 25, 21, .28)) drop-shadow(0 4px 6px rgba(27, 25, 21, .14));
}
.stamp {
  --hole: 2.1px;
  --step: 5.4px;
  display: block; padding: 4.5px; background: #fffaf0;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    radial-gradient(circle, transparent var(--hole), #000 calc(var(--hole) + .4px)) calc(var(--step) / -2) calc(var(--step) / -2) / var(--step) var(--step) round;
          mask:
    linear-gradient(#000 0 0) content-box,
    radial-gradient(circle, transparent var(--hole), #000 calc(var(--hole) + .4px)) calc(var(--step) / -2) calc(var(--step) / -2) / var(--step) var(--step) round;
}
.stamp svg { display: block; width: 100%; height: auto; color: var(--red); }
.stamp-value { font-family: var(--font-display); font-style: italic; font-weight: 600; font-size: 9.5px; fill: #fff; letter-spacing: -.2px; }

.brand-stamp { width: 40px; transform: rotate(-7deg); transition: transform .35s cubic-bezier(.3, 1.5, .5, 1); }
.brand:hover .brand-stamp { transform: rotate(-2deg) translateY(-2px) scale(1.05); }
.mode-badge {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .02em;
  padding: 6px 12px 6px 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  position: relative; overflow: hidden; max-width: 60vw;
  white-space: nowrap; text-overflow: ellipsis;
}
.mode-badge::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--airmail); }

/* ------------------------------------------------------------ layout */

.layout {
  max-width: 1200px; margin: 0 auto; padding: 20px 32px 80px;
  display: grid; gap: 28px 56px;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  grid-template-areas: 'desk intro' 'desk panel';
  grid-template-rows: auto 1fr;
}
.intro { grid-area: intro; }
.desk { grid-area: desk; position: sticky; top: 16px; align-self: start; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.panel { grid-area: panel; }

.intro h1 {
  font-family: var(--font-display); font-weight: 500; font-size: clamp(34px, 4vw, 46px);
  line-height: 1.02; letter-spacing: -.025em; margin: 6px 0 14px;
  font-variation-settings: 'opsz' 144;
}
.intro h1 em { font-style: italic; color: var(--red); font-weight: 400; }
.intro p { margin: 0; color: var(--ink-2); font-size: 17px; max-width: 34ch; }

/* ------------------------------------------------------------ segmented controls */

.segmented {
  display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
}
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: block; padding: 8px 16px; border-radius: 999px; white-space: nowrap;
  font-size: 14px; font-weight: 500; color: var(--ink-2);
  transition: background-color .2s, color .2s;
}
.segmented input:checked + span { background: var(--ink); color: var(--on-ink); }
.segmented input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.segmented label:hover input:not(:checked) + span { color: var(--ink); background: var(--bg-deep); }

/* ------------------------------------------------------------ address placement (secondary) */

.placement-more { border-bottom: 1px dashed var(--line); padding-bottom: 12px; }
.placement-more summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.placement-more summary::-webkit-details-marker { display: none; }
.pm-label {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2);
}
.pm-value {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 6px 10px 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-size: 13.5px; font-weight: 500; color: var(--ink); transition: border-color .15s;
}
.pm-value svg { width: 10px; height: 7px; color: var(--muted); transition: transform .2s; }
.placement-more summary:hover .pm-value { border-color: var(--line-strong); }
.placement-more[open] .pm-value svg { transform: rotate(180deg); }
.placement-options { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; animation: rise .25s ease-out; }
.placement-options label {
  position: relative; display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  transition: border-color .15s, background-color .15s;
}
.placement-options label:hover { border-color: var(--line-strong); }
.placement-options label:has(input:checked) { border-color: var(--ink); background: color-mix(in srgb, var(--ink) 4%, var(--surface)); }
.placement-options input { margin: 3px 0 0; accent-color: var(--ink); width: 16px; height: 16px; flex: none; }
.placement-options span { display: flex; flex-direction: column; gap: 2px; }
.placement-options b { font-weight: 600; font-size: 14.5px; }
.placement-options small { font-size: 13px; color: var(--muted); line-height: 1.35; }

.detect {
  padding: 14px; border-radius: 12px; display: flex; flex-direction: column; gap: 8px;
  background: color-mix(in srgb, var(--blue) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--blue) 30%, var(--line));
  animation: rise .3s ease-out;
}
.detect p { margin: 0; font-size: 14px; }
.detect pre { margin: 0; font-family: 'Arimo', Arial, sans-serif; font-size: 14px; white-space: pre-wrap; padding: 8px 10px; background: #fff; color: #1b1915; border-radius: 6px; }
.detect-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.detect .btn-secondary { height: 38px; }

/* ------------------------------------------------------------ sheet */

.sheet-wrap {
  position: relative;
  width: min(100%, 540px, max(300px, calc((100svh - 150px) * 0.7071)));
}
.folds { position: absolute; left: -18px; top: 0; bottom: 0; width: 10px; }
.folds i { position: absolute; left: 0; width: 10px; height: 1px; background: var(--line-strong); }

.sheet {
  position: relative; width: 100%; aspect-ratio: 210 / 297;
  background: var(--sheet); color: #1b1915;
  box-shadow: var(--shadow-sheet);
  container-type: inline-size;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s;
  overflow: hidden;
}
.sheet[data-state='empty'] { cursor: pointer; }
.sheet[data-state='empty']:hover { transform: translateY(-3px) rotate(-.4deg); }
.sheet::after { /* dashed edge while empty */
  content: ''; position: absolute; inset: 10px; border: 1.5px dashed #cfc6b4; pointer-events: none;
  transition: opacity .2s;
}
.sheet:not([data-state='empty'])::after { opacity: 0; }
body.dragging .sheet { transform: translateY(-6px) rotate(-1deg) scale(1.01); }
body.dragging .sheet::after { opacity: 1; inset: 0; border: 8px solid transparent; border-image: var(--airmail) 8; }

#pageCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
#overlay text { font-family: 'Arimo', Arial, sans-serif; fill: #111; }
#overlay text.placeholder { fill: #b9b2a5; }
#overlay text.overflow { fill: var(--red); }
#overlay .win-fill { fill: #fff; }
#overlay .win-outline { fill: none; stroke: var(--blue); stroke-width: .35; stroke-dasharray: 1.6 1.2; opacity: .65; }
#overlay .win-label { font-family: var(--font-mono); font-size: 2.4px; fill: var(--blue); opacity: .75; letter-spacing: .1px; }

.cover-tag {
  position: absolute; top: 14px; right: 14px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  background: var(--blue); color: #fff; padding: 4px 9px; border-radius: 4px;
}

.drop-hint {
  position: absolute; left: 0; right: 0; top: 50%;
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  color: #4a453c; padding: 0 24px;
}
.drop-hint strong { font-family: var(--font-display); font-weight: 500; font-size: clamp(22px, 6.4cqw, 34px); letter-spacing: -.02em; color: #1b1915; }
.drop-hint .drop-sub { font-size: 14px; color: #7a7366; }
.drop-hint u { text-decoration-color: var(--red); text-underline-offset: 3px; text-decoration-thickness: 1.5px; color: #1b1915; }
.drop-icon { width: 44px; height: 44px; color: var(--red); margin-bottom: 4px; animation: bob 2.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.sheet:not([data-state='empty']) .drop-hint { display: none; }

.sheet-busy {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px;
  background: rgba(255, 255, 255, .82); color: #4a453c; font-size: 14px;
}
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ files + thumbs */

.files { width: min(100%, 540px); display: flex; flex-direction: column; gap: 12px; }
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.file-list li {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  padding: 6px 6px 6px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line);
  font-size: 14px;
}
.file-list .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.file-list .fpages { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.file-list button {
  width: 24px; height: 24px; border-radius: 6px; border: 0; background: transparent; color: var(--muted);
  display: grid; place-items: center; font-size: 16px; line-height: 1;
}
.file-list button:hover { background: var(--bg-deep); color: var(--red); }

.thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.thumb { flex: none; width: 54px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.thumb canvas, .thumb .blank { width: 54px; aspect-ratio: 210 / 297; background: #fff; box-shadow: 0 1px 3px rgba(27, 25, 21, .2); display: block; }
.thumb .blank { display: grid; place-items: center; font-family: var(--font-mono); font-size: 9px; color: var(--blue); text-transform: uppercase; }
.thumb span { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

.notes { margin: 0; font-size: 13px; color: var(--warn); }
.window-check { font-size: 14px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.window-check.ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.window-check.bad { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); color: var(--warn); }
.window-check pre { margin: 6px 0 0; font-family: 'Arimo', Arial, sans-serif; font-size: 14px; white-space: pre-wrap; color: var(--ink); }

.file-actions { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--ink-2); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.link-btn:hover { color: var(--ink); text-decoration-color: var(--red); }

/* ------------------------------------------------------------ form */

form { display: flex; flex-direction: column; gap: 26px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
fieldset[disabled] .field { opacity: .45; }
legend {
  display: flex; align-items: center; gap: 12px; padding: 0; margin-bottom: 14px;
  font-family: var(--font-display); font-size: 24px; font-weight: 500; letter-spacing: -.01em;
}
.num {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--ink); font-family: var(--font-mono); font-size: 13px; font-weight: 500;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2);
  display: flex; align-items: baseline; gap: 8px;
}
.opt { text-transform: none; letter-spacing: 0; color: var(--muted); font-family: var(--font-body); font-size: 12.5px; }
.verified { text-transform: none; letter-spacing: 0; color: var(--ok); font-family: var(--font-body); font-size: 12.5px; font-weight: 600; }
.address-fields { display: flex; flex-direction: column; gap: 14px; }
.row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; }
input:not([type='radio']), select {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 16px; transition: border-color .15s, box-shadow .15s;
}
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%237a7366' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
input::placeholder { color: var(--muted); opacity: .6; }
input:hover, select:hover { border-color: var(--line-strong); }
input:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 18%, transparent); }
input[aria-invalid='true'] { border-color: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 15%, transparent); }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.segmented { align-self: flex-start; }

/* ------------------------------------------------------------ checkout */

.checkout {
  display: flex; flex-direction: column; gap: 14px;
  padding: 22px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
  position: relative;
}
.receipt { margin: 0; font-family: var(--font-mono); font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.receipt div { display: flex; align-items: baseline; gap: 8px; }
.receipt dt { color: var(--ink-2); }
.receipt i { flex: 1; border-bottom: 1.5px dotted var(--line-strong); transform: translateY(-4px); }
.receipt dd { margin: 0; font-variant-numeric: tabular-nums; }
.receipt .total { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 17px; font-weight: 500; }
.receipt .total dt { color: var(--ink); }
.receipt-meta { margin: -4px 0 0; font-size: 12.5px; color: var(--muted); }

.verify {
  display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--blue) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--blue) 30%, var(--line));
  animation: rise .35s cubic-bezier(.2, .8, .2, 1);
}
.verify label { font-size: 14px; }
.verify-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.verify-row input { font-family: var(--font-mono); font-size: 20px; letter-spacing: .3em; text-align: center; }
.btn-secondary { height: 46px; padding: 0 16px; border-radius: 10px; border: 0; background: var(--blue); color: #fff; font-weight: 600; white-space: nowrap; }
.btn-secondary:hover { filter: brightness(1.1); }
.verify .link-btn { align-self: flex-start; font-size: 13px; }

.form-error { margin: 0; font-size: 14px; color: var(--red); font-weight: 500; }

/* how to pay: single letter, pack, or a letter from a pack */
.pay-options { display: flex; flex-direction: column; gap: 6px; }
.pay-options label {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; cursor: pointer;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg);
  transition: border-color .15s, background-color .15s, opacity .15s;
}
.pay-options label:hover { border-color: var(--line-strong); }
.pay-options label:has(input:checked) { border-color: var(--ink); background: color-mix(in srgb, var(--ink) 4%, var(--surface)); }
.pay-options label.disabled { opacity: .5; cursor: not-allowed; }
.pay-options input { margin: 0; accent-color: var(--ink); width: 16px; height: 16px; }
.po-text { display: flex; flex-direction: column; min-width: 0; }
.po-text b { font-size: 14.5px; font-weight: 600; }
.po-text small { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.po-price { font-family: var(--font-mono); font-size: 14px; font-weight: 500; white-space: nowrap; }
.pack-badge {
  text-transform: none; letter-spacing: 0; font-family: var(--font-body); font-size: 12px; font-weight: 600;
  padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--blue) 12%, transparent); color: var(--blue);
}

.consent { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; font-size: 13.5px; color: var(--ink-2); cursor: pointer; line-height: 1.45; }
.consent input { margin: 2px 0 0; width: 17px; height: 17px; accent-color: var(--ink); }
.consent a, .fineprint a { color: var(--ink); text-underline-offset: 2px; text-decoration-color: var(--line-strong); }
.consent:has(input[aria-invalid='true']) { color: var(--red); }

/* footer + legal pages */
/* Footer at the bottom of the window on short pages (the "sent" screen, legal pages, 404). */
body { display: flex; flex-direction: column; min-height: 100dvh; }
body > * { width: 100%; }  /* keeps max-width + auto margins centring inside the column */
.site-footer {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px;
  max-width: 1200px; margin: auto auto 0; padding: 24px 16px 40px; border-top: 1px solid var(--line); font-size: 14px;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink); }
.back-link { font-size: 14px; color: var(--ink-2); text-decoration: none; }
.back-link:hover { color: var(--ink); }
.legal { max-width: 720px; margin: 0 auto; padding: 24px 32px 56px; }
.legal h1 { font-family: var(--font-display); font-weight: 500; font-size: clamp(32px, 4vw, 44px); line-height: 1.05; letter-spacing: -.02em; margin: 18px 0 8px; font-variation-settings: 'opsz' 144; }
.legal .updated { margin: 0 0 30px; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.legal h2 { font-family: var(--font-display); font-weight: 500; font-size: 21px; letter-spacing: -.01em; margin: 32px 0 8px; }
.legal p { margin: 0 0 12px; color: var(--ink-2); }
.legal a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--red); }
.legal .model-form { border: 1.5px dashed var(--line-strong); border-radius: 12px; padding: 12px 20px 4px; background: var(--surface); }
.legal .form-note { font-size: 13.5px; color: var(--muted); }
@media (max-width: 900px) { .legal { padding: 8px 16px 48px; } }

.send {
  position: relative; height: 60px; border: 0; padding: 6px; border-radius: 14px;
  background: var(--airmail); background-size: 200% 200%;
  transition: transform .15s, background-position .6s;
}
.send > span {
  display: flex; align-items: center; justify-content: center; gap: 10px; height: 100%; border-radius: 9px;
  background: var(--ink); color: var(--on-ink);
  font-family: var(--font-display); font-size: 20px; font-weight: 500; letter-spacing: -.01em;
}
.send:hover { background-position: 100% 0; }
.send:active { transform: translateY(1px) scale(.995); }
.send[disabled] { cursor: progress; }
.send[disabled] > span { opacity: .85; }
.fineprint { margin: 0; font-size: 12.5px; color: var(--muted); }

/* ------------------------------------------------------------ sent state */

.sent { display: flex; flex-direction: column; gap: 14px; animation: rise .5s .5s cubic-bezier(.2, .8, .2, 1) both; }
.sent-kicker { margin: 0; font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--red); }
.sent h2 { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: 40px; line-height: 1.05; letter-spacing: -.02em; }
.sent p { margin: 0; color: var(--ink-2); }
.sent-details { margin: 6px 0 8px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 18px; font-size: 14px; padding: 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.sent-details dt { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding-top: 2px; }
.sent-details dd { margin: 0; overflow-wrap: anywhere; }

.layout.is-sent .files, .layout.is-sent .intro { display: none; }
.layout.is-sent { grid-template-areas: 'desk panel'; grid-template-rows: auto; }

.sheet-wrap.posting .sheet { animation: fold .7s cubic-bezier(.6, 0, .4, 1) forwards; }
@keyframes fold {
  40% { transform: perspective(900px) rotateX(18deg) scaleY(.36); }
  100% { transform: perspective(900px) rotateX(18deg) scaleY(.34) translateY(60%); opacity: 0; }
}

.envelope {
  position: relative; width: 100%; aspect-ratio: 220 / 110; margin-top: 30%;
  background: #fbfaf6; color: #1b1915; border-radius: 4px; box-shadow: var(--shadow-sheet);
  animation: slideIn .7s cubic-bezier(.2, .8, .2, 1) both;
  container-type: inline-size;
}
.envelope::before { /* airmail border */
  content: ''; position: absolute; inset: 0; border-radius: 4px; padding: 2.4cqw;
  background: var(--airmail); background-size: 34px 34px;
  -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, linear-gradient(#000 0 0);
          mask-composite: exclude;
}
.env-window {
  position: absolute; left: 9.1%; top: 40.9%; width: 40.9%; height: 40.9%;
  background: #fff; border: 1px solid #d9d3c6; border-radius: 3px;
  padding: 1.7cqw 2.4cqw; font-family: 'Arimo', Arial, sans-serif; font-size: 2.3cqw; line-height: 1.2;
  white-space: pre; overflow: hidden; text-overflow: ellipsis;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6), inset 0 6px 14px -10px rgba(0, 0, 0, .25);
}
.env-stamp { position: absolute; z-index: 1; right: 6%; top: 11%; width: 12.5%; transform: rotate(3deg); }
.env-postmark {
  position: absolute; z-index: 2; right: 12%; top: 9%; width: 21%; aspect-ratio: 1;
  border: 2px solid rgba(33, 63, 143, .75); border-radius: 50%; color: rgba(33, 63, 143, .85);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3cqw;
  font-family: var(--font-mono); font-size: 1.7cqw; text-transform: uppercase; letter-spacing: .08em;
  transform: rotate(-14deg); mix-blend-mode: multiply;
  animation: stampDown .45s 1s cubic-bezier(.3, 1.6, .5, 1) both;
}
.env-postmark b { font-size: 2.4cqw; font-weight: 500; }
.env-postmark::after { /* cancellation waves */
  content: ''; position: absolute; left: -120%; top: 30%; width: 120%; height: 40%;
  background: repeating-linear-gradient(transparent 0 22%, rgba(33, 63, 143, .7) 22% 30%);
  -webkit-mask: radial-gradient(60% 300% at 50% 50%, #000, transparent);
}
@keyframes stampDown { from { opacity: 0; transform: rotate(-14deg) scale(1.7); } to { opacity: 1; transform: rotate(-14deg) scale(1); } }
@keyframes slideIn { from { opacity: 0; transform: translateY(40px) rotate(2deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ------------------------------------------------------------ drag overlay */

.drag-overlay {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  display: grid; place-items: end center; padding-bottom: 32px;
}
.drag-overlay div {
  font-family: var(--font-display); font-size: 20px; background: var(--ink); color: var(--on-ink);
  padding: 12px 22px; border-radius: 999px; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .5);
  animation: rise .2s ease-out;
}

/* ------------------------------------------------------------ entrance */

.intro, .sheet-wrap, .panel { animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; }
.sheet-wrap { animation-delay: .1s; }
.intro { animation-delay: .18s; }
.panel { animation-delay: .26s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------ small screens */

@media (max-width: 900px) {
  .topbar { padding: 16px 16px 0; }
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'intro' 'desk' 'panel';
    padding: 12px 16px 64px; gap: 24px;
  }
  .layout.is-sent { grid-template-areas: 'desk' 'panel'; }
  .desk { position: static; }
  .sheet-wrap { width: min(100%, 460px); }
  .folds { display: none; }
}

.when-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .when-touch { display: inline; }
  .drop-hint strong.when-touch { display: block; }
  .when-mouse { display: none; }
}

/* ------------------------------------------------------------ language switch */

.topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lang-switch {
  flex: none; font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; letter-spacing: .05em;
  color: var(--ink); text-decoration: none; padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); transition: border-color .15s;
}
.lang-switch:hover { border-color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------ how it works + FAQ (server-rendered for SEO) */

.about { max-width: 960px; margin: 0 auto; padding: 40px 32px 56px; }
.about h2 { font-family: var(--font-display); font-weight: 500; font-size: 30px; letter-spacing: -.02em; margin: 0 0 18px; }
.how { list-style: none; counter-reset: how; padding: 0; margin: 0 0 52px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.how li {
  counter-increment: how; display: flex; flex-direction: column; gap: 6px;
  padding: 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
}
.how li::before {
  content: counter(how); width: 28px; height: 28px; margin-bottom: 4px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--ink); font-family: var(--font-mono); font-size: 13px; font-weight: 500;
}
.how b { font-family: var(--font-display); font-size: 19px; font-weight: 500; }
.how span { color: var(--ink-2); font-size: 15px; }
.faq details { border-top: 1px solid var(--line); padding: 14px 0; }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 16px; font-size: 16.5px; font-weight: 600; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-family: var(--font-mono); font-weight: 400; color: var(--muted); }
.faq details[open] summary::after { content: '–'; }
.faq p { margin: 10px 0 0; max-width: 70ch; color: var(--ink-2); }
.faq a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--red); }
body:has(.layout.is-sent) .about { display: none; }

@media (max-width: 900px) {
  .about { padding: 16px 16px 40px; }
  .how { grid-template-columns: minmax(0, 1fr); }
  .mode-badge { max-width: 42vw; }
}
