/* ==========================================================================
   Joshua Ng — Portfolio
   Base / tokens
   ========================================================================== */

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

:root {
  --cream:      #f2f0ec;
  --cream-2:    #e9e6e0;
  --surface:    #ffffff;
  --ink:        #131311;
  --ink-2:      #2c2b28;
  --muted:      #78766f;
  --line:       rgba(19, 19, 17, 0.09);
  --accent:     #ff5c26;

  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 26px;
  --r-xl: 34px;

  --pad: clamp(20px, 5vw, 64px);
  --maxw: 1180px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

body {
  font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--cream);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img, canvas { display: block; max-width: 100%; }

.serif {
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
}

/* Grain texture overlay */
.grain {
  position: fixed;
  inset: 0;
  z-index: 9000;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Custom cursor
   ========================================================================== */

/* Outer element is positioned by GSAP (transform), inner handles scale so the
   two never fight over the same property. */
.cursor {
  position: fixed;
  top: 0; left: 0;
  width: 34px; height: 34px;
  margin: -17px 0 0 -17px;
  pointer-events: none;
  z-index: 9500;
  mix-blend-mode: difference;
}
.cursor-inner {
  width: 100%; height: 100%;
  border-radius: 50%;
  background: #fff;
  color: #000;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transform: scale(0.28);
  transition: transform 0.3s var(--ease);
}
.cursor span { opacity: 0; transition: opacity 0.2s ease; }
.cursor.is-view .cursor-inner { transform: scale(1.9); }
.cursor.is-view span { opacity: 1; }
.cursor.is-hide .cursor-inner { transform: scale(0); }

/* ==========================================================================
   Buttons / pills
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  border-radius: 100px;
  font-size: 0.94rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
  transition: transform 0.35s var(--ease), background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; transition: transform 0.35s var(--ease); }
.btn:hover svg { transform: translateX(3px); }

/* No transform on these two hovers: JS applies a magnetic transform instead. */
.btn-dark  { background: var(--ink); color: var(--cream); }
.btn-dark:hover  { background: var(--ink-2); }
.btn-light { background: var(--cream); color: var(--ink); }
.btn-light:hover { background: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface); border-color: rgba(19,19,17,0.2); transform: translateY(-2px); }
.btn-sm    { padding: 10px 20px; font-size: 0.86rem; }
.btn-block { width: 100%; }

.pill {
  display: inline-block;
  padding: 5px 13px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.6);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.pill-light { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.24); color: rgba(255,255,255,0.85); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

/* ==========================================================================
   Nav
   ========================================================================== */

.nav {
  position: fixed;
  top: 16px;
  /* Centred with auto margins rather than translateX(-50%), so `transform`
     stays free for the hide-on-scroll animation. Using transform for both
     meant .is-hidden silently fought with the centring. */
  left: 0;
  right: 0;
  margin-inline: auto;
  width: calc(100% - 2 * var(--pad));
  max-width: var(--maxw);
  z-index: 800;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 12px 10px 16px;
  border-radius: 100px;
  background: rgba(242, 240, 236, 0.72);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid var(--line);
  transition: transform 0.45s var(--ease), opacity 0.3s ease;
  will-change: transform;
}
.nav.is-hidden { transform: translateY(-170%); }

.nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.02em; }
.nav-avatar {
  position: relative;
  overflow: hidden;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffb37a, #ff5c26);
  color: #fff;
  display: grid; place-items: center;
  font-size: 0.68rem; font-weight: 700;
  flex: 0 0 30px;
}

/* Profile photo layer, used by all three avatar sizes. It sits over the
   initials, which remain the fallback if the file is missing — the inline
   onerror removes the broken img and reveals them.
   The source is already cropped square, so a plain centred cover is enough. */
.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  padding: 8px 14px;
  border-radius: 100px;
  font-size: 0.9rem;
  color: var(--muted);
  transition: color 0.25s ease, background 0.25s ease;
}
.nav-links a:hover { color: var(--ink); background: rgba(255,255,255,0.7); }

.nav-toggle { display: none; background: none; border: 0; padding: 10px; }
.nav-toggle span { display: block; width: 18px; height: 1.5px; background: var(--ink); }
.nav-toggle span + span { margin-top: 5px; }

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 150px var(--pad) 90px;
  overflow: hidden;
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 940px;
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 16px 7px 12px;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 28px;
  box-shadow: 0 4px 18px rgba(19,19,17,0.04);
}
.badge-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #22c55e;
  position: relative;
}
.badge-dot::after {
  content: '';
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 1.5px solid #22c55e;
  animation: ping 2s var(--ease) infinite;
}
@keyframes ping {
  0%   { transform: scale(0.6); opacity: 0.9; }
  80%,100% { transform: scale(1.5); opacity: 0; }
}

