/* ------------------------------------------------------------------
   Kervanto — design tokens
   ------------------------------------------------------------------ */

:root {
  --bg: #05070b;
  --bg-elevated: #0b0f16;
  --line: #1a2230;
  --text: #f4f6fb;
  --muted: #8a94a8;
  --blue: #3d72ff;
  --blue-soft: #7ea4ff;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --header-h: 80px;
  --radius: 6px;
  --max: 1240px;

  color-scheme: dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 "Inter Tight", system-ui, sans-serif;
  overflow-x: hidden;
}

body.nav-open {
  overflow: hidden;
}

h1,
h2,
h3 {
  font-family: Sora, "Inter Tight", sans-serif;
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--blue-soft);
  outline-offset: 3px;
}

img,
svg {
  display: block;
  max-width: 100%;
}

.container {
  width: min(var(--max), 100% - 48px);
  margin: 0 auto;
}

section {
  padding: 130px 0;
  position: relative;
}

p {
  margin: 0;
  color: var(--muted);
  max-width: 56ch;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--blue);
  color: #fff;
  border-radius: 4px;
}

.skip-link:focus {
  top: 12px;
}

/* ------------------------------------------------------------------
   Custom cursor
   ------------------------------------------------------------------ */

.cursor,
.cursor-ring {
  position: fixed;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 99;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s;
}

.cursor {
  width: 6px;
  height: 6px;
  background: #fff;
  margin: -3px 0 0 -3px;
}

.cursor-ring {
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border: 1px solid rgba(126, 164, 255, 0.6);
  transition: width 0.25s, height 0.25s, margin 0.25s, background 0.25s, opacity 0.3s;
}

.cursor-ring.is-large {
  width: 84px;
  height: 84px;
  margin: -42px 0 0 -42px;
  background: rgba(61, 114, 255, 0.16);
}

/* Native arrow hidden only while the custom dot + ring are active */
.has-cursor,
.has-cursor * {
  cursor: none !important;
}

@media (pointer: coarse) {
  .cursor,
  .cursor-ring {
    display: none;
  }
}

/* ------------------------------------------------------------------
   Header
   ------------------------------------------------------------------ */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 0 18px;
  transition: transform 0.45s;
}

.site-header.is-hidden {
  transform: translateY(-110%);
}

/* Background lives on a pseudo-element and fades via opacity only.
   No backdrop-filter: re-blurring the page under a fixed header on every
   scroll frame was a major source of jank. */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(5, 7, 11, 0.92);
  box-shadow: 0 1px 0 rgba(26, 34, 48, 0.8);
  opacity: 0;
  transition: opacity 0.3s;
}

.site-header.is-solid::before {
  opacity: 1;
}

.bar {
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand img,
.brand svg {
  height: 22px;
  width: auto;
  fill: #fff;
}

.brand b {
  font: 400 15px Sora, sans-serif;
  letter-spacing: 0.28em;
}

.brand i {
  font-style: normal;
  font-size: 13px;
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 14px;
  line-height: 1.3;
  display: none;
}

@media (min-width: 1180px) {
  .brand i {
    display: block;
  }
}

.nav {
  margin-left: auto;
  display: flex;
  gap: 30px;
  font-size: 15px;
}

.nav a {
  position: relative;
  color: #cfd6e6;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1px;
  background: var(--blue-soft);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s;
}

.nav a:hover::after {
  transform: scaleX(1);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 99px;
  border: 1px solid rgba(126, 164, 255, 0.45);
  background: rgba(61, 114, 255, 0.12);
  color: #fff;
  font: 500 15px "Inter Tight", sans-serif;
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
  will-change: transform;
}

.btn:hover {
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 0 40px rgba(61, 114, 255, 0.5);
}

.btn--sm {
  padding: 10px 20px;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  z-index: 60;
}

.lang-switch button {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 8px;
  font: 400 12px Sora, sans-serif;
  letter-spacing: 0.12em;
  transition: color 0.25s;
}

.lang-switch button[aria-pressed="true"] {
  color: #fff;
}

.lang-switch button:not([aria-pressed="true"]):hover {
  color: #cfd6e6;
}

.burger {
  display: none;
  margin-left: auto;
  background: none;
  border: 0;
  color: #fff;
  width: 40px;
  height: 40px;
  cursor: pointer;
  padding: 0;
}

.burger span {
  display: block;
  height: 1.5px;
  background: #fff;
  margin: 7px 8px;
  transition: transform 0.3s;
}

.burger[aria-expanded="true"] span:first-child {
  transform: translateY(4.25px) rotate(45deg);
}

.burger[aria-expanded="true"] span:last-child {
  transform: translateY(-4.25px) rotate(-45deg);
}

@media (max-width: 860px) {
  .nav {
    position: fixed;
    inset: 0;
    background: var(--bg);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 26px;
    font: 300 32px Sora, sans-serif;
    transform: translateY(-100%);
    visibility: hidden;
    transition: transform 0.5s cubic-bezier(0.7, 0, 0.2, 1), visibility 0s 0.5s;
    margin: 0;
  }

  .nav.is-open {
    transform: none;
    visibility: visible;
    transition: transform 0.5s cubic-bezier(0.7, 0, 0.2, 1);
  }

  .bar {
    gap: 16px;
  }

  .brand {
    flex-shrink: 0;
    gap: 12px;
  }

  .brand b {
    letter-spacing: 0.2em;
  }

  .lang-switch {
    margin-left: auto;
  }

  .burger {
    display: block;
    z-index: 60;
    position: relative;
    margin-left: 0;
    flex-shrink: 0;
  }

  .bar > .btn {
    display: none;
  }
}

@media (max-width: 374px) {
  .brand b {
    display: none;
  }
}

/* ------------------------------------------------------------------
   Hero
   ------------------------------------------------------------------ */

.hero {
  min-height: 100svh;
  padding: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
}

.hero .container {
  position: relative;
  z-index: 2;
  padding-top: 110px;
  padding-bottom: 70px;
}

h1 {
  font-size: clamp(44px, 7.4vw, 112px);
  max-width: 11.5em;
  position: relative;
  text-shadow: 0 8px 40px rgba(5, 7, 11, 0.7);
}

.line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
}

