/* Self-hosted fonts (P44): same-origin latin subsets, variable weights; no third-party font hosts. */
@font-face { font-family: "Bodoni Moda"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("/fonts/bodoni-moda-latin.woff2") format("woff2"); }
@font-face { font-family: "Bodoni Moda"; font-style: italic; font-weight: 400 600; font-display: swap; src: url("/fonts/bodoni-moda-italic-latin.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/plus-jakarta-sans-latin.woff2") format("woff2"); }
/* Festive but calm: aubergine ink, rani-pink actions, marigold accents, rounded shapes.
   Token names predate the palette (--color-rose is the primary pink, --color-sage the success teal). */
:root {
  --font-display: "Bodoni Moda", Georgia, serif;
  --font-body: "Plus Jakarta Sans", Arial, sans-serif;
  --color-paper: #fffaf6;
  --color-ivory: #ffffff;
  --color-ink: #2a1a33;
  --color-muted: #6f6075;
  --color-rule: #efe2e6;
  --color-rose: #b8326e;
  --color-rose-dark: #8e2253;
  --color-sage: #237566;
  --color-sage-soft: #dcf1ec;
  --color-marigold: #f0a830;
  --color-marigold-soft: #fdecc8;
  --color-arch: #fde3c2;
  --color-blush: #fbe3ec;
  --color-black: #1c1022;
  --color-white: #fff;
  --color-overlay: #1c1022e8;
  --color-shadow: #5a1f4a1f;
  --radius-card: 22px;
  --radius-field: 12px;
  --radius-photo: 14px;
  --space-page: clamp(20px, 5vw, 80px);
  --ease-gentle: cubic-bezier(.2,.75,.2,1);
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: clip; }
body { min-height: 100dvh; }
button, input { font: inherit; }
button, .button { cursor: pointer; }
/* File pickers stay keyboard-reachable inside their label buttons (QA P1-1): visually hidden, not display:none. */
label:has(> .file-input) { position: relative; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip-path: inset(50%); pointer-events: none; }
button:focus-visible, a:focus-visible, label:focus-within, summary:focus-visible { outline: 2px solid var(--color-rose); outline-offset: 3px; }
[hidden], .hidden { display: none !important; }
a { color: inherit; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.masthead { height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 var(--space-page); border-bottom: 1px solid var(--color-rule); }
.brand { text-decoration: none; display: inline-flex; align-items: center; gap: 12px; font-size: 12px; letter-spacing: .16em; font-weight: 700; white-space: nowrap; }
.brand-mark, .processing-mark, .art-asterisk, .empty-state > span { position: relative; display: inline-block; flex: none; width: 30px; height: 20px; }
.brand-mark::before, .brand-mark::after, .processing-mark::before, .processing-mark::after, .art-asterisk::before, .art-asterisk::after, .empty-state > span::before, .empty-state > span::after {
  content: ""; position: absolute; top: 0; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--color-rose); }