.hero-title {
  font-size: clamp(2.9rem, 8.4vw, 6.4rem);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.045em;
  margin-bottom: 26px;
}
.hero-title .ln { display: block; overflow: hidden; padding-bottom: 0.06em; }
.hero-title .w  { display: inline-block; will-change: transform; }
.hero-title .serif { letter-spacing: -0.02em; padding-right: 0.06em; }

.hero-sub {
  font-size: clamp(1rem, 1.5vw, 1.14rem);
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 34px;
  line-height: 1.65;
}

.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 46px; }

.hero-proof { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }

/* Small labelled tool/skill tag, reused in hero and about */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; }

/* ==========================================================================
   Logo marquee
   ========================================================================== */

.logos { padding: 26px 0 60px; border-bottom: 1px solid var(--line); }
.marquee {
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track {
  display: flex;
  gap: 68px;
  width: max-content;
  animation: scroll-x 34s linear infinite;
}
.marquee-track { gap: 34px; }
.marquee-track span {
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  opacity: 0.28;
  transition: opacity 0.3s ease;
}
.marquee-track .sep { color: var(--accent); opacity: 0.5; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span:hover { opacity: 0.75; }
@keyframes scroll-x { to { transform: translateX(-50%); } }

/* ==========================================================================
   Section shell
   ========================================================================== */

.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(72px, 11vw, 140px) var(--pad);
}

.section-head { max-width: 680px; margin-bottom: clamp(38px, 6vw, 64px); }
.section-head p { color: var(--muted); font-size: 1.04rem; margin-top: 14px; }

.h2 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.04em;
}

.section-foot { margin-top: 42px; display: flex; justify-content: center; }

.mini-head {
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 38px 0 14px;
}

/* ==========================================================================
   Work grid
   ========================================================================== */

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(16px, 2.2vw, 26px);
}
/* A lone card shouldn't stretch across a two-column track */
.work-grid.is-single { grid-template-columns: minmax(0, 620px); justify-content: center; }

.project {
  overflow: hidden;
  transition: transform 0.55s var(--ease), box-shadow 0.55s var(--ease), border-color 0.4s ease;
}
.project:hover {
  transform: translateY(-6px);
  box-shadow: 0 26px 50px -18px rgba(19,19,17,0.16);
  border-color: rgba(19,19,17,0.14);
}

.project-visual {
  aspect-ratio: 4 / 3;
  background: linear-gradient(150deg, var(--g1), var(--g2));
  display: grid;
  place-items: center;
  padding: 34px;
  overflow: hidden;
}
/* Real cover art fills the frame edge to edge instead of floating in it */
.project-visual.has-image { padding: 0; }
.project-visual.has-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}
.project:hover .project-visual.has-image img { transform: scale(1.04); }
.mock {
  width: 100%;
  max-width: 320px;
  background: rgba(255,255,255,0.92);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 18px 36px -14px rgba(0,0,0,0.24);
  transition: transform 0.6s var(--ease);
}
.project:hover .mock { transform: translateY(-6px) scale(1.03) rotate(-0.6deg); }
.mock i { display: block; background: rgba(19,19,17,0.1); border-radius: 5px; }

.mock-bar { height: 26px; border-radius: 7px; background: rgba(19,19,17,0.08); margin-bottom: 12px; }
.mock-rows i { height: 11px; margin-bottom: 8px; }
.mock-rows i:nth-child(2) { width: 78%; }
.mock-rows i:nth-child(3) { width: 52%; }

.mock-phone { max-width: 172px; border-radius: 22px; padding: 12px; }
.mock-notch { width: 42px; height: 5px; border-radius: 5px; background: rgba(19,19,17,0.16); margin: 0 auto 14px; }
.mock-card { height: 74px; border-radius: 12px; background: linear-gradient(135deg, var(--g2), var(--g1)); margin-bottom: 12px; }
.mock-lines i { height: 10px; margin-bottom: 7px; }
.mock-lines i:nth-child(2) { width: 62%; }

.mock-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.mock-grid i { aspect-ratio: 1; border-radius: 9px; }
.mock-grid i:nth-child(1) { background: rgba(19,19,17,0.14); }
.mock-grid i:nth-child(4) { background: rgba(19,19,17,0.06); }

