/* ============================================================
   ATA DALA PRODUCTION — «ANAMORPHOT» (dark, cinematic, red)
   pages/team.css — «Team». A 2.39:1 titre, an intro on how the
   core works, and a catalogue of six personnel records. Each
   record is a row of the crew list: number, big name, role, bio,
   facts and (for the founder) a pull-quote. Cinematic red
   editing-cut on hover; the active record lights, its neighbours
   dim (the A24 model). Ported from the anamorphot reference
   team.css — portraits replaced by a red montage cut, teal
   accent replaced by the Ata Dala brand red. No hardcoded
   colours: tokens only. Load AFTER layout.css.
   ============================================================ */

/* ============================================================
   1. TITRE — a 2.39:1 frame across the width, name on the frame
   ============================================================ */

.team-hero {
  position: relative;
  padding-block: 0 var(--sp-11);
}

/* Slightly darker than a scene: this is the titre, not the film yet */
.team-hero__frame { filter: brightness(0.82); }

.team-hero__cap {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: var(--sp-9);
  z-index: var(--z-content);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  pointer-events: none;
}

.team-hero__title {
  width: var(--measure-wide);
  max-width: 100%;
  font-size: var(--fs-h1);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tr-h1);
  line-height: var(--lh-h1);
  color: var(--c-text);
  text-wrap: balance;
}

/* ============================================================
   2. INTRO — text hugged left, three numbers on the right
   ============================================================ */

.team-intro__text > h2 { margin-bottom: var(--sp-4); }

.team-intro__facts {
  display: grid;
  gap: var(--sp-6);
  align-content: start;
  grid-column: 4 / 5;
  border-left: var(--border);
  padding-left: var(--sp-6);
}

.team-fact {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.team-fact__v {
  font-size: var(--fs-h2);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tr-h2);
  line-height: var(--lh-h2);
  font-variant-numeric: tabular-nums;
  color: var(--c-text);
}

/* ============================================================
   3. RECORDS — the crew catalogue
   ============================================================ */

.team-records {
  position: relative;
  padding-block: 0 var(--sp-12);
}

.team-records__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-6);
  padding-bottom: var(--sp-5);
}

.team-records__hint { color: var(--c-muted); }

/* No cursor, no hover hint */
@media (hover: none) {
  .team-records__hint { display: none; }
}

.crew {
  list-style: none;
  border-top: var(--border);
  width: 100%;
}

.crew__item { border-bottom: var(--border); }

/* ---- Record --------------------------------------------------
   Full-bleed row. Grid: id block (number + name + role) on the
   left, the dossier (bio, facts, quote) on the right.
   -------------------------------------------------------------- */

.rec {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  gap: var(--sp-8) var(--sp-10);
  align-items: start;
  padding-inline: var(--gutter);
  padding-block: var(--sp-9);
  color: var(--c-text);
  isolation: isolate;
}

.rec > * { position: relative; z-index: var(--z-content); }

/* The founder gets a taller, single-column feature layout */
.rec--feature {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-7);
  padding-block: var(--sp-10);
}

/* Rhythm: alternate records reverse the columns */
.rec--flip { grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); }
.rec--flip .rec__id { order: 2; }
.rec--flip .rec__body { order: 1; }

/* ---- A24 dimming model: one record lit at a time ------------ */

.crew:hover .rec__id,
.crew:focus-within .rec__id { color: var(--c-muted); }

.rec:hover .rec__id,
.rec:focus-within .rec__id { color: var(--c-text); }

/* ---- Red montage cut — replaces the reference portrait -------
   A red plate wipes across the record left→right; a hairline
   red edge lands on the leading side. Neighbours stay dark.
   -------------------------------------------------------------- */

.rec__cut {
  position: absolute;
  inset: 0;
  z-index: var(--z-frame);
  pointer-events: none;
  opacity: 0;
  clip-path: inset(0 100% 0 0);
  background:
    linear-gradient(90deg, var(--c-accent-ghost), transparent 62%);
  border-left: 2px solid var(--c-accent);
}

.rec--flip .rec__cut {
  clip-path: inset(0 0 0 100%);
  background: linear-gradient(270deg, var(--c-accent-ghost), transparent 62%);
  border-left: 0;
  border-right: 2px solid var(--c-accent);
}

.rec:hover .rec__cut,
.rec:focus-within .rec__cut {
  opacity: 1;
  clip-path: inset(0);
}

@media not (prefers-reduced-motion: reduce) {
  .rec__cut {
    transition: clip-path var(--d-slow) var(--e-cut),
                opacity var(--d-cut) var(--e-out);
  }
}

/* ---- Id block: number, name, role --------------------------- */

.rec__id {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  min-width: 0;
  transition: color var(--d-fast) var(--e-ease);
}

.rec__no {
  font-size: var(--fs-small);
  font-weight: var(--fw-semi);
  letter-spacing: var(--tr-label);
  line-height: var(--lh-flat);
  text-transform: uppercase;
  color: var(--c-muted);
  font-variant-numeric: tabular-nums;
  transition: color var(--d-fast) var(--e-ease);
}

.rec:hover .rec__no,
.rec:focus-within .rec__no { color: var(--c-accent); }

.rec__name {
  /* Sized to fit the longest surname (Kudaibergenova) inside the narrow
     id column — base.css breaks long words globally, and a name split as
     "Kudaibergen / ova" is never acceptable. */
  font-size: clamp(1.375rem, 2vw, 2.125rem);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tr-display);
  line-height: var(--lh-list);
  color: currentColor;
  text-wrap: balance;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  transition: color var(--d-fast) var(--e-ease);
}

.rec--feature .rec__name { font-size: clamp(1.75rem, 3vw, 3rem); }