.brand-mark::before, .processing-mark::before, .art-asterisk::before, .empty-state > span::before { left: 0; }
.brand-mark::after, .processing-mark::after, .art-asterisk::after, .empty-state > span::after { right: 0; border-color: var(--color-marigold); mix-blend-mode: multiply; }
.masthead-note { font-family: var(--font-display); font-style: italic; font-size: 19px; color: var(--color-muted); }
main { max-width: 1500px; margin-inline: auto; }
.welcome { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .95fr); gap: clamp(25px, 6vw, 100px); align-items: center; padding: clamp(58px, 8vw, 115px) var(--space-page) clamp(74px, 8vw, 108px); min-height: min(790px, 86dvh); }
.hero-copy { min-width: 0; padding-bottom: 24px; }
.section-kicker, .overline, .results-eyebrow, .viewer-label { text-transform: uppercase; color: var(--color-rose); font-size: 11px; letter-spacing: .14em; font-weight: 700; }
.section-kicker { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 26px; padding: 7px 14px; border-radius: 999px; background: var(--color-blush); white-space: nowrap; }
.section-kicker::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--color-marigold); }
.tiny-line { display: none; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; font-style: normal; }
h1 { font-size: clamp(48px, 4.4vw, 80px); line-height: 1; letter-spacing: -.025em; max-width: 680px; margin-bottom: 30px; overflow-wrap: anywhere; }
h1 span { display: block; color: var(--color-rose); font-style: italic; }
.hero-intro { font-size: clamp(16px, 1.4vw, 18px); line-height: 1.75; color: var(--color-muted); max-width: 470px; margin-bottom: 30px; }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.button { appearance: none; border: 1.5px solid transparent; border-radius: 999px; display: inline-flex; justify-content: center; align-items: center; gap: 10px; padding: 14px 26px; min-height: 52px; text-decoration: none; font-size: 14px; font-weight: 600; letter-spacing: .01em; white-space: nowrap; transition: background .22s var(--ease-gentle), color .22s var(--ease-gentle), transform .22s var(--ease-gentle), box-shadow .22s var(--ease-gentle); }
.button:hover { transform: translateY(-2px); }
.button:disabled { opacity: .5; cursor: wait; }
.button-primary { background: var(--color-rose); color: var(--color-white); box-shadow: 0 8px 20px -8px var(--color-rose); }
.button-primary:hover { background: var(--color-rose-dark); box-shadow: 0 12px 24px -10px var(--color-rose-dark); }
.button-outline { background: var(--color-ivory); color: var(--color-ink); border-color: var(--color-ink); }
.button-outline:hover { background: var(--color-ink); color: var(--color-white); }
.album-status { display: flex; align-items: center; gap: 8px; color: var(--color-sage); margin: 32px 0 8px; font-size: 12px; font-weight: 600; }
.album-status.error { color: var(--color-rose-dark); }
.status-dot { width: 7px; height: 7px; background: currentColor; border-radius: 50%; }
.privacy-note { font-size: 11px; color: var(--color-muted); line-height: 1.6; }
.hero-art { min-width: 0; height: min(595px, 58vw); min-height: 410px; position: relative; }
.art-arch { position: absolute; inset: 5% 13% 5% 10%; overflow: hidden; background: linear-gradient(180deg, var(--color-arch) 0%, var(--color-blush) 100%); border-radius: 50% 50% 28px 28px / 36% 36% 28px 28px; }
.art-sun { position: absolute; width: 58%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, var(--color-marigold) 0%, #f6c35f 55%, transparent 72%); opacity: .55; top: 14%; left: 21%; }
.art-photo { position: absolute; width: 38%; height: 51%; object-fit: cover; background: var(--color-blush); border: 7px solid var(--color-ivory); border-radius: 6px; box-shadow: 0 22px 50px var(--color-shadow); transition: transform .6s var(--ease-gentle); }
.art-photo:not([src]) { visibility: hidden; }
.art-photo-left { left: 0; bottom: 4%; transform: rotate(-9deg); }
.art-photo-right { right: 0; top: 0; transform: rotate(8deg); }
.hero-art:hover .art-photo-left { transform: rotate(-5deg) translateY(-7px); }
.hero-art:hover .art-photo-right { transform: rotate(5deg) translateY(5px); }
.art-asterisk { position: absolute; right: 6%; bottom: 7%; transform: scale(2.2); transform-origin: right bottom; }
.face-stage, .results-stage { min-height: 75dvh; padding: clamp(32px, 5vw, 72px) var(--space-page) 110px; }
.text-button { border: 0; background: transparent; display: inline-flex; align-items: center; gap: 9px; padding: 8px 0; color: var(--color-muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.text-button:hover { color: var(--color-rose); }
.stage-heading { text-align: center; margin: 48px auto 35px; max-width: 560px; }
.stage-heading h2, .results-heading h2 { font-size: clamp(46px, 5vw, 74px); line-height: .95; letter-spacing: -.03em; margin: 12px 0 15px; }
.stage-heading p, #face-status, #results-status { color: var(--color-muted); line-height: 1.6; font-size: 14px; }
.face-stage { text-align: center; }
.face-stage > .text-button { display: flex; }
.face-list { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 16px; margin: 16px auto; min-height: 100px; }
.face-choice { border: 3px solid transparent; border-radius: 50%; padding: 3px; background: transparent; opacity: .53; width: 96px; height: 96px; transition: opacity .2s, border-color .2s, transform .2s; position: relative; }
.face-choice:hover { transform: translateY(-3px); }
.face-choice.selected { opacity: 1; border-color: var(--color-rose); }
.face-choice img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.face-choice.selected::after { content: "✓"; position: absolute; right: -3px; bottom: -3px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--color-marigold); color: var(--color-ink); font-size: 12px; font-weight: 700; border: 2px solid var(--color-paper); }
.face-stage #find-button { margin-top: 12px; }
.results-top { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: clamp(44px, 7vw, 80px); }
.results-eyebrow { color: var(--color-muted); text-align: right; }
.results-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 36px; }
.results-heading h2 { margin-bottom: 8px; }
.results-heading #results-status { margin-bottom: 0; }
.period { color: var(--color-rose); }
.add-people { flex: none; margin-bottom: 8px; }
.results-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; background: var(--color-ivory); border: 1px solid var(--color-rule); border-radius: 999px; padding: 8px 22px 8px 10px; margin-bottom: 26px; }
.face-list-small { justify-content: flex-start; gap: 8px; margin: 0; min-height: 0; }
.face-list-small .face-choice { width: 44px; height: 44px; border-width: 2px; padding: 2px; }
.face-list-small .face-choice.selected::after { width: 16px; height: 16px; font-size: 9px; }
.filter-controls { display: flex; gap: 24px; align-items: center; }
.switch-label { display: flex; align-items: center; gap: 8px; font-size: 12px; white-space: nowrap; cursor: pointer; }
.switch-label input, input[type=range] { accent-color: var(--color-rose); }
.refine { position: relative; font-size: 12px; }
.refine summary { cursor: pointer; white-space: nowrap; }
.refine[open] { z-index: 3; }
.refine label { display: flex; justify-content: space-between; gap: 14px; margin: 14px 0 6px; }
.refine input { width: 100%; }
.gallery { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: clamp(9px, 1.6vw, 22px); }
.photo { appearance: none; display: block; padding: 0; border: 0; border-radius: var(--radius-photo); width: 100%; min-width: 0; position: relative; background: var(--color-blush); overflow: hidden; text-align: left; }
.photo img { width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block; transition: transform .65s var(--ease-gentle), filter .4s; }
.photo:hover img { transform: scale(1.035); filter: brightness(.9); }
.photo span { position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 8px 12px; border-radius: 999px; color: var(--color-ink); background: var(--color-ivory); font-size: 10px; letter-spacing: .04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0; transition: opacity .2s; }
.photo:hover span, .photo:focus-visible span { opacity: 1; }
.load-more { margin: 32px auto 0; display: flex; }
.empty-state { padding: 65px 20px; text-align: center; }
.empty-state > span { transform: scale(1.8); margin-bottom: 18px; }
.empty-state h3 { font-size: 40px; margin: 12px 0; }
.empty-state p { color: var(--color-muted); margin: 0 0 25px; }
.footer { padding: 35px var(--space-page) 42px; border-top: 1px solid var(--color-rule); display: flex; align-items: center; gap: 14px; color: var(--color-muted); }
.footer p { margin: 0; font-size: 13px; line-height: 1.6; }
.index-tools { margin-left: auto; font-size: 11px; max-width: 340px; }
.index-tools summary { cursor: pointer; }
.index-tools label, .index-tools input { display: block; margin: 8px 0; }
.index-tools p { font: 11px/1.6 var(--font-body); }
.processing { position: fixed; z-index: 15; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; background: var(--color-paper); padding: 24px; }
.processing-mark { transform: scale(2.4); margin-bottom: 24px; animation: gentle-pulse 1.6s var(--ease-gentle) infinite alternate; }
.processing p { font: italic 34px var(--font-display); margin: 18px 0 8px; }
.processing small { color: var(--color-muted); }
.processing-line { height: 3px; width: 110px; border-radius: 3px; background: linear-gradient(90deg, var(--color-rose), var(--color-marigold)); margin: 15px 0 22px; }
@keyframes gentle-pulse { from { transform: scale(2.1); } to { transform: scale(2.5); } }
.toast { position: fixed; z-index: 30; bottom: 30px; left: 50%; transform: translateX(-50%); background: var(--color-ink); color: var(--color-ivory); padding: 13px 22px; border-radius: 999px; font-size: 13px; box-shadow: 0 8px 24px var(--color-shadow); }
.viewer { padding: 0; margin: 0; width: 100vw; max-width: none; height: 100dvh; max-height: none; border: 0; background: var(--color-black); color: var(--color-ivory); overflow: hidden; }
.viewer::backdrop { background: var(--color-black); }
.viewer-shell { display: flex; flex-direction: column; width: 100%; height: 100%; }
.viewer-header { display: flex; justify-content: space-between; align-items: center; flex: none; height: 58px; padding: 0 var(--space-page); font-size: 11px; letter-spacing: .12em; }
.viewer-icon { border: 0; border-radius: 50%; color: var(--color-ivory); background: transparent; display: grid; place-items: center; width: 42px; height: 42px; }
.viewer-image-wrap { --viewer-gutter: 55px; position: relative; display: grid; place-items: center; flex: 1; min-height: 0; padding: 0 var(--viewer-gutter); }
/* Preview-first viewer (P47): one data-state on #viewer-stage drives the photo, the loading pill and the fallback card. */
.viewer-photo { position: absolute; top: 12px; left: var(--viewer-gutter); width: calc(100% - 2 * var(--viewer-gutter)); height: calc(100% - 24px); object-fit: contain; user-select: none; -webkit-user-drag: none;
  opacity: 0; transform: scale(.985); transition: opacity .22s var(--ease-gentle), transform .22s var(--ease-gentle); }
