/* Fotok site layout. Colors, type and spacing come from tokens.css;
   components from components.css (docs/design). */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: var(--type-body);
  color: var(--ink);
  background: var(--surface-100);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
img { max-width: 100%; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 300; }
button, input, select { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.skip-link { position: absolute; left: var(--space-4); top: -48px; z-index: 200; padding: var(--space-2) var(--space-4); background: var(--surface-inverse); color: var(--on-inverse); border-radius: var(--radius-xs); text-decoration: none; }
.skip-link:focus { top: var(--space-2); }

.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding-left: var(--space-16); padding-right: var(--space-16); }
.narrow { max-width: 720px; }
.nowrap { white-space: nowrap; }

/* Type */
.display-xl { font: var(--type-display-xl); letter-spacing: var(--type-display-xl-tracking); }
.display { font: var(--type-display); letter-spacing: var(--type-display-tracking); }
.heading { font: var(--type-heading); letter-spacing: var(--type-heading-tracking); }
.title { font: var(--type-title); letter-spacing: var(--type-title-tracking); }
.lead { font: var(--type-lead); color: var(--ink-muted); }
.eyebrow { font: var(--type-body-sm); color: var(--ink-muted); margin-bottom: var(--space-4); }
.subtle { color: var(--ink-subtle); }

/* ---------- Top bar ---------- */
.site-top { position: sticky; top: 0; z-index: 50; padding: var(--space-4) var(--space-16); }
.site-top nav { flex: 1; display: flex; justify-content: center; }
.ps-top-icon:hover { border-color: var(--ink); }
.ps-top-icon .ps-icon { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
.menu-toggle { display: none; }
.top-cta { padding: var(--space-2) var(--space-4); }

.mobile-menu { position: fixed; inset: 0; z-index: 150; background: var(--surface-100); padding: var(--space-4); display: flex; flex-direction: column; overflow-y: auto; }
.mobile-menu-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: var(--space-4); border-bottom: 1px solid var(--line); }
.mobile-menu-links { list-style: none; margin: var(--space-6) 0 0; padding: 0; }
.mobile-menu-links a { display: flex; align-items: baseline; gap: var(--space-4); padding: var(--space-4) 0; border-bottom: 1px solid var(--line); text-decoration: none; font: var(--type-heading); letter-spacing: var(--type-heading-tracking); }
.mobile-menu-links span { font: var(--type-caption); color: var(--ink-muted); width: 24px; }
body.menu-open { overflow: hidden; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: var(--space-24); }
.site-footer-inner { max-width: 1280px; margin: 0 auto; padding: var(--space-8) var(--space-16); display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-8); justify-content: space-between; align-items: center; }
.site-footer-brand { font-size: 16px; letter-spacing: -0.02em; }
.site-footer-brand b { font-weight: 500; color: var(--brand-text); }
.site-footer-brand span { color: var(--ink-muted); font: var(--type-body-sm); margin-left: var(--space-2); }
.site-footer-links { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); list-style: none; margin: 0; padding: 0; }
.site-footer-links a[aria-current="page"] { color: var(--ink); }
.site-footer-links a, .site-footer-note { font: var(--type-body-sm); color: var(--ink-muted); text-decoration: none; }
.site-footer-links a:hover, .site-footer-note a:hover { color: var(--ink); }
.site-footer-note a { color: var(--ink); }

