/* ==========================================================================
   AARI depth layer — 3D look and feel
   Additive stylesheet: tilt cards, scroll-driven 3D reveals, parallax orbs.
   Safe to remove: no rules here are load-bearing for layout.
   ========================================================================== */

/* Self-hosted brand font — styles.css already names it first in the stack.
   Variable weight 200-800, latin subset, 27KB. */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/PlusJakartaSans-latin.woff2") format("woff2");
}

html,
body {
  overflow-x: clip;
}

/* ---- Layered depth background: floating gradient orbs --------------------
   Injected by depth.js as .depth-orbs > .depth-orb. Fixed behind content,
   drifting slowly; pointer + scroll parallax via CSS custom properties. */
.depth-orbs {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.depth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  will-change: transform;
  transform:
    translate3d(
      calc(var(--pointer-x, 0) * var(--drift, 18px)),
      calc(var(--pointer-y, 0) * var(--drift, 18px) + var(--scroll-y, 0) * var(--depth, -0.04px)),
      0
    );
}

.depth-orb.orb-a {
  top: -12%;
  right: -8%;
  width: 46vw;
  height: 46vw;
  background: radial-gradient(circle at 35% 35%, rgba(20, 184, 166, 0.4), rgba(20, 184, 166, 0) 68%);
  --drift: 26px;
  --depth: -0.05px;
  animation: orb-float-a 26s ease-in-out infinite alternate;
}

.depth-orb.orb-b {
  top: 32%;
  left: -14%;
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle at 60% 40%, rgba(3, 105, 161, 0.28), rgba(3, 105, 161, 0) 66%);
  --drift: 40px;
  --depth: -0.09px;
  animation: orb-float-b 32s ease-in-out infinite alternate;
}

.depth-orb.orb-c {
  bottom: -18%;
  right: 18%;
  width: 34vw;
  height: 34vw;
  background: radial-gradient(circle at 40% 60%, rgba(204, 251, 241, 0.85), rgba(204, 251, 241, 0) 70%);
  --drift: 14px;
  --depth: -0.02px;
  animation: orb-float-a 38s ease-in-out infinite alternate-reverse;
}

@keyframes orb-float-a {
  from { margin-top: 0; margin-left: 0; }
  to { margin-top: 4vh; margin-left: -3vw; }
}

@keyframes orb-float-b {
  from { margin-top: 0; }
  to { margin-top: -5vh; }
}

/* ---- Perspective grid floor ----------------------------------------------
   A subtle 3D-tilted grid rising from the bottom of the viewport. */
.depth-floor {
  position: fixed;
  left: -20vw;
  right: -20vw;
  bottom: -6vh;
  height: 38vh;
  z-index: -1;
  pointer-events: none;
  transform: perspective(620px) rotateX(62deg);
  transform-origin: 50% 100%;
  background-image:
    linear-gradient(rgba(15, 118, 110, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 118, 110, 0.09) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent 82%);
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent 82%);
}

/* ---- WebGL hero scene ------------------------------------------------------
   Canvas injected by hero-scene.js as the first child of .hero. Sits behind
   the hero copy/card; soft-masked so it melts into the page background. */
.hero.section {
  position: relative;
  overflow: clip;
}

.hero-scene-canvas {
  position: absolute;
  inset: -8% -14%;
  width: 128%;
  height: 116%;
  z-index: 0;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 78% 72% at 50% 42%, black 38%, transparent 82%);
  -webkit-mask-image: radial-gradient(ellipse 78% 72% at 50% 42%, black 38%, transparent 82%);
}

.hero > :not(.hero-scene-canvas) {
  position: relative;
  z-index: 1;
}

/* ---- Interactive 3D tilt (pointer-tracked) --------------------------------
   depth.js tags cards with [data-tilt] and drives --rx/--ry/--gx/--gy. */
[data-tilt] {
  transform-style: preserve-3d;
  transform:
    perspective(900px)
    rotateX(var(--rx, 0deg))
    rotateY(var(--ry, 0deg))
    translateZ(0);
  transition: transform 480ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 480ms ease;
  position: relative;
}

[data-tilt].is-tilting {
  transition: transform 60ms linear, box-shadow 300ms ease;
  box-shadow:
    0 30px 60px rgba(15, 118, 110, 0.16),
    0 10px 24px rgba(3, 105, 161, 0.12);
  z-index: 1;
}

/* Specular glare that follows the pointer */
[data-tilt]::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    420px circle at var(--gx, 50%) var(--gy, 50%),
    rgba(255, 255, 255, 0.55),
    rgba(255, 255, 255, 0) 46%
  );
  transition: opacity 320ms ease;
}

[data-tilt].is-tilting::after {
  opacity: 1;
}

/* Lift inner content off the card surface for real parallax-in-card depth */
[data-tilt] > h3,
[data-tilt] > .service-group-label,
[data-tilt] > .hero-card-label,
[data-tilt] > h2,
[data-tilt] > span {
  transform: translateZ(34px);
}

