/* 
   ETHEREAL - UNIFIED MATTE BLACK INTERACTIVE FEED
   Aesthetics: Matte Black backdrop, high-contrast imagery, 35mm grain, no captions, 1px/2px borders.
*/

:root {
  --bg-matte-black: #080707;
  --text-ivory: #f4f0ea;
  --border-color: rgba(244, 240, 234, 0.15);
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

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

html, body {
  background-color: var(--bg-matte-black);
  color: var(--text-ivory);
  font-family: var(--font-sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* FILM GRAIN NOISE EFFECT */
.film-grain {
  position: fixed;
  top: -50px;
  left: -50px;
  width: calc(100% + 100px);
  height: calc(100% + 100px);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 250 250' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.055;
  pointer-events: none;
  z-index: 9999;
  animation: grain-dance 8s steps(10) infinite;
}

@keyframes grain-dance {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-5px, 5px); }
  20% { transform: translate(-10px, 10px); }
  30% { transform: translate(5px, -5px); }
  40% { transform: translate(-5px, -10px); }
  50% { transform: translate(10px, 5px); }
  60% { transform: translate(-10px, -5px); }
  70% { transform: translate(5px, 10px); }
  80% { transform: translate(-5px, 5px); }
  90% { transform: translate(10px, -10px); }
}

/* MINIMAL HEADER */
.feed-header {
  padding: 40px 20px 30px;
  text-align: center;
  background-color: var(--bg-matte-black);
}

.logo-title {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 300;
  letter-spacing: 0.25em;
  color: var(--text-ivory);
  text-transform: uppercase;
}

/* FEED GRID SYSTEM */
.feed-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px; /* Very thin gap just like the reference concept */
  padding: 0 2px 80px;
  background-color: var(--bg-matte-black);
  max-width: 1200px;
  margin: 0 auto;
}

.feed-item {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3/4; /* Balanced portrait layout */
  cursor: pointer;
  background-color: #121110;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), z-index 0s;
  z-index: 1;
}

.feed-item img,
.feed-item video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Unified filled grid cells */
  display: block;
  transition: filter 0.4s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  filter: grayscale(0.1) brightness(0.85) contrast(1.02);
}

/* Asymmetric span columns for editorial design layout */
.span-2 {
  grid-column: span 2;
  aspect-ratio: 4/3; /* Wider layout */
}

/* Interactive Spotlight feedback: Dim surrounding elements */
.feed-grid:hover .feed-item {
  opacity: 0.55;
  filter: grayscale(0.3) blur(0.5px);
}

.feed-grid .feed-item:hover {
  opacity: 1;
  filter: grayscale(0) blur(0px);
  transform: scale(1.02); /* Pops forward slightly */
  z-index: 2;
}

.feed-grid .feed-item:hover img,
.feed-grid .feed-item:hover video {
  filter: grayscale(0) brightness(1) contrast(1.05);
  transform: scale(1.03);
}

/* Subtly indicate video elements */
.video-indicator {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: rgba(14, 13, 12, 0.6);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(254, 254, 254, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0.85;
  transition: opacity 0.3s;
}

.feed-item:hover .video-indicator {
  opacity: 1;
  border-color: var(--text-ivory);
}

.video-indicator::after {
  content: '';
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent var(--text-ivory);
  margin-left: 2px;
}

/* AUDIO TOGGLE BUTTON */
.sound-toggle {
  position: fixed;
  bottom: 25px;
  left: 25px;
  z-index: 999;
  background: none;
  border: none;
  color: var(--text-ivory);
  opacity: 0.5;
  font-family: var(--font-sans);
  font-size: 0.65rem;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background-color: rgba(8, 7, 7, 0.8);
  backdrop-filter: blur(10px);
  transition: opacity 0.3s, border-color 0.3s;
}

.sound-toggle:hover {
  opacity: 1;
  border-color: var(--text-ivory);
}

.sound-waves {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 10px;
}

.sound-waves .wave {
  width: 1.5px;
  height: 100%;
  background-color: currentColor;
  transform-origin: bottom;
  transform: scaleY(0.2);
  transition: transform 0.3s;
}

.sound-toggle.playing {
  opacity: 0.9;
}

.sound-toggle.playing .sound-waves .wave {
  animation: wave-bounce 1s ease-in-out infinite alternate;
}

.sound-toggle.playing .sound-waves .wave:nth-child(1) { animation-delay: 0.1s; }
.sound-toggle.playing .sound-waves .wave:nth-child(2) { animation-delay: 0.3s; }
.sound-toggle.playing .sound-waves .wave:nth-child(3) { animation-delay: 0.5s; }

@keyframes wave-bounce {
  0% { transform: scaleY(0.2); }
  100% { transform: scaleY(1); }
}

/* SUPER MINIMAL LIGHTBOX OVERLAY */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.lightbox.active {
  opacity: 1;
  pointer-events: all;
}

.lightbox-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(4, 4, 4, 0.97);
  backdrop-filter: blur(15px);
  cursor: pointer;
}

.lightbox-close-btn {
  position: absolute;
  top: 30px;
  right: 30px;
  font-size: 2rem;
  font-weight: 200;
  color: var(--text-ivory);
  opacity: 0.5;
  cursor: pointer;
  z-index: 10002;
  transition: opacity 0.3s, transform 0.3s;
}

.lightbox-close-btn:hover {
  opacity: 1;
  transform: rotate(90deg);
}

.lightbox-content {
  position: relative;
  width: 90vw;
  height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  pointer-events: none;
  transform: scale(0.96);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox.active .lightbox-content {
  transform: scale(1);
}

.lightbox-content img,
.lightbox-content video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7);
  border-radius: 2px;
  display: none;
  pointer-events: auto; /* Allow inline video touch/controls */
}

/* Lightbox active states */
.lightbox.show-image #lightbox-img {
  display: block;
}

.lightbox.show-video #lightbox-video {
  display: block;
}

/* RESPONSIVE MEDIA QUERIES (Mobile Optimizations) */
@media (max-width: 768px) {
  .logo-title {
    font-size: 1.6rem;
    letter-spacing: 0.2em;
  }
  
  .feed-header {
    padding: 25px 15px 15px;
  }

  .feed-grid {
    grid-template-columns: repeat(3, 1fr); /* Force 3 columns to match the editorial board */
    gap: 1px; /* Even tighter for mobile */
    padding: 0 1px 60px;
  }

  /* Reset hover scales for touch screens */
  .feed-grid:hover .feed-item {
    opacity: 1;
    filter: none;
  }
  .feed-grid .feed-item:hover {
    transform: none;
  }
  .feed-grid .feed-item:hover img,
  .feed-grid .feed-item:hover video {
    transform: none;
  }

  .video-indicator {
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
  }

  .video-indicator::after {
    border-width: 3px 0 3px 5px;
    margin-left: 1px;
  }

  .lightbox-content {
    width: 95vw;
    height: 80vh;
  }

  .lightbox-close-btn {
    top: 20px;
    right: 20px;
    font-size: 1.8rem;
  }

  .sound-toggle {
    bottom: 20px;
    left: 20px;
  }
}

/* Ultra small devices */
@media (max-width: 480px) {
  /* We can drop to 2 columns on super tiny screen sizes if columns get too narrow, but 3 columns matches reference image */
  .feed-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
