/* Vextra AI — cinematic layer: preloader, smooth-scroll systems, cursor,
   text reveals, section choreography, dark finale. Loads after style.css. */

:root {
  /* Soft Structuralism premium light theme overrides */
  --bg: oklch(98.2% 0.003 196);
  --surface: oklch(100% 0 0);
  --surface-2: oklch(96.3% 0.005 196);
  --border: oklch(92% 0.006 196);
  --border-strong: oklch(85% 0.01 196);
  --muted: oklch(48% 0.012 196);
  --muted-2: oklch(58% 0.012 196);

  --shadow-sm: 0 1px 3px rgba(28, 39, 51, 0.02);
  --shadow-md: 0 18px 48px -12px oklch(20% 0.02 196 / 0.04), 0 2px 8px -2px oklch(20% 0.02 196 / 0.02);
  --shadow-lg: 0 32px 80px -20px oklch(20% 0.03 196 / 0.06), 0 4px 16px -4px oklch(20% 0.03 196 / 0.03);
}

/* Subtle blueprint technical grid overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: 
    linear-gradient(to right, oklch(0% 0 0 / 0.015) 1px, transparent 1px),
    linear-gradient(to bottom, oklch(0% 0 0 / 0.015) 1px, transparent 1px);
  background-size: 54px 54px;
}

/* native scroll: fixed-nav offset for anchor jumps (replaces the old Lenis JS offset) */
html { scroll-padding-top: 80px; }

/* ---------- preloader: dark branded entrance ---------- */
.preloader {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, oklch(22% 0.035 196 / 0.9), transparent 70%),
    oklch(14% 0.024 196);
}
.preloader-inner { text-align: center; }
.preloader-mark { width: 64px; height: 64px; margin-inline: auto; margin-bottom: clamp(20px, 3vh, 36px); }
.preloader-mark .pl-path { stroke-dasharray: 60; stroke-dashoffset: 60; }
.preloader-mark .pl-dot { transform-origin: center; transform-box: fill-box; transform: scale(0); }

.preloader-word {
  display: flex; justify-content: center;
  font-family: var(--font-display);
  font-size: clamp(52px, 9vw, 128px);
  font-weight: 650; letter-spacing: -0.02em; line-height: 1;
  color: oklch(96% 0.008 196);
}
.preloader-word .pl-l { display: block; overflow: hidden; }
.preloader-word .pl-l > span { display: block; transform: translateY(115%); }
.preloader-word .pl-ai > span { color: transparent; -webkit-text-stroke: 2px oklch(70% 0.16 48); }

.preloader-tag {
  margin-top: clamp(16px, 2.5vh, 26px);
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  color: oklch(58% 0.02 196);
  opacity: 0;
}

.preloader-count {
  position: absolute; right: clamp(24px, 4vw, 64px); bottom: clamp(20px, 4vh, 48px);
  font-family: var(--font-mono);
  font-size: clamp(40px, 6vw, 84px); line-height: 1;
  color: oklch(38% 0.03 196);
  font-variant-numeric: tabular-nums;
}
.preloader-bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: oklch(24% 0.025 196); overflow: hidden;
}
.preloader-bar i {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, oklch(63% 0.115 196), oklch(70% 0.16 48));
  transform: scaleX(0); transform-origin: left;
}
.preloader.done { pointer-events: none; }

/* ---------- scroll progress ---------- */
.scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 200;
  background: linear-gradient(90deg, var(--teal), var(--orange));
  transform: scaleX(0); transform-origin: left;
}

/* ---------- cursor ring ---------- */
.cursor-ring {
  position: fixed; top: 0; left: 0; z-index: 999;
  width: 36px; height: 36px; margin: -18px 0 0 -18px;
  border: 1.5px solid oklch(63% 0.115 196 / 0.55);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: width 0.3s var(--ease), height 0.3s var(--ease), margin 0.3s var(--ease),
              border-color 0.3s var(--ease), opacity 0.3s var(--ease), background 0.3s var(--ease);
}
.cursor-ring.active { opacity: 1; }
.cursor-ring.is-link {
  width: 56px; height: 56px; margin: -28px 0 0 -28px;
  border-color: oklch(70% 0.16 48 / 0.7);
  background: oklch(70% 0.16 48 / 0.08);
}
@media (hover: none), (pointer: coarse) { .cursor-ring { display: none; } }

