/* The photo app's styles. Colors, fonts and base text styles come from /assets/brand.css,
   which every page loads first. */

.site-header { text-align: center; padding: 32px 16px 4px; }
.logo { margin: 0; line-height: 0; }
.logo img { width: min(220px, 60vw); height: auto; }
.tagline { font-family: var(--serif); text-transform: uppercase; letter-spacing: .28em; font-size: .8rem; color: var(--muted); margin: 10px 0 0; }

/* Welcome screen */
body.on-welcome .site-header, body.on-welcome main { display: none; }
.welcome { min-height: 100vh; min-height: 100dvh; max-width: 560px; margin: 0 auto; padding: 32px 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.welcome-logo { width: min(420px, 80vw); height: auto; }
.welcome .tagline { margin-bottom: 40px; }
.welcome-title { font-size: clamp(1.6rem, 4vw, 2.1rem); margin-bottom: 10px; }
.welcome .muted { max-width: 420px; }
.btn.btn-large { font-size: 1.15rem; padding: 18px 48px; margin-top: 20px; border-radius: 999px; }
main { max-width: 1100px; margin: 0 auto; padding: 0 16px 64px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.panel h2 { margin-bottom: 12px; }

/* Progress */
.progress { display: flex; justify-content: center; gap: 8px; list-style: none; padding: 0; margin: 16px 0 28px; counter-reset: s; flex-wrap: wrap; }
.progress li { counter-increment: s; font-size: .88rem; color: var(--muted); padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.progress li::before { content: counter(s) ". "; }
.progress li.active { background: var(--ink); border-color: var(--ink); color: var(--accent-ink); }
.progress li.complete { color: var(--accent); border-color: var(--brand); }

/* Buttons */
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.btn { font: inherit; font-weight: 600; border-radius: 10px; padding: 14px 22px; border: 1px solid transparent; cursor: pointer; min-height: 48px; }
.btn.primary { background: var(--ink); color: var(--accent-ink); }
.btn.primary:hover { background: var(--ink-hover); }
.btn.primary:disabled { opacity: .6; cursor: wait; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.link { background: none; border: 0; padding: 6px 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 1rem; cursor: pointer; flex: none; }
.icon-btn:hover { color: var(--error); border-color: var(--error); }

.actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.actions.end { justify-content: flex-end; }
.actions.sticky { position: -webkit-sticky; position: sticky; bottom: 0; z-index: 5; margin: 20px -16px 0; padding: 12px 16px; background: rgba(245, 244, 242, .94); backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.total { margin-left: auto; font-size: 1.05rem; }
.total strong { font-family: var(--serif); font-size: 1.35rem; color: var(--accent); font-weight: 500; margin-left: 4px; }

/* Forms */
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label { display: block; font-size: .92rem; font-weight: 600; margin-bottom: 14px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin: 0 18px 0 0; font-size: 1rem; }
input, textarea, select { display: block; width: 100%; margin-top: 6px; font: inherit; font-weight: 400; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); min-height: 48px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input[type="radio"] { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--accent); display: inline-block; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; background-color: var(--surface); }
.invalid { border-color: var(--error); background-color: #fdf3f2; }
fieldset { border: 0; padding: 0; margin: 4px 0 8px; }
legend { font-size: .92rem; font-weight: 600; margin-bottom: 8px; }
.req { color: var(--accent); }
.hint { font-size: .85rem; color: var(--muted); margin: -6px 0 14px; }
.code-form { max-width: 360px; margin: 28px auto 0; text-align: center; }
.code-form input { text-align: center; font-size: 1.4rem; letter-spacing: .12em; text-transform: uppercase; }
.code-form .btn { width: 100%; margin-top: 18px; }
.error { color: var(--error); background: #fdecea; border-radius: 8px; padding: 10px 14px; margin: 16px 0 0; }

.counter { font-weight: 600; padding: 6px 14px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.counter.done { background: var(--accent); color: var(--accent-ink); }
.tag { display: inline-block; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-left: 6px; vertical-align: 3px; }
.tag.dark { background: var(--ink); color: var(--accent-ink); }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); grid-column: 1 / -1; }
.step-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.step-head h2 { margin-bottom: 4px; }
.step-head p { margin: 0; }

/* Find your photos */
.session-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; margin-top: 20px; }
.session-list.latest-only { grid-template-columns: minmax(230px, 340px); justify-content: center; }
.session-card { font: inherit; color: inherit; text-align: left; padding: 0; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.session-card:disabled { cursor: default; opacity: .6; }
.session-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 3:2 boxes: a spacer sets the shape and the photo sits on top, so a tall photo can't stretch the box.
   Not aspect-ratio or padding on the box itself: older iPads lack the first and get the second wrong in a flex parent. */
.cover::before, .photo-tile::before, .bg-frame::before { content: ""; display: block; padding-top: 66.667%; }
.cover { position: relative; overflow: hidden; background: var(--accent-soft); color: var(--muted); font-size: .9rem; }
.cover img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-empty { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: center; }
.session-info { padding: 12px 14px 14px; }
.session-info h3 { font-size: 1.3rem; margin: 0 0 2px; }
.session-info p { margin: 0; color: var(--muted); font-size: .88rem; }

/* Photo grids (favorites and choosing poses) */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.photo-tile { position: relative; border-radius: 10px; overflow: hidden; background: var(--accent-soft); }
.photo-main { position: absolute; top: 0; left: 0; display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.photo-main img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-main:disabled { cursor: default; }
.photo-tile.is-dimmed img { opacity: .45; }
.photo-tile.is-chosen { box-shadow: inset 0 0 0 4px var(--brand); }
.photo-tile.is-chosen .photo-main img { transform: scale(.96); border-radius: 6px; }
.fav-btn, .zoom-btn { position: absolute; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; background: rgba(255, 255, 255, .92); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.fav-btn { right: 8px; bottom: 8px; font-size: 1.35rem; color: var(--accent); }
.photo-tile.is-fav .fav-btn { background: var(--brand); color: #fff; }
.zoom-btn { left: 8px; bottom: 8px; font-size: 1.1rem; color: var(--text); }
.pick-badge { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; display: grid; place-items: center; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }

/* Package: digital or prints */
.path-toggle { display: flex; justify-content: center; gap: 0; margin: 4px auto 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; width: fit-content; }
.path-btn { font: inherit; font-weight: 600; font-size: 1.05rem; border: 0; background: none; color: var(--text); padding: 12px 36px; border-radius: 999px; cursor: pointer; min-width: 140px; }
.path-btn.selected { background: var(--ink); color: var(--accent-ink); }
.package-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px 16px; align-items: stretch; margin-top: 22px; }
@media (min-width: 1000px) { .package-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 520px) { .package-grid { grid-template-columns: 1fr; } }
.price-note { margin: 18px 0 0; }
.package-card { position: relative; font: inherit; color: var(--text); text-align: left; cursor: pointer; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 18px 18px; display: flex; flex-direction: column; }
.package-card.featured { border-color: var(--brand); }
.package-card.selected { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink), var(--shadow); }
.badge { position: absolute; top: -12px; left: 16px; background: var(--accent); color: var(--accent-ink); font-size: .76rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.package-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.package-name { font-family: var(--serif); font-size: 1.45rem; }
.price { font-family: var(--serif); font-size: 1.35rem; color: var(--accent); white-space: nowrap; margin: 0; }
.includes { padding: 0; margin: 0 0 16px; list-style: none; flex: 1; }
.includes li { padding: 3px 0 3px 22px; position: relative; font-size: .93rem; }
.includes li::before { content: "✓"; position: absolute; left: 0; color: var(--brand); }
.choose { display: block; text-align: center; font-weight: 600; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
.package-card.selected .choose { background: var(--ink); color: var(--accent-ink); border-color: var(--ink); }

/* Backgrounds */
.bg-row { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }
.bg-row + .bg-row { margin-top: 16px; }
.bg-row-photo { position: -webkit-sticky; position: sticky; top: 12px; text-align: center; font-weight: 600; }
.bg-row-photo img { width: 100%; border-radius: 10px; display: block; margin-bottom: 6px; }
.bg-slot-head { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 8px; }
.bg-slot-head h3 { font-size: 1.15rem; margin: 0; }
.tier-group + .tier-group { margin-top: 10px; }
.tier-name { font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.bg-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; align-items: stretch; }
.bg-option { position: relative; padding: 0; border: 3px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--bg); font: inherit; color: var(--text); text-align: left; box-shadow: 0 0 0 1px var(--line); }
.bg-frame { position: relative; display: block; background: #2B2828; }
.bg-frame img { position: absolute; top: 0; left: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.shape-tag { position: absolute; left: 6px; bottom: 6px; font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: rgba(255, 255, 255, .9); color: var(--text); }
.bg-name { display: block; padding: 6px 8px; font-size: .85rem; font-weight: 600; }
.bg-check { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--accent-ink); display: none; place-items: center; font-weight: 700; box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.bg-option.selected { border-color: var(--brand); box-shadow: none; }
.bg-option.selected .bg-check { display: grid; }
.bg-option:disabled { cursor: not-allowed; opacity: .4; }
.add-extra { margin-top: 16px; }
.premium-panel { margin-top: 16px; }
.premium-panel > .muted { margin-bottom: 4px; }
.premium-slot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.btn.secondary:disabled { opacity: .5; cursor: not-allowed; }

.tier-note { margin: -2px 0 8px; }

/* Extras */
.addon-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 1000px) { .addon-list { grid-template-columns: repeat(4, 1fr); } }
.addon-card { font: inherit; color: var(--text); text-align: left; cursor: pointer; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.addon-card .muted { flex: 1; }
.addon-card.selected { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink), var(--shadow); }
.addon-card.selected .choose { background: var(--ink); color: var(--accent-ink); border-color: var(--ink); }
.addon-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.addon-name { font-family: var(--serif); font-size: 1.3rem; }
.addon-group + .addon-group { margin-top: 26px; }
.addon-group h3 { margin: 0 0 2px; }
.addon-group > .muted { margin: 0 0 12px; }
.addon-size { font-size: .85rem; font-weight: 600; color: var(--accent); margin-top: -4px; }
.addon-config { margin-top: 20px; }
.addon-config h3 { font-size: 1.1rem; margin: 14px 0 8px; }
.addon-config .bg-slot-head { justify-content: space-between; }
.addon-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.addon-photo { position: relative; padding: 0; border: 3px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface); font: inherit; color: var(--text); text-align: left; box-shadow: 0 0 0 1px var(--line); }
.addon-photo img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.addon-photo span { display: block; padding: 4px 8px; font-size: .8rem; font-weight: 600; }
.addon-photo.selected { border-color: var(--brand); box-shadow: none; }
.addon-config-actions { display: flex; align-items: baseline; gap: 14px; }
.notice { color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 10px 14px; margin: 0 0 16px; }
/* Keepsakes: a count on each image */
.keepsake-photo { cursor: default; display: flex; flex-direction: column; }
.keepsake-image { flex: 1; display: block; width: 100%; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.keepsake-image:disabled { cursor: default; opacity: .5; }
.stepper { display: flex; align-items: center; justify-content: space-between; padding: 2px 8px 8px; }
.stepper button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); font: inherit; font-size: 1.4rem; line-height: 1; color: var(--text); cursor: pointer; }
.stepper button:disabled { opacity: .35; cursor: default; }
.addon-photo .stepper-count { padding: 0; font-size: 1.2rem; font-weight: 700; min-width: 2ch; text-align: center; }

/* Prints */
.print-row { display: grid; grid-template-columns: 170px 1fr; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.print-label strong { display: block; font-family: var(--serif); font-weight: 500; font-size: 1.15rem; }
.print-options { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px; }
.print-option { flex: 0 0 120px; padding: 0; border: 3px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface); font: inherit; color: var(--text); text-align: left; box-shadow: 0 0 0 1px var(--line); }
.print-option img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.print-option span { display: block; padding: 4px 6px; font-size: .75rem; line-height: 1.3; }
.print-option.selected { border-color: var(--brand); box-shadow: none; }

/* Checkout */
.checkout-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.order-images { list-style: none; padding: 0; margin: 12px 0; }
.order-images li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.order-images li > img { width: 96px; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 8px; flex: none; }
.bg-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; padding: 2px 10px 2px 2px; border-radius: 999px; background: var(--accent-soft); margin: 4px 0 2px; }
.bg-chip img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.price-lines { width: 100%; border-collapse: collapse; margin: 8px 0 10px; }
.price-lines td { padding: 6px 0; border-top: 1px solid var(--line); }
.price-lines td:last-child { text-align: right; white-space: nowrap; }
.price-total td { font-family: var(--serif); font-size: 1.3rem; color: var(--accent); }
.price-subtotal td { font-weight: 700; }
/* One block per child when a family orders for several */
.child-order { padding-bottom: 6px; }
.child-order + .child-order { margin-top: 14px; padding-top: 16px; border-top: 2px solid var(--line); }
.child-order h3 { margin: 0; }
.child-order .extra-option { margin: 6px 0 4px; }
.add-child { display: block; width: 100%; margin: 16px 0 6px; }
.child-links { display: flex; flex-wrap: wrap; gap: 0 22px; }
/* Poses step: a photo already in another package for the same child */
.used-badge { position: absolute; left: 8px; top: 8px; padding: 3px 9px; border-radius: 999px; background: rgba(0, 0, 0, .65); color: #fff; font-size: .75rem; font-weight: 700; }
#checkout-extras h2 { margin-bottom: 10px; }
.extra-option { display: flex; align-items: center; gap: 12px; font-weight: 400; font-size: 1rem; padding: 12px 14px; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); cursor: pointer; }
.extra-option > span:nth-child(2) { flex: 1; }
.extra-option input[type="checkbox"] { width: 24px; height: 24px; min-height: 0; margin: 0; accent-color: var(--ink); flex: none; }

/* Done */
.done-card { max-width: 520px; margin: 40px auto; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 40px 28px; box-shadow: var(--shadow); }
.done-mark { display: block; width: 88px; height: auto; margin: 0 auto 12px; }
.done-card .btn { margin: 12px 0; }

/* Full-screen viewer */
.viewer { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 50; background: #111; display: flex; align-items: center; justify-content: center; touch-action: pan-y; }
.viewer img { max-width: 100vw; max-height: 100vh; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.viewer-nav, .viewer-close { position: absolute; border: 0; cursor: pointer; color: #fff; background: rgba(255, 255, 255, .14); border-radius: 50%; width: 56px; height: 56px; font-size: 1.6rem; line-height: 1; display: grid; place-items: center; }
.viewer-nav:hover, .viewer-close:hover { background: rgba(255, 255, 255, .28); }
.viewer-nav.prev { left: 16px; top: 50%; transform: translateY(-50%); }
.viewer-nav.next { right: 16px; top: 50%; transform: translateY(-50%); }
.viewer-close { top: 16px; right: 16px; width: 48px; height: 48px; font-size: 1.3rem; }
.viewer-count { position: absolute; top: 28px; left: 0; right: 0; text-align: center; color: rgba(255, 255, 255, .75); font-size: .95rem; pointer-events: none; }
.viewer-action { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); font: inherit; font-weight: 600; font-size: 1.05rem; padding: 14px 30px; border-radius: 999px; border: 0; cursor: pointer; background: #fff; color: var(--text); box-shadow: 0 2px 12px rgba(0, 0, 0, .35); white-space: nowrap; }
.viewer-action.on { background: var(--brand); color: #fff; }
.viewer-action:disabled { opacity: .6; cursor: default; }

@media (max-width: 760px) {
  .row { grid-template-columns: 1fr; gap: 0; }
  .panel { padding: 20px 16px; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .bg-row { grid-template-columns: 1fr; }
  .bg-row-photo { position: static; max-width: 240px; }
  .bg-options { grid-template-columns: repeat(2, 1fr); }
  .print-row { grid-template-columns: 1fr; gap: 6px; }
  .checkout-layout { grid-template-columns: 1fr; }
  .addon-list { grid-template-columns: 1fr; }
  .path-btn { padding: 10px 24px; min-width: 110px; }
  .viewer-nav { display: none; } /* swipe instead */
}

/* Older iPads (iOS 14 and earlier) don't have aspect-ratio: keep these photos close to 3:2. */
@supports not (aspect-ratio: 1) {
  /* Buttons on older iPads shrink to fit their contents, so a box with no width of its own
     collapses. Flex buttons need an explicit stretch to fill the card; a huge width capped
     at 100% makes a box fill the button. */
  .session-card, .package-card, .addon-card { align-items: stretch; }
  .cover, .bg-frame, .addon-photo img, .print-option img { width: 9999px; max-width: 100%; }
  .addon-photo img { height: 110px; }
  .print-option img { height: 76px; }
  .order-images li > img { height: 64px; }
}

/* Cloudflare's bot check: only shows when it needs a tap, in the middle of the screen, where it
   can't sit over the buttons (a short screen put it on top of "View my photos"). */
.bot-check { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 50; }
.bot-check:empty { display: none; }
