/*
  Tinyhuman Books: the Express screens (upload flow, checkout, My Books, errors, legal pages).
  Loads after /css/brand.css and /css/th.css. Tokens only: no colour, face or radius that
  isn't in brand/. Square corners, 0.75px rules, one book-cloth button per screen.
*/

/* ---------- Page scaffolds ---------- */
.page { padding-block: 28px 64px; }
@media (min-width: 1024px) { .page { padding-block: 64px 96px; } }
.wrap--narrow { max-width: calc(680px + 2 * var(--page-gutter)); }
.page-title { font-size: clamp(2.125rem, 1.6rem + 2.2vw, 3.25rem); line-height: 1.08; }
.page-lead { font-family: var(--font-text); font-size: 17px; line-height: 1.5; max-width: 40ch; }
@media (min-width: 768px) { .page-lead { font-size: 19px; } }
.page-head { display: flex; flex-direction: column; gap: 14px; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
.rule-note { border-top: var(--rule); padding-top: 16px; font-family: var(--font-ui); font-size: 15px; line-height: 1.5; max-width: 52ch; }
.icon { width: 18px; height: 18px; flex: none; }
.text-button {
  background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  font-family: var(--font-ui); font-size: 15px; color: var(--line);
  text-decoration: underline; text-decoration-thickness: 0.75px; text-underline-offset: 4px;
  min-height: 44px; display: inline-flex; align-items: center; gap: 8px; text-align: left;
}
.text-button:hover { text-decoration-thickness: 1.5px; }
.text-button[disabled] { color: var(--text-disabled); text-decoration: none; cursor: not-allowed; }
.link-ui { display: inline-flex; align-items: center; min-height: 44px; }
.status[hidden] { display: none; }
.status p { margin: 0; }
.status a { color: inherit; }
.notices { display: flex; flex-direction: column; gap: 10px; }
.notices:empty { display: none; }

/* ---------- The upload flow: three steps on one page ---------- */
.flow-step { display: flex; flex-direction: column; }
.flow-step[hidden] { display: none; }
@media (max-width: 1023px) {
  /* The proof pins the action panel to the bottom of the phone screen */
  .flow-step { min-height: calc(100svh - 89px); }
}
.flow-layout { flex: 1 0 auto; display: flex; flex-direction: column; gap: 22px; padding-top: 26px; }
.flow-head { display: flex; flex-direction: column; gap: 12px; }
.flow-title { font-size: clamp(2.125rem, 1.7rem + 1.8vw, 3.1rem); line-height: 1.08; }
.flow-title:focus { outline: none; }
.flow-lead { font-family: var(--font-text); font-size: 17px; line-height: 1.5; max-width: 40ch; }
.flow-work { display: flex; flex-direction: column; gap: 14px; }
.flow-count { font-family: var(--font-ui); font-size: 14px; }
.flow-actions {
  margin-top: auto;
  margin-inline: calc(-1 * var(--page-gutter));
  padding: 18px var(--page-gutter) 30px;
  border-top: var(--rule);
  display: flex; flex-direction: column; gap: 14px;
  background: var(--paper);
}
.flow-promise { font-family: var(--font-text); font-size: 16px; line-height: 1.5; }
.flow-actions .link-ui { align-self: center; }
.flow-back { align-self: center; }
.flow-price { font-family: var(--font-ui); font-size: 15px; line-height: 1.45; }
@media (min-width: 1024px) {
  .flow-layout {
    display: grid; column-gap: 72px; row-gap: 28px; align-items: start; padding-top: 64px; padding-bottom: 96px;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "head work" "actions work";
  }
  .flow-head { grid-area: head; }
  .flow-work { grid-area: work; }
  .flow-actions {
    grid-area: actions; margin: 0; padding: 20px 0 0; position: sticky; top: 24px;
  }
  .flow-actions .link-ui, .flow-back { align-self: flex-start; }
  .flow-lead { font-size: 19px; }
  /* Step 2: fields left, the plate on page 1 right */
  .flow-layout--name { grid-template-rows: auto auto 1fr; grid-template-areas: "head plate" "fields plate" "actions plate"; }
  .flow-layout--name .plate-stage { grid-area: plate; position: sticky; top: 24px; }
  .flow-layout--name .flow-fields { grid-area: fields; }
  /* Step 3: form left, the book right */
  .flow-layout--send { grid-template-rows: auto auto auto 1fr; grid-template-areas: "head book" "fields book" "consent book" "actions book"; }
  .flow-layout--send .book-preview { grid-area: book; position: sticky; top: 24px; }
  .flow-layout--send .flow-fields { grid-area: fields; }
  .flow-layout--send .flow-consent { grid-area: consent; }
}
.flow-fields { display: flex; flex-direction: column; gap: 22px; }
.flow-consent { display: flex; flex-direction: column; gap: 12px; }
.checkout-disclaimer { font-family: var(--font-ui); font-size: 14px; line-height: 1.5; }

/* Step changes: the new step rises into place. Nothing moves under reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  .flow-step.is-entering .flow-layout { animation: th-rise var(--duration-slow) var(--ease-enter) both; }
}

/* ---------- Photo tiles ---------- */
.flow .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 10px; }
@media (min-width: 600px) { .flow .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.photo { display: flex; flex-direction: column; min-width: 0; }
.photo .tile { width: 100%; }
.photo .tile img { width: 100%; height: 100%; object-fit: cover; }
.photo[data-state="sampled"] .tile img { object-fit: contain; }
@media (prefers-reduced-motion: no-preference) {
  .photo { animation: th-fade var(--duration-base) var(--ease-enter) both; }
}
@keyframes th-fade { from { opacity: 0; } to { opacity: 1; } }
.photo-zoom { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: var(--paper); cursor: zoom-in; }
.photo-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-family: var(--font-ui); font-size: 13px; text-align: center; padding: 8px; }
.photo-remove {
  position: absolute; top: 0; right: 0; width: 44px; height: 44px; padding: 5px;
  display: flex; align-items: flex-start; justify-content: flex-end;
  background: none; border: 0; cursor: pointer; color: var(--line);
}
.photo-remove span { width: 28px; height: 28px; display: grid; place-items: center; background: var(--paper); border: var(--rule); }
.photo-remove svg { width: 15px; height: 15px; }
.photo-remove:focus-visible { outline-offset: -2px; }
.photo-state {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; gap: 3px;
  background: var(--paper); border-top: var(--rule);
  padding: 5px 7px 6px; font-family: var(--font-ui); font-size: 12.5px; line-height: 1.25;
}
.photo-state[hidden] { display: none; }
.photo-bar { height: 2px; background: var(--control-bg); position: relative; overflow: hidden; }
.photo-bar span { position: absolute; inset: 0; background: var(--cloth); transform-origin: left center; transform: scaleX(var(--progress, 0)); transition: transform var(--duration-base) var(--ease-standard); }
.photo[data-state="drawing"] .photo-bar span { right: auto; width: 38%; transform: none; animation: th-drawing 1.6s var(--ease-standard) infinite alternate; }
@keyframes th-drawing { from { transform: translateX(-10%); } to { transform: translateX(175%); } }
.photo[data-state="error"] .tile, .photo[data-state="held"] .tile { border-style: dashed; }
.photo[data-state="error"] .tile img, .photo[data-state="held"] .tile img { opacity: 0.45; }
.photo-caption { display: flex; flex-direction: column; align-items: flex-start; }
.photo-caption .text-button { font-size: 14px; }
.photo-scene { width: 100%; margin-top: 2px; }
.photo-scene select {
  width: 100%; min-height: 40px; font-family: var(--font-ui); font-size: 14px;
  background: var(--paper); color: var(--line); border: var(--rule); border-radius: 0; padding: 6px 8px;
}