/* ---------- text reveal (per-line mask) ---------- */
.st-line { display: block; overflow: hidden; }
.st-line > span { display: block; transform: translateY(110%); }
.st-done .st-line > span { transform: none; }

/* ---------- hero dive ---------- */
.hero-flash {
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, oklch(98% 0.01 196), oklch(97.3% 0.008 196) 70%);
  opacity: 0;
}
.hero .hero-inner { will-change: transform, opacity; }

/* ---------- flow data pulses ---------- */
.flow-arrow svg { overflow: visible; }
.flow-pulse { fill: var(--orange); }

/* ---------- marquees: stroke-only outline text ---------- */
.marquee {
  overflow: hidden;
  border-block: 1px solid var(--border);
  padding-block: 18px;
}
.marquee-track {
  display: flex; white-space: nowrap; will-change: transform;
  font-family: var(--font-display);
  font-size: clamp(40px, 7vw, 96px);
  font-weight: 650; letter-spacing: -0.02em;
  text-transform: uppercase;
  opacity: 0.5;
}
.marquee-track span {
  flex: 0 0 auto;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--muted-2); /* muted teal-gray */
}
.marquee.m2 .marquee-track span { -webkit-text-stroke-color: var(--orange-deep); }

/* ---------- ERP roadmap line ---------- */
.roadmap { position: relative; }
.roadmap-line {
  position: absolute; left: 19px; top: 24px; bottom: 24px; width: 2px;
  background: var(--border); z-index: 0;
}
.roadmap-line i {
  display: block; width: 100%; height: 100%;
  background: linear-gradient(180deg, var(--teal), var(--orange));
  transform: scaleY(0); transform-origin: top;
}
.roadmap-step { position: relative; z-index: 1; }
.roadmap-step.lit .roadmap-dot {
  background: var(--teal); color: white; border-color: var(--teal);
  box-shadow: 0 0 0 5px oklch(63% 0.115 196 / 0.15);
}

/* ---------- AI panel ---------- */
.interview-q .type-caret {
  display: inline-block; width: 2px; height: 1em;
  background: var(--orange); vertical-align: text-bottom;
  animation: caret-blink 0.9s steps(1) infinite;
  margin-left: 2px;
}
@keyframes caret-blink { 50% { opacity: 0; } }
.wave {
  display: flex; align-items: center; gap: 3px; height: 26px; margin-top: 14px;
}
.wave i {
  width: 3px; border-radius: 2px; background: var(--teal);
  height: 30%; opacity: 0.7;
}
@media (prefers-reduced-motion: reduce) {
  .interview-q .type-caret { animation: none; }
}

/* ---------- AI feature row: dark mode, mirrors the AI chapter's identity ----------
   Real CSS background (not just the js/sections.js --bg scroll morph): .feature-row
   has no tint class here, so without this the light-colored text below would sit on
   the default light page background whenever the morph hasn't fired yet (or JS fails). */
#ai.feature-row { background: linear-gradient(160deg, oklch(16% 0.024 196), oklch(11% 0.02 196)); }
#ai.feature-row .kicker { color: var(--teal-soft); }
#ai.feature-row .interview-topbar .timer { color: oklch(62% 0.02 196); }
#ai.feature-row .feature-copy h3 { color: oklch(97% 0.006 196); }
#ai.feature-row .feature-copy p { color: oklch(70% 0.015 196); }
#ai.feature-row .feature-list li { color: oklch(88% 0.008 196); }
#ai.feature-row .interview-topbar .rec { color: var(--orange); }
#ai.feature-row .interview-topbar .rec::before { background: var(--orange); }
#ai.feature-row .interview-q { background: oklch(15% 0.022 196); border-color: oklch(30% 0.02 196); color: oklch(90% 0.008 196); }
#ai.feature-row .score-chip { background: oklch(15% 0.022 196); border-color: oklch(30% 0.02 196); }
#ai.feature-row .score-chip strong { color: oklch(96% 0.006 196); }
#ai.feature-row .score-chip span { color: oklch(62% 0.02 196); }
#ai.feature-row .score-bar { background: oklch(28% 0.02 196); }
#ai.feature-row .feature-visual { background: oklch(13% 0.02 196) !important; }
#ai.feature-row .feature-visual::before { background: oklch(15% 0.022 196) !important; border-color: oklch(30% 0.02 196) !important; }

