/* ==========================================================================
   NEXUS STUDIO — BASE STYLES & RESET
   Typography hierarchy, custom cursor, animations, grid overlays
   ========================================================================== */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Playfair+Display:ital,wght@0,400;0,600;1,400&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=Syne:wght@500;700;800&display=swap');

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  letter-spacing: -0.01em;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  min-height: 100vh;
  position: relative;
}

/* Custom Selection */
::selection {
  background-color: var(--accent-primary);
  color: #000000;
}

/* Background Subtle Grid Texture */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(to right, var(--border-subtle) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border-subtle) 1px, transparent 1px);
  background-size: 80px 80px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}

/* Media elements */
img, svg, video, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

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

button, input, textarea, select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
}

ul, ol {
  list-style: none;
}

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

.display-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6.5vw, 5.5rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.display-title-serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  letter-spacing: -0.01em;
}

.h1 {
  font-size: clamp(2rem, 4.5vw, 3.75rem);
  font-weight: 700;
}

.h2 {
  font-size: clamp(1.75rem, 3.2vw, 2.75rem);
  font-weight: 700;
}

.h3 {
  font-size: clamp(1.35rem, 2vw, 1.875rem);
  font-weight: 600;
}

.h4 {
  font-size: 1.25rem;
  font-weight: 600;
}

.lead {
  font-size: clamp(1.125rem, 1.4vw, 1.35rem);
  line-height: 1.6;
  color: var(--text-secondary);
  font-weight: 400;
}

.text-muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

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

.font-mono {
  font-family: var(--font-mono);
  font-size: 0.85em;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

/* Custom Interactive Cursor */
.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: difference;
  background-color: #ffffff;
  transform: translate(-50%, -50%) scale(1);
  transition: transform 0.15s ease-out, opacity 0.2s ease, width 0.2s ease, height 0.2s ease, background-color 0.2s ease;
  opacity: 0;
}

.custom-cursor-follower {
  position: fixed;
  top: 0;
  left: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--accent-primary);
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), width 0.2s ease, height 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  opacity: 0;
}

.custom-cursor.active {
  transform: translate(-50%, -50%) scale(2.2);
  background-color: var(--accent-primary);
  mix-blend-mode: normal;
}

.custom-cursor-follower.active {
  transform: translate(-50%, -50%) scale(1.4);
  border-color: var(--accent-primary);
  opacity: 0.8;
}

.custom-cursor.pointer-text {
  width: 72px;
  height: 72px;
  background-color: var(--accent-primary);
  mix-blend-mode: normal;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

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

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

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--bg-elevated);
  border-radius: 4px;
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Scroll Animation Utilities */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--transition-editorial), transform var(--transition-editorial);
  will-change: opacity, transform;
}

.reveal-on-scroll.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 100ms; }
.reveal-delay-2 { transition-delay: 200ms; }
.reveal-delay-3 { transition-delay: 300ms; }
.reveal-delay-4 { transition-delay: 400ms; }

/* Responsive Word-Wrap & Display Safety */
h1, h2, h3, .display-title {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Accessibility: Reduced Motion Media Query */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .marquee-content {
    animation: none !important;
    transform: none !important;
  }
  .custom-cursor,
  .custom-cursor-follower {
    display: none !important;
  }
  .reveal-on-scroll {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
