/* ==========================================================================
   Nexolve: design system
   Tokens, base, typography, layout, buttons, navigation, reveal system,
   window frame, call-to-action band and footer. Page-specific styles live in
   home.css and pages.css.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  /* Colour: neutrals do the work, blue is rare */
  --ink: #13151a;
  --ink-2: #1b1e25;
  --ink-3: #262a32;
  --paper: #f6f7f9;
  --white: #ffffff;
  --warm: #f4f3f1;
  --mist: #e8ebf0;
  --mist-2: #d6dce5;
  --slate: #5a6270;
  --slate-light: #a4acba;
  --sky: #38b6ff;
  --indigo: #5271ff;
  --blue-text: #3a52e8;
  --grad: linear-gradient(90deg, var(--sky), var(--indigo));

  /* Semantic, switched per surface (.dark) */
  --bg: var(--paper);
  --fg: var(--ink);
  --fg-2: var(--slate);
  --line: var(--mist);
  --surface: var(--white);

  /* Type */
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fs-hero: clamp(2.7rem, 0.5rem + 6.3vw, 6.75rem);
  --fs-h1: clamp(2.6rem, 0.6rem + 6vw, 6.25rem);
  --fs-h2: clamp(2.1rem, 0.8rem + 4.2vw, 4.75rem);
  --fs-h3: clamp(1.4rem, 1rem + 1.3vw, 2.1rem);
  --fs-lead: clamp(1.125rem, 1rem + 0.55vw, 1.55rem);
  --fs-body: 1.0625rem;
  --fs-small: 0.875rem;

  /* Layout */
  --gutter: clamp(20px, 4.5vw, 64px);
  --max: 1360px;
  --section-y: clamp(88px, 12vw, 180px);

  /* Shape */
  --r-s: 6px;
  --r-m: 12px;
  --r-l: 20px;
  --shadow-win: 0 0 0 1px rgba(19, 21, 26, 0.06), 0 2px 4px rgba(19, 21, 26, 0.04), 0 40px 80px -24px rgba(19, 21, 26, 0.28);
  --shadow-s: 0 0 0 1px rgba(19, 21, 26, 0.06), 0 8px 24px -10px rgba(19, 21, 26, 0.18);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
}

.dark {
  --bg: var(--ink);
  --fg: #ffffff;
  --fg-2: var(--slate-light);
  --line: rgba(255, 255, 255, 0.1);
  --surface: var(--ink-2);
  background: var(--bg);
  color: var(--fg);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 88px; }
