/* ============================================
   BASE — Reset, Global Styles, Grid Background
   ============================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  cursor: none;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  overflow-x: hidden;
  cursor: none;
}

/* Film grain / noise overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  animation: grainShift 0.5s steps(4) infinite;
}

@keyframes grainShift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2px, 3px); }
  50% { transform: translate(3px, -1px); }
  75% { transform: translate(-3px, -2px); }
  100% { transform: translate(1px, 2px); }
}

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

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

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

ul, ol {
  list-style: none;
}

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

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

p {
  line-height: 1.65;
  font-size: 1rem;
}

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

/* Editorial typographic watermark */
.watermark {
  position: absolute;
  font-family: var(--font-display);
  font-size: clamp(120px, 30vw, 400px);
  font-weight: 700;
  color: var(--color-text);
  opacity: 0.03;
  line-height: 0.8;
  letter-spacing: -0.05em;
  pointer-events: none;
  z-index: 0;
  white-space: nowrap;
  user-select: none;
}

/* Grid background — full page overlay */
.grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, var(--grid-line-color) var(--grid-line-width), transparent var(--grid-line-width)),
    linear-gradient(to bottom, var(--grid-line-color) var(--grid-line-width), transparent var(--grid-line-width));
  background-size: var(--grid-gap) var(--grid-gap);
  will-change: transform;
}

/* Page loader — dark theme to match hero */
.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--color-bg-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
}

.loader-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.04) var(--grid-line-width), transparent var(--grid-line-width)),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.04) var(--grid-line-width), transparent var(--grid-line-width));
  background-size: var(--grid-gap) var(--grid-gap);
  opacity: 0.5;
}

.loader-text {
  font-family: var(--font-header);
  font-size: clamp(32px, 5vw, 64px);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--color-text-dark);
  position: relative;
  z-index: 1;
}

.loader-bar {
  width: 120px;
  height: 2px;
  background: rgba(255, 255, 255, 0.15);
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.loader-bar-fill {
  width: 0%;
  height: 100%;
  background: var(--color-accent);
  transition: width 0.1s linear;
}

.loader.is-done {
  pointer-events: none;
}

/* Section base */
.section {
  position: relative;
  width: 100%;
  min-height: 100vh;
  z-index: 1;
}

/* Section divider */
.section-divider {
  width: 100%;
  padding: 0 var(--container-padding);
  overflow: hidden;
}

.divider-line {
  width: 100%;
  height: 1px;
  background: var(--color-border-strong);
  transform: scaleX(0);
  transform-origin: center;
}

.section-label {
  display: inline-block;
  margin-bottom: var(--space-lg);
  padding: var(--space-sm) 0;
  border-bottom: 1px dashed var(--color-border);
}

/* Visibility utilities */
.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.is-visible {
  opacity: 1;
  visibility: visible;
}

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

@media (max-width: 768px) {
  html {
    cursor: auto;
  }

  body {
    cursor: auto;
  }

  .section {
    min-height: auto;
  }

  .section--hero {
    min-height: 100vh;
    min-height: 100dvh;
  }

  .mono-label {
    font-size: 10px;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
