:root {
  color-scheme: light;
  --bg: #f4f1ec;
  --panel: #fffefa;
  --text: #171817;
  --muted: #6c716a;
  --line: #d8d8cf;
  --accent: #13795b;
  --accent-dark: #0e5e47;
  --shadow: 0 12px 32px rgba(30, 34, 29, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 86px;
  padding: 18px clamp(18px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 254, 250, 0.94);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(24px, 3vw, 40px);
}

h2 {
  font-size: clamp(22px, 2.4vw, 34px);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 14px;
}

.stats span {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.layout {
  display: grid;
  grid-template-columns: minmax(220px, 286px) minmax(0, 1fr);
  gap: 26px;
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 34px) 40px;
}

.sidebar {
  position: sticky;
  top: 110px;
  align-self: start;
  max-height: calc(100vh - 130px);
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.search {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(19, 121, 91, 0.14);
}

.album-nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
  background: #e4f0eb;
  color: var(--accent-dark);
}

.nav-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item small {
  color: var(--muted);
}

.content {
  min-width: 0;
}

.content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.ghost {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
}

.ghost:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

.album-card,
.photo-card {
  display: grid;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.album-card:hover,
.photo-card:hover {
  border-color: rgba(19, 121, 91, 0.45);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.thumb,
.photo-thumb {
  display: block;
  width: 100%;
  overflow: hidden;
  background: #e5e1d8;
}

.thumb {
  aspect-ratio: 1 / 1;
}

.photo-thumb {
  aspect-ratio: 1 / 1;
}

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

.card-body,
.photo-meta {
  display: grid;
  gap: 5px;
  min-height: 72px;
  padding: 12px;
}

.card-body strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-body span,
.photo-meta span {
  color: var(--muted);
  font-size: 13px;
}

.photo-meta {
  align-content: start;
  min-height: 88px;
}

.photo-meta strong {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.photo-description {
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.photo-date {
  margin-top: 2px;
}

.empty {
  display: grid;
  min-height: 260px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.66);
  color: var(--muted);
}

.lightbox {
  width: min(1100px, calc(100vw - 24px));
  height: min(860px, calc(100vh - 24px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #10120f;
  color: #ffffff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

.lightbox::backdrop {
  background: rgba(8, 9, 8, 0.78);
}

.lightbox figure {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 22px;
}

.lightbox img {
  align-self: center;
  justify-self: center;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  object-fit: contain;
}

.lightbox figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 18px;
  color: #e6e6e0;
  font-size: 14px;
}

.icon-button {
  position: absolute;
  z-index: 2;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  cursor: pointer;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.close {
  top: 14px;
  right: 14px;
}

.previous,
.next {
  top: 50%;
  transform: translateY(-50%);
}

.previous {
  left: 14px;
}

.next {
  right: 14px;
}

@media (max-width: 860px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
  }

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

@media (max-width: 520px) {
  .albums-grid,
  .photos-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .card-body,
  .photo-meta {
    min-height: 66px;
    padding: 9px;
  }

  .stats {
    justify-content: flex-start;
  }
}
