/* ============================================
   TRIARK - Design System Tokens
   Based on Tek-Chronicle Prime design system
   ============================================ */

/* --- Colors --- */
:root {
  --color-background: #121317;
  --color-surface: #121317;
  --color-surface-dim: #121317;
  --color-surface-bright: #37393d;
  --color-surface-container-lowest: #0c0e11;
  --color-surface-container-low: #1a1c1f;
  --color-surface-container: #1e2023;
  --color-surface-container-high: #282a2d;
  --color-surface-container-highest: #333538;
  --color-surface-variant: #333538;

  --color-on-surface: #e2e2e6;
  --color-on-surface-variant: #bac9cc;
  --color-inverse-surface: #e2e2e6;
  --color-inverse-on-surface: #2f3034;

  --color-primary: #c3f5ff;
  --color-primary-container: #00e5ff;
  --color-on-primary: #00363d;
  --color-on-primary-container: #00626e;
  --color-primary-fixed: #9cf0ff;
  --color-primary-fixed-dim: #00daf3;
  --color-on-primary-fixed: #001f24;
  --color-on-primary-fixed-variant: #004f58;
  --color-inverse-primary: #006875;
  --color-surface-tint: #00daf3;

  --color-secondary: #bcc8d4;
  --color-on-secondary: #26323b;
  --color-secondary-container: #3f4a55;
  --color-on-secondary-container: #aebac6;
  --color-secondary-fixed: #d8e4f0;
  --color-secondary-fixed-dim: #bcc8d4;
  --color-on-secondary-fixed: #111d26;
  --color-on-secondary-fixed-variant: #3d4852;

  --color-tertiary: #e9ecff;
  --color-on-tertiary: #002c70;
  --color-tertiary-container: #c0d0ff;
  --color-on-tertiary-container: #1c54b8;
  --color-tertiary-fixed: #dae2ff;
  --color-tertiary-fixed-dim: #b1c5ff;
  --color-on-tertiary-fixed: #001946;
  --color-on-tertiary-fixed-variant: #00419e;

  --color-error: #ffb4ab;
  --color-on-error: #690005;
  --color-error-container: #93000a;
  --color-on-error-container: #ffdad6;

  --color-outline: #849396;
  --color-outline-variant: #3b494c;

  --color-energy-online: #00e676;
  --color-energy-warning: #ff9100;
  --color-energy-danger: #ff1744;

  --glow-primary: 0 0 12px rgba(0, 229, 255, 0.4);
  --glow-primary-strong: 0 0 24px rgba(0, 229, 255, 0.6), 0 0 48px rgba(0, 229, 255, 0.2);
  --glow-card: 0 0 1px rgba(168, 180, 192, 0.3);
}

/* --- Typography --- */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --font-headline: 'Orbitron', sans-serif;
  --font-body: 'JetBrains Mono', monospace;

  --text-headline-xl-size: clamp(2.5rem, 5vw, 4rem);
  --text-headline-xl-line: 1.125;
  --text-headline-xl-weight: 800;
  --text-headline-xl-tracking: -0.04em;

  --text-headline-lg-size: clamp(2rem, 4vw, 2.5rem);
  --text-headline-lg-line: 1.2;
  --text-headline-lg-weight: 700;
  --text-headline-lg-tracking: -0.02em;

  --text-headline-md-size: clamp(1.25rem, 2.5vw, 1.5rem);
  --text-headline-md-line: 1.33;
  --text-headline-md-weight: 600;

  --text-body-lg-size: 1.125rem;
  --text-body-lg-line: 1.55;
  --text-body-lg-weight: 400;

  --text-body-md-size: 1rem;
  --text-body-md-line: 1.5;
  --text-body-md-weight: 400;

  --text-label-size: 0.75rem;
  --text-label-line: 1.33;
  --text-label-weight: 700;
  --text-label-tracking: 0.15em;
}

:root {
  --space-unit: 4px;
  --space-gutter: 24px;
  --space-margin-desktop: 64px;
  --space-margin-mobile: 16px;
  --container-max: 1440px;
}

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

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

body {
  font-family: var(--font-body);
  font-size: var(--text-body-md-size);
  line-height: var(--text-body-md-line);
  font-weight: var(--text-body-md-weight);
  color: var(--color-on-surface);
  background-color: var(--color-background);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  list-style: none;
}

/* ============================================
   Accessibility & Focus
   ============================================ */
*:focus-visible {
  outline: 2px solid var(--color-primary-container);
  outline-offset: 2px;
}

/* Interactive cursor */
.btn-primary, .btn-secondary, .store-tab, .product-card__buy,
.realm-card__link, .server-card__connect, .nav__link, .nav__toggle,
.hero__scroll-icon, .carousel__btn, .carousel__dot {
  cursor: pointer;
}

/* Reduced motion */
@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;
  }

  .animate-on-scroll {
    opacity: 1;
    transform: none;
  }
}

/* ============================================
   Utility Classes
   ============================================ */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-margin-desktop);
}

