:root {
  --bg: #0f0f10;
  --surface: #1a1a1d;
  --border: #2e2e33;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #60a5fa;
  --radius: 10px;
  --gap: 1rem;
  --header-h: 4.5rem;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 1rem 1.25rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.site-title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.header-btn {
  flex-shrink: 0;
  margin-top: 0.15rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.header-btn:hover {
  border-color: var(--accent);
}

.header-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

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

.breadcrumbs a:hover {
  text-decoration: underline;
}

.breadcrumbs .sep {
  color: var(--border);
  user-select: none;
}

.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem;
}

.section {
  margin-bottom: 2rem;
}

.section-heading {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.album-grid,
.photo-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--gap);
}

.album-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.photo-grid {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.album-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition:
    border-color 0.15s,
    transform 0.15s;
}

.album-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.album-card-thumb {
  aspect-ratio: 4 / 3;
  background: #111;
  overflow: hidden;
}

.album-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.album-card-thumb .placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 2rem;
}

.album-card-body {
  padding: 0.65rem 0.75rem;
}

.album-card-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.album-card-meta {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.photo-item {
  margin: 0;
}

.photo-thumb {
  display: block;
  width: 100%;
  margin: 0;
  border: none;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition:
    border-color 0.15s,
    transform 0.15s;
}

.photo-thumb:hover {
  border-color: var(--accent);
  transform: scale(1.02);
}

.photo-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  vertical-align: middle;
}

.meta-list {
  margin: 0;
  display: grid;
  gap: 0.5rem 1rem;
  grid-template-columns: minmax(7rem, 10rem) 1fr;
}

.meta-list dt {
  margin: 0;
  font-weight: 500;
  color: var(--muted);
}

.meta-list dd {
  margin: 0;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 3rem 1rem;
}

.lightbox {
  margin: 0;
  padding: 0;
  border: none;
  max-width: none;
  max-height: none;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.92);
  color: var(--text);
}

.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.85);
}

.lightbox-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  width: 100%;
  height: 100vh;
  padding: 3.5rem 4.5rem;
}

.lightbox.show-meta .lightbox-layout {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
}

.lightbox-meta-toggle {
  position: fixed;
  top: 1rem;
  right: 4rem;
  z-index: 3;
}

.lightbox-figure {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding-right: 1rem;
}

#lightbox-image {
  max-width: 100%;
  max-height: calc(100vh - 7rem);
  object-fit: contain;
}

.lightbox-panel {
  overflow-y: auto;
  border-left: 1px solid var(--border);
  padding-left: 1.25rem;
  min-height: 0;
}

.lightbox-filename {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  word-break: break-word;
}

.lightbox-panel .meta-list {
  grid-template-columns: minmax(6.5rem, 9rem) 1fr;
}

.map-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.map-heading {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.photo-map {
  height: 200px;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  z-index: 0;
}

.map-coords {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 3rem;
  height: 3rem;
  border: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--text);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  background: var(--border);
}

.album-stats {
  margin: auto;
  padding: 0;
  border: none;
  max-width: min(640px, calc(100vw - 2rem));
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}

.album-stats::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.album-stats-inner {
  padding: 1.25rem 1.5rem 1.5rem;
}

.album-stats-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.album-stats-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.album-stats-close {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.album-stats-close:hover {
  background: var(--border);
}

.album-stats-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-height: min(70vh, 520px);
  overflow-y: auto;
}

.bar-chart-title {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.bar-chart-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.bar-chart-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bar-chart-row {
  display: grid;
  grid-template-columns: minmax(0, 9rem) 1fr 2rem;
  gap: 0.5rem 0.65rem;
  align-items: center;
  font-size: 0.85rem;
}

.bar-chart-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-chart-track {
  height: 1.1rem;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.bar-chart-bar {
  height: 100%;
  min-width: 2px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 70%, #2563eb), var(--accent));
  border-radius: 4px;
  transition: width 0.2s ease;
}

.bar-chart-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

@media (max-width: 900px) {
  .lightbox-layout,
  .lightbox.show-meta .lightbox-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    padding: 3rem 1rem 1rem;
    overflow-y: auto;
  }

  .lightbox-figure {
    padding-right: 0;
    max-height: 50vh;
  }

  #lightbox-image {
    max-height: 48vh;
  }

  .lightbox-panel {
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 1rem;
  }
}

@media (max-width: 600px) {
  .lightbox-meta-toggle {
    top: auto;
    bottom: 1rem;
    right: 1rem;
    left: auto;
  }

  .bar-chart-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .bar-chart-label {
    white-space: normal;
  }

  .meta-list {
    grid-template-columns: 1fr;
  }

  .meta-list dt {
    margin-bottom: -0.25rem;
  }

  .lightbox-nav {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1.5rem;
  }
}