.mock-hero { height: 62px; border-radius: 10px; background: linear-gradient(135deg, var(--g2), var(--g1)); margin-bottom: 10px; }
.mock-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mock-tiles i { aspect-ratio: 1; border-radius: 8px; }

.project-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 24px;
}
.project-meta h3 { font-size: 1.16rem; font-weight: 600; letter-spacing: -0.025em; }
.project-meta p  { font-size: 0.92rem; color: var(--muted); margin-top: 4px; }
.project-tags {
  display: block;
  margin-top: 12px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
}
.project-badges { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex-shrink: 0; }

/* ==========================================================================
   Quote band
   ========================================================================== */

.q-avatar {
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  display: grid; place-items: center;
  font-size: 0.66rem; font-weight: 700;
  color: rgba(0,0,0,0.45);
}

/* ==========================================================================
   Services
   ========================================================================== */

.svc-list { border-top: 1px solid var(--line); }
.svc-row {
  display: grid;
  grid-template-columns: 46px 1fr 1.1fr;
  gap: 18px;
  align-items: baseline;
  padding: 24px 8px;
  border-bottom: 1px solid var(--line);
  transition: padding 0.4s var(--ease), background 0.4s ease;
}
.svc-row:hover { background: rgba(255,255,255,0.6); padding-left: 18px; padding-right: 0; }
.svc-num { font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.svc-row h3 { font-size: 1.16rem; font-weight: 600; letter-spacing: -0.025em; }
.svc-row p  { font-size: 0.92rem; color: var(--muted); }

/* ==========================================================================
   About
   ========================================================================== */

.about { display: grid; grid-template-columns: 300px 1fr; gap: clamp(24px, 4vw, 56px); align-items: start; }

.about-card { padding: 28px; text-align: center; position: sticky; top: 92px; }
.about-portrait {
  position: relative;
  overflow: hidden;
  width: 112px; height: 112px; margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(140deg, #ffd0b0, #ff5c26);
  display: grid; place-items: center;
  color: #fff; font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em;
  box-shadow: 0 8px 24px -10px rgba(19,19,17,0.35);
}
.about-card h3 { font-size: 1.2rem; font-weight: 600; letter-spacing: -0.025em; }
.about-role { font-size: 0.9rem; color: var(--muted); }
.socials { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 20px; }
.socials a {
  padding: 7px 14px; border-radius: 100px;
  border: 1px solid var(--line);
  font-size: 0.8rem; color: var(--muted);
  transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}
.socials a:hover { color: var(--ink); border-color: rgba(19,19,17,0.22); background: var(--cream); }

.about-body p { font-size: 1.02rem; color: var(--ink-2); margin-bottom: 16px; max-width: 62ch; }

.tools { display: flex; flex-wrap: wrap; gap: 8px; }

.history { border-top: 1px solid var(--line); }
.history li {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 14px;
  padding: 16px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 0.94rem;
}
.history li span:first-child { font-weight: 600; }
.history li span:nth-child(2), .history li span:last-child { color: var(--muted); }
.history li span:last-child { font-variant-numeric: tabular-nums; }

.counters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 40px; }
.counters div {
  padding: 22px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.num, .plus {
  font-size: 2.1rem; font-weight: 600; letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}
.plus { font-size: 1.2rem; color: var(--accent); }
.counters small { display: block; margin-top: 6px; font-size: 0.82rem; color: var(--muted); }

/* ==========================================================================
   Steps + pricing
   ========================================================================== */

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.step { padding: 26px; }
.step-num {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--ink); color: var(--cream);
  font-size: 0.82rem; font-weight: 600;
  margin-bottom: 16px;
}
.step h4 { font-size: 1.06rem; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 5px; }
.step p  { font-size: 0.92rem; color: var(--muted); }

/* ==========================================================================
   Contact
   ========================================================================== */

.contact-section { padding-bottom: clamp(80px, 12vw, 150px); }
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}

.contact-intro .badge { margin-bottom: 22px; }
.contact-intro .h2 { margin-bottom: 16px; }
.contact-intro > p { color: var(--muted); font-size: 1.04rem; max-width: 46ch; }

.contact-details { margin-top: 36px; border-top: 1px solid var(--line); }
.contact-details li {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  align-items: baseline;
  padding: 16px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 0.96rem;
}
.cd-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.contact-details a { border-bottom: 1px solid transparent; transition: border-color 0.25s ease; }
.contact-details a:hover { border-color: var(--ink); }
.cd-socials { display: flex; gap: 16px; flex-wrap: wrap; }

