:root {
  --bg: #121212;
  --surface: #1a1a1a;
  --surface-2: #222222;
  --line: #2c2c2c;
  --white: #f2f2f0;
  --gray: #a1a1a1;
  --gray-2: #6b6b6b;

  --f-sans: "Geist", system-ui, sans-serif;
  --f-mono: "Geist Mono", ui-monospace, monospace;

  --pad: clamp(16px, 4vw, 48px);
  --max: 1200px;
  --radius: 14px;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--white);
  font: 400 16px/1.6 var(--f-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
::selection { background: var(--white); color: var(--bg); }
:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; border-radius: 4px; }

.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--pad); }
.label { font: 500 12px/1.4 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--gray); }
.muted { color: var(--gray-2); }

/* ---------- Reveal ---------- */
.fade { opacity: 0; transform: translateY(16px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: calc(var(--d, 0) * 70ms); }
.fade.is-in { opacity: 1; transform: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 48px; padding: 0 22px; border-radius: 999px;
  font: 500 15px/1 var(--f-sans);
  transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--white); color: var(--bg); }
.btn-primary:hover { background: #ffffff; }
.btn-ghost { border: 1px solid var(--line); color: var(--white); }
.btn-ghost:hover { border-color: var(--gray-2); background: var(--surface); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px var(--pad);
  background: rgba(18, 18, 18, .8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav-name { font: 600 16px/1 var(--f-sans); letter-spacing: -.01em; }
.nav-links { display: flex; align-items: center; gap: 28px; font-size: 14px; color: var(--gray); }
.nav-links a:hover { color: var(--white); }
.nav-links .nav-cta { color: var(--white); border: 1px solid var(--line); padding: 8px 16px; border-radius: 999px; }
.nav-links .nav-cta:hover { border-color: var(--gray-2); }

/* ---------- Film grain (whole page) ---------- */
body::after {
  content: ""; position: fixed; inset: -50%; z-index: 100; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(6) infinite;
}
@keyframes grain {
  0%, 100% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -1%); } 80% { transform: translate(3%, 3%); }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(24px, 3.5vw, 56px); align-items: center;
  min-height: calc(100svh - 70px);
  padding-top: clamp(24px, 4vw, 48px);
  --hero-pb: clamp(64px, 8vw, 110px);
  padding-bottom: var(--hero-pb);
}
/* soft spotlight behind the photo — also lifts the black shirt off the background */
.hero::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  left: -6%; top: 0; width: 60%; height: 100%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .10), transparent);
}

/* Cut-out photo: no frame, the body runs into the bottom edge of the hero */
.hero-photo {
  position: relative; align-self: end;
  margin-bottom: calc(-1 * var(--hero-pb));
  clip-path: inset(100% 0 0 0);
  transition: clip-path 1.4s cubic-bezier(.77, 0, .175, 1);
}
.hero-photo.is-in { clip-path: inset(-20% -20% 0 -20%); }
/* sized by height so the head sits near the top of the hero */
.hero-photo img { display: block; height: clamp(420px, calc(100svh - 140px), 740px); width: auto; max-width: none; transform: translateY(6%); transition: transform 1.6s var(--ease); }
.hero-photo.is-in img { transform: none; }
.hero-photo:not(:has(img)) { aspect-ratio: 3 / 4; display: grid; place-items: center; background: var(--surface); border-radius: var(--radius); margin-bottom: 0; align-self: center; }
.photo-ph { display: grid; justify-items: center; gap: 12px; color: var(--gray-2); font: 500 12px/1.4 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; text-align: center; }
.photo-ph svg { width: 44px; height: 44px; opacity: .6; }


