/* Homepage layout. References tokens-home.css. */

body.home {
  font-family: var(--font-sans);
  font-weight: var(--fw-regular);
  background-color: var(--color-bg);
  color: var(--color-text);
}

/* While the loader is up, lock scroll so the page doesn't peek out. */
body.home.is-loading {
  overflow: hidden;
}

/* ─────────────────────────────────────────────────────────────────────
   Scroll-reveal — applied via IntersectionObserver in scripts/home.js.
   Matches the previous iteration: longer duration, scale + slide, with
   an ease-out-expo curve so the entry settles slowly at the end.
   .reveal             single element fade-up + scale
   .reveal--stagger    parent whose direct children animate in cascade
   ──────────────────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(28px) scale(0.97);
  transition:
    opacity 1.35s cubic-bezier(0.16, 1, 0.3, 1),
    transform 1.35s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

.reveal--stagger > * {
  opacity: 0;
  transform: translateY(22px) scale(0.97);
  transition:
    opacity 1.05s cubic-bezier(0.16, 1, 0.3, 1),
    transform 1.05s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal--stagger.is-visible > *:nth-child(1)  { transition-delay: 0.05s; opacity: 1; transform: none; }
.reveal--stagger.is-visible > *:nth-child(2)  { transition-delay: 0.14s; opacity: 1; transform: none; }
.reveal--stagger.is-visible > *:nth-child(3)  { transition-delay: 0.23s; opacity: 1; transform: none; }
.reveal--stagger.is-visible > *:nth-child(4)  { transition-delay: 0.32s; opacity: 1; transform: none; }
.reveal--stagger.is-visible > *:nth-child(5)  { transition-delay: 0.41s; opacity: 1; transform: none; }
.reveal--stagger.is-visible > *:nth-child(6)  { transition-delay: 0.50s; opacity: 1; transform: none; }
.reveal--stagger.is-visible > *:nth-child(7)  { transition-delay: 0.59s; opacity: 1; transform: none; }
.reveal--stagger.is-visible > *:nth-child(8)  { transition-delay: 0.68s; opacity: 1; transform: none; }
.reveal--stagger.is-visible > *:nth-child(9)  { transition-delay: 0.77s; opacity: 1; transform: none; }
.reveal--stagger.is-visible > *:nth-child(10) { transition-delay: 0.86s; opacity: 1; transform: none; }
.reveal--stagger.is-visible > *:nth-child(11) { transition-delay: 0.95s; opacity: 1; transform: none; }
.reveal--stagger.is-visible > *:nth-child(12) { transition-delay: 1.04s; opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal--stagger > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────
   Loader — clip-path reveal.
   The dark cover sits on top of the hero canvas with a clip-path "frame"
   that punches a square hole in the centre. The hero's wave shows
   through that hole. The hole bounces open from 0 → 140px, holds for
   the progress phase, then expands to fill the viewport — exposing the
   rest of the same wave that was already running underneath.
   ──────────────────────────────────────────────────────────────────── */
@property --hole-size {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: auto;
}
.loader.is-removed {
  display: none;
}