html:not(.reduced) { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, video { max-width: 100%; }
h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
::selection { background: var(--sky); color: var(--ink); }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }
.skip {
  position: fixed; left: 16px; top: -80px; z-index: 100; padding: 12px 18px; border-radius: 999px;
  background: var(--ink); color: #fff; font-weight: 500; transition: top 0.2s;
}
.skip:focus { top: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 3. Typography ---------- */
.display, .h1, .h2, .h3 { font-weight: 700; text-wrap: balance; }
.display { font-size: var(--fs-hero); line-height: 0.96; letter-spacing: -0.048em; }
.h1 { font-size: var(--fs-h1); line-height: 0.98; letter-spacing: -0.045em; }
.h2 { font-size: var(--fs-h2); line-height: 1.02; letter-spacing: -0.04em; }
.h3 { font-size: var(--fs-h3); line-height: 1.15; letter-spacing: -0.03em; }
.lead { font-size: var(--fs-lead); line-height: 1.45; font-weight: 500; letter-spacing: -0.012em; color: var(--fg-2); text-wrap: pretty; }
.muted { color: var(--fg-2); }
.small { font-size: var(--fs-small); }
.label { font-size: var(--fs-small); font-weight: 500; color: var(--fg-2); letter-spacing: 0; }
.tnum { font-variant-numeric: tabular-nums; }
p { text-wrap: pretty; }
.blue { color: var(--blue-text); }
.dark .blue { color: var(--sky); }

/* ---------- 4. Layout ---------- */
.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.section { padding-block: var(--section-y); position: relative; }

/* ---------- 5. Buttons and links ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6em;
  min-height: 52px; padding: 0 1.6em; border-radius: 999px;
  font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; line-height: 1; white-space: nowrap;
  transition: background-color 0.35s var(--ease-out), color 0.35s var(--ease-out), border-color 0.35s, box-shadow 0.35s, transform 0.5s var(--ease-out);
  will-change: transform;
}
.btn--primary { background: var(--sky); color: var(--ink); }
.btn--primary:hover { background: var(--indigo); color: #fff; }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: var(--indigo); }
.btn--ghost { border: 1px solid var(--mist-2); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--ghost-dark { border: 1px solid rgba(255, 255, 255, 0.24); color: #fff; }
.btn--ghost-dark:hover { border-color: #fff; background: rgba(255, 255, 255, 0.06); }
.btn--sm { min-height: 42px; padding: 0 1.2em; font-size: 0.92rem; }
.btn--lg { min-height: 64px; padding: 0 2.1em; font-size: 1.125rem; }
.arr { display: inline-block; transition: transform 0.45s var(--ease-out); }
.btn:hover .arr, .tlink:hover .arr { transform: translateX(4px); }
.arr--down { display: inline-block; }
.btn:hover .arr--down { transform: translateY(3px); }
.tlink { display: inline-flex; align-items: center; gap: 0.5em; font-weight: 700; color: var(--blue-text); letter-spacing: -0.01em; }
.dark .tlink { color: var(--sky); }
.tlink--ink { color: inherit; }

/* ---------- 6. Navigation ---------- */
.nav { position: fixed; inset: 0 0 auto 0; z-index: 50; padding-top: max(14px, env(safe-area-inset-top)); pointer-events: none; color: var(--ink); }
.nav__bar {
  pointer-events: auto; display: flex; align-items: center; gap: 1.5rem;
  width: min(100% - 2 * var(--gutter), var(--max)); height: 68px; margin-inline: auto; padding: 0;
  border-radius: 999px; background: transparent;
  transition: width 0.7s var(--ease-out), height 0.7s var(--ease-out), padding 0.7s var(--ease-out), background-color 0.5s, box-shadow 0.5s;
}
.nav.is-scrolled .nav__bar {
  width: min(100% - 24px, 1020px); height: 60px; padding: 0 9px 0 24px;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(18px) saturate(1.5); backdrop-filter: blur(18px) saturate(1.5);
  box-shadow: 0 0 0 1px rgba(19, 21, 26, 0.06), 0 14px 34px -14px rgba(19, 21, 26, 0.22);
}
.nav__logo { display: block; flex: none; }
.logo { display: block; height: 40px; width: calc(40px * 1064 / 366); }
.nav__links { display: flex; gap: 2px; margin-inline: auto; }
.nav__links a {
  position: relative; padding: 0.55rem 0.95rem; border-radius: 999px; font-size: 0.94rem; font-weight: 500;
  color: rgba(19, 21, 26, 0.72); transition: color 0.3s, background-color 0.3s;
}
.nav__links a:hover { color: var(--ink); background: rgba(19, 21, 26, 0.05); }
.nav__links a[aria-current="page"] { color: var(--ink); }
.nav__links a[aria-current="page"]::after {
  content: ""; position: absolute; left: 50%; bottom: 2px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--sky);
}
.nav__toggle { display: none; }