/* name scales with its column so it always fits on one line */
.hero-body { container-type: inline-size; }
.hero-name {
  font: 500 min(16.5cqi, 96px)/1 var(--f-sans);
  letter-spacing: -.05em;
  white-space: nowrap;
  margin: 0 0 22px;
}
.hero-name .line { display: inline-block; vertical-align: top; overflow: hidden; padding-bottom: .06em; margin-bottom: -.06em; }
.hero-name .line-in { display: inline-block; transform: translateY(105%); transition: transform 1.2s var(--ease); }
.hero-name.is-in .line-in { transform: none; }
.hero-name .grad {
  background: linear-gradient(90deg, #f2f2f0 0%, #f2f2f0 30%, #8a8a8a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin-bottom: 18px; font: 400 clamp(19px, 1.7vw, 24px)/1.3 var(--f-sans); letter-spacing: -.015em; color: var(--white); }
.hero-about { color: var(--gray); font-size: clamp(15px, 1.1vw, 16.5px); max-width: 56ch; }
.hero-about p + p { margin-top: .9em; }

/* Desktop: wider hero so the text spreads sideways instead of downwards */
@media (min-width: 901px) {
  .hero { --max: 1560px; }
  .hero-about { max-width: 74ch; }
}

.software { margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--line); }
.software-list { display: flex; flex-wrap: wrap; gap: 20px 32px; margin-top: 16px; }
.software-list li { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.app-icon { width: 40px; height: auto; flex: none; }

.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }

/* ---------- Sections ---------- */
.section { padding-block: clamp(72px, 9vw, 120px); background: var(--bg); color: var(--white); }

/* Light bands — same tokens, inverted, so every component adapts */
.theme-light {
  --bg: #ebebe8;
  --surface: #f5f5f3;
  --surface-2: #e0e0dc;
  --line: #d3d3ce;
  --white: #151515;
  --gray: #5a5a57;
  --gray-2: #8c8c88;
}
.theme-light ::selection { background: #151515; color: #ebebe8; }
.theme-light .contact-card { box-shadow: 0 30px 60px -40px rgba(0, 0, 0, .25); }
.section-head { margin-bottom: 40px; }
.section-head h2, .contact h2 {
  font: 500 clamp(32px, 4.4vw, 56px)/1.05 var(--f-sans); letter-spacing: -.035em;
  margin-top: 12px;
}

/* Clients */
.clients-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 28px; margin-bottom: 48px; }
.count { font: 500 clamp(44px, 10vw, 120px)/.9 var(--f-sans); letter-spacing: -.06em; white-space: nowrap; }
/* Logo wall: centred rows, each logo sized by its own balanced width (--w from data.js) */
.logos {
  --logo-scale: 1.12;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: clamp(28px, 4.5vw, 56px) clamp(28px, 3.4vw, 48px);
}
.logos li { display: flex; align-items: center; justify-content: center; }
.logos img {
  width: calc(var(--w, 120px) * var(--logo-scale)); height: auto;
  /* soft shadow centred on the logo (even on all sides), following its shape */
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, .28)) drop-shadow(0 0 4px rgba(0, 0, 0, .14));
  transition: transform .3s ease;
}
.logos li:hover img { transform: scale(1.05); }
/* Tablet & desktop: rows of 4 / 5 / rest. A zero-height ::after takes a full line to force the
   break; row spacing moves from row-gap onto the items so that empty line adds no extra gap.
   Logos scale with the container (capped by --logo-max) so the first row of 4 always fits:
   685 = sum of the first four logos' widths in data.js. */
@media (min-width: 561px) {
  #clients .container { container-type: inline-size; }
  .logos { --logo-max: 1.12px; --row-gap: clamp(28px, 4.5vw, 56px); row-gap: 0; margin-block: calc(var(--row-gap) / -2); }
  .logos img { width: calc(var(--wn, 120) * min(var(--logo-max), (100cqi - 3 * clamp(28px, 3.4vw, 48px)) * .96 / 685)); }
  .logos li { margin-block: calc(var(--row-gap) / 2); }
  .logos::after { content: ""; flex-basis: 100%; order: 1; }
  .logos li:nth-child(n+10) { order: 2; }
}
/* Desktop: smaller heading, bigger logos */
@media (min-width: 901px) {
  #clients .count { font-size: clamp(56px, 6.5vw, 84px); }
  .logos { --logo-max: 1.3px; }
}
.logo-text { font: 600 16px/1.2 var(--f-sans); color: var(--gray-2); letter-spacing: -.01em; text-align: center; transition: color .3s ease; }
.logos li:hover .logo-text { color: var(--white); }