.loader__cover {
  position: absolute;
  inset: 0;
  background: var(--color-bg);
  --hole-size: 0px;
  /* The polygon traces the outer viewport rect, then jumps to an inner
     square (centred) and traces it counter-clockwise. The result is a
     "frame" shape — the cover only paints between the outer rect and
     the inner hole, so the hole is transparent and reveals what's
     behind. As --hole-size grows, the hole expands. */
  clip-path: polygon(
    0% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%,
    calc(50% - var(--hole-size) / 2) calc(50% - var(--hole-size) / 2),
    calc(50% - var(--hole-size) / 2) calc(50% + var(--hole-size) / 2),
    calc(50% + var(--hole-size) / 2) calc(50% + var(--hole-size) / 2),
    calc(50% + var(--hole-size) / 2) calc(50% - var(--hole-size) / 2),
    calc(50% - var(--hole-size) / 2) calc(50% - var(--hole-size) / 2)
  );
  transition: --hole-size 0.9s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.loader.is-loaded .loader__cover {
  --hole-size: 140px;
}
.loader.is-expanding .loader__cover {
  --hole-size: 220vmax;
  transition: --hole-size 1.8s var(--ease-out);
}

.loader__progress {
  position: absolute;
  left: 50%;
  top: 50%;
  /* Centre the bar 70px (half the hole) + 24px gap below the hole. */
  transform: translate(-50%, calc(70px + 24px));
  width: 140px;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.6s var(--ease-out) 0.4s;
}
.loader.is-loaded .loader__progress {
  opacity: 1;
}
.loader.is-expanding .loader__progress {
  opacity: 0;
  transition-delay: 0s;
  transition-duration: 0.25s;
}
.loader__bar {
  flex: 1;
  height: 6px;
  border: 1px solid hsla(215, 12%, 48%, 0.5);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.loader__bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: hsl(215, 12%, 42%);
  border-radius: 1px;
  transition: width 0.08s linear;
}
.loader__pct {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: var(--fw-regular);
  color: hsl(215, 12%, 60%);
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  .loader__cover { transition: none; }
  .loader__progress { transition: none; }
  .hero__canvas { transition: none; }
  body.is-pre-reveal .hero__canvas { transform: scale(1); }
}

.home main {
  display: block;
}

/* ─────────────────────────────────────────────────────────────────────
   Shared display header (script-style title + horizontal rule)
   ──────────────────────────────────────────────────────────────────── */
.display-header {
  display: flex;
  align-items: end;
  gap: clamp(24px, 4vw, 60px);
  margin-bottom: clamp(40px, 6vw, 96px);
}
.display-title {
  font-family: var(--font-display);
  font-weight: var(--fw-regular);
  font-size: var(--fs-display-xl);
  line-height: var(--lh-display);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.display-rule {
  flex: 1;
  height: 1px;
  background-color: currentColor;
  opacity: 0.25;
  margin-bottom: clamp(20px, 3vw, 56px);
}

/* The accent-color highlight used inline in copy */
.text-accent {
  color: var(--color-accent);
  font-style: normal;
}

/* ─────────────────────────────────────────────────────────────────────
   Top nav
   ──────────────────────────────────────────────────────────────────── */
.site-nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
}
.site-nav__inner {
  max-width: var(--content-max);
  margin-inline: auto;
  padding: clamp(24px, 3vw, 40px) var(--content-gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-10);
}
.site-nav__logo img {
  height: 36px;
  width: auto;
}
.site-nav__links {
  display: flex;
  gap: clamp(20px, 3vw, 48px);
  font-size: var(--fs-nav);
  font-weight: var(--fw-medium);
}
.site-nav__links a {
  color: var(--color-text);
  opacity: 0.85;
  transition: opacity var(--duration-fast) var(--ease-out);
}
.site-nav__links a:hover,
.site-nav__links a:focus-visible {
  opacity: 1;
}

/* ─────────────────────────────────────────────────────────────────────
   1. Hero
   ──────────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  /* Dynamic viewport: resizes as Safari's address bar shows/hides so the
     hero always fills the visible viewport. 100vh is the legacy fallback
     for browsers without dvh support. */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  background-color: var(--color-bg);
  overflow: hidden;
}
.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
  transform-origin: 50% 50%;
  transform: scale(1);
  /* The same 1.8s easing the loader cover uses, so the wave grows out
     in lockstep with the hole expanding. */
  transition: transform 1.8s cubic-bezier(0.16, 1, 0.3, 1);
}
/* While the loader is still in its "hold" phase, scale the wave down so
   the small window in the centre crops a larger portion of the curve
   (curves visible, not just near-straight lines). When the body class
   drops at expand-start, the canvas animates back to scale(1) — its
   final fullscreen size — in sync with the hole reveal. */
body.is-pre-reveal .hero__canvas {
  transform: scale(0.5);
}
.hero__inner {
  position: relative;
  z-index: 1;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--content-gutter);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 2.5vw, 40px);
}
.hero__eyebrow {
  font-family: var(--font-sans);
  font-weight: var(--fw-extralight);
  font-size: var(--fs-eyebrow);
  color: var(--color-text-muted);
}
.hero__title {
  font-family: var(--font-display);
  font-weight: var(--fw-regular);
  font-size: var(--fs-display-lg);
  line-height: var(--lh-display);
  letter-spacing: -0.01em;
  max-width: 1100px;
}
.hero__sub {
  font-family: var(--font-sans);
  font-weight: var(--fw-extralight);
  font-size: var(--fs-lead);
  color: var(--color-text-muted);
  max-width: 720px;
}

/* ─────────────────────────────────────────────────────────────────────
   2. Clients
   ──────────────────────────────────────────────────────────────────── */