@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-margin-mobile);
  }
}

/* Corner bracket accent */
.corner-brackets {
  position: relative;
}

.corner-brackets::before,
.corner-brackets::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--color-primary-container);
  border-style: solid;
}

.corner-brackets::before {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
}

.corner-brackets::after {
  bottom: -1px;
  right: -1px;
  border-width: 0 2px 2px 0;
}

/* Tek glow button */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  font-family: var(--font-headline);
  font-size: var(--text-label-size);
  font-weight: var(--text-label-weight);
  letter-spacing: var(--text-label-tracking);
  text-transform: uppercase;
  color: var(--color-primary);
  background: transparent;
  border: 1px solid var(--color-primary-container);
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--color-primary-container), var(--color-on-primary));
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 0;
}

.btn-primary > * {
  position: relative;
  z-index: 1;
}

.btn-primary:hover {
  color: var(--color-on-primary);
  box-shadow: var(--glow-primary);
  border-color: var(--color-primary);
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary:active {
  transform: scale(0.98);
}

/* Secondary button */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  font-family: var(--font-headline);
  font-size: var(--text-label-size);
  font-weight: var(--text-label-weight);
  letter-spacing: var(--text-label-tracking);
  text-transform: uppercase;
  color: var(--color-secondary);
  background: transparent;
  border: 1px solid var(--color-outline-variant);
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-secondary:hover {
  border-color: var(--color-secondary);
  color: var(--color-secondary-fixed);
}

/* Section styling */
.section {
  padding: 96px 0;
  position: relative;
}

@media (max-width: 768px) {
  .section {
    padding: 64px 0;
  }
}

/* Section gradient divider */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-outline-variant), var(--color-primary-container), var(--color-outline-variant), transparent);
  opacity: 0.4;
}

.section-label {
  font-family: var(--font-headline);
  font-size: var(--text-label-size);
  font-weight: var(--text-label-weight);
  letter-spacing: var(--text-label-tracking);
  text-transform: uppercase;
  color: var(--color-primary-container);
  margin-bottom: 12px;
}

.section-title {
  font-family: var(--font-headline);
  font-size: var(--text-headline-lg-size);
  font-weight: var(--text-headline-lg-weight);
  line-height: var(--text-headline-lg-line);
  letter-spacing: var(--text-headline-lg-tracking);
  color: var(--color-on-surface);
  margin-bottom: 16px;
}

.section-subtitle {
  font-family: var(--font-body);
  font-size: var(--text-body-lg-size);
  line-height: var(--text-body-lg-line);
  color: var(--color-on-surface-variant);
  max-width: 640px;
}

/* Scanline overlay effect */
.scanlines::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 229, 255, 0.015) 2px,
    rgba(0, 229, 255, 0.015) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* Hexagon pattern overlay */
.hex-pattern::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%2300e5ff' fill-opacity='1'%3E%3Cpath d='M13.99 9c-5.523 0-10 4.477-10 10s4.477 10 10 10 10-4.477 10-10-4.477-10-10-10zm0 18c-4.418 0-8-3.582-8-8s3.582-8 8-8 8 3.582 8 8-3.582 8-8 8zm0-14c-3.314 0-6 2.686-6 6s2.686 6 6 6 6-2.686 6-6-2.686-6-6-6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ============================================
   Animations
   ============================================ */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
  51% { opacity: 1; }
  55% { opacity: 0.9; }
  56% { opacity: 1; }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: var(--glow-primary); }
  50% { box-shadow: var(--glow-primary-strong); }
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes glitch {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-2px, 1px); }
  40% { transform: translate(2px, -1px); }
  60% { transform: translate(-1px, -1px); }
  80% { transform: translate(1px, 1px); }
}

@keyframes glitch-color {
  0%, 100% { text-shadow: 0 0 30px rgba(0, 229, 255, 0.3); }
  25% { text-shadow: -2px 0 #ff0040, 2px 0 #00e5ff; }
  50% { text-shadow: 2px 0 #ff0040, -2px 0 #00e5ff; }
  75% { text-shadow: -1px 0 #ff0040, 1px 0 #00e5ff; }
}

@keyframes radar-ping {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

@keyframes float {
  0%, 100% { transform: translateY(0) translateX(0); }
  25% { transform: translateY(-10px) translateX(5px); }
  50% { transform: translateY(-5px) translateX(-5px); }
  75% { transform: translateY(-15px) translateX(2px); }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes slide-in-left {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scroll animation base */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays */
.animate-delay-1 { transition-delay: 0.1s; }
.animate-delay-2 { transition-delay: 0.2s; }
.animate-delay-3 { transition-delay: 0.3s; }
.animate-delay-4 { transition-delay: 0.4s; }
.animate-delay-5 { transition-delay: 0.5s; }
.animate-delay-6 { transition-delay: 0.6s; }
.animate-delay-7 { transition-delay: 0.7s; }
.animate-delay-8 { transition-delay: 0.8s; }
.animate-delay-9 { transition-delay: 0.9s; }