/* Services */
.services-head { margin-bottom: 48px; }
.services-intro { margin: 20px auto 0; max-width: 64ch; text-wrap: balance; color: var(--gray); font-size: clamp(16px, 1.3vw, 18px); }
/* Formats: text-only cards, 2 x 2 */
.skills { margin-top: clamp(40px, 5vw, 64px); }
.format-list { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.service.format { align-content: start; }
.service.format h3 { align-self: auto; font-size: clamp(22px, 2vw, 26px); }
/* Skills: a wrap of pills under the service cards */
.skill-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }
.skill-list li {
  padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--gray); font-size: 15px; line-height: 1.3;
  transition: color .25s ease, border-color .25s ease;
}
.skill-list li:hover { color: var(--white); border-color: var(--gray-2); }
.service {
  display: grid; align-items: center;
  padding: clamp(24px, 3vw, 40px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.service h3 { margin: 0; align-self: end; font: 500 clamp(26px, 2.6vw, 34px)/1.1 var(--f-sans); letter-spacing: -.03em; }
.service .formats { margin-top: 10px; align-self: start; }

/* Testimonials: masonry wall of chat screenshots */
.testimonials-head { margin-bottom: 48px; }
.testimonial-wall { columns: 3; column-gap: 16px; }
.testimonial {
  break-inside: avoid; margin: 0 0 16px;
  display: grid; place-items: center;
  padding: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.testimonial img { display: block; width: 100%; height: auto; border-radius: 10px; }
@media (max-width: 900px) { .testimonial-wall { columns: 2; } }
@media (max-width: 560px) { .testimonial-wall { columns: 1; } }

/* Contact */
.contact-card {
  padding: clamp(28px, 5vw, 64px);
  background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) + 6px);
}
.contact h2 { margin-bottom: clamp(32px, 4vw, 56px); }
.contact-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.contact-item {
  display: flex; flex-direction: column; gap: 8px;
  padding: 22px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line);
  transition: border-color .2s ease;
}
a.contact-item:hover { border-color: var(--gray-2); }
.contact-k { font: 500 12px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--gray-2); }
.contact-v { font-size: 17px; overflow-wrap: anywhere; }
a.contact-item .contact-v::after { content: " ↗"; color: var(--gray-2); }
.contact-social { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 17px; }
.contact-social a:hover { color: var(--gray); }

/* Footer */
.footer { display: flex; justify-content: space-between; gap: 16px; padding-block: 28px 36px; color: var(--gray-2); font-size: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-photo { max-width: 420px; width: 100%; margin-bottom: 0; }
  .hero-photo img { width: 100%; height: auto; }
  /* photo sits above the text on phones, so fade the cut-off body instead of a hard edge */
  .hero-photo img { -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent); mask-image: linear-gradient(to bottom, #000 72%, transparent); }
  .format-list, .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .nav-links a:not(.nav-cta) { display: none; }
  .logos { --logo-scale: .8; }
  .skill-list { gap: 8px; }
  .skill-list li { padding: 7px 12px; font-size: 13px; }
  .hero-cta .btn { flex: 1 1 auto; }
}

/* Everything below the hero is centered on all screen sizes */
.section, .footer { text-align: center; }
.clients-head { justify-content: center; }
.service { text-align: left; }
.contact-item { align-items: center; }
.contact-social { justify-content: center; }
.footer { flex-direction: column; align-items: center; gap: 6px; }

/* Phones (single-column layout): center the hero too */
@media (max-width: 900px) {
  .hero { text-align: center; }
  .hero-name { font-size: min(13vw, 96px); }
  .hero-photo { margin-inline: auto; }
  .hero-about { margin-inline: auto; }
  .software-list, .hero-cta { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fade { opacity: 1; transform: none; transition: none; }
  .hero-photo { clip-path: none; }
  .hero-name .line-in { transform: none; }
  body::after { animation: none; }
  * { transition: none !important; }
}