[data-tilt] > p,
[data-tilt] > ul,
[data-tilt] > div,
[data-tilt] > .hero-card-copy,
[data-tilt] > .hero-card-stack,
[data-tilt] > .hero-card-trust {
  transform: translateZ(18px);
}

/* ---- Scroll-driven 3D reveals ---------------------------------------------
   Sections and cards rise out of the page plane as they enter the viewport. */
.reveal-3d {
  opacity: 0;
  transform:
    perspective(1000px)
    translateY(34px)
    rotateX(7deg)
    scale(0.985);
  transform-origin: 50% 100%;
  transition:
    opacity 700ms ease,
    transform 800ms cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

.reveal-3d.is-visible {
  opacity: 1;
  transform: perspective(1000px) translateY(0) rotateX(0deg) scale(1);
}

/* ---- Depth-boosted buttons ------------------------------------------------ */
.button {
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 200ms ease,
    background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.button:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 28px rgba(11, 107, 92, 0.24), 0 4px 10px rgba(3, 105, 161, 0.14);
}

.button:active {
  transform: translateY(0) scale(0.99);
}

/* Sticky header gains depth once the page is scrolled (driven by depth.js) */
body.is-scrolled .site-header {
  box-shadow:
    0 18px 40px rgba(15, 118, 110, 0.14),
    0 4px 12px rgba(3, 105, 161, 0.1);
}

/* ---- Header life ----------------------------------------------------------
   Brand-colored energy line drifting along the header's bottom edge, and a
   gentle lift + glow on the logo. Colors mirror the mark: teal, blue, red. */
.site-header {
  overflow: hidden;
}

.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(11, 107, 92, 0.55) 18%,
    rgba(46, 144, 250, 0.6) 42%,
    rgba(229, 52, 63, 0.4) 60%,
    rgba(11, 107, 92, 0.55) 82%,
    transparent 100%
  );
  background-size: 220% 100%;
  animation: header-energy 9s linear infinite;
  opacity: 0.7;
}

@keyframes header-energy {
  from { background-position: 0% 0; }
  to { background-position: -220% 0; }
}

/* Roomier header so the wordmark reads clearly */
.site-header {
  padding-top: 0.95rem;
  padding-bottom: 0.95rem;
}

.brand-logo-horizontal {
  height: 44px;
  max-width: min(100%, 292px);
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1), filter 320ms ease;
  filter: drop-shadow(0 1px 1px rgba(255, 255, 255, 0.9));
}

@media (max-width: 720px) {
  .site-header {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
  }

  .brand-logo-horizontal {
    height: 36px;
    max-width: min(100%, 240px);
  }
}

@media (max-width: 900px) {
  .site-header {
    overflow: visible;
  }
}

@media (max-width: 620px) {
  .brand-logo-horizontal {
    height: 30px;
    max-width: min(54vw, 180px);
  }
}

.brand:hover .brand-logo-horizontal,
.brand:focus-visible .brand-logo-horizontal {
  transform: translateY(-1px) scale(1.04);
  filter: drop-shadow(0 6px 14px rgba(20, 184, 166, 0.35));
}

@media (prefers-reduced-motion: reduce) {
  .site-header::after {
    animation: none;
  }

  .brand:hover .brand-logo-horizontal {
    transform: none;
  }
}

/* ---- Services page: numbered rows → 2-column depth cards ------------------
   Restyles .detailed-service-list without touching the markup. The number
   becomes a ghost watermark; "Best for" becomes a highlighted callout. */
.detailed-service-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem;
  align-items: stretch;
}

.detailed-service-list .service-item {
  display: block;
  position: relative;
  padding: 1.5rem 1.5rem 1.35rem;
  overflow: hidden;
}

.detailed-service-list .service-item > span {
  position: absolute;
  top: 0.4rem;
  right: 0.9rem;
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, #0f766e, #2e90fa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  opacity: 0.16;
  pointer-events: none;
}

.detailed-service-list .service-item h3 {
  padding-right: 3.4rem;
}

.detailed-service-list .best-for {
  margin: 0.85rem 0 0;
  padding: 0.55rem 0.75rem;
  border-left: 3px solid var(--brand);
  border-radius: 6px;
  background: var(--cta-soft);
  font-size: 0.88rem;
}

@media (max-width: 860px) {
  .detailed-service-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- Contact page: decluttered layout -------------------------------------
   Compact numbered steps inside the contact panel + small print. */
.contact-mini-steps {
  margin: 1.1rem 0 1.3rem;
  padding: 0;
  list-style: none;
  gap: 0.55rem;
}

.contact-mini-steps li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--body);
  font-size: 0.94rem;
}

.contact-mini-steps li span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--cta-soft);
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
}

.contact-panel-smallprint {
  margin: 1.2rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  color: var(--body);
  font-size: 0.8rem;
}

