/* =====================================================
   OperationsEdge — Homepage v4 "Journey"
   Scroll-driven 3D warehouse scene + light editorial
   Reference architecture: scroll-scrubbed scene, sticky
   step list, flat editorial sections after the 3D act.
   ===================================================== */

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

:root {
  --ink: #0e1419;
  --ink-soft: rgba(14, 20, 25, .72);
  --ink-mute: rgba(14, 20, 25, .52);
  --paper: #fbfcfe;
  --mist: #d9e4ee;
  --line: rgba(14, 20, 25, .12);
  --brand: #1b609d;
  --brand-light: #4a9bd4;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --max-w: 1280px;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 3rem); }

h1, h2, h3 { font-weight: 650; letter-spacing: -0.03em; line-height: 1.04; }

.eyebrow {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* --- Header --- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  padding: 1.1rem 0;
  transition: background .35s, box-shadow .35s, padding .35s;
}
.site-header.scrolled {
  background: rgba(251, 252, 254, .82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--line);
  padding: .7rem 0;
}
.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}
.header-nav { display: flex; gap: 1.75rem; }
.header-nav a {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  transition: color .2s;
}
.header-nav a:hover { color: var(--ink); }
.header-logo {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: .26em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
}
.header-logo span { color: var(--brand); }
.header-ctas { display: flex; gap: .6rem; justify-content: flex-end; }

.pill {
  display: inline-block;
  padding: .72rem 1.5rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  transition: transform .25s cubic-bezier(.22,1,.36,1), background .2s, color .2s;
  white-space: nowrap;
}
.pill:hover { transform: translateY(-1px); }
.pill--ghost { background: rgba(255,255,255,.55); color: var(--ink); backdrop-filter: blur(8px); }
.pill--ghost:hover { background: rgba(255,255,255,.85); }
.pill--dark { background: var(--ink); color: #fff; }
.pill--dark:hover { background: #21303d; }
.pill--brand { background: var(--brand); color: #fff; }
.pill--brand:hover { background: #174f82; }

/* --- Scene canvas --- */
#scene-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}
.no-webgl #scene-canvas { display: none; }
.no-webgl .scene-scroll { background: var(--mist); }

.scene-scroll { position: relative; z-index: 1; }

/* --- Hero --- */
.hero {
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: 0 1.5rem;
}
.hero h1 {
  font-size: clamp(2.9rem, 7.2vw, 5.6rem);
  max-width: 14ch;
  opacity: 0;
  transform: translateY(26px);
  animation: hero-in 1s cubic-bezier(.22,1,.36,1) .15s forwards;
}
.hero .hero-sub {
  margin-top: 1.4rem;
  max-width: 34rem;
  font-size: clamp(.95rem, 1.4vw, 1.08rem);
  color: var(--ink-soft);
  opacity: 0;
  transform: translateY(22px);
  animation: hero-in 1s cubic-bezier(.22,1,.36,1) .35s forwards;
}
.hero-eyebrow {
  margin-bottom: 1.25rem;
  opacity: 0;
  animation: hero-in 1s cubic-bezier(.22,1,.36,1) .05s forwards;
}
@keyframes hero-in { to { opacity: 1; transform: translateY(0); } }

.hero-scroll {
  position: absolute;
  bottom: 2.2rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: .64rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: .7rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.4);
  backdrop-filter: blur(6px);
  animation: bob 2.6s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translate(-50%,0); } 50% { transform: translate(-50%,6px); } }
.no-motion .hero-scroll, .no-motion .hero h1, .no-motion .hero .hero-sub, .no-motion .hero-eyebrow { animation: none; opacity: 1; transform: none; }

/* --- Flow (the 3D act) --- */
.flow { height: 420vh; position: relative; }
.no-motion .flow { height: auto; padding: 4rem 0; }
.flow__steps {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .4rem;
  max-width: 30rem;
  padding-left: clamp(1.25rem, 5vw, 4.5rem);
  padding-right: 1.25rem;
}
.flow__steps::before {
  content: '';
  position: absolute;
  inset: 0 -4rem 0 0;
  background: linear-gradient(to right, rgba(217, 228, 238, .9) 0%, rgba(217, 228, 238, .55) 55%, transparent 100%);
  pointer-events: none;
  z-index: -1;
}
.no-motion .flow__steps { position: static; height: auto; }
.flow__step { position: relative; padding: .55rem 0 .55rem 3.4rem; }
.flow__num {
  position: absolute;
  left: 0;
  top: .45rem;
  width: 2.4rem;
  height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: .72rem;
  border-radius: .8rem;
  color: var(--ink-mute);
  transition: all .4s cubic-bezier(.22,1,.36,1);
}
.flow__step.is-active .flow__num {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 6px 24px rgba(14,32,48,.14);
}
.flow__title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink-mute);
  transition: all .4s cubic-bezier(.22,1,.36,1);
  cursor: default;
}
.flow__step.is-active .flow__title { font-size: 1.45rem; color: var(--ink); }
.flow__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .55s cubic-bezier(.22,1,.36,1), opacity .45s;
  opacity: 0;
}
.flow__step.is-active .flow__body, .no-motion .flow__body { grid-template-rows: 1fr; opacity: 1; }
.flow__body-inner { overflow: hidden; }
.flow__body p {
  padding: .8rem 0 .35rem;
  font-size: .92rem;
  color: var(--ink-soft);
  border-left: 2px solid var(--line);
  padding-left: 1rem;
  margin-left: .1rem;
}
.flow__body a {
  display: inline-block;
  margin: .2rem 0 .4rem 1.1rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--brand);
}
.flow__body a:hover { text-decoration: underline; }
.flow__track {
  position: absolute;
  left: 1.15rem;
  top: 3.1rem;
  bottom: 0;
  width: 2px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  opacity: 0;
  transition: opacity .3s;
}
.flow__step.is-active .flow__track { opacity: 1; }
.flow__track i {
  position: absolute;
  inset: 0;
  background: var(--brand);
  transform-origin: top;
  transform: scaleY(var(--fill, 0));
}

