/* ═════════════════════════════════════════════════════════════
   iProject v4 — overlay layer
   Adds: scroll progress, gradient-mesh hero, magnetic micro-interactions,
   line-by-line reveals, diagrammatic operating-model section.
   ═════════════════════════════════════════════════════════════ */

/* ─── Scroll progress (top hairline) ─────────────────────── */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), color-mix(in oklab, var(--accent) 60%, white));
  z-index: 100;
  will-change: width;
  transition: width 80ms linear;
}

/* ─── Hero v4 — gradient mesh + giant editorial type ─────── */
.hero-v4 {
  min-height: 100vh;
  padding: 140px var(--gutter) 80px;
}
.hero-gradient {
  /* deprecated — replaced by .hero-mesh CSS-only solution */
  display: none !important;
}

/* ── Hero headline ──
   MUST be visible by default. Earlier reveal approaches (transition, then
   keyframe) both failed because the headline's resting state was the hidden
   translateY(110%) and the animation/transition clock does not reliably tick
   in this render context. Resting state is now the VISIBLE state, full stop.
   (This selector is 4 classes deep — more specific than the generic
   `.split-lines .line > .line-inner` start rule — so it wins outright.) */
.hero-v4 .split-lines .line > .line-inner {
  transform: translateY(0);
  animation: none;
}

