:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #666;
  --card-bg: #f4f4f5;
  --card-hover: #e8e8ea;
  --border: #e2e2e5;
  --accent: #2563eb;
  --header-bg: #ffffffcc;
  --radius: 12px;
  --maxw: 1200px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121214;
    --fg: #eaeaec;
    --muted: #9a9aa0;
    --card-bg: #1d1d20;
    --card-hover: #27272b;
    --border: #2a2a2e;
    --accent: #6ea8fe;
    --header-bg: #161618cc;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-title { font-weight: 700; font-size: 1.1rem; color: var(--fg); }
.search-form { display: flex; gap: 6px; }
.search-form input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  min-width: 160px;
}
.search-form button {
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

main { max-width: var(--maxw); margin: 0 auto; padding: 16px; }

h1 { font-size: 1.6rem; margin: 12px 0 20px; }
h2.group-label, main h2 { font-size: 1.2rem; margin: 28px 0 12px; color: var(--muted); }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--muted);
}
.breadcrumbs .sep { color: var(--border); }
.breadcrumbs [aria-current="page"] { color: var(--fg); font-weight: 600; }

/* ---------- Folder / year cards ---------- */
.folder-grid, .year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
.folder-card, .year-card {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--fg);
  transition: background 0.15s, transform 0.15s;
}
.folder-card:hover, .year-card:hover {
  background: var(--card-hover);
  text-decoration: none;
  transform: translateY(-2px);
}
.folder-thumb, .year-thumb { aspect-ratio: 1 / 1; overflow: hidden; }
.folder-thumb img, .year-thumb img,
.folder-thumb picture, .year-thumb picture { width: 100%; height: 100%; }
.folder-thumb img, .year-thumb img { object-fit: cover; }
.folder-name, .year-label {
  padding: 8px 10px;
  font-size: 0.9rem;
  font-weight: 500;
}

/* ---------- Photo grid ---------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.photo-grid .ps-item {
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 8px;
  background: var(--card-bg);
}
.photo-grid .ps-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}
.photo-grid .ps-item:hover img { transform: scale(1.04); }

/* video items: play badge over the poster thumbnail */
.photo-grid .ps-item.ps-video { position: relative; }
.ps-video .play-badge {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.ps-video .play-badge::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent #fff;
}

/* inline video player inside the lightbox */
.pswp__video-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.pswp__video-wrap video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

.embeds { margin: 16px 0; }
.embeds iframe { max-width: 100%; }

.site-footer {
  max-width: var(--maxw);
  margin: 40px auto 24px;
  padding: 16px;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

/* ---------- PhotoSwipe caption + EXIF overlay ---------- */
.pswp__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 16px;
  font-size: 0.85rem;
  color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  text-align: center;
  pointer-events: none;
}
.pswp__exif {
  position: absolute;
  top: 50px;
  right: 12px;
  width: min(300px, 80vw);
  padding: 14px 16px;
  background: rgba(20,20,22,0.92);
  color: #eaeaec;
  border-radius: 10px;
  font-size: 0.85rem;
  transform: translateX(115%);
  transition: transform 0.2s ease;
  z-index: 5;
}
.pswp__exif.is-open { transform: translateX(0); }
.pswp__exif dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.pswp__exif dt { color: #9a9aa0; }
.pswp__exif dd { margin: 0; word-break: break-word; }

@media (max-width: 600px) {
  .search-form input { min-width: 0; width: 100%; }
  .search-form { flex: 1 1 100%; }
}
