/* ==========================================================================
   THE GENUINE MATRIX: Minimalist Modern Design System
   ========================================================================== */

/* Variables & Custom Properties */
:root {
  --bg-color: #080808;
  --text-main: #f5f5f7;
  --text-muted: #86868b;
  --accent-green: #00ff66;
  --accent-red: #ff2a5f;
  --accent-blue: #00a2ff;
  --accent-glow-red: rgba(255, 42, 95, 0.2);
  --accent-glow-blue: rgba(0, 162, 255, 0.2);
  --glass-bg: rgba(20, 20, 22, 0.6);
  --glass-border: rgba(255, 255, 255, 0.08);
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Fira Code', monospace;
  --cursor-size: 20px;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Custom Cursor (Hide on Touch Devices, Only active when GSAP is initialized) */
@media (hover: hover) and (pointer: fine) {
  body.gsap-active,
  body.gsap-active * {
    cursor: none !important;
  }
  
  .custom-cursor,
  .custom-cursor-follower {
    display: none;
    pointer-events: none !important;
  }

  body.gsap-active .custom-cursor,
  body.gsap-active .custom-cursor-follower {
    display: block;
  }
  
  .custom-cursor {
    width: var(--cursor-size);
    height: var(--cursor-size);
    background-color: var(--text-main);
    border-radius: 50%;
    position: fixed;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%);
    z-index: 9999;
    mix-blend-mode: difference;
    transition: width 0.2s ease, height 0.2s ease, background-color 0.2s ease;
  }

  .custom-cursor-follower {
    width: calc(var(--cursor-size) * 2);
    height: calc(var(--cursor-size) * 2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    position: fixed;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%);
    z-index: 9998;
    transition: transform 0.08s cubic-bezier(0.25, 1, 0.5, 1);
  }

  /* Hover States */
  body.hovering-red .custom-cursor {
    background-color: var(--accent-red);
    width: 30px;
    height: 30px;
    mix-blend-mode: normal;
  }
  body.hovering-red .custom-cursor-follower {
    border-color: var(--accent-red);
    transform: translate(-50%, -50%) scale(1.5);
  }

  body.hovering-blue .custom-cursor {
    background-color: var(--accent-blue);
    width: 30px;
    height: 30px;
    mix-blend-mode: normal;
  }
  body.hovering-blue .custom-cursor-follower {
    border-color: var(--accent-blue);
    transform: translate(-50%, -50%) scale(1.5);
  }
}

/* Canvas Backdrop */
#matrix-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  opacity: 0.45; /* Stand out more in background */
  pointer-events: none; /* Never block user clicks */
  transition: opacity 1.5s ease;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, transparent 30%, rgba(8, 8, 8, 0.9) 100%);
  z-index: 2;
  pointer-events: none;
}

/* Layout Framework */
#app {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1200px;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

/* Screens Setup */
.screen {
  position: absolute;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(20px) scale(0.98);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.8s;
  width: 100%;
  max-width: 800px;
  display: flex;
  justify-content: center;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* ==========================================================================
   STATE 1: THE CROSSROADS (Pill Selection Layout)
   ========================================================================== */
.choice-container {
  text-align: center;
  max-width: 600px;
}

.title-sub {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 4px;
  color: var(--text-muted);
  margin-bottom: 16px;
  opacity: 0.8;
}

.title-sub .highlight {
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: 3px;
  animation: namePulse 3s infinite ease-in-out;
}

.title-main {
  font-size: 48px;
  font-weight: 300;
  letter-spacing: -1px;
  margin-bottom: 12px;
  color: var(--text-main);
}

.choice-desc {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 48px;
  font-weight: 300;
}

/* Pills & Interactive Wrapping */
.pill-wrapper {
  display: flex;
  justify-content: center;
  gap: 32px;
}

.magnetic-wrap {
  display: inline-block;
  position: relative;
}

.pill-btn {
  background: transparent;
  border: none;
  padding: 0;
  outline: none;
  position: relative;
  overflow: hidden;
  border-radius: 40px;
  width: 180px;
  height: 56px;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  transition: border-color 0.4s ease, transform 0.2s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

.pill-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.pill-text {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-main);
  z-index: 10;
  transition: color 0.4s ease;
}

/* Liquid Hover Animation */
.pill-liquid {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
}

.pill-liquid.red {
  background: var(--accent-red);
  box-shadow: 0 0 20px var(--accent-glow-red);
}

.pill-liquid.blue {
  background: var(--accent-blue);
  box-shadow: 0 0 20px var(--accent-glow-blue);
}

/* Hover Mechanics */
.pill-btn:hover {
  border-color: transparent;
}

.pill-btn:hover .pill-liquid {
  transform: translateY(-100%);
}

.pill-btn:hover .pill-text {
  color: #000;
}

/* ==========================================================================
   SHARED GLASS CARD STYLING
   ========================================================================== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.8s ease;
}

.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--accent-blue);
}

.reset-btn {
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.2s, background-color 0.2s;
}

.reset-btn:hover {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.05);
}

.card-body {
  padding: 32px 40px;
}

.divider {
  border: 0;
  height: 1px;
  background: var(--glass-border);
  margin: 24px 0;
}

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
}

.status-msg {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   STATE 2: THE BLUE PILL REALITY (Elegant Profile)
   ========================================================================== */
.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
}

