/* The type-and-print page. Nunito only, self-hosted; the kit's colours on a calm tool.
   Colours checked for WCAG AA (contrast notes beside each token). */

@font-face {
  font-family: "Nunito";
  src: url("fonts/Nunito-400.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("fonts/Nunito-700.ttf") format("truetype");
  font-weight: 600 700; /* no 600 cut ships with the repo; 600 uses the 700 file */
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("fonts/Nunito-800.ttf") format("truetype");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("fonts/Nunito-900.ttf") format("truetype");
  font-weight: 900;
  font-display: swap;
}

:root {
  --pink-top: #ffd9ec;
  --sky-bottom: #d9eeff;
  --card: #ffffff;
  --ink: #3a1f7a; /* 12.7 on white, 9.9 on the pink, 10.6 on the sky */
  --muted: #5b4590; /* help text: 7.8 on white */
  --violet: #7c3aed; /* labels on white: 5.7 */
  --violet-deep: #6d28d9; /* violet on the gradient: 5.5 on the pink (#7C3AED is 4.45 there) */
  --pink: #d61f72; /* primary button: white text 4.9 (#E8257D gave 4.2) */
  --pink-hover: #c41a68;
  --pink-pressed: #a8155a;
  --line: #9483cf; /* input border: 3.3 on white, for the 3:1 a control's edge needs (#D6CCEF is 1.5) */
  --line-soft: #e6dff7;
  --wash: #f6f2ff;
  --error: #b42318; /* on #FEF3F2: 6.0 */
  --error-bg: #fef3f2;
  --ok: #067647; /* on #ECFDF3: 5.4 */
  --ok-bg: #ecfdf3;
  --info-bg: #f3effe;
  --shadow: 0 6px 24px rgba(70, 40, 110, 0.14);
  --focus: 0 0 0 3px #ffffff, 0 0 0 6px var(--violet);
  --radius: 24px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* `hidden` must win over every display rule below (buttons, action rows). */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", ui-rounded, system-ui, sans-serif;
  font-weight: 600;
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--sky-bottom);
  padding: 0 16px 32px;
}

/* The gradient stays put while the page scrolls (background-attachment: fixed is ignored on iOS). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, var(--pink-top) 0%, var(--sky-bottom) 100%);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  padding: 10px 16px;
  background: var(--card);
  color: var(--ink);
  border-radius: 12px;
  font-weight: 800;
  z-index: 10;
}
.skip:focus {
  top: 12px;
  outline: none;
  box-shadow: var(--focus);
}

/* ------------------------------------------------------------------ header and steps */

.masthead,
.steps,
.frame,
.foot {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}
body.wide .frame {
  max-width: 960px;
}

.masthead {
  padding: 28px 0 4px;
  text-align: center;
}
.shop {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--violet-deep);
}
h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.kit {
  margin: 6px 0 0;
  font-size: 15px;
  color: var(--muted);
}

.steps {
  margin-top: 20px;
  margin-bottom: 16px;
}
.steps ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  position: relative;
}
.steps.without-details ol {
  grid-template-columns: repeat(3, 1fr);
}
.steps li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}
/* the line joining the dots */
.steps li + li::before {
  content: "";
  position: absolute;
  top: 15px;
  right: 50%;
  width: calc(100% - 36px);
  height: 3px;
  margin-right: 18px;
  border-radius: 2px;
  background: rgba(124, 58, 237, 0.22);
  z-index: 0;
}
.steps li.is-done + li::before,
.steps li.is-current::before {
  background: var(--violet-deep);
}
.steps .dot {
  position: relative;
  z-index: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  background: var(--card);
  color: var(--muted);
  border: 2px solid var(--line);
}
.steps li.is-done .dot {
  background: var(--violet-deep);
  border-color: var(--violet-deep);
  color: #ffffff;
}
.steps li.is-current .dot {
  background: var(--pink);
  border-color: var(--pink);
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(214, 31, 114, 0.18);
}
.steps li.is-current,
.steps li.is-done {
  color: var(--ink);
}
.steps li.is-current .step-name {
  font-weight: 800;
}

/* ------------------------------------------------------------------ cards and steps */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 20px;
}

.step.appear {
  animation: step-in 180ms var(--ease);
}
@keyframes step-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

