@import url('https://fonts.cdnfonts.com/css/minecraftia');

@font-face {
  font-family: 'Minecraft';
  font-style: normal;
  font-weight: 400;
  src: url(https://cdn.rawgit.com/IdreesInc/Minecraft-Font/main/Minecraft.otf)
}

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

body {
  overflow-x: hidden;
  background: #0a0a0a;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(139, 90, 43, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139, 90, 43, 0.03) 0%, transparent 50%);
  font-family: 'Minecraft', monospace;
  color: #ffffff;
  min-height: 100vh;
}

.archive-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.archive-header {
  text-align: center;
  margin-bottom: 50px;
  opacity: 0;
  animation: fadeInUp 1s ease-out 0.5s forwards;
  padding-bottom: 30px;
  border-bottom: 1px solid rgba(139, 90, 43, 0.2);
}

.archive-header h1 {
  font-size: 2.5rem;
  color: #D4A574;
  text-shadow: 0 0 20px rgba(212, 165, 116, 0.3),
               2px 2px 0px rgba(0, 0, 0, 0.8);
  margin-bottom: 15px;
  letter-spacing: 6px;
  font-weight: normal;
  text-transform: uppercase;
}

.archive-header h1::before {
  content: '// ';
  color: rgba(139, 90, 43, 0.6);
  font-size: 0.8em;
}

.archive-header h1::after {
  content: '';
}

.archive-header p {
  font-size: 1rem;
  color: #999;
  text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.8);
  margin-bottom: 20px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 300;
}

.archive-stats {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  margin-top: 25px;
  padding: 12px 25px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(139, 90, 43, 0.3);
  border-radius: 0;
  position: relative;
}

.archive-stats::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 165, 116, 0.3), transparent);
}

.stat-item {
  font-size: 0.85rem;
  color: #999;
  text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.8);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.stat-item strong {
  color: #D4A574;
  font-size: 1rem;
  font-weight: normal;
}

.x-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #666;
  transition: all 0.3s ease;
  text-decoration: none;
  padding: 6px;
  border: 1px solid rgba(139, 90, 43, 0.2);
  background: transparent;
  position: relative;
}

.x-link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(212, 165, 116, 0.1);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.x-link:hover {
  color: #D4A574;
  border-color: rgba(212, 165, 116, 0.5);
  box-shadow: 0 0 10px rgba(212, 165, 116, 0.2);
}

.x-link:hover::before {
  opacity: 1;
}

.x-link svg {
  display: block;
  position: relative;
  z-index: 1;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 35px;
  padding: 50px 30px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(139, 90, 43, 0.2);
  border-radius: 0;
  position: relative;
}

.books-grid::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    linear-gradient(90deg, rgba(139, 90, 43, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(139, 90, 43, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
}

.book-item {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(139, 90, 43, 0.3);
  border-radius: 0;
  padding: 25px 20px;
  text-align: center;
  cursor: default;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.8s ease-out forwards;
  position: relative;
  overflow: hidden;
  image-rendering: pixelated;
}

.book-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 165, 116, 0.2), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.book-item:hover::after {
  opacity: 1;
}

.book-item:nth-child(1) { animation-delay: 0.8s; }
.book-item:nth-child(2) { animation-delay: 1.0s; }
.book-item:nth-child(3) { animation-delay: 1.2s; }
.book-item:nth-child(4) { animation-delay: 1.4s; }
.book-item:nth-child(5) { animation-delay: 1.6s; }

.book-item:hover {
  background: rgba(0, 0, 0, 0.7);
  border-color: rgba(212, 165, 116, 0.5);
  cursor: pointer;
  box-shadow: 0 0 20px rgba(212, 165, 116, 0.1);
  transform: translateY(-2px);
}

.book-item:active {
  background: rgba(0, 0, 0, 0.8);
  transform: translateY(0);
}

.book-thumbnail {
  position: relative;
  margin-bottom: 15px;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.5));
}

.book-thumbnail img {
  width: 140px;
  height: 175px;
  object-fit: contain;
  image-rendering: pixelated;
  transition: all 0.4s ease;
  filter: brightness(0.6) grayscale(0.4) contrast(1.1);
  opacity: 0.7;
}

.book-item:hover .book-thumbnail img {
  filter: brightness(1) grayscale(0) contrast(1);
  opacity: 1;
  transform: scale(1.02);
}

