:root {
  --bg: #f6f5f2;
  --fg: #1d1d1b;
  --muted: #6b6a66;
  --card: #ffffff;
  --line: #e2e0da;
  --accent: #2f6f8f;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514;
    --fg: #ecebe7;
    --muted: #9b9a95;
    --card: #1f1f1d;
    --line: #2e2e2b;
    --accent: #7fb6d1;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px 64px; }

header.site {
  padding: 40px 0 8px;
}
header.site h1 { margin: 0; font-size: 2rem; letter-spacing: -0.02em; }
header.site p { margin: 4px 0 0; color: var(--muted); }

section h2 {
  margin: 40px 0 16px;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* Album folder heading inside a section */
h3.album {
  margin: 28px 0 12px;
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}
h3.album::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}
/* no extra gap when an album is the first thing in its section */
section > div > h3.album:first-child { margin-top: 0; }

.card {
  display: block;
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card .thumb {
  aspect-ratio: 2 / 1;
  width: 100%;
  object-fit: cover;
  display: block;
  background: var(--line);
}
.card .thumb.placeholder {
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  color: var(--muted);
}
.card .label { padding: 10px 14px; font-weight: 500; }

.empty { color: var(--muted); font-style: italic; }

/* Full-screen viewer pages */
body.viewer { overflow: hidden; background: #000; }
.viewer-stage { position: fixed; inset: 0; }
.viewer-stage model-viewer { width: 100%; height: 100%; background: var(--bg); }
.back {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 12px;
  z-index: 200;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  backdrop-filter: blur(6px);
}
.error { color: #fff; padding: 80px 24px; text-align: center; }