h2 {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
}
h2:focus {
  outline: none;
}
h2:focus-visible {
  outline: none;
  border-radius: 6px;
  box-shadow: var(--focus);
}

p {
  margin: 0 0 12px;
}
.lede {
  color: var(--ink);
}

/* ------------------------------------------------------------------ fields */

.field {
  margin: 0 0 18px;
  scroll-margin-bottom: 120px;
}
label {
  display: block;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--violet);
  margin-bottom: 2px;
}
.help {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.4;
}
input[type="text"] {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  background: var(--card);
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  min-height: 56px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
input[type="text"]:hover {
  border-color: var(--violet);
}
input[type="text"]:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.35);
}
input[aria-invalid="true"] {
  border-color: var(--error);
  background: #fffdfd;
}
input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.25);
}
#order {
  letter-spacing: 0.08em;
}
#name {
  letter-spacing: 0.04em;
}
.field-short input[type="text"] {
  max-width: 120px;
  text-align: center;
}

.field-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.field-error {
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--error);
  line-height: 1.4;
}
.field-error:empty {
  display: none;
}
.counter {
  margin: 6px 0 0 auto;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.counter.full {
  color: var(--ink);
}
.counter.over {
  color: var(--error);
}
.fix-row {
  margin: 8px 0 0;
}
.fix-row button[hidden] {
  display: none;
}
.primary:disabled,
.secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ------------------------------------------------------------------ messages */

.answer:empty {
  display: none;
}
.answer {
  margin: 0 0 16px;
}
.msg {
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 16px;
  line-height: 1.45;
}
.msg p {
  margin: 0;
}
.msg p + p {
  margin-top: 6px;
}
.msg.error {
  background: var(--error-bg);
  color: var(--error);
  border-left: 5px solid var(--error);
}
.msg.info {
  background: var(--info-bg);
  color: var(--ink);
}
.msg.ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.note {
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 16px;
  line-height: 1.45;
  margin: 0 0 16px;
}
.note.ok {
  background: var(--ok-bg);
  color: var(--ok);
  font-weight: 700;
}
.note.info {
  background: var(--info-bg);
  color: var(--ink);
}
/* Something she should act on, not an error (AO1). */
.note.warn {
  background: #fff4d6;
  color: var(--ink);
  border-left: 4px solid #e0a100;
}

.retry {
  margin: -4px 0 16px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--wash);
}
.retry-line {
  margin: 0 0 8px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.bar {
  height: 6px;
  border-radius: 3px;
  background: var(--line-soft);
  overflow: hidden;
  margin-bottom: 4px;
}
.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--violet);
  border-radius: 3px;
  transition: width 200ms linear;
}

.again {
  margin: -4px 0 16px;
}

.confirm {
  margin: 4px 0 8px;
  padding: 18px 16px;
  border-radius: 18px;
  background: var(--wash);
  border: 2px solid var(--line-soft);
}
.confirm-q {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.4;
  margin-bottom: 14px;
}
.confirm-q:focus {
  outline: none;
}
.confirm-q:focus-visible {
  border-radius: 6px;
  box-shadow: var(--focus);
}

/* ------------------------------------------------------------------ buttons */

button {
  font: inherit;
  cursor: pointer;
}
.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}
.primary,
.secondary {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  transition: background-color 150ms var(--ease), transform 150ms var(--ease), box-shadow 150ms var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.primary {
  width: 100%;
  border: 0;
  color: #ffffff;
  background: var(--pink);
  box-shadow: 0 3px 0 var(--pink-pressed);
}
.primary:hover {
  background: var(--pink-hover);
}
.primary:active {
  background: var(--pink-pressed);
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--pink-pressed);
}
.secondary {
  width: 100%;
  border: 2px solid var(--violet);
  color: var(--violet);
  background: var(--card);
}
.secondary:hover {
  background: var(--wash);
}
.secondary:active {
  background: var(--line-soft);
  color: var(--violet-deep); /* #7C3AED is 4.4 on this pressed tint */
  border-color: var(--violet-deep);
  transform: translateY(2px);
}
.primary:focus-visible,
.secondary:focus-visible,
.link:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
.secondary.small {
  min-height: 48px;
  font-size: 16px;
  padding: 10px 18px;
  width: auto;
}
.link {
  background: none;
  border: 0;
  padding: 10px 4px;
  min-height: 44px;
  color: var(--violet);
  font-weight: 800;
  font-size: 16px;
  text-decoration: underline;
  text-underline-offset: 3px;
  border-radius: 8px;
}
.back-row {
  margin: 12px 0 0;
  text-align: center;
}