/* ---------- Home ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: var(--space-16); align-items: center; padding-top: var(--space-24); padding-bottom: var(--space-24); }
.hero-lead { margin-top: var(--space-6); max-width: 34em; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-8); }
.play-soon { padding: 8px 14px; font-size: 14px; line-height: 20px; }

.hero-visual { position: relative; display: flex; justify-content: center; padding: var(--space-8) 0; }
.mock-phone { width: 100%; max-width: 300px; background: var(--surface-050); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); padding: var(--space-4); }
.mock-bar { display: flex; justify-content: space-between; align-items: center; padding: var(--space-2) var(--space-1) var(--space-4); }
.mock-title { font: var(--type-label); }
.mock-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.mock-tile { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-300); }
.mock-tile .ps-ph { position: absolute; inset: 0; }
.mock-wide { grid-column: span 2; aspect-ratio: 16 / 9; }
.mock-new { animation: mock-arrive 4s ease-in-out infinite; }
@keyframes mock-arrive { 0%, 12% { opacity: 0; transform: translateY(-6px); } 24%, 100% { opacity: 1; transform: none; } }
.mock-camera { position: absolute; left: 0; bottom: var(--space-16); display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4) var(--space-3) var(--space-3); background: var(--surface-050); border: 1px solid var(--line); border-radius: var(--radius-pill); box-shadow: var(--shadow-card); font: var(--type-label); }
.mock-camera small { font: var(--type-caption); color: var(--ink-muted); }
.mock-camera-icon { width: 40px; height: 40px; border-radius: var(--radius-pill); background: var(--brand); color: var(--on-brand); display: inline-flex; align-items: center; justify-content: center; }
.mock-camera-icon .ps-icon { width: 20px; height: 20px; }
@media (prefers-reduced-motion: reduce) { .mock-new { animation: none; } }

.band { background: var(--surface-050); padding: var(--space-24) 0; }
.steps { list-style: none; margin: var(--space-12) 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }
.step { border-radius: var(--radius-lg); padding: var(--space-8) var(--space-6); display: flex; flex-direction: column; gap: var(--space-3); min-height: 280px; }
.step-1 { background: var(--tint-100); }
.step-2 { background: var(--tint-200); }
.step-3 { background: var(--tint-300); }
.step-4 { background: var(--tint-400); }
.step-num { font: var(--type-heading); letter-spacing: var(--type-heading-tracking); margin-bottom: auto; padding-bottom: var(--space-8); }
.step-title { font: var(--type-title); letter-spacing: var(--type-title-tracking); }
.step-text { font: var(--type-body-sm); color: var(--ink); }

.features { padding-top: var(--space-24); }
.feature-list { list-style: none; margin: var(--space-12) 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-16); }
.feature-list li { display: flex; gap: var(--space-4); padding: var(--space-6) 0; border-top: 1px solid var(--line); }
.feature-list h3 { font: var(--type-title); letter-spacing: var(--type-title-tracking); margin-bottom: var(--space-2); }
.feature-list p { color: var(--ink-muted); }
.feature-icon { flex: none; width: 36px; height: 36px; border-radius: var(--radius-pill); background: var(--surface-300); display: inline-flex; align-items: center; justify-content: center; }

.cta-band { margin-top: var(--space-24); background: var(--surface-inverse); color: var(--on-inverse); padding: var(--space-24) 0; }
.cta-inner { display: flex; flex-direction: column; gap: var(--space-6); }
.cta-title { max-width: 12em; }
.cta-text { font: var(--type-lead); max-width: 32em; opacity: .8; }
.cta-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.btn-on-inverse { background: var(--on-inverse); color: var(--surface-inverse); }
.btn-on-inverse:hover { background: color-mix(in srgb, var(--on-inverse) 85%, var(--brand)); }
.btn-on-inverse-ghost { background: transparent; color: var(--on-inverse); border-color: color-mix(in srgb, var(--on-inverse) 50%, transparent); }
.btn-on-inverse-ghost:hover { border-color: var(--on-inverse); }
.cta-band .ps-btn:focus-visible { outline-color: var(--on-inverse); }
.page-home .site-footer { margin-top: 0; }

/* ---------- Page heads ---------- */
.page-head { padding-top: var(--space-16); padding-bottom: var(--space-12); }
.page-head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--space-6); }
.page-lead { margin-top: var(--space-4); max-width: 38em; }
.page-sub { font: var(--type-lead); color: var(--ink-muted); margin-top: var(--space-3); }
.ps-chip { text-decoration: none; }
.ps-chip[aria-current="page"] { background: var(--surface-inverse); color: var(--on-inverse); }

