/* ===== Design tokens ===== */
:root {
  --bg: #ffffff;
  --bg-alt: #f7f7f5;
  --ink: #11131a;
  --ink-soft: #4a4f5c;
  --ink-faint: #8a8f9c;
  --line: #e7e7e2;
  --accent: #4f46e5;
  --accent-soft: #eef0fe;
  --accent-ink: #3a32c4;

  --maxw: 1120px;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --radius: 16px;
  --radius-sm: 10px;

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

  --shadow: 0 1px 2px rgba(17, 19, 26, 0.04), 0 8px 24px rgba(17, 19, 26, 0.05);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

* { margin: 0; }

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

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

ul, ol { list-style: none; padding: 0; }

h1, h2, h3 {
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 600;
}

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

/* ===== Layout ===== */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(4.5rem, 9vw, 8rem);
}

.section-alt { background: var(--bg-alt); }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}

.site-header.scrolled {
  border-color: var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
}

.logo-text { font-size: 1.05rem; }
.logo-text-dim { color: var(--ink-faint); font-weight: 600; }

.nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav a {
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color 0.2s var(--ease);
}

.nav a:hover { color: var(--ink); }

.nav-cta {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff !important;
  font-weight: 500;
}

.nav-cta:hover { background: #000; }

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 1.8px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.2s var(--ease);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.8px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.8px) rotate(-45deg); }

.mobile-nav {
  display: none;
  flex-direction: column;
  padding: 0.5rem var(--gutter) 1.25rem;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.mobile-nav a {
  padding: 0.85rem 0;
  font-weight: 500;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
}

.mobile-nav a:first-child { border-top: none; }
.mobile-nav.open { display: flex; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.4rem;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.96rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease),
    border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--ink);
  color: #fff;
}
.btn-primary:hover {
  background: #000;
  box-shadow: var(--shadow);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--ink); }

.btn-lg {
  padding: 1rem 1.9rem;
  font-size: 1.05rem;
  font-family: var(--font-mono);
}

/* ===== Hero ===== */
.hero {
  position: relative;
  padding-block: clamp(4rem, 11vw, 9rem) clamp(4rem, 9vw, 7rem);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 60% at 78% 0%, rgba(79, 70, 229, 0.07), transparent 70%),
    linear-gradient(transparent 95%, var(--line) 95%) 0 0 / 100% 48px,
    linear-gradient(90deg, transparent 95%, var(--line) 95%) 0 0 / 48px 100%;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 35%, transparent 78%);
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 35%, transparent 78%);
  pointer-events: none;
}

.hero .container { position: relative; }

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  margin-bottom: 1.4rem;
}

.hero h1 {
  font-size: clamp(2.4rem, 6.4vw, 4.4rem);
  max-width: 16ch;
  margin-bottom: 1.4rem;
}

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

.hero-sub {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--ink-soft);
  max-width: 56ch;
  margin-bottom: 2.2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 3.5rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 760px;
  padding-top: 2.2rem;
  border-top: 1px solid var(--line);
}

.hero-stats dt {
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.hero-stats dd {
  color: var(--ink-soft);
  font-size: 0.94rem;
  line-height: 1.45;
}

/* ===== Section heads ===== */
.section-head {
  max-width: 640px;
  margin-bottom: 3.5rem;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
}

.section-head h2 {
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  margin-bottom: 1rem;
}

.section-intro {
  color: var(--ink-soft);
  font-size: 1.08rem;
}

/* ===== Service cards ===== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem 1.85rem;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease),
    border-color 0.3s var(--ease);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: #d9d9d2;
}

.card-num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 1.4rem;
}

.card h3 {
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
}

.card p {
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.card-tags li {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
}

/* ===== Steps ===== */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  counter-reset: step;
}

.step {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.85rem 1.6rem;
}

.step-no {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: #fff;
  background: var(--ink);
  width: 34px;
  height: 34px;
  line-height: 34px;
  text-align: center;
  border-radius: 9px;
  margin-bottom: 1.2rem;
}

.step h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.step p {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* ===== Work / About ===== */
.work-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

.work-copy h2 {
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  margin-bottom: 1.1rem;
}

.work-copy p {
  color: var(--ink-soft);
  margin-bottom: 1.1rem;
  max-width: 48ch;
}

.work-copy .btn { margin-top: 0.8rem; }

.work-list {
  display: grid;
  gap: 0.85rem;
}

.work-list li {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.4rem;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease);
}

.work-list li:hover {
  transform: translateX(4px);
  background: #fff;
}

.work-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent-ink);
  margin-bottom: 0.35rem;
}

.work-list p {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* ===== CTA ===== */
.cta {
  padding-block: clamp(4.5rem, 9vw, 7.5rem);
}

.cta-inner {
  text-align: center;
  max-width: 680px;
  margin-inline: auto;
  background: var(--ink);
  color: #fff;
  border-radius: 28px;
  padding: clamp(3rem, 6vw, 4.5rem) clamp(1.5rem, 5vw, 3.5rem);
  position: relative;
  overflow: hidden;
}

.cta-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 100% at 50% 0%, rgba(79, 70, 229, 0.45), transparent 65%);
  pointer-events: none;
}

.cta-inner > * { position: relative; }

.cta-inner h2 {
  font-size: clamp(1.8rem, 4.5vw, 2.7rem);
  margin-bottom: 1rem;
}

.cta-inner p {
  color: rgba(255, 255, 255, 0.72);
  font-size: 1.08rem;
  max-width: 46ch;
  margin-inline: auto;
  margin-bottom: 2rem;
}

.cta .btn-primary {
  background: #fff;
  color: var(--ink);
}
.cta .btn-primary:hover { background: var(--accent-soft); }

.cta-fine {
  font-size: 0.9rem !important;
  margin-top: 1.4rem;
  margin-bottom: 0 !important;
  color: rgba(255, 255, 255, 0.5) !important;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 3rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.footer-brand p {
  color: var(--ink-faint);
  font-size: 0.9rem;
  margin-top: 0.35rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-nav a {
  font-size: 0.92rem;
  color: var(--ink-soft);
  transition: color 0.2s var(--ease);
}
.footer-nav a:hover { color: var(--ink); }

.footer-copy {
  width: 100%;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 0.86rem;
}

/* ===== Reveal animation ===== */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

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

/* Stagger children of grids a touch */
.cards .reveal:nth-child(2) { transition-delay: 0.08s; }
.cards .reveal:nth-child(3) { transition-delay: 0.16s; }
.steps .reveal:nth-child(2) { transition-delay: 0.06s; }
.steps .reveal:nth-child(3) { transition-delay: 0.12s; }
.steps .reveal:nth-child(4) { transition-delay: 0.18s; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .nav { display: none; }
  .nav-toggle { display: flex; }

  .work-grid { grid-template-columns: 1fr; }

  .hero-stats {
    grid-template-columns: 1fr;
    gap: 1.1rem;
  }
}

@media (max-width: 520px) {
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { width: 100%; }
}

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