/* Gallery-specific layout. Colours, sizes, radii and motion come from tokens.css
   (every text size is a --fs-* token); shared components live in components.css. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
body.has-bar { padding-bottom: 128px; }
button { font-family: inherit; color: inherit; }
img { display: block; }
[hidden] { display: none !important; }
.icon { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-filled { fill: currentColor; }
.noscript { padding: 24px; color: var(--text-2); }

/* ---------- full-page screens (entry, errors) ---------- */
.screen, .pin-screen {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px 40px;
  background: radial-gradient(120% 70% at 50% 0%, #0B0B45 0%, var(--bg) 62%);
}
.screen-card {
  width: 100%; max-width: 440px; padding: 40px 28px 32px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: var(--glass); border: 1px solid var(--hairline); border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
}
.screen-logo, .pin-logo { height: 44px; width: auto; margin-bottom: 20px; }
.screen-art {
  display: grid; place-items: center; width: 64px; height: 64px; margin: 4px 0 8px;
  border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--hairline); color: var(--accent);
}
.screen-title, .empty-title { margin: 0; font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.screen-body, .empty-body { margin: 0 0 12px; max-width: 34ch; color: var(--text-2); line-height: 1.45; }
.entry-form { width: 100%; display: flex; flex-direction: column; gap: 14px; text-align: left; margin-top: 8px; }
.entry-label { color: var(--text-2); line-height: 1.4; }
.entry-error { margin: 0; color: var(--danger); font-weight: 500; line-height: 1.4; }

/* ---------- PIN gate ---------- */
.pin-screen { gap: 0; justify-content: flex-start; padding-top: 88px; }
.pin-card { width: 100%; max-width: 440px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.pin-logo { height: 48px; margin-bottom: 72px; }
.pin-title { margin: 0; font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; }
.pin-lead { margin: 12px 0 0; max-width: 300px; color: var(--text-2); line-height: 1.4; }
.pin-form { width: 100%; margin-top: 40px; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.digits { display: flex; gap: 8px; }
.digit {
  width: 48px; height: 60px; padding: 0; text-align: center;
  border: 1px solid var(--hairline); border-radius: var(--r-sm); background: var(--surface); color: var(--text);
  font: 600 var(--fs-h3)/1 var(--font); outline: none; caret-color: var(--accent);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.digit:focus { border: 2px solid var(--accent); box-shadow: 0 0 0 4px rgba(248, 147, 31, 0.18); }
.digit:disabled { opacity: 0.45; }
.digit-wrong, .digit-wrong:focus { border: 2px solid var(--danger); box-shadow: 0 0 0 4px rgba(255, 138, 128, 0.14); }
.shake { animation: shake 420ms var(--ease) 1; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-10px); } 40% { transform: translateX(9px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
.email-field {
  width: 100%; max-width: 340px; height: 56px; padding: 0 16px; text-align: center;
  border: 1px solid var(--hairline); border-radius: var(--r-sm); background: var(--surface); color: var(--text);
  font: 500 var(--fs-body)/1 var(--font); outline: none; caret-color: var(--accent);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.email-field:focus { border: 2px solid var(--accent); box-shadow: 0 0 0 4px rgba(248, 147, 31, 0.18); }
.email-field-wrong, .email-field-wrong:focus { border: 2px solid var(--danger); box-shadow: 0 0 0 4px rgba(255, 138, 128, 0.14); }
.pin-message { min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; line-height: 1.35; }
.pin-headline { font-weight: 600; color: var(--danger); }
.pin-sub { color: var(--text-2); }
.pin-submit { width: 100%; max-width: 300px; height: 56px; }
.pin-submit.btn-primary { box-shadow: 0 8px 24px rgba(248, 147, 31, 0.28); }
.pin-foot { margin: auto 0 0; padding-top: 48px; letter-spacing: 0.14em; }
@media (min-height: 760px) { .pin-screen { padding-top: 96px; } }

/* ---------- hero ---------- */
.hero { position: relative; height: clamp(440px, 66vh, 580px); overflow: hidden; background: var(--surface); }
.hero-plain { background: linear-gradient(160deg, #F8931F 0%, #C2410C 28%, #3B1E6E 62%, #0B0B45 100%); }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-fade {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 5, 26, 0.55) 0%, rgba(5, 5, 26, 0) 28%),
    linear-gradient(180deg, rgba(5, 5, 26, 0) 38%, rgba(5, 5, 26, 0.72) 74%, var(--bg) 100%);
}
.hero-logo { position: absolute; left: 20px; top: 56px; height: 32px; width: auto; }
.hero-text { position: absolute; left: 20px; right: 20px; bottom: 28px; }
.hero-eyebrow { margin: 0 0 10px; color: var(--text); opacity: 0.85; }
.hero-title { margin: 0; text-wrap: balance; text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35); }
.hero-count { margin: 12px 0 0; color: var(--text-2); font-weight: 500; }
.hero-dl { margin-top: 16px; }

/* ---------- grid ---------- */
.gallery { margin: 0 auto; padding: 0 4px; }
.scene { margin-bottom: 20px; }
.scene-head {
  position: sticky; top: 0; z-index: 20; margin: 0 -4px 4px; padding: 14px 20px;
  font-size: var(--fs-body-lg); font-weight: 600; letter-spacing: -0.01em; color: var(--text);
  background: var(--glass); border-bottom: 1px solid var(--hairline);
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
}
.rows { display: flex; flex-wrap: wrap; gap: 4px; }
.rows-fill { flex-grow: 120; } /* a short last row stretches part-way, never to full width, so 1-3 photo scenes still fill most of the line */
.tile {
  position: relative; overflow: hidden; border-radius: var(--r-sm);
  aspect-ratio: var(--ar); flex: calc(var(--ar) * 100) 1 calc(var(--ar) * 110px);
  background: var(--surface-2);
}
.tile-open { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms var(--ease), opacity var(--dur) var(--ease); }
.tile-open:hover img { transform: scale(1.03); }
.tile::after { content: ""; position: absolute; inset: auto 0 0 0; height: 56px; pointer-events: none; background: linear-gradient(180deg, rgba(5, 5, 26, 0), rgba(5, 5, 26, 0.38)); }
.fav {
  position: absolute; right: 6px; bottom: 6px; z-index: 2;
  display: grid; place-items: center; width: var(--tap); height: var(--tap); padding: 0;
  border: 0; border-radius: var(--r-pill); background: transparent; color: #fff; cursor: pointer;
  transition: transform var(--dur) var(--ease);
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.55));
}
.fav:active { transform: scale(0.88); }
.tile.is-fav .fav { color: var(--accent); animation: pop 280ms var(--ease); }
.tile.is-fav .fav .icon { fill: var(--accent); }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.3); } 100% { transform: scale(1); } }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; margin: 24px 16px 48px; padding: 56px 24px; background: var(--surface); border: 1px dashed var(--track); border-radius: var(--r-lg); }
.empty-body { margin: 0; }

