/*
 * ============================================================
 * css/base.css — Design Tokens, Reset, Base Styles, Grain Overlay, Cursor
 * ============================================================
 * Responsible for:
 *   - :root CSS custom properties (colour palette, typography,
 *     spacing scale, animation easings, layout vars)
 *   - Box-model reset and html/body base styles
 *   - img, a, ul global defaults
 *   - Typography utility classes (.display, .label-text, .accent-text)
 *   - Layout utility classes (.container, section, .section-label)
 *   - Noise / grain overlay (body::before)
 *   - Custom cursor (#cursor-dot, #cursor-ring) styles
 *   - Scroll-reveal animation classes (.reveal, .reveal-left,
 *     .reveal-right, .stagger and their .visible states)
 *   - Responsive mobile breakpoint overrides
 * ============================================================
 */

/* ═══════════════════════════════════════════════════════
   1. CSS CUSTOM PROPERTIES — edit tokens here only
═══════════════════════════════════════════════════════ */
:root {
  /* Palette */
  --bg:          #080808;
  --surface:     #111111;
  --surface-2:   #1a1a1a;
  --border:      rgba(255,255,255,0.08);
  --text:        #f0ede8;
  --text-muted:  rgba(240,237,232,0.45);
  --accent:      #e8d5a3;       /* warm gold */
  --accent-2:    #c4a882;       /* deeper gold */
  --danger:      #c0392b;

  /* Typography */
  --font-display: 'Bebas Neue', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  /* Spacing scale */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 8rem;

  /* Animation */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:   cubic-bezier(0.76, 0, 0.24, 1);
  --duration-fast: 0.25s;
  --duration-med:  0.6s;
  --duration-slow: 1.1s;

  /* Layout */
  --max-width: 1200px;
  --section-pad: 10rem 2rem;
}

/* ═══════════════════════════════════════════════════════
   2. RESET & BASE
═══════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  overflow-x: hidden;
  cursor: none; /* custom cursor active */
}

img { display: block; max-width: 100%; }
a   { color: inherit; text-decoration: none; }
ul  { list-style: none; }

/* ═══════════════════════════════════════════════════════
   3. TYPOGRAPHY
═══════════════════════════════════════════════════════ */
.display        { font-family: var(--font-display); letter-spacing: 0.02em; }
.label-text     { font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-muted); }
.accent-text    { color: var(--accent); }

h1, h2, h3 { line-height: 1.05; }

/* ═══════════════════════════════════════════════════════
   4. LAYOUT UTILITIES
═══════════════════════════════════════════════════════ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

section { padding: var(--section-pad); position: relative; }

.section-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 3rem;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ═══════════════════════════════════════════════════════
   5. NOISE / GRAIN OVERLAY — subtle film texture
═══════════════════════════════════════════════════════ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* ═══════════════════════════════════════════════════════
   6. CUSTOM CURSOR
═══════════════════════════════════════════════════════ */
#cursor-dot,
#cursor-ring {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  transition: opacity var(--duration-fast) ease;
}

#cursor-dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  transition: transform var(--duration-fast) var(--ease-out-expo),
              background var(--duration-fast) ease;
}

#cursor-ring {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--accent);
  opacity: 0.5;
  transition: width var(--duration-med) var(--ease-out-expo),
              height var(--duration-med) var(--ease-out-expo),
              opacity var(--duration-fast) ease;
}

/* Cursor expands over interactive elements */
body.cursor-hover #cursor-ring {
  width: 56px;
  height: 56px;
  opacity: 0.8;
}
body.cursor-hover #cursor-dot {
  transform: translate(-50%, -50%) scale(0.4);
}

/* ═══════════════════════════════════════════════════════
   15. SCROLL-TRIGGERED REVEAL ANIMATIONS
       Elements with .reveal class animate in when they
       enter the viewport (IntersectionObserver in JS).
═══════════════════════════════════════════════════════ */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity var(--duration-slow) var(--ease-out-expo),
              transform var(--duration-slow) var(--ease-out-expo);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children — apply .stagger to a parent,
   children get progressive delay */
.stagger > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--duration-slow) var(--ease-out-expo),
              transform var(--duration-slow) var(--ease-out-expo);
}

.stagger.visible > *:nth-child(1) { transition-delay: 0ms; }
.stagger.visible > *:nth-child(2) { transition-delay: 80ms; }
.stagger.visible > *:nth-child(3) { transition-delay: 160ms; }
.stagger.visible > *:nth-child(4) { transition-delay: 240ms; }
.stagger.visible > *:nth-child(5) { transition-delay: 320ms; }
.stagger.visible > *:nth-child(6) { transition-delay: 400ms; }
.stagger.visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* Slide-in from left */
.reveal-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity var(--duration-slow) var(--ease-out-expo),
              transform var(--duration-slow) var(--ease-out-expo);
}

.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Slide-in from right */
.reveal-right {
  opacity: 0;
  transform: translateX(50px);
  transition: opacity var(--duration-slow) var(--ease-out-expo),
              transform var(--duration-slow) var(--ease-out-expo);
}

.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE — mobile breakpoint
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --section-pad: 6rem 1.5rem; }

  body { cursor: auto; } /* Restore default cursor on mobile */
  #cursor-dot, #cursor-ring { display: none; }
}