/* fade the scene out into paper */
.scene-tail {
  height: 26vh;
  background: linear-gradient(to bottom, transparent, var(--paper) 78%);
  position: relative;
  z-index: 1;
}

/* --- Editorial sections after the scene --- */
.after-scene { position: relative; z-index: 2; background: var(--paper); }
.section { padding: clamp(4rem, 9vw, 7.5rem) 0; }
.section-title {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  max-width: 22ch;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

/* feature cards — hairline separated columns */
.feature-row { display: grid; grid-template-columns: repeat(4, 1fr); }
.feature {
  padding: 2.2rem 1.8rem 2.6rem;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: background .3s;
}
.feature:hover { background: rgba(27, 96, 157, .035); }
.feature-icon { width: 42px; height: 42px; color: var(--brand); }
.feature-icon svg { width: 100%; height: 100%; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.feature h3 { font-size: 1.12rem; font-weight: 650; }
.feature p { font-size: .9rem; color: var(--ink-soft); flex: 1; }
.feature a { font-size: .8rem; font-weight: 600; color: var(--brand); }
.feature a:hover { text-decoration: underline; }

/* case study list — editorial rows */
.case-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: clamp(1rem, 3vw, 3rem);
  align-items: baseline;
  padding: 1.6rem 0;
  border-top: 1px solid var(--line);
  transition: background .25s, padding-left .35s cubic-bezier(.22,1,.36,1);
}
.case-row:last-of-type { border-bottom: 1px solid var(--line); }
.case-row:hover { background: rgba(27, 96, 157, .03); padding-left: .8rem; }
.case-row .case-meta { font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-mute); white-space: nowrap; }
.case-row h3 { font-size: clamp(1.05rem, 2vw, 1.45rem); font-weight: 600; max-width: 36ch; }
.case-row .case-stat { font-family: var(--mono); font-size: .8rem; color: var(--brand); white-space: nowrap; }

/* about strip */
.about-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(2rem, 6vw, 6rem); align-items: center; }
.about-grid p { color: var(--ink-soft); margin-bottom: 1rem; max-width: 52ch; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 1.2rem; overflow: hidden; }
.stat-cell { background: var(--paper); padding: 1.6rem 1.4rem; }
.stat-cell b { display: block; font-size: 2.1rem; font-weight: 700; letter-spacing: -0.03em; color: var(--brand); }
.stat-cell span { font-size: .76rem; color: var(--ink-mute); }

