*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@font-face {
  font-family: 'TAN Meringue';
  src: url('assets/fonts/TAN-MERINGUE.woff2') format('woff2'),
       url('assets/fonts/TAN-MERINGUE.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand palette — direct from brand book */
  --brand-blue: #1e3f6b;
  --brand-blue-light: #a5dcf5;
  --brand-brown: #56351e;
  --brand-brown-light: #f4e3d7;
  --brand-beige: #fff9ee;
  --brand-orange: #ffa666;
}

/* Per-theme tokens applied via [data-theme] */
[data-theme="soft"] {
  --bg: var(--brand-beige);
  --bg-alt: #fbf3e2;
  --bg-deep: var(--brand-brown-light);
  --fg: var(--brand-blue);
  --fg-muted: #6f7d96;
  --accent: var(--brand-orange);
  --accent-strong: #f08236;
  --accent-text: var(--brand-brown);
  --line: #e4dac1;
  --card: #fff;
  --pill: #fff;
}
[data-theme="studio"] {
  --bg: var(--brand-blue);
  --bg-alt: #173258;
  --bg-deep: #0f2342;
  --fg: var(--brand-beige);
  --fg-muted: #a8b4c8;
  --accent: var(--brand-orange);
  --accent-strong: #ffbd83;
  --accent-text: var(--brand-brown-light);
  --line: #2a4d7c;
  --card: #173258;
  --pill: #2a4d7c;
}
[data-theme="lab"] {
  --bg: var(--brand-beige);
  --bg-alt: var(--brand-blue-light);
  --bg-deep: var(--brand-brown-light);
  --fg: var(--brand-blue);
  --fg-muted: #6f7d96;
  --accent: var(--brand-orange);
  --accent-strong: #f08236;
  --accent-text: var(--brand-brown);
  --line: #d9d2bf;
  --card: #fff;
  --pill: #fff;
}

/* Typography helpers */
.display {
  font-family: 'TAN Meringue', 'Fraunces', 'Times New Roman', serif;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 0.95;
}
.display-roman {
  font-family: 'TAN Meringue', 'Fraunces', serif;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 0.95;
}
.heading {
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.label-mono {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.label-sans {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* Brand "underscore" — keyword underline signature */
.u-mark {
  position: relative;
  white-space: nowrap;
}
.u-mark::after {
  content: "";
  position: absolute;
  left: -0.05em;
  right: -0.05em;
  bottom: -0.06em;
  height: 0.42em;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 24' preserveAspectRatio='none'><path d='M2 18 Q 50 4 100 12 T 198 14' fill='none' stroke='%23ffa666' stroke-width='5' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  z-index: -1;
  opacity: 0.95;
}
.u-mark--thin::after {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'><path d='M2 8 Q 50 0 100 4 T 198 6' fill='none' stroke='%23ffa666' stroke-width='3' stroke-linecap='round'/></svg>");
  height: 0.22em;
  bottom: -0.02em;
}
.u-mark--solid::after {
  background-image: none;
  background-color: var(--accent);
  height: 0.18em;
  bottom: 0.04em;
  z-index: -1;
  opacity: 0.85;
  border-radius: 2px;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, color .2s ease;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--fg); color: var(--bg); }
.btn--primary:hover { background: var(--accent); color: var(--brand-blue); }
.btn--accent { background: var(--accent); color: var(--brand-blue); }
.btn--ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--fg);
}
.btn--ghost:hover { background: var(--fg); color: var(--bg); }
.btn .arr { display: inline-block; transition: transform .25s ease; }
.btn:hover .arr { transform: translateX(4px); }

.section { padding: 96px 64px; }
.section--tight { padding: 64px 64px; }
.container { max-width: 1320px; margin: 0 auto; }

@media (max-width: 880px) {
  .section { padding: 64px 24px; }
  .section--tight { padding: 48px 24px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .stat-cell:nth-child(2) { border-right: none !important; }
  .stat-statement { grid-template-columns: 1fr !important; gap: 40px !important; }
  .stat-hero { border-left: none !important; padding-left: 0 !important; border-top: 1px solid var(--line); padding-top: 32px !important; }
  .founder-block { grid-template-columns: 1fr !important; }
  .testimonial-box { grid-template-columns: 1fr !important; padding: 32px 24px !important; gap: 20px !important; }
  .testimonial-box .display { font-size: 32px !important; }
}
@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr !important; }
  .stat-cell { border-right: none !important; }
  .footer-grid { grid-template-columns: 1fr !important; }
  .svc-name { font-size: clamp(20px, 6.5vw, 28px) !important; }
  .svc-row-head { grid-template-columns: 44px 1fr auto !important; gap: 14px !important; }
}

/* ── Case study template ── */
.cs-grayscale image-slot { filter: grayscale(1) contrast(1.04); }
.cs-grayscale:hover image-slot { filter: grayscale(0); transition: filter .6s ease; }