/* ---------- custom software: blueprint ---------- */
.workflow-item { position: relative; }
.workflow-connector {
  position: absolute; left: 27px; top: 100%; height: 18px; width: 0;
  border-left: 2px dashed var(--border-strong); z-index: 0;
}
.workflow-item:last-child .workflow-connector { display: none; }

/* ---------- why: stat strip ---------- */
.stat-strip {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
  margin-top: clamp(36px, 5vw, 56px); padding-top: clamp(28px, 4vw, 40px);
  border-top: 1px solid var(--border);
}
.stat-strip .stat strong {
  display: block; font-family: var(--font-display); font-weight: 650;
  font-size: clamp(30px, 3.4vw, 44px); letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(100deg, var(--teal-deep), var(--orange-deep) 140%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.stat-strip .stat span { color: var(--muted); font-size: 14px; }
@media (max-width: 720px) { .stat-strip { grid-template-columns: repeat(2, 1fr); } }

/* ---------- contact: dark finale ---------- */
.contact.finale {
  position: relative;
  background: oklch(17% 0.028 196);
  color: oklch(94% 0.008 196);
  border-radius: clamp(20px, 3vw, 40px) clamp(20px, 3vw, 40px) 0 0;
  overflow: hidden;
}
#contact-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; opacity: 0.55;
}
.contact.finale .wrap { position: relative; z-index: 1; }
.contact.finale .kicker { color: oklch(78% 0.09 196); }
.contact.finale h2 { color: oklch(97% 0.005 196); }
.contact.finale .contact-info > p { color: oklch(72% 0.015 196); }
.contact.finale .contact-detail div strong { color: oklch(94% 0.008 196); }
.contact.finale .contact-detail div span { color: oklch(66% 0.015 196); }
.contact.finale .contact-detail svg { color: oklch(78% 0.09 196); }
.contact.finale .form {
  background: oklch(21% 0.03 196);
  border: 1px solid oklch(32% 0.03 196);
  box-shadow: 0 32px 80px -24px oklch(5% 0.02 196 / 0.6);
}
.contact.finale .field label { color: oklch(80% 0.012 196); }
.contact.finale .field input,
.contact.finale .field select,
.contact.finale .field textarea {
  background: oklch(17% 0.028 196);
  border-color: oklch(34% 0.03 196);
  color: oklch(94% 0.008 196);
}
.contact.finale .field input:focus,
.contact.finale .field select:focus,
.contact.finale .field textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px oklch(63% 0.115 196 / 0.25);
}
.contact.finale .form-status { color: oklch(72% 0.015 196); }

/* ---------- footer parallax reveal: content lifts off the fixed footer ---------- */
.page-lift {
  position: relative; z-index: 1;
  background: var(--bg);
  margin-bottom: var(--footer-h, 0px); /* set by js/sections.js from footer height */
}
.footer.dark {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 0;
  background: oklch(15% 0.026 196);
  color: oklch(80% 0.012 196);
  border-top: 1px solid oklch(28% 0.028 196);
}
.footer.dark .brand { color: oklch(94% 0.008 196); }
.footer.dark .footer-brand p { color: oklch(64% 0.015 196); }
.footer.dark .footer-col-title { color: oklch(88% 0.01 196); }
.footer.dark .footer-col a { color: oklch(68% 0.015 196); }
.footer.dark .footer-col a:hover { color: oklch(88% 0.01 196); }
.footer.dark .footer-bottom { color: oklch(56% 0.015 196); border-top-color: oklch(26% 0.026 196); }

/* ---------- film grain ---------- */
.grain {
  position: fixed; inset: 0; z-index: 90; /* above page content, below nav (100) */
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  animation: grain-shift 0.7s steps(1) infinite;
}
@keyframes grain-shift {
  0%    { background-position: 0 0; }
  12.5% { background-position: -32px 46px; }
  25%   { background-position: 58px -22px; }
  37.5% { background-position: -44px -38px; }
  50%   { background-position: 26px 54px; }
  62.5% { background-position: -58px 12px; }
  75%   { background-position: 38px -48px; }
  87.5% { background-position: -16px 28px; }
  100%  { background-position: 0 0; }
}