/* newsletter */
.newsletter {
  background: var(--mist);
  border-radius: 2rem;
  padding: clamp(2.5rem, 6vw, 5rem);
  text-align: center;
}
.newsletter h2 { font-size: clamp(1.6rem, 3.4vw, 2.6rem); max-width: 24ch; margin: .6rem auto 0; }
.newsletter p { color: var(--ink-soft); max-width: 42ch; margin: 1rem auto 1.8rem; font-size: .95rem; }
.newsletter-form { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.newsletter-form input {
  font: inherit;
  font-size: .9rem;
  padding: .8rem 1.4rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  min-width: min(20rem, 70vw);
  outline: none;
}
.newsletter-form input:focus { border-color: var(--brand); }
.newsletter-form button { font: inherit; border: 0; cursor: pointer; }
.newsletter-small { font-family: var(--mono); font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-mute); margin-top: 1.2rem; }
.newsletter-success { display: none; color: var(--brand); font-weight: 600; margin-top: 1rem; }

/* footer */
.site-footer { border-top: 1px solid var(--line); padding: 3.5rem 0 2.5rem; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 2.5rem; }
.footer-brand { font-weight: 800; letter-spacing: .2em; text-transform: uppercase; font-size: .95rem; }
.footer-brand span { color: var(--brand); }
.footer-tagline { font-size: .85rem; color: var(--ink-soft); margin-top: .8rem; max-width: 34ch; }
.footer-note { font-size: .72rem; color: var(--ink-mute); margin-top: .6rem; max-width: 38ch; }
.site-footer h4 { font-family: var(--mono); font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 1rem; font-weight: 500; }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: .55rem; }
.footer-links a { font-size: .88rem; color: var(--ink-soft); }
.footer-links a:hover { color: var(--brand); }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; border-top: 1px solid var(--line); padding-top: 1.6rem; font-size: .75rem; color: var(--ink-mute); }
.footer-bottom a { margin-left: 1.2rem; }
.footer-bottom a:hover { color: var(--brand); }

/* --- responsive --- */
@media (max-width: 920px) {
  .header-nav { display: none; }
  .header-inner { grid-template-columns: auto 1fr; }
  .header-logo { text-align: left; }
  .feature-row { grid-template-columns: 1fr 1fr; }
  .feature:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .about-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .header-ctas .pill--ghost { display: none; }
  .feature-row { grid-template-columns: 1fr; }
  .feature { border-left: 0; border-top: 1px solid var(--line); }
  .case-row { grid-template-columns: 1fr; gap: .35rem; }
  .flow__steps { max-width: 100%; }
  .flow { height: 460vh; }
}

/* =====================================================
   Inner pages — v4 layers
   ===================================================== */

/* --- Page hero (with optional 3D vignette) --- */
.page-hero {
  position: relative;
  min-height: 64vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: var(--mist);
}
.page-hero--compact { min-height: 38vh; }
.page-hero .vignette-holder { position: absolute; inset: 0; }
.page-hero .vignette-canvas { width: 100%; height: 100%; display: block; }
.page-hero.no-webgl .vignette-holder { display: none; }
.page-hero-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to right, rgba(217, 228, 238, .88) 0%, rgba(217, 228, 238, .35) 45%, transparent 70%),
    linear-gradient(to top, rgba(217, 228, 238, .92) 0%, transparent 30%);
}
.page-hero .container {
  position: relative;
  z-index: 1;
  width: 100%;
  padding-top: 7rem;
  padding-bottom: clamp(2.5rem, 6vw, 4.5rem);
}
.page-hero h1 {
  font-size: clamp(2.2rem, 5.4vw, 4rem);
  max-width: 18ch;
  margin: .9rem 0 1.1rem;
}
.page-hero .page-hero-sub {
  max-width: 36rem;
  color: var(--ink-soft);
  font-size: clamp(.95rem, 1.3vw, 1.05rem);
}
.page-hero [data-rise] {
  opacity: 0;
  transform: translateY(22px);
  animation: rise .9s cubic-bezier(.22,1,.36,1) forwards;
}
.page-hero [data-rise="2"] { animation-delay: .14s; }
.page-hero [data-rise="3"] { animation-delay: .28s; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* --- Scroll reveal (chrome.js) --- */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .6s cubic-bezier(.22,1,.36,1), transform .6s cubic-bezier(.22,1,.36,1);
}
[data-reveal].visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal], .page-hero [data-rise] { opacity: 1; transform: none; animation: none; transition: none; }
}

/* --- Tags & meta --- */
.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: .3rem .7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
}
.tag--brand { border-color: rgba(27, 96, 157, .35); color: var(--brand); }

