/* ============================================================
   HOME PAGE — page-specific styles
   ============================================================ */

/* ============================================================
   HERO — WebGL mesh gradient background
   ============================================================ */

.hero {
  position: relative;
  z-index: 1;
  min-height: 82svh;
  background-color: var(--color-bg); /* matches WebGL bgColor — no flash before first frame */
  overflow: hidden;
  display: flex;
  align-items: center;
}

/* ── Triangle grid — ghost texture layer ── */
.hero__grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: calc(50% + 200px) center;
  pointer-events: none;
  z-index: 1;
  opacity: 0.06;
  mix-blend-mode: multiply;
  -webkit-mask-image: linear-gradient(to left, black 40%, transparent 60%);
  mask-image: linear-gradient(to left, black 40%, transparent 60%);
}

/* Above 1200px, freeze the grid scale by capping the element width and
   anchoring it to the right — triangle size stays locked to its 1200px appearance. */
@media (min-width: 1200px) {
  .hero__grid {
    inset: 0 0 0 auto;
    width: 1200px;
    height: 100%;
  }
}

/* ── Text — in flow, z-index above canvas ── */
.hero__inner {
  position: relative;
  z-index: 2;   /* text always above blobs + canvas */
  width: 100%;
  /*
   * Wider than the regular --width-full so "Experiences for Humans,"
   * fits on one line. Text column is ~62% of this = ~870px at max.
   */
  max-width: 1440px;
  margin-inline: auto;
  padding-inline: var(--space-12);
  padding-block: var(--space-16) var(--space-12);
}

.hero__text {
  /*
   * clamp: never narrower than 480px, prefer 62vw,
   * cap at 870px so the headline fits without wrapping.
   */
  width: clamp(480px, 62%, 40vw);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.hero__headline {
  font-size: clamp(2.5rem, 4.2vw, 3.125rem); /* max 50px */
  font-weight: var(--weight-bold);
  line-height: 1.0;
  letter-spacing: -0.02em;
  color: #050f1c;
}

.hero__tagline {
  font-size: clamp(1rem, 1.8vw, 1.875rem); /* max 30px */
  font-weight: 300;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  line-height: 1.2;
  color: #050f1c;
  margin-top: calc(var(--space-6) * -0.5);
}

.hero__sub {
  font-size: var(--text-body); /* 18px */
  font-weight: var(--weight-medium);
  line-height: 1.6;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.hero__sub em {
  font-style: italic;
}

/* Button — layout overrides only; visuals come from .btn.btn--cta */
.hero__cta {
  gap: var(--space-3);
  margin-top: var(--space-2);
  width: fit-content;
}
.hero__cta-arrow {
  display: inline-block;
  transition: transform var(--duration-base) var(--ease-out);
}
.hero__cta:hover .hero__cta-arrow { transform: translateY(3px); }

/* Fade div — hidden on desktop, used only for mobile stacked layout */
.hero__fade { display: none; }

@media (max-width: 1200px) {
  .hero__text {
    width: clamp(400px, 58vw, 600px);
  }
}

/* ── Mobile ── */
@media (max-width: 768px) {
  /* Stack: text on top, canvas reveals below */
  .hero {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-height: calc(88svh - 450px);
  }

  /* Text zone: solid bg full-width, fades to transparent at the bottom
     so the canvas dissolves in naturally below the button. */
  .hero__inner {
    position: relative;
    z-index: 2;
    background: linear-gradient(172deg, #F4F5F4 55%, transparent 82%);
    padding-inline: var(--gutter);
    padding-block: var(--space-8) var(--space-8);
  }

  .hero__fade { display: none; }

  .hero__text    { width: 100%; }
  .hero__headline { font-size: 2.1rem; }
  .hero__sub      { font-size: 1rem; }
}

/* ============================================================
   LOGO BAR
   ============================================================ */

.logo-bar {
  position: relative;
  z-index: 1;
  background-color: var(--color-neutral-0);
  padding-block: calc(var(--space-16) + 10px);
}

.logo-bar__inner {
  position: relative;   /* anchor for the absolute label */
  max-width: var(--width-full);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.logo-bar__label {
  position: absolute;
  top: calc(-1 * var(--space-10));  /* floats above the logo row, inside the section padding */
  left: var(--gutter);              /* aligns with the first logo */
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 0;
}

.logo-bar__logos {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: space-between;
}

.logo-bar__logo {
  height: 32px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
  filter: grayscale(1);
  opacity: 0.5;
  transition: opacity var(--duration-base) var(--ease-out),
              filter var(--duration-base) var(--ease-out);
}
.logo-bar__logo:hover { filter: grayscale(0); opacity: 1; }
.logo-bar__logo--small { height: 22px; }

@media (max-width: 900px) {
  .logo-bar__logos {
    gap: var(--space-6);
  }
  .logo-bar__logo {
    max-width: 120px;
  }
}

@media (max-width: 768px) {
  .logo-bar__logo--small {
    display: none;
  }
}

@media (max-width: 600px) {
  .logo-bar {
    padding-block: calc(var(--space-16) + 10px - 40px); /* clip 40px top/bottom */
  }

  .logo-bar__label {
    position: static;
    margin-bottom: var(--space-6);
    text-align: center;
  }

  .logo-bar__logos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px var(--space-6);
    justify-items: center;
    align-items: center;
  }

  .logo-bar__logo {
    height: 28px;
    max-width: 130px;
  }

  .logo-bar__logo--small {
    display: none;
  }
}

/* ============================================================
   WORK SECTION — alternating case study rows
   ============================================================ */

.work-section {
  position: relative;
  overflow: clip;
  background-color: var(--color-bg);
  padding-block: var(--space-10) var(--space-16);
}

/* ── Decorative triangle grid corners ── */
/* Containers: flex-centered so the rotated image stays centered within them.
   overflow:clip keeps rotated overflow inside the container box.
   Sizing and positions are derived from the Figma layout (1440px frame). */
.tri-dec {
  position: absolute;
  pointer-events: none;
  user-select: none;
  opacity: 0.10;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: clip;
}

.tri-dec img {
  flex-shrink: 0;
}

/* Top-left — large rotated grid, mostly above/left of the section, barely peeking in */
.tri-dec--tl {
  top: -580px;
  left: -390px;
  width: 961px;
  height: 990px;
}
.tri-dec--tl img {
  width: 567px;
  height: 818px;
  transform: rotate(40.3deg);
}

/* Mid-right — tall narrow grid, bleeds off the right edge */
.tri-dec--mr {
  top: 600px;
  right: -345px;
  width: 490px;
  height: 1327px;
}
.tri-dec--mr img {
  width: 375px;
  height: 1299px;
}

/* Bottom — wide horizontal grid spanning full width near section end */
.tri-dec--bl {
  bottom: -350px;
  left: -70px;
  width: 1509px;
  height: 463px;
}
.tri-dec--bl img {
  width: 1501px;
  height: 433px;
  transform: rotate(0.4deg);
}

@media (max-width: 600px) {
  .tri-dec { display: none; }
}

@media (max-width: 800px) {
  .tri-dec--mr { display: none; }
}

.work-section__inner {
  position: relative;
  z-index: 1;
  max-width: var(--width-full);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.work-section__header {
  margin-bottom: calc(var(--space-10) - var(--space-12)); /* -8px: cancels excess cs-row top padding so above/below match */
}

.work-section__title {
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  padding-top: var(--space-5); /* ~20px above the heading */
}

/* ── Case study rows — alternating image/text layout ── */
.cs-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cs-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-16);
  align-items: center;
  padding-block: var(--space-12);
}

/* Alternate: push image to the right */
.cs-row--reverse .cs-row__image { order: 2; }
.cs-row--reverse .cs-row__text  { order: 1; }

/* Image container */
.cs-row__image {
  position: relative;
  background-color: transparent;
  border: none;
  aspect-ratio: 3 / 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cs-row__image a {
  display: block;
  width: 100%;
  height: 100%;
}

.cs-row__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 30px rgba(0,0,0,0.20);
}

/* Text column */
.cs-row__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.cs-row__eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-text-muted);
  line-height: 1.3;
}