.day-label {
  position: absolute;
  top: 15px;
  left: 15px;
  background: rgba(0, 0, 0, 0.9);
  color: #999;
  padding: 5px 10px;
  border-radius: 0;
  font-size: 0.7rem;
  font-weight: normal;
  border: 1px solid rgba(139, 90, 43, 0.3);
  text-shadow: none;
  transition: all 0.3s ease;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.book-item:hover .day-label {
  background: rgba(0, 0, 0, 0.95);
  color: #D4A574;
  border-color: rgba(212, 165, 116, 0.5);
  box-shadow: 0 0 10px rgba(212, 165, 116, 0.2);
}

.book-title {
  font-size: 0.95rem;
  color: #D4A574;
  font-weight: normal;
  text-shadow: 0 0 10px rgba(212, 165, 116, 0.3);
  margin-top: 18px;
  margin-bottom: 8px;
  letter-spacing: 2px;
  text-transform: uppercase;
  transition: all 0.3s ease;
}

.book-item:hover .book-title {
  color: #E5C6A0;
  text-shadow: 0 0 15px rgba(212, 165, 116, 0.5);
}

.book-meta {
  font-size: 0.7rem;
  color: #555;
  text-shadow: none;
  font-style: normal;
  letter-spacing: 1px;
  text-transform: lowercase;
  transition: color 0.3s ease;
}

.book-item:hover .book-meta {
  color: #777;
}

/* Book Modal Styles */
.book-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.book-modal.show {
  display: flex;
  opacity: 1;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
}

.modal-content {
  position: relative;
  margin: auto;
  background: rgba(5, 5, 5, 0.98);
  border-radius: 0;
  border: 1px solid rgba(139, 90, 43, 0.4);
  padding: 30px;
  max-width: 400px;
  width: 90%;
  transform: scale(0.8);
  transition: transform 0.15s steps(5);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.95),
              0 0 100px rgba(212, 165, 116, 0.1);
}

.book-modal.show .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(139, 90, 43, 0.4);
}

.modal-header h2 {
  color: #D4A574;
  font-size: 1.2rem;
  text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.8);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: normal;
}

.close-btn {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.1s ease;
}

.close-btn:hover {
  color: #D4A574;
}

.close-btn:active {
  color: #999;
}

.modal-body {
  display: flex;
  justify-content: center;
}

/* Book Styles */
.book {
  background: url('https://i.imgur.com/BFFYO3S.png');
  height: 360px;
  width: 292px;
  background-size: contain;
  image-rendering: pixelated;
  position: relative;
  font-family: Minecraft;
  opacity: 0;
  transform: scale(0.9);
  transition: none;
}

.book.fade-in {
  opacity: 1;
  transform: scale(1);
  animation: bookOpen 0.2s steps(4) forwards;
}

@keyframes bookOpen {
  0% {
    opacity: 0;
    transform: scale(0.8) rotateY(-20deg);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.95) rotateY(-10deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotateY(0deg);
  }
}

.book__page-indicator {
  position: absolute;
  top: 30px;
  right: 38px;
  user-select: none;
  line-height: 14px;
  color: #000000;
  font-size: 12px;
  font-weight: bold;
}

.book__nav {
  width: 36px;
  height: 20px;
  background-size: contain !important;
  cursor: pointer;
  position: absolute;
  bottom: 24px;
  transition: all 0.1s ease;
  image-rendering: pixelated;
}

.book__nav:hover {
  filter: brightness(1.2);
}

.book__nav:active {
  filter: brightness(0.9);
}

.book__prev {
  background: url('https://i.imgur.com/SkbjEJc.png');
  left: 57px;
}

.book__prev:hover {
  background: url('https://i.imgur.com/brX7TER.png');
}

.book__next {
  background: url('https://i.imgur.com/Q6nluGA.png');
  right: 67px;
}

.book__next:hover {
  background: url('https://i.imgur.com/byt4Ygz.png');
}

.book__content {
  position: absolute;
  top: 58px;
  width: 236px;
  left: 32px;
  word-break: break-word;
  line-height: 16px;
  margin: 0;
  opacity: 0;
  user-select: none;
  z-index: -10;
  color: #000000;
  font-size: 12px;
  transition: none;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 5px;
}

.book__content::-webkit-scrollbar {
  width: 4px;
}

.book__content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

.book__content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 0;
}

.book__content.--active {
  opacity: 1;
  user-select: auto;
  z-index: 10;
  animation: pageFlip 0.15s steps(3) forwards;
}

@keyframes pageFlip {
  0% {
    opacity: 0;
    transform: translateX(-10px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Responsive Design */
@media (max-width: 768px) {
  .archive-header h1 {
    font-size: 2rem;
  }
  
  .books-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
  }
  
  .book-thumbnail img {
    width: 100px;
    height: 125px;
  }
  
  .modal-content {
    padding: 20px;
    max-width: 350px;
  }
  
  .book {
    height: 300px;
    width: 240px;
  }
  
  .book__content {
    width: 180px;
    left: 30px;
    font-size: 12px;
  }
}