.contact-form { padding: clamp(24px, 3.4vw, 34px); }
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 7px;
  color: var(--ink-2);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 0.96rem;
  color: var(--ink);
  padding: 13px 15px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: border-color 0.25s ease, background 0.25s ease;
}
.field textarea { resize: vertical; min-height: 110px; }
.field input::placeholder,
.field textarea::placeholder { color: rgba(120,118,111,0.7); }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--ink);
}
.field input:user-invalid,
.field textarea:user-invalid { border-color: #e0563f; }

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' stroke='%2378766f' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
  padding-right: 38px;
}

.contact-form .btn { margin-top: 8px; border: 0; cursor: pointer; }
.form-note {
  min-height: 1.2em;
  margin-top: 12px;
  font-size: 0.86rem;
  color: var(--muted);
  text-align: center;
}
.form-note.is-error { color: #c0402a; }

/* ==========================================================================
   Testimonials
   ========================================================================== */

.testimonials { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: start; }
.t-card { padding: 26px; }
.t-card p { font-size: 1rem; line-height: 1.55; letter-spacing: -0.015em; margin-bottom: 20px; }
.t-card figcaption { display: flex; align-items: center; gap: 11px; font-size: 0.82rem; color: var(--muted); }
.t-card figcaption strong { color: var(--ink); font-weight: 600; }

/* ==========================================================================
   FAQ
   ========================================================================== */

.faq-section { max-width: 900px; }
.faq { border-top: 1px solid var(--line); }

.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px 4px;
  cursor: pointer;
  font-size: clamp(1rem, 1.8vw, 1.18rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  list-style: none;
  transition: color 0.25s ease;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--muted); }
.faq-num { font-size: 0.78rem; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }

.faq-item summary i {
  margin-left: auto;
  position: relative;
  width: 15px; height: 15px;
  flex: 0 0 15px;
}
.faq-item summary i::before,
.faq-item summary i::after {
  content: '';
  position: absolute; top: 50%; left: 0;
  width: 100%; height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.35s var(--ease);
}
.faq-item summary i::after { transform: rotate(90deg); }
.faq-item[open] summary i::after { transform: rotate(0deg); }

.faq-body { overflow: hidden; }
.faq-body p { padding: 0 4px 26px 61px; color: var(--muted); max-width: 68ch; }

/* ==========================================================================
   CTA band
   ========================================================================== */

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  background: var(--ink);
  color: var(--cream);
  padding: clamp(70px, 10vw, 120px) var(--pad) 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  overflow: hidden;
}

