/* =========================================================================
   Vectis Labs — Interactive Portfolio
   Global stylesheet. Ultra-clean, translucent, predominantly white.
   ========================================================================= */

:root {
  --bg: #ffffff;                 /* white canvas */
  --bg-2: #f2f2f3;
  --ink: #0a0a0b;                /* near-black foreground */
  --ink-70: rgba(10, 10, 11, 0.66);
  --ink-45: rgba(10, 10, 11, 0.45);
  --ink-30: rgba(10, 10, 11, 0.30);
  --ink-20: rgba(10, 10, 11, 0.18);
  --ink-10: rgba(10, 10, 11, 0.10);
  --ink-06: rgba(10, 10, 11, 0.055);
  --glass: rgba(255, 255, 255, 0.5);
  --glass-strong: rgba(255, 255, 255, 0.68);
  --stroke: rgba(10, 10, 11, 0.12);
  --blur: 16px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;

  --pad: clamp(20px, 5vw, 80px);
  --maxw: 1240px;
}

/* ----- reset --------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(120% 120% at 50% 0%, var(--bg) 0%, var(--bg-2) 78%);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: 1.5;
  letter-spacing: 0.01em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* On desktop with a fine pointer we hide the native cursor for the custom one */
@media (hover: hover) and (pointer: fine) {
  body.custom-cursor,
  body.custom-cursor * { cursor: none; }
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* Numbers that change should never jitter */
.tabular { font-variant-numeric: tabular-nums; font-family: var(--font-mono); }

/* ----- typography ---------------------------------------------------------- */
h1, h2, h3, h4 {
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
}

.display {
  font-size: clamp(2.6rem, 9vw, 8rem);
  font-weight: 200;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-45);
  font-weight: 400;
}

.lead {
  font-size: clamp(1.05rem, 2.2vw, 1.4rem);
  color: var(--ink-70);
  font-weight: 300;
  max-width: 52ch;
}

.muted { color: var(--ink-45); }

/* ==========================================================================
   Custom cursor — single ring, no centre dot, minimal lag
   ========================================================================== */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 22px; height: 22px;
  border: 1.5px solid #fff;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate3d(-50%, -50%, 0);
  transition: width 0.24s var(--ease-out),
              height 0.24s var(--ease-out),
              background 0.24s var(--ease-out),
              opacity 0.2s ease;
  mix-blend-mode: difference;   /* black on white, white over the dark object */
  will-change: transform;
}
.cursor.is-hover {
  width: 46px; height: 46px;
  background: #fff;
}
.cursor.is-hidden { opacity: 0; }
@media (hover: none), (pointer: coarse) {
  .cursor { display: none; }
}

/* ==========================================================================
   Telemetry loader (light, aligned with the site)
   ========================================================================== */
.loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: var(--pad);
  /* the directional wipe: revealed = full inset, out = clipped away */
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.6s var(--ease-in-out);
  will-change: clip-path;
}
.loader.is-out { clip-path: inset(0 0 100% 0); }
.loader.is-done { display: none; }
/* Already seen this session (set synchronously in <head>): never paint it,
   so there's no telemetry flash when navigating between pages. */
.intro-seen .loader { display: none !important; }

.loader__inner {
  width: min(560px, 100%);
  display: grid;
  gap: 28px;
}
.loader__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-45);
  border-bottom: 1px solid var(--stroke);
  padding-bottom: 18px;
}
.loader__pct {
  font-family: var(--font-mono);
  font-size: clamp(3.5rem, 14vw, 7rem);
  font-weight: 200;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.loader__pct sup { font-size: 0.3em; color: var(--ink-45); vertical-align: super; }

.loader__bars { display: grid; gap: 12px; }
.loader__bar-row {
  display: grid;
  grid-template-columns: 84px 1fr 52px;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--ink-45);
  text-transform: uppercase;
}
.loader__track {
  height: 2px;
  background: var(--ink-10);
  position: relative;
  overflow: hidden;
}
.loader__fill {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform: scaleX(0);
  background: var(--ink);
}
.loader__val {
  text-align: right;
  color: var(--ink-70);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Floating navigation
   ========================================================================== */
.nav-trigger {
  position: fixed;
  top: clamp(20px, 3vw, 34px);
  right: clamp(20px, 3vw, 36px);
  z-index: 200;
  border: 0;
  background: none;
  padding: 8px;
  display: grid;
  gap: 6px;
  cursor: pointer;
  mix-blend-mode: difference;   /* bars visible over white and the dark object */
  transition: transform 0.4s var(--ease-out);
}
.nav-trigger:hover { transform: scale(1.08); }
.nav-trigger span {
  display: block;
  width: 28px; height: 2px;
  background: #fff;
  transition: transform 0.4s var(--ease-out), opacity 0.3s ease;
}
body.nav-open .nav-trigger span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
body.nav-open .nav-trigger span:nth-child(2) { opacity: 0; }
body.nav-open .nav-trigger span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.brand {
  position: fixed;
  top: clamp(20px, 3vw, 36px);
  left: clamp(18px, 3vw, 34px);
  z-index: 200;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #fff;
  mix-blend-mode: difference;
}
.brand b { font-weight: 500; }
.brand span { opacity: 0.55; }

.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(26px) saturate(120%);
  -webkit-backdrop-filter: blur(26px) saturate(120%);
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s var(--ease-out), visibility 0.5s;
}
body.nav-open .nav-overlay { opacity: 1; visibility: visible; }

