/* Family Pieces web pages. One stylesheet for every page.
   Built for older eyes and hands (SPEC 6.9): body text 18px or more and growing with the browser's text
   size (everything is in rem), buttons and fields at least 56px tall, strong contrast in light and dark,
   visible focus, one column that works one-handed at 375px wide with no sideways scroll.
   The font is Atkinson Hyperlegible (made for low-vision readers), served from this site (OFL-1.1). */

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/assets/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/assets/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fbf8f5;
  --surface: #ffffff;
  --surface-2: #f6f1f4;
  --ink: #1f1b24;
  --muted: #554d5d;
  --line: #e2d9e3;
  --line-strong: #7d7283;
  --accent: #7a2e63;
  --accent-ink: #ffffff;
  --accent-hover: #62224f;
  --accent-soft: #f4e8f0;
  --ok: #1d6640;
  --ok-soft: #e3f2e9;
  --warn: #7d4300;
  --warn-soft: #fcefd9;
  --bad: #9e1f2a;
  --bad-soft: #fbe5e7;
  --bad-ink: #ffffff;
  --focus: #1b5fd6;
  --shadow: 0 1px 2px rgba(40, 20, 40, 0.06), 0 6px 20px rgba(40, 20, 40, 0.06);
  --radius: 16px;
  --sans: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141217;
    --surface: #1e1b23;
    --surface-2: #26222c;
    --ink: #f3eff5;
    --muted: #c4bccb;
    --line: #3a3442;
    --line-strong: #9a90a3;
    --accent: #eaa8d3;
    --accent-ink: #2a0e22;
    --accent-hover: #f4c5e3;
    --accent-soft: #3b2236;
    --ok: #93dcb0;
    --ok-soft: #16301f;
    --warn: #f5c47f;
    --warn-soft: #382812;
    --bad: #ffa6ad;
    --bad-soft: #3d191d;
    --bad-ink: #2b0a0e;
    --focus: #9cc3ff;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141217;
  --surface: #1e1b23;
  --surface-2: #26222c;
  --ink: #f3eff5;
  --muted: #c4bccb;
  --line: #3a3442;
  --line-strong: #9a90a3;
  --accent: #eaa8d3;
  --accent-ink: #2a0e22;
  --accent-hover: #f4c5e3;
  --accent-soft: #3b2236;
  --ok: #93dcb0;
  --ok-soft: #16301f;
  --warn: #f5c47f;
  --warn-soft: #382812;
  --bad: #ffa6ad;
  --bad-soft: #3d191d;
  --bad-ink: #2b0a0e;
  --focus: #9cc3ff;
  --shadow: none;
  color-scheme: dark;
}

