/* ===================================
   CARTOONS @ 420360 - RETRO GALLERY
   =================================== */

/* === CSS RESET & BASE === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Color scheme matching 420360.xyz */
  --primary-green: #4a8c3a;
  --secondary-purple: #7b5e8b;
  --dark-bg: #1a1a1a;
  --darker-bg: #0f0f0f;
  --text-light: #e0e0e0;
  --text-muted: #cfcfcf;
  --border-color: #333;
  --hover-glow: rgba(74, 140, 58, 0.3);
}

body {
  font-family: 'Press Start 2P', monospace;
  background: var(--dark-bg);
  color: var(--text-light);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === HEADER === */
header {
  background: var(--darker-bg);
  border-bottom: 3px solid var(--primary-green);
  padding: 20px;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.header-content h1 {
  font-size: 18px;
  color: var(--primary-green);
  margin-bottom: 10px;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.subtitle {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 15px;
}

.back-link {
  display: inline-block;
  font-size: 10px;
  color: var(--text-light);
  text-decoration: none;
  padding: 8px 15px;
  border: 2px solid var(--primary-green);
  background: rgba(74, 140, 58, 0.1);
  transition: all 0.3s ease;
}

.back-link:hover {
  background: var(--primary-green);
  color: var(--dark-bg);
  transform: translateY(-2px);
  box-shadow: 0 0 15px var(--hover-glow);
}

/* === MAIN CONTENT === */
main {
  flex: 1;
  padding: 30px 20px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* === MASONRY GRID === */
.masonry-grid {
  column-count: 3;
  column-gap: 20px;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 20px;
  background: var(--darker-bg);
  border: 2px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 
    3px 3px 0 rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05);
}

.gallery-item:hover {
  transform: translateY(-5px);
  border-color: var(--primary-green);
  box-shadow: 
    5px 5px 0 rgba(0, 0, 0, 0.4),
    0 0 20px var(--hover-glow),
    0 0 0 2px var(--primary-green);
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.3s ease;
}

.gallery-item img:hover {
  opacity: 0.9;
}

.gallery-item-title {
  padding: 10px;
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  background: rgba(0, 0, 0, 0.3);
}

/* === LOADING & EMPTY STATES === */
.loading-text,
.empty-state {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 40px 20px;
}

.empty-state p {
  font-size: 14px;
  color: var(--primary-green);
}

/* === LIGHTBOX === */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  z-index: 10000;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 85vh;
  display: block;
  border: 3px solid var(--primary-green);
  box-shadow: 
    0 0 30px rgba(74, 140, 58, 0.5),
    0 0 60px rgba(0, 0, 0, 0.8);
}

/* Lightbox Controls */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: var(--primary-green);
  color: var(--dark-bg);
  border: none;
  font-family: 'Press Start 2P', monospace;
  font-size: 20px;
  width: 50px;
  height: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
  z-index: 10001;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: var(--secondary-purple);
  transform: scale(1.1);
  box-shadow: 0 0 20px var(--hover-glow);
}

.lightbox-close {
  top: 20px;
  right: 20px;
  border-radius: 4px;
}

.lightbox-prev {
  top: 50%;
  left: 20px;
  transform: translateY(-50%);
  border-radius: 4px;
}

.lightbox-next {
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  border-radius: 4px;
}

.lightbox-title {
  text-align: center;
  margin-top: 15px;
  font-size: 11px;
  color: var(--text-light);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.lightbox-counter {
  text-align: center;
  margin-top: 8px;
  font-size: 9px;
  color: var(--text-muted);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* === FOOTER === */
footer {
  background: var(--darker-bg);
  border-top: 3px solid var(--primary-green);
  padding: 20px;
  text-align: center;
  font-size: 9px;
  color: var(--text-muted);
}

footer p {
  margin: 5px 0;
}

footer a {
  color: var(--primary-green);
  text-decoration: none;
  transition: color 0.3s ease;
}

footer a:hover {
  color: var(--secondary-purple);
  text-decoration: underline;
}

/* === RESPONSIVE === */

/* Tablet: 2 columns */
@media (max-width: 1024px) {
  .masonry-grid {
    column-count: 2;
  }
  
  .header-content h1 {
    font-size: 16px;
  }
  
  .lightbox-prev,
  .lightbox-next {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
}

/* Mobile: 1 column */
@media (max-width: 640px) {
  .masonry-grid {
    column-count: 1;
  }
  
  .header-content h1 {
    font-size: 14px;
  }
  
  .subtitle {
    font-size: 9px;
  }
  
  .back-link {
    font-size: 9px;
    padding: 6px 12px;
  }
  
  main {
    padding: 20px 15px;
  }
  
  .gallery-item {
    margin-bottom: 15px;
  }
  
  .lightbox-close {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
  
  .lightbox-prev,
  .lightbox-next {
    width: 35px;
    height: 35px;
    font-size: 14px;
    left: 10px;
  }
  
  .lightbox-next {
    left: auto;
    right: 10px;
  }
  
  .lightbox-content img {
    max-height: 80vh;
  }
  
  footer {
    font-size: 8px;
  }
}

/* === ACCESSIBILITY === */
.skip-to-main {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary-green);
  color: var(--dark-bg);
  padding: 8px;
  text-decoration: none;
  font-size: 10px;
}

.skip-to-main:focus {
  top: 0;
}

/* Focus states */
a:focus,
button:focus,
.gallery-item:focus {
  outline: 2px solid var(--primary-green);
  outline-offset: 3px;
}