.nav-menu {
  display: grid;
  gap: clamp(6px, 1.4vh, 14px);
  text-align: center;
}
.nav-menu a {
  font-size: clamp(2.2rem, 8vw, 4.6rem);
  font-weight: 200;
  letter-spacing: -0.02em;
  color: var(--ink-45);
  position: relative;
  transform: translateY(30px);
  opacity: 0;
  transition: color 0.3s ease, transform 0.6s var(--ease-out), opacity 0.6s var(--ease-out);
}
body.nav-open .nav-menu a { transform: translateY(0); opacity: 1; }
body.nav-open .nav-menu a:nth-child(1) { transition-delay: 0.08s; }
body.nav-open .nav-menu a:nth-child(2) { transition-delay: 0.14s; }
body.nav-open .nav-menu a:nth-child(3) { transition-delay: 0.20s; }
body.nav-open .nav-menu a:nth-child(4) { transition-delay: 0.26s; }
body.nav-open .nav-menu a:nth-child(5) { transition-delay: 0.32s; }
.nav-menu a:hover,
.nav-menu a.is-current { color: var(--ink); }

.nav-foot {
  position: fixed;
  bottom: clamp(18px, 3vw, 34px);
  left: 0; right: 0;
  z-index: 151;
  display: flex;
  justify-content: space-between;
  padding: 0 var(--pad);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-45);
  opacity: 0;
  transition: opacity 0.5s ease 0.2s;
  pointer-events: none;
}
body.nav-open .nav-foot { opacity: 1; pointer-events: auto; }

/* ==========================================================================
   Layout helpers + staggered reveal
   ========================================================================== */
.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--pad); }
.section { padding-block: clamp(80px, 14vh, 200px); position: relative; }

/* staggered rise: initial hidden state, JS adds .is-in */
.reveal { opacity: 0; transform: translateY(28px); }
.reveal.is-in {
  opacity: 1; transform: translateY(0);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

/* three.js canvas host for the hero object */
.scene {
  position: fixed;
  inset: 0;
  /* pin to the large viewport so the collapsing mobile URL bar doesn't
     resize the canvas mid-scroll (each resize visibly jolts the object) */
  height: 100vh;
  height: 100lvh;
  z-index: 1;
  pointer-events: none;
}
/* width/height must be pinned in CSS: the renderer sizes its buffer at
   devicePixelRatio and skips styling the canvas (setSize updateStyle=false),
   so without this the canvas overflows the viewport on DPR > 1 screens. */
.scene canvas { display: block; width: 100%; height: 100%; }

/* content sits above the fixed scene */
.content { position: relative; z-index: 2; }

/* ==========================================================================
   Home hero + scroll sections
   ========================================================================== */
.hero {
  min-height: 100vh;
  display: grid;
  align-content: center;
  padding-block: 22vh 12vh;
}
/* Keep hero copy legible where it overlaps the dark 3D object */
.hero > *,
.page-hero > *,
.statement { text-shadow: 0 2px 40px rgba(255, 255, 255, 0.75); }

.hero__meta {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  margin-top: 30px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--ink-45);
  text-transform: uppercase;
}
.hero__meta span { display: flex; align-items: center; gap: 8px; }
.hero__meta span::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink); display: inline-block;
}