/* ---------- action bar ---------- */
.action-bar { position: fixed; left: 16px; right: 16px; bottom: max(28px, env(safe-area-inset-bottom)); z-index: 40; }
.bar-logo { display: none; }
.bar-count { margin: 0; display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--text); }
.bar-count .icon { color: var(--accent); }
.bar-count strong { display: inline-block; font-weight: 600; transition: transform 150ms var(--ease); }
.bar-count strong.bump { transform: scale(1.3); }
.action-bar .btn { min-height: 48px; }

/* ---------- download sheet ---------- */
.sheet { max-height: 92vh; }
.sheet-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.sheet-title { margin: 0 0 4px; font-size: var(--fs-h3); font-weight: 700; letter-spacing: -0.01em; }
.sheet-sub { margin: 0; color: var(--text-2); line-height: 1.35; }
.sheet-close { padding: 0; width: var(--tap); min-height: var(--tap); margin: -4px -8px 0 0; flex: none; }
.sheet-cards { display: flex; flex-direction: column; gap: 12px; }
.sheet-status { margin: 12px 0 0; min-height: 0; color: var(--text-2); text-align: center; }
.sheet-status:empty { display: none; }
.dl-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; }
.dl-title { margin: 0; font-size: var(--fs-body-lg); font-weight: 600; }
.dl-blurb { margin: 6px 0 14px; color: var(--text-2); line-height: 1.35; }
.dl-off .dl-blurb { margin-bottom: 0; }
.dl-btn { width: 100%; min-height: 52px; }
.tiers { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.tier {
  min-height: 52px; padding: 10px 16px; text-align: left; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--track); border-radius: 16px; background: transparent;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.tier.on { border: 2px solid var(--accent); padding: 9px 15px; background: rgba(248, 147, 31, 0.10); }
.tier-name { font-weight: 600; color: var(--text); }
.tier-price { color: var(--text-2); font-weight: 500; }
.tier.on .tier-price { color: var(--text); }

/* ---------- lightbox ---------- */
.lb {
  position: fixed; inset: 0; z-index: 100; background: rgba(2, 2, 8, 0.9);
  -webkit-backdrop-filter: blur(28px); backdrop-filter: blur(28px);
  animation: lb-fade 250ms var(--ease);
}
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }
.lb-top { position: absolute; z-index: 3; left: 16px; right: 16px; top: max(16px, env(safe-area-inset-top)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.lb-top > :first-child { justify-self: start; }
.lb-actions { display: flex; gap: 10px; justify-self: end; }
.glass-pill, .lb-btn {
  background: rgba(30, 30, 60, 0.55); border: 1px solid rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
}
.lb-btn { display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border-radius: var(--r-pill); color: var(--text); cursor: pointer; transition: transform var(--dur) var(--ease); }
.lb-btn:active { transform: scale(0.92); }
.lb-btn.is-fav { color: var(--accent); }
.lb-btn.is-fav .icon { fill: var(--accent); }
.lb-counter { display: inline-flex; align-items: center; height: 48px; padding: 0 20px; border-radius: var(--r-pill); font-weight: 600; white-space: nowrap; }
.lb-stage { position: absolute; z-index: 1; inset: 80px 0 24px 0; display: flex; align-items: center; justify-content: center; padding: 0 12px; }
.lb-img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: var(--r-md); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7); }
.lb-in { animation: lb-scale 350ms var(--ease); }
@keyframes lb-scale { from { transform: scale(0.96); opacity: 0.4; } to { transform: scale(1); opacity: 1; } }
.lb-nav { position: absolute; z-index: 3; top: 50%; margin-top: -24px; }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-strip { display: none; }
@media (min-width: 900px) {
  .lb-top { left: 24px; right: 24px; top: 20px; }
  .lb-stage { inset: 92px 120px 132px 120px; padding: 0; }
  .lb-nav { width: 56px; height: 56px; margin-top: -28px; }
  .lb-prev { left: 28px; }
  .lb-next { right: 28px; }
  .lb-strip { position: absolute; z-index: 3; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; gap: 8px; padding: 10px; border-radius: 24px; }
  .lb-thumb { flex: none; width: 56px; height: 56px; padding: 0; border: 0; border-radius: var(--r-sm); overflow: hidden; opacity: 0.7; cursor: pointer; background: transparent; transition: width var(--dur) var(--ease), opacity var(--dur) var(--ease); }
  .lb-thumb img { width: 100%; height: 100%; object-fit: cover; }
  .lb-thumb.current { width: 68px; opacity: 1; outline: 3px solid var(--accent); outline-offset: 2px; }
}