.avatar-glow {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 20px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-glow::after {
  content: 'K';
  font-size: 28px;
  font-weight: 600;
  color: var(--text-main);
}

.avatar-glow.blue {
  box-shadow: 0 0 30px var(--accent-glow-blue);
  border-color: var(--accent-blue);
}

.profile-name {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #ffffff 40%, var(--accent-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: profileNamePulse 4s infinite ease-in-out;
  margin-bottom: 4px;
  display: inline-block;
}

.profile-title {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 300;
}

.bio-section {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-main);
  font-weight: 300;
  margin-bottom: 32px;
  text-align: center;
}

.grid-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.detail-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 16px;
}

.detail-box h3 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.detail-box p {
  font-size: 14px;
  color: var(--text-main);
  font-weight: 400;
}

/* ==========================================================================
   STATE 3: THE RED PILL REALITY (IDE Console Card)
   ========================================================================== */
.console-card {
  max-width: 760px;
  font-family: var(--font-mono);
}

.console-header {
  border-bottom: 1px solid var(--glass-border);
}

.window-controls {
  display: flex;
  gap: 8px;
}

.window-controls .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.dot.close { background-color: #ff5f56; }
.dot.minimize { background-color: #ffbd2e; }
.dot.maximize { background-color: #27c93f; }

.console-title {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.console-body {
  display: flex;
  min-height: 320px;
  background: rgba(0, 0, 0, 0.15);
}

/* Sidebar styling */
.console-sidebar {
  width: 180px;
  border-right: 1px solid var(--glass-border);
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tab-btn {
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 12px;
  text-align: left;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s, background-color 0.2s;
}

.tab-btn:hover {
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

.tab-btn.active {
  background-color: rgba(0, 255, 102, 0.05);
  color: var(--accent-green);
}

/* Content Area styling */
.console-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Code Editor text highlighting */
.code-editor {
  line-height: 1.7;
  font-size: 13px;
  color: #abb2bf;
}

.code-line {
  display: flex;
  gap: 16px;
}

.line-num {
  width: 24px;
  text-align: right;
  color: rgba(255, 255, 255, 0.15);
  user-select: none;
}

.code-key { color: #c678dd; }
.code-var { color: #e06c75; }
.code-string { color: #98c379; }
.code-highlight-name {
  font-weight: 600;
  text-shadow: 0 0 8px rgba(152, 195, 121, 0.5);
}
.code-val { color: #d19a66; }
.code-comment { color: #5c6370; font-style: italic; }

.green-glow {
  color: var(--accent-green);
  text-shadow: 0 0 8px rgba(0, 255, 102, 0.3);
}

.terminal-reset:hover {
  color: var(--accent-green);
}

/* Interactive Terminal Styles */
.terminal-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 250px;
  font-family: var(--font-mono);
  color: var(--accent-green);
  font-size: 13px;
  text-align: left;
}

.terminal-history {
  flex: 1;
  overflow-y: auto;
  max-height: 230px;
  padding-right: 8px;
  margin-bottom: 12px;
}

.terminal-history::-webkit-scrollbar {
  width: 4px;
}

.terminal-history::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 102, 0.15);
  border-radius: 2px;
}

.terminal-line {
  line-height: 1.6;
  margin-bottom: 6px;
  white-space: pre-wrap;
}

.terminal-prompt {
  color: #fff;
  margin-right: 8px;
  font-weight: 500;
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.1);
}

.terminal-input-line {
  display: flex;
  align-items: center;
  border-top: 1px solid rgba(0, 255, 102, 0.08);
  padding-top: 12px;
}

.terminal-input-line input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--accent-green);
  font-family: var(--font-mono);
  font-size: 13px;
  caret-color: var(--accent-green);
  text-shadow: 0 0 5px rgba(0, 255, 102, 0.2);
}

/* ==========================================================================
   RESPONSIVE DESIGN RULES
   ========================================================================== */
@media (max-width: 768px) {
  .title-main {
    font-size: 36px;
  }
  
  .pill-wrapper {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }

  .grid-details {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .console-body {
    flex-direction: column;
  }

  .console-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
  }

  .tab-btn {
    white-space: nowrap;
  }

  .card-body {
    padding: 24px;
  }
}

/* ==========================================================================
   Highlight Glow Keyframes (Premium Pulse Effect)
   ========================================================================== */
@keyframes namePulse {
  0% {
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
  }
  50% {
    text-shadow: 0 0 25px rgba(255, 255, 255, 0.65);
  }
  100% {
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
  }
}

@keyframes profileNamePulse {
  0% {
    text-shadow: 0 0 15px rgba(0, 162, 255, 0.2);
  }
  50% {
    text-shadow: 0 0 35px rgba(0, 162, 255, 0.7);
  }
  100% {
    text-shadow: 0 0 15px rgba(0, 162, 255, 0.2);
  }
}