.scroll-hint {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-45);
  display: grid;
  justify-items: center;
  gap: 10px;
  transition: opacity 0.4s ease;
}
.scroll-hint .line {
  width: 1px; height: 40px;
  background: linear-gradient(var(--ink), transparent);
  animation: hint 2.2s var(--ease-in-out) infinite;
}
@keyframes hint {
  0% { transform: scaleY(0); transform-origin: top; }
  40% { transform: scaleY(1); transform-origin: top; }
  60% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

.statement {
  font-size: clamp(1.8rem, 5vw, 4rem);
  font-weight: 200;
  line-height: 1.15;
  max-width: 18ch;
  letter-spacing: -0.02em;
}
.statement em { font-style: normal; color: var(--ink-45); }

/* ==========================================================================
   Soft page transition veil
   ========================================================================== */
.page-veil {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: var(--bg);
  opacity: 1;
  pointer-events: none;
  transition: opacity 0.48s var(--ease-in-out);
}
.page-veil.is-hidden { opacity: 0; }

/* ==========================================================================
   Liquid glass plane — frosted panel the object sits behind, so any text
   on it stays readable while the object drifts behind the blur.
   ========================================================================== */
.glass-plane {
  position: relative;
  border-radius: 22px;
  border: 1px solid var(--stroke);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.4));
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow:
    0 60px 120px -46px rgba(10, 10, 11, 0.6),
    0 24px 60px -40px rgba(10, 10, 11, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  padding: clamp(26px, 3.4vw, 44px);
  overflow: hidden;
}
/* soft glossy sheen for the "liquid" read */
.glass-plane::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 15% -10%, rgba(255, 255, 255, 0.55), transparent 55%);
  mix-blend-mode: screen;
  pointer-events: none;
}
.glass-plane > * { position: relative; }

/* ==========================================================================
   "What we build" — intro on the left, panes stacked on the right
   ========================================================================== */
.build {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(30px, 5vw, 90px);
  align-items: start;
}
.build__intro { position: sticky; top: 20vh; }
.build__intro h2 { margin: 18px 0 20px; }
@media (max-width: 860px) {
  .build { grid-template-columns: 1fr; }
  .build__intro { position: static; }
}

/* ==========================================================================
   Depth-reveal parallax cards
   ========================================================================== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: clamp(18px, 2.5vw, 32px);
  perspective: 1400px;
}
/* stacked variant: panes one under another */
.cards--stack { grid-template-columns: 1fr; gap: clamp(16px, 2vw, 24px); }
.cards--stack .card { min-height: 220px; }
.card {
  position: relative;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: linear-gradient(160deg, var(--glass-strong), var(--glass));
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: 0 40px 90px -44px rgba(10, 10, 11, 0.62);
  padding: clamp(24px, 3vw, 38px);
  min-height: 300px;
  transform-style: preserve-3d;
  overflow: hidden;
  /* Stage 1 initial state */
  opacity: 0;
  transform: translateY(46px) scale(0.98);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}
.card.is-revealed { opacity: 1; transform: translateY(0) scale(1); }
/* Stage 2 tilt handled by JS via CSS vars for smoothness */
.card.is-live {
  transition: transform 0.25s var(--ease-out), box-shadow 0.4s ease;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
}
.card.is-live:hover { box-shadow: 0 50px 100px -44px rgba(10, 10, 11, 0.66); }
.card__layer { transform-style: preserve-3d; }
.card__index {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-45);
  letter-spacing: 0.18em;
  transform: translateZ(20px);
}
.card__title {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 300;
  margin: 18px 0 12px;
  transform: translateZ(50px);
}
.card__body { color: var(--ink-45); max-width: 40ch; transform: translateZ(30px); }
.card__glow {
  position: absolute;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(10,10,11,0.06), transparent 70%);
  top: -120px; right: -100px;
  transform: translateZ(-40px);
  pointer-events: none;
}
.card__spark {
  position: absolute;
  bottom: 24px; left: clamp(24px, 3vw, 38px);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  color: var(--ink-45);
  text-transform: uppercase;
  transform: translateZ(40px);
}

/* ==========================================================================
   Infinite marquee
   ========================================================================== */
