/* ============================================================
   TIERS MATCH — flip "match" cards
   (welcome.html + program.html · inside #tiers-match)

   In-place 3D flip. FRONT = self-recognition statement + toggle.
   BACK = tier title + themes in focus (info only, no button).

   Front face 3-zone layout:
     cover  — .cards-flip__cover  (fixed-height tier image)
     text   — .cards-flip__statement (fills remaining space)
     button — .cards-flip__toggle (natural height, pinned bottom)

   Equal-height cards via grid stretch + flex.
   Reuses existing tokens only — no new colours.
   Honors prefers-reduced-motion (instant flip).
   Class prefix .cards-flip__* — deliberately separate from
   .tier-card__* so the two systems never collide.
   ============================================================ */

/* Intro note under the lead */
.match-note {
  max-width: 62ch;
  margin: var(--space-xs) auto var(--space-m);
  text-align: center;
  font-family: var(--ff-base);
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--color-softblue);
}

/* Grid: 1 col mobile, 3 cols tablet+ — equal-height rows */
.match-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-s);
  margin: var(--space-s) auto 0;
  max-width: 460px;
}
@media (min-width: 700px) {
  .match-cards {
    grid-template-columns: repeat(3, 1fr);
    max-width: var(--container-max);
    align-items: stretch;
  }
}

/* The flip frame — equal height across the row */
.cards-flip {
  position: relative;
  min-height: 380px;
  height: 100%;
  perspective: 1400px;
}

.cards-flip__inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.4, 0.15, 0.2, 1);
}
.cards-flip.is-flipped .cards-flip__inner { transform: rotateY(180deg); }

/* Both faces stack in the same box; only one shows at a time */
.cards-flip__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border: 2px solid var(--color-bridge);
  border-radius: 10px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--color-bridge) 40%, transparent), color-mix(in srgb, var(--color-bridge) 20%, transparent), transparent);
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}


.highlight-cards-flip-face {
  display: inline-block;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  background:
    linear-gradient(
      to right,
      transparent 0%,
      transparent 15%,
      rgba(255, 184, 0, 0.0) 15%,
      rgba(90, 110, 76, 0.2) 40%,
      rgba(90, 110, 76, 0.3) 60%,
      rgba(90, 110, 76, 0.0) 100%
    );
}

/*
.highlight-pink-sage {
  display: inline-block;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  background:
    linear-gradient(
      to bottom,
      transparent 0%,
      transparent 25%,
      rgba(226, 226, 225) 55%,
      rgba(255, 255, 255, 0.2) 80%
    ),
    linear-gradient(
      to right,
      transparent 0%,
      transparent 15%,
      rgba(255, 184, 0, 0.0) 15%,
      rgba(199, 195, 183, 0.3) 40%,
      rgba(65, 83, 53, 0.4) 70%,
      rgba(255, 184, 0, 0.0) 100%
    );
}
*/

/* ===========================================================
   FRONT FACE — fixed 3-zone split:  image 45% · text 40% · button 15%
   The face is absolutely positioned to fill the card frame, which has a
   definite height (grid-stretch + min-height), so these flex-basis
   percentages always resolve. Zones never move: a long statement clips
   inside its 40% band instead of shoving the button off the bottom.
   =========================================================== */
.cards-flip__face--front {
  justify-content: flex-start;
  padding: 0;
}

/* zone 1 — cover image (top 45%) */
.cards-flip__cover {
  position: relative;
  flex: 0 0 45%;
  width: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Per-tier cover images */
.cards-flip[data-tier="ready"]  .cards-flip__cover { background-image: url('../images/content/tier-fit-cover-1.webp'); }
.cards-flip[data-tier="steady"] .cards-flip__cover { background-image: url('../images/content/tier-fit-cover-2.webp'); }
.cards-flip[data-tier="go"]     .cards-flip__cover { background-image: url('../images/content/tier-fit-cover-3.webp'); }

/* Angled glass gradient over the photo — same angle/stops as the face,
   so the gradient reads as one continuous sweep across the whole card. */
.cards-flip__cover::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, color-mix(in srgb, var(--color-bridge) 40%, transparent), color-mix(in srgb, var(--color-bridge) 20%, transparent), transparent);
}

/* zone 2 — statement (middle 40%): the <p> is the flex CENTERING box,
   with a single inner <span> holding the sentence so inline pieces
   (e.g. .highlight) never become separate flex items / columns. */
.cards-flip__statement {
  flex: 0 1 40%;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: var(--space-xs) var(--space-s);
  overflow: hidden;
}
.cards-flip__statement-text {
  font-family: var(--ff-base);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--color-text);
  text-align: center;
}

/* zone 3 — flip button (bottom 15%) */
.cards-flip__toggle {
  flex: 0 0 15%;
  width: 100%;
  min-height: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: var(--space-xs) var(--space-s);
  border: none;
  cursor: pointer;
  font-family: var(--ff-accent);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-white);
  background: var(--color-bridge-old);
  transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
}
.cards-flip__toggle::after { content: '\21BB'; font-size: 0.95rem; line-height: 1; }
.cards-flip__toggle:hover { transform: translateY(-2px); }


/* ===========================================================
   BACK FACE — tighter margins when flipped
   =========================================================== */
.cards-flip__face--back {
  transform: rotateY(180deg);
  justify-content: center;
  gap: var(--space-xxs);
  padding: var(--space-xxs) var(--space-s);
  background: linear-gradient(to right, rgba(255,255,255,0.40), rgba(255,255,255,0.60), rgba(255,255,255,0.88));
}

.cards-flip__badge {
  font-family: var(--ff-accent);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-lila);
  margin: 0;
  line-height: 1;
}
.cards-flip__name {
  font-family: var(--ff-heading);
  font-size: var(--fs-h3);
  color: var(--color-vividblue);
  line-height: 1.15;
  margin: 0 0 var(--space-xxs);
}
.cards-flip__themes-label {
  font-family: var(--ff-accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-bridge-old);
  margin: 0;
  line-height: 1;
}
.cards-flip__theme {
  font-family: var(--ff-heading);
  font-size: var(--fs-body);
  color: var(--color-blue);
  line-height: 1.25;
  margin: 0;
}
.cards-flip__question {
  font-family: var(--ff-heading);
  font-size: var(--fs-body);
  color: var(--color-softblue);
  line-height: 1.3;
  margin: 0;
}
.cards-flip__back-toggle {
  width: 1.9rem;
  height: 1.9rem;
  margin-top: var(--space-xxs);
  border-radius: 50%;
  border: 1.5px solid var(--color-bridge);
  background: rgba(255, 255, 255, 0.85);
  color: var(--color-blue);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.cards-flip__back-toggle:hover {
  background: #fff;
  transform: translateY(-2px);
}

/* Keyboard focus visibility */
.cards-flip__toggle:focus-visible,
.cards-flip__back-toggle:focus-visible {
  outline: 2px solid var(--color-blue);
  outline-offset: 2px;
}

/* Reduced motion: instant flip */
@media (prefers-reduced-motion: reduce) {
  .cards-flip__inner { transition: none; }
}

/* ===========================================================
   RESPONSIVE
   =========================================================== */

/* Mobile */
@media (max-width: 699px) {
  .cards-flip { min-height: 400px; }
}

/* Tablet (iPad Mini / Air / Pro portrait) … */
@media (min-width: 700px) and (max-width: 1024px) {
  .cards-flip { min-height: 460px; }
}