.rec:hover .rec__name,
.rec:focus-within .rec__name { color: var(--c-accent); }

.rec__role {
  font-size: var(--fs-small);
  font-weight: var(--fw-semi);
  letter-spacing: var(--tr-label);
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--c-accent-ink);
}

/* ---- Body: bio, facts, quote -------------------------------- */

.rec__body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-7);
  min-width: 0;
}

.rec__bio { max-width: var(--measure); }
.rec__bio > * + * { margin-top: var(--sp-5); }
.rec__bio p { color: var(--c-text); }

/* Facts — a k/v mini-table with hairline rules */
.rec__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(12rem, 100%), 1fr));
  gap: var(--sp-5) var(--sp-7);
  margin: 0;
}

.fact {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: var(--border);
  min-width: 0;
}

.fact__k {
  font-size: var(--fs-small);
  font-weight: var(--fw-semi);
  letter-spacing: var(--tr-label);
  line-height: var(--lh-flat);
  text-transform: uppercase;
  color: var(--c-muted);
}

.fact__v {
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tr-body);
  line-height: 1.35;
  color: var(--c-text);
}

/* Pull-quote (founder) — red rule, large line */
.rec__quote {
  margin: 0;
  border-left: 2px solid var(--c-accent);
  padding-left: var(--sp-6);
}

.rec__quote-text {
  font-size: var(--fs-h3);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tr-h3);
  line-height: 1.3;
  color: var(--c-text);
  text-wrap: balance;
}

.rec--feature .rec__quote-text { font-size: var(--fs-h2); }

.rec__quote-cite {
  display: block;
  margin-top: var(--sp-4);
  font-size: var(--fs-small);
  font-weight: var(--fw-semi);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--c-accent-ink);
  font-style: normal;
}

/* On the feature record the quote leads — full width, larger rule */
.rec--feature .rec__body { gap: var(--sp-8); }
.rec--feature .rec__quote { border-left-width: 3px; padding-left: var(--sp-7); }

/* ============================================================
   4. CLOSER — the closing cut
   ============================================================ */

.team-next__link {
  display: inline-flex;
  align-items: baseline;
  gap: var(--sp-5);
  margin-block: var(--sp-5) var(--sp-6);
  color: var(--c-text);
  transition: color var(--d-fast) var(--e-ease);
}

.team-next__word {
  font-size: var(--fs-list);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tr-display);
  line-height: var(--lh-list);
}

.team-next__arrow {
  font-size: var(--fs-h2);
  line-height: var(--lh-flat);
  color: var(--c-muted);
  transition: transform var(--d-cut) var(--e-out),
              color var(--d-fast) var(--e-ease);
}

.team-next__link:hover,
.team-next__link:focus-visible { color: var(--c-accent); }

.team-next__link:hover .team-next__arrow,
.team-next__link:focus-visible .team-next__arrow {
  color: var(--c-accent);
  transform: translateX(var(--sp-3));
}

.team-next__note { max-width: var(--measure-col); margin-top: var(--sp-2); }

/* ============================================================
   5. RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
  .rec,
  .rec--flip {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--sp-6);
  }
  .rec--flip .rec__id { order: 0; }
  .rec--flip .rec__body { order: 0; }
}

@media (max-width: 900px) {
  .team-intro__facts {
    grid-column: 1 / -1;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    border-left: 0;
    border-top: var(--border);
    padding-left: 0;
    padding-top: var(--sp-6);
    margin-top: var(--sp-6);
  }
}

@media (max-width: 768px) {
  .team-hero { padding-block: 0 var(--sp-10); }

  .team-hero__cap {
    position: static;
    transform: none;
    padding-top: var(--sp-7);
    gap: var(--sp-4);
  }

  .rec,
  .rec--feature { padding-block: var(--sp-8); }
}

@media (max-width: 560px) {
  .team-intro__facts {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: var(--sp-5);
  }
}

/* ============================================================
   6. REDUCED MOTION — interface intact, cuts are instant
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .team-next__arrow { transform: none; }
}

/* ============================================================
   OPTIONAL PORTRAIT — only members with a headshot on file.
   Grayscale to sit inside the dark cinematic tone; lifts to
   colour with a slight push-in on hover/focus. Faces sit high
   in both source frames, so bias the crop to the top.
   ============================================================ */

.rec__portrait {
  margin-top: var(--sp-6);
  width: 100%;
  max-width: 15rem;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--g-frame);
  border: var(--border);
}

.rec--feature .rec__portrait { max-width: 20rem; }
.rec--flip .rec__portrait { margin-left: auto; }

.rec__portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 12%;
  filter: grayscale(1) contrast(1.03);
  transition: filter var(--d-slow) var(--e-out),
              transform var(--d-slow) var(--e-out);
}

.rec:hover .rec__portrait-img,
.rec:focus-within .rec__portrait-img {
  filter: grayscale(0) contrast(1);
  transform: scale(1.03);
}

@media (prefers-reduced-motion: reduce) {
  .rec__portrait-img { transition: none; transform: none; }
}

/* Portrait plate — the honest stand-in for members with no headshot on
   file: initials on the cold frame gradient, same 4:5 slot as a photo, so
   the roster reads as one system instead of "two people have pictures". */
.rec__portrait--plate {
  display: grid;
  place-items: center;
  border: var(--border);
  background: var(--g-frame);
}

.rec__plate {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: var(--fw-semi);
  letter-spacing: var(--tr-label);
  line-height: 1;
  color: var(--c-line-strong);
  transition: color var(--d-slow) var(--e-out);
}

.rec:hover .rec__plate,
.rec:focus-within .rec__plate { color: var(--c-accent); }

@media (prefers-reduced-motion: reduce) {
  .rec__plate { transition: none; }
}