.marquee {
  display: grid;
  gap: 18px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee__row {
  display: flex;
  width: max-content;
  gap: 18px;
  will-change: transform;
}
.marquee__row.is-paused { animation-play-state: paused; }
.review {
  flex: 0 0 auto;
  width: min(78vw, 380px);
  border-radius: 16px;
  border: 1px solid var(--stroke);
  /* No backdrop-filter here: these cards move every frame, so a live blur is
     very expensive to composite. A solid translucent fill reads the same. */
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 32px 66px -40px rgba(10, 10, 11, 0.56);
  padding: 26px 28px;
}
.review__stars { color: var(--ink); letter-spacing: 3px; font-size: 0.8rem; }
.review__text { color: var(--ink-70); margin: 14px 0 18px; font-size: 0.98rem; }
.review__who { display: flex; align-items: center; gap: 12px; }
.review__avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--ink-20), var(--ink-06));
  border: 1px solid var(--stroke);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 0.8rem;
}
.review__name { font-size: 0.9rem; }
.review__role { font-size: 0.74rem; color: var(--ink-45); font-family: var(--font-mono); }

/* ==========================================================================
   Generic content blocks (interior pages)
   ========================================================================== */
.page-hero {
  min-height: 62vh;
  display: grid;
  align-content: center;
  padding-block: 24vh 8vh;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: clamp(28px, 5vw, 80px);
  align-items: start;
}
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 24px;
  border-top: 1px solid var(--stroke);
  padding-top: 34px;
  margin-top: 44px;
}
.stat b {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 200;
  font-variant-numeric: tabular-nums;
}
.stat span { color: var(--ink-45); font-size: 0.82rem; letter-spacing: 0.04em; }

.step {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 24px;
  padding: 30px 0;
  border-top: 1px solid var(--stroke);
}
.step__n { font-family: var(--font-mono); color: var(--ink-45); }
.step h3 { font-size: clamp(1.3rem, 3vw, 1.9rem); margin-bottom: 10px; }
.step p { color: var(--ink-45); max-width: 56ch; }

/* FAQ */
.faq { border-top: 1px solid var(--stroke); }
.faq__item { border-bottom: 1px solid var(--stroke); }
/* as a glass pane the panel brings its own border, so drop the list rules
   that would double it at the top and bottom edges */
.faq.glass-plane { border-top: 0; }
.faq.glass-plane .faq__item:last-child { border-bottom: 0; }
.faq__q {
  width: 100%;
  background: none;
  border: 0;
  color: var(--ink);
  text-align: left;
  padding: 28px 0;
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  font-weight: 300;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  cursor: pointer;
}
.faq__q .sign { position: relative; width: 16px; height: 16px; flex: 0 0 auto; }
.faq__q .sign::before,
.faq__q .sign::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  background: var(--ink); transition: transform 0.4s var(--ease-out);
}
.faq__q .sign::before { width: 16px; height: 1.5px; }
.faq__q .sign::after { width: 1.5px; height: 16px; }
.faq__item.is-open .sign::after { transform: scaleY(0); }
.faq__a {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.5s var(--ease-in-out);
}
.faq__a p { color: var(--ink-45); padding-bottom: 28px; max-width: 68ch; }

/* Contact form */
.field { margin-bottom: 26px; position: relative; }
.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-45);
  margin-bottom: 10px;
}
.field input,
.field textarea {
  width: 100%;
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 16px 18px;
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.field input::placeholder,
.field textarea::placeholder { color: var(--ink-30); }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--ink-45);
  background: var(--glass-strong);
}
.field textarea { min-height: 140px; resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 30px;
  border-radius: 100px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.4s var(--ease-out), background 0.3s ease, color 0.3s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--stroke); }
.btn--ghost:hover { background: var(--ink-06); }

/* footer */
.foot {
  border-top: 1px solid var(--stroke);
  padding-block: 60px 40px;
  margin-top: 40px;
}
.foot__grid {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 30px;
  align-items: flex-end;
}
.foot__big { font-size: clamp(2rem, 7vw, 4.6rem); font-weight: 200; }
.foot__links { display: grid; gap: 8px; font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-45); }
.foot__links a:hover { color: var(--ink); }
.foot__bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  margin-top: 50px; font-family: var(--font-mono); font-size: 0.68rem;
  letter-spacing: 0.1em; color: var(--ink-30); text-transform: uppercase;
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal, .card { opacity: 1 !important; transform: none !important; }
  .scroll-hint .line { animation: none; }
}