/* The add tile. Empty, it is the whole invitation. */
.tile--add { flex-direction: column; gap: 6px; color: var(--line); width: 100%; aspect-ratio: 1; }
.tile--add:hover, .tile--add.is-dragover { border-style: solid; background: var(--surface-subtle); }
.tile--add .add-plus { font-size: 26px; line-height: 1; }
.tile--add .add-label { font-size: 14px; font-weight: 600; }
.tile--add .add-hint { display: none; }
.tiles.is-empty .tile--add { grid-column: 1 / -1; aspect-ratio: auto; min-height: 210px; padding: 24px; }
.tiles.is-empty .tile--add .add-label { font-size: 17px; }
.tiles.is-empty .tile--add .add-hint { display: block; font-size: 14px; font-weight: 400; max-width: 30ch; text-align: center; line-height: 1.45; }
.tile--add[hidden] { display: none; }
/* The add tile is a label; its file input is visually hidden but takes keyboard focus */
.tile--add:has(input:focus-visible) { outline: 2px solid var(--cloth); outline-offset: 3px; }
.sample-note { font-family: var(--font-ui); font-size: 14px; line-height: 1.5; max-width: 60ch; }

/* ---------- The plate being named ---------- */
.plate-stage { display: flex; justify-content: center; padding-block: 6px 2px; }
.plate-stage .plate { --plate-w: 300px; }
.plate-page { display: none; }
/* An occasion's drawings: a row under the plate on a phone, round the page from 1024px */
.edition-strip { display: flex; justify-content: center; gap: 14px; margin-top: 12px; }
.edition-strip[hidden], .edition-corners[hidden] { display: none; }
.edition-strip img { width: 48px; height: 48px; object-fit: contain; }
.plate-stage { flex-direction: column; align-items: center; }
.edition-corners { position: absolute; inset: 0; pointer-events: none; }
/* Scoped to the page: the phone row uses the same images, laid out in a line */
.edition-corners > .edition-corner { position: absolute; width: 15%; height: auto; }
.edition-corners > .edition-corner--0 { left: 7%; top: 5%; }
.edition-corners > .edition-corner--1 { right: 7%; top: 5%; }
.edition-corners > .edition-corner--2 { left: 7%; bottom: 5%; }
.edition-corners > .edition-corner--3 { right: 7%; bottom: 5%; }
@media (min-width: 1024px) {
  .plate-stage .plate-page { display: block; width: 420px; max-width: 100%; }
  .plate-page .plate { position: absolute; left: 50%; top: 21%; transform: translateX(-50%); }
  .plate-stage > .plate { display: none; }
  .plate-stage > .edition-strip { display: none; }
  .plate-page-foot { position: absolute; left: 0; right: 0; bottom: 9%; display: flex; flex-direction: column; align-items: center; gap: 10px; font-family: var(--font-ui); font-size: 12px; }
  .plate-page-foot img { width: 118px; }
}
.plate .ci { max-width: 100%; }
/* The ink copy wraps exactly like the line copy when a long name breaks */
.plate .ci .ink { right: calc(-1 * max(3px, 0.07em)); transition: color var(--duration-base) var(--ease-standard), transform var(--duration-slow) var(--ease-standard), opacity var(--duration-base) var(--ease-standard); }
.plate-name { font-size: calc(var(--name-size) * var(--name-fit, 1)); white-space: nowrap; }
.plate-name.is-wrapping { white-space: normal; }
.plate-name.is-typing .ink { transform: translate(calc(-1 * max(3px, 0.07em)), calc(-1 * max(3px, 0.07em))); opacity: 0; }
.plate-name.is-empty .ink { opacity: 0; }
.plate-line:empty, .plate-short-rule.is-hidden { display: none; }