/* ---------- Guide ---------- */
.guide { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--space-16); align-items: start; }
.guide-toc { position: sticky; top: 96px; }
.guide-toc-title { font: var(--type-caption); color: var(--ink-muted); margin-bottom: var(--space-3); }
.guide-toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.guide-toc a { display: block; padding: var(--space-2) var(--space-4); font: var(--type-body-sm); color: var(--ink-muted); text-decoration: none; }
.guide-toc a:hover { color: var(--ink); }
.guide-body { max-width: 760px; }
.guide-section { padding: var(--space-12) 0; border-top: 1px solid var(--line); scroll-margin-top: 80px; }
.guide-section:first-child { padding-top: 0; border-top: 0; }
.guide-num { font: var(--type-caption); color: var(--ink-muted); margin-bottom: var(--space-3); }
.guide-sub { font: var(--type-lead); color: var(--ink-muted); margin: var(--space-3) 0 var(--space-8); }
.menu-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.menu-steps li { counter-increment: step; position: relative; padding: var(--space-6) var(--space-6) var(--space-6) 72px; background: var(--surface-050); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.menu-steps li::before { content: counter(step); position: absolute; left: var(--space-6); top: var(--space-6); width: 28px; height: 28px; border-radius: var(--radius-pill); background: var(--surface-300); font: var(--type-label); display: inline-flex; align-items: center; justify-content: center; }
.menu-path { font: var(--type-body-sm); color: var(--ink-muted); }
.menu-path b { color: var(--ink); font-weight: 500; }
.menu-value { font: var(--type-title); letter-spacing: var(--type-title-tracking); margin-top: var(--space-2); }
.menu-note { font: var(--type-body-sm); color: var(--ink-muted); margin-top: var(--space-2); }
.callout { margin-top: var(--space-6); padding: var(--space-6); border-radius: var(--radius-lg); background: var(--tint-200); }
.callout-title { font: var(--type-label); margin-bottom: var(--space-1); }
.account-notice { margin: 0 0 var(--space-6); }
.guide-tip { margin-top: var(--space-6); color: var(--ink-muted); }
.guide-list, .guide-steps { margin: 0; padding: 0; list-style: none; }
.guide-list li, .guide-steps li { padding: var(--space-4) 0; border-top: 1px solid var(--line); }
.guide-list b, .guide-steps b { font-weight: 500; }
.guide-steps { counter-reset: s; }
.guide-steps li { counter-increment: s; display: flex; gap: var(--space-4); }
.guide-steps li::before { content: counter(s, decimal-leading-zero); font: var(--type-caption); color: var(--ink-muted); padding-top: 4px; flex: none; width: 20px; }
.guide-steps a { color: var(--brand-text); }
.guide-play { margin-bottom: var(--space-6); }

/* ---------- Privacy and terms ---------- */
.legal > * { max-width: 760px; }
.legal .legal-draft { margin: 0 0 var(--space-4); }
.legal-section { padding: var(--space-12) 0 0; scroll-margin-top: 80px; }
.legal-section .heading { margin-bottom: var(--space-6); }
.legal-section p + p { margin-top: var(--space-4); }
.legal-section a, .legal-foot a { color: var(--brand-text); }
.legal-section code { font-size: 0.92em; overflow-wrap: anywhere; }
.legal-list { margin: 0; padding: 0; list-style: none; }
.legal-list li { padding: var(--space-4) 0; border-top: 1px solid var(--line); }
.legal-list li:first-child { border-top: 0; padding-top: 0; }
.legal-list b { font-weight: 500; }
.legal-list + p { margin-top: var(--space-4); }
.legal-terms { margin: 0; }
.legal-terms > div { padding: var(--space-4) 0; border-top: 1px solid var(--line); }
.legal-terms > div:first-child { border-top: 0; padding-top: 0; }
.legal-terms dt { font: var(--type-label); margin-bottom: var(--space-1); }
.legal-terms dd { margin: 0; color: var(--ink-muted); }
.legal-foot { margin-top: var(--space-12); padding-top: var(--space-6); border-top: 1px solid var(--line); color: var(--ink-muted); }
.faq { margin: 0; }
.faq > div { padding: var(--space-6) 0; border-top: 1px solid var(--line); }
.faq dt { font: var(--type-title); letter-spacing: var(--type-title-tracking); margin-bottom: var(--space-2); }
.faq dd { margin: 0; color: var(--ink-muted); }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: var(--space-4); }
.form-error { font: var(--type-body-sm); color: var(--danger); }
.form-success { font: var(--type-body-sm); color: var(--live); }
.form-note { font: var(--type-body-sm); color: var(--ink-muted); }
select.ps-field-input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; }
.ps-field-input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.check { display: flex; gap: var(--space-3); align-items: center; font: var(--type-body-sm); }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }

.auth { display: flex; justify-content: center; padding-top: var(--space-24); }
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: var(--space-3); }
.auth-sub { color: var(--ink-muted); margin-bottom: var(--space-6); }
.auth-foot { font: var(--type-body-sm); color: var(--ink-muted); margin-top: var(--space-6); }
.page-login .site-footer { margin-top: var(--space-24); }

