:root {
  color-scheme: light dark;
  --bg: #fdfaf6;
  --fg: #2b2320;
  --accent: #e08a5b;
  --card-bg: #ffffff;
  --shadow: rgba(0, 0, 0, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1614;
    --fg: #f2ece6;
    --card-bg: #262019;
    --shadow: rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

.page {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  flex: 0 0 180px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 2rem 1rem;
  border-right: 1px solid var(--shadow);
  overflow: hidden;
  white-space: nowrap;
  transition: flex-basis 0.2s ease, padding 0.2s ease;
}

.sidebar.collapsed {
  flex-basis: 0;
  padding-left: 0;
  padding-right: 0;
  border-right-color: transparent;
}

.sidebar-toggle {
  position: sticky;
  top: 1rem;
  margin: 1rem 0 0 1rem;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--fg);
  box-shadow: 0 2px 8px var(--shadow);
  cursor: pointer;
  font-size: 1.1rem;
}

.sidebar-toggle:hover {
  opacity: 0.85;
}

.sidebar a {
  color: var(--fg);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  opacity: 0.75;
}

.sidebar a:hover {
  background: var(--card-bg);
  opacity: 1;
}

.sidebar a.current {
  opacity: 1;
  font-weight: 600;
  color: var(--accent);
}

.content {
  flex: 1;
  min-width: 0;
}

@media (max-width: 640px) {
  .page {
    flex-direction: column;
  }

  .sidebar {
    flex-direction: row;
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--shadow);
    padding: 1rem;
    overflow-x: auto;
    transition: max-height 0.2s ease, padding 0.2s ease;
    max-height: 4rem;
  }

  .sidebar.collapsed {
    flex-basis: auto;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-color: transparent;
  }
}

header {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
}

header h1 {
  margin: 0;
  font-size: 2.25rem;
}

.subtitle {
  margin: 0.5rem 0 0;
  opacity: 0.7;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.gallery figure {
  margin: 0;
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--shadow);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.gallery figure:hover {
  transform: translateY(-3px);
}

.gallery img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  opacity: 0.7;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  cursor: zoom-out;
  z-index: 10;
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}
