/* ==========================================================================
   BASE — reset, tokens, typography, global elements
   ========================================================================== */

:root {
  --bg: #0A0A0F;
  --bg-elev: #12121A;
  --text: #EDEDF0;
  --text-dim: #8A8A96;
  --accent: #00FF88;
  --accent-dim: rgba(0, 255, 136, 0.12);
  --line: rgba(237, 237, 240, 0.08);

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

  --nav-h: 88px;
}

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

html {
  background: var(--bg);
  overflow-x: clip;
  scroll-behavior: auto;
}

html, body {
  max-width: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.5;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

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

ul, ol {
  list-style: none;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
}

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

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: rgba(237, 237, 240, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}
html {
  scrollbar-width: thin;
  scrollbar-color: rgba(237, 237, 240, 0.15) var(--bg);
}

/* ==========================================================================
   Utility / shared primitives
   ========================================================================== */

.mono-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
}

@media (min-width: 768px) {
  .mono-label {
    font-size: 12px;
  }
}

.section-label {
  display: block;
  margin-bottom: 2rem;
  color: var(--accent);
}

/* Grain overlay */
.grain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.04;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Custom cursor (pointer:fine only, JS-driven) */
.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9998;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
}

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

.cursor-ring {
  width: 32px;
  height: 32px;
  border: 1px solid var(--accent-dim);
}

@media (pointer: fine) {
  html.js .cursor-dot,
  html.js .cursor-ring {
    opacity: 1;
  }
}

/* ==========================================================================
   Preloader
   ========================================================================== */

#preloader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.preloader-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-align: center;
  padding: 0 1rem;
}

.preloader-count {
  font-family: var(--font-mono);
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.preloader-count::after {
  content: " / 100";
  color: var(--text-dim);
  font-size: 0.5em;
}

/* No-JS fallback: never let the preloader block content forever */
html:not(.js) #preloader {
  display: none;
}

/* ==========================================================================
   Nav
   ========================================================================== */

#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 500;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s ease, background-color 0.4s ease;
}

#nav.nav-scrolled {
  background: rgba(10, 10, 15, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--line);
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.nav-links {
  display: flex;
  gap: 2.5rem;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color 0.25s ease;
  position: relative;
}

.nav-links a:hover {
  color: var(--text);
}

@media (max-width: 767px) {
  .nav-links {
    display: none;
  }
}

@keyframes pulse-dot {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.5);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(0, 255, 136, 0);
  }
}
