@font-face {
  font-family: "Inter";
  src: url("fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

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

body {
  font-family: "Inter", sans-serif;
  background: #000;
  color: #fff;
  min-height: 100vh;
}

:root {
  --header-height: 60px;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2rem;
  height: var(--header-height);
  background: #000;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: lowercase;
}

/* Shuffle Button */
.shuffle-btn {
  margin-left: auto;
  margin-right: 1rem;
  background: none;
  border: none;
  color: #999;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 8px;
  letter-spacing: 0.05em;
  transition: color 0.3s, opacity 0.3s;
}

.shuffle-btn:hover {
  color: #fff;
}

/* Hamburger */
.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
}

.hamburger span {
  display: block;
  width: 26px;
  height: 2px;
  background: #fff;
  transition: transform 0.3s, opacity 0.3s;
}

.hamburger.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Side Panel */
.panel {
  position: fixed;
  top: var(--header-height);
  right: 0;
  bottom: 0;
  z-index: 90;
  width: 400px;
  max-width: 85vw;
  background: rgba(0, 0, 0, 0.95);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  overflow-y: auto;
}

.panel.open {
  opacity: 1;
  pointer-events: auto;
}

.panel-content {
  padding: 2rem;
}

.panel-content h2 {
  font-size: 1.4rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
  margin-top: 2.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

.panel-content h2:first-child {
  margin-top: 0;
}

.panel-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  margin-top: 1.2rem;
}

.panel-content p {
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 0.8rem;
  color: #ccc;
}

.panel-content a {
  color: #fff;
}

/* Tile Grid */
.grid {
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 4px;
}

.grid-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
  background: #222;
}

.grid-item.fading-out {
  transition: opacity 0.4s ease;
  opacity: 0;
}

.grid-item.fading-in {
  animation: fade-in 0.4s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.grid-item:hover img {
  transform: scale(1.05);
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: #666;
  font-size: 1.1rem;
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-img,
.lightbox-video {
  max-width: 90vw;
  max-height: calc(100vh - var(--header-height) - 2rem);
  object-fit: contain;
}

.lightbox-img.loading {
  opacity: 0;
}

.lightbox.loading::after {
  content: '';
  position: absolute;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.lightbox-video {
  display: none;
}

/* Play icon overlay on video tiles */
.play-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.play-icon::after {
  content: '';
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 14px 0 14px 24px;
  border-color: transparent transparent transparent rgba(255, 255, 255, 0.8);
}

/* Hide shuffle button when lightbox or panel is open */
.shuffle-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Responsive */
@media (max-width: 600px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 2px;
  }

  .header {
    padding: 1rem 1.2rem;
  }

  .panel {
    width: 100%;
    max-width: 100%;
  }
}