.viewer-image-wrap[data-state="ready"] .viewer-photo { opacity: 1; transform: none; }
.viewer-image-wrap[data-state="failed"] .viewer-photo { display: none; }
.viewer-fallback { display: none; position: absolute; text-align: center; max-width: 320px; }
.viewer-fallback p { font: italic 24px/1.3 var(--font-display); margin: 0 0 18px; }
.viewer-image-wrap[data-state="failed"] .viewer-fallback { display: block; }
.viewer-arrow { position: absolute; z-index: 2; top: 50%; transform: translateY(-50%); width: 45px; height: 56px; border: 0; background: transparent; color: var(--color-ivory); font: 42px/1 var(--font-display); }
.viewer-arrow.previous { left: 5px; }
.viewer-arrow.next { right: 5px; }
.viewer-loading { position: absolute; display: none; align-items: center; gap: 10px; padding: 9px 16px; border-radius: 999px; background: #ffffff14;
  color: var(--color-ivory); font-size: 12px; letter-spacing: .04em; pointer-events: none; }
.viewer-loading::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--color-marigold); border-right-color: transparent; animation: spin .8s linear infinite; }
.viewer-image-wrap[data-state="loading"] .viewer-loading { display: inline-flex; }
@keyframes spin { to { transform: rotate(360deg); } }
.viewer-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex: none; padding: 13px var(--space-page) 18px; min-height: 92px; border-top: 1px solid var(--color-muted); }
.viewer-label { margin: 0 0 7px; color: var(--color-marigold); }
.viewer-footer #caption { font: 21px var(--font-display); margin: 0; max-width: 300px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.viewer-actions { display: flex; align-items: center; gap: clamp(10px, 2vw, 22px); }
.viewer-action { border: 0; background: transparent; color: var(--color-ivory); text-decoration: none; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font: 12px var(--font-body); padding: 9px 0; }
.viewer-action:hover { color: var(--color-blush); }
.viewer-action .icon { width: 17px; height: 17px; }
.viewer-action-strong { padding: 8px 14px; border-radius: 999px; background: var(--color-ivory); color: var(--color-ink); font-weight: 600; }
.viewer-action-strong:hover { background: var(--color-marigold); color: var(--color-ink); }

