:root {
  color-scheme: dark;
  --bg: #14191e;
  --panel: #1d242b;
  --line: #343d46;
  --muted: #a6b0b9;
  --text: #eef1f4;
  --accent: #a8c6d4;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 20px; }
body { margin: 0 auto; max-width: 1440px; padding: 0 32px; background: var(--bg); color: var(--text); }
body.viewer-open { overflow: hidden; }
button, input, select { font: inherit; }
button, a { touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .3; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -80px; left: 20px; z-index: 10; padding: 12px; background: var(--bg); }
.skip-link:focus { top: 12px; }
.site-header { min-height: 88px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 650; letter-spacing: -.8px; }
.brand svg { width: 23px; height: 23px; color: var(--accent); }
.nav-link { font-size: 13px; color: var(--muted); padding: 12px 0; }
.nav-link:hover, footer a:hover, .viewer-notice a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 4px; }
.collection { padding: 36px 0 48px; min-height: calc(100svh - 161px); }
.section-heading { display: flex; justify-content: space-between; gap: 20px; align-items: baseline; margin-bottom: 24px; }
h1 { font-size: 30px; font-weight: 550; letter-spacing: -.7px; margin: 0 0 10px; }
.usage-notice { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 0; }
.collection-count { font-size: 13px; color: var(--muted); margin: 0; white-space: nowrap; }
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter { border: 1px solid var(--line); padding: 10px 14px; min-height: 42px; border-radius: 6px; background: var(--bg); font-size: 13px; white-space: nowrap; }
.filter:hover { background: var(--panel); }
.filter.active { background: var(--accent); border-color: var(--accent); color: #172129; }
.tools { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.filters[hidden] + .tools { width: 100%; justify-content: space-between; }
.search-box { display: flex; gap: 8px; align-items: center; min-width: 0; border: 1px solid var(--line); padding: 0 12px; border-radius: 6px; background: var(--panel); }
.search-box svg { width: 17px; height: 17px; color: var(--muted); flex-shrink: 0; }
.search-box input { width: 190px; background: none; border: 0; color: var(--text); font-size: 14px; height: 42px; min-width: 0; }
.search-box input::placeholder { color: var(--muted); }
.sort-box { position: relative; flex-shrink: 0; }
.sort-box::after { content: ''; position: absolute; right: 16px; top: 50%; width: 7px; height: 7px; border-right: 1.5px solid var(--text); border-bottom: 1.5px solid var(--text); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.sort-box select { appearance: none; -webkit-appearance: none; max-width: 180px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; color: var(--text); height: 44px; font-size: 13px; padding: 0 42px 0 14px; cursor: pointer; }
.sort-box select:disabled { cursor: default; opacity: .5; }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.photo-card { align-self: start; min-width: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.photo-card:hover { border-color: #657681; }
.photo-button { display: block; width: 100%; padding: 0; background: none; border: 0; text-align: left; }
.photo-frame { overflow: hidden; background: #101417; }
.photo-frame img { display: block; width: 100%; height: auto; }
.photo-frame img, #full-photo { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.photo-caption { padding: 14px 16px; display: flex; gap: 10px; justify-content: space-between; align-items: baseline; }
.photo-caption h3 { font-size: 14px; font-weight: 500; margin: 0 0 4px; line-height: 1.4; overflow-wrap: anywhere; }
.photo-caption p:empty { display: none; }
.photo-caption p { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 0; overflow-wrap: anywhere; }
.photo-number { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.empty-state { text-align: center; padding: 64px 16px; }
.empty-state h3 { font-size: 18px; font-weight: 500; margin: 0 0 10px; }
.empty-state p { font-size: 14px; line-height: 1.7; color: var(--muted); margin: 0; }
.text-button { border: 1px solid var(--line); border-radius: 4px; background: var(--bg); padding: 12px 16px; font-size: 14px; margin-top: 16px; }
.load-more { display: flex; gap: 20px; align-items: center; border: 1px solid var(--line); background: var(--bg); padding: 12px 20px; font-size: 14px; border-radius: 4px; margin: 32px auto 0; }
.load-more:hover, .text-button:hover { background: var(--panel); }
.noscript { padding: 24px; border: 1px solid var(--line); }
footer { min-height: 73px; padding: 20px 0; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 13px; }
.back-top { padding: 8px 0; }
dialog { --text: #eee; --line: #444; --muted: #aaa; color-scheme: dark; position: fixed; inset: 0; max-width: none; max-height: none; width: 100%; height: 100%; height: 100dvh; padding: 0; border: 0; background: #151515; color: var(--text); }
dialog::backdrop { background: #151515; }
.viewer { height: 100%; display: flex; flex-direction: column; padding: max(12px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); }
.viewer-top { display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; height: 52px; }
.viewer-notice { margin: 16px 70px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.viewer-notice a { margin-left: 8px; text-decoration: underline; text-underline-offset: 3px; }
.viewer-top > span { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--muted); }
.icon-button { width: 48px; height: 48px; border: 1px solid var(--line); background: #222; border-radius: 4px; display: grid; place-items: center; flex-shrink: 0; font-size: 22px; }
.icon-button:hover:enabled { background: #333; }
.viewer-stage { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 22px; flex: 1; min-height: 0; padding: 16px 0; touch-action: pan-y pinch-zoom; }
.viewer-image-wrap { position: relative; flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; justify-content: center; }
.viewer-image-wrap img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; width: auto; height: auto; }
.image-error { position: absolute; left: 0; right: 0; text-align: center; color: var(--muted); }
.viewer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 70px 0; flex-shrink: 0; }
.viewer-bottom h2 { font-size: 20px; font-weight: 500; margin: 0; overflow-wrap: anywhere; }
.viewer-bottom p { font-size: 13px; line-height: 1.6; color: var(--muted); margin: 8px 0 0; }
@media (max-width: 1000px) {
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  body { padding: 0 16px; }
  .brand { font-size: 22px; }
  .nav-link { font-size: 12px; }
  .site-header { min-height: 60px; }
  .collection { padding: 24px 0 32px; min-height: calc(100svh - 133px); }
  .section-heading { flex-direction: column; gap: 12px; align-items: flex-start; margin-bottom: 20px; }
  .usage-notice { font-size: 12px; }
  h1 { font-size: 24px; }
  .collection-count { font-size: 12px; }
  .toolbar { gap: 10px; margin-bottom: 20px; }
  .filters { width: 100%; flex-wrap: nowrap; overflow: auto; padding: 3px; margin: -3px; scrollbar-width: thin; }
  .tools { width: 100%; gap: 8px; }
  .search-box { flex: 1; }
  .search-box input { width: 100%; font-size: 16px; }
  .search-box input::placeholder { font-size: 12px; }
  .sort-box select { font-size: 12px; max-width: 152px; }
  .gallery { gap: 22px; grid-template-columns: 1fr; }
  .empty-state { padding: 48px 12px; }
  .viewer { padding-left: 12px; padding-right: 12px; }
  .viewer-stage { gap: 0; padding: 8px 0; }
  .viewer-stage > .icon-button { position: absolute; bottom: 15px; z-index: 1; width: 44px; height: 44px; }
  .prev { left: 8px; }
  .next { right: 8px; }
  .viewer-bottom { padding: 18px 4px 0; gap: 12px; align-items: flex-start; }
  .viewer-bottom h2 { font-size: 17px; }
  .viewer-bottom p { font-size: 12px; }
  .viewer-top { height: 48px; }
  .viewer-notice { margin: 14px 4px 0; font-size: 11px; }
  .viewer-notice a { display: inline-block; margin-left: 0; }
}