/* ── Full-screen looping video background ── */
.hero-video {
  position: absolute;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
/* With a video present, the CSS mesh is just a pre-load fallback behind it */
.hero-v4[data-variant="video"] .hero-mesh {
  z-index: -4;
}
/* Stronger, cooler scrim over video for headline legibility */
.hero-v4[data-variant="video"] .hero-overlay {
  background:
    radial-gradient(70% 60% at 20% 95%, color-mix(in oklab, var(--accent) 22%, transparent), transparent 60%),
    linear-gradient(180deg,
      color-mix(in oklab, var(--bg-0) 55%, transparent) 0%,
      color-mix(in oklab, var(--bg-0) 35%, transparent) 38%,
      color-mix(in oklab, var(--bg-0) 55%, transparent) 72%,
      var(--bg-0) 100%);
}

/* ── ShinyText: continuous left→right sweep, accent→white ── */
.shiny-text {
  background-image: linear-gradient(
    100deg,
    var(--accent) 0%,
    var(--accent) 35%,
    #ffffff 50%,
    var(--accent) 65%,
    var(--accent) 100%
  );
  background-size: 250% 100%;
  background-position: 150% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: shiny-sweep 3s linear infinite;
}
@keyframes shiny-sweep {
  0%   { background-position: 150% 0; }
  100% { background-position: -50% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .shiny-text { animation: none; background-position: 50% 0; }
}

/* CSS-only animated gradient mesh — single layered element, no filter:blur.
   Soft already from the radial-gradient stop curves; animated by transform. */
.hero-mesh {
  position: absolute; inset: 0;
  z-index: -3;
  overflow: hidden;
  background: var(--bg-0);
}
.mesh-blob {
  position: absolute;
  display: block;
  pointer-events: none;
  will-change: transform;
}
.mb-1 {
  width: 110vw; height: 110vh;
  left: -30vw; top: -10vh;
  background:
    radial-gradient(40% 35% at 30% 85%, color-mix(in oklab, var(--accent) 45%, transparent), transparent 70%),
    radial-gradient(35% 30% at 75% 25%, color-mix(in oklab, var(--accent) 32%, transparent), transparent 70%);
  opacity: 0.85;
  animation: mesh-drift-1 30s ease-in-out infinite alternate;
}
.mb-2 {
  width: 90vw; height: 90vh;
  right: -20vw; bottom: -20vh;
  background:
    radial-gradient(45% 40% at 70% 50%, rgba(139, 92, 246, 0.32), transparent 70%);
  opacity: 0.6;
  animation: mesh-drift-2 38s ease-in-out infinite alternate;
}
.mb-3 { display: none; }
@keyframes mesh-drift-1 {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(4vw, -3vh, 0); }
}
@keyframes mesh-drift-2 {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-3vw, 4vh, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .mesh-blob { animation: none; }
}
/* Subtle noise overlay — plain (no blend mode — compositor friendly) */
.hero-noise {
  position: absolute; inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.08;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
.hero-v4 .hero-overlay {
  background:
    radial-gradient(60% 50% at 20% 100%, color-mix(in oklab, var(--accent) 18%, transparent), transparent 60%),
    linear-gradient(180deg, color-mix(in oklab, var(--bg-0) 10%, transparent) 0%, color-mix(in oklab, var(--bg-0) 30%, transparent) 50%, var(--bg-0) 100%);
}
/* Cursor follower — lightweight, no blur filter, no blend mode */
.hero-v4 .hero-cursor {
  width: 480px; height: 480px;
  opacity: 0.6;
  mix-blend-mode: normal;
  filter: none;
  transition: opacity 0.4s var(--ease);
  background: radial-gradient(closest-side, color-mix(in oklab, var(--accent) 28%, transparent), transparent 72%);
}
.hero-v4:hover .hero-cursor { opacity: 0.95; }

/* Status chip */
.hero-status {
  position: absolute;
  top: 88px;
  right: var(--gutter);
  z-index: 2;
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-1);
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  background: color-mix(in oklab, var(--bg-0) 35%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.hero-status-dot {
  width: 7px; height: 7px;
  background: #4ade80;
  box-shadow: 0 0 12px #4ade80;
  border-radius: 50%;
  animation: pulse-dot 1.8s infinite;
}
.hero-status-sep { color: var(--fg-2); }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Coordinate eyebrow above hero title */
.hero-coord {
  margin-bottom: 28px;
  color: var(--fg-2);
}

/* Hero title — bigger, tighter, with split-line reveals */
.hero-title-v4 h1 {
  font-size: clamp(64px, 13vw, 220px);
  line-height: 0.9;
  letter-spacing: -0.04em;
  max-width: 16ch;
  font-weight: 400;
}
.split-lines .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;     /* descenders */
}
.split-lines .line > .line-inner {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 1.1s cubic-bezier(0.2, 0.7, 0.05, 1);
}
.split-lines.in .line > .line-inner { transform: translateY(0); }
.split-lines .line:nth-child(2) > .line-inner { transition-delay: 140ms; }
.split-lines .line:nth-child(3) > .line-inner { transition-delay: 280ms; }

/* Magnetic CTA — base styles + arrow slide */
.magnetic {
  display: inline-flex; align-items: center; gap: 14px;
  will-change: transform;
  transition: transform 200ms cubic-bezier(0.2, 0.7, 0.05, 1), border-color 200ms var(--ease), background 200ms var(--ease);
  position: relative;
  overflow: hidden;
}
.magnetic .arrow {
  transition: transform 240ms cubic-bezier(0.2, 0.7, 0.05, 1);
  display: inline-block;
}
.magnetic:hover .arrow { transform: translateY(3px); }
.hero-foot-cta.magnetic:hover .arrow { transform: translateY(4px); }

/* ═══════════════════ DIAGRAMMATIC MISSION ═══════════════════ */
.mission .mission-statement {
  margin-bottom: 96px;
}
.diagram {
  margin-top: 32px;
  padding: 28px 32px 36px;
  border: 1px solid color-mix(in oklab, var(--fg-0) 14%, transparent);
  background: color-mix(in oklab, var(--bg-1) 25%, transparent);
  position: relative;
}
/* Corner crops — engineering-drawing feel */
.diagram::before,
.diagram::after {
  content: '';
  position: absolute;
  width: 10px; height: 10px;
  border: 1px solid var(--accent);
}
.diagram::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.diagram::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.diagram-head {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px dashed color-mix(in oklab, var(--fg-0) 14%, transparent);
}
.diagram-head .dim { color: var(--fg-2); }

.diagram-grid {
  display: grid;
  grid-template-columns: 1fr 80px 1.15fr 80px 1fr;
  align-items: stretch;
  gap: 0;
}

/* Diagram nodes */
.d-node {
  position: relative;
  padding: 22px 22px 20px;
  border: 1px solid color-mix(in oklab, var(--fg-0) 18%, transparent);
  background: color-mix(in oklab, var(--bg-0) 6%, transparent);
  display: flex; flex-direction: column; gap: 14px;
  min-height: 260px;
  transition: transform 280ms var(--ease), border-color 280ms var(--ease), background 280ms var(--ease);
}
.d-node:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 4%, transparent);
}
.d-node-head {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.d-node-id { color: var(--fg-2); }
.d-node-kind { color: var(--accent); }
.d-node-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--fg-0);
}
.d-node-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 13.5px;
  color: var(--fg-1);
  line-height: 1.45;
}
.d-node-list .k {
  display: inline-block;
  width: 18px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
}
.d-node-meta {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px dashed color-mix(in oklab, var(--fg-0) 14%, transparent);
  color: var(--fg-2);
  font-size: 10.5px;
  letter-spacing: 0.18em;
}