.clients {
  background-color: var(--color-bg-light);
  color: var(--color-text-on-light);
  padding-block: clamp(80px, 10vw, 160px);
}
.clients__inner {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--content-gutter);
  display: flex;
  flex-direction: column;
  gap: clamp(48px, 6vw, 96px);
}
.clients__title {
  font-family: var(--font-sans);
  font-weight: var(--fw-light);
  font-size: var(--fs-section-intro);
  line-height: var(--lh-snug);
  text-align: center;
  max-width: 1100px;
  margin-inline: auto;
}
.clients__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(28px, 4vw, 64px) clamp(24px, 4vw, 80px);
  align-items: center;
  justify-items: center;
}
.clients__grid img {
  max-height: 56px;
  max-width: 180px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* ─────────────────────────────────────────────────────────────────────
   3. My Story
   ──────────────────────────────────────────────────────────────────── */
.story {
  background-color: var(--color-bg);
  padding-block: clamp(96px, 12vw, 200px);
}
.story__inner {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--content-gutter);
}
.story__body {
  display: grid;
  grid-template-columns: minmax(280px, 480px) minmax(0, 1fr);
  gap: clamp(40px, 6vw, 96px);
  align-items: end;
}
.story__portrait {
  margin: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background-color: var(--color-surface-1);
}
.story__portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.story__copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  font-size: var(--fs-body);
  line-height: 1.65;
  font-weight: var(--fw-light);
  color: var(--color-text-muted);
  max-width: 640px;
}
.story__copy p {
  margin: 0;
}
.story__copy .text-accent {
  font-weight: var(--fw-regular);
}

/* ─────────────────────────────────────────────────────────────────────
   4. Selected Work
   ──────────────────────────────────────────────────────────────────── */
.work {
  background-color: var(--color-bg-light);
  color: var(--color-text-on-light);
  padding-block: clamp(96px, 12vw, 200px);
}
.work__inner {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--content-gutter);
}

/* Case study — list-style block: details on the white page, imagery in
   a tinted panel below. */
.case {
  --case-bg: var(--grad-hdfc);
  display: flex;
  flex-direction: column;
  gap: clamp(28px, 3.5vw, 48px);
  margin-bottom: clamp(64px, 8vw, 144px);
}
.case--hdfc { --case-bg: var(--grad-hdfc); }
.case--tira { --case-bg: var(--grad-tira); }
.case--adda { --case-bg: var(--grad-adda); }
.case:last-child { margin-bottom: 0; }

/* Header: project meta on the left, intro + CTA on the right */
.case__header {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 1.6fr);
  gap: clamp(32px, 5vw, 96px);
  align-items: start;
  padding-bottom: clamp(20px, 2.5vw, 36px);
  border-bottom: 1px solid var(--color-border-light);
}
.case__heading {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.case__role {
  font-size: var(--fs-meta);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-on-light-muted);
}
.case__title {
  font-family: var(--font-sans);
  font-weight: var(--fw-bold);
  font-size: clamp(36px, 4vw, 56px);
  line-height: var(--lh-tight);
  color: var(--color-text-on-light);
}
.case__intro {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  align-items: start;
}
.case__lede {
  font-size: var(--fs-body-md);
  line-height: var(--lh-snug);
  color: var(--color-text-on-light-muted);
  max-width: 760px;
}
.case__cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--fw-medium);
  color: var(--color-accent-cta);
  font-size: var(--fs-body-md);
  transition: gap var(--duration-fast) var(--ease-out);
}
.case__cta:hover { gap: var(--space-3); }
.case__cta--external { color: var(--color-accent-tira); }
.case__cta-arrow {
  width: 20px;
  height: 20px;
  display: block;
}
.case__cta--external svg { stroke: currentColor; }

/* Scope — 4 columns of mini stack lists */
.case__scope {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 56px);
  margin: 0;
}
.case__scope-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.case__scope-col dt {
  font-size: var(--fs-meta);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-on-light-muted);
  margin-bottom: var(--space-1);
}
.case__scope-col dd {
  margin: 0;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--color-text-on-light);
}

/* Imagery panel — tinted gradient behind the screens */
.case__panel {
  background: var(--case-bg);
  border-radius: var(--radius-xl);
  padding: clamp(28px, 4vw, 72px) clamp(20px, 3vw, 56px);
  display: block;
}
.case__phones {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 1.6vw, 28px);
  align-items: end;
}
.case__phones li {
  margin: 0;
  border-radius: clamp(14px, 1.5vw, 22px);
  overflow: hidden;
  aspect-ratio: 350 / 750;
  box-shadow: 0 24px 48px -28px rgba(0, 0, 0, 0.18);
}
.case__phones img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Desktop screenshot panel (Tira & Adda only) */
.case__panel--desktop {
  margin: 0;
  padding: clamp(36px, 5vw, 88px) clamp(28px, 4vw, 80px);
}
.case__panel--desktop img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
  box-shadow: 0 32px 64px -36px rgba(0, 0, 0, 0.22);
}

