:root {
  --bg-color: #0f1115;
  --bg-elevated: #181b22;
  --accent: #ffcc33;
  --accent-soft: rgba(255, 204, 51, 0.1);
  --text-main: #f5f5f5;
  --text-muted: #a0a4b0;
  --border-subtle: #2a2f3a;
  --danger: #ff6b6b;
  --radius-lg: 12px;
  --radius-md: 8px;
  --shadow-soft: 0 14px 30px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1b2130 0, #05060a 55%, #020308 100%);
  color: var(--text-main);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 5vw 0.75rem;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
  background: linear-gradient(to bottom, rgba(5, 6, 12, 0.92), rgba(5, 6, 12, 0.7));
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-logo {
  height: 40px;
  width: auto;
  display: block;
}

.titles h1 {
  margin: 0;
  font-size: 1.3rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.titles p {
  margin: 0.1rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.view-toggle {
  display: inline-flex;
  padding: 0.15rem;
  background: rgba(6, 7, 14, 0.9);
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.55);
}

.view-toggle button {
  border: none;
  background: none;
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.view-toggle button.active {
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateY(-1px);
}

#gridView[hidden],
#listView[hidden] {
  display: none !important;
}

.controls {
  padding: 0.9rem 5vw 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.search-box {
  flex: 1 1 240px;
  max-width: 380px;
}

.search-box label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.search-box input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(10, 12, 20, 0.95);
  color: var(--text-main);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.filter-group {
  min-width: 140px;
}

.filter-group label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.filter-group select {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: rgba(10, 12, 20, 0.95);
  color: var(--text-main);
}

main {
  padding: 0.3rem 5vw 2.5rem;
}

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

.card {
  background: linear-gradient(145deg, rgba(18, 21, 30, 0.98), rgba(8, 10, 16, 0.98));
  border-radius: var(--radius-lg);
  padding: 0.6rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 255, 255, 0.02);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75);
  border-color: rgba(255, 204, 51, 0.4);
}

.card-image-wrapper {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: radial-gradient(circle at top, #444, #111);
}

.card-image-wrapper img {
  width: 100%;
  display: block;
}

.card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.7rem;
  color: var(--text-muted);
}

.card-meta {
  margin-top: 0.55rem;
}

.card-title {
  margin: 0;
  font-size: 0.95rem;
}

.card-subtitle {
  margin: 0.12rem 0 0.1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.25rem;
}

.tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.gallery-list {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  background: rgba(10, 12, 20, 0.95);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.gallery-list th,
.gallery-list td {
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.82rem;
}

.gallery-list th {
  background: rgba(5, 6, 12, 0.9);
  text-align: left;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
}

.list-thumb {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  background: radial-gradient(circle at top, #555, #111);
}

tr.clickable-row {
  cursor: pointer;
}

tr.clickable-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.empty-state {
  margin-top: 2rem;
  text-align: center;
  color: var(--text-muted);
}

.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.lightbox[hidden] {
  display: none !important;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.95));
}

.lightbox-content {
  position: relative;
  max-width: min(960px, 92vw);
  max-height: min(90vh, 640px);
  background: linear-gradient(145deg, #121623, #070812);
  border-radius: 18px;
  padding: 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 1rem;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.lightbox-content img {
  width: 100%;
  border-radius: 12px;
  background: radial-gradient(circle at top, #555, #111);
}

.lightbox-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
}

.lightbox-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.lightbox-meta h2 {
  margin-top: 0;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

.lightbox-meta p {
  margin: 0.15rem 0;
}

.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 0.8rem 5vw 1.2rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(5, 6, 12, 0.9);
}

@media (max-width: 720px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.7rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .filters {
    width: 100%;
  }

  .lightbox-content {
    grid-template-columns: 1fr;
    max-height: 90vh;
  }
}
