/* ==========================================================================
   About Us Page Styles
   Banner styles (.cetools-page-banner, --image, __bg, __heading, __subtitle)
   live in page-products.css since they're shared across all inner pages.
   This file owns only About-page-specific layout: story, values, team.
   ========================================================================== */

/* --------------------------------------------------------------------------
   About Page wrapper
   -------------------------------------------------------------------------- */
.cetools-about-page {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Story Section — 50/50 image + text  (Figma: 1795 x 567 fixed)
   -------------------------------------------------------------------------- */
.cetools-about-story {
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 567px;
  margin-top: 120px;
}

/*
 * Story image — converted from Figma 828:3374 imageTransform per
 * PROJECT_CONTEXT.md "STRETCH + Transform → background-size/background-position".
 * Matrix: [[1.0, 0, 0], [0, 0.4224964678287506, 0.1998809576034546]]
 *   Sw = 100/a = 100%
 *   Sh = 100/d = 236.69%
 *   bg-pos-y = -ty*Sh / (Sh - 100) * 100% = -0.1999*236.69 / 136.69 * 100 = 34.62%
 */
.cetools-about-story__image {
  flex: 1 1 50%;
  align-self: stretch;
  min-height: 567px;     /* desktop: parent is 567 fixed; this is a fallback */
  background-image: url("../images/about/compressed/hero.webp");
  background-size: 100% 236.69%;
  background-position: 50% 34.62%;
  background-repeat: no-repeat;
}

.cetools-about-story__content {
  flex: 1 1 50%;
  background-color: #F5F5F5;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 59px 240px 59px 80px;
}

.cetools-about-story__heading {
  font-family: "Semplicita", sans-serif;
  font-size: 26px;
  color: #272727;
  letter-spacing: 5.46px;
  line-height: 30px;
  margin: 0 0 20px;
  text-transform: capitalize;
}

.cetools-about-story__text {
  font-family: "Palatino Linotype", Georgia, serif;
  font-size: 20px;
  color: #272727;
  line-height: 28px;
  margin: 0;
  max-width: 580px;
}

/* --------------------------------------------------------------------------
   Values Section — full-width gray bar with arrow nav
   -------------------------------------------------------------------------- */
.cetools-about-values {
  margin-top: 120px;
  background-color: #F5F5F5;
  padding: 138px 0;       /* Figma: bg 433 - content 157 = 276 ÷ 2 = 138 top/bottom */
}

.cetools-about-values__inner {
  /* Figma content area is exactly 1309px. Add 80px to max-width to account
     for the 40px horizontal padding, so visible content stays at 1309px. */
  max-width: 1389px;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;              /* Figma Frame 1597881929 itemSpacing */
}

.cetools-about-values__heading {
  font-family: "Semplicita", sans-serif;
  font-size: 30px;
  color: #272727;
  letter-spacing: 0;          /* Figma JSON: letterSpacing: 0 */
  line-height: 30px;
  margin: 0;
  text-align: center;
  text-transform: none;
}

.cetools-about-values__carousel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 65px;
  width: 100%;
}

.cetools-about-values__nav {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: #132F6B;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.25s ease, transform 0.25s ease;
  padding: 0;
}

.cetools-about-values__nav:hover {
  background-color: #0c2050;
  transform: scale(1.05);
}

.cetools-about-values__nav:focus-visible {
  outline: 2px solid #132F6B;
  outline-offset: 3px;
}

.cetools-about-values__nav svg {
  display: block;
}

.cetools-about-values__viewport {
  flex: 1 1 auto;
  overflow: hidden;
  max-width: 1103px;
}

.cetools-about-values__track {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

.cetools-about-values__slide {
  flex: 0 0 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 15px;              /* Figma Frame 1597881957 itemSpacing */
  /* No horizontal padding — Figma slide frame is 1103 wide, full bleed */
}

.cetools-about-values__title {
  font-family: "Semplicita", sans-serif;
  font-size: 24px;
  color: #272727;
  letter-spacing: 0;          /* Figma JSON: letterSpacing: 0 */
  line-height: 24px;
  margin: 0;
  text-transform: none;
}

.cetools-about-values__text {
  font-family: "Palatino Linotype", Georgia, serif;
  font-size: 20px;
  color: #272727;
  line-height: 28px;
  margin: 0;
  max-width: 1103px;      /* Figma description bbox width */
}

/* --------------------------------------------------------------------------
   Team Section
   -------------------------------------------------------------------------- */
.cetools-about-team {
  margin: 120px 0;
  padding: 0 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 120px;
}

.cetools-about-team__heading {
  font-family: "Semplicita", sans-serif;
  font-size: 26px;
  color: #272727;
  letter-spacing: 5.46px;
  line-height: 30px;
  margin: 0;
  text-align: center;
  text-transform: capitalize;
}

.cetools-about-team__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 60px;
  width: 100%;
  max-width: 1315px;
}

