/* ---------- Fonts ---------- */
@font-face {
  font-family: "Literata";
  src: url("assets/fonts/Literata-Variable.ttf") format("truetype-variations"),
       url("assets/fonts/Literata-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "MS Sans Serif";
  src: url("assets/fonts/MicrosoftSansSerif.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #f0f4ea;
  --accent: #ee4a31;
  --accent-soft: rgba(238, 74, 49, 0.18);
  --max-width: 1800px;
  --side-margin: 64px;
  --font-display: "Literata", Georgia, "Times New Roman", serif;
  --font-body: "MS Sans Serif", "Microsoft Sans Serif", Tahoma, Verdana, Arial, sans-serif;

  /* Premium easing curves (Emil Kowalski / animations.dev) */
  --ease-out-quint: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
  --ease-in-out-quart: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--accent);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ---------- Accessibility helpers ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 8px 12px;
  z-index: 9999;
}
.skip-link:focus { left: 12px; top: 12px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Page frame (full-width responsive) ---------- */
.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px clamp(20px, 3.5vw, 64px) 0;
}

/* ---------- Header ---------- */
.site-header {
  padding: 10px 0 50px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
}
.brand-wordmark {
  width: auto;
  height: 22px;
  display: block;
}
.brand-mark {
  width: auto;
  height: 28px;
  display: block;
}

/* ---------- Intro typewriter ---------- */
.intro {
  margin: 0 0 60px;
}
.intro-text {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.45;
  letter-spacing: -0.005em;
  max-width: 1180px;
  min-height: calc(1.45em * 5);
}
.intro-text .tw-cursor {
  display: inline-block;
  width: 0.5ch;
  margin-left: 2px;
  background: var(--accent);
  animation: blink 0.9s steps(2, start) infinite;
  vertical-align: -0.05em;
}
.intro-text .tw-cursor::before { content: "\00a0"; }
@keyframes blink { to { visibility: hidden; } }

/* ---------- Headline ---------- */
.headline-section {
  margin: 0 0 40px;
}
.headline {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 150px;
  line-height: 1.02;
  letter-spacing: -0.02em;
}
.headline-line { display: block; }
.headline .accent { color: var(--accent); }

/* ---------- Divider ---------- */
.divider {
  border: 0;
  border-top: 1px solid var(--accent);
  margin: 0 0 40px;
  opacity: 0.95;
}

/* ---------- Reel ---------- */
.reel { margin: 0 0 60px; }
.reel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 36px;
}
.section-label {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 18px;
  letter-spacing: 0.04em;
}
.wordmark-logo {
  height: 64px;
  width: auto;
  display: block;
}

