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

@font-face {
  font-family: 'CustomSerif';
  src: url('../fonts/serif.ttf') format('truetype');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Colors */
  --bg-primary: #0a0a0b;
  --bg-secondary: #111113;
  --bg-tertiary: #18181b;
  --text-primary: #e8e6e3;
  --text-secondary: #8a8a8a;
  --text-muted: #5a5a5a;
  --accent-primary: #6366f1;
  --accent-secondary: #f59e0b;
  --accent-tertiary: #ad827e;
  --accent-success: #22c55e;
  --grid-line: rgba(99, 102, 241, 0.04);
  --grid-line-strong: rgba(99, 102, 241, 0.08);
  --glow-primary: rgba(99, 102, 241, 0.12);
  --glow-secondary: rgba(245, 158, 11, 0.12);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(99, 102, 241, 0.3);

  /* Typography */
  --font-serif: 'CustomSerif', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 2rem;
  --font-size-3xl: 2.5rem;
  --line-height-tight: 1.25;
  --line-height-normal: 1.7;
  --line-height-relaxed: 1.85;

  /* Spacing (8px grid) */
  --unit: 8px;
  --space-1: calc(var(--unit) * 1);   /* 8px */
  --space-2: calc(var(--unit) * 2);   /* 16px */
  --space-3: calc(var(--unit) * 3);   /* 24px */
  --space-4: calc(var(--unit) * 4);   /* 32px */
  --space-6: calc(var(--unit) * 6);   /* 48px */
  --space-8: calc(var(--unit) * 8);   /* 64px */
  --space-12: calc(var(--unit) * 12); /* 96px */
  --space-16: calc(var(--unit) * 16); /* 128px */

  /* Layout */
  --content-width: 720px;
  --content-wide: 960px;
  --content-hero: 900px;
  --nav-height: 64px;

  /* Transitions */
  --transition-fast: 150ms ease-out;
  --transition-base: 200ms ease-out;
  --transition-slow: 300ms ease-out;
}

/* ============================================
   RESET
   ============================================ */

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

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

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

/* ============================================
   GRID BACKGROUND
   ============================================ */

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: -1;
  
  /* Orthogonal grid */
  background-image: 
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  
  /* Fade toward edges */
  mask-image: radial-gradient(
    ellipse 80% 60% at 50% 40%,
    black 0%,
    transparent 100%
  );
  -webkit-mask-image: radial-gradient(
    ellipse 80% 60% at 50% 40%,
    black 0%,
    transparent 100%
  );
}

/* Subtle ambient glow */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: -2;
  background: 
    radial-gradient(ellipse 50% 30% at 20% 20%, var(--glow-primary), transparent),
    radial-gradient(ellipse 40% 25% at 80% 70%, var(--glow-primary), transparent);
  opacity: 0.4;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 500;
  line-height: var(--line-height-tight);
  color: var(--text-primary);
}

h1 {
  font-size: var(--font-size-3xl);
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--font-size-2xl);
  letter-spacing: -0.01em;
}

h3 {
  font-size: var(--font-size-xl);
}

h4 {
  font-size: var(--font-size-lg);
}

p {
  margin-bottom: var(--space-2);
  color: var(--text-primary);
}

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

a:hover {
  color: var(--text-primary);
}

/* Monospace elements */
code, .mono {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ============================================
   LAYOUT
   ============================================ */

.container {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

.container--wide {
  max-width: var(--content-wide);
}

.section {
  padding: var(--space-12) 0;
}

.section--hero {
  padding: var(--space-16) 0 var(--space-12);
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ============================================
   NAVIGATION
   ============================================ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  background: rgba(10, 10, 11, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 100;
}

.nav__logo {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-serif);
  font-size: var(--font-size-lg);
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
}

.nav__logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.nav__logo-text {
  display: inline;
}

.nav__links {
  display: flex;
  gap: var(--space-4);
  list-style: none;
}

.nav__link {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  text-decoration: none;
  padding: var(--space-1) 0;
  transition: color var(--transition-fast);
  position: relative;
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent-primary);
  transition: width var(--transition-base);
}

.nav__link:hover {
  color: var(--text-primary);
}

.nav__link:hover::after {
  width: 100%;
}

.nav__link--active {
  color: var(--text-primary);
}

/* ============================================
   MAIN CONTENT OFFSET
   ============================================ */

main {
  padding-top: var(--nav-height);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  :root {
    --font-size-3xl: 2rem;
    --font-size-2xl: 1.5rem;
    --font-size-xl: 1.25rem;
  }

  .nav {
    padding: 0 var(--space-2);
  }

  .nav__links {
    gap: var(--space-3);
  }

  .container {
    padding: 0 var(--space-2);
  }

  .section {
    padding: var(--space-8) 0;
  }

  .section--hero {
    padding: var(--space-12) 0 var(--space-8);
  }
}

@media (max-width: 480px) {
  :root {
    --font-size-base: 0.9375rem;
  }
  
  .nav {
    padding: 0 var(--space-2);
  }
  
  .nav__logo {
    font-size: var(--font-size-sm);
  }
  
  .nav__logo-img {
    width: 24px;
    height: 24px;
  }
  
  .nav__logo-text {
    display: none;
  }
  
  .nav__links {
    gap: var(--space-1);
  }

  .nav__link {
    font-size: 0.7rem;
    padding: 4px 6px;
  }
  
  .container {
    padding: 0 var(--space-2);
  }
  
  .section {
    padding: var(--space-6) 0;
  }
}

/* ============================================
   SCROLLYTELLING (overclock.co style)
   ============================================ */

html.lenis, html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

.scene {
  position: relative;
  min-height: 150vh;
}

.scene > .sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}