/* Team Card  (Figma: card 398w / photo 350x350 left-aligned with 8px inset 2px white border) */
.cetools-team-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: flex-start;
}

/*
 * Photo container — 350×350 per Figma. The bg image is painted on a ::before
 * pseudo that's logically 1.4x the box (inset:-20% extends 20% past each edge),
 * then transformed to scale(1/1.4 = 0.7143) so it visually fills the box at
 * exactly 100%.
 *
 * Effect: the browser samples the source at 1.4x density before the GPU
 * downscales the composited surface back. Two-stage downsample produces
 * a softer perceived edge than a single hard bicubic from the original 5MB
 * source straight to 350px. Visible crop / Figma matrix values are unchanged.
 *
 * url() still references the original webp — view-image goes to the source.
 */
.cetools-team-card__photo {
  position: relative;
  width: 87.94%;          /* 350 / 398 (Figma) */
  aspect-ratio: 1 / 1;
  background-color: #EAE8EB;
  overflow: hidden;
}

.cetools-team-card__photo::before {
  content: "";
  position: absolute;
  inset: -20%;            /* logical 140% × 140% supersample surface */
  z-index: 0;
  background-image: var(--photo-image);
  background-size: var(--photo-size);
  background-position: var(--photo-position);
  background-repeat: no-repeat;
  transform: scale(0.7143);  /* 1 / 1.4 — fits supersample surface back to 100% */
  transform-origin: center center;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: smooth;
}

/*
 * Per-photo crops derived from Figma imageTransform matrices in 828:3374 JSON.
 * Sw = 100/a%, Sh = 100/d%, bg-pos = -t/(1-1/scale)*100% (matrix → CSS).
 * STRETCH + Transform → CSS background-size + background-position per PROJECT_CONTEXT.md.
 */
.cetools-team-card__photo--xiaoning {
  --photo-image: url("../images/about/compressed/team-xiaoning.webp");
  --photo-size: 91.66% 137.47%;
  --photo-position: 50.01% 17.39%;
}

.cetools-team-card__photo--yi {
  --photo-image: url("../images/about/compressed/team-yi.webp");
  --photo-size: cover;       /* Figma scaleMode = FILL, no transform */
  --photo-position: center;
}

.cetools-team-card__photo--xue {
  --photo-image: url("../images/about/compressed/team-xue.webp");
  --photo-size: 100% 149.98%;
  --photo-position: 50% 61.46%;
}

.cetools-team-card__photo::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid #FFFFFF;
  pointer-events: none;
  z-index: 1;             /* ensure border sits above the scaled ::before */
}

.cetools-team-card__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.cetools-team-card__name {
  font-family: "Semplicita", sans-serif;
  font-size: 24px;
  color: #272727;
  line-height: 24px;
  margin: 0;
}

.cetools-team-card__role {
  font-family: "Semplicita", sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #272727;
  letter-spacing: 1.32px;
  line-height: 16px;
  margin: 0;
  text-transform: capitalize;
}

.cetools-team-card__name + .cetools-team-card__role {
  margin-top: -8px;       /* Figma: 8px gap between name and role inside the name+role frame */
}

.cetools-team-card__bio {
  font-family: "Palatino Linotype", Georgia, serif;
  font-size: 16px;
  color: #272727;
  line-height: 22px;
  margin: 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1600px) {
  .cetools-about-story__content {
    padding: 50px 120px 50px 60px;
  }
  .cetools-about-team {
    padding: 0 120px;
  }
}

@media (max-width: 1200px) {
  .cetools-about-story {
    height: auto;
    min-height: 460px;
  }
  .cetools-about-story__image {
    min-height: 460px;
  }
  .cetools-about-story__content {
    padding: 50px 60px;
  }
  .cetools-about-values__carousel {
    gap: 30px;
  }
}

