/* ============================================================
   STATS BENTO — asymmetric grid with offset cells, decorative
   accents and a sparkline on the uptime stat
   ============================================================ */
.stats-bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  align-items: stretch;
}
.stat-cell {
  position: relative;
  padding: 32px 28px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 18px 40px -24px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  transition:
    transform 420ms cubic-bezier(.2,.7,.2,1),
    border-color 320ms cubic-bezier(.2,.6,.2,1),
    box-shadow 420ms cubic-bezier(.2,.7,.2,1),
    background-color 320ms ease;
}
/* Sweeping accent gradient that crosses the card on hover */
.stat-cell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 0%, transparent 38%,
    color-mix(in oklab, var(--accent-color, #C6FF3D) 22%, transparent) 50%,
    transparent 62%, transparent 100%);
  transform: translateX(-110%);
  transition: transform 800ms cubic-bezier(.2,.7,.2,1);
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.85;
}
.stat-cell:hover::before { transform: translateX(110%); }
.stat-cell:hover {
  border-color: color-mix(in oklab, var(--accent-color, #C6FF3D) 38%, rgba(255,255,255,0.1));
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-4px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 28px 60px -24px rgba(0, 0, 0, 0.7),
    0 0 0 1px color-mix(in oklab, var(--accent-color, #C6FF3D) 18%, transparent);
}
.stat-cell--lg   { grid-column: span 5; }
.stat-cell--md   { grid-column: span 4; }
.stat-cell--tall { grid-column: span 3; padding-bottom: 70px; }
/* Tall (narrow) cell — shrink the big number so it fits with the % suffix */
.stat-cell--tall .stat-num { font-size: clamp(40px, 4.5vw, 72px); }

/* Corner brackets brighten on hover */
.stat-cell:hover .stat-cell__corner { border-color: var(--accent-color, #C6FF3D); }
.stat-cell__corner { transition: border-color 320ms ease; }

/* Number scales up subtly */
.stat-cell .stat-num { transition: transform 420ms cubic-bezier(.2,.7,.2,1), letter-spacing 420ms ease; }
.stat-cell:hover .stat-num { transform: translateX(2px); letter-spacing: -0.01em; }

/* Sparkline brightens */
.stat-cell__sparkline { transition: opacity 320ms ease; }
.stat-cell:hover .stat-cell__sparkline { opacity: 0.95; }

/* Accent rule on lg cell extends */
.stat-cell__rule { transition: background 420ms ease; }
.stat-cell--lg:hover .stat-cell__rule {
  background: linear-gradient(90deg, var(--accent-color, #C6FF3D) 0%, color-mix(in oklab, var(--accent-color, #C6FF3D) 30%, transparent) 100%);
  opacity: 1;
}
@media (max-width: 900px) {
  .stats-bento { grid-template-columns: 1fr; }
  .stat-cell--lg, .stat-cell--md, .stat-cell--tall { grid-column: 1 / -1; padding-bottom: 32px; }
}

/* Decorative corner brackets */
.stat-cell__corner {
  position: absolute;
  width: 18px; height: 18px;
  border-color: rgba(198, 255, 61, 0.55);
  pointer-events: none;
}
.stat-cell__corner--tl { top: 8px;    left: 8px;    border-top:  1px solid; border-left:  1px solid; }
.stat-cell__corner--tr { top: 8px;    right: 8px;   border-top:  1px solid; border-right: 1px solid; }
.stat-cell__corner--bl { bottom: 8px; left: 8px;    border-bottom: 1px solid; border-left: 1px solid; }
.stat-cell__corner--br { bottom: 8px; right: 8px;   border-bottom: 1px solid; border-right: 1px solid; }
html[data-mood="midnight"] .stat-cell__corner { border-color: rgba(94, 234, 212, 0.55); }
html[data-mood="solar"]    .stat-cell__corner { border-color: rgba(184, 65, 43, 0.55); }

/* Horizontal accent rule on the lg cell */
.stat-cell__rule {
  margin-top: 22px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent-color, #C6FF3D) 0%, transparent 80%);
  opacity: 0.6;
}

/* Sparkline at the bottom of the tall cell */
.stat-cell__sparkline {
  position: absolute;
  left: 28px; right: 28px; bottom: 24px;
  color: var(--accent-color, #C6FF3D);
  opacity: 0.55;
  height: 28px;
}
.stat-cell__sparkline svg { width: 100%; height: 100%; display: block; }

/* ============================================================
   PILLAR BENTO — 2 columns × 2 rows, asymmetric widths
   Layout (lg): col 1 = 7fr, col 2 = 5fr (P1+P3 wider, P2+P4 narrow)
   ============================================================ */
.pillar-bento {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: 16px;
  align-items: stretch;
}
.pillar-card {
  /* override the older bg-ink padding rules with tighter spacing */
  padding: 22px 24px 24px !important;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
/* No span hacks needed — pillars naturally tile 2×2 */
.pillar-card--wide,
.pillar-card--tall { grid-column: auto; grid-row: auto; }

@media (max-width: 1024px) {
  .pillar-bento { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .pillar-bento { grid-template-columns: 1fr; }
}
.pillar-card__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.pillar-card__title {
  font-size: clamp(20px, 1.6vw, 24px);
  font-weight: 500;
  line-height: 1.15;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.pillar-card__lede {
  color: #8B95A7;
  font-size: 13.5px;
  line-height: 1.55;
  margin-bottom: 16px;
  max-width: 460px;
}
.pillar-card__list {
  font-family: "JetBrains Mono", monospace;
  font-size: 12.5px;
  color: #C8CDD6;
  display: grid;
  gap: 7px;
  margin-top: auto;
}
.pillar-card__list li {
  display: flex; align-items: center; gap: 10px;
}

/* ============================================================
   PROGRESS RAIL — dotted progress bar under nav with section ticks
   ============================================================ */
.progress-rail {
  position: fixed;
  top: 68px;                          /* directly under nav */
  left: 0; right: 0;
  height: 28px;
  pointer-events: none;
  z-index: 49;
  display: flex;
  align-items: center;
  padding: 0 24px;
  font-family: "JetBrains Mono", monospace;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 320ms var(--ease-out),
    transform 320ms var(--ease-out);
}
.progress-rail.show {
  opacity: 1;
  transform: translateY(0);
}
.progress-rail__track {
  position: relative;
  flex: 1;
  height: 1px;
  /* dotted line: tiny dots every 6px */
  background-image: radial-gradient(circle, currentColor 0.5px, transparent 1px);
  background-size: 6px 1px;
  background-repeat: repeat-x;
  color: rgba(255, 255, 255, 0.18);
}
.progress-rail__tick {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.35);
  background: var(--page-bg, #0A0E14);
  padding: 0 6px;
  transition: color 280ms var(--ease-out);
}
.progress-rail__tick.passed {
  color: rgba(255, 255, 255, 0.7);
}
.progress-rail__tick.active {
  color: var(--accent-color, #C6FF3D);
}

/* The moving knob — small accent dot with halo */
.progress-rail__knob {
  position: absolute;
  top: 50%;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent-color, #C6FF3D);
  transform: translate(-50%, -50%);
  transition: left 240ms var(--ease-out);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.04),
    0 0 14px 2px var(--accent-color, #C6FF3D);
}
.progress-rail__knob::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--accent-color, #C6FF3D);
  opacity: 0.4;
  animation: knob-pulse 2.4s var(--ease-out) infinite;
}
@keyframes knob-pulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50%      { transform: scale(1.6); opacity: 0; }
}

/* Mood-aware colors via CSS vars on <html> */
html { --accent-color: #C6FF3D; --page-bg: #0A0E14; }
html[data-mood="solar"]    { --accent-color: #B8412B; --page-bg: #F2EBDD; }
html[data-mood="midnight"] { --accent-color: #5EEAD4; --page-bg: #050B1A; }

/* ============================================================
   FOOTER LINKS — clean underline-on-hover, accent-aware
   ============================================================ */
.footer-link {
  position: relative;
  color: #C8CDD6;
  transition: color var(--t-micro) var(--ease-out);
  display: inline-block;
}
.footer-link::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: -2px;
  height: 1px;
  background: currentColor;
  transition: right 380ms var(--ease-out);
}
.footer-link:hover {
  color: var(--accent-color, #C6FF3D);
}
html[data-mood="midnight"] .footer-link:hover { color: #5EEAD4; }
html[data-mood="solar"]    .footer-link:hover { color: #B8412B; }
.footer-link:hover::after { right: 0; }

/* ============================================================
   LIQUID GLASS — applied to all card-style surfaces
   ============================================================
   Translucent base + backdrop blur + inner highlight + soft
   accent edge glow. Layered on top of existing .card / .bg-ink
   utility classes without breaking the mood overrides. */

.card,
.pillar-card,
.bg-ink.p-8,
.bg-ink.p-10,
.bg-ink.p-7 {
  position: relative;
  background: rgba(255, 255, 255, 0.03) !important;
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.07) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.30),
    0 1px 0 rgba(255, 255, 255, 0.02),
    0 18px 40px -24px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

/* Top inner highlight — subtle white sheen along the top edge,
   reinforces the glass surface */
.card::before,
.pillar-card::before,
.bg-ink.p-8::before,
.bg-ink.p-10::before,
.bg-ink.p-7::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(255, 255, 255, 0.10) 0%, transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, transparent 30%);
  mix-blend-mode: screen;
  opacity: 0.85;
  z-index: 0;
}
/* Keep card content above the highlight pseudo */
.card > *,
.pillar-card > *,
.bg-ink.p-8 > *,
.bg-ink.p-10 > *,
.bg-ink.p-7 > * { position: relative; z-index: 1; }

/* Mood-tinted glass — operator (default) keeps neutral white sheen.
   Solar / midnight take their accent in the inner glow. */
html[data-mood="midnight"] .card,
html[data-mood="midnight"] .pillar-card,
html[data-mood="midnight"] .bg-ink.p-8,
html[data-mood="midnight"] .bg-ink.p-10,
html[data-mood="midnight"] .bg-ink.p-7 {
  background: rgba(94, 234, 212, 0.025) !important;
  border-color: rgba(94, 234, 212, 0.10) !important;
  box-shadow:
    inset 0 1px 0 rgba(94, 234, 212, 0.07),
    inset 0 -1px 0 rgba(0, 0, 0, 0.40),
    0 18px 40px -24px rgba(0, 0, 0, 0.65);
}
html[data-mood="solar"] .card,
html[data-mood="solar"] .pillar-card,
html[data-mood="solar"] .bg-ink.p-8,
html[data-mood="solar"] .bg-ink.p-10,
html[data-mood="solar"] .bg-ink.p-7 {
  background: rgba(255, 255, 255, 0.32) !important;
  border-color: rgba(26, 22, 16, 0.08) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(26, 22, 16, 0.07),
    0 18px 40px -24px rgba(26, 22, 16, 0.18);
}

/* Hover: stronger glass — lifts, brightens, accent halo */
.card:hover,
.bg-ink.p-7:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

/* ============================================================
   NEOXIS — Premium animation layer
   ============================================================
   Easing curves
     --ease-out  → entrances (decelerating)
     --ease-in   → exits (accelerating)
   Durations
     --t-large   → hero / large reveals
     --t-mid     → section reveals, card reveals
     --t-micro   → hover states, button states
   ============================================================ */

:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:  cubic-bezier(0.7, 0, 0.84, 0);
  --t-large:  900ms;
  --t-mid:    600ms;
  --t-micro:  320ms;
}

/* ---------- A11y: kill non-essential motion --------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .anim-pulse, .anim-float, .anim-glow,
  .stat-num[data-count] { animation: none !important; }
}

/* ============================================================
   HERO
   ============================================================ */

/* Word-by-word stagger reveal for the headline. The headline lives in
   a normal element; we wrap each word in <span class="hword"> at runtime
   so we can stagger transition-delay. */
.hword {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.6em);
  transition:
    opacity var(--t-large) var(--ease-out),
    transform var(--t-large) var(--ease-out);
  /* per-word delay applied via inline style */
}
.hword.in {
  opacity: 1;
  transform: translateY(0);
}

/* Subline + CTA: fade in after the headline finishes */
.hero-after {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity var(--t-mid) var(--ease-out),
    transform var(--t-mid) var(--ease-out);
}
.hero-after.in {
  opacity: 1;
  transform: translateY(0);
}

/* CTA — soft pulse glow on the accent color, every 4s */
.cta-pulse {
  position: relative;
  isolation: isolate;
  animation: cta-breathe 4s var(--ease-out) infinite;
}
.cta-pulse::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: currentColor;
  opacity: 0;
  z-index: -1;
  filter: blur(14px);
  animation: cta-glow 4s var(--ease-out) infinite;
}
@keyframes cta-breathe {
  0%, 100% { transform: scale(1); }
  45%, 55% { transform: scale(1.03); }
}
@keyframes cta-glow {
  0%, 100% { opacity: 0; }
  45%, 55% { opacity: 0.18; }
}

/* Hero background sphere — cursor parallax (max 15px) */
#hero-canvas-wrap, .hero-canvas-wrap {
  transition: transform 600ms var(--ease-out);
  will-change: transform;
}

/* Scroll indicator — bouncing arrow that fades after first scroll */
.scroll-cue {
  transition: opacity 500ms var(--ease-out);
}
.scroll-cue.gone {
  opacity: 0;
  pointer-events: none;
}

/* ============================================================
   STATS — number count-up
   ============================================================ */
.stat-num[data-count] {
  /* counter handled by JS; ensure no layout shift while counting */
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   CAPABILITIES — pillar cards
   ============================================================ */

/* Slight scale + fade-in on enter (overrides .reveal scale axis) */
.pillar-reveal {
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  transition:
    opacity var(--t-large) var(--ease-out),
    transform var(--t-large) var(--ease-out);
}
.pillar-reveal.in {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Hover: lift, glow border, animated tonal shift */
.pillar-card {
  transition:
    transform var(--t-micro) var(--ease-out),
    border-color var(--t-micro) var(--ease-out),
    box-shadow var(--t-micro) var(--ease-out),
    background-color var(--t-micro) var(--ease-out);
}
.pillar-card:hover {
  transform: translateY(-6px);
  border-color: currentColor !important;  /* uses .icon-accent context if set */
  box-shadow:
    0 24px 60px -32px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.04);
}
html[data-mood="midnight"] .pillar-card:hover {
  border-color: rgba(94, 234, 212, 0.45) !important;
  box-shadow:
    0 24px 60px -32px rgba(94, 234, 212, 0.25),
    0 0 0 1px rgba(94, 234, 212, 0.10);
}
html[data-mood="solar"] .pillar-card:hover {
  border-color: rgba(184, 65, 43, 0.45) !important;
  box-shadow: 0 24px 60px -32px rgba(184, 65, 43, 0.20);
}
.pillar-card:hover {
  border-color: rgba(198, 255, 61, 0.45) !important;
  box-shadow: 0 24px 60px -32px rgba(198, 255, 61, 0.18);
}

/* Icon: subtle rotation on card hover */
.pillar-card .icon-accent {
  transition: transform 600ms var(--ease-out);
  transform-origin: 50% 50%;
}
.pillar-card:hover .icon-accent {
  transform: rotate(-8deg) scale(1.06);
}

/* ============================================================
   PROCESS FLOW — animated SVG line + step pulses
   ============================================================ */

/* The original .step-line is a simple gradient; we layer an SVG path on
   top that draws as user scrolls. Set on the connector rail wrapper. */
.process-line-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 1px;
  pointer-events: none;
  overflow: visible;
}
.process-line-svg path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1200ms var(--ease-out);
}

.step-circle {
  position: relative;
  transition: border-color var(--t-micro) var(--ease-out);
}
.step-circle.reached {
  border-color: currentColor !important;
}
.step-circle.reached::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 9999px;
  border: 1px solid currentColor;
  opacity: 0;
  animation: step-pulse 1400ms var(--ease-out) 1;
}
@keyframes step-pulse {
  0%   { transform: scale(0.9); opacity: 0.6; }
  70%  { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}

/* Step number reveal stagger handled via .reveal d1/d2/d3 already. */

/* ============================================================
   SERVICE DETAIL CARDS — gentle float + 3D tilt
   ============================================================ */
.float-card {
  animation: float-bob 4.4s ease-in-out infinite;
  animation-delay: var(--float-delay, 0s);
  transform-style: preserve-3d;
  transition: transform 200ms var(--ease-out);
  will-change: transform;
}
@keyframes float-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

/* When we apply tilt via JS, we set --tx / --ty which compose with the
   bobbing animation. To do that cleanly, JS adds .tilt-active and we
   stop the keyframe so the inline transform takes over. */
.float-card.tilt-active {
  animation: none;
  transform:
    perspective(900px)
    rotateX(var(--ty, 0deg))
    rotateY(var(--tx, 0deg))
    translateY(var(--bob, 0px));
}

/* Live-data badge blink for "OPERATIONAL" / "ACTIVE" pulses */
.live-blink {
  animation: live-blink 2.4s var(--ease-out) infinite;
}
@keyframes live-blink {
  0%, 100% { opacity: 1; }
  48%, 52% { opacity: 0.45; }
}

/* ============================================================
   NAV — auto-hide + scroll-blur
   ============================================================ */
header.nav-blur {
  transition:
    transform 320ms var(--ease-out),
    backdrop-filter 320ms var(--ease-out),
    background-color 320ms var(--ease-out);
  will-change: transform, backdrop-filter;
}
header.nav-blur.nav-hidden {
  transform: translateY(-100%);
}

/* Active section: animated underline that slides between nav items */
.nav-underline {
  position: absolute;
  bottom: -6px;
  height: 1px;
  background: currentColor;
  transition:
    left 380ms var(--ease-out),
    width 380ms var(--ease-out),
    opacity 220ms linear;
  pointer-events: none;
  opacity: 0;
}
.nav-underline.show { opacity: 1; }
nav.nav-track { position: relative; }

/* ============================================================
   SECTION ENTRANCES (richer than .reveal — slight slide)
   ============================================================ */
.sec-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity var(--t-large) var(--ease-out),
    transform var(--t-large) var(--ease-out);
}
.sec-reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   BUTTONS / LINKS — micro-interactions
   ============================================================ */

/* Ripple on click (JS adds the .ripple span; CSS fades it out) */
.btn-primary, .btn-ghost {
  position: relative;
  overflow: hidden;
  transition:
    transform var(--t-micro) var(--ease-out),
    background-color var(--t-micro) var(--ease-out),
    color var(--t-micro) var(--ease-out),
    border-color var(--t-micro) var(--ease-out);
}
.btn-primary:hover, .btn-ghost:hover {
  transform: translateY(-1px);
}
.btn-primary:active, .btn-ghost:active {
  transform: translateY(0);
}
.ripple {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  transform: scale(0);
  background: currentColor;
  opacity: 0.28;
  animation: ripple-out 620ms var(--ease-out) forwards;
}
@keyframes ripple-out {
  to { transform: scale(2.4); opacity: 0; }
}

/* Underline-on-hover for general anchors inside content */
.link-underline {
  position: relative;
}
.link-underline::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: -2px;
  height: 1px;
  background: currentColor;
  transition: right 380ms var(--ease-out);
}
.link-underline:hover::after { right: 0; }

/* ============================================================
   FOOTER — slow gradient sweep along bottom edge
   ============================================================ */
.footer-glow {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    currentColor 30%,
    currentColor 70%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: footer-sweep 18s linear infinite;
  opacity: 0.35;
  pointer-events: none;
}
@keyframes footer-sweep {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
