/* ==========================================================================
   ARYAN KALRA — Design System
   Core tokens, reset, typography, components, utilities
   ========================================================================== */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- Design Tokens ---------- */
:root {
  /* Backgrounds */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a28;
  --bg-glass: rgba(18, 18, 26, 0.6);
  --bg-glass-hover: rgba(18, 18, 26, 0.8);

  /* Text */
  --text-primary: #f0f0f5;
  --text-secondary: #a0a0b8;
  --text-muted: #5a5a72;
  --text-accent: #f5c542;

  /* Accent Colors — Per Persona */
  --accent-home: #f5c542;
  --accent-youtube: #ff4d6a;
  --accent-builder: #00d4ff;
  --accent-founder: #a855f7;
  --accent-research: #34d399;
  --accent-journal: #f59e0b;
  --accent-contact: #f0f0f5;

  /* Current section accent (overridden per section) */
  --accent: var(--accent-home);
  --accent-glow: rgba(245, 197, 66, 0.15);

  /* Typography */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;
  --space-5xl: 8rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-Index Scale */
  --z-canvas: 0;
  --z-content: 10;
  --z-cards: 20;
  --z-nav: 100;
  --z-overlay: 200;
  --z-cursor: 300;

  /* Container */
  --container-max: 1200px;
  --container-padding: 2rem;
}

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

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

body {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.7;
  color: var(--text-secondary);
  background-color: var(--bg-primary);
  overflow-x: hidden;
  cursor: none;
}

/* Restore default cursor on mobile */
@media (hover: none) {
  body { cursor: auto; }
}

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

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

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

button {
  font-family: inherit;
  cursor: none;
  border: none;
  background: none;
  color: inherit;
}

ul, ol {
  list-style: none;
}

::selection {
  background: var(--accent);
  color: var(--bg-primary);
}

/* ---------- Typography ---------- */
.display {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw + 1rem, 4.5rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

h1, .h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw + 0.5rem, 3rem);
  font-weight: 600;
  line-height: 1.15;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

h2, .h2 {
  font-family: var(--font-body);
  font-size: clamp(1.5rem, 2.5vw + 0.5rem, 2rem);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text-primary);
}

h3, .h3 {
  font-family: var(--font-body);
  font-size: clamp(1.25rem, 2vw + 0.25rem, 1.5rem);
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-primary);
}

.label {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

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

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

.micro-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.6;
}

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

.section {
  position: relative;
  z-index: var(--z-content);
  padding: var(--space-5xl) 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.section--full {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xl);
  align-items: center;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}

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

@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
  .section { padding: var(--space-4xl) 0; }
  :root { --container-padding: 1.25rem; }
}

@media (max-width: 480px) {
  .section { padding: var(--space-3xl) 0; }
  :root { --container-padding: 1rem; }
}

/* ---------- Glassmorphism Card ---------- */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(240, 240, 245, 0.06);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-base),
              border-color var(--transition-base),
              box-shadow var(--transition-base);
  will-change: transform;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(240, 240, 245, 0.1), transparent);
}

.glass-card:hover {
  border-color: rgba(240, 240, 245, 0.12);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4),
              0 0 60px var(--accent-glow);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.85rem 2rem;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  cursor: none;
}

.btn--primary {
  background: var(--accent);
  color: var(--bg-primary);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn--primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 30px var(--accent-glow);
  color: var(--bg-primary);
}

.btn--outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid rgba(240, 240, 245, 0.15);
}

.btn--outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn__arrow {
  transition: transform var(--transition-fast);
}

.btn:hover .btn__arrow {
  transform: translateX(4px);
}

/* ---------- Tags ---------- */
.tag {
  display: inline-block;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  background: rgba(240, 240, 245, 0.06);
  color: var(--text-secondary);
  border: 1px solid rgba(240, 240, 245, 0.06);
  transition: all var(--transition-fast);
}

.tag:hover {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

.tag--active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

/* ---------- Divider ---------- */
.divider {
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
  border-radius: var(--radius-full);
  margin: var(--space-lg) 0;
}

/* ---------- Section Header ---------- */
.section-header {
  margin-bottom: var(--space-3xl);
}

.section-header .label {
  margin-bottom: var(--space-md);
}

.section-header .intro {
  max-width: 600px;
  margin-top: var(--space-md);
  color: var(--text-secondary);
}

/* ---------- Scroll Indicator ---------- */
.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.scroll-indicator__chevron {
  width: 24px;
  height: 24px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  animation: bounce-down 2s ease infinite;
}

@keyframes bounce-down {
  0%, 20%, 50%, 80%, 100% { transform: rotate(45deg) translateY(0); }
  40% { transform: rotate(45deg) translateY(6px); }
  60% { transform: rotate(45deg) translateY(3px); }
}

/* ---------- Custom Cursor ---------- */
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 32px;
  height: 32px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: var(--z-cursor);
  transition: width 0.2s ease, height 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  opacity: 0;
  mix-blend-mode: difference;
}

.custom-cursor--visible {
  opacity: 1;
}

.custom-cursor--hover {
  width: 56px;
  height: 56px;
  border-color: var(--text-primary);
}

.custom-cursor--click {
  width: 24px;
  height: 24px;
}

@media (hover: none) {
  .custom-cursor { display: none; }
}

/* ---------- Loading Screen ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader__text {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.1em;
}

.loader__bar {
  width: 200px;
  height: 2px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  margin-top: var(--space-lg);
  overflow: hidden;
}

.loader__bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-full);
  animation: loader-fill 1.8s ease-in-out forwards;
}

@keyframes loader-fill {
  0% { width: 0; }
  50% { width: 70%; }
  100% { width: 100%; }
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* ---------- Global Canvas ---------- */
#three-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-canvas);
  pointer-events: none;
}