@media (max-width: 1024px) {
  /* Hard stop — nothing inside the about page can be wider than the viewport.
     Forces every descendant to honor the viewport bounds and shifts each
     element to border-box so paddings don't push past container width. */
  .cetools-about-page,
  .cetools-about-page *,
  .cetools-about-page *::before,
  .cetools-about-page *::after {
    box-sizing: border-box;
    max-width: 100%;
  }

  .cetools-about-page {
    overflow-x: hidden;
  }

  /* Images can never overflow their container */
  .cetools-about-page img {
    max-width: 100%;
    height: auto;
  }

  /* Stacked story panels: stop relying on `flex: 1 1 50%` on column axis —
     it makes the basis 50% of MAIN axis (= height when stacked) which is
     unpredictable on auto-height parents. Use natural widths. */
  .cetools-about-story__image,
  .cetools-about-story__content {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
  }

  /* Drop the desktop supersample trick on mobile/tablet — at smaller box
     sizes the inset:-20% + scale(0.7143) combo can render unevenly across
     browsers. Render the bg-image directly on the ::before at the photo's
     native bounds instead. The Figma matrix values still apply but now
     against a 100%×100% surface, so the crop matches the desktop look
     exactly without any GPU-scale artefacts. */
  .cetools-team-card__photo::before {
    inset: 0;
    transform: none;
  }

  /* Defensive: any wide-tracked heading wraps instead of overflowing */
  .cetools-about-story__heading,
  .cetools-about-team__heading,
  .cetools-about-values__heading,
  .cetools-about-values__title,
  .cetools-about-values__text,
  .cetools-about-story__text,
  .cetools-team-card__bio,
  .cetools-team-card__name,
  .cetools-team-card__role {
    overflow-wrap: break-word;
    word-wrap: break-word;
  }

  .cetools-page-banner__subtitle {
    max-width: 400px;
    overflow-wrap: break-word;
  }

  .cetools-about-story {
    flex-direction: column;
    height: auto;
    margin-top: 60px;
  }
  .cetools-about-story__image {
    width: 100%;
    min-height: 0;
    aspect-ratio: 894 / 567;       /* exact Figma container ratio */
  }
  .cetools-about-story__content {
    padding: 50px;
  }
  .cetools-about-story__text {
    max-width: none;
  }

  .cetools-about-values {
    margin-top: 60px;
    padding: 60px 0;
  }
  .cetools-about-values__inner {
    padding: 0 50px;
    gap: 30px;
    max-width: 100%;             /* don't force the 1389 desktop cap */
  }

  .cetools-about-team {
    margin: 60px 0;
    padding: 0 50px;
    gap: 60px;
  }
  .cetools-about-team__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 40px;
    max-width: 100%;
  }
  /* When there are exactly 3 cards, drop the lonely third card to its own
     row and center it at single-column width so it visually matches the
     two cards above. */
  .cetools-team-card:nth-child(3):last-child {
    grid-column: 1 / -1;
    max-width: calc((100% - 40px) / 2);   /* same width as a row-1 card */
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 768px) {
  .cetools-page-banner__subtitle {
    font-size: 11px;
    line-height: 15px;
    max-width: 90%;
  }

  .cetools-about-story__content {
    padding: 32px 20px;
  }
  .cetools-about-story__heading {
    font-size: 17px;             /* was 20 — fits on narrow phones */
    letter-spacing: 1.5px;       /* was 4px — wide tracking was the overflow */
    line-height: 22px;
    margin-bottom: 14px;
  }
  .cetools-about-story__text {
    font-size: 15px;
    line-height: 22px;
  }

  .cetools-about-values {
    padding: 44px 0;
  }
  .cetools-about-values__inner {
    padding: 0 20px;
    gap: 22px;
  }
  .cetools-about-values__heading {
    font-size: 22px;
    line-height: 26px;
  }
  .cetools-about-values__carousel {
    gap: 10px;
  }
  .cetools-about-values__nav {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }
  .cetools-about-values__nav svg {
    width: 12px;
    height: 12px;
  }
  .cetools-about-values__title {
    font-size: 18px;
    line-height: 22px;
  }
  .cetools-about-values__text {
    font-size: 15px;
    line-height: 22px;
    max-width: 100%;
  }
  .cetools-about-values__slide {
    padding: 0;
    gap: 10px;
  }

  .cetools-about-team {
    padding: 0 20px;
    gap: 36px;
    margin: 44px 0;
  }
  .cetools-about-team__heading {
    font-size: 17px;             /* was 20 */
    letter-spacing: 1.5px;       /* was 4px */
    line-height: 22px;
  }
  .cetools-about-team__grid {
    grid-template-columns: 1fr;
    gap: 32px;
    max-width: 100%;
  }
  /* Phones: revert the tablet third-card centering rule */
  .cetools-team-card:nth-child(3):last-child {
    grid-column: auto;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
  .cetools-team-card {
    align-items: stretch;        /* on phones, photo + body span full card width */
  }
  .cetools-team-card__photo {
    width: 100%;                 /* was 87.94% (Figma asymmetric) — full bleed reads better on phones */
  }
  .cetools-team-card__name {
    font-size: 20px;
    line-height: 24px;
  }
  .cetools-team-card__bio {
    font-size: 14px;
    line-height: 21px;
  }
}

@media (max-width: 380px) {
  /* Smallest phones — last-resort tightening */
  .cetools-about-story__heading,
  .cetools-about-team__heading {
    font-size: 16px;
    letter-spacing: 1px;
  }
  .cetools-about-values__heading {
    font-size: 20px;
  }
  .cetools-about-values__nav {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }
}