/* iPhone and iPad: follow the phone's own text-size setting. */
@supports (font: -apple-system-body) and (-webkit-touch-callout: none) {
  html { font: -apple-system-body; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.25rem;
  line-height: 1.55;
  overflow-wrap: break-word;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
@media (max-width: 480px) { body { font-size: 1.15rem; } }

img, svg, canvas { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 1.4rem + 2.6vw, 2.75rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.5rem, 1.25rem + 1.2vw, 1.9rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0 0 1em; padding-left: 1.3em; }
li + li { margin-top: 0.4em; }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 0.08em; }
a:hover { color: var(--accent-hover); }
strong, b { font-weight: 700; }
small, .small { font-size: 1rem; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
[tabindex="-1"]:focus { outline: none; }

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 10;
  background: var(--surface); color: var(--ink); padding: 12px 16px; border-radius: 10px;
  border: 2px solid var(--focus);
}
.skip:focus { top: 12px; }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: 42rem; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.wrap.wide { max-width: 64rem; }
main { flex: 1; padding: 1.5rem 0 3rem; }
.stack > * + * { margin-top: 1.25rem; }
.stack > p { margin-bottom: 0; }
.stack-lg > * + * { margin-top: 2.25rem; }

.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 4rem; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 700; font-size: 1.2rem; color: var(--ink); text-decoration: none; padding: 0.4rem 0; }
.brand svg { width: 2rem; height: 2rem; flex: none; color: var(--accent); }
.brand:hover { color: var(--ink); }
/* Web play (20 Nov): the free game one tap away on every page, above the fold on phones. */
.btn.header-play { width: auto; min-height: 2.75rem; padding: 0.4rem 1.1rem; font-size: 1rem; flex: none; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 1.5rem 0 2rem; font-size: 1.05rem; }
.site-footer nav ul { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.site-footer nav li + li { margin-top: 0; }
.site-footer nav a { display: inline-block; padding: 0.5rem 0; min-height: 2.75rem; }
.site-footer p { color: var(--muted); }

/* ---------- panels and notices ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
@media (min-width: 560px) { .panel { padding: 1.75rem; } }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel.soft { background: var(--surface-2); box-shadow: none; }

.notice { border-radius: 12px; padding: 1rem 1.1rem; border: 2px solid transparent; background: var(--accent-soft); color: var(--ink); }
.notice.ok { background: var(--ok-soft); border-color: var(--ok); }
.notice.warn { background: var(--warn-soft); border-color: var(--warn); }
.notice.bad { background: var(--bad-soft); border-color: var(--bad); }
.notice.info { background: var(--accent-soft); border-color: var(--accent); }
.notice > :last-child { margin-bottom: 0; }
.notice strong:first-child { display: block; margin-bottom: 0.2rem; }

.draft-banner { background: var(--warn-soft); border: 3px solid var(--warn); color: var(--ink); border-radius: 12px; padding: 1rem 1.1rem; font-size: 1.35rem; font-weight: 700; text-align: center; }
.draft-banner span { display: block; font-size: 1.05rem; font-weight: 400; margin-top: 0.25rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 3.5rem; width: 100%; padding: 0.75rem 1.4rem;
  font: inherit; font-size: 1.15rem; font-weight: 700; line-height: 1.25; text-align: center; text-decoration: none;
  color: var(--accent-ink); background: var(--accent); border: 2px solid var(--accent); border-radius: 14px;
  cursor: pointer; touch-action: manipulation;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--accent); border-color: var(--accent); }
.btn.secondary:hover { background: var(--accent-soft); color: var(--accent); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: var(--bad-ink); }
.btn.danger:hover { filter: brightness(1.08); }
.btn.link { background: none; border-color: transparent; color: var(--accent); text-decoration: underline; font-weight: 700; min-height: 3.5rem; }
.btn.link:hover { background: var(--accent-soft); }
@media (min-width: 560px) { .btn.auto { width: auto; } }
.btn-row { display: flex; flex-direction: column; gap: 0.75rem; }
@media (min-width: 560px) { .btn-row.inline { flex-direction: row; flex-wrap: wrap; } .btn-row.inline .btn { width: auto; } }

.store-buttons { display: flex; flex-direction: column; gap: 0.75rem; }
@media (min-width: 560px) { .store-buttons { flex-direction: row; } .store-buttons .btn { width: auto; flex: 1; } }

/* ---------- forms ---------- */
form { margin: 0; }
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field + .field, .field + .check, .check + .field { margin-top: 1.25rem; }
label, .label { font-weight: 700; }
.hint { color: var(--muted); font-size: 1.05rem; font-weight: 400; margin: 0; }
input[type="text"], input[type="email"], input[type="tel"], input[type="search"], textarea, select {
  width: 100%; min-height: 3.5rem; padding: 0.7rem 0.95rem;
  font: inherit; font-size: 1.2rem; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line-strong); border-radius: 12px;
}
textarea { min-height: 5.5rem; resize: vertical; line-height: 1.4; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.85; }
input[aria-invalid="true"] { border-color: var(--bad); }
.field-error { color: var(--bad); font-weight: 700; margin: 0.35rem 0 0; font-size: 1.05rem; }
.field-error::before { content: "! "; }
.code-input { letter-spacing: 0.35em; font-size: 1.6rem !important; font-variant-numeric: tabular-nums; text-align: center; max-width: 16rem; }

.check { display: flex; gap: 0.85rem; align-items: flex-start; padding: 0.6rem 0; min-height: 3.5rem; cursor: pointer; font-weight: 400; }
.check input { flex: none; width: 1.75rem; height: 1.75rem; margin: 0.1rem 0 0; accent-color: var(--accent); cursor: pointer; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 0.6rem; font-size: 1.25rem; }