/* ─────────────────────────────────────────────────────────────────────
   5. Testimonials
   ──────────────────────────────────────────────────────────────────── */
.testimonials {
  background-color: var(--color-bg-light);
  color: var(--color-text-on-light);
  padding-block: clamp(48px, 8vw, 120px) clamp(96px, 12vw, 200px);
}
.testimonials__inner {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--content-gutter);
}
.testimonials__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 28px);
}
.testimonial {
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 2.5vw, 28px);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-height: 360px;
}
.testimonial__quote {
  font-size: var(--fs-body-md);
  font-weight: var(--fw-bold);
  line-height: var(--lh-snug);
}
.testimonial__body {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--color-text-on-light-muted);
  flex: 1;
}
.testimonial__author {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: auto;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  color: #fff;
}
.testimonial__author--dark { background-color: var(--color-bg); }
.testimonial__author--teal { background-color: var(--color-accent-teal); }
.testimonial__author--purple { background-color: var(--color-accent-purple); }
.testimonial__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.05));
  flex-shrink: 0;
  overflow: hidden;
  display: block;
}
.testimonial__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.testimonial__meta {
  display: flex;
  flex-direction: column;
  line-height: var(--lh-snug);
}
.testimonial__meta strong {
  font-weight: var(--fw-bold);
  font-size: var(--fs-body);
}
.testimonial__meta span {
  font-weight: var(--fw-medium);
  font-size: var(--fs-meta);
  opacity: 0.85;
}

/* ─────────────────────────────────────────────────────────────────────
   Footer (Figma: 644px tall, content column 464px tall, headline + email
   at top of column, socials (left) + logo (right) at bottom).
   ──────────────────────────────────────────────────────────────────── */
.site-footer {
  position: relative;
  background-color: var(--color-bg);
  color: var(--color-text);
  height: clamp(560px, 45vw, 644px);
  display: flex;
  align-items: center;
  overflow: hidden;
}
.site-footer__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
}
.site-footer__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--content-gutter);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: clamp(260px, 22vw, 310px);
}
.site-footer__top {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
.site-footer__headline {
  font-family: var(--font-sans);
  font-weight: var(--fw-regular);
  font-size: clamp(36px, 4.5vw, 60px);
  line-height: 1.2;
  color: var(--color-text);
}
.site-footer__email {
  font-size: clamp(16px, 1.4vw, 20px);
  font-weight: var(--fw-light);
  line-height: 1.2;
  color: var(--color-text);
  align-self: flex-start;
  transition: color var(--duration-fast) var(--ease-out);
}
.site-footer__email:hover { color: var(--color-accent); }
.site-footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-10);
}
.site-footer__social {
  display: flex;
  gap: var(--space-5);
}
.site-footer__social img {
  width: 24px;
  height: 24px;
  filter: invert(1);
  opacity: 0.9;
  transition: opacity var(--duration-fast) var(--ease-out);
}
.site-footer__social a:hover img { opacity: 1; }
.site-footer__logo {
  display: block;
  transition: opacity var(--duration-fast) var(--ease-out);
}
.site-footer__logo:hover { opacity: 0.85; }
.site-footer__logo img {
  height: 42px;
  width: auto;
  display: block;
}

/* ─────────────────────────────────────────────────────────────────────
   Responsive
   ──────────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .case__header { grid-template-columns: minmax(0, 1fr); }
  .case__scope { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .testimonials__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .testimonial { min-height: 0; }
}

@media (max-width: 800px) {
  .site-nav__links { display: none; }
  .clients__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .clients__grid img { max-height: 40px; max-width: 130px; }
  .story__body { grid-template-columns: minmax(0, 1fr); }
  .story__portrait { max-width: 360px; aspect-ratio: 4 / 5; }
  .case__phones { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer {
    height: auto;
    padding-block: var(--space-20);
  }
  .site-footer__inner {
    height: auto;
    gap: var(--space-16);
  }
}

@media (max-width: 520px) {
  .display-title { white-space: normal; }
  .clients__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-7) var(--space-5); }
  .clients__grid img { max-height: 32px; max-width: 110px; }
  /* Keep scope at 2 columns on phones with smaller text so the four
     categories read as a 2×2 grid instead of a long stack. */
  .case__scope {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-10) var(--space-4);
  }
  .case__scope-col dt { font-size: 12px; }
  .case__scope-col dd { font-size: 14px; line-height: 1.5; }
  .case__phones { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .testimonials__grid { grid-template-columns: minmax(0, 1fr); }
}
