/* ===========================
   TechNodeX Redesigned Brand System
   Based on comprehensive redesign plan
   Dark theme with glowing accents
   =========================== */

/* === CSS Custom Properties (Design Tokens) === */
:root {
  /* Primary Colors */
  --bg-primary: #0F1419;
  --bg-secondary: #1A1F2E;
  --bg-tertiary: #121316;
  
  /* Surface Colors */
  --surface: #1A1F2E;
  --surface-elevated: #232836;
  --surface-hover: #2A3142;
  
  /* Border Colors */
  --border: #2D3748;
  --border-hover: #3D4758;
  --border-accent: #DC2626;
  
  /* Text Colors */
  --text-primary: #FFFFFF;
  --text-secondary: #B0B8C6;
  --text-muted: #7D8590;
  
  /* Accent Colors */
  --accent: #DC2626;
  --accent-hover: #FF1744;
  --accent-light: rgba(220, 38, 38, 0.1);
  --accent-glow: rgba(220, 38, 38, 0.4);
  --accent-glow-strong: rgba(220, 38, 38, 0.8);
  
  /* Status Colors */
  --success: #10B981;
  --success-light: rgba(16, 185, 129, 0.1);
  --info: #3B82F6;
  --info-light: rgba(59, 130, 246, 0.1);
  --warning: #F59E0B;
  --warning-light: rgba(245, 158, 11, 0.1);
  --error: #EF4444;
  
  /* Focus & Interaction */
  --focus-ring: #F59E0B;
  --focus-ring-offset: 2px;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px var(--accent-glow);
  --shadow-glow-strong: 0 0 30px var(--accent-glow-strong), 0 0 60px var(--accent-glow);
  
  /* Spacing Scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-2xl: 24px;
  --radius-full: 9999px;
  
  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  
  /* Font Sizes */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 30px;
  --text-4xl: 36px;
  --text-5xl: 48px;
  --text-6xl: 60px;
  
  /* Line Heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;
  
  /* Container */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1200px;
  --container-max: 1400px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;
  --transition-bounce: 350ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* === Base Reset === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent);
}

/* === Links === */
.link {
  color: var(--accent);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* === Utilities === */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wrap {
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-xl);
}

.wrap-wide {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-xl);
}

.text-gradient {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

/* === Navigation Bar === */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(15, 20, 25, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.navbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-md);
  padding-bottom: var(--space-md);
}

.navbar .brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 800;
  font-size: var(--text-xl);
  color: var(--text-primary);
  text-decoration: none;
  transition: all var(--transition-normal);
}

.navbar .brand:hover {
  color: var(--accent);
}

.navbar .brand img {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
}

.navbar nav ul {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  list-style: none;
}

.navlink {
  display: inline-flex;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-normal);
}

.navlink:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.navlink[aria-current="page"] {
  color: var(--text-primary);
  background: var(--surface);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  min-height: 44px;
  border: none;
  border-radius: var(--radius-lg);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-bounce);
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 0 20px rgba(220, 38, 38, 0);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-glow-strong);
  transform: translateY(-2px);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: var(--shadow-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--text-base);
  min-height: 52px;
}

/* === Focus States === */
.btn:focus-visible,
.navlink:focus-visible,
.card:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}

/* === Cards === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-lg);
  transition: all var(--transition-bounce);
}

.card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 25px rgba(220, 38, 38, 0.3), inset 0 0 25px rgba(220, 38, 38, 0.05);
  transform: translateY(-4px);
}

.card-elevated {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  box-shadow: var(--shadow-lg);
}

/* === Hero Section === */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl) var(--space-xl);
  padding-top: calc(var(--space-3xl) + 80px); /* Account for navbar */
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 50%, rgba(220, 38, 38, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(220, 38, 38, 0.05) 0%, transparent 50%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 900px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(var(--text-4xl), 8vw, var(--text-6xl));
  margin-bottom: var(--space-lg);
  animation: fadeInUp 0.8s ease-out;
}

.hero p {
  font-size: clamp(var(--text-lg), 2.5vw, var(--text-xl));
  max-width: 600px;
  margin: 0 auto var(--space-xl);
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  justify-content: center;
  animation: fadeInUp 0.8s ease-out 0.4s both;
}

/* Floating code snippets background */
.code-float {
  position: absolute;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--accent);
  opacity: 0.15;
  pointer-events: none;
  white-space: nowrap;
}

.code-float-1 {
  top: 15%;
  left: 5%;
  animation: float 6s ease-in-out infinite;
}

.code-float-2 {
  top: 25%;
  right: 8%;
  animation: float 8s ease-in-out infinite 1s;
}

.code-float-3 {
  bottom: 20%;
  left: 10%;
  animation: float 7s ease-in-out infinite 2s;
}

.code-float-4 {
  bottom: 30%;
  right: 5%;
  animation: float 5s ease-in-out infinite 0.5s;
}

/* === Stats Section === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
  margin: var(--space-2xl) 0;
}

.stat-card {
  text-align: center;
  padding: var(--space-xl);
}

.stat-number {
  font-size: var(--text-4xl);
  font-weight: 800;
  color: var(--accent);
  margin-bottom: var(--space-xs);
}

.stat-label {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

/* === Feature Cards === */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
  margin: var(--space-2xl) 0;
}

.feature-card {
  padding: var(--space-xl);
}

