/*
  Continental Media — "Nosotros" teaser block styles.
  Namespaced under .cm-about. Depends on assets/css/tokens.css.
*/

.cm-about {
  position: relative;
  z-index: 30; /* same reasoning as .cm-clients: sits after the hero in
                  normal flow and must stay opaque above its sticky video */
  background: var(--cm-color-bg);
  color: var(--cm-color-fg);
  padding-block: clamp(4.5rem, 11vh, 7.5rem);
  overflow: hidden;
  font-size: 0.9375rem; /* base for unsized wrappers, see hero.css's .cm-hero for why */
}

.cm-about__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: clamp(3rem, 6vw, 6rem);
  max-width: 1280px;
  margin: 0 auto;
  padding-inline: var(--cm-gutter);
}

/* ---------- Text column ---------- */

.cm-about__text {
  max-width: 34rem;
}

.cm-about__eyebrow {
  display: block;
  font-family: var(--cm-font-body);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  /* 0.5 alpha clears normal-text AA at ~5.3:1 on this near-black ground */
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.9em;
}

.cm-about__title {
  margin: 0;
  font-family: var(--cm-font-display);
  font-weight: 700;
  font-size: clamp(2rem, 1.3rem + 2.2vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.cm-about__body {
  margin: 1.1em 0 0;
  font-family: var(--cm-font-body);
  font-weight: 400;
  font-size: clamp(1rem, 0.93rem + 0.3vw, 1.125rem);
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.75);
  max-width: 42ch;
}

.cm-about__chips {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.cm-about__chip {
  font-family: var(--cm-font-body);
  font-weight: 500;
  /* Reuses the site's existing 12px micro-label size (see hero/clients-marquee
     eyebrows) instead of a new in-between size, keeping the type scale's steps
     wide enough to read as intentional hierarchy rather than noise. */
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--cm-radius-sm);
  padding: 0.5em 0.85em;
  white-space: nowrap;
}

.cm-about__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2.25rem;
  font-family: var(--cm-font-body);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  border-radius: var(--cm-radius-sm);
  padding: 0.95em 1.75em;
  cursor: pointer;
  border: 1.5px solid var(--cm-color-accent);
  background: var(--cm-color-accent);
  color: var(--cm-color-on-accent);
  transition:
    background-color var(--cm-duration-fast) var(--cm-ease-out),
    border-color var(--cm-duration-fast) var(--cm-ease-out),
    transform var(--cm-duration-fast) var(--cm-ease-out);
}

.cm-about__cta:hover {
  background: var(--cm-color-accent-hover);
  border-color: var(--cm-color-accent-hover);
}

.cm-about__cta:active {
  transform: translateY(1px);
}

.cm-about__cta:focus-visible {
  outline: 2px solid var(--cm-color-fg);
  outline-offset: 3px;
}

/* ---------- Photo grid ---------- */

.cm-about__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.75rem, 1.6vw, 1.25rem);
}

/* All 9 source photos are pre-processed (see the pipeline note in
   about-teaser.html's PLACEHOLDER comment) to the same square crop and
   face zoom before export, so a plain 1:1 tile + object-fit:cover is
   enough to keep the wall visually uniform — no per-card cropping logic
   needed here. */
.cm-about__photo {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--cm-radius-sm);
  background: var(--cm-black);
  isolation: isolate;
  transition:
    transform var(--cm-duration-base) var(--cm-ease-out),
    opacity var(--cm-duration-base) var(--cm-ease-out),
    filter var(--cm-duration-base) var(--cm-ease-out),
    box-shadow var(--cm-duration-base) var(--cm-ease-out);
}

.cm-about__photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition:
    transform var(--cm-duration-slow) var(--cm-ease-out),
    opacity var(--cm-duration-base) var(--cm-ease-out);
}

.cm-about__photo.is-loaded img {
  opacity: 1;
}

/* Skeleton placeholder: a photo's own <img loading="lazy"> only starts
   fetching once it nears the viewport — right around the same moment
   the scroll entrance below reveals the card — so without this there's
   a beat where the tile just shows flat black. A quiet shimmer sweep
   signals "loading", not "broken"; about-teaser.js adds .is-loaded per
   <img> (on load, on error, and immediately if already cached/complete)
   to fade it out and reveal the photo. */
.cm-about__photo::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  /* A steady base tint keeps the tile reading as "loading" even between
     sweep passes; the gradient layered on top is what actually moves. */
  background-color: rgba(255, 255, 255, 0.06);
  background-image: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0.02) 0%,
    rgba(255, 255, 255, 0.16) 45%,
    rgba(255, 255, 255, 0.02) 90%
  );
  background-size: 200% 100%;
  animation: cm-about-skeleton-sweep 1.6s ease-in-out infinite;
  opacity: 1;
  transition: opacity var(--cm-duration-fast) var(--cm-ease-out);
}