.footer-hero { max-width: var(--maxw); margin: 0 auto clamp(50px, 8vw, 90px); }
.footer-hero h2 {
  font-size: clamp(2.1rem, 6.6vw, 5rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.rotator {
  display: inline-grid;
  vertical-align: bottom;
  height: 1.02em;
  overflow: hidden;
  text-align: left;
}
.rot-item {
  grid-area: 1 / 1;
  color: var(--accent);
  transform: translateY(110%);
  opacity: 0;
  transition: transform 0.6s var(--ease), opacity 0.4s ease;
}
.rot-item.is-active { transform: translateY(0); opacity: 1; }
.rot-item.is-out { transform: translateY(-110%); opacity: 0; }

.footer-grid {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  padding-bottom: 56px;
  border-bottom: 1px solid rgba(242,240,236,0.12);
}
.footer-grid h5 {
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: rgba(242,240,236,0.42);
  margin-bottom: 14px;
}
.footer-link {
  display: block;
  font-size: 0.98rem;
  padding: 4px 0;
  color: rgba(242,240,236,0.8);
  transition: color 0.25s ease, transform 0.35s var(--ease);
}
.footer-link:hover { color: var(--cream); transform: translateX(4px); }
.footer-text { font-size: 0.92rem; line-height: 1.7; color: rgba(242,240,236,0.6); }

.footer-bottom {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: rgba(242,240,236,0.42);
}

.footer-wordmark {
  font-size: clamp(4rem, 22vw, 17rem);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 0.78;
  text-align: center;
  color: rgba(242,240,236,0.055);
  user-select: none;
  margin-bottom: -0.14em;
}

/* ==========================================================================
   Reveal defaults (GSAP takes over when JS is available)
   ========================================================================== */

.js .reveal,
.js .hero-title .w { opacity: 0; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1000px) {
  .about { grid-template-columns: 1fr; }
  .about-card { position: static; }
  .testimonials { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: 1fr; }
  .contact-intro > p { max-width: none; }
}

@media (max-width: 820px) {
  .nav-links { display: none; }
  .nav.is-open { border-radius: var(--r-lg); flex-wrap: wrap; }
  .nav.is-open .nav-links {
    display: flex; order: 3; flex-direction: column;
    width: 100%; margin: 6px 0 4px;
  }
  .nav.is-open .nav-links a { padding: 11px 14px; }
  .nav-toggle { display: block; order: 2; margin-left: auto; }
  .nav .btn-sm { order: 4; }
  .nav.is-open .btn-sm { width: 100%; }

  .work-grid { grid-template-columns: 1fr; }
  .svc-row { grid-template-columns: 34px 1fr; }
  .svc-row p { grid-column: 2; }
  .steps { grid-template-columns: 1fr; }
  .counters { grid-template-columns: 1fr; }
  .history li { grid-template-columns: 1fr auto; }
  .history li span:nth-child(2) { grid-column: 1 / -1; font-size: 0.88rem; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .faq-body p { padding-left: 4px; }
  .project-meta { flex-direction: column; gap: 14px; }
  .project-badges { flex-direction: row; align-items: flex-start; }
  .contact-details li { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 560px) {
  .hero-actions .btn { width: 100%; }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .marquee-track { animation: none; }
  .js .reveal, .js .hero-title .w { opacity: 1 !important; transform: none !important; }
  html { scroll-behavior: auto; }
  #hero-canvas { display: none; }
}

/* ==========================================================================
   CASE STUDY PAGES  (projects/<slug>.html)
   ========================================================================== */

.cs { display: block; }

/* Every direct child of .cs sits in the same centred column. Targeting `> *`
   rather than `> section` so a non-section block can't break out full-bleed. */
.cs > * {
  max-width: var(--maxw);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

/* --- Hero --- */

.cs-hero { padding-top: clamp(110px, 14vw, 170px); padding-bottom: clamp(34px, 5vw, 56px); }

.cs-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 12px;
  margin-bottom: 30px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: var(--surface);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ink-2);
  transition: transform 0.35s var(--ease), border-color 0.3s ease;
}
.cs-back svg { width: 15px; height: 15px; transition: transform 0.35s var(--ease); }
.cs-back:hover { border-color: rgba(19,19,17,0.22); }
.cs-back:hover svg { transform: translateX(-3px); }

.cs-title {
  font-size: clamp(2.4rem, 6.6vw, 5rem);
  text-align: left;
  max-width: 19ch;
  margin-bottom: clamp(34px, 5vw, 54px);
}
.cs-title .ln { white-space: normal; }

.cs-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px 24px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.cs-meta-item { display: flex; flex-direction: column; gap: 5px; }
.cs-meta-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--muted);
}
.cs-meta-value { font-size: 0.96rem; font-weight: 500; line-height: 1.45; }

/* --- Overview + scope --- */

.cs-overview {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: clamp(28px, 5vw, 70px);
  align-items: start;
  padding-top: clamp(40px, 6vw, 70px);
  padding-bottom: clamp(40px, 6vw, 64px);
}
.cs-overview-text p {
  font-size: clamp(1.04rem, 1.7vw, 1.2rem);
  line-height: 1.68;
  color: var(--ink-2);
  margin-bottom: 18px;
}
.cs-overview-text p:first-child { color: var(--ink); }

.cs-scope h3 {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--muted);
  margin-bottom: 14px;
}
.cs-scope-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }

/* --- Result stats --- */

