/* Guest photo book — host-facing, code-gated gallery. Self-contained (its own tokens) so it can be
   served alone on the photos.<domain> subdomain. Branding accent/bg are injected by album.js from meta. */
:root {
  color-scheme: dark;
  --accent: #6c63ff;
  --bg: #0b0b14;
  --bg2: #12121f;
  --card: #16162a;
  --border: rgba(255,255,255,0.09);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --radius: 16px;
  --shadow: 0 12px 40px rgba(0,0,0,0.45);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1100px 700px at 15% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    radial-gradient(900px 600px at 110% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.ab-app { max-width: 1120px; margin: 0 auto; padding: clamp(1rem, 3vw, 2rem); padding-top: calc(clamp(1rem,3vw,2rem) + env(safe-area-inset-top)); }
.ab-center { min-height: 70dvh; display: flex; align-items: center; justify-content: center; }

/* Spinner */
.ab-spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: ab-spin 0.8s linear infinite; }
@keyframes ab-spin { to { transform: rotate(360deg); } }

/* ── Gate / message card ─────────────────────────────────────────────── */
.ab-gate { min-height: 82dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 0.35rem; }
.ab-gate-card {
  width: min(94vw, 420px); background: color-mix(in srgb, var(--card) 88%, transparent);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: clamp(1.4rem, 5vw, 2.2rem); backdrop-filter: blur(8px);
}
.ab-logo { max-height: 74px; max-width: 62%; object-fit: contain; margin-bottom: 1rem; }
.ab-badge { font-size: 2.4rem; line-height: 1; margin-bottom: 0.6rem; }
.ab-title { font-size: clamp(1.35rem, 5vw, 1.7rem); font-weight: 800; margin: 0 0 0.25rem; letter-spacing: -0.02em; }
.ab-sub { color: var(--muted); font-size: 0.98rem; margin: 0 0 1.3rem; line-height: 1.5; }
.ab-codeform { display: flex; flex-direction: column; gap: 0.8rem; }
.ab-code-input {
  width: 100%; text-align: center; font-size: 1.7rem; font-weight: 800; letter-spacing: 0.42em; text-indent: 0.42em;
  text-transform: uppercase; padding: 0.85rem 0.6rem; border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--bg2); color: var(--text); outline: none; font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.ab-code-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.ab-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font-size: 1.02rem; font-weight: 800; padding: 0.9rem 1.4rem; border: none; border-radius: 999px;
  background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; transition: transform 0.08s ease, filter 0.15s ease;
}
.ab-btn:hover { filter: brightness(1.08); }
.ab-btn:active { transform: scale(0.98); }
.ab-btn[disabled] { opacity: 0.55; cursor: default; }
.ab-btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.ab-err { color: #fca5a5; font-size: 0.92rem; min-height: 1.1em; margin-top: 0.2rem; }

/* ── Gallery header ──────────────────────────────────────────────────── */
.ab-header { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.ab-header .ab-hlogo { max-height: 46px; max-width: 160px; object-fit: contain; }
.ab-hmeta { flex: 1 1 auto; min-width: 0; }
.ab-hname { color: var(--muted); font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.ab-htitle { font-size: clamp(1.3rem, 4.5vw, 1.85rem); font-weight: 800; letter-spacing: -0.02em; margin: 0.1rem 0 0; }
.ab-avail { color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; }
.ab-toolbar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 1rem 0 1.1rem; }
.ab-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.ab-chip {
  font-size: 0.9rem; font-weight: 700; padding: 0.45rem 0.9rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg2); color: var(--muted); cursor: pointer;
}
.ab-chip.active { background: color-mix(in srgb, var(--accent) 20%, var(--bg2)); border-color: var(--accent); color: var(--text); }
.ab-spacer { flex: 1 1 auto; }

/* ── Photo grid ──────────────────────────────────────────────────────── */
.ab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.7rem; }
.ab-tile {
  position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; cursor: pointer;
  background: var(--card); border: 1px solid var(--border); padding: 0;
}
.ab-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s ease; }
.ab-tile:hover img { transform: scale(1.05); }
.ab-tile.is-strip { aspect-ratio: 3 / 4; }
.ab-tag {
  position: absolute; left: 0.45rem; bottom: 0.45rem; font-size: 0.66rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.05em; padding: 0.16rem 0.44rem; border-radius: 999px; background: rgba(0,0,0,0.6); color: #fff; backdrop-filter: blur(4px);
}
.ab-empty { color: var(--muted); text-align: center; padding: 3rem 1rem; }
.ab-footnote { color: var(--muted); font-size: 0.8rem; text-align: center; margin: 1.8rem 0 calc(1rem + env(safe-area-inset-bottom)); }

/* ── Lightbox ────────────────────────────────────────────────────────── */
.ab-lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(4,4,10,0.94); display: flex; align-items: center; justify-content: center; }
.ab-lightbox[hidden] { display: none; } /* [hidden] + class specificity beats the bare class rule above */
.ab-lb-img { max-width: 92vw; max-height: 78dvh; border-radius: 10px; box-shadow: var(--shadow); }
.ab-lb-close { position: absolute; top: calc(0.8rem + env(safe-area-inset-top)); right: 1rem; width: 46px; height: 46px; border-radius: 50%; border: none; background: rgba(255,255,255,0.12); color: #fff; font-size: 1.3rem; cursor: pointer; }
.ab-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%; border: none; background: rgba(255,255,255,0.1); color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; }
.ab-lb-prev { left: 0.6rem; } .ab-lb-next { right: 0.6rem; }
.ab-lb-download { position: absolute; bottom: calc(1.1rem + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  font-weight: 800; padding: 0.8rem 1.5rem; border-radius: 999px; background: var(--accent); color: #fff; text-decoration: none; }
@media (max-width: 520px) { .ab-lb-nav { width: 42px; height: 42px; font-size: 1.6rem; } .ab-grid { gap: 0.5rem; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); } }
