/* ===== RESET ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow-x: hidden;
}

body {
  background: #000;
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ===== BACKGROUND ===== */
.bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("images/bg.jpg") center / cover no-repeat;
  animation: bgPulse 4s infinite alternate;
  z-index: -1;
}

@keyframes bgPulse {
  from {
    filter: brightness(0.75) contrast(1);
    transform: scale(1);
  }
  to {
    filter: brightness(1.25) contrast(1.3);
    transform: scale(1.05);
  }
}

/* ===== CONTAINER ===== */
.container {
  min-height: 100vh;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  z-index: 1;
  gap: 30px;
}

/* ===== TITLES ===== */
.titles {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 10px;
}

.subtitle {
  font-size: clamp(18px, 4vw, 24px);
  letter-spacing: 1px;
  text-transform: lowercase;
  font-weight: 700;
  margin-bottom: -5px;
  animation: subtitleGlow 2s infinite alternate;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
  position: relative;
  z-index: 2;
}

@keyframes subtitleGlow {
  from { 
    opacity: 0.8;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  }
  to { 
    opacity: 1;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.9),
                 0 0 30px rgba(159, 186, 255, 0.6);
  }
}

.title {
  font-size: clamp(80px, 20vw, 160px);
  line-height: 0.9;
  font-weight: 900;
  font-family: 'Montserrat', Impact, sans-serif;
  background: linear-gradient(180deg, 
    #ffffff 0%,
    #ffffff 30%,
    #ffffff 70%,
    #ffffff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  animation: 
    titleGlitch 3s infinite,
    titleShine 2s infinite alternate;
  margin: 0;
  padding: 0;
  letter-spacing: -2px;
  text-transform: uppercase;
}

.title::before {
  content: 'PEAK';
  position: absolute;
  top: 1px;
  left: 1px;
  background: linear-gradient(180deg, 
    rgba(0,0,0,0.8) 0%,
    rgba(0,0,0,0.4) 100%,
    rgba(0,0,0,0.2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  z-index: -1;
}

@keyframes titleGlitch {
  0%, 100% { transform: translate(0); }
  92% { transform: translate(0); }
  93% { transform: translate(-3px, 2px); }
  94% { transform: translate(3px, -2px); }
  95% { transform: translate(-1px, 1px); }
  96% { transform: translate(1px, -1px); }
}

@keyframes titleShine {
  from { 
    text-shadow: 
      0 0 30px rgba(255, 255, 255, 0.1),
      1px 1px 1px rgba(0,0,0,0.1),
      -1px -1px 1px rgba(255,255,255,0.1);
  }
  to { 
    text-shadow:
      0 0 20px rgba(255, 255, 255, 0.5),
      0 0 45px rgba(255, 255, 255, 0.3),
      2px 2px 2px rgba(0,0,0,0.2),
      -2px -2px 2px rgba(255,255,255,0.3);
  }
}

/* ===== HERO ===== */
.hero-wrapper {
  position: relative;
  margin: 20px 0;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

.hero {
  max-width: min(600px, 90vw);
  height: auto;
  display: block;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ===== INFO SECTION ===== */
.info {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 25px;
  max-width: 800px;
  width: 100%;
  animation: infoPulse 3s infinite alternate;
}

@keyframes infoPulse {
  from { opacity: 0.95; }
  to { opacity: 1; }
}

.contract {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding: 24px 40px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
}

.contract:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(255, 255, 255, 0.2);
}

@keyframes contractGlow {
  from { 
    box-shadow: 
      0 0 10px rgba(255, 255, 255, 0.1),
      inset 0 0 10px rgba(255, 255, 255, 0.05);
  }
  to { 
    box-shadow: 
      0 0 25px rgba(255, 255, 255, 0.3),
      inset 0 0 20px rgba(255, 255, 255, 0.1);
  }
}

#ca {
  font-family: 'Courier New', monospace;
  font-size: clamp(12px, 2vw, 14px);
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  animation: textFlicker 3s infinite alternate;
}

@keyframes textFlicker {
  from { opacity: 0.9; }
  to { opacity: 1; }
}

.copy-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  transition: all 0.3s ease;
  animation: btnPulse 2s infinite alternate;
}

.copy-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(255, 255, 255, 0.2);
}

.copy-btn:active {
  transform: translateY(0);
}

@keyframes btnPulse {
  from { 
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
  }
  to { 
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
  }
}

.btn-icon {
  width: 60px;
  height: 60px;
  object-fit: contain;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.7));
}

/* LINKS */
.links {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  transition: all 0.3s ease;
  animation: linkGlow 3s infinite alternate;
}