.create-panel { background: var(--surface-200); border-radius: var(--radius-xl); padding: var(--space-8); display: flex; flex-direction: column; gap: var(--space-6); }
.create-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4) var(--space-6); }
.create-fields-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.create-foot { display: flex; flex-wrap: wrap; gap: var(--space-4); justify-content: space-between; align-items: center; }
.slug-input { display: flex; align-items: stretch; }
.slug-prefix { display: inline-flex; align-items: center; padding: 0 var(--space-3); font: var(--type-body-sm); color: var(--ink-muted); background: var(--surface-300); border: 1px solid var(--line-strong); border-right: 0; border-radius: var(--radius-xs) 0 0 var(--radius-xs); white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.slug-input .ps-field-input { border-radius: 0 var(--radius-xs) var(--radius-xs) 0; min-width: 0; }
.ps-field-error .slug-prefix { border-color: var(--danger); border-width: 2px; }
.address-preview { font: var(--type-body-sm); color: var(--ink-muted); overflow-wrap: anywhere; }
.address-preview b { font-weight: 500; color: var(--ink); }

/* ---------- Panel ---------- */
.sessions { margin-top: var(--space-12); }
.session-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-8) var(--space-6); }
.session-card { display: flex; flex-direction: column; gap: var(--space-4); }
.session-cover { position: relative; display: block; aspect-ratio: 3 / 2; border-radius: var(--radius-lg); overflow: hidden; background: var(--surface-300); transition: box-shadow .2s, transform .2s; }
.session-cover:hover { box-shadow: var(--shadow-float); transform: translateY(-2px); }
.session-cover .ps-ph, .session-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.session-count { position: absolute; top: var(--space-3); left: var(--space-3); }
.session-name { font: var(--type-title); letter-spacing: var(--type-title-tracking); overflow-wrap: anywhere; }
.session-address { font: var(--type-body-sm); margin-top: var(--space-1); overflow-wrap: anywhere; }
.session-address a { color: var(--brand-text); text-decoration: none; }
.session-address a:hover { text-decoration: underline; }
.session-meta { font: var(--type-caption); color: var(--ink-muted); margin-top: var(--space-2); }
.session-downloads { margin-top: var(--space-3); color: var(--ink-muted); cursor: pointer; }
.session-actions { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); align-items: center; }
.session-actions .ps-btn-outline { padding: var(--space-2) var(--space-4); }
.btn-danger-text:hover { color: var(--danger); }