@media (max-width: 899px) {
  .nav__bar { gap: 0.6rem; height: 60px; }
  .nav.is-scrolled .nav__bar { padding: 0 8px 0 18px; height: 56px; }
  .logo { height: 34px; width: calc(34px * 1064 / 366); }
  .nav__links { display: none; }
  .nav__cta { margin-left: auto; }
  .nav__cta .arr { display: none; }
  .nav__toggle {
    display: inline-flex; align-items: center; gap: 0.55rem; min-height: 44px; padding: 0 1rem; border-radius: 999px;
    font-weight: 700; font-size: 0.92rem; background: rgba(19, 21, 26, 0.06);
  }
  .nav__toggle-icon { position: relative; width: 16px; height: 8px; }
  .nav__toggle-icon i { position: absolute; left: 0; right: 0; height: 2px; border-radius: 2px; background: currentColor; transition: transform 0.5s var(--ease-out); }
  .nav__toggle-icon i:first-child { top: 0; }
  .nav__toggle-icon i:last-child { bottom: 0; }
  .nav.is-menu .nav__toggle-icon i:first-child { transform: translateY(3px) rotate(45deg); }
  .nav.is-menu .nav__toggle-icon i:last-child { transform: translateY(-3px) rotate(-45deg); }
  .nav.is-menu { color: #fff; }
  .nav.is-menu .nav__bar { background: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .nav.is-menu .nav__toggle { background: rgba(255, 255, 255, 0.12); }
  .nav.is-menu .nav__cta { visibility: hidden; }
}
@media (max-width: 380px) { .nav__cta { display: none; } .nav__toggle { margin-left: auto; } }

/* Full-screen menu sheet (mobile and tablet) */
.menu {
  position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem;
  padding: 112px var(--gutter) max(24px, env(safe-area-inset-bottom)); overflow-y: auto;
  background: var(--ink); color: #fff;
  clip-path: circle(0 at calc(100% - 64px) 36px); visibility: hidden;
  transition: clip-path 0.85s var(--ease-io), visibility 0s 0.85s;
}
.menu.is-open { clip-path: circle(160% at calc(100% - 64px) 36px); visibility: visible; transition: clip-path 0.85s var(--ease-io), visibility 0s; }
.menu__links { display: grid; gap: 0.1rem; }
.menu__links a { display: block; overflow: hidden; font-size: clamp(2.4rem, 11vw, 4.5rem); font-weight: 700; letter-spacing: -0.045em; line-height: 1.12; padding-block: 0.04em; }
.menu__links span { display: block; transform: translateY(110%); transition: transform 0.9s var(--ease-out); transition-delay: 0s; }
.menu.is-open .menu__links span { transform: none; transition-delay: calc(0.25s + var(--i) * 0.06s); }
.menu__actions { display: grid; gap: 0.75rem; opacity: 0; transform: translateY(16px); transition: opacity 0.6s, transform 0.8s var(--ease-out); }
.menu.is-open .menu__actions { opacity: 1; transform: none; transition-delay: 0.6s; }
.menu__actions .btn--ghost { border-color: rgba(255, 255, 255, 0.24); color: #fff; }
@media (min-width: 900px) { .menu { display: none; } }

/* ---------- 7. Reveal system ---------- */
/* Hidden states only exist when JS has run and motion is allowed. */
.js:not(.reduced) [data-reveal] {
  opacity: 0; transform: translateY(28px); filter: blur(4px);
  transition: opacity 1s var(--ease-out), transform 1.1s var(--ease-out), filter 1s var(--ease-out);
  transition-delay: var(--d, 0s);
}
.js:not(.reduced) [data-reveal].is-in { opacity: 1; transform: none; filter: none; }
.w { display: inline-block; overflow: hidden; vertical-align: top; padding-block: 0.1em 0.14em; margin-block: -0.1em -0.14em; }
.wi { display: inline-block; }
.js:not(.reduced) [data-split] .wi { transform: translateY(112%); }
.js:not(.reduced) [data-split].is-in .wi { transform: none; transition: transform 1.15s var(--ease-out); transition-delay: calc(var(--d, 0s) + var(--i) * 55ms); }

/* Scrubbed ranges. Scenes expose --p (0..1); an element with data-r="a b" is given --a / --b
   by JS and exposes --t (linear) and --e (eased) for its own window of the scene. */
[data-scene] { --p: 1; }
[data-r] {
  --t: clamp(0, calc((var(--p) - var(--a, 0)) / (var(--b, 1) - var(--a, 0))), 1);
  --e: calc(var(--t) * var(--t) * (3 - 2 * var(--t)));
}

/* ---------- 8. Window frame (used by system scene, process scene, service previews) ---------- */
.win { container-type: inline-size; container-name: win; background: var(--white); color: var(--ink); border-radius: var(--r-l); box-shadow: var(--shadow-win); overflow: hidden; }
.win__in { font-size: clamp(10px, 1.28cqw, 15px); line-height: 1.35; }
.win__bar { display: flex; align-items: center; gap: 0.9em; padding: 0.95em 1.3em; background: #fbfbfc; border-bottom: 1px solid var(--mist); }
.win__dots { display: flex; gap: 0.5em; }
.win__dots i { width: 0.75em; height: 0.75em; border-radius: 50%; background: var(--mist-2); }
.win__title { font-weight: 700; letter-spacing: -0.01em; }
.win__tag { margin-left: auto; padding: 0.25em 0.8em; border-radius: 999px; background: var(--mist); color: var(--slate); font-size: 0.85em; font-weight: 500; }

/* ---------- 9. Call-to-action band ---------- */
.cta { position: relative; background: var(--ink); color: #fff; overflow: hidden; padding-block: clamp(110px, 16vw, 240px) clamp(90px, 12vw, 180px); }
.cta__mark { position: absolute; right: -4%; top: 50%; height: 135%; aspect-ratio: 260 / 304; width: auto; transform: translateY(-50%); opacity: 0.1; pointer-events: none; }
.cta__inner { position: relative; display: grid; gap: clamp(1.5rem, 3vw, 2.5rem); justify-items: start; }
.cta__title { font-size: clamp(2.6rem, 0.8rem + 6.6vw, 7rem); font-weight: 700; line-height: 0.98; letter-spacing: -0.048em; max-width: 12.5ch; text-wrap: balance; }
.cta__sub { max-width: 34rem; font-size: var(--fs-lead); line-height: 1.45; font-weight: 500; color: var(--slate-light); }
.cta__actions { display: flex; flex-wrap: wrap; gap: 0.9rem; }

/* ---------- 10. Footer ---------- */
.foot { position: relative; background: var(--ink); color: #fff; padding-top: clamp(56px, 7vw, 104px); overflow: hidden; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.foot__grid { display: grid; grid-template-columns: 1.7fr 1fr 1fr 1.2fr; gap: 2.5rem 3rem; }
.foot__lead { max-width: 22rem; font-size: 1.25rem; font-weight: 500; letter-spacing: -0.02em; line-height: 1.35; }
.foot__small { margin-top: 0.8rem; color: var(--slate-light); font-size: var(--fs-small); }
.foot__col { display: flex; flex-direction: column; }
.foot__col h2 { margin-bottom: 0.8rem; font-size: var(--fs-small); font-weight: 500; color: var(--slate-light); }
.foot__col a { padding: 0.4rem 0; font-weight: 500; opacity: 0.92; transition: color 0.25s, opacity 0.25s; width: fit-content; overflow-wrap: anywhere; }
.foot__col a:hover { color: var(--sky); opacity: 1; }
.foot__word { margin-top: clamp(48px, 9vw, 140px); height: clamp(60px, 15.5vw, 250px); overflow: hidden; color: var(--ink-3); }
.foot__word svg { display: block; width: calc(100% - 2 * var(--gutter)); margin-inline: auto; aspect-ratio: 714 / 118; height: auto; }
.foot__legal { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-block: 1.4rem 2rem; font-size: var(--fs-small); color: var(--slate-light); border-top: 1px solid rgba(255, 255, 255, 0.08); position: relative; background: var(--ink); }
.foot__legal a:hover { color: #fff; }
@media (max-width: 899px) { .foot__grid { grid-template-columns: 1fr 1fr; } .foot__about { grid-column: 1 / -1; } }
@media (max-width: 479px) { .foot__grid { grid-template-columns: 1fr; } }

/* ---------- 11. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