/* ---------- Choices (edition, ink, format) ---------- */
.choice-group { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.choice-group legend { font-family: var(--font-ui); font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 10px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice-row { display: flex; flex-wrap: wrap; gap: 10px; }
.choice {
  position: relative; display: flex; align-items: center; gap: 10px;
  border: var(--rule); padding: 11px 14px; min-height: 48px; cursor: pointer;
  font-family: var(--font-ui); font-size: 16px; line-height: 1.3; background: var(--paper);
  transition: box-shadow var(--duration-fast) var(--ease-standard);
}
.choice input[type="radio"] { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--cloth); }
.choice:has(input:checked) { box-shadow: inset 0 0 0 1.5px var(--line); }
.choice:has(input:focus-visible) { outline: 2px solid var(--cloth); outline-offset: 2px; }
.choice-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.choice-title { font-weight: 600; }
.choice-detail { font-size: 14px; line-height: 1.4; }
.choice-price { font-weight: 600; margin-left: auto; padding-left: 8px; white-space: nowrap; }
/* A choice that can't be made here (the printed book, somewhere we don't post): dashed, like a held photo */
.choice:has(input:disabled) { border-style: dashed; cursor: not-allowed; }
.choice:has(input:disabled) .choice-title { color: var(--text-secondary); }
.choice--block { align-items: flex-start; }
.choice--block input[type="radio"] { margin-top: 1px; }
.edition-note { font-family: var(--font-ui); font-size: 14px; line-height: 1.5; }
.field .hint { color: var(--line); }
.field-optional { font-weight: 400; }
.details-pages { border-top: var(--rule); border-bottom: var(--rule); }
.details-pages summary {
  cursor: pointer; list-style: none; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-family: var(--font-ui); font-weight: 600; font-size: 15px;
}
.details-pages summary::-webkit-details-marker { display: none; }
.details-pages summary::after { content: '+'; font-weight: 400; font-size: 22px; transition: transform var(--duration-base) var(--ease-standard); }
.details-pages[open] summary::after { transform: rotate(45deg); }
.page-titles { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 18px; }
.page-title-row { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: end; }
.page-title-row .thumb { width: 56px; aspect-ratio: 1; object-fit: cover; border: var(--rule); }

/* ---------- Their book, before paying ---------- */
.book-preview { display: flex; flex-direction: column; gap: 14px; }
.book-preview h2 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.2rem); }
.book-preview-note { font-family: var(--font-ui); font-size: 14px; line-height: 1.5; }
.book-strip {
  --thumb-w: 132px; --thumb-scale: 0.4;
  display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  margin-inline: calc(-1 * var(--page-gutter)); padding: 4px var(--page-gutter) 20px;
  list-style: none; margin-block: 0;
}
@media (min-width: 1024px) {
  .book-strip { --thumb-w: 150px; --thumb-scale: 0.4545; flex-wrap: wrap; overflow: visible; margin-inline: 0; padding: 4px 0 8px; }
}
/* position: relative keeps each button's visually hidden ", page N" inside the strip's
   scroller; without it that text escaped and widened the whole page at 390px (TH-31) */
