/* ═══════════════════════════════════════════════════════════════
   OCTOPILOT — Base Design System
   Reset · Tokens · Typography · Atmosphere
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ── */
:root {
  /* Color Tokens */
  --bg-deep:        #050505;
  --bg-surface:     #0a0a0a;
  --bg-elevated:    #111111;
  --bg-graphite:    #161618;

  --accent:         #c41420;
  --accent-bright:  #e8192a;
  --accent-dim:     #6b0a10;
  --accent-glow:    rgba(196, 20, 32, 0.25);
  --accent-subtle:  rgba(196, 20, 32, 0.08);

  --text-primary:   rgba(245, 241, 237, 0.95);
  --text-secondary: rgba(245, 241, 237, 0.62);
  --text-muted:     rgba(245, 241, 237, 0.38);
  --text-ghost:     rgba(245, 241, 237, 0.18);

  --silver:         #8a8a8e;
  --silver-bright:  #b8b8bc;
  --white-pure:     #ffffff;

  --border:         rgba(255, 255, 255, 0.07);
  --border-hover:   rgba(255, 255, 255, 0.14);
  --border-accent:  rgba(196, 20, 32, 0.3);

  --glass:          rgba(18, 18, 20, 0.72);
  --glass-strong:   rgba(12, 12, 14, 0.88);

  /* Typography */
  --font-display:   "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-body:      "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:      "JetBrains Mono", "Fira Code", monospace;

  /* Font Sizes */
  --text-xs:    0.72rem;
  --text-sm:    0.82rem;
  --text-base:  0.95rem;
  --text-md:    1.08rem;
  --text-lg:    1.22rem;
  --text-xl:    1.5rem;
  --text-2xl:   2rem;
  --text-3xl:   2.8rem;
  --text-4xl:   3.8rem;
  --text-5xl:   5rem;
  --text-hero:  clamp(2.8rem, 5.5vw, 5.2rem);

  /* Spacing Scale */
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   16px;
  --space-lg:   24px;
  --space-xl:   40px;
  --space-2xl:  64px;
  --space-3xl:  100px;
  --space-4xl:  140px;

  /* Z-Index Layers */
  --z-base:       1;
  --z-content:    5;
  --z-overlay:    10;
  --z-nav:        50;
  --z-modal:      100;
  --z-cursor:     200;

  /* Easing Curves */
  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:  cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-heavy:   cubic-bezier(0.7, 0, 0.3, 1);

  /* Borders & Radii */
  --radius-sm:    8px;
  --radius-md:    14px;
  --radius-lg:    22px;
  --radius-xl:    32px;
  --radius-full:  999px;

  /* Shadows */
  --shadow-sm:    0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md:    0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg:    0 18px 60px rgba(0, 0, 0, 0.5);
  --shadow-glow:  0 0 40px var(--accent-glow);
}


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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-width: 320px;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s var(--ease-out);
}

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

button {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

ul, ol {
  list-style: none;
}

input, textarea {
  font: inherit;
  color: inherit;
}

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


/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

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

.system-label {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.system-label--accent {
  color: var(--accent);
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-bright);
  margin-bottom: var(--space-lg);
}


/* ── Body Atmosphere ── */
/* Removed fixed overlay — hero controls its own atmosphere.
   Fixed radial gradients caused an abrupt visual jump when
   the hero section scrolled out of view. */

/* Noise / Grid Texture Overlay */
.noise-layer {
  position: fixed;
  inset: 0;
  z-index: var(--z-base);
  pointer-events: none;
  opacity: 0.06;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(circle at center, black, transparent 85%);
  -webkit-mask-image: radial-gradient(circle at center, black, transparent 85%);
}

/* Film Grain Animation */
.grain-layer {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  z-index: var(--z-base);
  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");
  animation: grain-drift 8s steps(10) infinite;
}

@keyframes grain-drift {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-5%, -10%); }
  20% { transform: translate(-15%, 5%); }
  30% { transform: translate(7%, -25%); }
  40% { transform: translate(-5%, 25%); }
  50% { transform: translate(-15%, 10%); }
  60% { transform: translate(15%, 0%); }
  70% { transform: translate(0%, 15%); }
  80% { transform: translate(3%, 35%); }
  90% { transform: translate(-10%, 10%); }
}


/* ── Reduced Motion ── */
@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;
  }

  .grain-layer {
    display: none;
  }
}

/* ── Scrollbar Styling ── */
::-webkit-scrollbar {
  width: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--accent-dim);
  border-radius: var(--radius-full);
}

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