.cm-about__photo.is-loaded::before {
  opacity: 0;
  animation-play-state: paused;
}

@keyframes cm-about-skeleton-sweep {
  0% {
    background-position: 150% 0;
  }
  100% {
    background-position: -50% 0;
  }
}

/* "Spotlight", desktop/mouse: the whole wall dims and desaturates slightly
   the moment the pointer enters the grid, and the one card under the
   cursor lifts back to full color/scale with a brand-blue focus ring — a
   group interaction (not a single-card tooltip) that reads as "this is a
   real team, look closer" without needing any name/role text. */
@media (hover: hover) and (pointer: fine) {
  .cm-about__grid:hover .cm-about__photo:not(:hover) {
    opacity: 0.55;
    filter: saturate(0.55);
    transform: scale(0.97);
  }

  .cm-about__photo:hover {
    transform: scale(1.045);
    box-shadow:
      0 0 0 2px var(--cm-color-accent),
      0 24px 44px -16px rgba(0, 0, 0, 0.6);
    z-index: 2;
  }

  .cm-about__photo:hover img {
    transform: scale(1.08);
  }
}

/* Touch equivalent: no cursor to spotlight around, so about-teaser.js
   toggles the same visual states on tap instead — .has-active on the grid
   dims every photo except the tapped one, which gets .is-active. Same
   states, same transitions, just driven by a class instead of :hover so
   the effect isn't limited to desktop/mouse. */
.cm-about__grid.has-active .cm-about__photo:not(.is-active) {
  opacity: 0.55;
  filter: saturate(0.55);
  transform: scale(0.97);
}

.cm-about__photo.is-active {
  transform: scale(1.045);
  box-shadow:
    0 0 0 2px var(--cm-color-accent),
    0 24px 44px -16px rgba(0, 0, 0, 0.6);
  z-index: 2;
}

.cm-about__photo.is-active img {
  transform: scale(1.08);
}

/* ---------- Scroll-triggered entrance ---------- */

.cm-about [data-cm-about-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity var(--cm-duration-slow) var(--cm-ease-out),
    transform var(--cm-duration-slow) var(--cm-ease-out);
}

.cm-about__photo {
  opacity: 0;
  transform: scale(0.94);
  transition:
    opacity var(--cm-duration-base) var(--cm-ease-out),
    transform var(--cm-duration-base) var(--cm-ease-out);
}

.cm-about.is-visible [data-cm-about-reveal] {
  opacity: 1;
  transform: translateY(0);
}

.cm-about.is-visible .cm-about__photo {
  opacity: 1;
  transform: scale(1);
}

/* ~90ms stagger, reading order = DOM order = the order specified in the brief */
.cm-about.is-visible .cm-about__photo:nth-child(1) { transition-delay: 0ms; }
.cm-about.is-visible .cm-about__photo:nth-child(2) { transition-delay: 90ms; }
.cm-about.is-visible .cm-about__photo:nth-child(3) { transition-delay: 180ms; }
.cm-about.is-visible .cm-about__photo:nth-child(4) { transition-delay: 270ms; }
.cm-about.is-visible .cm-about__photo:nth-child(5) { transition-delay: 360ms; }
.cm-about.is-visible .cm-about__photo:nth-child(6) { transition-delay: 450ms; }
.cm-about.is-visible .cm-about__photo:nth-child(7) { transition-delay: 540ms; }
.cm-about.is-visible .cm-about__photo:nth-child(8) { transition-delay: 630ms; }
.cm-about.is-visible .cm-about__photo:nth-child(9) { transition-delay: 720ms; }

@media (prefers-reduced-motion: reduce) {
  .cm-about [data-cm-about-reveal],
  .cm-about__photo {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .cm-about__photo img {
    transition: none;
  }

  .cm-about__photo::before {
    animation: none;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .cm-about__inner {
    grid-template-columns: 1fr;
    gap: clamp(2.5rem, 8vh, 3.5rem);
  }

  .cm-about__text {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .cm-about {
    padding-block: clamp(3.5rem, 10vh, 5rem);
  }

  .cm-about__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Mobile shows a 4x2 grid (8 photos) instead of all 9 — drops just the
     last one so nothing is orphaned into a lopsided last row. Desktop
     keeps the full 3x3. */
  .cm-about__photo:nth-child(9) {
    display: none;
  }

  .cm-about__title {
    text-wrap: balance;
  }
}