/* ---- Accessibility: kill all motion for users who ask for it -------------- */
@media (prefers-reduced-motion: reduce) {
  .depth-orb {
    animation: none;
    transform: none;
  }

  [data-tilt],
  [data-tilt].is-tilting {
    transform: none;
    transition: none;
  }

  .reveal-3d {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .button:hover {
    transform: none;
  }
}

/* ==========================================================================
   Dark theme — the site's default look for all visitors. Deep navy-teal
   night palette; the depth layer's glows and the constellation shine on it.
   (Wrapped in `@media all` so it can be re-scoped to a preference or a
   toggle later without re-indenting.)
   ========================================================================== */
@media all {
  :root {
    --ink: #eef7f5;
    --body: #9fc4be;
    --body-strong: #c9ece6;
    --brand: #2dd4bf;
    --mint: #134e4a;
    --cta: #14b8a6;
    --cta-hover: #2dd4bf;
    --cta-soft: rgba(20, 184, 166, 0.16);
    --bg-start: #071318;
    --bg-mid: #0a1220;
    --bg-end: #0b0f1a;
    --aqua: #0f2027;
    --line: rgba(45, 212, 191, 0.16);
    --line-strong: rgba(45, 212, 191, 0.3);
    --surface: rgba(15, 26, 42, 0.85);
    --surface-soft: rgba(13, 30, 40, 0.7);
    --shadow: 0 20px 48px rgba(0, 0, 0, 0.5), 0 4px 18px rgba(20, 184, 166, 0.08);
    --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.4);
  }

  body::before {
    background-image:
      linear-gradient(rgba(45, 212, 191, 0.05) 1px, transparent 1px),
      linear-gradient(90deg, rgba(45, 212, 191, 0.045) 1px, transparent 1px);
  }

  h1, h2, h3 {
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.55), 0 12px 28px rgba(20, 184, 166, 0.18);
  }

  .site-header {
    background: rgba(10, 18, 32, 0.82);
  }

  .primary-nav {
    background: rgba(13, 30, 40, 0.72);
    border-color: rgba(45, 212, 191, 0.14);
  }

  .primary-nav a:hover,
  .primary-nav a[aria-current="page"] {
    color: #5eead4;
  }

  .nav-toggle {
    background: rgba(15, 26, 42, 0.92);
    color: #5eead4;
  }

  .button.secondary {
    background: rgba(15, 26, 42, 0.92);
    color: #5eead4;
  }

  .hero-card,
  .founder-note-card,
  .callout,
  .site-footer,
  .product-showcase-panel {
    background:
      linear-gradient(135deg, rgba(19, 78, 74, 0.4), rgba(13, 22, 38, 0.94) 48%),
      #0c1424;
  }

  .service-group-card,
  .outcome-card,
  .product-feature-card,
  .pipeline-card,
  .mission-callout,
  .process-section .card {
    background:
      linear-gradient(135deg, rgba(19, 78, 74, 0.34), transparent 48%),
      rgba(13, 22, 38, 0.92);
  }

  .hero-card::before,
  .product-showcase-panel::after,
  .contact-entry-section .contact-panel,
  .contact-entry-section .contact-form {
    background:
      linear-gradient(135deg, rgba(19, 78, 74, 0.32), transparent 48%),
      rgba(13, 22, 38, 0.92);
  }

  input,
  select,
  textarea {
    background: rgba(10, 18, 32, 0.92);
    border-color: rgba(45, 212, 191, 0.24);
    color: var(--ink);
  }

  @media (max-width: 880px) {
    .primary-nav {
      background: rgba(10, 18, 32, 0.97);
      box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
    }
  }

  /* Depth layer tuning for dark */
  [data-tilt]::after {
    background: radial-gradient(
      420px circle at var(--gx, 50%) var(--gy, 50%),
      rgba(94, 234, 212, 0.16),
      rgba(94, 234, 212, 0) 46%
    );
  }

  .depth-floor {
    background-image:
      linear-gradient(rgba(45, 212, 191, 0.11) 1px, transparent 1px),
      linear-gradient(90deg, rgba(45, 212, 191, 0.11) 1px, transparent 1px);
  }

  .depth-orb.orb-c {
    background: radial-gradient(circle at 40% 60%, rgba(20, 184, 166, 0.3), rgba(20, 184, 166, 0) 70%);
  }

  .brand-logo-horizontal {
    filter: brightness(1.55) saturate(1.05) drop-shadow(0 1px 8px rgba(45, 212, 191, 0.25));
  }

  .detailed-service-list .service-item > span {
    background: linear-gradient(135deg, #2dd4bf, #60a5fa);
    -webkit-background-clip: text;
    background-clip: text;
    opacity: 0.3;
  }

  /* Pills/chips: dark glass with teal text instead of washed light-gray */
  .hero-card-stack span,
  .hero-card-trust strong,
  .hero-proof-row span,
  .contact-trust-list span,
  .contact-form-expectation span,
  .footer-trust span,
  .showcase-status.pipeline,
  .topic-chip-group button {
    border-color: rgba(45, 212, 191, 0.24);
    background: rgba(20, 184, 166, 0.12);
    color: #7ee8db;
  }
}

/* Small screens: tone the floor down, keep reveals (they're cheap) */
@media (max-width: 720px) {
  .depth-floor {
    height: 24vh;
    opacity: 0.7;
  }

  .depth-orb {
    filter: blur(44px);
  }
}
