/* =================================================================
   STUDIO — Creative Agency Template
   Minimal, editorial, mono-sans aesthetic.
   Everything you'll usually want to tweak lives in :root below.
   ================================================================= */

:root {
  /* ---- BRAND COLOURS (edit these) ---- */
  --bg:        #ffffff;   /* white page background   */
  --bg-alt:    #f4f4f2;   /* subtle off-white band   */
  --ink:       #0d0d0d;   /* near-black text        */
  --muted:     #8a8a85;   /* soft grey text         */
  --accent:    #0d0d0d;   /* accent kept neutral (mono look) */
  --accent-2:  #6f6a60;   /* secondary grey                  */
  --line:      #e4e4e0;   /* hairline borders       */
  --invert-bg: #0d0d0d;   /* dark sections          */
  --invert-ink:#ffffff;

  /* ---- TYPE ---- */
  --font-display: 'Inter', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;

  /* ---- LAYOUT ---- */
  --max:  1280px;
  --pad:  clamp(20px, 5vw, 80px);
  --radius: 0;            /* sharp corners. Bump to 12px if you want rounded. */
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;   /* clip (not hidden) so position:sticky still works */
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
::selection { background: var(--ink); color: var(--bg); }

/* ---- Shared bits ---- */
section { padding: clamp(90px, 12vw, 180px) var(--pad); }
.eyebrow {
  font-size: .78rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); font-weight: 500;
}
.section-head { max-width: var(--max); margin: 0 auto clamp(40px,6vw,80px); }
.section-head__tag {
  font-size: .78rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); font-weight: 500;
}
.section-head__title {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(2rem, 5.5vw, 3.6rem); line-height: 1.02;
  margin-top: 14px; letter-spacing: -0.03em;
}

/* Understated text-and-arrow links (the house style) */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  font-weight: 500; font-size: 1rem;
  transition: gap .2s ease, opacity .2s ease;
  cursor: pointer; border: 0; background: none; color: var(--ink);
  padding: 0;
}
.btn::after { content: '→'; transition: transform .2s ease; }
.btn:hover { gap: .75em; color: var(--accent); }
.btn:hover::after { transform: translateX(4px); }
/* Solid variant kept subtle: underline on hover, no fill */
.btn--solid { border-bottom: 2px solid var(--ink); padding-bottom: 4px; }
.btn--solid:hover { border-color: var(--accent); }
.btn--ghost { color: var(--muted); }
.btn--ghost:hover { color: var(--accent); }
/* Nav CTA: small outlined chip */
.btn--pill {
  display: inline-flex; align-items: center; font-weight: 500; font-size: .9rem;
  border: 1px solid var(--ink); padding: 9px 20px; transition: background .2s, color .2s;
}
.btn--pill::after { content: none; }
.btn--pill:hover { background: var(--ink); color: var(--bg); }

