/* Family Tree (/family-tree): the step-by-step guide (wizard.js). Written for 55–80 year olds on a
   phone: every word at least 18 px, every button at least 48 px tall (the main ones 60), one question
   per screen, ← Back / Save & Next → pinned to the bottom of the card while it is on screen.
   The site's look: cream card, burgundy buttons, Georgia headings (app.css variables). */

.wizard { position: relative; margin: 0 0 18px; padding: 18px 16px 0; background: var(--cream); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(45, 33, 29, .04), 0 18px 40px -30px rgba(45, 33, 29, .45); color: var(--ink); font: 19px/1.45 var(--sans); scroll-margin-top: 8px; }
.wizard *, .wizard *::before, .wizard *::after { box-sizing: border-box; }
.wizard p { margin: 0; }
.wz-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wz-screen { display: flex; flex-direction: column; gap: 16px; }

/* Progress: "Step 2 of 5 · Photos" over five bars */
.wz-progress { display: grid; gap: 8px; }
.wz-step { font-size: 18px; font-weight: 700; color: var(--muted); }
.wz-bar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; margin: 0; padding: 0; list-style: none; }
.wz-bar li { height: 8px; border-radius: 999px; background: var(--line); }
.wz-bar li.done { background: #b98a8d; }
.wz-bar li.on { background: var(--burgundy); }

/* The question */
.wz-head { display: grid; gap: 8px; }
.wz-eyebrow { font-size: 18px; font-weight: 700; color: var(--burgundy); }
.wz-h { font: 400 29px/1.15 var(--serif); color: var(--ink); text-wrap: balance; }
.wz-h:focus { outline: none; }
.wz-h:focus-visible { outline: 3px solid var(--burgundy); outline-offset: 4px; border-radius: 6px; }
.wz-lead { font-size: 19px; color: #5f524a; text-wrap: pretty; }
.wz-note { font-size: 18px; color: #5f524a; }
.wz-note a { color: var(--burgundy); font-weight: 700; }

/* Buttons */
.wz-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 10px 22px; border: 2px solid var(--burgundy); border-radius: 999px; background: #fff; color: var(--burgundy); font: 700 19px/1.2 var(--sans); text-align: center; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .15s, transform .1s; }
.wz-btn:active { transform: translateY(1px); }
.wz-btn:disabled { opacity: .6; cursor: default; transform: none; }
.wz-btn:focus-visible, .wz-choice:focus-visible, .wz-pedit:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
@media (hover: hover) { .wz-btn:not(:disabled):hover { background: var(--blush); } }
.wz-btn.wz-primary { min-height: 60px; border-color: var(--burgundy); background: var(--burgundy); color: #fff; font-size: 20px; box-shadow: 0 10px 22px -12px rgba(80, 22, 27, .75); }
@media (hover: hover) { .wz-btn.wz-primary:not(:disabled):hover { background: var(--burgundy-dark); border-color: var(--burgundy-dark); } }
.wz-btn.wz-quiet { border-color: #cdb9a3; color: var(--ink); }
.wz-btn.wz-small { min-height: 48px; padding: 6px 16px; font-size: 18px; border-width: 2px; }
.wz-block { width: 100%; }
.wz-stack { display: grid; gap: 12px; }
.wz-ic { display: inline-flex; flex: none; }
.wz-ic svg { display: block; }

/* Back / Save & Next, pinned to the bottom while the card is on screen */
.wz-nav { position: sticky; bottom: 0; z-index: 6; display: flex; gap: 10px; margin: 6px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: rgba(255, 252, 247, .97); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); box-shadow: 0 -10px 20px -18px rgba(45, 33, 29, .55); }
.wz-nav .wz-back { flex: 0 0 auto; border-color: #cdb9a3; color: var(--ink); padding-inline: 18px; }
.wz-nav .wz-next { flex: 1 1 auto; min-width: 0; }
.wz-nav .wz-next span[aria-hidden] { font-size: 22px; line-height: 1; }
.wz-screen.no-nav { padding-bottom: 22px; }

/* Answers: big buttons; the chosen one burgundy with a tick */
.wz-answers { display: grid; gap: 10px; }
.wz-choice { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 44px 10px 16px; border: 2px solid #dcc9b4; border-radius: 16px; background: #fff; color: var(--ink); font: 700 19px/1.25 var(--sans); text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: border-color .15s, background .15s; }
@media (hover: hover) { .wz-choice:hover { border-color: #b98a8d; } }
.wz-choice:active { background: var(--blush); }
.wz-ctext { display: flex; align-items: center; gap: 14px; flex: 1 1 auto; min-width: 0; }
.wz-tick { position: absolute; top: 50%; right: 12px; display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; margin-top: -13px; border: 2px solid #dcc9b4; border-radius: 50%; color: transparent; background: #fff; }
.wz-choice[aria-pressed="true"] { border-color: var(--burgundy); background: var(--blush); box-shadow: 0 0 0 1px var(--burgundy); color: var(--burgundy); }
.wz-choice[aria-pressed="true"] .wz-tick { border-color: var(--burgundy); background: var(--burgundy); color: #fff; }

/* Picture cards: the tree designs (2:3), the finishes (square), the formats and sizes (text) */
.wz-card { padding: 10px 44px 10px 10px; }
.wz-card img { flex: none; width: 42%; max-width: 170px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; background: var(--lightcream); box-shadow: 0 2px 8px -4px rgba(45, 33, 29, .35); }
.wz-card-sq img { width: 30%; max-width: 120px; aspect-ratio: 1; }
.wz-dtext { display: grid; gap: 4px; min-width: 0; }
.wz-dtext b { font: 400 24px/1.15 var(--serif); color: var(--ink); }
.wz-choice[aria-pressed="true"] .wz-dtext b { color: var(--burgundy); }
.wz-dtext > span { font-size: 18px; font-weight: 400; line-height: 1.35; color: #5f524a; }
.wz-card-text { padding: 14px 44px 14px 16px; }
.wz-card-text .wz-ctext { justify-content: space-between; align-items: center; }
.wz-fprice { flex: none; display: grid; justify-items: end; font-size: 20px; font-weight: 800; color: var(--burgundy); white-space: nowrap; }
.wz-fprice s { font-size: 18px; font-weight: 400; color: var(--muted); }
.wz-dtext > .wz-from-price { justify-items: start; margin-top: 2px; font-size: 20px; font-weight: 800; color: var(--burgundy); }
.wz-pop { justify-self: start; padding: 1px 10px; border-radius: 999px; background: #f3e3c4; color: #6b4a12 !important; font-size: 18px !important; font-weight: 700 !important; }

/* Price + "Free preview" */
.wz-price { display: grid; gap: 4px; padding: 12px 14px; border-radius: 14px; background: var(--lightcream); border: 1px solid var(--line); }
.wz-free { display: flex; align-items: flex-start; gap: 8px; font-weight: 700; color: #2f6b3a; }
.wz-free .wz-ic { margin-top: 4px; color: #2f6b3a; }
.wz-from { font-size: 18px; color: #5f524a; padding-left: 26px; }

/* Photos */
.wz-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; overflow: hidden; }
.wz-up { min-height: 64px; font-size: 21px; }
.wz-count { font-weight: 700; color: var(--muted); font-size: 18px; }
.wz-plist { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.wz-photo-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); grid-template-areas: "thumb info" "btns btns"; gap: 10px 14px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.wz-pthumb { grid-area: thumb; display: flex; align-items: center; justify-content: center; width: 96px; height: 96px; border-radius: 10px; background: var(--lightcream); overflow: hidden; }
.wz-pthumb img { width: 100%; height: 100%; object-fit: contain; }
.wz-pinfo { grid-area: info; display: grid; gap: 4px; min-width: 0; }
.wz-pname { font: 400 22px/1.2 var(--serif); }
.wz-pstat { display: flex; align-items: center; gap: 8px; font-size: 18px; color: #5f524a; min-height: 28px; }
.wz-pstat.ok { color: #2f6b3a; font-weight: 700; }
.wz-pbtns { grid-area: btns; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.wz-private { display: flex; align-items: flex-start; gap: 10px; font-size: 18px; color: #5f524a; }
.wz-private .wz-ic { margin-top: 2px; color: var(--burgundy); }
.wz-later { display: grid; gap: 10px; margin-top: 4px; padding: 16px 14px; border-radius: 16px; border: 2px dashed #dcc9b4; background: var(--lightcream); text-align: center; }
.wz-later-q { font: 400 22px/1.2 var(--serif); }
.wz-later-btn { background: #fff; }

/* Spinner */
.wz-spin { display: inline-block; flex: none; width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--burgundy); animation: wz-spin 1s linear infinite; }
@keyframes wz-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .wz-spin { animation-duration: 3s; } }
.wz-wait { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.wz-working { display: grid; justify-items: center; gap: 14px; padding: 18px 0 6px; text-align: center; font: 400 22px/1.3 var(--serif); }
.wz-working .wz-spin { width: 46px; height: 46px; border-width: 4px; }

/* A photo with its faces numbered */
.wz-stage { display: flex; justify-content: center; }
.wz-canvas { display: block; max-width: 100%; border-radius: 12px; background: var(--lightcream); box-shadow: 0 0 0 1px var(--line), 0 10px 24px -16px rgba(0, 0, 0, .6); }
.wz-canvas.small { border-radius: 8px; }

/* "Who is this person to you?": the face big, where they are in the photo beside it */
.wz-face { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: end; }
.wz-face.solo { grid-template-columns: minmax(0, 190px); justify-content: center; }
.wz-crop-wrap { position: relative; }
.wz-crop { display: block; width: 100%; aspect-ratio: 4 / 5; border-radius: 18px; background: var(--lightcream); box-shadow: 0 0 0 3px var(--burgundy), 0 14px 28px -16px rgba(0, 0, 0, .55); }
.wz-badge { position: absolute; top: -10px; left: -10px; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; border: 3px solid #fff; background: var(--burgundy); color: #fff; font: 800 18px/1 var(--sans); box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.wz-where { display: grid; justify-items: center; gap: 6px; margin: 0; }
.wz-where figcaption { font-size: 18px; color: var(--muted); }
.wz-mini { display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: 16px; background: var(--lightcream); }
.wz-crop.small { flex: none; width: 84px; border-radius: 12px; box-shadow: 0 0 0 2px var(--burgundy); }
.wz-mini-rel { font: 400 22px/1.2 var(--serif); }
.wz-mini-name { font-weight: 700; }

.wz-rels { gap: 14px; }
.wz-rgroup { display: grid; gap: 8px; }
.wz-glabel { font-size: 18px; font-weight: 700; color: var(--muted); }
/* Two answers a row ("Grandson | Granddaughter"): centred words, the tick as a corner badge when
   chosen, so a long word like "Granddaughter" fits half a 390 px phone at 18 px bold. */
.wz-rbtns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.wz-rgroup.one .wz-rbtns { grid-template-columns: minmax(0, 1fr); }
.wz-rbtns .wz-choice { justify-content: center; padding: 10px 8px; font-size: 18px; text-align: center; }
.wz-rbtns .wz-ctext { justify-content: center; overflow-wrap: break-word; hyphens: auto; }
.wz-rbtns .wz-tick { top: -9px; right: -9px; margin: 0; display: none; }
.wz-rbtns .wz-choice[aria-pressed="true"] .wz-tick { display: flex; }
.wz-leave { border-style: dashed; color: #5f524a; font-weight: 600; }
.wz-leave[aria-pressed="true"] { border-style: solid; border-color: #6d625b; background: #efe9e3; color: var(--ink); box-shadow: 0 0 0 1px #6d625b; }
.wz-leave[aria-pressed="true"] .wz-tick { border-color: #6d625b; background: #6d625b; }
.wz-full { padding: 12px 14px; border-radius: 14px; background: #fff4d6; border: 1px solid #e7c779; font-weight: 600; }

/* Text answers */
.wz-label { display: block; margin-bottom: -8px; font-size: 19px; font-weight: 700; }
.wz-opt { font-weight: 400; color: var(--muted); }
.wz-input { display: block; width: 100%; min-height: 60px; padding: 12px 16px; border: 2px solid #b8a593; border-radius: 14px; background: #fff; color: var(--ink); font: 400 21px/1.3 var(--sans); }
.wz-input::placeholder { color: #8b7d73; }
.wz-input:focus { outline: 3px solid var(--burgundy); outline-offset: 1px; border-color: var(--burgundy); }
.wz-skip { margin-top: -4px; }
.wz-pv { display: grid; justify-items: center; gap: 4px; padding: 16px 12px 18px; border-radius: 16px; background: #fbf6ea; border: 1px solid #ead9b9; text-align: center; }
.wz-pv-label { font-size: 18px; color: var(--muted); }
.wz-pv-title { font: italic 400 30px/1.15 var(--serif); color: #3c2a1c; overflow-wrap: anywhere; }
.wz-pv-title.ph { color: #a99686; }
.wz-pv-line { font-size: 18px; letter-spacing: .12em; text-transform: uppercase; color: #6b5a48; overflow-wrap: anywhere; }

/* Review */
.wz-tree-card { display: grid; grid-template-columns: 76px 1fr; gap: 14px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.wz-tree-card img { width: 76px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px; background: var(--lightcream); }
.wz-tree-card > div { display: grid; gap: 2px; justify-items: start; min-width: 0; }
.wz-tc-title { font: 400 23px/1.2 var(--serif); }
.wz-tree-card .wz-change { margin-top: 6px; }
.wz-gen { display: grid; gap: 8px; }
.wz-gen-h { font: 700 18px/1.2 var(--sans); color: var(--muted); letter-spacing: .02em; }
.wz-people { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
/* A person: the face, the name, the relationship; the whole card changes them, Remove sits on
   the card's last line, to the right of "Change". */
.wz-prow { position: relative; padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.wz-pedit { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: start; width: 100%; padding: 6px; border: 0; border-radius: 12px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
@media (hover: hover) { .wz-pedit:hover { background: var(--lightcream); } }
.wz-pimg { width: 64px; height: 80px; object-fit: cover; border-radius: 10px; background: var(--lightcream); }
.wz-ptext { display: grid; min-width: 0; line-height: 1.3; }
.wz-ptext b { font: 400 22px/1.2 var(--serif); overflow-wrap: break-word; }
.wz-ptext > span { font-size: 18px; color: #5f524a; }
.wz-ptext .wz-plink { display: flex; align-items: center; min-height: 48px; color: var(--burgundy); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.wz-prow .wz-premove { position: absolute; right: 12px; bottom: 12px; padding-inline: 14px; border-color: #cdb9a3; color: var(--ink); }
.wz-prow.out { background: #f6f1ec; border-style: dashed; }
.wz-prow.out .wz-pimg { filter: grayscale(1); opacity: .7; }
.wz-dups { display: grid; gap: 4px; padding: 12px 14px; border-radius: 14px; background: #fff4d6; border: 1px solid #e7c779; }
.wz-dups-h { font-weight: 800; }
.wz-few { display: grid; gap: 12px; padding: 14px; border-radius: 14px; background: #fff4d6; border: 1px solid #e7c779; font-weight: 600; }
.wz-sum { font-weight: 700; color: var(--muted); }
/* For / Family name / Line under it: the label over the answer, Change on the right */
.wz-words { display: grid; margin: 0; padding: 0 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.wz-wrow { position: relative; display: grid; align-content: center; gap: 2px; min-height: 76px; padding: 12px 112px 12px 0; }
.wz-wrow + .wz-wrow { border-top: 1px solid var(--line); }
.wz-wrow dt { font-size: 18px; font-weight: 700; color: var(--muted); }
.wz-wrow dd { margin: 0; font-size: 19px; overflow-wrap: break-word; }
.wz-wrow .wz-change { position: absolute; top: 50%; right: 0; margin-top: -24px; border-color: #cdb9a3; color: var(--burgundy); }
.wz-none { color: var(--muted); font-style: italic; }
.wz-reassure { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; background: #eef5ec; border: 1px solid #c9dfc3; color: #24482b; font-size: 19px; }
.wz-reassure .wz-ic { margin-top: 2px; }

.wz-err { padding: 12px 14px; border-radius: 12px; background: #fdecec; border: 1px solid #f1c3c3; color: #8a1c1c; font-size: 19px; font-weight: 700; }

/* Welcome back */
.wz-wthumbs { display: flex; gap: 8px; }
.wz-wthumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; border: 3px solid #fff; box-shadow: 0 4px 12px -6px rgba(0, 0, 0, .4); }

/* Order mode */
.wz-how { display: grid; gap: 10px; margin: 0; padding: 0 0 0 0; list-style: none; counter-reset: how; }
.wz-how li { position: relative; padding-left: 46px; min-height: 34px; counter-increment: how; }
.wz-how li::before { content: counter(how); position: absolute; left: 0; top: -2px; width: 34px; height: 34px; border-radius: 50%; background: var(--burgundy); color: #fff; font: 800 18px/34px var(--sans); text-align: center; }
.wz-art { display: flex; justify-content: center; }
.wz-art-img { width: 100%; max-width: 440px; height: auto; border-radius: 10px; box-shadow: 0 0 0 1px var(--line), 0 18px 34px -20px rgba(0, 0, 0, .6); background: var(--lightcream); }
.wz-approve { display: grid; gap: 12px; }
.wz-confirm { font: 400 22px/1.3 var(--serif); text-align: center; }

/* Phones narrower than 360 px: a little more room for the words */
@media (max-width: 359px) {
  .wizard { padding-inline: 12px; }
  .wz-nav { margin-inline: -12px; padding-inline: 12px; }
  .wz-h { font-size: 26px; }
  .wz-rbtns { grid-template-columns: 1fr; }
  .wz-photo-row { grid-template-columns: 80px 1fr; }
  .wz-pthumb { width: 80px; height: 80px; }
}
@media (min-width: 600px) {
  .wizard { padding: 24px 24px 0; }
  .wz-nav { margin-inline: -24px; padding-inline: 24px; }
  .wz-h { font-size: 32px; }
}

/* The "working" panel and the result's "Restored from" row (app.js) show one face per person
   here, up to twelve: let them wrap instead of widening the page. */
body:has(#wizard) .ring-thumbs { flex-wrap: wrap; row-gap: 10px; }
body:has(#wizard) .source { flex-wrap: wrap; }
body:has(#wizard) .source-thumbs { flex-wrap: wrap; justify-content: center; row-gap: 6px; }