.cs-results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding-bottom: clamp(40px, 6vw, 64px);
}
.cs-result {
  padding: 26px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.cs-result-value {
  display: block;
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.1;
}
.cs-result-label {
  display: block;
  margin-top: 8px;
  font-size: 0.86rem;
  color: var(--muted);
}

/* --- Content blocks --- */

.cs-block { padding-bottom: clamp(44px, 7vw, 90px); }

.cs-block-text { max-width: 68ch; margin-bottom: clamp(26px, 4vw, 44px); }
.cs-block-text h2 {
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.038em;
  margin-bottom: 18px;
}
.cs-block-text p {
  font-size: 1.04rem;
  line-height: 1.72;
  color: var(--ink-2);
  margin-bottom: 15px;
}

/* --- Figures --- */

/* Figures always fill the content column — a single figure is never narrower
   than its neighbours. Only the aspect ratio changes between them. */
.cs-figure { margin: 0; }
.cs-figure + .cs-figure { margin-top: 18px; }

.cs-media {
  overflow: hidden;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: linear-gradient(150deg, var(--cream-2), #dcd8d0);
  display: grid;
  place-items: center;
  padding: clamp(24px, 4vw, 54px);
}
.cs-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 0;
}
/* A real image should fill the frame edge to edge */
.cs-media:has(img) { padding: 0; }

.ratio-16-9 { aspect-ratio: 16 / 9; }
.ratio-4-3  { aspect-ratio: 4 / 3; }
.ratio-1-1  { aspect-ratio: 1 / 1; }
.ratio-3-4  { aspect-ratio: 3 / 4; }

.cs-figure figcaption {
  margin: 13px auto 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--muted);
  text-align: center;
}

.cs-figure-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cs-figure-pair .cs-figure + .cs-figure { margin-top: 0; }

/* --- Quote --- */

.cs-quote-band { padding-bottom: clamp(50px, 8vw, 96px); }
.cs-quote {
  padding: clamp(30px, 5vw, 52px);
  background: var(--cream-2);
  border-radius: var(--r-xl);
  text-align: center;
}
.cs-quote p {
  font-size: clamp(1.2rem, 2.6vw, 1.75rem);
  font-weight: 500;
  line-height: 1.36;
  letter-spacing: -0.03em;
  text-wrap: balance;
  max-width: 30ch;
  margin: 0 auto;
}
.cs-quote footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 26px;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: left;
}
.cs-quote footer strong { color: var(--ink); font-weight: 600; }

/* --- More projects + CTA --- */

.cs-next { padding-top: clamp(40px, 6vw, 70px); border-top: 1px solid var(--line); }
.cs-next .section-head { margin-bottom: clamp(28px, 4vw, 44px); }

.cs-cta { padding-top: clamp(50px, 8vw, 90px); padding-bottom: clamp(60px, 9vw, 110px); }
.cs-cta-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(36px, 6vw, 58px) 34px;
  text-align: center;
  border-radius: var(--r-xl);
  background: radial-gradient(120% 100% at 50% 0%, #fff 0%, #f7f5f1 62%, #f2f0ec 100%);
}
.cta-avatar {
  position: relative;
  overflow: hidden;
  width: 60px; height: 60px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(140deg, #ffd0b0, #ff5c26);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 0.98rem;
  box-shadow: 0 10px 28px -8px rgba(255,92,38,0.5);
}
.cs-cta-inner h3 {
  font-size: clamp(1.45rem, 3.2vw, 2.1rem);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.035em;
  margin-bottom: 12px;
  text-wrap: balance;
}
.cs-cta-inner p { color: var(--muted); margin-bottom: 26px; }

/* ==========================================================================
   PROJECTS INDEX  (projects/index.html)
   ========================================================================== */

.page-hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(120px, 15vw, 180px) var(--pad) clamp(20px, 4vw, 40px);
  text-align: center;
}
.page-title {
  font-size: clamp(2.6rem, 7.5vw, 5.6rem);
  margin-bottom: 24px;
}
.page-hero .hero-sub { margin-bottom: 34px; }

/* Standalone pages (thanks, 404) — less content, so they need their own
   breathing room to stop the footer riding up under the headline. */
.simple-page {
  min-height: 68vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: clamp(60px, 10vw, 120px);
}
.simple-page .page-title { font-size: clamp(2.2rem, 5.5vw, 4rem); }
.simple-page .hero-actions { margin-bottom: 0; }

.filters { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.filter {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 9px 20px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}
.filter:hover { color: var(--ink); border-color: rgba(19,19,17,0.2); }
.filter.is-active { background: var(--ink); border-color: var(--ink); color: var(--cream); }

.filter-empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ==========================================================================
   Case study responsive
   ========================================================================== */

@media (max-width: 1000px) {
  .cs-overview { grid-template-columns: 1fr; }
  .cs-meta { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  /* Short stat values still fit three-up above this width */
  .cs-results { grid-template-columns: 1fr; }
  .cs-figure-pair { grid-template-columns: 1fr; }
  .cs-figure-pair .cs-figure + .cs-figure { margin-top: 18px; }
  .cs-title { max-width: none; }
  /* Portrait placeholders get very tall on small screens */
  .ratio-3-4 { aspect-ratio: 4 / 3; }
}