/* ===================== HEADER ===================== */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: transparent; border-bottom: 1px solid transparent;
  transition: background .3s ease, border-color .3s ease;
}
/* Header stays transparent — no bar, just the floating nav */
.site-header.scrolled {
  background: transparent;
  border-bottom-color: transparent;
}
/* Over the dark hero the nav goes white */
.site-header.over-dark .nav__links a,
.site-header.over-dark .nav__brand { color: #fff; }
.site-header.over-dark .nav__links a::after { background: #fff; }
.site-header.over-dark .nav__logo { filter: invert(1); }
.site-header.over-dark .nav__toggle span { background: #fff; }
.nav {
  max-width: 1600px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 22px var(--pad);
}
.nav__brand {
  font-family: var(--font-display); font-size: 1.9rem; font-weight: 700;
  letter-spacing: -0.04em; text-align: center; justify-self: center;
}
.nav__brand span { font-size: .42em; vertical-align: super; font-weight: 500; }
.nav__logo { height: 22px; width: auto; display: block; }
.footer__brand .nav__logo { height: 26px; }
.nav__links { display: flex; gap: 38px; }
.nav__links--left  { justify-self: start; }
.nav__links--right { justify-self: end; }
.nav__links a { font-weight: 500; font-size: .95rem; position: relative; }
.nav__links a::after {
  content: ''; position: absolute; left: 0; bottom: -5px; height: 2px; width: 0;
  background: var(--accent); transition: width .25s ease;
}
.nav__links a:hover::after { width: 100%; }
.nav__toggle { display: none; background: none; border: 0; flex-direction: column; gap: 6px; cursor: pointer; }
.nav__toggle span { width: 26px; height: 1.5px; background: var(--ink); display: block; }

/* ===================== HERO ===================== */
/* Dark scroll-zoom. .hero is a tall scroller; .hero__pin sticks for one
   viewport while JS zooms the logo and fades to white. */
.hero { position: relative; height: 200vh; background: var(--invert-bg); padding: 0; }
.hero__pin {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  background: var(--invert-bg); color: var(--invert-ink);
  transition: background-color 1.2s ease;   /* pastel cycle fades */
}
/* White overlay that fades in at the end of the zoom for a clean handoff */
.hero__flash {
  position: absolute; inset: 0; z-index: 3;
  background: #fff; opacity: 0; pointer-events: none;
}
/* Intro copy revealed on the white at the end of the zoom — big, bold, centred */
.hero__reveal {
  position: absolute; inset: 0; z-index: 4;
  display: flex; align-items: center; justify-content: center;
  padding: 0 var(--pad);
  background: var(--invert-bg); color: #fff; opacity: 0; pointer-events: none;
}
.hero__reveal .intro__inner { max-width: 1450px; margin: 0 auto; width: 100%; text-align: center; }
.hero__reveal .eyebrow { margin-bottom: 22px; color: #8a8a8a; }
.hero__reveal .intro__lead {
  font-weight: 700; font-size: clamp(2.1rem, 5.4vw, 4.2rem);
  line-height: 1.14; letter-spacing: -0.02em;
  max-width: none; margin: 0 auto 40px;
}
.hero__reveal .intro__actions { justify-content: center; }
.hero__reveal .btn { color: #fff; }
.hero__reveal .btn--solid { border-color: #fff; }
.hero__reveal .btn--ghost { color: #999; }
.hero__reveal .intro__lead .rw { color: #555; }   /* words fill dark-grey -> white on scroll */
.hero__tag {
  position: absolute; z-index: 2;
  top: clamp(120px, 15vh, 180px); left: var(--pad); right: var(--pad);
  font-family: var(--font-body); font-weight: 700;
  font-size: clamp(1.5rem, 3.6vw, 2.7rem); line-height: 1.08;
  letter-spacing: -0.02em; color: var(--ink); max-width: 22ch;
}
/* Typewriter: the untyped remainder keeps its space (hidden) so the line
   layout never reflows; a caret blinks at the boundary. */
.hero__tag.tw-on .tw-rest { visibility: hidden; }
.tw-caret { display: none; }
.hero__tag.tw-on .tw-caret {
  display: inline-block; width: .07em; height: 1em; background: var(--ink);
  transform: translateY(.14em);
  animation: caret .9s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* Image trail — images spawn and follow the cursor across the hero */
.trail-img {
  position: absolute; z-index: 5; pointer-events: none;
  width: clamp(130px, 13vw, 230px); aspect-ratio: 4/5;
  background-size: cover; background-position: center;
  transform: translate(-50%, -50%) rotate(var(--r, 0deg)) scale(.5);
  opacity: 0; transition: opacity .3s ease, transform .55s cubic-bezier(.2,.8,.2,1);
}
.trail-img.in  { opacity: 1; transform: translate(-50%, -50%) rotate(var(--r,0deg)) scale(1); }
.trail-img.out { opacity: 0; transform: translate(-50%, -50%) rotate(var(--r,0deg)) scale(.85); }

/* Giant Kingpin logo, inline SVG. The zoom animates the viewBox (in JS) so the
   vector re-renders sharp at every step — no pixelation. */
.hero__logo {
  position: absolute; inset: 0; margin: 0; z-index: 1;
  animation: logoIn 1s ease .1s backwards;
}
.hero__svg { width: 100%; height: 100%; display: block; }
@keyframes logoIn { from { opacity: 0; } to { opacity: 1; } }

/* ===================== IMAGE SCATTER (3D FLIP) ===================== */
/* A band of tiles in fixed positions across the width. Each tile is sized by
   width (--w) + aspect (--ar) and nudged up/down by --y. Each .gi__flip spins
   continuously on its X-axis (a looping 360° barrel roll) so both the front and
   back faces keep coming into view; --delay staggers them out of sync. */
.gallery { overflow: hidden; background: var(--bg); padding: clamp(40px,7vh,110px) 0; min-height: 100vh;
  display: flex; align-items: center; }
.gallery__track {
  display: flex; align-items: center; justify-content: space-between;
  gap: clamp(20px,3vw,60px);
  width: 100%; max-width: 1600px; margin: 0 auto; padding: 0 var(--pad);
}
.gi {
  flex: 0 0 auto;
  width: var(--w, 18vw);
  aspect-ratio: var(--ar, 1 / 1);
  transform: translateY(var(--y, 0));
  perspective: 1600px;   /* each tile its own vanishing point */
}
.gi__flip {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  will-change: transform;
  animation: giSpin 14s linear infinite;
  animation-delay: var(--delay, 0s);
}
@keyframes giSpin { to { transform: rotateX(360deg); } }
.gi__face {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.gi__back { transform: rotateX(180deg); }   /* pre-flipped so it reads upright at 180° */

/* Brand block face (the KP tile) */
.kp {
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  font-family: 'Archivo Black', var(--font-display); line-height: 1;
}
.kp--indigo { background: #3a1ff0; }
.kp--coral  { background: #f2685f; }
.kp span { font-size: clamp(90px, 20vh, 220px); font-weight: 400; }
.kp__k { color: #b9f0ff; transform: translateX(.12em); }
.kp__p { color: #ff8f8f; transform: translateX(-.16em) translateY(.12em); }
.kp--coral .kp__k { color: #ffe14d; }
.kp--coral .kp__p { color: #3a1ff0; }
/* the pink semicircle rising from the base */
.kp::after {
  content: ''; position: absolute; left: 50%; bottom: -18%;
  width: 62%; aspect-ratio: 1/1; border-radius: 50%;
  background: #ff8f8f; transform: translateX(-50%); z-index: 0;
}
.kp--coral::after { background: #ffe14d; }
.kp span { position: relative; z-index: 1; }

/* ===================== INTRO STRIP ===================== */
.intro { padding-top: clamp(40px,6vw,80px); }
.intro__inner { max-width: var(--max); margin: 0 auto; }
.intro__lead {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.6rem, 4vw, 2.8rem); line-height: 1.2;
  letter-spacing: -0.025em; max-width: 24ch; margin: 18px 0 32px;
}
.intro__actions { display: flex; gap: 32px; flex-wrap: wrap; align-items: center; }

/* ===================== ABOUT ===================== */
.about__grid {
  max-width: var(--max); margin: 0 auto;
  display: grid; grid-template-columns: 1.35fr .65fr; gap: clamp(30px,5vw,80px);
  align-items: center;
}
.statement {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.7rem, 3.8vw, 2.9rem); line-height: 1.18;
  letter-spacing: -0.025em; margin-bottom: 28px;
}
.smile { color: var(--muted); }
.about__copy p { color: var(--muted); max-width: 46ch; }
.about__media {
  background-size: cover; background-position: center;
  border-radius: var(--radius); min-height: 480px;
}

/* ===================== SERVICES ===================== */
.services__list { max-width: var(--max); margin: 0 auto; border-top: 1px solid var(--line); }
.service {
  display: grid; grid-template-columns: 60px 1fr 40px; align-items: center;
  padding: clamp(22px,3.4vw,38px) 4px; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: padding-left .3s ease;
}
.service:hover { padding-left: 22px; color: var(--accent); }
.service__no { font-size: .82rem; color: var(--muted); font-weight: 500; }
.service__name { font-family: var(--font-display); font-size: clamp(1.5rem,3.6vw,2.6rem); font-weight: 500; letter-spacing: -0.02em; }
.service__arrow { text-align: right; opacity: 0; transform: translateX(-8px); transition: all .3s ease; }
.service:hover .service__arrow { opacity: 1; transform: translateX(0); }

/* ===================== STATS ===================== */
.stats {
  background: var(--invert-bg); color: var(--invert-ink);
  display: grid; grid-template-columns: repeat(3,1fr); gap: 40px;
  text-align: left;
}
.stat__num { font-family: var(--font-display); font-size: clamp(3.2rem,9vw,6rem); font-weight: 500; display: block; line-height: 1; letter-spacing: -0.04em; }
.stat__label { color: color-mix(in srgb, var(--invert-ink) 55%, transparent); margin-top: 14px; font-size: .95rem; max-width: 22ch; }

/* ===================== WORK ===================== */
.work__grid {
  max-width: var(--max); margin: 0 auto;
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(20px,3vw,40px);
}
.project__img {
  aspect-ratio: 4/3; background-size: cover; background-position: center;
  border-radius: var(--radius); transition: opacity .3s ease;
}
.project:hover .project__img { opacity: .85; }
.project__meta {
  display: flex; justify-content: space-between; margin-top: 16px;
  font-weight: 500; font-size: 1.05rem;
}
.project__meta span:last-child { color: var(--muted); }
.project:hover .project__meta span:first-child { color: var(--accent); }

/* ===================== TEAM ===================== */
.team__grid {
  max-width: var(--max); margin: 0 auto;
  display: grid; grid-template-columns: repeat(4,1fr); gap: clamp(18px,2.4vw,32px);
}
.member__photo {
  aspect-ratio: 4/5; background-size: cover; background-position: center;
  border-radius: var(--radius); filter: grayscale(1); transition: filter .4s ease;
}
.member:hover .member__photo { filter: grayscale(0); }
.member figcaption { margin-top: 16px; }
.member strong { display: block; font-family: var(--font-display); font-weight: 500; font-size: 1.1rem; letter-spacing: -0.01em; }
.member span { color: var(--muted); font-size: .9rem; }

/* ===================== CLIENTS ===================== */
.clients { text-align: center; }
.clients__title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.7rem,4.4vw,3rem); line-height: 1.15;
  max-width: 22ch; margin: 0 auto clamp(48px,7vw,80px); letter-spacing: -0.025em;
}
.clients__row {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: clamp(32px,5vw,72px); font-weight: 600; letter-spacing: .06em; color: var(--muted); font-size: 1.05rem;
}

/* ===================== CTA MARQUEE ===================== */
.cta { padding: 0; }
.cta__marquee { display: block; overflow: hidden; background: var(--invert-bg); color: var(--invert-ink); padding: clamp(32px,5vw,56px) 0; }
.cta__track { display: flex; white-space: nowrap; width: max-content; animation: marquee 24s linear infinite; }
.cta__track span { font-family: var(--font-display); font-size: clamp(2rem,6vw,4.5rem); font-weight: 400; padding-right: 40px; letter-spacing: -0.02em; }
.cta__marquee:hover .cta__track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-33.333%); } }

/* ===================== FOOTER ===================== */
.footer {
  background: var(--bg); color: var(--ink);
  border-top: 1px solid var(--line);
  padding: clamp(64px,8vw,110px) var(--pad) 44px;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 44px;
  max-width: 100%;
}
.footer > * { max-width: var(--max); }
.footer__brand p { color: var(--muted); margin-top: 16px; max-width: 28ch; }
.footer__col h4 { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 18px; color: var(--muted); }
.footer__col a { display: block; margin-bottom: 11px; transition: opacity .2s; }
.footer__col a:hover { color: var(--accent); }
.footer__legal { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 26px; font-size: .84rem; color: var(--muted); }

/* ===================== SCROLL REVEAL ===================== */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s ease; }
.reveal.is-in { opacity: 1; transform: none; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
  .nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; }
  .nav__brand { justify-self: auto; text-align: left; order: 1; }
  .nav__toggle { display: flex; order: 2; }
  .nav__links { display: none; }
  /* Open menu drops both link groups full-width below the brand row */
  .nav.is-open .nav__links {
    display: flex; flex-direction: column; gap: 16px; width: 100%; order: 3;
    padding-top: 22px;
  }
  .nav.is-open .nav__links--left { margin-top: 20px; border-top: 1px solid var(--line); }
  .hero__cards { width: 62vw; }
  .about__grid, .work__grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; gap: 48px; }
  .team__grid { grid-template-columns: 1fr 1fr; }
  .footer { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .team__grid { grid-template-columns: 1fr 1fr; }
  .footer { grid-template-columns: 1fr; }
}

/* Respect users who prefer no motion */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .cta__track { animation: none; }
  .gi__flip { animation: none; }
  .hero__logo { animation: none; }
  .hero { height: 100vh; }
  .hero__pin { position: static; }
  .hero__flash { display: none; }
  html { scroll-behavior: auto; }
}
