/* ============================================================
   Kernel Of Solutions (KOS) — premium dark-tech personal brand site
   Recreated from the "PathOps AI - v3" design component.
   Edit brand colors / fonts via the :root tokens below.
   ============================================================ */

:root {
  /* Surfaces */
  --bg:            #050507;   /* near-black page background */
  --bg-panel:      #08090d;   /* slightly lighter panel (infra cells) */
  --glass:         rgba(255, 255, 255, 0.025);
  --glass-hover:   rgba(43, 111, 255, 0.06);

  /* Text */
  --fg:            #e8eaed;
  --fg-strong:     #ffffff;
  --muted:         #a4a9b2;
  --muted-2:       #9aa0a8;
  --muted-3:       #8a8f98;
  --muted-4:       #6f7680;
  --muted-5:       #5a6069;
  --muted-6:       #4a5059;

  /* Accent — electric blue. Change here to re-tint the whole site. */
  --accent:        #2b6fff;
  --accent-soft:   rgba(43, 111, 255, 0.12);

  /* Lines / borders */
  --line:          rgba(255, 255, 255, 0.08);
  --line-soft:     rgba(255, 255, 255, 0.06);

  /* Type */
  --font-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;

  /* Layout */
  --maxw: 1320px;
  --pad-x: clamp(20px, 5vw, 64px);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: rgba(43, 111, 255, 0.35); color: #fff; }

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

.accent { color: var(--accent); }
.muted  { color: var(--muted-4); }

/* ---------- Scene layers ---------- */
.scene-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.scene-vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(120% 80% at 70% 20%, transparent 30%, rgba(5, 5, 7, 0.55) 75%, var(--bg) 100%);
}
.content { position: relative; z-index: 2; }

/* ---------- Navigation ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px var(--pad-x);
  backdrop-filter: blur(14px);
  background: linear-gradient(180deg, rgba(5, 5, 7, 0.7), rgba(5, 5, 7, 0));
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 16px;
}
.nav-dot {
  width: 9px; height: 9px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 14px 2px rgba(43, 111, 255, 0.9);
  display: inline-block;
}
.nav-logo-sub { color: var(--muted-4); font-weight: 500; }
.nav-logo-mark { letter-spacing: 0.02em; }
.nav-logo-full { margin-left: 10px; font-size: 13px; letter-spacing: 0.01em; }
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 34px);
  font-size: 13.5px;
  color: var(--muted-2);
}
.navlink { transition: color 0.3s ease; }
.navlink:hover { color: var(--fg); }
.navlink--hidden { display: none; }
.nav-cta {
  padding: 9px 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: var(--fg);
  transition: all 0.3s ease;
}
.nav-cta:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #fff;
}

/* mobile bottom tab bar (section jumps) — hidden on desktop */
.tabbar { display: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--pad-x);
  max-width: var(--maxw);
  margin: 0 auto;
  /* "camera" for the multi-plane fold (scoped to hero so it can't reach the
     sticky pin in #process — that would break position: sticky) */
  perspective: 850px;
  perspective-origin: 65% 30%;
}

/* hero content rides on a plane that folds back + fades on scroll (--hp 0→1,
   set from app.js). Layers get depth (translateZ) that grows with --hp, so the
   hero is undistorted at rest and separates into planes only as it folds. */
.hero-stage {
  display: flex;
  flex-direction: column;
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
  transform: rotateX(calc(var(--hp, 0) * -40deg)) rotateY(calc(var(--hp, 0) * -40deg)) scale(calc(1 - var(--hp, 0) * 0.06));
  opacity: calc(1 - var(--hp, 0) * 1.18);
}
.hero-stage .hero-badge   { transform: translateZ(calc(var(--hp, 0) * 70px)); }
.hero-stage .hero-title   { transform: translateZ(calc(var(--hp, 0) * 130px)); }
.hero-stage .hero-sub     { transform: translateZ(calc(var(--hp, 0) * 50px)); }
.hero-stage .hero-cta-row { transform: translateZ(calc(var(--hp, 0) * 25px)); }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  margin-bottom: 30px;
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-3);
  background: rgba(255, 255, 255, 0.02);
}
.hero-badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px 1px var(--accent);
  animation: pop-blink 2.4s ease-in-out infinite;
}
.hero-title {
  margin: 0;
  font-size: clamp(34px, 7.4vw, 100px);
  line-height: 0.98;
  letter-spacing: -0.035em;
  font-weight: 700;
  max-width: 18ch;
  overflow-wrap: break-word; /* keep long words (e.g. "IT-інфраструктура.") inside narrow screens */
}
.hero-sub {
  margin: 34px 0 0;
  max-width: 56ch;
  font-size: clamp(16px, 1.7vw, 20px);
  line-height: 1.55;
  color: var(--muted);
}
.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 42px;
}
.hero-scroll-hint {
  position: absolute;
  bottom: 34px;
  left: var(--pad-x);
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-5);
}
.hero-scroll-line {
  width: 30px; height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary {
  padding: 16px 28px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 8px 40px -8px rgba(43, 111, 255, 0.7);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 50px -8px rgba(43, 111, 255, 0.9);
}
.btn-primary--sm {
  padding: 14px 24px;
  font-size: 14.5px;
  gap: 9px;
  box-shadow: 0 8px 36px -10px rgba(43, 111, 255, 0.8);
}
.btn-arrow { font-size: 17px; }
.btn-ghost {
  padding: 16px 28px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--fg);
  font-size: 15px;
  font-weight: 500;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.04);
}

