/* ============================================
   FRONTIER LABS — Global Styles
   ============================================ */

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

:root {
  /* Core palette */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a2e;
  --text-primary: #e8e8f0;
  --text-secondary: #8888a0;
  --text-muted: #555570;

  /* Accent colors */
  --accent-cyan: #00f0ff;
  --accent-magenta: #ff00aa;
  --accent-green: #00ff88;
  --accent-purple: #8844ff;
  --accent-orange: #ff6622;

  /* Gradients */
  --gradient-hero: linear-gradient(135deg, #00f0ff 0%, #8844ff 50%, #ff00aa 100%);
  --gradient-card: linear-gradient(135deg, rgba(0,240,255,0.1) 0%, rgba(136,68,255,0.1) 100%);
  --gradient-border: linear-gradient(135deg, #00f0ff, #8844ff, #ff00aa);

  /* Glow */
  --glow-cyan: 0 0 30px rgba(0,240,255,0.3);
  --glow-magenta: 0 0 30px rgba(255,0,170,0.3);
  --glow-purple: 0 0 30px rgba(136,68,255,0.3);

  /* Typography */
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Spacing */
  --section-padding: clamp(4rem, 10vh, 8rem) clamp(1.5rem, 5vw, 6rem);

  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-smooth: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-bounce: 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ============================================
   Reset & Base
   ============================================ */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-cyan) var(--bg-primary);
}

html::-webkit-scrollbar {
  width: 6px;
}

html::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

html::-webkit-scrollbar-thumb {
  background: var(--accent-cyan);
  border-radius: 3px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

/* ============================================
   Custom Cursor
   ============================================ */

.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 99999;
  mix-blend-mode: difference;
}

.cursor-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-cyan);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.15s, height 0.15s, background 0.15s;
}

.cursor-ring {
  width: 40px;
  height: 40px;
  border: 1.5px solid var(--accent-cyan);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease, border-color 0.3s ease;
  opacity: 0.5;
}

.cursor-hover .cursor-dot {
  width: 16px;
  height: 16px;
  background: var(--accent-magenta);
}

.cursor-hover .cursor-ring {
  width: 60px;
  height: 60px;
  border-color: var(--accent-magenta);
}

/* ============================================
   Section Shared Styles
   ============================================ */

.section {
  padding: var(--section-padding);
  position: relative;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent-cyan);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-label::before {
  content: '//';
  color: var(--text-muted);
}

.section-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  background: var(--gradient-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.7;
}

/* ============================================
   Scroll Animations
   ============================================ */

.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-60px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(60px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-scale.visible {
  opacity: 1;
  transform: scale(1);
}

/* Staggered children */
.stagger-children > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.stagger-children.visible > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-children.visible > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-children.visible > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-children.visible > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-children.visible > *:nth-child(5) { transition-delay: 0.5s; }

.stagger-children.visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   Glitch text effect
   ============================================ */

.glitch {
  position: relative;
  display: inline-block;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  -webkit-background-clip: text;
  background-clip: text;
}

.glitch::before {
  animation: glitch-1 2s infinite linear alternate-reverse;
  clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
  -webkit-text-fill-color: var(--accent-cyan);
}

.glitch::after {
  animation: glitch-2 2s infinite linear alternate-reverse;
  clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
  -webkit-text-fill-color: var(--accent-magenta);
}

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

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

/* ============================================
   Gradient border cards
   ============================================ */

.gradient-border {
  position: relative;
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: 12px;
  background: var(--gradient-border);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ============================================
   Noise overlay
   ============================================ */

.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ============================================
   Syntax highlight colors (floating snippets)
   ============================================ */

.hl-keyword { color: #ff00aa; }
.hl-func { color: #00f0ff; }
.hl-param { color: #ff6622; }
.hl-prop { color: #00ff88; }
.hl-comment { color: #555570; font-style: italic; }

/* ============================================
   Scroll Progress Bar
   ============================================ */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--gradient-hero);
  z-index: 10001;
  transition: width 0.05s linear;
  box-shadow: 0 0 10px rgba(0,240,255,0.5);
}

/* ============================================
   Mouse Spotlight
   ============================================ */

.spotlight {
  position: fixed;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,240,255,0.04) 0%, rgba(136,68,255,0.02) 30%, transparent 70%);
  pointer-events: none;
  z-index: 1;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  mix-blend-mode: screen;
}

/* ============================================
   Konami Code Easter Egg
   ============================================ */

.konami-overlay {
  position: fixed;
  inset: 0;
  z-index: 100001;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.konami-overlay.active {
  opacity: 1;
  visibility: visible;
}

.konami-terminal {
  font-family: var(--font-mono);
  color: var(--accent-green);
  font-size: 1.2rem;
  text-align: center;
  line-height: 2;
  animation: konamiFlicker 0.15s 3;
}

.konami-dismiss {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 2rem;
  animation: blink 1.5s infinite;
}

@keyframes konamiFlicker {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Konami glitch effect on body */
.konami-glitch {
  animation: konamiPageGlitch 0.1s 10;
}

@keyframes konamiPageGlitch {
  0% { filter: hue-rotate(0deg); }
  25% { filter: hue-rotate(90deg) saturate(2); transform: translate(2px, -1px); }
  50% { filter: hue-rotate(180deg); transform: translate(-2px, 1px); }
  75% { filter: hue-rotate(270deg) saturate(3); transform: translate(1px, 2px); }
  100% { filter: hue-rotate(360deg); transform: translate(0); }
}

/* ============================================
   Text Scramble
   ============================================ */

.scramble-text {
  font-family: var(--font-mono);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
  .cursor-dot, .cursor-ring {
    display: none;
  }

  .spotlight {
    display: none;
  }
}

/* ============================================
   Loading screen
   ============================================ */

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-terminal {
  width: min(500px, 90vw);
  color: var(--accent-green);
  font-size: 0.8rem;
  line-height: 1.8;
}

.loading-terminal .line {
  opacity: 0;
  animation: terminalFade 0.1s forwards;
}

.loading-terminal .line.ok {
  color: var(--accent-cyan);
}

.loading-terminal .line.warn {
  color: var(--accent-orange);
}

.loading-terminal .line.success {
  color: var(--accent-green);
  font-weight: 700;
}

@keyframes terminalFade {
  to { opacity: 1; }
}

.loading-bar {
  width: min(500px, 90vw);
  height: 2px;
  background: var(--bg-tertiary);
  margin-top: 1.5rem;
  border-radius: 1px;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--gradient-hero);
  border-radius: 1px;
  transition: width 0.3s ease;
}