/* progress inside a button: a bar sliding along its bottom edge */
.progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  opacity: 0;
  overflow: hidden;
}
.progress::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  left: -40%;
  background: currentColor;
  opacity: 0.85;
}
.is-busy {
  cursor: progress;
}
.is-busy .progress {
  opacity: 1;
}
.is-busy .progress::after {
  animation: slide 1s linear infinite;
}
.primary.is-busy {
  background: var(--pink-hover);
}
.secondary.is-busy {
  background: var(--wash);
}
.secondary.is-saved {
  background: var(--ok-bg);
  border-color: var(--ok);
  color: var(--ok);
}
@keyframes slide {
  from {
    left: -40%;
  }
  to {
    left: 100%;
  }
}

/* ------------------------------------------------------------------ print step */

.print-head {
  margin-bottom: 16px;
}
.summary {
  font-size: 17px;
}
.edit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 16px;
}
.tips {
  list-style: none;
  margin: 0 0 4px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--wash);
  font-size: 16px;
}
.tips li {
  padding-left: 18px;
  position: relative;
}
.tips li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pink);
}
.pieces {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.piece {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 14px 16px;
  align-items: start;
  padding: 16px;
  border-radius: 20px;
}
.piece-foot {
  grid-column: 1 / -1;
}
.preview {
  width: 104px;
  height: 130px;
  border-radius: 12px;
  background: var(--wash);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.preview.wide {
  grid-column: 1 / -1;
  width: 100%;
  height: 170px;
  position: relative;
}
.preview {
  position: relative;
}
/* AV1, AW4: the preview is a button that opens the piece large: no button chrome, a zoom
   cursor, a clear focus ring, and under the picture (never over the art) a quiet "See it larger"
   line with a small magnifier, part of the same button: one tap target, one name. */
button.preview {
  border: 0;
  margin: 0;
  padding: 0 0 22px;
  font: inherit;
  color: inherit;
  cursor: zoom-in;
}
button.preview::after {
  content: "See it larger";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 3px;
  padding-left: 15px;
  font-size: 12px;
  font-weight: 800;
  line-height: 16px;
  color: var(--violet-deep);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}
button.preview::before {
  /* the magnifier (a ring and its handle), just before the words */
  content: "";
  position: absolute;
  left: calc(50% - 42px);
  bottom: 5px;
  width: 12px;
  height: 12px;
  background:
    radial-gradient(circle at 5px 5px, transparent 0 2.6px, var(--violet-deep) 2.8px 4.4px, transparent 4.6px),
    linear-gradient(135deg, transparent 0 60%, var(--violet-deep) 60% 78%, transparent 78%);
  pointer-events: none;
}
@media (max-width: 479px) {
  /* a phone's picture is 68 to 84 px wide: the words on two lines, the glass before the first */
  button.preview {
    padding-bottom: 28px;
  }
  button.preview::after {
    content: "See it\A larger";
    white-space: pre;
    padding-left: 0;
    font-size: 11px;
    line-height: 12px;
    bottom: 2px;
  }
  button.preview::before {
    left: calc(50% - 31px);
    bottom: 15px;
    width: 11px;
    height: 11px;
  }
  button.preview .preview-more {
    bottom: 34px;
  }
}
button.preview:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 3px;
}

/* AV1: the large view: the whole screen on a phone, a centred sheet on a wider screen. */
.large-view {
  border: 0;
  padding: 0;
  width: min(900px, 92vw);
  max-height: 92vh;
  border-radius: 20px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(30, 10, 60, 0.35);
}
.large-view[open] {
  display: flex;
  flex-direction: column;
}
.large-view::backdrop {
  background: rgba(30, 14, 60, 0.6);
}
.large-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.large-title {
  margin: 0;
  font-size: 20px;
}
.large-close {
  width: auto;
  min-height: 44px;
  padding: 8px 20px;
}
.large-body {
  overflow: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}
.large-picture {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}
@media (min-width: 480px) {
  /* AW2: on a wider screen the whole piece fits the sheet's visible height (the sheet is at most
     92 percent of the screen; its heading and padding take about 110 px), centred and with its
     own shape, so a portrait piece never needs scrolling; a wide one (the banner) still takes
     the width. */
  .large-picture {
    width: auto;
    max-width: 100%;
    max-height: calc(92vh - 112px);
    margin: 0 auto;
  }
}
.large-wait,
.large-more {
  margin: 12px 0 0;
  color: var(--muted);
}
@media (max-width: 479px) {
  .large-view {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }
  .large-body {
    padding: 12px;
  }
}
.piece:has(.preview.wide) .piece-body {
  grid-column: 1 / -1;
}
/* The landing line and picture are for the first step only. */
.past-order .intro,
.past-order .sample {
  display: none;
}
.preview-more {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 1px 4px rgba(58, 31, 122, 0.18);
}
.preview-more[hidden] {
  display: none;
}
.piece-saved {
  margin: 10px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ok);
}
.piece-saved[hidden] {
  display: none;
}
/* AQ1: a built file waiting for her own tap (the first tap has gone stale, or a share). */
.piece-ready {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.ready-line {
  flex-basis: 100%;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ok);
}
.piece-ready .save-link {
  flex: 1 1 auto;
  width: auto;
  min-width: 160px;
  text-decoration: none;
}
.piece-ready .share-ready {
  flex: 1 1 auto;
  width: auto;
}
.paper {
  margin: 14px 0 6px;
  padding: 0;
  border: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.paper legend {
  font-weight: 800;
  margin-bottom: 8px;
  padding: 0;
}
/* The phone's one-line paper hint (AP5); a wider screen shows each choice's own. */
.paper-hint {
  display: none;
}
.paper-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 16px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  cursor: pointer;
}
.paper-choice:has(input:checked) {
  border-color: var(--violet);
  background: var(--wash);
}
.paper-choice input {
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--violet);
}
.paper-name {
  font-weight: 800;
  font-size: 17px;
}
.paper-where {
  color: var(--muted);
  font-size: 15px;
}
.intro {
  margin: 10px auto 0;
  max-width: 34em;
  font-size: 16px;
  line-height: 1.45;
}
.sample {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  margin: 14px auto 0;
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.preview-canvas {
  /* The whole piece inside its box at every width: contain, never crop (Q4). */
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(58, 31, 122, 0.18);
}
.preview-wait {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  padding: 8px;
}
.preview.is-loading .preview-wait {
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}
.piece-title {
  margin: 0 0 2px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
}
.piece-size {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.35;
}
.piece-needs {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
}
.piece-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.piece-actions[hidden] {
  display: none;
}
.piece-actions .build {
  flex: 1 1 auto;
  min-width: 160px;
}
.piece-error:empty {
  display: none;
}
.piece-error {
  margin: 10px 0 0;
}
.piece-error .msg {
  font-size: 15px;
  padding: 10px 12px;
}

/* ------------------------------------------------------------------ footer */

.foot {
  margin-top: 28px;
  padding: 0 4px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  text-align: center;
}
.foot p {
  margin: 0 0 8px;
}
.foot a {
  color: var(--violet-deep);
  font-weight: 800;
  display: inline-block;
  padding: 10px 8px;
  min-height: 44px;
  border-radius: 8px;
  text-underline-offset: 3px;
}
.foot a:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
.foot .notice {
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
}

/* ------------------------------------------------------------------ privacy page */

.prose h2 {
  margin-top: 24px;
}
.prose h2:first-of-type {
  margin-top: 0;
}
.placeholder {
  border: 2px dashed var(--error);
  background: var(--error-bg);
  color: var(--error);
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 800;
}
.placeholder-text {
  color: var(--muted);
  font-style: italic;
}
.back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--violet);
  font-weight: 800;
  text-underline-offset: 3px;
  border-radius: 8px;
}
.back:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