/* ================= premium polish layer ================= */

::selection { background: var(--teal-soft); color: var(--teal-deep); }

/* buttons — primary with nested trailing icon island, custom spring-like physics */
.btn {
  border-radius: var(--radius-pill) !important;
  padding: 10px 14px 10px 24px !important;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border-strong) !important;
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1), box-shadow 0.4s cubic-bezier(0.32, 0.72, 0, 1), background 0.4s cubic-bezier(0.32, 0.72, 0, 1) !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--ink) 0%, var(--teal-deep) 150%) !important;
  color: var(--surface) !important;
  border: 1px solid var(--ink) !important;
  box-shadow: 0 6px 20px -6px oklch(19% 0.03 196 / 0.25), inset 0 1px 0 oklch(100% 0 0 / 0.1);
}

.btn-primary:hover {
  /* fully covered by .btn-primary::after's teal->orange reveal (style.css) — this is the fallback beneath it */
  background: oklch(24% 0.03 196) !important;
  box-shadow: 0 12px 30px -8px oklch(19% 0.03 196 / 0.35), inset 0 1px 0 oklch(100% 0 0 / 0.15);
}

.btn-ghost {
  background: var(--surface) !important;
  color: var(--ink) !important;
  box-shadow: var(--shadow-sm);
}

.btn-ghost:hover {
  border-color: var(--ink) !important;
  background: var(--surface-2) !important;
}

/* Button Icon Island wrapper */
.btn-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1), background 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  color: currentColor;
  flex-shrink: 0;
}

.btn-ghost .btn-icon {
  background: rgba(0, 0, 0, 0.05);
}

.btn:hover {
  transform: scale(0.97) translateY(-1px);
}

.btn:hover .btn-icon {
  transform: translate(2px, -2px) scale(1.06);
}

.btn-primary:hover .btn-icon {
  background: rgba(255, 255, 255, 0.2);
}

.btn-ghost:hover .btn-icon {
  background: rgba(0, 0, 0, 0.08);
}

/* hero — soft brand glow washes behind content */
.hero { position: relative; }
.hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 42% 34% at 18% 22%, oklch(63% 0.115 196 / 0.10), transparent 70%),
    radial-gradient(ellipse 38% 30% at 84% 74%, oklch(70% 0.16 48 / 0.08), transparent 70%);
}
.hero-badge {
  backdrop-filter: blur(8px) saturate(1.3);
  border: 1px solid oklch(89% 0.014 196 / 0.9);
  box-shadow: 0 4px 16px -6px oklch(40% 0.08 196 / 0.18);
}

/* kicker dot glow */
.kicker::before { box-shadow: 0 0 8px oklch(70% 0.16 48 / 0.8); }