.book-page { position: relative; flex: 0 0 var(--thumb-w); width: var(--thumb-w); scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px; }
.book-page .a4 { width: 100%; }
.book-page .a4 > img { inset: 8%; width: 84%; height: 84%; }
/* A page not drawn yet shows its whole photo, greyed, as the drawing will be: never cropped */
.book-page.is-pending .a4 > img { filter: grayscale(1); opacity: 0.38; mix-blend-mode: normal; }
.book-page-caption { font-family: var(--font-ui); font-size: 13px; line-height: 1.35; }
.book-page-caption em { font-family: var(--font-text); font-size: 14px; }
.book-page .text-button { font-size: 13px; min-height: 32px; }
/* Page 1 at full size, scaled into the thumbnail */
.page-one { position: absolute; left: 0; top: 0; width: 330px; height: 467px; transform-origin: 0 0; transform: scale(var(--thumb-scale)); }
.page-one::before { content: ''; position: absolute; inset: 11px; border: var(--rule-strong); }
.page-one::after { content: ''; position: absolute; inset: 13px; border: var(--rule); }
.page-one .plate { --plate-w: 238px; position: absolute; left: 46px; top: 88px; }
.page-one .page-one-logo { position: absolute; left: 50%; bottom: 58px; width: 89px; transform: translateX(-50%); }