.feature-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-light);
  border-radius: var(--radius-lg);
  font-size: var(--text-2xl);
  margin-bottom: var(--space-md);
}

.feature-card h3 {
  margin-bottom: var(--space-sm);
}

.feature-card p {
  font-size: var(--text-sm);
}

/* === Section Headers === */
.section-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.section-header h2 {
  margin-bottom: var(--space-sm);
}

.section-header p {
  max-width: 600px;
  margin: 0 auto;
}

/* === Learning Path Cards === */
.path-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-xl);
}

.path-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.path-icon {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-elevated);
  border-radius: var(--radius-lg);
  font-size: var(--text-2xl);
}

.path-meta {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-top: var(--space-sm);
}

.path-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: var(--surface-elevated);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

/* === Downloads Grid === */
.downloads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-lg);
}

.app-card {
  display: flex;
  flex-direction: column;
}

.app-thumb {
  aspect-ratio: 16/10;
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-md);
}

.app-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.app-card:hover .app-thumb img {
  transform: scale(1.05);
}

.app-title {
  font-weight: 700;
  font-size: var(--text-base);
  margin-bottom: var(--space-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-meta {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-md);
}

.app-actions {
  margin-top: auto;
  display: flex;
  gap: var(--space-sm);
}

/* === Search & Filters === */
.search-bar {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-xl);
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: var(--space-sm) var(--space-md);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--text-base);
  transition: all var(--transition-normal);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.select-input {
  padding: var(--space-sm) var(--space-md);
  padding-right: var(--space-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--text-base);
  cursor: pointer;
  transition: all var(--transition-normal);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23B0B8C6' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.select-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* === Footer === */
.footer {
  border-top: 1px solid var(--border);
  padding: var(--space-2xl) var(--space-xl);
  margin-top: var(--space-3xl);
  background: var(--bg-secondary);
}

.footer-content {
  max-width: var(--container-xl);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-xl);
}

.footer-section h4 {
  margin-bottom: var(--space-md);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.footer-section ul {
  list-style: none;
}

.footer-section li {
  margin-bottom: var(--space-sm);
}

.footer-section a {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.footer-section a:hover {
  color: var(--accent);
}

.footer-bottom {
  max-width: var(--container-xl);
  margin: var(--space-xl) auto 0;
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* === Page Header === */
.page-header {
  padding-top: calc(var(--space-3xl) + 80px);
  padding-bottom: var(--space-xl);
  text-align: center;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.page-header h1 {
  margin-bottom: var(--space-sm);
}

.page-header p {
  max-width: 600px;
  margin: 0 auto;
}

/* === Empty States === */
.empty-state {
  text-align: center;
  padding: var(--space-3xl);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: var(--text-5xl);
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

/* === Code/KBD Elements === */
.kbd, code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-primary);
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* === Scroll Indicator === */
.scroll-indicator {
  position: absolute;
  bottom: var(--space-xl);
  left: 50%;
  transform: translateX(-50%);
  animation: bounce 2s infinite;
}

.scroll-indicator svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

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

@keyframes float {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.15;
  }
  50% {
    transform: translateY(-20px);
    opacity: 0.25;
  }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  40% {
    transform: translateX(-50%) translateY(-10px);
  }
  60% {
    transform: translateX(-50%) translateY(-5px);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px var(--accent-glow);
  }
  50% {
    box-shadow: 0 0 40px var(--accent-glow-strong);
  }
}

/* === Responsive Design === */
/* Tablet and down */
@media (max-width: 768px) {
  :root {
    --text-5xl: 36px;
    --text-6xl: 42px;
  }

  .wrap {
    padding: var(--space-md);
  }

  /* Navbar: allow wrapping and reduce density */
  .navbar .wrap {
    padding: var(--space-sm) var(--space-md);
    gap: var(--space-sm);
    flex-wrap: wrap;
  }

  .navbar nav ul {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-xs);
  }

  .navlink {
    padding: var(--space-xs) var(--space-sm);
  }

  .navbar .brand span {
    display: none;
  }

  /* Hero: reduce side padding */
  .hero {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
    padding-top: calc(var(--space-2xl) + 80px);
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

/* Small phones */
@media (max-width: 480px) {
  /* Tighten overall spacing */
  .wrap {
    padding: var(--space-sm);
  }

  /* Navbar: center and prevent overflow */
  .navbar .wrap {
    justify-content: center;
  }

  .navbar nav ul {
    justify-content: center;
  }

  .navlink {
    font-size: var(--text-sm);
    padding: 8px 10px; /* explicit for touch while compact */
  }

  /* Hide decorative floating code to reduce clutter */
  .code-float {
    display: none;
  }

  /* Headings and paragraphs: avoid cramped line length */
  .hero h1 {
    line-height: 1.1;
  }

  /* Grids: single column */
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .downloads-grid {
    grid-template-columns: 1fr;
  }

  .search-bar {
    flex-direction: column;
  }

  .search-input,
  .select-input {
    width: 100%;
  }

  /* Avoid truncating titles on narrow screens */
  .app-title {
    white-space: normal;
  }
}

/* Global responsive media */
img,
video,
iframe {
  max-width: 100%;
  height: auto;
}


@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}

/* === Print Styles === */
@media print {
  .navbar,
  .hero::before,
  .code-float,
  .scroll-indicator {
    display: none;
  }
  
  body {
    background: white;
    color: black;
  }
  
  .card {
    border: 1px solid #ccc;
    box-shadow: none;
  }
}
