/* ============================================================
   OPERATIONAL INTELLIGENCE — Scroll-Driven Website
   Editorial / Industrial Precision
   ============================================================ */

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

:root {
  --yellow: #faea53;
  --ink: #1a1a18;
  --ink-mid: #2e2e2b;
  --paper: #f5f2ed;
  --sage: #8f987f;
  --text-bright: #f5f2ed;
  --text-mid: rgba(245, 242, 237, 0.7);
  --text-dim: rgba(245, 242, 237, 0.4);
  --yellow-dim: rgba(250, 234, 83, 0.5);

  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
}

html {
  scroll-behavior: auto; /* Lenis handles smooth scroll */
}

body {
  background: var(--ink);
  color: var(--text-bright);
  font-family: var(--font-body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- LOADER ------------------------------------------------- */
#loader {
  position: fixed;
  inset: 0;
  background: var(--ink);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.8rem;
}

.loader-brand {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.loader-brand strong {
  font-weight: 800;
  color: var(--yellow);
}

#loader-bar-wrap {
  width: 200px;
  height: 1px;
  background: rgba(245, 242, 237, 0.12);
  position: relative;
}

#loader-bar {
  height: 100%;
  width: 0%;
  background: var(--yellow);
  transition: width 0.08s linear;
}

#loader-percent {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 300;
  color: var(--text-dim);
  letter-spacing: 0.15em;
}

/* --- HEADER ------------------------------------------------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  padding: 1.4rem 5vw;
  transition: background 0.4s ease, backdrop-filter 0.4s ease;
}

.site-header.scrolled {
  background: rgba(250, 234, 83, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.site-header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1.6rem;
}

.nav-secondary {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.75;
  transition: opacity 0.3s ease, color 0.3s ease;
}

.nav-secondary:hover {
  opacity: 1;
}

/* Default: dark text (hero is now light bg) */
.logo {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color 0.3s ease;
}

.logo strong {
  font-weight: 800;
}

.nav-cta {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(26, 26, 24, 0.3);
  padding-bottom: 2px;
  transition: color 0.3s ease, border-color 0.3s ease;
}

/* On canvas sections (after hero scrolls), header picks up yellow bg */
.site-header.scrolled .logo,
.site-header.scrolled .nav-cta,
.site-header.scrolled .nav-secondary {
  color: var(--ink);
}

.site-header.scrolled .nav-cta {
  border-color: rgba(26, 26, 24, 0.35);
}

/* When canvas is visible (dark/video bg), make text white */
.site-header.on-canvas .logo,
.site-header.on-canvas .nav-cta,
.site-header.on-canvas .nav-secondary {
  color: var(--text-bright);
  border-color: rgba(245, 242, 237, 0.3);
}

.site-header.on-canvas.scrolled .logo,
.site-header.on-canvas.scrolled .nav-cta,
.site-header.on-canvas.scrolled .nav-secondary {
  color: var(--ink);
  border-color: rgba(26, 26, 24, 0.35);
}

/* --- HERO STANDALONE --------------------------------------- */
.hero-standalone {
  position: relative;
  z-index: 10;
  height: 100vh;
  /* Light bg matching the white video background — seamless transition */
  background: #f5f5f5;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 8vw 10vh;
  overflow: hidden;
}

/* Yellow accent line at the top */
.hero-standalone::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--yellow);
}

.hero-label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sage);
  margin-bottom: 2rem;
}

.hero-heading {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(4.5rem, 11vw, 13rem);
  line-height: 0.92;
  color: var(--ink);
  margin: 0 0 2rem;
  letter-spacing: -0.02em;
}

.hero-heading .word {
  display: inline-block;
  margin-right: 0.18em;
}

.hero-heading .em {
  /* Yellow underline trick for legibility on light bg */
  color: var(--ink);
  position: relative;
  display: inline-block;
}

.hero-heading .em::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0.05em;
  width: 100%;
  height: 0.12em;
  background: var(--yellow);
  z-index: -1;
}