/* ---------- desktop ---------- */
@media (min-width: 900px) {
  body.has-bar { padding-bottom: 48px; }
  .hero { height: clamp(460px, 62vh, 600px); }
  .hero-logo { display: none; }
  .hero-text { left: max(48px, calc((100% - 1360px) / 2 + 44px)); right: 48px; bottom: 36px; }
  .hero-eyebrow { margin-bottom: 12px; }
  /* Rows are capped at 1360px and centred so a 1-3 photo scene never strands a
     huge empty strip on ultra-wide screens; scene bars stay full-bleed. */
  .gallery { padding: 0; }
  .scene-head { margin: 0 0 6px; padding: 16px max(44px, calc((100% - 1360px) / 2 + 44px)); font-size: var(--fs-h3); }
  .rows { gap: 6px; max-width: 1360px; margin: 0 auto; padding: 0 44px; }
  .tile { flex-basis: calc(var(--ar) * max(220px, 14vw)); }
  .action-bar {
    left: 0; right: 0; top: 0; bottom: auto; height: 72px; min-height: 72px; padding: 0 max(48px, calc((100% - 1360px) / 2 + 44px));
    border-width: 0 0 1px 0; border-radius: 0; box-shadow: none; background: rgba(18, 18, 46, 0.55);
  }
  .bar-logo { display: block; height: 36px; width: auto; margin-right: auto; }
  .bar-count { margin-right: 12px; }
  .action-bar .btn { min-height: 44px; padding: 0 24px; }
  .scene-head { top: 72px; }
  .sheet-cards { gap: 14px; }
}

/* PIN gate: on larger screens the form sits on a centred glass card. */
@media (min-width: 600px) {
  .pin-screen { justify-content: center; padding-top: 48px; }
  .pin-card {
    max-width: 480px; padding: 48px 40px 44px;
    background: var(--glass); border: 1px solid var(--hairline); border-radius: var(--r-lg);
    box-shadow: var(--shadow-2);
    -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  }
  .pin-logo { margin-bottom: 40px; }
  .pin-foot { margin: 40px 0 0; padding-top: 0; }
}
