/* Family viewer */

/* Gate */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; text-align: center; overflow: hidden; }
.gate::before {
  content: ""; position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 35% at 20% 25%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(35% 30% at 85% 80%, color-mix(in srgb, #d9b26f 22%, transparent), transparent 70%);
  filter: blur(10px);
}
.gate__inner { width: min(560px, 100%); }
.gate__title { font-size: clamp(3.4rem, 15vw, 7rem); }
.gate__sub { margin: 14px 0 34px; font-family: var(--serif); font-style: italic; font-size: clamp(1.1rem, 4vw, 1.35rem); color: var(--muted); }
.gate__form { display: flex; gap: 8px; max-width: 340px; margin: 0 auto; padding: 6px; border-radius: var(--pill); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.gate__form .input { border: 0; background: transparent; border-radius: var(--pill); text-align: center; min-height: 48px; }
.gate__form .input:focus { box-shadow: none; }
.gate__form .btn { width: 48px; height: 48px; min-height: 48px; padding: 0; flex: none; }
.gate__error { margin-top: 16px; color: var(--danger); font-size: 15px; }

/* Top bar */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .3s;
}
.top.scrolled { border-bottom-color: var(--line); }
.top__brand { font-size: 30px; text-decoration: none; padding-right: 6px; }
.top__search { flex: 1; max-width: 520px; margin: 0 auto; position: relative; }
.top__search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.top__search input {
  width: 100%; height: 44px; padding: 0 16px 0 40px; border-radius: var(--pill);
  border: 1px solid var(--line); background: var(--card); font-size: 16px; transition: border-color .2s, box-shadow .2s;
}
.top__search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }

.app { max-width: 1280px; margin: 0 auto; padding: 0 16px calc(64px + var(--safe-b)); }

/* Hero */
.hero { text-align: center; padding: clamp(28px, 7vw, 64px) 0 clamp(20px, 4vw, 32px); }
.hero h1 { font-size: clamp(3.2rem, 13vw, 6.2rem); }
.hero p { margin-top: 10px; color: var(--muted); font-size: 15px; }

/* Controls */
.controls { position: sticky; top: 64px; z-index: 10; margin: 0 -16px 18px; padding: 8px 16px 10px; background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.controls__row { display: flex; align-items: center; gap: 10px; }
.seg { display: inline-flex; padding: 4px; border-radius: var(--pill); background: var(--paper-2); border: 1px solid var(--line); flex: none; }
.seg button { height: 36px; padding: 0 16px; border-radius: var(--pill); font-weight: 600; font-size: 14px; color: var(--muted); transition: background .2s, color .2s; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.sort { margin-left: auto; position: relative; flex: none; }
.sort select {
  appearance: none; height: 44px; padding: 0 36px 0 14px; border-radius: var(--pill); border: 1px solid var(--line); background: var(--card);
  font-size: 14px; font-weight: 600; color: var(--ink-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%238a7f72' stroke-width='1.8'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 10px 16px 2px; margin: 0 -16px; scroll-snap-type: x proximity; -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 24px), transparent); }
.chips::-webkit-scrollbar { display: none; }
.chips .chip { scroll-snap-align: start; flex: none; }
.chips .chip--clear { border-style: dashed; color: var(--accent); }
@media (max-width: 520px) { .seg button { padding: 0 12px; } .sort select { max-width: 132px; } }

/* Album cards — a little stack of prints */
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 36px 28px; padding-top: 8px; }
@media (max-width: 560px) { .albums { grid-template-columns: 1fr 1fr; gap: 28px 16px; } }
.acard { text-decoration: none; display: grid; gap: 14px; animation: rise .6s var(--ease) both; }
.acard__stack { position: relative; aspect-ratio: 4 / 3.3; }
.acard__stack::before, .acard__stack::after {
  content: ""; position: absolute; inset: 0; border-radius: 14px; background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); transition: transform .45s var(--ease);
}
.acard__stack::before { transform: rotate(-4deg) translate(-4px, 5px); }
.acard__stack::after { transform: rotate(3deg) translate(4px, 3px); }
.acard__stack .thumb { position: absolute; inset: 0; z-index: 1; border-radius: 14px; box-shadow: var(--shadow); border: 5px solid var(--card); }
.acard:hover .acard__stack::before { transform: rotate(-8deg) translate(-12px, 8px); }
.acard:hover .acard__stack::after { transform: rotate(6deg) translate(12px, 4px); }
.acard:hover .thumb img.ready { transform: scale(1.04); }
.acard__count { position: absolute; z-index: 2; right: 12px; bottom: 12px; }
.acard h2 { font-family: var(--serif); font-weight: 500; font-size: clamp(17px, 4.5vw, 21px); line-height: 1.2; letter-spacing: -.005em; }
.acard p { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* Album page header */
.ahead { padding: 18px 0 22px; display: grid; gap: 8px; }
.ahead .back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; width: max-content; padding: 8px 10px 8px 0; }
.ahead h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(32px, 8vw, 54px); line-height: 1.05; letter-spacing: -.02em; }
.ahead__meta { color: var(--muted); font-size: 14px; display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; }
.ahead__desc { max-width: 62ch; color: var(--ink-2); font-size: 16px; line-height: 1.6; }
.ahead .tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* Photo grid */
.month { font-family: var(--serif); font-weight: 500; font-size: 20px; margin: 26px 0 12px; display: flex; align-items: baseline; gap: 10px; }
.month small { font-family: var(--sans); font-size: 13px; color: var(--muted); font-weight: 400; }
.month:first-child { margin-top: 4px; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
@media (max-width: 560px) { .pgrid { grid-template-columns: repeat(3, 1fr); gap: 3px; margin: 0 -14px; } .pgrid .ptile { border-radius: 0; } }
.ptile { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; cursor: zoom-in; }
.ptile .thumb { position: absolute; inset: 0; }
.ptile:hover .thumb img.ready { transform: scale(1.04); }
.ptile:focus-visible { outline-offset: -3px; }

.empty { text-align: center; padding: 72px 20px; color: var(--muted); display: grid; gap: 10px; justify-items: center; }
.empty h2 { font-family: var(--serif); font-weight: 500; font-size: 26px; color: var(--ink); }
.results-note { font-size: 14px; color: var(--muted); margin: 0 0 14px; }

/* Lightbox */
.lb { position: fixed; inset: 0; z-index: 50; background: #0d0a08; color: #f4ede3; display: grid; grid-template-rows: auto 1fr auto; animation: fade .25s both; touch-action: pan-y; }
@keyframes fade { from { opacity: 0; } }
.lb .icon-btn { color: #f4ede3; }
.lb .icon-btn:hover { background: rgba(255,255,255,.1); }
.lb__bar { display: flex; align-items: center; justify-content: space-between; padding: max(8px, env(safe-area-inset-top)) 12px 8px 20px; }
.lb__count { font-size: 14px; opacity: .7; font-variant-numeric: tabular-nums; }
.lb__actions { display: flex; gap: 4px; }
.lb__stage { position: relative; overflow: hidden; display: grid; place-items: center; }
.lb__stage img, .lb__stage video { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; transition: transform .3s var(--ease), opacity .25s; }
.lb__stage.swiping img { transition: none; }
.lb__stage .loading { position: absolute; width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.2); border-top-color: #fff; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.lb__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.08); color: #fff; transition: background .2s; }
.lb__nav:hover { background: rgba(255,255,255,.18); }
.lb__nav--prev { left: 16px; } .lb__nav--next { right: 16px; }
@media (hover: none), (max-width: 720px) { .lb__nav { display: none; } }
.lb__info { padding: 14px 20px calc(18px + var(--safe-b)); display: grid; gap: 8px; max-width: 760px; width: 100%; margin: 0 auto; text-align: center; }
.lb__info:empty { padding: 0 0 calc(12px + var(--safe-b)); }
.lb__cap { font-family: var(--serif); font-size: 18px; line-height: 1.4; }
.lb__meta { font-size: 13px; opacity: .65; display: flex; gap: 6px 14px; justify-content: center; flex-wrap: wrap; }
.lb__meta a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.lb__tags { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.lb__tags .tag { background: rgba(255,255,255,.12); color: #f4ede3; }