/* --- Featured case panels (competency pages) --- */
.case-feature {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  padding: clamp(1.6rem, 3.5vw, 2.6rem);
  margin-bottom: 1.4rem;
  transition: transform .4s cubic-bezier(.22,1,.36,1), border-color .3s, box-shadow .4s;
}
.case-feature:hover {
  transform: translateY(-3px);
  border-color: rgba(27, 96, 157, .4);
  box-shadow: 0 18px 50px rgba(14, 32, 48, .08);
}
.case-feature h2 { font-size: clamp(1.15rem, 2.2vw, 1.5rem); margin: .7rem 0 .6rem; }
.case-feature h2 a { color: inherit; }
.case-feature h2 a:hover { color: var(--brand); }
.case-feature p { color: var(--ink-soft); font-size: .92rem; max-width: 56ch; }
.case-feature .case-meta-row { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; font-size: .78rem; color: var(--ink-mute); }
.case-feature .case-points { display: flex; gap: 1.4rem; flex-wrap: wrap; font-size: .8rem; color: var(--ink-mute); margin: .9rem 0 1.3rem; }
.case-stat-big { text-align: center; min-width: 8rem; }
.case-stat-big b { display: block; font-size: clamp(2.2rem, 4vw, 3rem); font-weight: 750; letter-spacing: -0.03em; color: var(--brand); line-height: 1; }
.case-stat-big span { font-size: .72rem; color: var(--ink-mute); display: block; margin-top: .4rem; max-width: 11rem; }
@media (max-width: 640px) { .case-feature { grid-template-columns: 1fr; } .case-stat-big { text-align: left; } }

/* --- Quote / context panel --- */
.context-panel {
  border-left: 3px solid var(--brand);
  background: rgba(27, 96, 157, .04);
  border-radius: 0 1.2rem 1.2rem 0;
  padding: clamp(1.4rem, 3vw, 2.2rem);
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
.context-panel blockquote { font-size: 1.08rem; line-height: 1.65; font-weight: 500; max-width: 60ch; }
.context-panel blockquote + p { margin-top: .9rem; font-size: .88rem; color: var(--ink-soft); max-width: 64ch; }

/* --- Article prose --- */
.article-wrap { max-width: 46rem; margin: 0 auto; }
.article-head { padding: 7.5rem 0 2.5rem; }
.article-head h1 { font-size: clamp(1.9rem, 4.4vw, 3rem); max-width: 24ch; margin: 1rem 0; }
.article-head .article-standfirst { font-size: 1.06rem; color: var(--ink-soft); max-width: 56ch; }
.article-meta { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-mute); }
.prose { font-family: 'Source Serif 4', Georgia, serif; font-size: 1.08rem; line-height: 1.75; color: #1d2730; }
.prose p, .prose ul, .prose ol { margin-bottom: 1.25rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: .45rem; }
.prose h2 { font-family: var(--font); font-size: 1.55rem; margin: 2.6rem 0 1rem; }
.prose h3 { font-family: var(--font); font-size: 1.18rem; margin: 2rem 0 .8rem; }
.prose a { color: var(--brand); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.prose blockquote {
  border-left: 3px solid var(--brand);
  padding: .4rem 0 .4rem 1.3rem;
  margin: 1.8rem 0;
  font-style: italic;
  color: var(--ink-soft);
}
.prose table { width: 100%; border-collapse: collapse; font-family: var(--font); font-size: .88rem; margin: 1.6rem 0; }
.prose th { font-family: var(--mono); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-mute); text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--ink); }
.prose td { padding: .65rem .8rem; border-bottom: 1px solid var(--line); }
.stat-callout {
  font-family: var(--font);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  padding: 1.5rem 1.8rem;
  margin: 2rem 0;
  display: flex;
  gap: 2rem;
  align-items: center;
  flex-wrap: wrap;
}
.stat-callout b { font-size: 2.2rem; font-weight: 750; letter-spacing: -0.03em; color: var(--brand); line-height: 1; }
.stat-callout span { font-size: .85rem; color: var(--ink-soft); max-width: 30ch; }

/* --- Contact form --- */
.form-grid { display: grid; gap: 1rem; max-width: 36rem; }
.form-grid label { font-family: var(--mono); font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-mute); display: block; margin-bottom: .4rem; }
.form-grid input, .form-grid textarea {
  font: inherit;
  font-size: .95rem;
  width: 100%;
  padding: .85rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #fff;
  outline: none;
  transition: border-color .2s;
}
.form-grid input:focus, .form-grid textarea:focus { border-color: var(--brand); }
.form-grid button { font: inherit; border: 0; cursor: pointer; justify-self: start; }