/* choice cards (gift products) */
.choices { display: flex; flex-direction: column; gap: 0.75rem; }
.choice { position: relative; display: flex; gap: 0.85rem; align-items: flex-start; padding: 1rem 1.1rem; border: 2px solid var(--line-strong); border-radius: 14px; background: var(--surface); cursor: pointer; font-weight: 400; min-height: 3.5rem; }
.choice input { flex: none; width: 1.6rem; height: 1.6rem; margin: 0.15rem 0 0; accent-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice .choice-title { display: block; font-weight: 700; }
.choice .choice-price { display: block; font-weight: 700; color: var(--accent); }
.choice .choice-detail { display: block; color: var(--muted); font-size: 1.05rem; margin-top: 0.2rem; }

/* ---------- home page ---------- */
.hero { padding: 1rem 0 0.5rem; }
.hero .lede { font-size: 1.3rem; }
.hero-art { display: block; width: 100%; max-width: 22rem; height: auto; max-height: 30vh; margin: 0 auto 1rem; }
.steps { list-style: none; padding: 0; margin: 0; counter-reset: step; display: grid; gap: 1rem; }
.steps li { counter-increment: step; position: relative; padding: 1.1rem 1.1rem 1.1rem 4rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 0; }
.steps li::before { content: counter(step); position: absolute; left: 1rem; top: 1rem; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; }
.steps h3 { margin: 0 0 0.3rem; font-size: 1.25rem; }
.ticks { list-style: none; padding: 0; }
.ticks li { position: relative; padding-left: 2rem; }
.ticks li::before { content: ""; position: absolute; left: 0.2rem; top: 0.45em; width: 0.9rem; height: 0.5rem; border-left: 3px solid var(--ok); border-bottom: 3px solid var(--ok); transform: rotate(-45deg); }

/* ---------- upload page ---------- */
.picker-label { position: relative; }
.picker-label input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.picker-label:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.photo-list { list-style: none; padding: 0; margin-left: 0; margin-right: 0; margin-bottom: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.photo-list li { margin: 0; }
.photo-row { display: grid; grid-template-columns: 5rem minmax(0, 1fr); gap: 0.85rem; align-items: start; padding: 0.75rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.thumb { width: 5rem; height: 5rem; border-radius: 10px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); font-size: 0.95rem; text-align: center; overflow: hidden; }
.photo-row .photo-body { min-width: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.photo-row .photo-name { font-size: 1rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-row label { font-size: 1.05rem; }
.photo-row input[type="text"] { font-size: 1.1rem; }
.photo-row .remove { align-self: flex-start; min-height: 3.5rem; padding: 0.35rem 0.75rem; font-size: 1.05rem; width: auto; }
.status { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 700; font-size: 1.05rem; padding: 0.2rem 0.65rem; border-radius: 999px; background: var(--surface-2); color: var(--ink); align-self: flex-start; }
.status::before { content: ""; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--line-strong); flex: none; }
.status.sent { background: var(--ok-soft); color: var(--ok); }
.status.sent::before { background: var(--ok); }
.status.duplicate, .status.skipped { background: var(--warn-soft); color: var(--warn); }
.status.duplicate::before, .status.skipped::before { background: var(--warn); }
.status.failed { background: var(--bad-soft); color: var(--bad); }
.status.failed::before { background: var(--bad); }
.status.sending::before, .status.preparing::before { background: var(--accent); }
.photo-msg { font-size: 1.02rem; color: var(--muted); margin: 0; }

.progress-wrap { display: flex; flex-direction: column; gap: 0.6rem; }
.progress { width: 100%; height: 2rem; border-radius: 999px; background: var(--surface-2); border: 2px solid var(--line-strong); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.3s ease; }
.progress-line { font-size: 1.35rem; font-weight: 700; margin: 0; }
@media (prefers-reduced-motion: reduce) { .progress > span { transition: none; } }

.sender-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; }
.sender-line .btn.link { width: auto; min-height: 3.5rem; padding: 0.25rem 0.6rem; }
.consent { font-size: 1.05rem; color: var(--ink); background: var(--surface-2); border-radius: 12px; padding: 0.9rem 1rem; }

/* ---------- gift card (card.html) ---------- */
.giftcard {
  width: 100%; max-width: 128mm; margin: 0 auto; background: #ffffff; color: #1f1b24;
  border: 2px solid #7a2e63; border-radius: 6mm; padding: 8mm 8mm 7mm; text-align: center;
  display: flex; flex-direction: column; gap: 4mm; font-size: 12pt; line-height: 1.4;
}
.giftcard .gc-brand { display: inline-flex; align-items: center; justify-content: center; gap: 2.5mm; font-weight: 700; font-size: 13pt; color: #7a2e63; }
.giftcard .gc-brand svg { width: 9mm; height: 9mm; color: #7a2e63; }
.giftcard h1 { font-size: 20pt; margin: 0; color: #1f1b24; }
.giftcard .gc-what { font-size: 14pt; font-weight: 700; margin: 0; }
.giftcard .gc-qr { width: 46mm; height: 46mm; margin: 0 auto; }
.giftcard .gc-qr svg { width: 100%; height: 100%; display: block; }
.giftcard .gc-code { font-size: 18pt; font-weight: 700; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; white-space: nowrap; margin: 0; }
.giftcard .gc-small { font-size: 10.5pt; color: #4b4452; margin: 0; }
.giftcard .gc-dates { display: flex; justify-content: center; gap: 8mm; font-size: 11pt; margin: 0; flex-wrap: wrap; }
.giftcard .gc-dates b { display: block; font-size: 9.5pt; text-transform: uppercase; letter-spacing: 0.06em; color: #4b4452; }
.card-tools { max-width: 128mm; margin: 1.5rem auto 0; }
.sample-flag { max-width: 128mm; margin: 0 auto 1rem; }

/* ---------- admin ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.75rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.9rem 1rem; }
.stat b { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 1rem; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 1.05rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 700; }
.report { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 1rem; align-items: start; }
.report img { width: 7rem; height: 7rem; object-fit: cover; border-radius: 10px; background: var(--surface-2); }
@media (max-width: 420px) { .report { grid-template-columns: 1fr; } }

/* ---------- legal pages ---------- */
.legal h2 { margin-top: 2rem; }
.legal h3 { margin-top: 1.25rem; }
.legal .todo { background: var(--warn-soft); border-left: 4px solid var(--warn); padding: 0.1rem 0.4rem; }
.legal table { margin: 0.5rem 0 1rem; }
@media (max-width: 560px) {
  .legal table, .legal tbody, .legal tr, .legal td { display: block; width: 100%; }
  .legal thead { display: none; }
  .legal tr { border-bottom: 1px solid var(--line); padding: 0.5rem 0; }
  .legal td { border: 0; padding: 0.2rem 0; }
  .legal td:first-child { font-weight: 700; }
}

/* ---------- print ---------- */
@media print {
  @page { margin: 10mm; }
  body { background: #fff !important; color: #000 !important; display: block; min-height: 0; }
  .site-header, .site-footer, .no-print, .skip { display: none !important; }
  main { padding: 0; }
  .giftcard { break-inside: avoid; page-break-inside: avoid; box-shadow: none; margin-top: 0; }
  a { color: #000; }
}

/* ---------- gift thanks page ---------- */
.gift-code { font-weight: 700; font-variant-numeric: tabular-nums; margin: 0; }
#gift-link { font-size: 1.05rem; }

/* ---------- 12-character gift codes (XXXX-XXXX-XXXX) ---------- */
.gift-code-input { font-size: 1.5rem !important; letter-spacing: 0.08em; text-transform: uppercase; font-variant-numeric: tabular-nums; max-width: 21rem; }
.gift-code { font-size: clamp(1.3rem, 6vw, 1.9rem); letter-spacing: 0.06em; white-space: nowrap; }

/* ---------- opened from the iOS app (?from=app): no gift shop, gift code or web prices ---------- */
:root[data-from-app] [data-web-only] { display: none !important; }

/* ---------- "clear enough" check on the upload page ---------- */
.photo-msg.bad { color: var(--bad); font-weight: 700; }
.quality-choice { border: 2px solid var(--warn); background: var(--warn-soft); border-radius: 12px; padding: 0.6rem 0.85rem 0.3rem; }
.quality-choice legend { float: left; width: 100%; font-size: 1.05rem; font-weight: 700; padding: 0; margin: 0.2rem 0 0.3rem; }
.quality-choice legend + * { clear: both; }
.quality-choice .check { min-height: 3.5rem; align-items: center; padding: 0.2rem 0; }