/* Storage card (admins only, filled by panel.js from /api/admin/storage). */
.storage { margin-top: var(--space-8); }
.storage-card { border: 1px solid var(--line); border-radius: var(--radius-xl); padding: var(--space-6) var(--space-8); display: flex; flex-direction: column; gap: var(--space-3); }
.storage-head { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); justify-content: space-between; align-items: baseline; }
.storage-free { font: var(--type-body-sm); color: var(--ink-muted); }
.storage-free b { font-weight: 500; color: var(--ink); }
.storage-bar { height: 8px; border-radius: var(--radius-pill); background: var(--surface-300); overflow: hidden; }
.storage-used { display: block; height: 100%; width: var(--used, 0%); background: var(--ink); border-radius: inherit; }
.storage-bar.is-full .storage-used { background: var(--danger); }
.storage-note, .storage-rest { font: var(--type-caption); color: var(--ink-muted); }
.storage-full { font: var(--type-body-sm); color: var(--danger); }
.storage-list { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: flex; flex-direction: column; }
.storage-list li { display: flex; gap: var(--space-4); justify-content: space-between; align-items: baseline; padding: var(--space-2) 0; border-top: 1px solid var(--line); font: var(--type-body-sm); }
.storage-list a { color: var(--ink); text-decoration: none; min-width: 0; overflow-wrap: anywhere; }
.storage-list a:hover { text-decoration: underline; }
.storage-size { color: var(--ink-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.empty-state, .gallery-empty { max-width: 420px; margin: var(--space-12) auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.empty-state p, .gallery-empty p { color: var(--ink-muted); }
.empty-art { width: 180px; aspect-ratio: 3 / 2; border-radius: var(--radius-lg); overflow: hidden; margin-bottom: var(--space-3); }

.dialog { border: 0; padding: 0; border-radius: var(--radius-xl); background: var(--surface-100); color: var(--ink); box-shadow: var(--shadow-float); width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
.dialog::backdrop { background: rgba(10, 9, 8, .55); }
.dialog-inner { padding: var(--space-8); display: flex; flex-direction: column; gap: var(--space-4); }
.dialog-sub, .dialog-text { color: var(--ink-muted); }
.dialog-sub { margin-top: calc(var(--space-3) * -1); overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.qr-box { background: #ffffff; border-radius: var(--radius-lg); padding: var(--space-2); }
.qr-box .qr { display: block; width: 100%; height: auto; }
.qr-url { font: var(--type-body-sm); text-align: center; overflow-wrap: anywhere; }
.qr-url a { color: var(--brand-text); }

.toast { position: fixed; left: 50%; bottom: var(--space-6); transform: translateX(-50%); z-index: 120; background: var(--surface-inverse); color: var(--on-inverse); padding: var(--space-3) var(--space-6); border-radius: var(--radius-pill); font: var(--type-label); box-shadow: var(--shadow-float); max-width: calc(100vw - 32px); overflow-wrap: anywhere; }

/* ---------- Photos of a session ---------- */
.back-link { font: var(--type-body-sm); margin-bottom: var(--space-3); }
.back-link a { color: var(--ink-muted); text-decoration: none; }
.back-link a::before { content: "\2190\00a0"; }
.back-link a:hover { color: var(--ink); }
.photos-title { overflow-wrap: anywhere; }
.photos-address { color: var(--brand-text); text-decoration: none; overflow-wrap: anywhere; }
.photos-address:hover { text-decoration: underline; }
.photos-count { font: var(--type-label); color: var(--ink-muted); margin-bottom: var(--space-4); }
.photo-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-6) var(--space-4); }
.photo-item { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.photo-thumb { position: relative; aspect-ratio: 3 / 2; border-radius: var(--radius-md); overflow: hidden; background: var(--surface-300); }
.photo-thumb .ps-ph, .photo-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; }
.photo-thumb img { object-fit: cover; opacity: 0; transition: opacity .2s ease; }
.photo-thumb img.loaded { opacity: 1; }
.photo-dialog-thumb img { opacity: 1; object-fit: contain; }
.photo-info { min-width: 0; }
.photo-name { font: var(--type-body-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-time { margin-top: 0; }
.photo-delete { align-self: flex-start; margin-left: calc(var(--space-2) * -1); }
.photos-more { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); margin-top: var(--space-8); }
.photos-status { font: var(--type-body-sm); color: var(--ink-muted); }
.photos-status:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .photo-thumb img { transition: none; } }

/* ---------- Users ---------- */
.user-list { list-style: none; margin: var(--space-12) 0 0; padding: 0; }
.user-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: var(--space-4); align-items: center; padding: var(--space-4) 0; border-top: 1px solid var(--line); }
.user-row:last-child { border-bottom: 1px solid var(--line); }
.user-row.is-inactive .user-main { opacity: .6; }
.user-name { font: var(--type-body); overflow-wrap: anywhere; }
.user-you { font: var(--type-caption); color: var(--ink-muted); margin-left: var(--space-1); }
.user-login { font: var(--type-body-sm); color: var(--ink-muted); overflow-wrap: anywhere; }
.user-tags { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ps-badge-outline { border: 1px solid var(--line-strong); color: var(--ink); background: transparent; }
.user-since { font: var(--type-caption); color: var(--ink-muted); }
.stateless-note { margin-top: var(--space-6); }

/* ---------- Error ---------- */
.error-page { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--space-16); align-items: center; padding-top: var(--space-24); }
.error-art { aspect-ratio: 4 / 5; border-radius: var(--radius-xl); overflow: hidden; }
.error-code { font: var(--type-display-xl); letter-spacing: var(--type-display-xl-tracking); color: var(--ink-subtle); }
.error-title { margin-top: var(--space-3); }
.error-text { margin-top: var(--space-6); max-width: 30em; }

/* ---------- Gallery ---------- */
.page-gallery { --row: 220px; --gap: var(--space-2); }
.page-gallery .site-top { transition: box-shadow .2s; }
.page-gallery .site-top.scrolled { box-shadow: 0 1px 0 var(--line), 0 12px 24px -20px rgba(10, 9, 8, .4); }
.live-badge { transition: background-color .2s, color .2s; }
/* Narrow screens: the brand and the icons keep their size; if the badge
   still does not fit, its label is cut with an ellipsis instead of pushing
   the bar (and the page) sideways. */
.page-gallery .ps-top-brand, .page-gallery .ps-top-icon { flex-shrink: 0; }
.page-gallery .ps-top-actions, .live-badge, #live-label { min-width: 0; }
#live-label { overflow: hidden; text-overflow: ellipsis; }
.live-badge[data-state="ended"] .ps-badge-dot { animation: none; opacity: .5; }
.live-badge[data-state="closed"] .ps-badge-dot { display: none; }
/* Closed: the date fits in the top bar from 420 px; below, the badge says
   only "Encerrada" and the date goes to the line under the title. */
@media (max-width: 479px) { .live-date { display: none; } }
@media (min-width: 420px) { .closed-note { display: none; } }
.gallery-head { max-width: 1600px; margin: 0 auto; padding: var(--space-12) var(--space-16) var(--space-8); }
.gallery-title { font: var(--type-display); letter-spacing: var(--type-display-tracking); overflow-wrap: anywhere; }
.gallery-meta { font: var(--type-body-sm); color: var(--ink-muted); }
.gallery-sub { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-6); align-items: center; justify-content: space-between; margin-top: var(--space-3); }
.gallery-zip { padding: var(--space-2) var(--space-4); }

/* Justified rows: each tile grows in proportion to its aspect ratio, so
   photos keep their shape and read left to right, newest first. */
.grid { max-width: 1600px; margin: 0 auto; padding: 0 var(--space-16); display: flex; flex-wrap: wrap; gap: var(--gap); }
.grid::after { content: ""; flex-grow: 1000000; }
.tile { --r: 1.5; position: relative; flex-grow: calc(var(--r) * 100); flex-basis: calc(var(--r) * var(--row)); max-width: calc(var(--r) * var(--row) * 1.9); display: block; padding: 0; border: 0; margin: 0; overflow: hidden; border-radius: var(--radius-sm); background: var(--surface-300); cursor: zoom-in; -webkit-tap-highlight-color: transparent; transition: box-shadow .2s; aspect-ratio: var(--r); }
.tile .ps-ph { position: absolute; inset: 0; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .2s ease; }
.tile img.loaded { opacity: 1; }
@media (hover: hover) { .tile:hover { box-shadow: var(--shadow-float); } }
.tile.is-new { animation: tile-in .2s ease both; }
@keyframes tile-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tile.is-new { animation: none; } .tile img { transition: none; } }

/* Until the first page of photos is in the grid, the footer would sit right
   under the empty grid and be pushed down when the tiles arrive; the same
   goes for each older page, so it only shows once the last one is in. */
.page-gallery[data-count]:not([data-count="0"]):not(.is-synced) .site-footer,
.page-gallery.has-more .site-footer { display: none; }

.gallery-more { max-width: 1600px; margin: 0 auto; padding: var(--space-8) var(--space-16) 0; display: flex; flex-direction: column; align-items: center; gap: var(--space-3); text-align: center; }
.gallery-more-status { font: var(--type-body-sm); color: var(--ink-muted); min-height: 1.5em; }

/* New photos only enter the grid while its start is on screen (gallery.js
   holds them otherwise); the browser's own anchoring would then scroll them
   out of view in some browsers and not in others. */
.page-gallery { overflow-anchor: none; }

.new-pill { position: fixed; top: 80px; left: 50%; transform: translateX(-50%); z-index: 60; border-radius: var(--radius-pill); box-shadow: var(--shadow-float); }

/* Lightbox: always dark, the photo is the subject. */
.lightbox { position: fixed; inset: 0; z-index: 100; background: #0a0908; color: #f4f1ec; touch-action: pan-y; }
.lb-stage { position: absolute; inset: 64px 72px 88px; display: flex; align-items: center; justify-content: center; }
.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius-xs); user-select: none; }
.lb-btn { position: absolute; width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid rgba(244, 241, 236, .25); border-radius: var(--radius-pill); background: transparent; color: inherit; cursor: pointer; transition: border-color .15s, background-color .15s; }
.lb-btn:hover { border-color: rgba(244, 241, 236, .7); }
.lb-btn:focus-visible { outline: 2px solid #f4f1ec; outline-offset: 2px; }
.lb-btn[disabled] { opacity: .25; cursor: default; }
.lb-close { top: max(12px, env(safe-area-inset-top)); right: 12px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lb-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: var(--space-4) var(--space-6) max(var(--space-4), env(safe-area-inset-bottom)); display: flex; align-items: center; gap: var(--space-4); font: var(--type-body-sm); color: rgba(244, 241, 236, .75); }
.lb-info { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-download { flex: none; }
body.lb-open { overflow: hidden; }

/* Wall mode (?telao=1): the newest photos one at a time, for a projector or
   a TV. Always dark, like the lightbox; the QR code stays dark on white. */
.wall { position: fixed; inset: 0; z-index: 120; background: #0a0908; color: #f4f1ec; overflow: hidden; }
body.wall-open { overflow: hidden; }
.wall-stage { position: absolute; inset: 0; }
.wall-img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; opacity: 0; transition: opacity .8s ease; user-select: none; }
.wall-img.is-shown { opacity: 1; }
.wall-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-3); padding: var(--space-8); text-align: center; }
.wall-empty-title { font: var(--type-display); letter-spacing: var(--type-display-tracking); }
.wall-empty-sub { font: var(--type-lead); color: rgba(244, 241, 236, .7); }
.wall-corner { position: absolute; right: var(--space-6); bottom: var(--space-6); display: flex; align-items: flex-end; gap: var(--space-4); max-width: min(560px, calc(100% - 2 * var(--space-6))); padding: var(--space-3); border-radius: var(--radius-lg); background: rgba(10, 9, 8, .72); }
.wall-qr { flex: none; width: clamp(96px, 16vmin, 220px); background: #ffffff; border-radius: var(--radius-sm); }
.wall-qr .qr { display: block; width: 100%; height: auto; }
.wall-text { min-width: 0; padding-bottom: var(--space-1); }
.wall-name { font: var(--type-title); font-size: clamp(20px, 2.6vmin, 36px); line-height: 1.25; letter-spacing: var(--type-title-tracking); overflow-wrap: anywhere; }
.wall-url { font: var(--type-body-sm); font-size: clamp(14px, 1.6vmin, 22px); line-height: 1.4; color: rgba(244, 241, 236, .7); overflow-wrap: anywhere; margin-top: var(--space-1); }
.wall-controls { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; display: flex; gap: var(--space-2); opacity: 0; transition: opacity .3s; }
.wall-controls .lb-btn { position: static; background: rgba(10, 9, 8, .6); }
.wall-controls .ps-icon { width: 20px; height: 20px; }
.wall.is-awake .wall-controls, .wall-controls:focus-within { opacity: 1; }
.wall:not(.is-awake) { cursor: none; }
@media (prefers-reduced-motion: reduce) { .wall-img, .wall-controls { transition: none; } }
.wall-state, .wall-pos { font: var(--type-body-sm); font-size: clamp(14px, 1.6vmin, 22px); line-height: 1.4; color: rgba(244, 241, 236, .7); margin-top: var(--space-1); }
.wall-state { color: #f4f1ec; }

/* Preview (?preview=1): the newest photo held on screen, with the older ones
   a key, a drag or a tap away. Same overlay as the wall mode; the swaps are
   quicker, since they follow the hand. */
.wall.is-preview { touch-action: none; }
.wall.is-preview .wall-img { transition-duration: .25s; }
.wall .wall-prev, .wall .wall-next { top: 50%; transform: translateY(-50%); background: rgba(10, 9, 8, .6); opacity: 0; transition: opacity .3s, border-color .15s; }
.wall-prev { left: 12px; }
.wall-next { right: 12px; }
.wall.is-awake .wall-prev, .wall.is-awake .wall-next, .wall-prev:focus-visible, .wall-next:focus-visible { opacity: 1; }
.wall.is-awake .wall-prev[disabled], .wall.is-awake .wall-next[disabled] { opacity: .25; }
@media (prefers-reduced-motion: reduce) { .wall.is-preview .wall-img, .wall-prev, .wall-next { transition: none; } }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .create-fields-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-top: var(--space-12); gap: var(--space-8); }
  .hero-visual { justify-content: flex-end; }
  .guide { grid-template-columns: minmax(0, 1fr); gap: var(--space-8); }
  .guide-toc { position: static; }
  .guide-toc ol { display: flex; flex-wrap: wrap; border-left: 0; gap: var(--space-2); }
  .guide-toc a { border: 1px solid var(--line-strong); border-radius: var(--radius-pill); padding: 6px var(--space-4); }
  .error-page { grid-template-columns: minmax(0, 1fr); padding-top: var(--space-12); gap: var(--space-8); }
  .error-art { aspect-ratio: 16 / 9; }
  .user-row { grid-template-columns: minmax(0, 1fr) auto; }
  .user-tags, .user-since { grid-column: 1; }
  .user-row .ps-btn { grid-column: 2; grid-row: 1 / span 3; }
}