.hero-tagline {
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.4vw, 1.35rem);
  font-weight: 300;
  color: rgba(26, 26, 24, 0.45);
  letter-spacing: 0.01em;
  font-style: italic;
}

.hero-scroll-indicator {
  position: absolute;
  bottom: 4.5vh;
  right: 8vw;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(26, 26, 24, 0.25);
  animation: indicatorBounce 2.2s ease-in-out infinite;
}

@keyframes indicatorBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

/* --- CANVAS ------------------------------------------------- */
.canvas-wrap {
  position: fixed;
  inset: 0;
  z-index: 1;
  /* clip-path set by JS */
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* --- DARK OVERLAY ------------------------------------------ */
#dark-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 8, 0.92);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  will-change: opacity;
}

/* --- MARQUEE ----------------------------------------------- */
.marquee-wrap {
  position: fixed;
  bottom: 10vh;
  left: 0;
  width: 100%;
  overflow: hidden;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  will-change: opacity;
}

.marquee-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10vw;
  white-space: nowrap;
  color: var(--yellow);
  opacity: 0.1;
  display: block;
  will-change: transform;
  letter-spacing: 0.02em;
}

/* --- SCROLL CONTAINER -------------------------------------- */
#scroll-container {
  position: relative;
  height: 900vh;
  /* No z-index needed — sections are fixed */
}

/* --- SCROLL SECTIONS (all fixed) --------------------------- */
.scroll-section {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  will-change: transform, opacity;
  will-change: opacity, transform;
}

/* Side alignment zones — video subject stays in center */
.align-left {
  padding-left: 5vw;
  padding-right: 56vw;
}

.align-right {
  padding-left: 56vw;
  padding-right: 5vw;
}

/* Text block */
.section-inner {
  max-width: 38vw;
  width: 100%;
  background: rgba(10, 10, 8, 0.80);
  padding: 2.5rem 2.5rem 2rem;
  border-top: 1px solid rgba(250, 234, 83, 0.45);
}

/* Labels */
.section-label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--yellow);
  margin-bottom: 1.1rem;
}

/* Headings */
.section-heading {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 2.4vw, 3rem);
  line-height: 1.08;
  color: var(--text-bright);
  margin: 0 0 1.2rem;
  letter-spacing: -0.01em;
}

/* Body */
.section-body {
  font-family: var(--font-body);
  font-size: clamp(0.85rem, 1vw, 1rem);
  font-weight: 300;
  line-height: 1.72;
  color: var(--text-mid);
  margin: 0 0 0.8rem;
}

.section-body:last-child {
  margin-bottom: 0;
}

/* Note / meta text */
.section-note {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 0.4rem;
}

/* --- STATS SECTION ----------------------------------------- */
.section-stats {
  justify-content: center;
  align-items: flex-start;
  flex-direction: column;
  gap: 1.5rem;
  padding: 0 52vw 0 5vw; /* Right padding keeps stats clear of video zone */
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3vw 6vw;
  width: 100%;
  text-align: center;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.stat-top {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.5rem, 7vw, 8rem);
  line-height: 1;
  color: var(--yellow);
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: 0.04em;
}

.stat-prefix,
.stat-suffix {
  font-size: 0.55em;
  font-weight: 700;
}

.stat-prefix { align-self: flex-start; padding-top: 0.2em; }

.stat-label {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  line-height: 1.4;
}

.stats-source {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 300;
  color: rgba(245, 242, 237, 0.2);
  letter-spacing: 0.08em;
  text-align: center;
}

/* --- CTA SECTION ------------------------------------------- */
.section-cta {
  background: var(--ink);
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 8;
  overflow-y: auto;
}

