:root {
  --bg: #edefe7;
  --surface: #f6f7f1;
  --text: #2f3a26;
  --muted: #6c7559;
  --accent: #6b8e4e;
  --accent-hover: #87a96b;
  --border: #c9d1b8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

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

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

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

header.site {
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  background: var(--surface);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
}

header.site .brand {
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 1.1rem;
  color: var(--text);
}

header.site .brand:hover {
  color: var(--accent);
  text-decoration: none;
}

header.site .topnav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.95rem;
}

header.site .topnav a {
  color: var(--muted);
}

header.site .topnav a:hover {
  color: var(--accent-hover);
  text-decoration: none;
}

main {
  margin: 2rem 0;
  padding: 0 1.5rem;
}

nav.crumbs {
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  color: var(--muted);
}

nav.crumbs .sep {
  margin: 0 0.4rem;
  color: var(--border);
}

nav.crumbs .current {
  color: var(--text);
  font-weight: 500;
}

section.dirs {
  margin-bottom: 2rem;
}

section.dirs h2,
section.gallery h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.75rem;
  font-weight: 600;
}

ul.dirlist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

ul.dirlist li a {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
}

ul.dirlist li a:hover {
  background: var(--accent);
  color: var(--surface);
  border-color: var(--accent);
  text-decoration: none;
}

ul.grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

li.tile a {
  display: block;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

li.tile a:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(47, 58, 38, 0.15);
}

li.tile img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

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

.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(20, 24, 16, 0.88);
  z-index: 1000;
  padding: 2rem;
}

@supports (backdrop-filter: blur(4px)) {
  .lightbox {
    background: rgba(20, 24, 16, 0.72);
    backdrop-filter: blur(4px);
  }
}

.lightbox.open {
  display: flex;
}

.lightbox .lb-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
}

.lightbox img {
  max-width: calc(100vw - 8rem);
  max-height: calc(100vh - 4rem);
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  background: var(--surface);
}

.lightbox .lb-btn {
  position: absolute;
  background: rgba(246, 247, 241, 0.12);
  color: var(--surface);
  border: 1px solid rgba(246, 247, 241, 0.25);
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.lightbox .lb-btn svg {
  display: block;
  width: 55%;
  height: 55%;
}

.lightbox .lb-btn:hover {
  background: rgba(246, 247, 241, 0.22);
  border-color: rgba(246, 247, 241, 0.45);
}

.lightbox .lb-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  font-size: 1.75rem;
  line-height: 1;
}

.lightbox .lb-prev { left: 1rem; }
.lightbox .lb-next { right: 1rem; }

.lightbox .lb-close {
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  font-size: 1.5rem;
  line-height: 1;
}

@media (max-width: 600px) {
  .lightbox { padding: 0.5rem; }
  .lightbox img {
    max-width: 100vw;
    max-height: calc(100vh - 1rem);
  }
  .lightbox .lb-nav { width: 3rem; height: 3rem; }
  .lightbox .lb-prev { left: 0.5rem; }
  .lightbox .lb-next { right: 0.5rem; }
  .lightbox .lb-close { width: 3rem; height: 3rem; top: 0.5rem; right: 0.5rem; }
}
