/* Guest app. Brand: the photographer's colours lead (deep teal ink + marigold);
   the product stays a quiet "Powered by". Layout: one full-height app column, phone-first. */
:root {
  --ink: #0e3b45;
  --marigold: #f0a63a;
  --bg: #f6f7f6;
  --surface: #ffffff;
  --surface-2: #eef1f0;
  --fg: #14211f;
  --muted: #5d6b69;
  --line: #dde3e1;
  --on-accent: #1c1405;
  --good: #1f8a52;
  --danger: #b4372b;
  --shimmer: #e4e9e7;
  --outside: #dfe5e3;
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #9fd3dc; --marigold: #f3b457; --bg: #0d1514; --surface: #15201f; --surface-2: #1c2928;
    --fg: #e8eeec; --muted: #9aa9a6; --line: #2a3836; --good: #4cc489; --danger: #ff8a7a;
    --shimmer: #1f2c2b; --outside: #070c0b; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
/* App shell: the page itself never scrolls (or rubber-bands); only the panes inside do.
   Otherwise a swipe at the end of the gallery can grab the page instead of the gallery. */
html:has(body.guest) { overflow: hidden; overscroll-behavior: none; }
body.guest { position: fixed; inset: 0; overflow: hidden; overscroll-behavior: none; }
body.guest { background: var(--outside); color: var(--fg); font-family: var(--body); font-size: 15px; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--marigold); outline-offset: 2px; }
[hidden] { display: none !important; }

.app { position: relative; height: 100%; max-width: 520px; margin: 0 auto; background: var(--bg); overflow: hidden; display: flex; flex-direction: column; }
@media (min-width: 560px) { .app { box-shadow: 0 0 60px rgb(0 0 0 / .12); } }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; padding-top: env(safe-area-inset-top, 0px); }
.scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.pad { padding: 20px; }

/* buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; border-radius: 16px; border: 0; font-weight: 700; font-size: 16px; text-decoration: none; }
.btn.primary { background: var(--marigold); color: var(--on-accent); }
.btn.dark { background: var(--fg); color: var(--bg); }
.btn.ghost { background: transparent; color: var(--fg); border: 1.5px solid var(--line); }
.btn.text { background: none; min-height: 44px; color: var(--muted); font-weight: 600; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.wa { background: #1f8f4e; color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; border: 0; background: transparent; }
.icon-btn svg, .tab svg, .btn svg, .small-link svg, .vbtn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* steps */
.stepbar { display: flex; align-items: center; gap: 8px; padding: 12px 12px 0; }
.dots { display: flex; gap: 6px; margin-left: auto; margin-right: 12px; }
.dots span { width: 22px; height: 4px; border-radius: 4px; background: var(--line); }
.dots span.on { background: var(--marigold); }
.step-body { flex: 1; display: flex; flex-direction: column; gap: 18px; padding: 16px 24px calc(24px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; }
.step-body h2 { font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1.08; margin: 8px 0 0; text-wrap: balance; letter-spacing: -0.01em; }
.lead { margin: 0; color: var(--muted); line-height: 1.5; }
.spacer { flex: 1; }
.err { color: var(--danger); font-size: 14px; margin: 0; font-weight: 600; }

/* welcome */
.cover { position: relative; height: 56%; min-height: 280px; background: linear-gradient(135deg, var(--ink), #1b5a66); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgb(0 0 0 / .3) 0%, transparent 30%, transparent 55%, var(--bg) 100%); }
.brand { position: absolute; top: calc(16px + env(safe-area-inset-top, 0px)); left: 16px; z-index: 1; display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; text-shadow: 0 1px 6px rgb(0 0 0 / .45); }
.mono { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--marigold); color: #1c1405; font-family: var(--display); font-weight: 800; font-size: 14px; text-shadow: none; flex: 0 0 auto; }
.welcome-text { padding: 0 24px; margin-top: -40px; position: relative; z-index: 1; display: flex; flex-direction: column; gap: 8px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.welcome-text h1 { font-family: var(--display); font-weight: 800; font-size: 38px; line-height: 1; margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
.meta { color: var(--muted); font-size: 14px; line-height: 1.4; }
.welcome-actions { padding: 20px 24px 8px; display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.lock { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; color: var(--muted); }
.lock svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.powered { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0 calc(14px + env(safe-area-inset-bottom, 0px)); }

/* inputs */
.pin { display: flex; gap: 12px; }
.pin input { width: 100%; min-width: 0; height: 64px; text-align: center; font-size: 28px; font-family: var(--display); font-weight: 800; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); color: var(--fg); }
.pin input:focus, .field:focus { border-color: var(--marigold); outline: none; }
.field { width: 100%; height: 56px; padding: 0 16px; font: inherit; font-size: 18px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); color: var(--fg); }
.hint { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.45; }

/* camera */
.camera { flex: 1; position: relative; background: #0b1110; display: grid; place-items: center; overflow: hidden; min-height: 300px; }
.camera video, .camera .still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.camera .still.from-file { transform: none; }
.oval { position: relative; width: 62%; aspect-ratio: 3 / 4; max-width: 260px; border-radius: 50%; box-shadow: 0 0 0 999px rgb(0 0 0 / .5); border: 3px dashed rgb(255 255 255 / .85); transition: border-color .3s; pointer-events: none; }
.oval.ok { border-style: solid; border-color: #4cc489; }
.cam-tip { position: absolute; top: 18px; left: 12px; right: 12px; text-align: center; color: #fff; font-weight: 600; font-size: 15px; z-index: 2; }
.cam-tip.bad { color: #ffb4a8; }
.cam-tips { position: absolute; bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; z-index: 2; flex-wrap: wrap; padding: 0 12px; }
.cam-tips span { background: rgb(255 255 255 / .14); color: #fff; font-size: 12px; padding: 6px 10px; border-radius: 99px; }
.cam-fallback { position: absolute; z-index: 3; inset: auto 24px 64px; text-align: center; color: #fff; display: grid; gap: 10px; }
.cam-fallback p { margin: 0; font-size: 13px; opacity: .8; }
.cam-controls { padding: 16px 24px calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; justify-content: space-between; background: var(--bg); }
.shutter { width: 74px; height: 74px; border-radius: 50%; border: 5px solid var(--fg); background: var(--marigold); }
.shutter.retake { background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2314211f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12a8 8 0 1 0 2.3-5.7M4 4v5h5'/%3E%3C/svg%3E") center / 28px no-repeat; }
.small-link { background: none; border: 0; color: var(--fg); font-weight: 600; font-size: 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 64px; cursor: pointer; }
.small-link:disabled { opacity: .4; }

/* consent */
.consent-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px; display: grid; gap: 14px; }
.consent-row { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; }
.consent-row .ic { width: 36px; height: 36px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; }
.consent-row .ic svg { width: 18px; height: 18px; stroke: var(--fg); fill: none; stroke-width: 1.8; }
.consent-row strong { display: block; font-size: 15px; }
.consent-row span { color: var(--muted); font-size: 14px; line-height: 1.45; }
details.more summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; }
details.more p { color: var(--muted); font-size: 13px; line-height: 1.5; }

/* searching / found */
.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; }
.ring { width: 140px; height: 140px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; }
.ring .track { stroke: var(--line); }
.ring .bar { stroke: var(--marigold); stroke-linecap: round; stroke-dasharray: 402; stroke-dashoffset: 402; transition: stroke-dashoffset .15s linear; }
.ring .face { position: absolute; inset: 22px; border-radius: 50%; overflow: hidden; background: var(--surface-2); }
.ring .face img { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.big-count { font-family: var(--display); font-weight: 800; font-size: 72px; line-height: .9; font-variant-numeric: tabular-nums; }
.center h2 { font-family: var(--display); font-size: 28px; margin: 0; line-height: 1.1; text-wrap: balance; }
.center p { margin: 0; color: var(--muted); line-height: 1.5; max-width: 32ch; }
.burst { position: absolute; inset: 0; pointer-events: none; width: 100%; height: 100%; }

/* app shell */
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; background: var(--bg); border-bottom: 1px solid transparent; transition: border-color .2s; z-index: 3; }
.topbar.scrolled { border-color: var(--line); }
.topbar .title { flex: 1; min-width: 0; }
.topbar .title strong { display: block; font-family: var(--display); font-size: 18px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title span { font-size: 12px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .mono { width: 32px; height: 32px; font-size: 12px; }
.tabbar { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: var(--surface); padding: 6px 4px calc(8px + env(safe-area-inset-bottom, 0px)); }
.tab { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 0; }
.tab.on { color: var(--fg); }
.tab.on svg { stroke-width: 2.3; }

/* people bubbles */
.bubbles { display: flex; gap: 14px; padding: 10px 16px 4px; overflow-x: auto; scrollbar-width: none; }
.bubbles::-webkit-scrollbar { display: none; }
.bubble { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 0 0 auto; width: 64px; font-size: 12px; font-weight: 600; padding: 4px 0 0; }
.bubble .nm { max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 20px; color: #fff; background: var(--ink); position: relative; overflow: hidden; box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--line); transition: box-shadow .15s, opacity .15s; flex: 0 0 auto; }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bubble.on .av { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--marigold); }
.bubble.off .av { opacity: .45; }
.bubble .count { color: var(--muted); font-weight: 500; font-size: 11px; margin-top: -4px; }
.av.add { background: var(--surface-2); color: var(--fg); }
.av.add svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; }
.togglebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px 6px; font-size: 13px; color: var(--muted); min-height: 36px; }
.switch { display: flex; align-items: center; gap: 8px; background: none; border: 0; font-weight: 600; font-size: 13px; color: var(--fg); padding: 0; }
.switch .knob { width: 38px; height: 22px; border-radius: 99px; background: var(--line); position: relative; transition: background .2s; }
.switch .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch[aria-checked="true"] .knob { background: var(--good); }
.switch[aria-checked="true"] .knob::after { transform: translateX(16px); }

/* gallery */
.install { margin: 8px 16px; padding: 12px 14px; border-radius: 16px; background: var(--ink); color: var(--bg); display: flex; gap: 12px; align-items: center; }
.install .t { flex: 1; font-size: 13px; line-height: 1.35; }
.install strong { display: block; font-size: 14px; }
.install button { background: var(--marigold); color: var(--on-accent); border: 0; border-radius: 10px; padding: 8px 12px; font-weight: 700; font-size: 13px; }
.install .x { background: none; color: inherit; padding: 4px 6px; opacity: .7; }
.ptr { height: 0; overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: 13px; transition: height .2s; }
.album-h { position: sticky; top: 0; z-index: 2; display: flex; align-items: baseline; justify-content: space-between; padding: 12px 16px 8px; background: var(--bg); }
.album-h h3 { margin: 0; font-family: var(--display); font-size: 19px; }
.album-h span { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.album-note { margin: -4px 16px 8px; font-size: 13px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 0 3px; }
@media (min-width: 440px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.tile { position: relative; aspect-ratio: 1; background: var(--shimmer); border: 0; padding: 0; overflow: hidden; display: block; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .3s, transform .15s; pointer-events: none; }
.tile.loaded img { opacity: 1; }
.tile:not(.loaded)::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgb(255 255 255 / .35) 50%, transparent 80%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.tile .new { position: absolute; top: 6px; left: 6px; background: var(--marigold); color: var(--on-accent); font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 2px 6px; border-radius: 6px; }
.tile .check { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: rgb(0 0 0 / .2); display: none; }
.selecting .tile .check { display: block; }
.tile.sel .check { background: var(--marigold); border-color: var(--marigold); }
.tile.sel .check::after { content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid var(--on-accent); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.tile.sel img { transform: scale(.88); border-radius: 6px; }
.empty { padding: 40px 24px; text-align: center; color: var(--muted); line-height: 1.5; }
.gallery-foot { padding: 20px 16px 28px; display: grid; gap: 10px; }

.selbar { display: none; align-items: center; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); }
.selecting .selbar { display: flex; }
.selecting .tabbar { display: none; }
.selbar .n { flex: 1; font-weight: 700; }
.selbar button { border: 0; border-radius: 12px; padding: 10px 14px; font-weight: 700; }
.selbar .go { background: var(--marigold); color: var(--on-accent); }
.selbar .cancel { background: var(--surface-2); }

/* viewer */
.viewer { position: absolute; inset: 0; background: #000; z-index: 20; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
.viewer header, .viewer footer { display: flex; align-items: center; justify-content: space-between; padding: 12px; color: #fff; }
.viewer header span { font-size: 13px; opacity: .85; }
.viewer .icon-btn { color: #fff; }
.vstage { flex: 1; position: relative; display: grid; place-items: center; overflow: hidden; touch-action: pan-y; }
.vstage.zoomed { overflow: auto; place-items: start; touch-action: auto; }
.vstage img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-select: none; }
.vstage.zoomed img { max-width: none; max-height: none; width: 220%; }
.vspin { position: absolute; color: #fff; opacity: .6; font-size: 13px; }
.viewer footer { justify-content: space-around; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.vbtn { background: none; border: 0; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; text-decoration: none; }
.navarrow { position: absolute; top: 50%; transform: translateY(-50%); background: rgb(255 255 255 / .15); border: 0; color: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 22px; }
.navarrow.l { left: 10px; } .navarrow.r { right: 10px; }
@media (hover: none) { .navarrow { display: none; } }
.who { display: flex; gap: 6px; justify-content: center; padding: 0 12px 4px; flex-wrap: wrap; }
.who span { font-size: 12px; color: #fff; background: rgb(255 255 255 / .14); padding: 4px 10px; border-radius: 99px; }

/* overlays */
.overlay { position: absolute; inset: 0; z-index: 25; background: var(--bg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
.scrim { position: absolute; inset: 0; background: rgb(0 0 0 / .45); z-index: 30; display: flex; align-items: flex-end; }
.sheet { width: 100%; background: var(--bg); border-radius: 24px 24px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 14px; max-height: 90%; overflow-y: auto; }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 4px; }
.sheet h3 { margin: 0; font-family: var(--display); font-size: 22px; }
.sheet p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 14px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: var(--fg); }
.check-row input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--marigold); flex: 0 0 auto; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; line-height: 1.45; }
.toast { position: fixed; left: 50%; transform: translate(-50%, 20px); bottom: calc(86px + env(safe-area-inset-bottom, 0px)); width: min(488px, calc(100% - 32px)); z-index: 40; background: var(--fg); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-weight: 600; font-size: 14px; box-shadow: 0 10px 30px rgb(0 0 0 / .25); opacity: 0; transition: .25s; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* tab panes */
.section-t { font-family: var(--display); font-size: 24px; margin: 4px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 16px; display: grid; gap: 12px; }
.list { display: grid; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row strong { display: block; overflow-wrap: anywhere; }
.row .sub { color: var(--muted); font-size: 13px; }
.row .av { width: 46px; height: 46px; font-size: 16px; box-shadow: none; }
.linkbox { display: flex; gap: 8px; }
.linkbox input { flex: 1; min-width: 0; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); padding: 0 12px; font: inherit; font-size: 13px; }
.linkbox button { border: 0; border-radius: 12px; padding: 0 14px; background: var(--fg); color: var(--bg); font-weight: 700; }
.danger-link { background: none; border: 0; color: var(--danger); font-weight: 600; padding: 8px 0; text-align: left; }
.stack { display: grid; gap: 16px; }
.mini-cover { height: 160px; border-radius: 20px; overflow: hidden; background: linear-gradient(135deg, var(--ink), #1b5a66); }
.mini-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kv a { color: var(--fg); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