/* ---------- The ready page: their pages ---------- */
.ready-pages { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; border-top: var(--rule); padding-top: 18px; }
.ready-pages-title { font-size: clamp(1.35rem, 1.15rem + 0.8vw, 1.75rem); }
.ready-pages-note { font-family: var(--font-ui); font-size: 14px; }
/* Big enough to judge a face: two to a row on a phone, each drawing at its own shape (final review) */
.ready-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 14px; align-items: start; overflow: visible; margin-inline: 0; padding: 0; scroll-snap-type: none; }
@media (min-width: 600px) { .ready-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ready-strip .book-page { width: auto; flex: none; }
.ready-page { display: block; border: var(--rule); background: var(--paper); padding: 8%; box-shadow: var(--shadow-sm); }
.ready-page img { display: block; width: 100%; height: auto; mix-blend-mode: multiply; }
.ready-page:focus-visible { outline: 2px solid var(--cloth); outline-offset: 3px; }

/* The printed copy offered after a PDF (D45) */
.ready-offer { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; margin-top: 8px; border-top: var(--rule); padding-top: 18px; }
.ready-offer-copy { font-size: 16px; line-height: 1.55; max-width: 52ch; }

/* ---------- Print: where it's going ---------- */
.ship { display: flex; flex-direction: column; gap: 12px; }
.ship[hidden] { display: none; }
.waitlist { display: flex; flex-direction: column; gap: 10px; border-top: var(--rule); padding-top: 14px; }
.waitlist-row { display: flex; gap: 10px; flex-wrap: wrap; }
.waitlist-row .input { flex: 1 1 200px; }
.btn--quiet.btn--compact { font-size: 15px; padding: 11px 18px; min-height: 48px; }

/* ---------- Lightbox for a sample page ---------- */
.lightbox { border: var(--rule-strong); padding: 6px; background: var(--paper); color: var(--line); max-width: min(92vw, 760px); max-height: 92vh; }
.lightbox::backdrop { background: color-mix(in srgb, var(--line) 72%, transparent); }
.lightbox-in { border: var(--rule); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.lightbox img { max-height: 76vh; width: auto; margin-inline: auto; }
#page-viewer img { width: 100%; height: auto; max-height: 76vh; object-fit: contain; }
.lightbox-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-family: var(--font-ui); font-size: 14px; }
.lightbox-close { background: none; border: 0; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font-family: var(--font-ui); font-weight: 600; font-size: 15px; color: var(--line); }
.lightbox-close svg { width: 18px; height: 18px; }

/* ---------- After paying ---------- */
.confirm { display: grid; gap: 40px; }
@media (min-width: 1024px) { .confirm { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 72px; align-items: center; } }
.confirm-plate { display: flex; justify-content: center; order: -1; }
@media (min-width: 1024px) { .confirm-plate { order: 0; } }
.confirm-plate .plate { --plate-w: 300px; }
@media (min-width: 1024px) { .confirm-plate .plate { --plate-w: 380px; } }
.progress { display: flex; flex-direction: column; gap: 12px; border-top: var(--rule); padding-top: 18px; }
.progress-line { font-family: var(--font-ui); font-size: 16px; line-height: 1.45; }
.progress-line strong { font-weight: 600; }
.page-ticks { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.page-ticks li { width: 22px; aspect-ratio: 210 / 297; border: var(--rule); display: grid; place-items: center; background: var(--paper); transition: background-color var(--duration-slow) var(--ease-standard); }
.page-ticks li svg { width: 14px; height: 14px; opacity: 0; transition: opacity var(--duration-base) var(--ease-standard); }
.page-ticks li.is-done { border: var(--rule-strong); }
.page-ticks li.is-done svg { opacity: 1; }
.order-ref { font-family: var(--font-ui); font-size: 13px; }
/* The heading takes focus when the page reloads into a new state; it isn't a control */
.confirm .page-title:focus { outline: none; }
.print-ordered, .held-note { max-width: 52ch; }

/* ---------- My Books ---------- */
.shelf { list-style: none; padding: 0; margin: 0; display: grid; gap: 40px 32px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.book { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (min-width: 640px) { .book { grid-template-columns: 1fr; } }
.book-cover { --thumb-scale: 0.3758; width: 124px; }
@media (min-width: 640px) { .book-cover { --thumb-scale: 0.6667; width: 220px; } }
.book-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.book-title { font-family: var(--font-text); font-size: 20px; line-height: 1.3; overflow-wrap: anywhere; }
.book-meta { font-family: var(--font-ui); font-size: 14px; line-height: 1.5; }
.book-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 0; margin-top: 8px; }
.book-actions .btn { margin-bottom: 6px; }
.book-confirm { display: flex; flex-direction: column; gap: 8px; border-top: var(--rule); padding-top: 10px; margin-top: 4px; }
.book-confirm[hidden] { display: none; }
.book-confirm-actions { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.book .status { margin-top: 8px; }
.shelf-foot { border-top: var(--rule); margin-top: 56px; padding-top: 28px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }

/* Redraw dialog */
.sheet { border: var(--rule-strong); padding: 6px; background: var(--paper); color: var(--line); width: min(92vw, 520px); max-height: 90vh; }
.sheet::backdrop { background: color-mix(in srgb, var(--line) 60%, transparent); }
.sheet-in { border: var(--rule); padding: 22px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.sheet h2 { font-size: 30px; }
.sheet-sub { font-family: var(--font-text); font-style: italic; font-size: 17px; overflow-wrap: anywhere; }
.page-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.page-pick { position: relative; }
.page-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.page-pick label {
  display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 8px;
  border: var(--rule); font-family: var(--font-ui); font-size: 15px; cursor: pointer; background: var(--paper);
}
.page-pick input:checked + label { box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 600; }
.page-pick input:checked + label::before { content: ''; width: 12px; height: 7px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg) translate(1px, -2px); margin-right: 8px; }
.page-pick input:focus-visible + label { outline: 2px solid var(--cloth); outline-offset: 2px; }
/* With a preview: the page above its number, so the parent picks the drawing, not a number to remember */
.page-pick.has-thumb label { flex-direction: column; gap: 6px; padding: 6px 6px 8px; flex-wrap: wrap; }
.page-pick-thumb { width: 100%; aspect-ratio: 210 / 297; object-fit: contain; background: var(--paper); mix-blend-mode: multiply; }
.page-pick.has-thumb input:checked + label::before { position: absolute; left: 10px; bottom: 14px; margin: 0; }
.page-pick.has-thumb input:checked + label .page-pick-thumb { outline: 2px solid var(--line); outline-offset: -2px; }
.sheet-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; }

/* ---------- Simple pages: cancelled, sent, errors, not found ---------- */
.plain { display: flex; flex-direction: column; gap: 22px; max-width: 640px; }
.plain .btn { align-self: flex-start; }
.email-form { display: flex; flex-direction: column; gap: 18px; max-width: 460px; }
.steps-list { margin: 0; padding-left: 1.25em; font-family: var(--font-text); font-size: 17px; line-height: 1.55; display: flex; flex-direction: column; gap: 6px; }
.detail { font-family: var(--font-ui); font-size: 14px; line-height: 1.5; }
.setup { border: var(--rule); padding: 18px 20px; font-family: var(--font-ui); font-size: 15px; line-height: 1.6; }
.setup code { font-size: 14px; }

/* ---------- Legal pages: .legal is styled in th.css (shared with Astro) ---------- */
.legal-page .legal h2:target { text-decoration: underline; text-decoration-thickness: 0.75px; text-underline-offset: 8px; }

/* ---------- The rollback home page (index.ejs) ---------- */
.hero { display: grid; gap: 36px; padding-block: 28px 56px; }
@media (min-width: 1024px) { .hero { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px; align-items: center; padding-block: 80px 88px; } }
.hero-copy { display: flex; flex-direction: column; gap: 18px; }
.hero h1 { font-size: clamp(2.2rem, 1.5rem + 3vw, 4.25rem); line-height: 1.04; }
.hero-note { font-family: var(--font-ui); font-size: 14px; line-height: 1.45; max-width: 46ch; }
.hero-art { display: flex; justify-content: center; }
.hero-art .plate { --plate-w: 280px; }
@media (min-width: 1024px) { .hero-art .plate { --plate-w: 360px; } }
.band { border-top: var(--rule); padding-block: clamp(48px, 6vw, 80px); }
.band-grid { display: grid; gap: 28px; }
@media (min-width: 1024px) { .band-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 64px; } }
.band-body { display: flex; flex-direction: column; gap: 14px; font-size: 18px; line-height: 1.6; max-width: 56ch; }
.pair { display: grid; gap: 24px; margin-top: 36px; align-items: end; }
@media (min-width: 768px) { .pair { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 40px; } }
.pair figure { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.pair .photo-frame { border: var(--rule); background: var(--paper); padding: 10px; }
.pair .photo-frame img { width: 100%; }
.pair figcaption { font-family: var(--font-ui); font-size: 14px; }
.pair .a4 > img { inset: 5%; width: 90%; height: 90%; }
.promises { display: grid; gap: 32px; }
@media (min-width: 900px) { .promises { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 56px; } }
.promises h3 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.4rem); margin-bottom: 12px; }
.promises p { font-size: 18px; line-height: 1.55; max-width: 44ch; }
.price-line { border-top: var(--rule); margin-top: 36px; padding-top: 18px; font-size: 18px; line-height: 1.55; }
.faq-list { border-top: var(--rule); }
.faq-item { border-bottom: var(--rule); }
.faq-question {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  background: none; border: 0; padding: 18px 0; min-height: 56px; cursor: pointer; text-align: left;
  font-family: var(--font-text); font-size: 19px; line-height: 1.35; color: var(--line);
}
.faq-question::after { content: '+'; font-family: var(--font-ui); font-size: 24px; line-height: 1; flex: none; transition: transform var(--duration-base) var(--ease-standard); }
.faq-item.active .faq-question::after { transform: rotate(45deg); }
.faq-answer { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--duration-slow) var(--ease-standard); }
.faq-item.active .faq-answer { grid-template-rows: 1fr; }
.faq-answer > div { overflow: hidden; }
.faq-answer p { padding-bottom: 20px; font-size: 17px; line-height: 1.6; max-width: 62ch; }
.final { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.plate-name.is-empty .line { color: var(--text-secondary); }
.add-drag { display: none; }
@media (hover: hover) and (pointer: fine) { .add-drag { display: inline; } }
@media (min-width: 1024px) { .tiles.is-empty .tile--add { min-height: 340px; } }

/* ---------- Fixes after the first look ---------- */
.photo-media { position: absolute; inset: 0; }
.photo-media img, .photo-media .photo-zoom { width: 100%; height: 100%; display: block; }
.photo-media img { object-fit: cover; }
.photo[data-state="sampled"] .photo-media img { object-fit: contain; background: var(--paper); }
@media (max-width: 599px) { .flow .tiles.has-scenes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.choice .ink-chip { flex: none; }
.error { font-family: var(--font-ui); font-size: 14px; line-height: 1.45; color: var(--danger-text); display: inline-flex; gap: 6px; align-items: flex-start; }
.error[hidden] { display: none; }
.error .icon { width: 16px; height: 16px; margin-top: 2px; }
.book-strip { scroll-padding-inline: var(--page-gutter); }
@media (min-width: 1024px) { .book-strip { scroll-padding-inline: 0; } }
.details-pages summary .summary-text { flex: 1; }
[hidden] { display: none !important; }
.details-pages { border-bottom: 0; }
.field-label { font-family: var(--font-ui); font-weight: 600; font-size: 14px; }
.shelf { margin-top: 40px; }
.shelf-empty { margin-top: 32px; }
#shelf-title:focus { outline: none; }
.sheet textarea { font-family: var(--font-ui); font-size: 16px; line-height: 1.45; background: var(--paper); color: var(--line); border: var(--rule-strong); border-radius: 0; padding: 12px 14px; width: 100%; resize: vertical; }
.sheet textarea:focus { outline: 2px solid var(--cloth); outline-offset: 1px; }
.faq-answer > div { visibility: hidden; transition: visibility 0s linear var(--duration-slow); }
.faq-item.active .faq-answer > div { visibility: visible; transition-delay: 0s; }
.faq-list .rule-note { border-top: 0; padding-top: 18px; }
.final h2 { font-size: clamp(1.9rem, 1.5rem + 2vw, 3.1rem); }
.book { align-content: start; }
@media (max-width: 599px) { .hero .page-actions .btn { width: 100%; } }
/* A text button inside a sentence keeps the line's rhythm; padding keeps the target big */
.text-button--inline { display: inline; min-height: 0; padding: 12px 2px; margin: -12px -2px; line-height: inherit; font-size: inherit; }
@media (max-width: 419px) { .choice-grid { grid-template-columns: 1fr; } }
.book-page .text-button { min-height: 44px; }
.photo-scene select { min-height: 44px; }
/* Without the book preview (flag off, as in production) step 3 is one calm column */
@media (min-width: 1024px) {
  .flow-layout--send:not(:has(.book-preview)) { grid-template-columns: minmax(0, 600px); grid-template-rows: auto; grid-template-areas: "head" "fields" "consent" "actions"; }
  .flow-layout--send:not(:has(.book-preview)) .flow-actions { position: static; }
}

/* The printed-copy offer page (D45) */
.upgrade .ready-strip { margin-block: 8px 4px; }
.upgrade-form { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; border-top: var(--rule); padding-top: 20px; max-width: 560px; }
