/* pro-flow.css: the ordering flow on pro.html, one step on screen at a time.
   Loaded after paper.css and adds to it. Tokens come from paper.css; the three values below are
   this page's own, because paper.css has no error colour and no handwriting. */
.flow {
    --flow-error: #A3341F;      /* 6.1:1 on paper */
    --flow-pen: #27376B;        /* the blue ink a card is written in */
    --flow-hand: "Caveat", "Segoe Print", cursive;   /* the note preview only */
    --flow-max: 1040px;
}

.flow [hidden] { display: none !important; }
.flow ol, .flow fieldset, .flow legend { margin: 0; padding: 0; }
.flow ol { list-style: none; }
.flow fieldset { border: 0; min-width: 0; }
/* Zero specificity, so paper.css's .btn keeps its own font and colour. */
:where(.flow) :where(button, input, textarea, select) { font: inherit; color: inherit; }
.flow button { cursor: pointer; }
.flow h1:focus, .flow h2:focus { outline: none; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.flow h1 { font-size: 30px; line-height: 1.12; }
.flow h2 { font-size: 24px; line-height: 1.2; letter-spacing: -0.01em; }
.flow .sub { color: var(--muted); }
.flow .err { font-size: 15px; line-height: 1.45; color: var(--flow-error); font-weight: 500; }
.flow .price { font-size: 20px; font-weight: 500; }
.flow .price s { margin-left: 4px; font: 400 15px/1 var(--text); letter-spacing: 0; color: var(--muted); }

/* ---------- Shell ---------- */
.app { min-height: 100svh; display: flex; flex-direction: column; }
.flow main { flex: 1; display: flex; flex-direction: column; }
.flow .wrap { max-width: calc(var(--flow-max) + 2 * var(--gutter)); }
.flow .site-head .wrap { flex-wrap: nowrap; align-items: center; gap: 12px; min-height: 56px; padding-top: 0; padding-bottom: 0; }
.flow .brand { display: inline-flex; align-items: center; min-height: 44px; font-size: 22px; color: var(--ink); text-decoration: none; }
.trail { display: flex; }
.trail button { min-width: 44px; min-height: 44px; padding: 0 9px; border: 0; background: none; font-size: 15px; color: var(--ink); }
.trail button:disabled { color: var(--muted); cursor: default; }
.trail button[aria-current="step"] { font-weight: 600; color: var(--accent); }
.trail button[aria-current="step"]::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.account-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; color: var(--ink); }
/* The cart button: a bag with the number of items, beside the steps */
.cart-btn { position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: auto; padding: 0; border: 0; border-radius: var(--radius); background: none; color: var(--ink); }
.cart-btn svg { width: 26px; height: 26px; }
/* The count sits on the bag's shoulder, so the button stays 44 px wide beside the steps. */
.cart-count { position: absolute; top: 3px; right: 0; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--ink); color: var(--surface); font: 600 12px/20px var(--text); text-align: center; font-variant-numeric: tabular-nums; }
.cart-btn:hover .cart-count { background: var(--accent); }
/* A personal order (pro.html?role=personal) has no account, company, license or note writer. */
.is-personal .pro-only { display: none !important; }

.screen { animation: flow-rise 0.26s ease both; }
@keyframes flow-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes flow-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes flow-slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Controls ---------- */
.flow .btn.wide { width: 100%; }
.flow .btn:disabled { background: var(--muted); cursor: default; }
.btn-quiet { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--surface); font: 500 16px/1.2 var(--text); }
.btn-quiet:hover { background: var(--paper); }
.btn-quiet:disabled { color: var(--muted); border-color: var(--field-line); cursor: default; }
.btn-quiet.wide { width: 100%; }
.flow .link { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; color: var(--accent); font: 500 16px/1.35 var(--text); text-decoration: underline; text-decoration-color: var(--mark); text-decoration-thickness: 1.5px; text-underline-offset: 3px; text-align: left; }
.flow .link:hover { color: var(--accent-press); }
.flow .link.soft { color: var(--ink); font-size: 15px; font-weight: 400; text-decoration-color: var(--field-line); }
.flow .link.soft:hover { text-decoration-color: var(--ink); }