.cs-row__eyebrow-sep {
  color: var(--color-green);
  font-size: 0.5625rem;
  line-height: 1;
}

.cs-row__title {
  font-weight: var(--weight-medium);
  line-height: 1.1;
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}

.cs-row__desc {
  font-size: var(--text-body);
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
  max-width: 42ch;
}

/* Layout overrides only; visuals come from .btn.btn--cta */
.cs-row__cta {
  margin-top: var(--space-4);
  width: fit-content;
}

@media (max-width: 768px) {
  .work-section { padding-block-start: 30px; }
  .work-section__header { margin-bottom: var(--space-2); }
}

/* Mobile: eyebrow+title → image → desc+cta */
@media (max-width: 600px) {
  .cs-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-4);
    padding-block: var(--space-8);
  }

  /* Dissolve the text wrapper so its children join the flex flow */
  .cs-row__text { display: contents; }

  /* Slot each piece into the desired order — override reverse-row desktop rules */
  .cs-row__eyebrow,
  .cs-row--reverse .cs-row__eyebrow { order: 1; line-height: 1.3; }
  .cs-row__title,
  .cs-row--reverse .cs-row__title   { order: 2; margin-top: -4px; text-align: left; line-height: 1.0; }
  .cs-row__image,
  .cs-row--reverse .cs-row__image   { order: 3; margin-block: 10px; }
  .cs-row__desc,
  .cs-row--reverse .cs-row__desc    { order: 4; text-align: left; }
  .cs-row__cta,
  .cs-row--reverse .cs-row__cta     { order: 5; width: 100%; justify-content: center; font-size: var(--text-sm); }

  /* Extra breathing room between case study rows */
  .cs-row + .cs-row,
  .cs-row + .testimonial-pair + .cs-row { margin-block-start: var(--space-12); }
}