.scene .sticky > * {
  will-change: transform, opacity;
}

/* Scroll-driven animations */
/* Scroll-driven animations */
[data-scroll-animate] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-scroll-animate].in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Progress bar */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  width: 0%;
  z-index: 1000;
  transition: width 0.1s linear;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .scene { min-height: auto; }
  .scene > .sticky { position: relative; height: auto; overflow: visible; }
  .scene [data-scroll-animate] { opacity: 1; transform: none; }
}

/* ============================================
   LOADING ANIMATION
   ============================================ */

.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

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

.loader__content {
  position: relative;
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader__logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  z-index: 2;
  animation: logo-pulse 2s ease-in-out infinite;
}

@keyframes logo-pulse {
  0%, 100% { 
    transform: scale(1);
    filter: drop-shadow(0 0 8px var(--accent-primary));
  }
  50% { 
    transform: scale(1.1);
    filter: drop-shadow(0 0 20px var(--accent-primary));
  }
}

.loader__ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid transparent;
}

.loader__ring--outer {
  width: 120px;
  height: 120px;
  border-top-color: var(--accent-primary);
  border-right-color: var(--accent-primary);
  animation: spin 1.5s linear infinite;
}

.loader__ring--inner {
  width: 90px;
  height: 90px;
  border-bottom-color: var(--accent-tertiary);
  border-left-color: var(--accent-tertiary);
  animation: spin-reverse 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes spin-reverse {
  to { transform: rotate(-360deg); }
}

.loader__particles {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  animation: particles-spin 20s linear infinite;
}

.loader__particles span {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--accent-primary);
  border-radius: 50%;
  animation: particle-float 3s ease-in-out infinite;
}

.loader__particles span:nth-child(1) { top: 0; left: 50%; animation-delay: 0s; }
.loader__particles span:nth-child(2) { top: 15%; right: 15%; animation-delay: 0.4s; }
.loader__particles span:nth-child(3) { top: 50%; right: 0; animation-delay: 0.8s; }
.loader__particles span:nth-child(4) { bottom: 15%; right: 15%; animation-delay: 1.2s; }
.loader__particles span:nth-child(5) { bottom: 0; left: 50%; animation-delay: 1.6s; }
.loader__particles span:nth-child(6) { bottom: 15%; left: 15%; animation-delay: 2s; }
.loader__particles span:nth-child(7) { top: 50%; left: 0; animation-delay: 2.4s; }
.loader__particles span:nth-child(8) { top: 15%; left: 15%; animation-delay: 2.8s; }

@keyframes particle-float {
  0%, 100% {
    opacity: 0;
    transform: scale(0) translateY(0);
  }
  50% {
    opacity: 1;
    transform: scale(1) translateY(-10px);
  }
}

@keyframes particles-spin {
  to { transform: rotate(360deg); }
}

.loader__text {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  animation: text-blink 1.5s ease-in-out infinite;
}

@keyframes text-blink {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ============================================
   HERO WIDE (DESKTOP ONLY)
   ============================================ */

.section--hero .container {
  max-width: var(--content-width);
  display: flex;
  flex-direction: column;
  align-items: center;
}

@media (min-width: 1024px) {
  .section--hero .container {
    max-width: var(--content-hero);
  }
}

/* ============================================
   CURTAIN REVEAL
   ============================================ */

.curtain {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

.curtain__bar {
  flex: 1;
  background: var(--bg-primary);
  transition: transform 0.8s cubic-bezier(0.77, 0, 0.18, 1);
}

.curtain__bar--top {
  transform-origin: top;
}

.curtain__bar--bottom {
  transform-origin: bottom;
}

.curtain.revealed .curtain__bar--top {
  transform: translateY(-100%);
}

.curtain.revealed .curtain__bar--bottom {
  transform: translateY(100%);
}