/* ------------------------------------------------------------------ wider screens */

@media (min-width: 480px) {
  .card {
    padding: 32px 32px;
  }
  .actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .actions .primary,
  .actions .secondary {
    width: auto;
    min-width: 200px;
  }
  .piece {
    grid-template-columns: 128px 1fr;
  }
  .preview {
    width: 128px;
    height: 160px;
  }
  .paper {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 720px) {
  h1 {
    font-size: 36px;
  }
  .masthead {
    padding-top: 40px;
  }
  .pieces {
    grid-template-columns: 1fr 1fr;
  }
  .print-head {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 32px;
    align-items: start;
  }
  .print-head > h2,
  .print-head > .note,
  .print-head > .summary,
  .print-head > .edit-row {
    grid-column: 1;
  }
  .print-head > .tips {
    grid-column: 2;
    grid-row: 1 / span 4;
    align-self: start;
  }
  .print-head > .paper,
  .print-head > .colours {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .is-busy .progress::after {
    left: 0;
    width: 100%;
    opacity: 0.5;
  }
}

/* QA re-walk (2026-11-14) ------------------------------------------------------------ */

.page-wait,
.pieces-wait {
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}
.pieces-wait[hidden],
.page-wait[hidden] {
  display: none;
}
.order-found[hidden],
form[hidden] {
  display: none;
}
.found-line {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 8px;
}
.link.inline {
  display: inline;
  min-height: 44px;
  padding: 10px 2px;
  margin-right: 10px;
  font-size: inherit;
}
.tips-line {
  margin: 6px 0 10px;
  font-size: 15px;
  color: var(--muted);
}
.try-again {
  margin-top: 10px;
}
.piece-actions .share {
  flex: 0 1 auto;
}
.primary[aria-disabled="true"]:not(.is-busy) {
  opacity: 0.75;
}
@media (min-width: 720px) {
  .print-head {
    display: block;
  }
}

/* QA re-walk, round 2 (W1, W3, W4) ---------------------------------------------------- */

/* W1: the box is a flex container of fixed height, so the image's max sizes resolve and the
   image keeps its own shape inside it at every width (contain, never crop). */
.preview {
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-canvas {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  flex: 0 1 auto;
}

/* W3: "Loading your pieces" in the header card, with a progress cue. */
.pieces-wait {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 4px;
  text-align: left;
}
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid var(--line-soft);
  border-top-color: var(--violet);
  animation: spin 0.9s linear infinite;
  flex: none;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* W4: a shorter header on phones, so the first piece's button is on the first screen. */
.summary {
  margin-bottom: 0;
}
.edit-links {
  display: flex;
  flex-wrap: wrap;
  column-gap: 12px;
  margin: 0 0 4px;
}
.edit-links .link.inline {
  margin-right: 0;
  padding-left: 0;
  padding-right: 0;
  font-size: 14px;
  white-space: nowrap;
}
.paper {
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.paper legend {
  margin-bottom: 6px;
}
.paper-choice {
  min-height: 52px;
  padding: 8px 10px;
  gap: 8px;
  align-items: center;
}
.paper-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.paper-name {
  font-size: 16px;
}
.paper-where {
  font-size: 13px;
}
.tips-line {
  margin: 4px 0 6px;
  font-size: 14px;
}
@media (max-width: 479px) {
  .print-head {
    padding-top: 14px;
    padding-bottom: 10px;
    margin-bottom: 12px;
  }
  .print-head h2 {
    margin-bottom: 2px;
  }
  /* QA5 (AO4): the whole first Download button on the first screen at 390 x 844. */
  .print-head .tips-line {
    margin: 2px 0 1px;
  }
  .print-head .paper {
    margin: 6px 0 2px;
    gap: 8px;
  }
  .print-head .paper legend {
    margin-bottom: 2px;
  }
  .print-head .paper-choice {
    min-height: 44px;
    padding: 6px 12px;
  }
  /* The paper's hint ("US and Canada") stays for screen readers; on a phone each choice is one
     line (the default already follows the device's language). */
  .print-head .paper-where {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  /* AP5b: the label and all four swatches on one line down to 360 px (each swatch keeps its
     44 px target; the targets touch), with the paper hint clear of it above. */
  .print-head .colours {
    margin: 8px 0 0;
    flex-wrap: nowrap;
    gap: 0;
  }
  .print-head .colours-label {
    font-size: 15px;
    min-width: 0;
    margin-right: 6px;
    flex: 0 1 auto;
  }
  .print-head .colour-choice {
    flex: none;
  }
  .print-head .paper-hint {
    display: block;
    grid-column: 1 / -1;
    margin: -2px 0 0;
    font-size: 12.5px;
    line-height: 1.25;
    color: var(--muted);
  }
  .print-head .edit-links {
    margin-bottom: 0;
  }
  .print-head .summary {
    margin-top: 0;
  }
  .pieces {
    gap: 12px;
  }
}

/* ------------------------------------------------------------------ the free sample (AC1) */

.sample-names {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.sample-name {
  min-height: 44px;
  padding: 8px 16px;
  border: 2px solid var(--violet);
  border-radius: 999px;
  background: var(--card);
  color: var(--violet);
  font-size: 16px;
  font-weight: 800;
}
.sample-name[aria-pressed="true"] {
  background: var(--violet);
  color: #ffffff;
}
.sample-name:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
.sample-pieces {
  margin: 16px 0;
}
.piece.sample-piece {
  grid-template-columns: 1fr;
}
.sample-picture {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(58, 31, 122, 0.18);
}
.sample-foot a.primary {
  text-decoration: none;
}
/* The order step's quiet link to the sample: a whole 44 px tap target. */
.back-row a.link {
  display: inline-flex;
  align-items: center;
}
@media (min-width: 720px) {
  .piece.sample-piece.wide {
    grid-column: 1 / -1;
  }
}

/* ------------------------------------------------------------------ the party details' look (AD1) */

.look {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.look legend {
  font-weight: 800;
  margin-bottom: 8px;
  padding: 0;
}
.look-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px 10px;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  cursor: pointer;
}
.look-choice:has(input:checked) {
  border-color: var(--violet);
  background: var(--wash);
}
.look-choice input {
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--violet);
}
.look-choice img {
  grid-column: 1 / -1;
  grid-row: 1;
  width: 100%;
  height: auto;
  border-radius: 8px;
}
.look-name {
  font-weight: 800;
  font-size: 16px;
}

/* The welcome sign's poster (AJ1). */
.piece-actions .build-poster {
  width: 100%;
}
.poster-help {
  flex-basis: 100%;
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ the name's colour (AD3) */

/* One row, so the first download button stays on a phone's first screen (W4). */
.colours {
  margin: 10px 0 4px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
/* "Name colour:" over the picked colour's name (AD3c), so the four swatches stay on one row
   beside them at phone width and never move when the name changes. */
.colours-label {
  font-weight: 800;
  margin-right: 8px;
  line-height: 1.25;
  min-width: 6.6em;
}
.colour-picked {
  display: block;
}
.colour-choice {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 3px solid transparent;
  border-radius: 50%;
  cursor: pointer;
}
.colour-choice:has(input:checked) {
  border-color: var(--violet);
}
.colour-choice:has(input:focus-visible) {
  box-shadow: var(--focus);
}
.colour-choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}
.swatch-pink {
  background: #f2398a;
}
.swatch-blue {
  background: #2f7cf0;
}
.swatch-green {
  background: #2fb85c;
}
.swatch-purple {
  background: #8a3ff0;
}


/* The thank-you card's flat or folded choice (AG1). */
.fold {
  margin: 6px 0 10px;
  padding: 0;
  border: 0;
  display: grid;
  gap: 6px;
}
/* QOPS-174: the tick box under a party line: a blank line to write on by hand. */
.write-on {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 4px 0 0;
  padding: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
  cursor: pointer;
}
.write-on input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--violet);
}
.write-on input:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 4px;
}
.piece-note {
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.fold-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 10px;
  border: 2px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
}
.fold-choice:has(input:checked) {
  border-color: var(--violet);
  background: var(--wash);
}
.fold-choice input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--violet);
}

/* The optional photo (AE): the round placing preview, its zoom and its buttons. */
.photo {
  margin: 18px 0 8px;
  padding: 0;
  border: 0;
}
.photo legend {
  font-weight: 800;
  margin-bottom: 4px;
}
.photo-stage {
  width: min(300px, 78vw);
  aspect-ratio: 1;
  margin: 6px auto 4px;
  touch-action: none;
  cursor: grab;
  border-radius: 16px;
}
.photo-stage:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
.photo-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.photo-zoom {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 8px;
}
.photo-zoom label {
  font-weight: 700;
}
.photo-zoom input {
  flex: 1;
  min-height: 44px;
  font-size: 16px; /* iOS zooms into any control under 16px */
  accent-color: var(--violet);
}
.photo-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* A photo not kept after a reload (AO1). */
.photo-lost p {
  margin: 0 0 8px;
}
.photo-lost .photo-lost-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin: 0;
}
.photo-reload {
  margin: 8px 0 0;
}

