* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, sans-serif;
  background-color: #121212;
  color: #ffffff;
  min-height: 100vh;
  padding: 20px;
}

/* ---------- Index page ---------- */

.page-header {
  max-width: 1200px;
  margin: 0 auto 16px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.page-header h1,
.page-header .logo {
  font-size: 24px;
  letter-spacing: 1px;
}

/* "Logo" on the viewer page links back to the index. */
.page-header .logo {
  color: #ffffff;
  text-decoration: none;
}

.page-header .logo:hover {
  color: #3b82f6;
}

.viewer-header {
  max-width: 1100px; /* aligns with the viewer column */
}

.count {
  color: #888;
  font-size: 13px;
}

.empty {
  color: #aaa;
  padding: 40px 0;
  text-align: center;
}

.gallery-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.grid-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  overflow: hidden;
  background-color: #1a1a1a;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.grid-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.grid-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-color: #1a1a1a;
}

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

.label {
  text-align: center;
  color: #888;
  font-size: 12px;
  padding: 4px 2px;
  background-color: #000;
}

/* ---------- Viewer page ---------- */

.viewer {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Fixed height container (no per-image aspect-ratio) so the page layout
   height stays stable while browsing; the image centers inside it. */
.featured-wrapper {
  width: 100%;
  height: 75vh;
  min-height: 300px;
  background-color: #1a1a1a;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
}

.featured-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Fullscreen mode */
.featured-wrapper:fullscreen {
  border-radius: 0;
  background-color: #000;
  max-height: none;
}

.featured-wrapper:fullscreen .featured-image {
  width: 100vw;
  height: 100vh;
  max-height: none;
}

/* Toolbar */
.nav-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background-color: #1a1a1a;
  border-radius: 8px;
  flex-wrap: wrap;
}

/* The <a> wrapper carries NO layout styles — only the <button> inside it is
   rendered, so enabled and disabled states have identical widths. */
.nav-buttons a {
  text-decoration: none;
  color: inherit;
}

.nav-buttons button,
.nav-buttons .btn {
  background-color: #2b2b2b;
  color: #fff;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.nav-buttons button:hover:not(:disabled),
.nav-buttons .btn:hover {
  background-color: #3b82f6;
  border-color: #3b82f6;
}

.nav-buttons button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.nav-buttons .spacer {
  flex: 1;
}

.position {
  color: #999;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* Thumbnail strip */
.thumbnail-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 8px 5px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: #333 #121212;
}

.thumbnail-list::-webkit-scrollbar {
  height: 6px;
}

.thumbnail-list::-webkit-scrollbar-thumb {
  background-color: #333;
  border-radius: 3px;
}

.thumbnail-item {
  flex: 0 0 120px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: opacity 0.15s ease, transform 0.15s ease;
  background-color: #1a1a1a;
}

.thumbnail-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumbnail-item:hover {
  opacity: 0.85;
}

.thumbnail-item.active {
  border-color: #3b82f6;
  transform: scale(1.04);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.viewer-footer {
  text-align: center;
  color: #777;
  font-size: 12px;
}
