/* ========================================
   GUILD OF KNOWLEDGE - MAIN STYLESHEET
   ======================================== */

/* ========================================
   CSS RESET & BASE STYLES
   ======================================== */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Courier New', monospace, Arial, sans-serif;
  background: #0a0a0a;
  color: #f1f1f1;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   MATRIX BACKGROUND
   ======================================== */
#matrix-canvas {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  opacity: 0.3;
}

/* ========================================
   SITE HEADER
   ======================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #0a0a0a;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  padding: 1rem 2vw;
  text-align: center;
}

.site-title {
  font-size: 2.5rem;
  color: #0ff;
  margin: 0;
  font-weight: bold;
  text-shadow: 0 0 10px #0ff;
}

@media (max-width: 600px) {
  .site-title {
    font-size: 1.8rem;
  }
}

/* ========================================
   MAIN CONTENT LAYOUT
   ======================================== */
#main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero-section {
  text-align: center;
  margin-bottom: 3rem;
  animation: fadeInDown 1s ease-out;
}

.hero-title {
  font-size: 3.5rem;
  color: #0ff;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 20px #0ff, 0 0 40px #0ff;
  font-weight: bold;
  letter-spacing: 2px;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: #0f0;
  margin: 0;
  opacity: 0.8;
  font-style: italic;
}

/* ========================================
   TOPICS SECTION
   ======================================== */
.topics-section {
  margin-bottom: 3rem;
}

.topics-section h2 {
  font-size: 2.5rem;
  color: #0f0;
  text-align: center;
  margin-bottom: 2rem;
  text-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

/* ========================================
   KNOWLEDGE GRID & CARDS
   ======================================== */
.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.knowledge-card {
  background: linear-gradient(145deg, #111, #1a1a1a);
  border: 1px solid #0f0;
  border-radius: 15px;
  padding: 0;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.1);
  animation: fadeInUp 0.8s ease-out;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.knowledge-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 0, 0.1), transparent);
  transition: left 0.5s ease;
}

.knowledge-card:hover::before,
.knowledge-card:active::before {
  left: 100%;
}

.knowledge-card:hover,
.knowledge-card:active {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 10px 30px rgba(0, 255, 0, 0.3);
  border-color: #0ff;
}

.knowledge-card a {
  display: block;
  padding: 2rem;
  text-decoration: none;
  color: inherit;
  height: 100%;
  min-height: 44px;
}

.card-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
  filter: drop-shadow(0 0 10px rgba(0, 255, 0, 0.5));
}

.knowledge-card h3 {
  font-size: 1.5rem;
  color: #0f0;
  margin: 0 0 1rem 0;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.knowledge-card p {
  font-size: 0.95rem;
  color: #ccc;
  margin: 0;
  line-height: 1.5;
  opacity: 0.9;
}

/* ========================================
   CARD BADGES
   ======================================== */
.card-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 255, 0, 0.2);
  color: #0f0;
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid rgba(0, 255, 0, 0.3);
}

/* ========================================
   COLLAPSIBLE SECTIONS
   ======================================== */
.dictionary-section,
.papers-section {
  margin-bottom: 3rem;
}