.video-frame {
  background: #ffffff;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.reel-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- Services ---------- */
.services { margin: 60px 0 0; }
.services .section-label { margin-bottom: 28px; }
.strategy {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  line-height: 1.4;
  letter-spacing: -0.01em;
  max-width: 1180px;
}
.strategy-divider {
  border: 0;
  border-top: 1px solid var(--accent);
  margin: 32px 0 56px;
  opacity: 0.95;
}

.services-stage-wrap {
  position: relative;
  margin: 0 0 60px;
  max-width: 1180px;
}
.services-list {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.service-row {
  display: grid;
  grid-template-columns: 320px 1fr;
  column-gap: 60px;
  margin: 0;
}
.service-name {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 17px;
  letter-spacing: 0.01em;
}
.service-desc {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 18px;
  line-height: 1.4;
  letter-spacing: -0.005em;
}

/* Stagger init state */
.service-row[data-stagger] > * {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.7s var(--ease-out-quint), transform 0.7s var(--ease-out-quint);
}
.service-row.is-in > * {
  opacity: 1;
  transform: none;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 40px 0 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 40px;
  align-items: start;
  margin-bottom: 120px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--accent-soft);
}
.footer-address,
.footer-links {
  font-style: normal;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
}
.footer-address p,
.footer-links p { margin: 0 0 4px; }
.footer-title {
  font-family: var(--font-body);
  font-size: 16px;
  margin-bottom: 16px !important;
}
.footer-address a:hover,
.footer-links a:hover { text-decoration: underline; }

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.footer-links .icon { width: 16px; height: 16px; }

.footer-action {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 18px;
}
.footer-mark { width: auto; height: 42px; display: block; }

.contact-cta {
  display: inline-block;
  padding: 12px 22px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: transparent;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.35s cubic-bezier(.22, 1, .36, 1);
  will-change: transform;
}
.contact-cta:hover,
.contact-cta:focus-visible {
  background: var(--accent);
  color: var(--bg);
}

/* ---------- AFTR logo ---------- */
.aftr-logo-wrap {
  margin: 0;
  padding: 0 0 40px;
}
.aftr-logo {
  width: 100%;
  height: auto;
  display: block;
  will-change: transform;
}

/* ---------- Clients ---------- */
.clients {
  margin: 40px 0 60px;
}
.clients .section-label { margin-bottom: 36px; }

.clients-grid {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  width: 100%;
  max-width: 1550px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
}

/*
  CSS sprite approach — uses the original clients-logos.png at native
  resolution. No individual slicing, no upscaling, no blur.

  Source image: 1550×1189px, 5 columns × 6 rows.
  background-size: 500% 600% means "the full image is 5× wider than
  one cell, 6× taller" — so each cell shows exactly 1/5 × 1/6 of it.

  background-position uses --c (0–4) and --r (0–5) CSS vars set inline
  on each li. Percentages map: col → 0%/25%/50%/75%/100%,
  row → 0%/20%/40%/60%/80%/100%.
*/
.client-cell {
  aspect-ratio: 31 / 20;
  background-image: url('clients-logos.png');
  background-size: 500% 600%;
  background-position:
    calc(var(--c, 0) * 25%)
    calc(var(--r, 0) * 20%);
  background-repeat: no-repeat;
  min-width: 0;
  cursor: default;
  transition: transform 0.6s var(--ease-out-quint);
  will-change: transform;
}

/* Per-cell reveal cascade */
.client-cell[data-reveal] {
  transition-delay: calc(min(var(--i, 0), 14) * 35ms);
}

@media (hover: hover) and (pointer: fine) {
  .client-cell:hover {
    transform: scale(1.08);
  }
}

/* Responsive column drops */
@media (max-width: 1240px) {
  .clients-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .clients-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .clients-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .clients { margin: 24px 0 40px; }
  .clients .section-label { margin-bottom: 22px; }
}

/* ---------- Service hover image ---------- */
.service-hover-stage {
  display: none;
  pointer-events: none;
}
.service-hover-image {
  position: absolute;
  right: 0;
  top: 0;
  width: 240px;
  height: auto;
  max-height: 320px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%) scale(1.04);
  filter: blur(12px);
  transition:
    opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 1;
  will-change: opacity, transform, filter;
}
.service-hover-image.is-visible {
  opacity: 1;
  transform: translateY(-50%) scale(1);
  filter: blur(0);
}
.service-hover-image.is-exiting {
  opacity: 0;
  transform: translateY(-50%) scale(1.02);
  filter: blur(8px);
  transition:
    opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (min-width: 1100px) {
  .services-stage-wrap {
    max-width: none;
  }
  .services-list {
    max-width: 740px;
  }
  .service-hover-stage {
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 240px;
  }
}

@media (hover: none), (pointer: coarse) {
  .service-hover-stage { display: none !important; }
}

/* ---------- Reveal animations ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.9s var(--ease-out-quint), transform 0.9s var(--ease-out-quint);
  will-change: opacity, transform;
}
[data-reveal].is-in {
  opacity: 1;
  transform: none;
}


/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .intro-text { font-size: 24px; }
  .headline { font-size: 100px; }
  .wordmark-logo { height: 52px; }
  .strategy { font-size: 22px; }
  .service-row { grid-template-columns: 260px 1fr; column-gap: 40px; }
}

@media (max-width: 900px) {
  .intro-text { font-size: 20px; }
  .headline { font-size: 76px; }
  .wordmark-logo { height: 40px; }
}

@media (max-width: 768px) {
  .page { padding-left: 24px; padding-right: 24px; }
  .site-header { padding: 6px 0 40px; }

  .intro { margin-bottom: 60px; }
  .intro-text { font-size: 18px; min-height: calc(1.5em * 6); }

  .headline-section { margin-bottom: 40px; }
  .headline { font-size: 56px; line-height: 1.05; }

  .divider { margin-bottom: 40px; }

  .reel-header { flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
  .wordmark-logo { height: 34px; }

  .services { margin-top: 40px; }
  .services .section-label { margin-bottom: 22px; }
  .strategy { font-size: 18px; }
  .strategy-divider { margin: 24px 0 36px; }

  .services-stage-wrap { margin-bottom: 40px; }
  .services-list { gap: 18px; }
  .service-row { display: block; }
  .service-name { font-size: 16px; margin-bottom: 4px; display: block; }
  .service-desc { font-size: 15px; display: block; }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 60px;
    padding-bottom: 30px;
  }
  .footer-action { justify-content: flex-start; }

  .aftr-logo-wrap { margin-top: 0; padding-bottom: 30px; }

}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  [data-reveal],
  .service-row[data-stagger] > * {
    opacity: 1 !important;
    transform: none !important;
  }
  .intro-text .tw-cursor { display: none; }
  .service-hover-stage { display: none !important; }
}