/* Hub node — emphasized */
.d-node-hub {
  border-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 5%, transparent);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--accent) 25%, transparent) inset;
}
.d-node-hub .d-node-title {
  color: var(--accent);
  font-size: 32px;
}
.d-hub-rings {
  position: absolute;
  top: 14px; right: 14px;
  width: 56px; height: 56px;
  pointer-events: none;
}
.d-hub-rings .ring {
  position: absolute; inset: 0;
  border: 1px solid var(--accent);
  border-radius: 50%;
  opacity: 0;
  animation: hub-ring 3.2s infinite cubic-bezier(0.2, 0.7, 0.2, 1);
}
.d-hub-rings .ring:nth-child(2) { animation-delay: 1.0s; }
.d-hub-rings .ring:nth-child(3) { animation-delay: 2.0s; }
@keyframes hub-ring {
  0% { transform: scale(0.25); opacity: 0.9; }
  100% { transform: scale(1); opacity: 0; }
}

/* Connector arrows */
.d-link {
  width: 100%;
  height: 100%;
  align-self: center;
  min-height: 60px;
}
.d-link-bg {
  fill: none;
  stroke: color-mix(in oklab, var(--fg-0) 18%, transparent);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}
.d-link-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  transition: stroke-dashoffset 1.6s cubic-bezier(0.2, 0.7, 0.05, 1);
}
.reveal.in .d-link-fg,
.diagram.in .d-link-fg { stroke-dashoffset: 0; }
.d-link-pulse {
  fill: var(--accent);
  animation: d-link-fly 2.4s infinite cubic-bezier(0.4, 0, 0.6, 1);
}
@keyframes d-link-fly {
  0% { transform: translateX(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateX(200px); opacity: 0; }
}

/* Diagram caption row */
.diagram-caption {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  padding-top: 24px;
  border-top: 1px dashed color-mix(in oklab, var(--fg-0) 14%, transparent);
}
.d-cap {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13.5px;
  color: var(--fg-1);
  line-height: 1.5;
}
.d-cap .dim { color: var(--fg-2); letter-spacing: 0.2em; }
.d-cap b {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  color: var(--fg-0);
  letter-spacing: -0.01em;
  margin-top: 2px;
}

@media (max-width: 1000px) {
  .diagram-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .d-link {
    height: 60px;
    transform: rotate(90deg);
    transform-origin: center;
  }
  .diagram-caption { grid-template-columns: 1fr; gap: 18px; }
}

@media (max-width: 700px) {
  .hero-status { display: none; }
  .hero-coord { font-size: 10px; }
}

/* ─── Card tilt — capabilities + industries get subtle micro-tilt ─── */
.ind, .stat, .d-node, .cap-item, .client {
  will-change: transform;
}

/* ─── Stat hover — small lift ─── */
.stat {
  transition: transform 260ms var(--ease);
}
.stat:hover { transform: translateY(-3px); }

/* ─── Industries — bigger overlay treatment on hover ─── */
.ind { transition: transform 320ms var(--ease); }
.ind:hover { transform: translateY(-4px); }
.ind .ind-img img {
  transition: transform 800ms var(--ease), filter 600ms var(--ease);
}
.ind:hover .ind-img img {
  transform: scale(1.04);
  filter: contrast(1.05) saturate(1.05) brightness(0.5);
}

/* ═══════════════════ MISSION v5 — Option A pillars ═══════════════════ */
/* Section now inherits the dark page background (data-theme="light" removed). */
.mission-v5 .mission-statement .em.shiny-text {
  /* shiny-text already drives the gradient fill; keep the serif italic */
  font-family: var(--font-serif);
  font-style: italic;
}
.mission-pillars {
  margin-top: clamp(56px, 8vw, 104px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line-strong);
}
.mission-pillar {
  padding: 40px 44px 8px 0;
  border-right: 1px solid var(--line);
}
.mission-pillar:last-child { border-right: 0; padding-right: 0; }
.mission-pillar .mp-id {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--fg-2);
}
.mission-pillar h4 {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(26px, 2.8vw, 34px);
  letter-spacing: -0.01em;
  margin: 16px 0 16px;
  color: var(--fg-0);
}
.mission-pillar p {
  font-size: clamp(15px, 1.3vw, 17px);
  line-height: 1.55;
  color: var(--fg-1);
  margin: 0;
  max-width: 32ch;
}
@media (max-width: 860px) {
  .mission-pillars { grid-template-columns: 1fr; }
  .mission-pillar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 32px 0;
  }
  .mission-pillar:last-child { border-bottom: 0; }
}