.line-inner {
  display: block;
  transform: translateY(110%);
  animation: rise 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  animation-delay: calc(var(--i) * 0.12s + 0.25s);
}

.line-inner span[hidden] {
  display: none;
}

@keyframes rise {
  to {
    transform: none;
  }
}

.hero p {
  margin: 34px 0 40px;
  font-size: 19px;
  color: #a9b3c7;
  opacity: 0;
  animation: fade 1s 0.95s forwards;
}

.hero .btn {
  opacity: 0;
  animation: fade 1s 1.15s forwards;
}

@keyframes fade {
  to {
    opacity: 1;
  }
}

.hero-hint {
  position: absolute;
  right: 24px;
  bottom: 28px;
  z-index: 2;
  font-size: 13px;
  color: var(--muted);
  writing-mode: vertical-rl;
}

/* ------------------------------------------------------------------
   Marquee
   ------------------------------------------------------------------ */

.marquee {
  border-block: 1px solid var(--line);
  overflow: hidden;
  padding: 26px 0;
  background: var(--bg-elevated);
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 38s linear infinite;
}

.marquee span {
  font: 300 clamp(28px, 4vw, 52px) Sora, sans-serif;
  color: #2a3550;
  padding-right: 60px;
  white-space: nowrap;
}

.marquee span:nth-child(3n + 1) {
  color: #cfd8ee;
}

@keyframes marquee {
  to {
    transform: translateX(-50%);
  }
}

/* ------------------------------------------------------------------
   Stats
   ------------------------------------------------------------------ */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}

.stat {
  padding: 50px 30px 20px 0;
}

.stat + .stat {
  padding-left: 40px;
  border-left: 1px solid var(--line);
}