/* cards + panels — Doppelrand double-bezel card structure */
.flow-node, .feature-visual, .why-item, .form, .workflow-step {
  position: relative;
  background: rgba(0, 0, 0, 0.012) !important;
  border: 1px solid var(--border) !important;
  border-radius: 32px !important;
  padding: 34px 28px !important;
  box-shadow: none !important;
  overflow: visible !important;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.flow-node > *, .feature-visual > *, .why-item > *, .form > *, .workflow-step > * {
  position: relative;
  z-index: 2;
}

.flow-node::before, .feature-visual::before, .why-item::before, .form::before, .workflow-step::before {
  content: '';
  position: absolute;
  inset: 6px;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 26px;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  transition: border-color 0.4s var(--ease), box-shadow 0.4s var(--ease), background 0.4s var(--ease);
}

/* Specific inner spacing adjustments */
.flow-node { padding: 30px 24px !important; }
.flow-node::before { inset: 5px; border-radius: 27px; }

.why-item:hover, .flow-node:hover, .workflow-step:hover {
  transform: translateY(-4px);
}

.why-item:hover::before, .flow-node:hover::before, .workflow-step:hover::before {
  border-color: var(--teal);
  box-shadow: var(--shadow-lg);
  background: oklch(100% 0 0 / 0.99);
}

/* Contact form dark override to preserve its design contrast */
.contact.finale .form {
  background: rgba(255, 255, 255, 0.015) !important;
  border: 1px solid oklch(32% 0.03 196) !important;
}
.contact.finale .form::before {
  background: oklch(21% 0.03 196) !important;
  border-color: oklch(32% 0.03 196) !important;
  box-shadow: 0 32px 80px -24px oklch(5% 0.02 196 / 0.6);
}
.contact.finale .form-submit .btn-icon {
  background: rgba(255, 255, 255, 0.15);
}

/* Why section: monochrome ink mode — sets it apart from the colorful teal/orange modules */
.why-item svg {
  padding: 10px; border-radius: 12px;
  background: var(--ink); color: var(--teal-soft);
  box-sizing: content-box;
}

/* feature rows — giant soft brand orbs behind visuals */
.feature-row { position: relative; overflow: hidden; }
.feature-row::before {
  content: ''; position: absolute; pointer-events: none;
  width: 44vw; height: 44vw; border-radius: 50%;
  right: -12vw; top: 50%; transform: translateY(-50%);
  background: radial-gradient(circle, oklch(63% 0.115 196 / 0.10), transparent 65%);
}
.feature-row.rev::before { right: auto; left: -12vw; background: radial-gradient(circle, oklch(63% 0.115 196 / 0.08), transparent 65%); }
.feature-row.tint-orange::before { background: radial-gradient(circle, oklch(70% 0.16 48 / 0.12), transparent 65%); }
.feature-row .wrap { position: relative; z-index: 1; }

/* tags/chips — floating pill refinement */
.module-tags span {
  background: oklch(100% 0 0 / 0.85);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px -3px oklch(40% 0.06 196 / 0.15), inset 0 1px 0 oklch(100% 0 0 / 0.7);
}

/* marquees — soft edge fade */
.marquee {
  mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
}

/* contact finale — glow orbs behind content */
.contact.finale::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 40% 45% at 12% 20%, oklch(63% 0.115 196 / 0.14), transparent 68%),
    radial-gradient(ellipse 34% 38% at 88% 82%, oklch(70% 0.16 48 / 0.10), transparent 68%);
}
.contact.finale .form-submit {
  background: linear-gradient(135deg, var(--ink) -10%, var(--teal-deep) 55%, var(--teal) 130%);
  box-shadow: 0 12px 30px -10px oklch(63% 0.115 196 / 0.45), inset 0 1px 0 oklch(100% 0 0 / 0.2);
}
.contact.finale .form-submit:hover { box-shadow: 0 16px 40px -10px oklch(63% 0.115 196 / 0.6), inset 0 1px 0 oklch(100% 0 0 / 0.25); }

/* nav — stronger glass when scrolled */
.nav.scrolled { backdrop-filter: blur(14px) saturate(1.4); }

/* Custom full-width section styling */
.custom-section {
  padding: clamp(60px, 8vw, 110px) 0;
  border-top: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.custom-section::before {
  content: ''; position: absolute; pointer-events: none;
  width: 44vw; height: 44vw; border-radius: 50%;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(circle, oklch(70% 0.16 48 / 0.05), transparent 65%);
}

.custom-head {
  text-align: center;
  max-width: 680px;
  margin-inline: auto;
  margin-bottom: 56px;
}
.custom-head h3 {
  font-size: clamp(32px, 4vw, 48px);
  margin-top: 12px;
}
.custom-head p {
  color: var(--muted);
  font-size: 16px;
  margin-top: 14px;
}

.custom-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.workflow-step {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.workflow-step .idx {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-2);
  margin-bottom: 12px;
  display: block;
}

.workflow-step h4 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 10px 0;
}

.workflow-step p {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
  flex: 1;
}

.workflow-step .step-indicator {
  margin-top: 24px;
  display: flex;
  gap: 6px;
}
.workflow-step .step-indicator em {
  font-style: normal;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: block;
}

@media (max-width: 1024px) {
  .custom-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .custom-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- reduced motion: neutralize hidden initial states ---------- */
@media (prefers-reduced-motion: reduce) {
  .st-line > span { transform: none; }
  .preloader { display: none; }
  .grain { animation: none; }
  .marquee-track span + span { display: none; } /* static single row, no loop */
}
