/* =============================================
   BASE — Reset, Tokens, Typography
   ============================================= */

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

:root {
  color-scheme: dark;
  --color-charcoal: #1a1a1a;
  --color-charcoal-soft: #2d2d2d;
  --color-green: #2db52d;
  --color-green-dark: #1e8c1e;
  --color-green-light: #3dd63d;
  --color-navy: #1e2a3a;
  --color-white: #ffffff;
  --color-off-white: #f5f5f0;
  --color-surface: #f0f0eb;
  --color-border: #e0e0d8;
  --color-text-muted: #666660;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;

  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 8rem;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.16);

  --transition: 0.3s ease;
  --transition-fast: 0.15s ease;

  --nav-height: 88px;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background-color: #040A0C;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-charcoal);
  background-color: var(--color-white);
  overflow-x: hidden;
}

body.page--dark {
  background-color: #0D1512;
  color: var(--color-off-white);
}

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

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

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* Typography scale — fluid sizing */
h1 {
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.75rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h3 {
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  font-weight: 600;
  line-height: 1.25;
}

h4 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
}

p {
  line-height: 1.7;
}

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

/* GSAP animation initial states — only hide when JS has confirmed GSAP loaded.
   Without this guard, a CDN timeout or ad-blocker leaves all content invisible. */
.js-anim .anim-fade-in {
  opacity: 0;
}

.js-anim .anim-slide-up {
  opacity: 0;
  transform: translateY(40px);
}

.js-anim .anim-stagger-children > * {
  opacity: 0;
  transform: translateY(30px);
}

/* ── NETWORK BANNER ──────────────────────────── */
#network-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  transform: translateY(-100%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

#network-banner.is-visible {
  transform: translateY(0);
  pointer-events: auto;
}

.network-banner--offline {
  background: rgba(180, 40, 40, 0.95);
  color: #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.network-banner--online {
  background: rgba(44, 179, 46, 0.92);
  color: #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.network-banner--slow {
  background: rgba(180, 130, 20, 0.92);
  color: #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.network-banner__icon::before {
  font-size: 14px;
}

.network-banner--offline .network-banner__icon::before { content: '⚠'; }
.network-banner--online  .network-banner__icon::before { content: '✓'; }
.network-banner--slow    .network-banner__icon::before { content: '⏳'; }

/* ── Form Inputs & Autofill Dark Mode Reset ── */
input,
textarea,
select {
  color-scheme: dark;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
textarea:-webkit-autofill:active,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus,
select:-webkit-autofill:active {
  -webkit-text-fill-color: #F4F4F1 !important;
  color: #F4F4F1 !important;
  caret-color: #F4F4F1 !important;
  -webkit-box-shadow: 0 0 0 1000px #07120E inset !important;
  box-shadow: 0 0 0 1000px #07120E inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

input:autofill,
input:autofill:hover,
input:autofill:focus,
input:autofill:active,
textarea:autofill,
textarea:autofill:hover,
textarea:autofill:focus,
textarea:autofill:active,
select:autofill,
select:autofill:hover,
select:autofill:focus,
select:autofill:active {
  -webkit-text-fill-color: #F4F4F1 !important;
  color: #F4F4F1 !important;
  caret-color: #F4F4F1 !important;
  -webkit-box-shadow: 0 0 0 1000px #07120E inset !important;
  box-shadow: 0 0 0 1000px #07120E inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* ── Accessibility & Screen Reader Utilities ── */
.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;
}

/* Image load error placeholder — shown when network.js catches an img error */
.img-load-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #06100C 0%, #0d1a14 100%);
  color: rgba(241,239,233,0.35);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: center;
  line-height: 1.5;
  padding: 12px;
  border-radius: inherit;
}