.field { display: grid; gap: 6px; }
.field > label, .field > .label-row label { font-size: 16px; font-weight: 600; }
.field input, .field textarea, .field select { width: 100%; min-height: 54px; padding: 12px 14px; border: 1px solid var(--field-line); border-radius: var(--radius); background: var(--surface); font-size: 17px; }
.field input::placeholder { color: var(--muted); opacity: 1; }
.field textarea { min-height: 0; resize: vertical; line-height: 1.45; }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible, .date:focus-visible { outline-offset: 1px; border-color: var(--accent); border-radius: var(--radius); }
.field [aria-invalid="true"] { border-color: var(--flow-error); box-shadow: inset 0 0 0 1px var(--flow-error); }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.count { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Choice chips: a hidden radio and its label */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: var(--radius); background: var(--surface); box-shadow: inset 0 0 0 1px var(--field-line); font-size: 16px; }
.chip input:checked + span { background: var(--accent); color: #FFFFFF; box-shadow: none; font-weight: 600; }
.chip input:checked + span small,
.chips.three .chip input:checked + span small { color: rgba(255, 255, 255, 0.88); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
.dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(27, 26, 23, 0.35); }
.dot.red_oak { background: #B98A55; }
.dot.black { background: #1D1D1D; }
.dot.white { background: #F7F7F5; }
.opt-label { font-size: 15px; font-weight: 500; margin-bottom: 6px; }
.chips.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chips.three .chip span { display: grid; justify-items: center; gap: 0; width: 100%; min-height: 56px; padding: 6px 4px; align-content: center; line-height: 1.25; }
.chips.three .chip small { font-size: 15px; font-weight: 400; color: var(--muted); }

/* ---------- 1. Address ---------- */
.address { width: 100%; max-width: calc(520px + 2 * var(--gutter)); margin: 0 auto; padding: 20px var(--gutter) 40px; display: grid; gap: 18px; align-content: start; }
.address .h-quiet { color: var(--muted); }
.address form { display: grid; gap: 16px; }
.start-btns { display: grid; gap: 10px; }
.style-pick summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; color: var(--muted); cursor: pointer; list-style: none; }
.style-pick summary::-webkit-details-marker { display: none; }
.style-pick summary strong { color: var(--ink); font-weight: 500; }
.style-pick summary u { color: var(--accent); text-decoration-color: var(--mark); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.style-thumb { width: 36px; height: 36px; border-radius: 8px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); object-fit: cover; }
/* The styles as pictures of one sample house: three across on a phone, five on a wider screen. */
.style-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 8px; }
.style-tile { position: relative; display: grid; gap: 6px; padding: 6px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
.style-tile input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.style-tile img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #FFFFFF; }
.style-tile span { font-size: 15px; line-height: 1.3; text-align: center; }
.style-tile:has(input:checked) { box-shadow: inset 0 0 0 2px var(--accent); background: var(--panel); }
.style-tile:has(input:checked) span { color: var(--accent); font-weight: 600; }
.style-tile:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.past { border-top: 1px solid var(--line); padding-top: 10px; }
.past > p { display: flex; flex-wrap: wrap; align-items: center; column-gap: 12px; }
.past .link { font-size: 15px; }
.past li { overflow-wrap: anywhere; }
.flow-foot { border-top: 1px solid var(--line); padding: 4px 0 12px; }
.flow-foot .wrap { display: flex; flex-wrap: wrap; gap: 0 24px; }
.flow-foot a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); font-size: 15px; }

/* ---------- 2, 3, 7. The sheet: wait, reveal, refusal ---------- */
.stage { background: var(--paper); padding-bottom: 20px; }
/* The free preview is 448 px on its long edge (PREVIEW_MAX_EDGE_PX). On a phone the sheet is the
   column, so the painting shows at its natural size or smaller. --ar is the painting's own
   width over height, set by pro-flow.js when it loads. */
.sheet { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 8px -2px rgba(30, 77, 58, 0.08); width: min(100%, 448px); margin: 0 auto; aspect-ratio: var(--ar, 1.22); }
.sheet .ph, .sheet .photo { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); border-radius: 4px; }
.sheet .ph { display: grid; place-items: center; height: 76%; aspect-ratio: 4 / 3; max-width: 90%; padding: 12px; border: 1px solid var(--line); font-size: 15px; color: var(--muted); text-align: center; transition: opacity 0.4s ease; }
.sheet .photo { width: auto; height: auto; max-width: 80%; max-height: 78%; opacity: 0; transition: opacity 0.6s ease; }
.sheet .art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transform: scale(1.035); transition: opacity 1.3s ease 0.1s, transform 1.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.1s; }
/* A painting's paper is a shade off white; fading its edges keeps the sheet seamless. */
.sheet .art { -webkit-mask-image: linear-gradient(to right, transparent, #000 3%, #000 97%, transparent), linear-gradient(to bottom, transparent, #000 4%, #000 96%, transparent); -webkit-mask-composite: source-in; mask-image: linear-gradient(to right, transparent, #000 3%, #000 97%, transparent), linear-gradient(to bottom, transparent, #000 4%, #000 96%, transparent); mask-composite: intersect; }
.sheet img:not([src]) { visibility: hidden; }
/* The line under the house, as it prints: the painting moves up to leave it a strip. */
.sheet.has-line .art { inset: 0 0 13% 0; height: 87%; }
.sheet-line { position: absolute; left: 6%; right: 6%; bottom: 3.5%; margin: 0; text-align: center; font: 500 clamp(12px, 3.4vw, 15px)/1.3 var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); }
.sheet-line[hidden] { display: none; }
/* While it waits, the wait part (partners/painting-wait.js) is the picture: the sheet steps aside. */
.stage[data-phase="finding"] .sheet, .stage[data-phase="checking"] .sheet, .stage[data-phase="painting"] .sheet { display: none; }
.sheet.has-photo .photo { opacity: 1; }
.sheet.has-photo .ph, .stage[data-phase="revealed"] .ph { opacity: 0; }
.stage[data-phase="revealed"] .photo { opacity: 0; transition-duration: 1.1s; }
.stage[data-phase="revealed"] .art { opacity: 1; transform: none; }
.stage[data-phase="refused"] .sheet { aspect-ratio: 1 / 0.62; }
.stage[data-phase="refused"] .cap-title { font: 600 17px/1.4 var(--text); letter-spacing: 0; }
.stage[data-phase="refused"] .cap-sub { font-size: 15px; }
.stage.instant .art, .stage.instant .photo, .stage.instant .ph { transition: none; }

.caption { padding: 4px var(--gutter) 0; }
.cap-title { font: 400 28px/1.15 var(--display); font-optical-sizing: auto; letter-spacing: -0.012em; overflow-wrap: anywhere; }
.cap-sub { color: var(--muted); }
.cap-note { font-size: 15px; line-height: 1.5; color: var(--muted); margin-top: 8px; }

.below { max-width: calc(440px + 2 * var(--gutter)); margin: 0 auto; padding: 16px var(--gutter) 0; display: grid; gap: 14px; }
.wait-box, .ask-box, .refusal-box { display: grid; gap: 14px; }

/* Under the painting, first thing: is it the right house? Both ways out are one tap. */
/* The house check, the three paintings and the line under the house: one gap between each. */
.reveal-box { display: grid; gap: 24px; }
.house-check { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.house-check p { margin: 0; font-weight: 500; }
.house-check-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.house-check-btns .btn-quiet { min-height: 44px; padding: 0 10px; font-size: 15px; }
.reveal-links { display: flex; flex-wrap: wrap; justify-content: center; column-gap: 24px; }
.refusal-box .btn, .ask-box .btn { margin-top: 4px; }
.refusal-box .reveal-links, .ask-box .reveal-links { justify-content: flex-start; }
.stage-err { display: grid; justify-items: start; }

.ongifts-in { padding-top: 28px; padding-bottom: 36px; display: grid; gap: 14px; }
.ongifts-media { margin: 0 calc(-1 * var(--gutter)); }
.ongifts-media .clip, .ongifts-media img { width: 100%; border-radius: 0; border-left: 0; border-right: 0; }
.ongifts-media img { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ongifts p { max-width: 62ch; }

/* ---------- Split screens: gift, note, pay ---------- */
.split { width: 100%; max-width: calc(var(--flow-max) + 2 * var(--gutter)); margin: 0 auto; padding: 12px var(--gutter) 32px; display: grid; gap: 18px; align-content: start; }
.split-head { display: grid; gap: 8px; }
.split-body { display: grid; gap: 18px; }

/* What ships: the card, the gift, or both */
.what { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; height: 190px; }
.what-cell { position: relative; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); animation: flow-fade 0.35s ease both; }
.what-cell img { width: 100%; height: 100%; object-fit: contain; }
.what-cell img.fill { object-fit: cover; object-position: 44% 50%; }

.pick { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; }
.pick.is-on { box-shadow: inset 0 0 0 2px var(--accent); border-color: transparent; }
.pick-top { display: grid; gap: 2px; }
.pick-name { font: 500 20px/1.2 var(--display); font-optical-sizing: auto; }
/* In the cart: a check and plain words in the success green, no pill, so it is not taken for a button. */
.pick-tag, .gift-have { justify-self: start; font-size: 15px; line-height: 1.4; font-weight: 500; color: var(--success); }
/* Under each name, its price and that shipping is in it. */
.price-line { font-size: 15px; line-height: 1.4; color: var(--muted); }
.price-line .price { color: var(--ink); }
.pick .link { justify-self: start; }
.pick-links { display: grid; margin: -6px 0 -8px; }
.pick-opts { display: grid; gap: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.pick-opts fieldset { padding-top: 10px; }

.gift-more { display: grid; gap: 12px; }
.gift-more > div { display: grid; gap: 10px; }
.more-btn { width: 100%; justify-content: space-between; text-align: left; min-height: 64px; padding: 10px 16px; }
.more-btn span { display: grid; gap: 2px; }
.more-btn small { font-size: 15px; font-weight: 400; color: var(--muted); }
.more-btn .chev { flex: none; width: 10px; height: 10px; border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: rotate(45deg) translate(-3px, -3px); transition: transform 0.2s ease; }
.more-btn[aria-expanded="true"] .chev { transform: rotate(-135deg) translate(-3px, -3px); }
.gifts { display: grid; gap: 8px; }
.gift { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.gift.is-on { box-shadow: inset 0 0 0 2px var(--accent); border-color: transparent; }
.gift-main { width: 100%; display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px; border: 0; background: none; text-align: left; border-radius: var(--radius); }
.gift-main img { width: 76px; height: 76px; object-fit: contain; border-radius: 6px; background: var(--surface); }
.gift-text { display: grid; gap: 2px; }
.gift-name { font-weight: 600; }
.gift-line { font-size: 15px; line-height: 1.5; color: var(--muted); }
.gift-act { font-size: 15px; font-weight: 500; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; margin-top: 2px; }
.gift-opts { padding: 2px 12px 14px; display: grid; gap: 12px; }
.gift-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.suggest { font-size: 15px; line-height: 1.5; color: var(--muted); }
.suggest b { color: var(--ink); font-weight: 600; }
.suggest .link { display: inline; min-height: 0; padding: 12px 0; margin: -12px 0 -12px 6px; font-size: 15px; }

/* The note */
.notecard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 16px; display: grid; gap: 10px; }
.notecard-label { font-size: 15px; color: var(--muted); }
.notecard-text, .notecard-name { font: 500 27px/1.22 var(--flow-hand); color: var(--flow-pen); white-space: pre-wrap; overflow-wrap: anywhere; }
.notecard-text { min-height: 3.66em; }
.notecard-text.is-empty, .notecard-name.is-empty { color: var(--muted); }
.notecard-foot { display: grid; gap: 6px; justify-items: start; border-top: 1px solid var(--line); padding-top: 10px; }
.notecard-logo { width: auto; max-width: 160px; max-height: 40px; }
.notecard-sign { font-size: 15px; line-height: 1.4; color: var(--muted); }
.notecard.is-slip .notecard-text, .notecard.is-slip .notecard-name { font: 400 20px/1.4 var(--display); font-optical-sizing: auto; color: var(--ink); }
.notecard.is-slip .notecard-text { min-height: 4.2em; }
.notecard.is-slip .notecard-name { font-size: 17px; }
.assist { display: grid; gap: 10px; }
.assist-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
/* The note writer's ideas in a beige panel, each a white card. */
.ideas { display: grid; gap: 8px; padding: 12px; border-radius: var(--radius); background: var(--panel); }
.idea { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; min-height: 44px; padding: 12px 14px; border: 0; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); text-align: left; font-size: 16px; line-height: 1.4; }
.idea em { font-style: normal; font-size: 15px; font-weight: 500; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.idea[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.idea[aria-pressed="true"] em { color: var(--success); text-decoration: none; }
.suggests { display: grid; gap: 2px; }
.when { display: grid; gap: 8px; }
.when legend { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
/* Each mailing choice is a tappable row; the chosen one is outlined green. */
.when > .radio, .when > .with-date { padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.when > .radio:has(input:checked), .when > .with-date:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.radio { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.radio input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: none; }
.radio.with-date { flex-wrap: wrap; }
.when > .with-date > label.radio { flex: 1; }
.date { min-height: 44px; min-width: 10.5em; padding: 6px 10px; border: 1px solid var(--field-line); border-radius: var(--radius); background: var(--surface); font-size: 16px; }

/* Pay */
/* The review: a short label, then what happens, one row each. */
/* What happens next, in a beige panel above the order. */
.summary { display: grid; gap: 8px; margin: 0; padding: 14px 16px; list-style: none; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); font-size: 16px; line-height: 1.45; }
.summary li { display: grid; grid-template-columns: 5.5em minmax(0, 1fr); column-gap: 10px; }
.summary b { font-weight: 600; }
.summary li:only-child { display: block; }
.order { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.order > img { width: 100%; aspect-ratio: 1 / 0.64; object-fit: contain; border-bottom: 1px solid var(--line); }
.order-rows { padding: 6px 16px 4px; }
.order-rows li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.order-rows li span:last-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.order-rows li.is-muted { color: var(--muted); }
.order-rows li.is-total { border-bottom: 0; font-weight: 600; align-items: baseline; }
.order-rows li.is-total span:last-child { font: 500 24px/1.1 var(--display); font-optical-sizing: auto; }
.order-line { display: grid; gap: 2px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.order-line #orderLine { font: 500 15px/1.35 var(--display); letter-spacing: 0.09em; text-transform: uppercase; }
.order-line #orderLine.is-none { font-style: italic; letter-spacing: 0; text-transform: none; }
.order-note { display: grid; gap: 2px; padding: 10px 16px 12px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.order-links { display: flex; flex-wrap: wrap; column-gap: 24px; padding: 0 16px 6px; border-top: 1px solid var(--line); }
.account { display: grid; gap: 12px; }
.account-new { display: grid; gap: 12px; }
.fields { display: grid; gap: 12px; }
.signin-offer { display: grid; gap: 8px; justify-items: start; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.from-line { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 4px; overflow-wrap: anywhere; }
.stripe-line { border-top: 1px solid var(--line); padding-top: 14px; }

/* ---------- The bar: total and the one next step ---------- */
.bar { position: sticky; bottom: 0; z-index: 5; background: rgba(250, 247, 241, 0.97); border-top: 1px solid var(--line); padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); }
.bar-in { display: flex; align-items: center; gap: 10px; }
/* The chosen card or gift, pictured. On a phone it is sized so the words beside it are not cut
   (measured at 390 px: the longest summary needs 132 px and has 137); narrower phones drop it. */
.bar-thumb { flex: none; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); object-fit: cover; }
.bar-info { flex: 1; min-width: 0; display: grid; }
.bar-total { font: 500 24px/1.15 var(--display); font-optical-sizing: auto; }
.bar-total.bump { animation: flow-bump 0.3s ease; }
@keyframes flow-bump { 40% { transform: translateY(-3px); } }
.bar-sum { font-size: 15px; line-height: 1.4; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .btn { flex: none; padding: 0 24px; }
.bar[data-mode="split"] .btn { padding: 0 16px; }
.bar[data-mode="solo"] .bar-info { display: none; }
.bar[data-mode="solo"] .btn { flex: 1; }

/* ---------- Dialogs: a sheet from the bottom on a phone ---------- */
.flow dialog { width: 100%; max-width: 560px; max-height: 90svh; margin: auto auto 0; padding: 0; border: 0; border-radius: var(--radius) var(--radius) 0 0; background: var(--surface); color: var(--ink); overflow: auto; }
.flow dialog::backdrop { background: rgba(27, 26, 23, 0.5); }
.dlg { padding: 8px 16px 20px; display: grid; gap: 12px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.flow .dlg-head h2 { font-size: 22px; }
.dlg-close { flex: none; min-width: 44px; min-height: 44px; border: 0; background: none; font-size: 15px; text-decoration: underline; text-underline-offset: 3px; }
.thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.thumb { position: relative; padding: 0; border: 0; background: var(--paper); border-radius: 8px; overflow: hidden; aspect-ratio: 4 / 3; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: -3px; }
.thumb .tag { position: absolute; left: 8px; top: 8px; background: var(--surface); border-radius: 6px; padding: 2px 8px; font-size: 15px; font-weight: 500; }
.pick-own { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; color: var(--muted); }

/* The listing photo picker (photo-assist.js builds these), in this page's look. Its own title
   is hidden: the dialog's heading says the same words. */
.pa { display: grid; gap: 12px; }
.pa-title { display: none; }
.pa-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pa-drop { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; cursor: pointer; }
.pa-drop-main { display: inline-flex; align-items: center; min-height: 48px; padding: 0 18px; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--surface); font: 500 16px/1.2 var(--text); }
.pa-drop:hover .pa-drop-main, .pa-over .pa-drop-main { background: var(--paper); }
.pa-input:focus-visible + .pa-drop .pa-drop-main { outline: 2px solid var(--accent); outline-offset: 3px; }
.pa-drop-hint { font-size: 15px; color: var(--muted); }
.pa-busy { opacity: 0.55; pointer-events: none; }
.pa-status:empty { display: none; }
.pa-err { color: var(--flow-error); font-size: 15px; font-weight: 500; }
.pa-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pa-list:empty { display: none; }
.pa-item { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.pa-best, .pa-chosen { box-shadow: inset 0 0 0 2px var(--ink); border-color: transparent; }
.pa-no { color: var(--muted); }
.pa-thumb { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; background: var(--paper); }
.pa-info { min-width: 0; }
.pa-kind, .pa-name { font-weight: 600; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; overflow-wrap: anywhere; }
.pa-badge { font-size: 15px; font-weight: 500; color: var(--success); }
.pa-reason { font-size: 15px; line-height: 1.5; color: var(--muted); }
.pa-failed .pa-reason { color: var(--flow-error); }
.pa-bar { height: 6px; margin-top: 8px; border-radius: 3px; background: var(--line); overflow: hidden; }
.pa-fill { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.pa-use { display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; padding: 0 16px; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--surface); font: 500 16px/1.2 var(--text); }
.pa-use.pa-primary { border: 0; border-radius: 999px; background: var(--accent); color: #FFFFFF; font-weight: 600; }
.pa-use.pa-primary:hover { background: var(--accent-press); }

/* ---------- The cart panel: a bottom sheet on a phone (the dialog default above), a side
   panel on a laptop (below) ---------- */
.cart-list { display: grid; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.cart-line { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-line > img, .cart-ph { width: 72px; height: 72px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.cart-ph { display: block; background: repeating-linear-gradient(135deg, var(--paper) 0 6px, var(--surface) 6px 12px); }
.cart-text { display: grid; gap: 2px; align-content: start; min-width: 0; }
.cart-name { font-weight: 600; overflow-wrap: anywhere; }
.cart-text .quiet { font-size: 15px; line-height: 1.45; }
.cart-text .link { justify-self: start; min-height: 44px; font-size: 15px; }
.cart-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 6px; }
.cart-price { font-variant-numeric: tabular-nums; font-weight: 500; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--field-line); border-radius: var(--radius); background: var(--surface); }
.stepper button { width: 44px; height: 44px; border: 0; background: none; font-size: 20px; line-height: 1; }
.stepper button:disabled { color: var(--field-line); cursor: default; }
.stepper output { min-width: 28px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.stepper output:focus { outline: none; }
.cart-foot { display: grid; gap: 2px; }
/* The total and the button stay in view while the list scrolls under them. */
.cart-bottom { position: sticky; bottom: 0; display: grid; gap: 10px; margin: 0 -16px -20px; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; }
.cart-total span:last-child { font: 500 24px/1.1 var(--display); font-optical-sizing: auto; }
.cart-house .quiet { color: var(--muted); }

/* ---------- The narrowest phones ---------- */
@media (max-width: 359px) {
    .flow .site-head .wrap { gap: 4px; }
    .flow .brand { font-size: 20px; }
    .trail button { min-width: 0; padding: 0 6px; }
}
@media (max-width: 380px) {
    .bar-thumb { display: none; }
}
/* A phone: the brand, four steps and the cart button share one 358 px row. */
@media (max-width: 479px) {
    .flow .site-head .wrap { gap: 6px; }
    .trail button { padding: 0 6px; }
}

/* A phone narrower than the 448 px sheet: the painting runs edge to edge, so it drops the card's
   side borders and corners and reads as a full-width picture, not a card cut off by the screen. */
@media (max-width: 448px) {
    .sheet { border-left: 0; border-right: 0; border-radius: 0; box-shadow: none; }
}

/* ---------- Larger screens ---------- */
@media (min-width: 720px) {
    .flow dialog { margin: auto; border-radius: var(--radius); }
    .flow dialog.cart-panel { width: 420px; max-width: 100%; height: 100svh; max-height: 100svh; margin: 0 0 0 auto; border-radius: 0; border-left: 1px solid var(--line); }
    .flow dialog.cart-panel[open] { animation: flow-slide 0.22s ease both; }
    .dlg { padding: 12px 24px 24px; }
    .cart-bottom { margin: 0 -24px -24px; padding: 14px 24px 20px; }
    .thumbs { grid-template-columns: repeat(4, 1fr); }
    .bar-in { gap: 14px; }
    .bar-thumb { width: 48px; height: 48px; }
    .bar[data-mode="split"] .btn { padding: 0 24px; }
    .bar[data-mode="solo"] .bar-in { justify-content: flex-end; }
    .bar[data-mode="solo"] .btn { flex: none; min-width: 280px; }
    .bar[data-mode="solo"][data-note] .bar-info { display: grid; }
    .fields { grid-template-columns: 1fr 1fr; }
    .fields .span2 { grid-column: 1 / -1; }
}
@media (min-width: 880px) {
    .flow h1 { font-size: 40px; }
    .flow h2 { font-size: 28px; }
    .flow .site-head .wrap { min-height: 64px; }
    .flow .brand { font-size: 22px; }
    .trail button { padding: 0 14px; font-size: 16px; }
    .address { max-width: calc(600px + 2 * var(--gutter)); padding-top: 36px; gap: 20px; }

    .stage { padding: 24px var(--gutter) 32px; }
    /* The painting and the column beside it start at the top. Centred, a long column (the three
       variations and the four captions) pushed the painting half under the bar. */
    .stage-in { max-width: var(--flow-max); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 380px; column-gap: 56px; align-items: start; }
    /* A 448 px preview is not blown up past 600 px, and never taller than the screen has room for.
       It stays in view while the column beside it scrolls. */
    .sheet { width: min(100%, 600px, calc((100svh - 230px) * var(--ar, 1.22))); position: sticky; top: 24px; }
    .stage[data-phase="refused"] .stage-in, .stage[data-phase="ask"] .stage-in { align-items: center; }
    .stage[data-phase="refused"] .sheet { aspect-ratio: 1 / 0.78; width: min(100%, 462px); }
    /* While it waits the sheet is hidden: the wait gets the whole row, so its photo and steps sit
       side by side (painting-wait.css, from 760 px) above the fold, not in a narrow left column. */
    .stage:is([data-phase="finding"], [data-phase="checking"], [data-phase="painting"]) .stage-in { grid-template-columns: minmax(0, 1fr); }
    .stage-side { display: grid; gap: 22px; }
    .caption { padding: 0; }
    .stage:not([data-phase="refused"]) .cap-title { font-size: 34px; }
    .below { max-width: none; margin: 0; padding: 0; }
    .reveal-links { justify-content: flex-start; }
    .flow .refusal-box h1, .flow .ask-box h1 { font-size: 32px; }
    .ongifts-in { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); column-gap: 48px; align-items: center; padding-top: 48px; padding-bottom: 56px; }
    .flow .ongifts h2 { grid-column: 2; grid-row: 1; align-self: end; font-size: 32px; }
    .ongifts-media { grid-column: 1; grid-row: 1 / span 2; margin: 0; }
    .ongifts-media .clip, .ongifts-media img { border: 1px solid var(--line); border-radius: var(--radius); }
    .ongifts p { grid-column: 2; grid-row: 2; align-self: start; }

    .split { grid-template-columns: minmax(0, 1fr) 448px; column-gap: 64px; row-gap: 20px; padding-top: 28px; padding-bottom: 48px; }
    .split-media { grid-column: 1; grid-row: 1 / span 2; position: sticky; top: 24px; align-self: start; }
    .split-head { grid-column: 2; grid-row: 1; }
    .split-body { grid-column: 2; grid-row: 2; }
    .what { height: 380px; }
    .what.is-two { height: 300px; }
    .notecard { padding: 32px 36px 24px; gap: 16px; }
    .notecard-text, .notecard-name { font-size: 36px; }
    .notecard.is-slip .notecard-text { font-size: 24px; }
    .notecard.is-slip .notecard-name { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .flow *, .flow *::before, .flow *::after { animation: none !important; transition: none !important; }
}
