/* ============ Tokens ============ */
:root {
  --bg: #060810;
  --bg-alt: #000000;
  --card-bg: #0e1420;
  --card-bg-alt: #0a0e18;
  --ink: #f3f5f9;
  --ink-soft: #9aa3b8;
  --ink-faint: #565f74;
  --line: rgba(243, 245, 249, 0.08);
  --line-strong: rgba(243, 245, 249, 0.16);
  --accent: #3e7bfa;
  --accent-soft: #86b3ff;
  --accent-dim: rgba(62, 123, 250, 0.18);
  --on-accent: #060810;

  --font-display: "Sora", "Segoe UI", sans-serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, monospace;

  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

@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;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  padding-inline: clamp(20px, 5vw, 64px);
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 800; text-wrap: balance; margin: 0; }
p { margin: 0; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; }

::selection { background: var(--accent); color: var(--on-accent); }

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

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--accent-soft);
  display: inline-block;
  margin-bottom: 14px;
}

/* ============ Progress bar ============ */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 60;
  background: var(--line);
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  transform-origin: left;
}

/* ============ Vignette ============ */
.vignette {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.4) 100%);
  mix-blend-mode: multiply;
}

/* ============ Custom cursor ============ */
.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 999;
  border-radius: 50%;
  transform: translate3d(-100px, -100px, 0);
}
.cursor-dot {
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  background: var(--accent-soft);
}
.cursor-ring {
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  transition: width 0.25s ease, height 0.25s ease, margin 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
}
.cursor-ring.is-hover {
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-color: var(--ink-soft);
}
.cursor-ring.is-active {
  width: 70px;
  height: 70px;
  margin: -35px 0 0 -35px;
  border-color: var(--accent);
  background: rgba(62, 123, 250, 0.14);
}
body.has-custom-cursor,
body.has-custom-cursor a,
body.has-custom-cursor button,
body.has-custom-cursor input,
body.has-custom-cursor textarea {
  cursor: none;
}
@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none !important; }
}

/* ============ Buttons ============ */
.btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.95em 1.7em;
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  will-change: transform;
}
.btn-primary {
  background: var(--ink);
  color: #10131a;
}
.btn-primary:hover { transform: translateY(-2px); opacity: 0.92; }
.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--accent-soft); color: var(--accent-soft); transform: translateY(-2px); }
.btn-block { width: 100%; justify-content: center; }

/* ============ Nav ============ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(6, 8, 16, 0.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1280px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 20px;
  gap: 24px;
}
.logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--ink);
}
.logo-tag { color: var(--ink-faint); font-weight: 600; margin-left: 0.35em; }

.nav-links ul { display: flex; gap: 32px; }
.nav-links a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  position: relative;
  padding-block: 4px;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.nav-links a:hover,
.nav-links a.active { color: var(--ink); }
.nav-links a.active::after,
.nav-links a:hover::after { transform: scaleX(1); }

.nav-cta { display: none; }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  cursor: pointer;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  display: block;
  width: 16px;
  height: 2px;
  background: var(--ink);
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle span::before { position: absolute; top: -5px; }
.nav-toggle span::after { position: absolute; top: 5px; }
.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { transform: translateY(5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after { transform: translateY(-5px) rotate(-45deg); }

.mobile-menu {
  display: none;
  flex-direction: column;
  gap: 20px;
  padding: 24px 0 32px;
  border-bottom: 1px solid var(--line);
  max-width: 1280px;
  margin-inline: auto;
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 1rem;
  font-weight: 600;
}
.mobile-menu a.btn { color: #10131a; width: fit-content; }

@media (min-width: 900px) {
  .nav-cta { display: inline-flex; }
  .nav-toggle { display: none; }
}
@media (max-width: 899px) {
  .nav-links { display: none; }
}

/* ============ Hero ============ */
.hero {
  position: relative;
  padding-top: clamp(64px, 12vh, 140px);
  padding-bottom: clamp(80px, 14vh, 160px);
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
}
.network-canvas {
  position: absolute;
  inset: -10% -5% -5% -5%;
  width: 110%;
  height: 120%;
  z-index: -2;
  display: block;
}
.hero-fade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(6, 8, 16, 0.15) 0%, rgba(6, 8, 16, 0.55) 55%, var(--bg) 100%);
}
.hero-inner {
  max-width: 1280px;
  margin-inline: auto;
  perspective: 1400px;
}
.hero-title {
  font-size: clamp(2.6rem, 7vw, 5.2rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
  max-width: 14ch;
  will-change: transform;
}
.hero-title .line { display: block; overflow: hidden; }
.hero-title .line-inner { display: inline-block; will-change: transform; }
.hero-sub {
  margin-top: 26px;
  max-width: 44ch;
  color: var(--ink-soft);
  font-size: 1.08rem;
  will-change: transform;
}
.hero-actions {
  margin-top: 38px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  will-change: transform;
}

/* ============ Sections ============ */
.section { padding-block: clamp(72px, 11vw, 128px); }
.section-alt { background: var(--bg-alt); }
.section-inner { max-width: 1280px; margin-inline: auto; }

/* ---- Pinned scroll scenes (desktop only, see script.js) ---- */
[data-stack] { position: relative; background-color: var(--bg); }

@media (min-width: 900px) and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  [data-stack] {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  [data-stack] .section-inner,
  [data-stack] .hero-inner {
    width: 100%;
  }
}
.section-title {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  max-width: 22ch;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}
.section-note {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin-bottom: 4px;
}

.reveal {
  opacity: 0;
  transform: translateY(28px) rotateX(6deg);
  transform-origin: top center;
}

/* ============ Services ============ */
.card-grid {
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.25s ease;
  will-change: transform;
}
.card:hover { border-color: var(--line-strong); }
.card h3, .card p { position: relative; z-index: 2; }
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.12), transparent 55%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.card:hover::before { opacity: 1; }