/* The photographer's local indexer remains usable with the shared stylesheet. */
body:has(#start) main { max-width: 750px; padding: 48px var(--space-page); }
body:has(#start) h1 { font-size: 52px; }
body:has(#start) p { line-height: 1.6; }
body:has(#start) #start { background: var(--color-rose); color: var(--color-white); border: 0; border-radius: 999px; padding: 15px 22px; }
body:has(#start) progress { display: block; width: 100%; accent-color: var(--color-rose); }

@media (max-width: 960px) {
  .welcome { gap: 20px; }
  h1 { font-size: clamp(50px, 6.4vw, 76px); }
  .gallery { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 700px) {
  .masthead { height: 70px; }
  .masthead-note { display: none; }
  .welcome { grid-template-columns: minmax(0,1fr); min-height: 0; padding-top: 54px; padding-bottom: 58px; gap: 36px; }
  .hero-copy { padding: 0; }
  .hero-art { height: 390px; min-height: 0; max-width: 470px; width: 100%; margin-inline: auto; }
  .results-heading { align-items: start; flex-direction: column; gap: 22px; }
  .results-top { margin-bottom: 48px; }
  .results-toolbar { align-items: start; flex-direction: column; border-radius: 18px; padding: 12px 16px; }
  .filter-controls { width: 100%; justify-content: space-between; flex-wrap: wrap; }
  .gallery { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .viewer-footer { flex-direction: column; align-items: stretch; min-height: 122px; gap: 8px; }
  .viewer-footer #caption { font-size: 17px; }
  .viewer-actions { justify-content: space-between; }
  .viewer-image-wrap { --viewer-gutter: 30px; }
  .viewer-arrow { width: 30px; }
  .viewer-arrow.previous { left: 0; }
  .viewer-arrow.next { right: 0; }
}
@media (max-width: 390px) {
  h1 { font-size: 48px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .button { width: 100%; }
  .hero-art { height: 310px; }
  .art-photo { border-width: 5px; }
  .art-asterisk { transform: scale(1.7); }
  .results-eyebrow { display: none; }
  .filter-controls { gap: 10px; }
  .viewer-action { font-size: 11px; }
  .viewer-action .icon { width: 15px; }
  .footer { flex-wrap: wrap; }
  .index-tools { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