.stat strong {
  display: block;
  font: 300 clamp(60px, 9vw, 140px) / 1 Sora, sans-serif;
  letter-spacing: -0.04em;
  background: linear-gradient(180deg, #fff 30%, #5d86ee);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat span {
  color: var(--muted);
}

@media (max-width: 700px) {
  .stats {
    grid-template-columns: 1fr;
  }

  .stat + .stat {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

/* ------------------------------------------------------------------
   Section headings
   ------------------------------------------------------------------ */

.heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 40px;
  margin-bottom: 70px;
  flex-wrap: wrap;
}

.heading h2 {
  font-size: clamp(36px, 5vw, 72px);
  max-width: 13em;
}

/* ------------------------------------------------------------------
   Industries
   ------------------------------------------------------------------ */

.industries a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 44px 0;
  border-top: 1px solid var(--line);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.industries a:last-child {
  border-bottom: 1px solid var(--line);
}

.industries a::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(
    420px circle at var(--x, 50%) var(--y, 50%),
    rgba(61, 114, 255, 0.32),
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.4s;
}

.industries a:hover::before {
  opacity: 1;
}

.industries h3 {
  font-size: clamp(34px, 6vw, 88px);
  transition: transform 0.5s var(--ease);
}

.industries a:hover h3 {
  transform: translateX(26px);
}

.industries p {
  max-width: 30ch;
  text-align: right;
  font-size: 16px;
}

@media (max-width: 700px) {
  .industries a {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .industries p {
    text-align: left;
  }
}

/* ------------------------------------------------------------------
   Cases
   ------------------------------------------------------------------ */

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

.case {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  transform-style: preserve-3d;
  transition: transform 0.2s, border-color 0.3s;
  position: relative;
  overflow: hidden;
}

.case:hover {
  border-color: #2d4590;
}

.case::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -90px;
  top: -90px;
  background: radial-gradient(circle, rgba(61, 114, 255, 0.35), transparent 70%);
  pointer-events: none;
}

.case-meta {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue-soft);
  margin-bottom: -10px;
}

.case h3 {
  font-size: 26px;
}

.case-result {
  display: grid;
  gap: 8px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.metric-caption {
  font-size: 14px;
  color: var(--muted);
}

.case .metric {
  display: block;
  font: 300 64px / 1 Sora, sans-serif;
  color: var(--blue-soft);
  letter-spacing: -0.04em;
}

.case dl {
  margin: 0;
  display: grid;
  gap: 14px;
  font-size: 15px;
}

.case dt {
  color: #fff;
  font-weight: 500;
}

.case dd {
  margin: 0;
  color: var(--muted);
}

.tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}

.tools span {
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 4px 12px;
  color: #b8c2d8;
}

@media (max-width: 960px) {
  .cases {
    grid-template-columns: 1fr;
  }
}

/* Side-by-side cards: reserve two title lines so the big numbers line up */
@media (min-width: 961px) {
  .case h3 {
    min-height: 2.1em;
  }
}

/* ------------------------------------------------------------------
   Services
   ------------------------------------------------------------------ */

.services {
  border-top: 1px solid var(--line);
}

.services details {
  border-bottom: 1px solid var(--line);
}

.services summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 34px 0;
  font: 300 clamp(26px, 3.6vw, 50px) Sora, sans-serif;
  letter-spacing: -0.02em;
  transition: color 0.3s, padding 0.4s;
}

.services summary::-webkit-details-marker {
  display: none;
}

.services summary::after {
  content: "+";
  font-size: 40px;
  color: var(--blue-soft);
  transition: transform 0.4s;
}

.services details.is-open summary::after {
  transform: rotate(135deg) scale(1.1);
}

html:not(.js) .services details[open] summary::after {
  transform: rotate(45deg);
}

.services summary:hover,
.services details.is-open summary {
  color: var(--blue-soft);
  padding-left: 14px;
}

.svc-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.7s cubic-bezier(0.65, 0, 0.35, 1);
}

.services details.is-open .svc-panel {
  grid-template-rows: 1fr;
}

.svc-panel-inner {
  overflow: hidden;
  min-height: 0;
}

.services details p {
  padding: 0 0 38px;
  font-size: 18px;
  opacity: 0;
  transform: translateY(18px);
  filter: blur(6px);
  transition: opacity 0.35s, transform 0.35s var(--ease), filter 0.35s;
}

.services details.is-open p {
  opacity: 1;
  transform: none;
  filter: none;
  transition: opacity 0.6s 0.2s, transform 0.7s 0.2s var(--ease), filter 0.6s 0.2s;
}

html:not(.js) .services details[open] .svc-panel {
  grid-template-rows: 1fr;
}

html:not(.js) .services details[open] p {
  opacity: 1;
  transform: none;
  filter: none;
}

/* ------------------------------------------------------------------
   Why
   ------------------------------------------------------------------ */

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

.why div {
  grid-column: span 2;
  padding: 34px 0 0;
  border-top: 1px solid var(--line);
}

.why div:nth-child(n + 4) {
  grid-column: span 3;
}

.why h3 {
  font-size: 26px;
  margin-bottom: 14px;
  font-weight: 400;
}

@media (max-width: 800px) {
  .why div,
  .why div:nth-child(n + 4) {
    grid-column: span 6;
  }
}

/* ------------------------------------------------------------------
   Process
   ------------------------------------------------------------------ */

.process {
  position: relative;
  padding-left: 64px;
}

.process::before,
.process-fill {
  content: "";
  position: absolute;
  left: 19px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--line);
}

/* Scaled with transform (compositor only) instead of animating height */
.process-fill {
  background: linear-gradient(var(--blue-soft), var(--blue));
  box-shadow: 0 0 18px var(--blue);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.15s linear;
  will-change: transform;
}