/* ============ Process ============ */
.process-list {
  margin-top: 56px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
  position: relative;
}
.process-line {
  position: absolute;
  top: 11px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
  z-index: 0;
}
.process-line-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transform-origin: left;
}
.process-step {
  position: relative;
  z-index: 1;
}
.step-num {
  font-family: var(--font-mono);
  color: var(--accent-soft);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  background: var(--bg-alt);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}
.process-step h3 {
  margin-top: 18px;
  font-size: 1.3rem;
}
.process-step p {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 0.94rem;
  max-width: 28ch;
}

/* ============ Work / Portfolio ============ */
.work-grid {
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.work-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.25s ease;
  will-change: transform;
}
.work-card:hover { border-color: var(--line-strong); }
.work-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.14), transparent 55%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.work-card:hover::after { opacity: 1; }
.work-mock {
  height: 170px;
  position: relative;
  background-size: 200% 200%;
}
.work-mock--a { background-image: linear-gradient(135deg, #0e1a3a 0%, #123166 40%, #3e7bfa 100%); }
.work-mock--b { background-image: linear-gradient(135deg, #0a1120 0%, #1a2c52 45%, #86b3ff 100%); }
.work-mock--c { background-image: linear-gradient(135deg, #08101f 0%, #0f2547 50%, #2f5fd0 100%); }
.work-mock::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 26px 26px;
}
.work-info {
  padding: 20px 22px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.work-info h3 { font-size: 1.15rem; }
.work-desc { margin-top: 8px; color: var(--ink-soft); font-size: 0.9rem; }
.work-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* ============ Contact ============ */
.contact-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 6vw, 72px);
}
.contact-lead {
  margin-top: 20px;
  color: var(--ink-soft);
  max-width: 40ch;
  font-size: 1.02rem;
}
.contact-list {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.contact-item:hover { border-color: var(--accent); transform: translateX(4px); }
.contact-icon { font-size: 1.1rem; }

.contact-form {
  background: var(--card-bg-alt);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: clamp(24px, 3vw, 34px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
  letter-spacing: 0.03em;
}
.field input,
.field textarea {
  font-family: var(--font-body);
  font-size: 0.98rem;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--ink-faint); }
.field textarea { resize: vertical; min-height: 110px; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--accent-soft); outline-offset: 1px; }
.field.invalid input,
.field.invalid textarea { border-color: #ff6b6b; }

.form-status {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent-soft);
  min-height: 1.2em;
}

/* ============ Footer ============ */
footer {
  padding-block: 40px;
  border-top: 1px solid var(--line);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.footer-brand {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.footer-location,
.footer-legal {
  font-size: 0.8rem;
  color: var(--ink-faint);
}

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .card-grid { grid-template-columns: 1fr 1fr; }
  .process-list { grid-template-columns: 1fr 1fr; row-gap: 40px; }
  .process-line { display: none; }
  .work-grid { grid-template-columns: 1fr 1fr; }
  .contact-inner { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .card-grid { grid-template-columns: 1fr; }
  .process-list { grid-template-columns: 1fr; }
  .work-grid { grid-template-columns: 1fr; }
  .nav-inner { padding-block: 16px; }
}