@media (max-width: 720px) {
  .wrap, .site-footer-inner { padding-left: var(--space-4); padding-right: var(--space-4); }
  .site-top { padding: var(--space-3) var(--space-4); gap: var(--space-3); }
  .site-top nav { display: none; }
  .ps-top-actions { gap: var(--space-2); }
  .menu-toggle { display: inline-flex; }
  .ps-top-actions .ps-btn-outline.top-cta { display: none; }
  .display-xl { font-size: 52px; line-height: 52px; }
  .display, .ps-section-title, .gallery-title { font-size: 40px; line-height: 44px; }
  .heading { font-size: 32px; line-height: 36px; }
  .error-code { font-size: 72px; line-height: 72px; }
  .lead, .page-sub, .ps-section-sub, .ps-section-lead, .cta-text, .guide-sub { font-size: 18px; line-height: 27px; }
  .hero { padding-top: var(--space-8); padding-bottom: var(--space-12); }
  .hero-visual { justify-content: center; padding-bottom: var(--space-12); }
  .mock-camera { left: auto; right: 0; bottom: 0; }
  .band, .cta-band { padding: var(--space-16) 0; }
  .features { padding-top: var(--space-16); }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .step { min-height: 0; padding: var(--space-6); }
  .step-num { padding-bottom: var(--space-4); }
  .feature-list { grid-template-columns: minmax(0, 1fr); }
  .page-head { padding-top: var(--space-8); padding-bottom: var(--space-8); }
  .create-panel { padding: var(--space-6) var(--space-4); border-radius: var(--radius-lg); }
  .storage-card { padding: var(--space-6) var(--space-4); border-radius: var(--radius-lg); }
  .create-fields, .create-fields-4 { grid-template-columns: minmax(0, 1fr); }
  .create-foot .ps-btn { width: 100%; }
  .menu-steps li { padding: var(--space-4) var(--space-4) var(--space-4) 60px; }
  .menu-steps li::before { left: var(--space-4); top: var(--space-4); }
  .auth { padding-top: var(--space-12); }
  .dialog-inner { padding: var(--space-6); }
  .session-grid { grid-template-columns: minmax(0, 1fr); }
  .photo-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4) var(--space-3); }

  .page-gallery { --row: 120px; --gap: 4px; }
  .gallery-head { padding: var(--space-6) var(--space-4) var(--space-4); }
  .grid { padding: 0 var(--space-2); }
  .gallery-more { padding: var(--space-6) var(--space-4) 0; }
  .tile { border-radius: var(--radius-xs); }
  .site-footer { margin-top: var(--space-16); }
  .lb-stage { inset: 64px 0 156px; }
  .lb-prev, .lb-next { top: auto; bottom: calc(max(var(--space-4), env(safe-area-inset-bottom)) + 92px); transform: none; }
  .lb-caption { flex-wrap: wrap; row-gap: var(--space-2); }
  .lb-info { flex-basis: 100%; }
  .lb-pos { flex: 1; }
}

/* The gallery bar holds the brand, the preview and wall mode buttons, the
   theme toggle and the badge with its longer labels ("Encerrada em <data>",
   "Sessão encerrada"). Below 480 px the wall mode button leaves the bar: the
   mode is made for a projector, and /{slug}?telao=1 still opens it. Below
   360 px the preview button leaves too (/{slug}?preview=1 still opens it). */
@media (max-width: 479px) {
  .wall-toggle { display: none; }
}
@media (max-width: 359px) {
  .preview-toggle { display: none; }
}