/* The sample's "What you can change" (AO6). */
.sample-can {
  margin: 18px 0 6px;
  font-size: 17px;
}
.sample-change {
  margin: 0;
  padding-left: 20px;
  font-size: 16px;
  line-height: 1.5;
}

/* AQ2: on a phone, past step 1, the hero folds to one compact line above the stepper (the h1
   stays for screen readers), so the first Download button is on an iPhone's first screen. */
@media (max-width: 479px) {
  body[data-step]:not([data-step="order"]) .masthead {
    padding: 10px 0 0;
  }
  body[data-step]:not([data-step="order"]) .masthead .shop,
  body[data-step]:not([data-step="order"]) .masthead .intro,
  body[data-step]:not([data-step="order"]) .masthead .sample {
    display: none;
  }
  body[data-step]:not([data-step="order"]) .masthead h1 {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  body[data-step]:not([data-step="order"]) .masthead .kit {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    color: var(--violet-deep);
  }
  body[data-step]:not([data-step="order"]) .steps {
    margin-top: 6px;
    margin-bottom: 8px;
  }
  body[data-step]:not([data-step="order"]) .masthead {
    padding-top: 8px;
  }
  /* and a smaller picture beside each piece's title, so its button sits higher */
  .piece {
    grid-template-columns: 84px 1fr;
  }
  .piece .preview:not(.wide) {
    width: 84px;
    height: 105px;
  }
}

/* AR7: short phones (an iPhone SE, a small Android): the Print step's top tightened so the first
   Download button comes up sooner. Every tap target stays 44 px and no type goes under 13 px;
   nothing is hidden. */
@media (max-width: 479px) and (max-height: 700px) {
  body[data-step]:not([data-step="order"]) .masthead {
    padding-top: 4px;
  }
  body[data-step]:not([data-step="order"]) .steps {
    margin-top: 2px;
    margin-bottom: 4px;
  }
  .steps li {
    gap: 2px;
    font-size: 13px;
  }
  .steps .dot {
    width: 26px;
    height: 26px;
    font-size: 13px;
  }
  .steps li + li::before {
    top: 12px;
    width: calc(100% - 30px);
    margin-right: 15px;
  }
  .print-head {
    padding-top: 10px;
    padding-bottom: 8px;
    margin-bottom: 6px;
  }
  .print-head h2 {
    font-size: 20px;
  }
  .print-head .paper-hint {
    margin-top: -4px;
  }
  .print-head .summary {
    font-size: 16px;
    line-height: 1.35;
  }
  .print-head .tips-line {
    margin: 0 0 1px;
    font-size: 14px;
    line-height: 1.3;
  }
  .print-head .paper {
    margin-top: 2px;
  }
  .print-head .paper legend {
    margin-bottom: 0;
  }
  .print-head .colours {
    margin-top: 6px;
  }
  .piece {
    grid-template-columns: 68px 1fr;
    gap: 10px 14px;
    padding: 12px 14px 14px;
  }
  .piece .preview:not(.wide) {
    width: 68px;
    height: 85px;
  }
  .piece-actions .primary,
  .piece-actions .secondary {
    min-height: 48px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
}

/* AR7: the shortest phones (an iPhone SE, 553 px in Safari): the stepper keeps its numbered dots
   and drops its words from view (screen readers still hear each step's name and state), and the
   summary sits a little smaller. */
@media (max-width: 479px) and (max-height: 600px) {
  .steps .step-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .print-head .summary {
    font-size: 15px;
    line-height: 1.3;
  }
}