/* ---------- Generic section / type ---------- */
.section {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(80px, 12vh, 140px) var(--pad-x);
}
.container { max-width: var(--maxw); margin: 0 auto; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--accent);
}
.eyebrow-row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 28px;
}
.rule { height: 1px; flex: 1; background: var(--line); }

.section-title {
  margin: 0 0 clamp(40px, 6vh, 64px);
  font-size: clamp(30px, 4.4vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 700;
}
.section-title--xl {
  font-size: clamp(34px, 6vw, 92px);
  line-height: 0.98;
  letter-spacing: -0.035em;
  margin-bottom: 28px;
}
.lead {
  margin: 0 0 36px;
  font-size: clamp(16px, 1.7vw, 19px);
  line-height: 1.55;
  color: var(--muted);
  max-width: 48ch;
}

/* ---------- Process (scroll-driven) ---------- */
.process {
  min-height: 220vh;
  padding-top: clamp(80px, 14vh, 160px);
  padding-bottom: clamp(80px, 14vh, 160px);
}
.process-sticky {
  position: sticky;
  top: 0;
  /* min must exceed the fixed nav height (~82px) so the pinned heading clears it
     once revealed (the .reveal transform offsets it while it animates in) */
  padding-top: clamp(102px, 12vh, 132px);
  padding-bottom: 10px;
}
.process .eyebrow-row { margin-bottom: clamp(16px, 2.6vh, 30px); }
.process .section-title { margin-bottom: clamp(16px, 2.8vh, 34px); }

/* Mobile: the full pinned block is taller than the screen, so the desktop
   freeze/scrub model breaks (overlap, messy slide-under). On phones the heading
   flows normally and the steps reveal as they scroll into view
   (handled by initProcessStepper). */
@media (max-width: 760px) {
  body { overflow-x: clip; } /* kill any sideways panning */
  /* Same as desktop: the whole heading+steps block pins and the steps reveal
     one-by-one via the scroll scrub. Just tighter spacing so the pinned block
     fits a phone screen. */
  .process-sticky { padding-bottom: 10px; } /* padding-top inherits the base clamp (clears the nav) */
  .process .eyebrow-row { margin-bottom: 14px; }
  .process .section-title { margin-bottom: clamp(16px, 3vh, 28px); }
  .steps { gap: 14px; }
  .step-desc { font-size: 14px; }
}
.steps {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2vh, 22px);
  max-width: 760px;
}
.step {
  position: relative;
  padding-left: 30px;
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              color 0.5s ease;
}
/* Scroll-stepper: steps are hidden until revealed one-by-one (the heading
   stays pinned). Without JS the class is absent, so steps stay visible. */
.steps.is-scroll-stepped .step {
  opacity: 0;
  transform: translateY(24px);
}
.steps.is-scroll-stepped .step.is-revealed {
  opacity: 1;
  transform: translateY(0);
}
.step-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  transition: all 0.5s ease;
}
.step.is-active .step-bar {
  background: var(--accent);
  box-shadow: 0 0 18px 1px rgba(43, 111, 255, 0.8);
}
.step-body { display: flex; align-items: baseline; gap: 18px; }
.step-num {
  font-family: var(--font-mono);
  font-size: clamp(17px, 1.9vw, 24px);
  font-weight: 700;
  color: var(--muted-6);
  transition: color 0.5s ease;
  min-width: 1.6em;
}
.step.is-active .step-num { color: var(--accent); }
.step-title {
  margin: 0 0 7px;
  font-size: clamp(19px, 1.9vw, 25px);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.step-desc {
  margin: 0;
  font-size: clamp(14px, 1.3vw, 16px);
  line-height: 1.5;
  color: var(--muted-2);
  max-width: 52ch;
}

/* ---------- Services ---------- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.card {
  position: relative;
  padding: 28px 26px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  overflow: hidden;
  transition: border-color 0.4s ease, transform 0.4s ease, background 0.4s ease;
}
.card:hover {
  border-color: rgba(43, 111, 255, 0.5);
  transform: translateY(-4px);
  background: var(--glass-hover);
}
.card-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.08em;
}
.card-title {
  margin: 14px 0 10px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.card-desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted-3);
}

/* ---------- AI Agents ---------- */
.agents-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr);
  gap: clamp(40px, 6vw, 90px);
  align-items: start;
}
.agent-caps { display: flex; flex-direction: column; gap: 10px; }
.cap {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  transition: border-color 0.35s ease, background 0.35s ease;
}
.cap:hover {
  border-color: rgba(43, 111, 255, 0.45);
  background: rgba(43, 111, 255, 0.05);
}
.cap-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px 1px rgba(43, 111, 255, 0.9);
  flex-shrink: 0;
}
.cap-text { font-size: 15.5px; color: #d2d6dc; line-height: 1.4; }

/* ---------- Infrastructure ---------- */
.infra {
  max-width: none;
  padding: clamp(90px, 14vh, 170px) var(--pad-x);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.infra-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  overflow: hidden;
}
.infra-cell {
  padding: 30px 28px;
  background: var(--bg-panel);
  transition: background 0.4s ease;
}
.infra-cell:hover { background: rgba(43, 111, 255, 0.05); }
.infra-k {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 14px;
}
.infra-title { margin: 0 0 9px; font-size: 19px; font-weight: 600; }
.infra-desc { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted-3); }

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr);
  gap: clamp(40px, 6vw, 90px);
  align-items: start;
}
/* trim the bottom void so the footer sits close under the contact content */
#contact { padding-bottom: clamp(48px, 7vh, 96px); }
/* Desktop (with enough viewport height): spread the two blocks diagonally
   (text upper-left, form lower-right) so the centre opens up for the orbit.
   The min-height is capped so the top heading never slides under the fixed nav
   when the form (bottom) is in view; on short viewports the diagonal is off. */