.step {
  position: relative;
  padding: 0 0 70px;
}

.step:last-child {
  padding-bottom: 0;
}

.step::before {
  content: attr(data-n);
  position: absolute;
  left: -64px;
  top: -4px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font: 400 14px Sora, sans-serif;
  color: var(--muted);
  transition: all 0.4s;
}

.step.is-active::before {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
  box-shadow: 0 0 24px rgba(61, 114, 255, 0.7);
}

.step h3 {
  font-size: clamp(24px, 4vw, 52px);
  overflow-wrap: break-word;
  hyphens: auto;
  margin-bottom: 12px;
  color: #5a6479;
  transition: color 0.4s;
}

.step.is-active h3 {
  color: #fff;
}

/* ------------------------------------------------------------------
   Formats
   ------------------------------------------------------------------ */

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

.formats article {
  padding: 40px 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--bg-elevated), var(--bg));
  transition: border-color 0.3s, transform 0.4s;
}

.formats article:hover {
  border-color: #2d4590;
  transform: translateY(-6px);
}

.formats h3 {
  font-size: 28px;
  margin-bottom: 16px;
  font-weight: 400;
}

.formats article:nth-child(2) {
  background: linear-gradient(160deg, #112054, #070b17);
  border-color: #2a3f8c;
}

@media (max-width: 900px) {
  .formats {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------------
   Contact
   ------------------------------------------------------------------ */

.cta {
  background:
    radial-gradient(900px circle at 85% 100%, rgba(61, 114, 255, 0.28), transparent 60%),
    var(--bg);
  border-top: 1px solid var(--line);
}

.cta h2 {
  font-size: clamp(44px, 8vw, 128px);
  margin-bottom: 60px;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 70px;
}

.contact-form {
  display: grid;
  gap: 26px;
}

.field {
  position: relative;
}

.field input,
.field textarea {
  width: 100%;
  background: none;
  border: 0;
  border-bottom: 1px solid #2a3550;
  color: #fff;
  font: 400 18px "Inter Tight", sans-serif;
  padding: 22px 0 10px;
  resize: none;
  transition: border-color 0.3s;
}

.field input:focus,
.field textarea:focus {
  outline: 0;
  border-color: var(--blue-soft);
}

.field.is-invalid input,
.field.is-invalid textarea {
  border-color: #ff6b7a;
}

.field label {
  position: absolute;
  left: 0;
  top: 22px;
  color: var(--muted);
  pointer-events: none;
  transition: all 0.25s;
}

.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field textarea:focus + label,
.field textarea:not(:placeholder-shown) + label {
  top: 0;
  font-size: 13px;
  color: var(--blue-soft);
}

.field-error {
  display: none;
  margin-top: 8px;
  font-size: 13px;
  color: #ff6b7a;
}

.field.is-invalid .field-error {
  display: block;
}

.contact-meta {
  display: grid;
  gap: 26px;
  align-content: start;
}

.contact-meta b {
  display: block;
  font-weight: 500;
  color: #fff;
  margin-bottom: 4px;
}

.form-status {
  display: none;
  color: var(--blue-soft);
  font-size: 19px;
}

.form-status.is-visible {
  display: block;
}

.form-status.is-error {
  color: #ff6b7a;
}

@media (max-width: 900px) {
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 50px;
  }
}

/* ------------------------------------------------------------------
   Footer
   ------------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 34px 0;
  font-size: 14px;
  color: var(--muted);
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* ------------------------------------------------------------------
   Reveal
   ------------------------------------------------------------------ */

.js .reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.9s, transform 0.9s var(--ease);
}

.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

/* ------------------------------------------------------------------
   Russian type
   Sora has no Cyrillic; Onest keeps the same geometric display voice.
   ------------------------------------------------------------------ */

html[lang="ru"] h1,
html[lang="ru"] h2,
html[lang="ru"] h3,
html[lang="ru"] .stat strong,
html[lang="ru"] .metric,
html[lang="ru"] .services summary,
html[lang="ru"] .step h3,
html[lang="ru"] .marquee span,
html[lang="ru"] .cta h2 {
  font-family: Onest, "Inter Tight", sans-serif;
}

@media (max-width: 860px) {
  html[lang="ru"] .nav {
    font-family: Onest, "Inter Tight", sans-serif;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01s !important;
    animation-delay: 0s !important;
    transition-duration: 0.01s !important;
  }

  .marquee-track {
    animation: none;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }
}
