/* ============================================================
   Byte Stack Solutions, base.css
   Reset, design tokens, typography, utilities
   ============================================================ */

:root {
  /* Color tokens */
  --bg: #0a0e1a;
  --bg-2: #0f1424;
  --bg-3: #161c35;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-strong: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #f5f5f7;
  --text-muted: #94a3b8;
  --text-soft: #cbd5e1;
  --text-faint: #64748b;

  --accent-cyan: #00d4ff;
  --accent-violet: #a855f7;
  --accent-pink: #ec4899;

  --gradient-accent: linear-gradient(135deg, #00d4ff 0%, #a855f7 100%);
  --gradient-accent-soft: linear-gradient(135deg, rgba(0, 212, 255, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
  --gradient-text: linear-gradient(135deg, #00d4ff 0%, #a855f7 60%, #ec4899 100%);

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  /* Spacing scale */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4rem;
  --s-9: 6rem;
  --s-10: 8rem;

  /* Radius */
  --r-1: 4px;
  --r-2: 8px;
  --r-3: 14px;
  --r-4: 20px;
  --r-5: 28px;
  --r-full: 9999px;

  /* Typography */
  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Effects */
  --shadow-glow: 0 0 60px rgba(0, 212, 255, 0.15);
  --shadow-lift: 0 30px 60px -20px rgba(0, 0, 0, 0.6);
  --blur: 20px;

  /* Layout */
  --container: 1200px;
  --container-narrow: 920px;
  --nav-h: 72px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --t-fast: 160ms;
  --t-med: 280ms;
  --t-slow: 600ms;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  opacity: 0;
  transition: opacity 400ms var(--ease-out);
}

body.ready {
  opacity: 1;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

a {
  color: var(--text);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease-out);
}

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

ul,
ol {
  list-style: none;
}

/* ---- Background mesh (lives on body::before) ---- */
body::before {
  content: '';
  position: fixed;
  inset: -10%;
  background:
    radial-gradient(circle at 20% 30%, rgba(0, 212, 255, 0.18), transparent 35%),
    radial-gradient(circle at 80% 20%, rgba(168, 85, 247, 0.18), transparent 40%),
    radial-gradient(circle at 60% 80%, rgba(236, 72, 153, 0.12), transparent 40%),
    radial-gradient(circle at 10% 80%, rgba(0, 212, 255, 0.10), transparent 40%);
  background-size: 200% 200%;
  z-index: -2;
  animation: meshDrift 40s ease-in-out infinite alternate;
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at top, transparent 0%, var(--bg) 90%);
  z-index: -1;
  pointer-events: none;
}

@keyframes meshDrift {
  0%   { background-position: 0% 0%, 100% 0%, 50% 100%, 0% 100%; }
  50%  { background-position: 30% 50%, 70% 30%, 40% 70%, 20% 60%; }
  100% { background-position: 100% 100%, 0% 100%, 100% 0%, 100% 0%; }
}

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

h1 {
  font-size: clamp(2.4rem, 5vw + 1rem, 4.8rem);
  letter-spacing: -0.035em;
}

h2 {
  font-size: clamp(1.9rem, 3vw + 1rem, 3.2rem);
  letter-spacing: -0.025em;
}

h3 {
  font-size: clamp(1.35rem, 1.5vw + 0.8rem, 1.9rem);
}

h4 {
  font-size: 1.15rem;
}

p {
  color: var(--text-soft);
  line-height: 1.7;
}

p.lead {
  font-size: 1.2rem;
  color: var(--text-soft);
  max-width: 60ch;
}

.gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-cyan);
  padding: var(--s-2) var(--s-4);
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: var(--r-full);
}

.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 12px var(--accent-cyan);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.4); }
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

code {
  padding: 0.15em 0.4em;
  background: rgba(0, 212, 255, 0.1);
  border-radius: var(--r-1);
  color: var(--accent-cyan);
}

/* ---- Layout utilities ---- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--s-5);
}

.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: 0 var(--s-5);
}

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

.section-sm {
  padding: var(--s-9) 0;
}

@media (max-width: 768px) {
  .section {
    padding: var(--s-9) 0;
  }
  .section-sm {
    padding: var(--s-8) 0;
  }
}

.section-head {
  text-align: center;
  margin-bottom: var(--s-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-4);
}

.section-head p {
  max-width: 60ch;
}

/* ---- Grids ---- */
.grid {
  display: grid;
  gap: var(--s-5);
}

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

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---- Reveal animation ---- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 800ms var(--ease-out), transform 800ms var(--ease-out);
  will-change: opacity, transform;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger > * {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
}

.reveal-stagger.in-view > * {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger.in-view > *:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger.in-view > *:nth-child(2) { transition-delay: 80ms; }
.reveal-stagger.in-view > *:nth-child(3) { transition-delay: 160ms; }
.reveal-stagger.in-view > *:nth-child(4) { transition-delay: 240ms; }
.reveal-stagger.in-view > *:nth-child(5) { transition-delay: 320ms; }
.reveal-stagger.in-view > *:nth-child(6) { transition-delay: 400ms; }
.reveal-stagger.in-view > *:nth-child(7) { transition-delay: 480ms; }
.reveal-stagger.in-view > *:nth-child(8) { transition-delay: 560ms; }

/* ---- Selection ---- */
::selection {
  background: rgba(0, 212, 255, 0.35);
  color: #fff;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(0,212,255,0.4), rgba(168,85,247,0.4));
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(0,212,255,0.7), rgba(168,85,247,0.7));
}

/* ---- Focus ---- */
:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
  border-radius: var(--r-2);
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  body::before { animation: none; }
  .reveal, .reveal-stagger > * {
    opacity: 1 !important;
    transform: none !important;
  }
}