.meme-gallery-btn {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
}

.link:hover,
.meme-gallery-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(255, 255, 255, 0.2);
}

@keyframes linkGlow {
  from { 
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
  }
  to { 
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
  }
}

.link-icon {
  width: 60px;
  height: 60px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.7));
  animation: iconPulse 2s infinite alternate;
}

@keyframes iconPulse {
  from { transform: scale(1); }
  to { transform: scale(1.1); }
}

/* ===== MEME GALLERY MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px) brightness(0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  width: 90%;
  max-width: 1200px;
  max-height: 90vh;
  overflow: hidden;
  animation: modalSlideIn 0.3s ease;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  font-family: 'Montserrat', sans-serif;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
}

.modal-header h2 {
  font-size: 28px;
  font-weight: 900;
  background: linear-gradient(180deg, #fff, #aaa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
  text-align: center;
}

.close-modal {
  position: absolute;
  right: 32px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.close-modal:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.gallery-container {
  padding: 24px;
  max-height: calc(90vh - 90px);
  overflow-y: auto;
}

.meme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.meme-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
  height: 200px;
}

.meme-item:hover {
  transform: translateY(-5px) scale(1.02);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 10px 20px rgba(255, 255, 255, 0.1);
}

.meme-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ===== MEME VIEWER MODAL ===== */
.meme-viewer-content {
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  width: 90%;
  max-width: 1000px;
  max-height: 90vh;
  overflow: hidden;
  animation: viewerSlideIn 0.3s ease;
  position: relative;
}

@keyframes viewerSlideIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.meme-viewer-header {
  padding: 20px;
  display: flex;
  justify-content: flex-end;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.close-viewer {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.close-viewer:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.meme-viewer-body {
  padding: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: calc(90vh - 100px);
  overflow: auto;
}

#fullMemeImage {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Navigation buttons for meme viewer */
.nav-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 1001;
}

.nav-button:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: translateY(-50%) scale(1.1);
  border-color: white;
}

.nav-button.prev {
  left: 20px;
}

.nav-button.next {
  right: 20px;
}

.nav-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.nav-button:disabled:hover {
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.7);
}

/* ===== RESPONSIVENESS ===== */
@media (max-width: 1024px) {
  .meme-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .container {
    padding: 30px 15px;
    gap: 25px;
  }
  
  .subtitle {
    letter-spacing: 6px;
    font-size: 16px;
  }
  
  .title {
    font-size: clamp(70px, 18vw, 120px);
  }
  
  .hero {
    max-width: 95vw;
  }
  
  .contract {
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }
  
  #ca {
    text-align: center;
    word-break: break-all;
    padding: 0 10px;
  }
  
  .links {
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }
  
  .link,
  .meme-gallery-btn {
    width: 100%;
    max-width: 300px;
    justify-content: center;
  }
  
  .modal-content {
    width: 95%;
    max-height: 85vh;
  }
  
  .modal-header h2 {
    font-size: 24px;
  }
  
  .meme-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
  
  .meme-item {
    height: 180px;
  }
  
  .meme-viewer-content {
    width: 95%;
  }
  
  .meme-viewer-body {
    padding: 20px;
  }
  
  .nav-button {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  
  .nav-button.prev {
    left: 10px;
  }
  
  .nav-button.next {
    right: 10px;
  }
}

@media (max-width: 480px) {
  .subtitle {
    letter-spacing: 4px;
    font-size: 14px;
  }
  
  .title {
    font-size: clamp(60px, 15vw, 90px);
  }
  
  .hero {
    max-width: 100vw;
  }
  
  .copy-btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  .link,
  .meme-gallery-btn {
    padding: 10px 20px;
    font-size: 14px;
  }
  
  .link-icon {
    width: 20px;
    height: 20px;
  }
  
  .modal-content {
    width: 98%;
    max-height: 80vh;
  }
  
  .modal-header {
    padding: 16px;
  }
  
  .modal-header h2 {
    font-size: 20px;
  }
  
  .close-modal {
    right: 16px;
    width: 35px;
    height: 35px;
    font-size: 20px;
  }
  
  .meme-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .meme-item {
    height: 200px;
  }
  
  .gallery-container {
    padding: 16px;
  }
  
  .meme-viewer-content {
    width: 98%;
  }
  
  .meme-viewer-header {
    padding: 15px;
  }
  
  .close-viewer {
    width: 35px;
    height: 35px;
    font-size: 20px;
  }
  
  .meme-viewer-body {
    padding: 15px;
  }
  
  .nav-button {
    width: 35px;
    height: 35px;
    font-size: 18px;
  }
}