@media (max-width: 880px) {
  .cs-hero-grid { grid-template-columns: 1fr !important; }
  .cs-hero-media { min-height: 320px !important; order: 2; }
  .cs-hero-scrim { background: linear-gradient(180deg, var(--brand-blue) 0%, rgba(30,63,107,0.55) 12%, rgba(30,63,107,0) 42%, rgba(30,63,107,0) 68%, rgba(30,63,107,0.95) 100%) !important; }

  /* Services header + About header two-column collapse */
  .svc-head, .about-head { grid-template-columns: 1fr !important; gap: 28px !important; align-items: start !important; }
  .svc-head h2, .about-head h2 { font-size: clamp(32px, 8vw, 48px) !important; }
  .svc-head p { font-size: clamp(15px, 4vw, 17px) !important; max-width: 100% !important; }

  /* About stats: 2x2 grid on mobile instead of forced 4-col row */
  .about-stats { grid-template-columns: repeat(2, 1fr) !important; }
  .about-stats > div { padding: 24px 16px !important; }
  .about-stats span:first-child { font-size: clamp(26px, 7vw, 36px) !important; }

  /* Fixed 64px side-padding wraps need to shrink on mobile so content
     doesn't get squeezed/clipped on narrow viewports. */
  .px-mobile-safe { padding-left: 24px !important; padding-right: 24px !important; }
  .thesis-inset { left: 24px !important; right: 24px !important; }
  .site-footer { padding: 56px 24px 24px !important; }
  .footer-grid { grid-template-columns: 1fr 1fr !important; gap: 32px !important; }
}

@media (max-width: 520px) {
  .about-stats { grid-template-columns: 1fr !important; }
  .about-stats > div { border-right: none !important; border-bottom: 1px solid var(--line); }
  .about-stats > div:last-child { border-bottom: none; }
}
  .cs-stat-grid { grid-template-columns: 1fr !important; }
  .cs-stat-grid > div { border-left: none !important; border-top: 1px solid var(--line); padding-left: 0 !important; }
  .cs-stat-grid > div:first-child { border-top: none; }
  .cs-brief-grid { grid-template-columns: 1fr !important; gap: 24px !important; }
  .cs-approach-grid { grid-template-columns: 1fr !important; }
  .cs-results-numbers { grid-template-columns: 1fr !important; }
  .cs-results-cards { grid-template-columns: 1fr !important; }
  .cs-next-card { grid-template-columns: 1fr !important; gap: 20px !important; }
}
@media (min-width: 881px) and (max-width: 1100px) {
  .cs-results-cards { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Hide scrollbar on Work carousel (Safari/Chrome) */
.work-carousel { scrollbar-width: none; }
.work-carousel::-webkit-scrollbar { display: none; }

/* Reduced-motion tweak — pause infinite marquees */
body[data-motion="reduced"] .marquee__track { animation: none !important; }

/* Services expanded panel — stack on smaller screens */
@media (max-width: 980px) {
  .svc-expand {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }
  .svc-expand > div:first-child { display: none !important; }
  .svc-visual { min-height: 200px; order: -1; }
}

@media (max-width: 760px) {
  .hero-grid {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
    margin-top: 40px !important;
  }
  .hero-aside { display: none !important; }
  .hero-ctas .btn { padding: 16px 22px; }
}

/* Marquee */
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.marquee {
  display: flex;
  overflow: hidden;
  white-space: nowrap;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.marquee__track {
  display: inline-flex;
  align-items: center;
  gap: 48px;
  padding: 22px 24px;
  animation: marquee 48s linear infinite;
  flex-shrink: 0;
}
.marquee--fast .marquee__track { animation-duration: 28s; }
.marquee__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* Rotating word stage */
.rotator {
  display: inline-flex;
  height: 1.4em;
  line-height: 1.4;
  overflow: hidden;
  vertical-align: baseline;
  color: var(--fg);
  position: relative;
  padding-right: 0.1em;
}
.rotator__inner {
  display: inline-flex;
  flex-direction: column;
  transition: transform 0.5s cubic-bezier(0.7, 0, 0.2, 1);
}
.rotator__word {
  height: 1.4em;
  line-height: 1.4;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

/* Tag pill */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--pill);
  color: var(--fg);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
}
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* Service card */
.svc {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 36px;
  transition: transform .3s ease, box-shadow .3s ease;
}
.svc:hover { transform: translateY(-4px); box-shadow: 0 24px 60px -28px rgba(30, 63, 107, 0.25); }

/* Image slot styling override */
image-slot {
  border-radius: 16px;
  overflow: hidden;
}

/* Drag-scroll case study row */
.drag-row {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 16px 64px 32px;
  cursor: grab;
  scrollbar-width: none;
}
.drag-row::-webkit-scrollbar { display: none; }
.drag-row.--dragging { cursor: grabbing; user-select: none; }
.drag-row.--dragging * { pointer-events: none; }
.drag-row > * { scroll-snap-align: start; flex-shrink: 0; }

/* Custom cursor */
.cursor {
  position: fixed;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width .2s ease, height .2s ease, background .2s ease;
}
.cursor.--big { width: 56px; height: 56px; background: var(--accent); mix-blend-mode: multiply; }

/* Number / index counter */
.num {
  font-family: 'TAN Meringue', 'Fraunces', serif;
  font-weight: 400;
  color: var(--accent-text);
}

[data-theme="studio"] .btn--ghost { color: var(--bg); border-color: var(--bg); }
[data-theme="studio"] .btn--ghost:hover { background: var(--bg); color: var(--fg); }

/* Reveal on scroll */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .8s ease, transform .9s cubic-bezier(.2,.7,.2,1);
}
.reveal.--in { opacity: 1; transform: none; }
.pf-grid > .reveal { height: 100%; }

/* Contact form focus ring */
.cf-input:focus {
  border-color: var(--brand-orange) !important;
  box-shadow: 0 0 0 3px rgba(255, 166, 102, 0.22);
}

/* Contact page — mobile stacking */
@media (max-width: 880px) {
  .contact-grid { grid-template-columns: 1fr !important; gap: 40px !important; }
  .contact-grid > div:first-child { position: static !important; top: auto !important; }
  .contact-fields { grid-template-columns: 1fr !important; }
  .contact-trust { grid-template-columns: repeat(2, 1fr) !important; }
  .contact-logos { grid-template-columns: repeat(3, 1fr) !important; row-gap: 28px !important; }
}