.dictionary-section h2,
.papers-section h2 {
  font-size: 2rem;
  color: #0f0;
  text-align: center;
  margin-bottom: 1rem;
  text-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.collapsible-content.open {
  max-height: 1000px;
  transition: max-height 0.5s cubic-bezier(.4,2,.6,1);
}

.collapse-toggle {
  background: #111;
  color: #0ff;
  border: 1px solid #0ff;
  border-radius: 8px;
  padding: 0.4rem 1rem;
  margin: 0.5rem 0;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.collapse-toggle[aria-expanded="true"] {
  background: #0ff;
  color: #111;
}

.collapse-toggle:hover {
  background: #0ff;
  color: #111;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
}

/* ========================================
   CONTENT LISTS
   ======================================== */
.dictionary-section ul,
.papers-section ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.dictionary-section li,
.papers-section li {
  background: rgba(0, 255, 0, 0.05);
  border: 1px solid rgba(0, 255, 0, 0.2);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.5rem;
  transition: all 0.3s ease;
}

.dictionary-section li:hover,
.papers-section li:hover {
  background: rgba(0, 255, 0, 0.1);
  border-color: rgba(0, 255, 0, 0.4);
  transform: translateX(5px);
}

.dictionary-section strong {
  color: #0f0;
  font-weight: bold;
}

.papers-section a {
  color: #0ff;
  text-decoration: none;
  transition: color 0.3s ease;
}

.papers-section a:hover {
  color: #fff;
  text-decoration: underline;
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.9rem;
  color: #555;
  margin-top: 3rem;
  border-top: 1px solid #333;
}

.footer-links {
  margin-top: 1rem;
  font-size: 0.8rem;
}

.footer-links a {
  color: #0f0;
  text-decoration: none;
  margin: 0 0.5rem;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: #0ff;
  text-decoration: underline;
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablet and smaller desktop */
@media (max-width: 768px) {
  #main-content {
    padding: 1rem;
  }
  
  .hero-title {
    font-size: 2.5rem;
    margin-bottom: 0.3rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .topics-section h2,
  .dictionary-section h2,
  .papers-section h2 {
    font-size: 1.8rem;
  }
  
  .knowledge-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
  }
  
  .knowledge-card {
    margin: 0 0.5rem;
    border-radius: 12px;
  }
  
  .knowledge-card a {
    padding: 1.5rem;
  }
  
  .card-icon {
    font-size: 2.5rem;
    margin-bottom: 0.8rem;
  }
  
  .knowledge-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
  }
  
  .knowledge-card p {
    font-size: 0.9rem;
  }
  
  .card-badge {
    font-size: 0.6rem;
    padding: 0.15rem 0.4rem;
  }
}

/* Mobile phones */
@media (max-width: 480px) {
  #main-content {
    padding: 0.8rem;
  }
  
  .hero-title {
    font-size: 2rem;
    letter-spacing: 1px;
  }
  
  .hero-subtitle {
    font-size: 0.9rem;
  }
  
  .topics-section h2,
  .dictionary-section h2,
  .papers-section h2 {
    font-size: 1.5rem;
  }
  
  .knowledge-grid {
    gap: 1rem;
    margin-top: 1rem;
  }
  
  .knowledge-card {
    margin: 0 0.3rem;
    border-radius: 10px;
  }
  
  .knowledge-card a {
    padding: 1.2rem;
    min-height: 60px;
  }
  
  .card-icon {
    font-size: 2.2rem;
    margin-bottom: 0.6rem;
  }
  
  .knowledge-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.6rem;
    letter-spacing: 0.5px;
  }
  
  .knowledge-card p {
    font-size: 0.85rem;
    line-height: 1.4;
  }
  
  .card-badge {
    font-size: 0.5rem;
    padding: 0.1rem 0.3rem;
    top: 0.3rem;
    right: 0.3rem;
  }
  
  .footer {
    padding: 1.5rem 1rem;
    margin-top: 2rem;
  }
  
  .footer-links {
    font-size: 0.7rem;
  }
  
  .footer-links a {
    margin: 0 0.3rem;
  }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */
@media (hover: none) and (pointer: coarse) {
  .knowledge-card:hover {
    transform: none;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.1);
    border-color: #0f0;
  }
  
  .knowledge-card:active {
    transform: scale(0.98);
    box-shadow: 0 5px 15px rgba(0, 255, 0, 0.2);
    border-color: #0ff;
  }
  
  .knowledge-card::before {
    display: none;
  }
  
  .collapse-toggle:hover {
    transform: none;
    box-shadow: none;
  }
  
  .collapse-toggle:active {
    transform: scale(0.95);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
  }
}

/* ========================================
   SAFE AREA SUPPORT FOR IPHONE X+
   ======================================== */
@supports (padding: max(0px)) {
  #main-content {
    padding-left: max(2rem, env(safe-area-inset-left));
    padding-right: max(2rem, env(safe-area-inset-right));
  }
  
  .footer {
    padding-left: max(2rem, env(safe-area-inset-left));
    padding-right: max(2rem, env(safe-area-inset-right));
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
  }
}
