@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Inter:wght@400;500;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* --- 0. DESIGN TOKENS --- */
:root {
  /* Colors */
  --codex-red: #CC0000;
  --codex-red-bright: #FF0000;
  --codex-red-glow: rgba(204, 0, 0, 0.4);
  --bg-dark: #050505;
  --panel-bg: rgba(15, 15, 15, 0.85);
  --border-light: rgba(255, 255, 255, 0.08);
  
  /* Text */
  --text-primary: #FFFFFF;
  --text-secondary: #999999;
  
  /* Fonts */
  --font-pixel: 'Press Start 2P', cursive;
  --font-main: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Utilities */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- 1. BASE --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Custom cursor only for desktop/pointing devices */
@media (pointer: fine) {
  * {
    cursor: none;
  }
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

@media (max-width: 768px) {
  html {
    font-size: 14px;
  }
}

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-main);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Background Layers */
.bg-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: 
    radial-gradient(circle at 50% 50%, transparent 0%, rgba(0, 0, 0, 0.8) 100%),
    url('https://www.transparenttextures.com/patterns/carbon-fibre.png');
  opacity: 0.6;
}

.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  background: url('https://grainy-gradients.vercel.app/noise.svg');
  opacity: 0.05;
  pointer-events: none;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--codex-red);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--codex-red-bright);
}

/* --- 2. COMPONENTS --- */

/* Custom Cursor */
#cursor {
  display: none; /* Hidden by default */
  width: 20px;
  height: 20px;
  border: 2px solid var(--codex-red);
  position: fixed;
  pointer-events: none;
  z-index: 20000;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s, background 0.3s, border-color 0.3s;
}

@media (pointer: fine) {
  #cursor {
    display: flex;
  }
}

#cursor::after {
  content: '';
  width: 2px;
  height: 2px;
  background: var(--codex-red);
}

#cursor span {
  position: absolute;
  top: 35px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--codex-red);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s;
  font-weight: 700;
  letter-spacing: 1px;
}

#cursor.cursor-hover {
  width: 45px;
  height: 45px;
  background: var(--codex-red-glow);
  border-color: var(--codex-red-bright);
}

#cursor.cursor-close {
  width: 60px;
  height: 60px;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.5);
}

#cursor.cursor-close span {
  opacity: 1;
}

/* Glass Panels */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  padding: clamp(1.5rem, 5vw, 3rem);
  margin-bottom: clamp(2rem, 8vw, 4rem);
  position: relative;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.glass-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--codex-red);
  opacity: 0.5;
}

/* Module Cards */
.module-card {
  background: rgba(204, 0, 0, 0.9);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: 0.5s;
}

@media (hover: hover) {
  .module-card:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px var(--codex-red-glow);
    z-index: 10;
  }

  .module-card:hover::before {
    left: 100%;
  }
}

.module-title {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.module-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 6px;
  text-transform: uppercase;
}

.module-indicator {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  opacity: 0.4;
}

/* Buttons */
.btn-cta {
  background: var(--codex-red);
  color: white;
  border: none;
  padding: 1.2rem clamp(2rem, 10vw, 3.5rem);
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  letter-spacing: 2px;
  transition: var(--transition);
  box-shadow: 0 10px 20px rgba(204, 0, 0, 0.2);
  text-decoration: none;
  display: inline-block;
  width: auto;
  text-align: center;
}

@media (max-width: 480px) {
  .btn-cta {
    display: block;
    width: 100%;
  }
}

@media (hover: hover) {
  .btn-cta:hover {
    background: var(--codex-red-bright);
    box-shadow: 0 15px 30px var(--codex-red-glow);
    transform: translateY(-5px);
  }
}

/* --- 3. HERO & BRANDING --- */
.hero-container {
  text-align: center;
  padding: clamp(4rem, 15vh, 8rem) 0;
}

.hero-logo {
  width: clamp(180px, 40vw, 280px);
  height: auto;
  margin-bottom: 2.5rem;
  /* Multi-layered premium glow */
  filter: 
    drop-shadow(0 0 10px var(--codex-red-glow))
    drop-shadow(0 0 30px rgba(204, 0, 0, 0.2))
    drop-shadow(0 0 60px rgba(204, 0, 0, 0.1));
  animation: floatEffect 5s ease-in-out infinite;
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@media (hover: hover) {
  .hero-logo:hover {
    transform: scale(1.1) rotate(2deg);
    filter: 
      drop-shadow(0 0 20px var(--codex-red-glow))
      drop-shadow(0 0 40px rgba(204, 0, 0, 0.3))
      drop-shadow(0 0 80px rgba(204, 0, 0, 0.2));
  }
}

.hero-title {
  font-family: var(--font-pixel);
  font-size: clamp(1.5rem, 8vw, 3.5rem);
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: clamp(4px, 1vw, 8px);
  text-shadow: 0 0 30px var(--codex-red-glow);
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.hero-title span {
  color: var(--codex-red);
}

/* --- 4. GALLERY & MODAL --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1.5rem, 4vw, 2.5rem);
  margin: clamp(2rem, 8vw, 4rem) 0;
}

@media (max-width: 992px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
}

.preview-frame {
  border: 1px solid var(--border-light);
  background: var(--panel-bg);
  padding: clamp(10px, 3vw, 15px);
  transition: var(--transition);
  cursor: pointer;
}

@media (hover: hover) {
  .preview-frame:hover {
    border-color: var(--codex-red);
    transform: translateY(-10px);
  }
}

.preview-img {
  width: 100%;
  filter: grayscale(20%);
  transition: var(--transition);
  display: block;
}

@media (hover: hover) {
  .preview-frame:hover .preview-img {
    filter: grayscale(0%);
  }
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border: 1px solid var(--border-light);
  transform: scale(0.8);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-img {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: clamp(20px, 5vw, 40px);
  right: clamp(20px, 5vw, 40px);
  font-family: var(--font-pixel);
  color: white;
  cursor: pointer;
  font-size: clamp(1rem, 4vw, 1.5rem);
  z-index: 10001;
  background: rgba(0,0,0,0.5);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border-light);
}

/* --- 5. LAYOUT & UTILS --- */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 40px);
}

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(160px, 30vw, 220px), 1fr));
  gap: 1.5rem;
}

.accent-text {
  color: var(--codex-red);
}

.section-header {
  font-family: var(--font-pixel);
  font-size: clamp(1rem, 3vw, 1.2rem);
  margin-bottom: clamp(1.5rem, 5vw, 3rem);
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.section-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
  min-width: 50px;
}

/* --- 6. ANIMATIONS --- */
@keyframes floatEffect {
  0% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
  100% { transform: translateY(0); }
}

.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s ease-out;
}

.scroll-reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* --- 7. FOOTER --- */
footer {
  text-align: center;
  padding: clamp(4rem, 15vh, 8rem) 0;
  background: linear-gradient(to top, rgba(204, 0, 0, 0.05), transparent);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(1rem, 4vw, 2rem);
  margin-bottom: 2rem;
}

.footer-links a {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  text-decoration: none;
  transition: var(--transition);
  font-size: clamp(0.8rem, 2vw, 0.9rem);
  font-weight: 700;
  white-space: nowrap;
}

@media (hover: hover) {
  .footer-links a:hover {
    color: var(--codex-red);
    letter-spacing: 2px;
  }
}

.footer-disclaimer {
  margin-top: 1rem;
  font-family: var(--font-mono);
  opacity: 0.4;
  font-size: 0.75rem;
  letter-spacing: 1px;
  padding: 0 20px;
}
