/* ============================================
   GHOSTWIRE — Base Styles
   Body, typography, layout primitives
   ============================================ */

/* ---- Background Noise Texture ---- */
@keyframes noiseShift {
  0% { background-position: 0 0; }
  100% { background-position: 200px 200px; }
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  position: relative;
  overflow-x: hidden;
}

/* Subtle noise overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.03;
  pointer-events: none;
  z-index: var(--z-top);
  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;
}

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.container--wide {
  max-width: var(--container-wide);
}

.section {
  padding: var(--space-4xl) 0;
}

.section--sm {
  padding: var(--space-2xl) 0;
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-bright);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-wide);
}

h1 {
  font-size: var(--text-5xl);
  letter-spacing: var(--tracking-wider);
}

h2 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-lg);
}

h3 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-md);
}

h4 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-sm);
}

h5, h6 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-sm);
}

p {
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}

p:last-child {
  margin-bottom: 0;
}

.text-mono {
  font-family: var(--font-mono);
}

.text-sans {
  font-family: var(--font-sans);
}

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

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

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

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

.text-uppercase {
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

/* ---- Links ---- */
a {
  transition: color var(--transition-fast);
}

.link-accent {
  color: var(--accent-primary);
  border-bottom: 1px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.link-accent:hover {
  color: var(--accent-light);
  border-bottom-color: var(--accent-light);
}

/* ---- Horizontal Rules ---- */
hr {
  background: var(--border-subtle);
  margin: var(--space-2xl) 0;
}

hr.accent {
  background: var(--accent-primary);
  height: 2px;
  box-shadow: var(--shadow-glow);
}

/* ---- Red Top Line (across full viewport) ---- */
.red-line-top {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent-primary);
  z-index: var(--z-top);
  box-shadow: 0 2px 10px rgba(196, 30, 30, 0.4);
}

/* ---- Utility Classes ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.fade-in {
  animation: fadeIn var(--transition-slow) ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink {
  50% { border-color: transparent; }
}

@keyframes scanline {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(196, 30, 30, 0.2); }
  50% { box-shadow: 0 0 20px rgba(196, 30, 30, 0.4); }
}

/* ---- Scroll Animation Classes ---- */
/* .scroll-animate provides the transition; .scroll-hidden sets initial state.
   Removing .scroll-hidden triggers the transition to opacity:1 / translateY(0). */
.scroll-animate {
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-hidden {
  opacity: 0;
  transform: translateY(20px);
}