/* ── Testimonials ── */
.testimonial-pair {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-block: 0;
}

.testimonial {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: var(--space-8);
  padding-block: var(--space-12);
  width: 80%;
}

/* Flip avatar to the right and right-align */
.testimonial--reverse {
  flex-direction: row-reverse;
  align-self: flex-end;
}


.testimonial-divider {
  border: none;
  margin: 0;
}

.testimonial__avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  flex-shrink: 0;
  background-color: var(--color-surface);
  overflow: hidden;
  /* When a photo is added: <img src="..." alt="..."> inside this div */
}

.testimonial__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.testimonial__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  /* Vertically center content against the avatar */
  align-self: center;
}

.testimonial__quote {
  font-size: clamp(1.375rem, 2.2vw, 2.125rem);
  font-weight: var(--weight-bold);
  font-style: italic;
  letter-spacing: -0.045em;
  line-height: 1.31;
  color: var(--color-text);
  margin: 0;
  text-indent: -0.55em; /* hang opening curly quote — only indents first line */
}

/* Decorative curly quotes in brand green */
.testimonial__quote::before {
  content: '\201C';
  color: var(--color-green);
  font-style: normal;
  margin-right: 0.05em;
}

.testimonial__quote::after {
  content: '\201D';
  color: var(--color-green);
  font-style: normal;
  margin-left: 0.03em;
}

.testimonial__author {
  display: flex;
  align-items: center;
  column-gap: var(--space-3);
  row-gap: var(--space-1);
  flex-wrap: wrap;
}

.testimonial__name {
  font-size: clamp(1rem, 1.5vw, 1.44rem);
  font-weight: var(--weight-medium);
  letter-spacing: -0.01em;
  color: var(--color-text);
  font-style: normal;
}

/* Small green triangle separator between name and role */
.testimonial__separator {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 12px solid var(--color-green);
  flex-shrink: 0;
}

.testimonial__role {
  font-size: clamp(0.8125rem, 1.1vw, 1.125rem);
  font-weight: var(--weight-medium);
  letter-spacing: 0.073em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  line-height: 1.2;
}

@media (max-width: 1200px) {
  .testimonial__content { gap: var(--space-2); } /* -12px vs default 20px */
}

@media (max-width: 768px) {
  .testimonial-pair { padding-block: 24px; }

  /* Full-width, left-aligned; grid layout: quote spans top, avatar+byline on bottom row */
  .testimonial,
  .testimonial--reverse {
    display: grid;
    grid-template-areas:
      "quote  quote"
      "avatar byline";
    grid-template-columns: 48px 1fr;
    grid-template-rows: auto auto;
    gap: var(--space-4) var(--space-3);
    width: 100%;
    align-self: auto;
    text-align: left;
  }

  /* Dissolve content wrapper so quote and author become direct grid children */
  .testimonial__content { display: contents; }

  .testimonial__quote  { grid-area: quote; font-size: 1.375rem; text-indent: 0; }
  .testimonial__avatar { grid-area: avatar; width: 48px; height: 48px; align-self: center; }
  .testimonial__author { grid-area: byline; flex-direction: column; align-items: flex-start; gap: 2px; align-self: center; }
  .testimonial__separator { display: none; }
  .testimonial__name     { font-size: var(--text-base); }
  .testimonial__role     { font-size: var(--text-xs); }
}

/* ============================================================
   UI DESIGN TEASER
   ============================================================ */

.ui-teaser {
  background-color: var(--color-neutral-0);
  border-top: var(--border-thin);
  padding-block: var(--space-20);
}

.ui-teaser__inner {
  max-width: var(--width-full);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-16);
  align-items: center;
}

.ui-teaser__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.ui-teaser__eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.ui-teaser__headline {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-snug);
}

.ui-teaser__desc {
  font-size: var(--text-md);
  color: var(--color-text-muted);
  line-height: var(--leading-normal);
  max-width: 40ch;
}

/* 2×2 preview mosaic */
.ui-teaser__preview {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: var(--space-3);
  aspect-ratio: 1.1;
}

.ui-teaser__tile {
  border-radius: var(--radius-lg);
  background-color: var(--color-neutral-100);
  overflow: hidden;
}
.ui-teaser__tile:nth-child(1) { background-color: var(--color-green-light); }
.ui-teaser__tile:nth-child(2) { background-color: #E4E9EF; }
.ui-teaser__tile:nth-child(3) { background-color: #F0EAE4; }
.ui-teaser__tile:nth-child(4) { background-color: var(--color-neutral-200); }
.ui-teaser__tile img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 768px) {
  .ui-teaser__inner { grid-template-columns: 1fr; }
  .ui-teaser__preview { display: none; }
}