@media (min-width: 861px) and (min-height: 800px) {
  .contact-grid {
    /* as much diagonal as fits while the top heading still clears the nav */
    min-height: min(78vh, calc(100vh - 348px));
    align-items: stretch;
  }
  .contact-grid > div:first-child { align-self: start; }  /* text → upper-left */
  .contact-grid > .form { align-self: end; }              /* form → lower-right */
  /* a more compact form sits lower (its bottom is pinned), widening the diagonal */
  .form { gap: 11px; padding: clamp(20px, 2vw, 30px); }
  .form input, .form select, .form textarea { padding: 12px 15px; }
  .form textarea { height: 86px; }
}
.contact-sub {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted-2);
  max-width: 40ch;
}
.form {
  display: grid;
  gap: 14px;
  min-width: 0; /* allow the form to shrink inside its grid column */
  padding: clamp(24px, 3vw, 36px);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  background: var(--glass);
  backdrop-filter: blur(14px);
}
/* minmax(0,1fr) lets the two fields shrink below their intrinsic width
   instead of forcing the form wider than the screen */
.form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.form input,
.form select,
.form textarea {
  width: 100%;
  min-width: 0; /* fields must be allowed to shrink, or they overflow on mobile */
  padding: 15px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.3);
  color: var(--fg);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.3s ease;
}
.form select { color: #c4c8ce; }
.form textarea { resize: vertical; }
.form input:focus,
.form select:focus,
.form textarea:focus { border-color: var(--accent); }
.form input::placeholder,
.form textarea::placeholder { color: var(--muted-3); }
.submit-btn {
  margin-top: 4px;
  padding: 16px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 8px 36px -10px rgba(43, 111, 255, 0.8);
  transition: transform 0.3s ease, background 0.3s ease;
}
.submit-btn:hover { transform: translateY(-2px); }
.submit-btn.is-sent { background: #1f8a5b; }

/* ---------- Footer ---------- */
.footer {
  position: relative;
  padding: clamp(34px, 5vh, 56px) var(--pad-x) clamp(34px, 5vh, 56px);
  border-top: 1px solid var(--line-soft);
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: flex-end;
  justify-content: space-between;
}
.footer-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  font-size: 19px;
  margin-bottom: 12px;
}
.footer-dot {
  width: 9px; height: 9px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 14px 2px rgba(43, 111, 255, 0.9);
}
.footer-logo-sub { color: var(--muted-6); font-weight: 400; font-size: 15px; }
.footer-tagline {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.1em;
  color: var(--muted-4);
}
.footer-copy {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-6);
}

/* ---------- Reveal-on-scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.in { opacity: 1; transform: translateY(0); }

@keyframes pop-blink { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes float-up { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .agents-grid,
  .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .nav-links .navlink { display: none; }
  .nav-logo-full { display: none; }

  /* single-column cards + form fields on phones (avoids min-width overflow) */
  .services-grid { grid-template-columns: 1fr; }
  .infra-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }

  /* leave room so content can scroll clear of the fixed tab bar */
  body { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }

  /* fixed bottom tab bar — quick jump between sections */
  .tabbar {
    display: flex;
    position: fixed;
    left: 12px; right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 60;
    align-items: stretch;
    height: 58px;
    background: rgba(12, 13, 18, 0.92);
    backdrop-filter: blur(18px);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  }
  .tabbar a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    letter-spacing: 0.01em;
    color: var(--muted);
    transition: color 0.2s ease;
  }
  .tabbar a:active { color: #fff; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  /* keep the sequential reveal, but drop the slide motion (opacity only) */
  .steps.is-scroll-stepped .step {
    transform: none !important;
    transition: opacity 0.3s ease !important;
  }
  .hero-badge-dot { animation: none; }
  /* no scroll-fold: keep hero flat and fully visible */
  .hero-stage { transform: none !important; opacity: 1 !important; }
  .hero-stage .hero-badge,
  .hero-stage .hero-title,
  .hero-stage .hero-sub,
  .hero-stage .hero-cta-row { transform: none !important; }
}
