:root {
  --background: #0b0d10;
  --surface: #14181d;
  --surface-raised: #1b2027;
  --border: #2a313a;
  --text: #f5f7fa;
  --muted: #9da8b5;
  --accent: #8dd7c7;
  --danger: #ff8f8f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--background);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--background); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 20% -10%, #19302e 0, transparent 32rem), var(--background); color: var(--text); }
button, input { font: inherit; }
button { color: inherit; }

.access-shell { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.access-card { max-width: 38rem; padding: clamp(2rem, 7vw, 4.5rem); border: 1px solid var(--border); border-radius: 1.5rem; background: rgba(20, 24, 29, .92); box-shadow: 0 2rem 6rem rgba(0, 0, 0, .35); }
.access-card h1 { margin: .5rem 0 1rem; font-size: clamp(2rem, 6vw, 4rem); line-height: .98; letter-spacing: -.05em; }
.access-card p { color: var(--muted); font-size: 1.05rem; line-height: 1.65; }
.access-card code { color: var(--accent); }
.alert-text { color: var(--danger) !important; }

.gallery-shell { width: min(100%, 112rem); margin: 0 auto; padding: clamp(1rem, 3vw, 3rem); }
.gallery-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.gallery-header h1 { margin: .35rem 0 0; font-size: clamp(2.4rem, 6vw, 5.5rem); line-height: .9; letter-spacing: -.055em; }
.gallery-actions { display: flex; align-items: end; gap: .75rem; }
.gallery-toolbar { display: flex; align-items: center; gap: 1rem; min-height: 3.5rem; margin: 0 0 1.5rem; padding: .6rem .85rem; border: 1px solid var(--border); border-radius: .9rem; background: var(--surface); }
.gallery-filter-controls { display: flex; align-items: center; justify-content: flex-end; gap: .75rem; margin-left: auto; }
.sort-control { display: flex; align-items: center; gap: .7rem; color: var(--muted); font-size: .72rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.sort-control select { border: 1px solid var(--border); border-radius: .65rem; background: var(--surface); color: var(--text); padding: .55rem .7rem; font: inherit; font-size: .82rem; letter-spacing: normal; text-transform: none; cursor: pointer; }
.eyebrow { color: var(--accent); font-size: .72rem; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.quiet-button, .tab-button, .admin-button, .like-button { border: 1px solid var(--border); border-radius: 999px; background: var(--surface); padding: .65rem 1rem; cursor: pointer; transition: border-color .2s, background .2s, color .2s, transform .2s; }
.quiet-button:hover, .tab-button:hover, .admin-button:hover, .like-button:hover { border-color: #56616e; background: var(--surface-raised); }
.quiet-button:active, .tab-button:active, .admin-button:active, .like-button:active { transform: translateY(1px); }

.gallery-tabs { position: sticky; top: .75rem; z-index: 4; display: inline-flex; gap: .35rem; margin-bottom: 1.5rem; padding: .35rem; border: 1px solid var(--border); border-radius: 999px; background: rgba(11, 13, 16, .86); backdrop-filter: blur(16px); }
.tab-button { border-color: transparent; background: transparent; color: var(--muted); }
.tab-button.active { background: var(--text); color: #101317; }
.channel-tabs { display: flex; flex: 1 1 auto; gap: .5rem; margin: 0; overflow-x: auto; scrollbar-width: thin; }
.channel-tab { flex: 0 0 auto; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); padding: .5rem .8rem; cursor: pointer; }
.channel-tab:hover { border-color: #56616e; background: var(--surface-raised); }
.channel-tab.active { border-color: var(--accent); background: #18302d; color: var(--text); }

.photo-grid { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); gap: 1rem; }
@media (min-width: 600px) { .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1380px) { .photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.photo-card { position: relative; min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 1rem; background: var(--surface); animation: reveal .35s ease both; }
.photo-preview { aspect-ratio: 4 / 3; overflow: hidden; background: #08090b; }
.photo-preview img { display: block; width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.photo-details { display: flex; justify-content: space-between; gap: 1rem; padding: .85rem .9rem 1rem; }
.photo-details > div:first-child { min-width: 0; }
.photo-details strong { display: block; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-details span { color: var(--muted); font-size: .76rem; }
.photo-actions { display: flex; flex: 0 0 auto; align-items: center; gap: .45rem; }
.like-button { display: inline-flex; align-items: center; justify-content: center; gap: .32rem; min-width: 3.5rem; padding: .45rem .7rem; color: var(--muted); font-size: .78rem; }
.like-button.liked { border-color: #d75f7f; background: #351923; color: #ff9bb5; }
.like-button:disabled { cursor: wait; opacity: .65; }
.like-button .like-icon { color: currentColor; font-size: 1rem; line-height: 1; }
.like-button .like-count { color: currentColor; font-size: .76rem; font-variant-numeric: tabular-nums; }
.photo-flags { position: absolute; top: .7rem; left: .7rem; display: flex; gap: .35rem; }
.photo-flag { padding: .3rem .55rem; border-radius: 999px; background: rgba(10, 12, 15, .82); color: #ffc2c2; font-size: .68rem; backdrop-filter: blur(8px); }
.admin-button { flex: 0 0 auto; padding: .45rem .7rem; font-size: .75rem; }
.admin-button.delete { color: var(--danger); }

.empty-state { margin: 8rem auto; max-width: 32rem; text-align: center; color: var(--muted); }
.error-state { color: var(--danger); }
.scroll-sentinel { height: 8rem; display: grid; place-items: center; }
.scroll-sentinel span { width: 1.6rem; height: 1.6rem; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.scroll-sentinel.done span { display: none; }
.scroll-sentinel p { display: none; margin: 0; color: var(--muted); font-size: .9rem; }
.scroll-sentinel.done p { display: block; }

.photo-dialog { width: min(96vw, 96rem); height: min(94vh, 70rem); padding: 0; border: 1px solid var(--border); border-radius: 1rem; background: #060708; color: var(--text); overflow: hidden; }
.photo-dialog::backdrop { background: rgba(0, 0, 0, .88); backdrop-filter: blur(8px); }
.dialog-image-frame { width: 100%; height: calc(100% - 4rem); display: flex; align-items: center; justify-content: center; overflow: hidden; background: #060708; }
.dialog-image-frame:empty::after { content: "Loading photo…"; color: var(--muted); font-size: .9rem; }
.dialog-image-frame img { display: block; min-width: 0; min-height: 0; width: 100%; height: 100%; object-fit: contain; object-position: center; cursor: zoom-in; user-select: none; -webkit-user-drag: none; touch-action: none; transition: transform .15s ease; }
.dialog-image-frame img.zoomed { cursor: grab; }
.dialog-image-frame img.zoomed:active { cursor: grabbing; }
.dialog-image-frame img.dragging { transition: none; }
.dialog-close { position: absolute; z-index: 2; top: .75rem; right: .75rem; width: 2.6rem; height: 2.6rem; border: 1px solid #ffffff33; border-radius: 50%; background: #000a; font-size: 1.6rem; cursor: pointer; }
.dialog-download { position: absolute; z-index: 2; top: .75rem; right: 4rem; display: inline-flex; height: 2.6rem; align-items: center; gap: .45rem; padding: 0 .9rem; border: 1px solid #ffffff33; border-radius: 999px; background: #000a; color: var(--text); font-size: .8rem; font-weight: 700; text-decoration: none; }
.dialog-download:hover { border-color: var(--accent); background: #111d; }
.dialog-download > span[aria-hidden] { font-size: 1.15rem; line-height: 1; }
.dialog-navigation { position: absolute; z-index: 2; top: calc(50% - 2rem); width: 3rem; height: 4rem; border: 1px solid #ffffff33; border-radius: .75rem; background: #000a; color: var(--text); font-size: 2.8rem; line-height: 1; cursor: pointer; }
.dialog-navigation:disabled { cursor: default; opacity: .35; }
.dialog-navigation.previous { left: .75rem; }
.dialog-navigation.next { right: .75rem; }
.dialog-caption { height: 4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 1.2rem; border-top: 1px solid var(--border); }
.dialog-caption-copy { display: flex; min-width: 0; align-items: center; justify-content: space-between; flex: 1 1 auto; gap: 1rem; }
.dialog-caption-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog-caption-copy span { color: var(--muted); font-size: .8rem; text-align: right; }
.dialog-like { flex: 0 0 auto; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes reveal { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; scroll-behavior: auto !important; } }
@media (max-width: 600px) { .dialog-navigation { width: 2.5rem; height: 3.4rem; } .dialog-navigation.previous { left: .35rem; } .dialog-navigation.next { right: .35rem; } .dialog-download { width: 2.6rem; justify-content: center; padding: 0; } .dialog-download-label { display: none; } }
@media (max-width: 600px) { .gallery-header { align-items: flex-start; flex-direction: column; gap: 1.25rem; } .gallery-actions { width: 100%; justify-content: space-between; } .gallery-toolbar { align-items: stretch; flex-direction: column; } .gallery-filter-controls { justify-content: space-between; margin-left: 0; } .sort-control { flex: 1 1 0; } .sort-control select { width: 100%; } }