.cta-inner {
  max-width: 600px;
  width: 100%;
  padding: 0 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.section-cta .section-label {
  margin-bottom: 1.4rem;
  font-size: 0.65rem;
}

.section-cta .section-heading {
  font-size: clamp(1.8rem, 3vw, 3.8rem);
  line-height: 1.05;
  margin-bottom: 2.4rem;
  letter-spacing: -0.02em;
}

.cta-button {
  display: inline-block;
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  padding: 1.1rem 2.8rem;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
  margin-bottom: 0.8rem;
}

.cta-button:hover {
  background: #fff;
  transform: translateY(-2px);
}

.cta-sub {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 300;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  margin-bottom: 2.5rem;
}

.cta-divider {
  width: 40px;
  height: 1px;
  background: rgba(245, 242, 237, 0.12);
  margin: 0 auto 2.5rem;
}

/* Newsletter form */
.newsletter-form {
  display: flex;
  width: 100%;
  border: 1px solid rgba(245, 242, 237, 0.14);
  margin-bottom: 0.8rem;
}

.newsletter-form input {
  flex: 1;
  padding: 0.9rem 1.3rem;
  background: rgba(245, 242, 237, 0.04);
  border: none;
  outline: none;
  color: var(--text-bright);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 300;
  min-width: 0;
}

.newsletter-form input::placeholder {
  color: rgba(245, 242, 237, 0.22);
}

.newsletter-form button {
  padding: 0.9rem 1.4rem;
  background: transparent;
  border: none;
  border-left: 1px solid rgba(245, 242, 237, 0.14);
  color: var(--yellow);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.newsletter-form button:hover {
  background: rgba(250, 234, 83, 0.08);
}

.newsletter-sub {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 300;
  color: rgba(245, 242, 237, 0.2);
  letter-spacing: 0.06em;
  margin-bottom: 2rem;
}

.cta-contact {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 300;
  color: var(--text-dim);
}

.cta-contact a {
  color: var(--text-mid);
  text-decoration: none;
  border-bottom: 1px solid rgba(245, 242, 237, 0.18);
  padding-bottom: 1px;
  transition: color 0.2s, border-color 0.2s;
}

.cta-contact a:hover {
  color: var(--text-bright);
  border-color: rgba(245, 242, 237, 0.45);
}

/* Form feedback */
.form-success {
  color: var(--yellow);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 400;
  text-align: center;
  padding: 1rem 0;
}

.form-error {
  color: #ff7070;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 300;
  text-align: center;
  padding: 0.5rem 0;
}

/* --- MOBILE ------------------------------------------------- */
@media (max-width: 768px) {
  #scroll-container {
    height: 620vh;
  }

  .site-header {
    padding: 1rem 4vw;
  }

  .nav-actions {
    gap: 0.9rem;
  }

  .logo {
    font-size: 0.78rem;
  }

  .nav-secondary {
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    border-bottom: 1px solid rgba(26, 26, 24, 0.25);
    padding-bottom: 2px;
  }

  .nav-cta {
    font-size: 0.7rem;
    padding-bottom: 2px;
  }

  .site-header.on-canvas .nav-secondary {
    border-color: rgba(245, 242, 237, 0.3);
  }

  .hero-heading {
    font-size: clamp(3.5rem, 16vw, 6rem);
  }

  .hero-tagline {
    font-size: 0.95rem;
  }

  /* Stack side-aligned sections at the bottom of the viewport */
  .align-left,
  .align-right {
    padding: 0 5vw;
    align-items: flex-end;
    padding-bottom: 14vh;
  }

  .section-inner {
    max-width: 100%;
    padding: 1.8rem 1.6rem 1.5rem;
  }

  .section-heading {
    font-size: clamp(1.4rem, 5vw, 2rem);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem 4vw;
    padding: 0 4vw;
  }

  .stat-top {
    font-size: clamp(2.5rem, 12vw, 5rem);
  }

  .section-cta .section-heading {
    font-size: clamp(1.6rem, 7vw, 2.5rem);
  }

  .marquee-text {
    font-size: 14vw;
  }
}

@media (max-width: 480px) {
  .hero-standalone {
    padding-bottom: 12vh;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .newsletter-form {
    flex-direction: column;
    border: none;
    gap: 0.5rem;
  }

  .newsletter-form input,
  .newsletter-form button {
    border: 1px solid rgba(245, 242, 237, 0.14);
    width: 100%;
  }

  .newsletter-form button {
    border-left: 1px solid rgba(245, 242, 237, 0.14);
  }
}
