/* ============================================
   GROWTH & DEVELOPMENT — Flip cards
   Replaces the accordion in #cr-growth.
   Hover: blur the front image. Click: flip the card on Y.
   ============================================ */

.cr-growth-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(24px, 2.4vw, 40px);
    margin: clamp(40px, 5vw, 72px) auto 0;
    max-width: 82%;
    perspective: 1600px;
}

@media (max-width: 1100px) {
    .cr-growth-cards { max-width: 100%; }
}

@media (max-width: 640px) {
    .cr-growth-cards { max-width: 100%; }
}

@media (max-width: 1100px) {
    .cr-growth-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .cr-growth-cards { grid-template-columns: 1fr; }
}

/* Card shell — matches the indicator-pill family elsewhere on the site.
   display:block + width:100% override the user-agent inline-block on <button>
   so the card fills its grid cell and aspect-ratio resolves to a real height. */
.cr-growth-card {
    display: block;
    width: 100%;
    position: relative;
    aspect-ratio: 3 / 4;
    background: transparent;
    border: 0;
    padding: 0;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: left;
    outline: none;
}

.cr-growth-card:focus-visible {
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.4);
}

/* The 3D inner that flips.
   display:block is critical — the element is a <span> (button-children-must-be-
   phrasing-content), and inline spans ignore width/height. */
.cr-growth-card__inner {
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 720ms cubic-bezier(0.4, 0, 0.1, 1);
    border-radius: 8px;
    box-shadow: 0 22px 50px -28px rgba(0, 0, 0, 0.22),
                0 2px 6px rgba(0, 0, 0, 0.04);
}

.cr-growth-card[aria-expanded="true"] .cr-growth-card__inner {
    transform: rotateY(180deg);
}

/* Each face fills the card and hides its own back when rotated away. */
.cr-growth-card__face {
    position: absolute;
    inset: 0;
    border-radius: 8px;
    overflow: hidden;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border: 0.5px solid #d8d8d4;
}

/* ---- FRONT ---- */
.cr-growth-card__face--front {
    background: var(--color-pure-white);
}

.cr-growth-card__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 420ms cubic-bezier(0.4, 0, 0.1, 1),
                transform 720ms cubic-bezier(0.4, 0, 0.1, 1);
}

.cr-growth-card:hover .cr-growth-card__image {
    filter: blur(8px) brightness(0.9);
    transform: scale(1.04);
}

/* Bottom gradient so the title is always legible against the photo. */
.cr-growth-card__face--front::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 55%;
    background: linear-gradient(180deg,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.55) 70%,
        rgba(0, 0, 0, 0.78) 100%);
    pointer-events: none;
}

.cr-growth-card__overlay {
    position: absolute;
    left: clamp(20px, 2vw, 28px);
    right: clamp(64px, 6vw, 88px);
    bottom: clamp(20px, 2vw, 28px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2;
}

.cr-growth-card__eyebrow {
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.85);
}

.cr-growth-card__title {
    font-family: var(--font-body);
    font-size: clamp(1.15rem, 1.6vw, 1.5rem);
    font-weight: var(--font-bold);
    line-height: 1.15;
    letter-spacing: var(--tracking-tight);
    color: var(--color-pure-white);
}

/* The +/× toggle pill in the bottom-right. */
.cr-growth-card__toggle {
    position: absolute;
    right: clamp(16px, 1.6vw, 22px);
    bottom: clamp(16px, 1.6vw, 22px);
    width: clamp(36px, 3vw, 44px);
    height: clamp(36px, 3vw, 44px);
    border-radius: 50%;
    background: var(--color-pure-white);
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    z-index: 3;
    transition: background 220ms cubic-bezier(0.4, 0, 0.1, 1),
                color 220ms cubic-bezier(0.4, 0, 0.1, 1),
                transform 520ms cubic-bezier(0.4, 0, 0.1, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.cr-growth-card[aria-expanded="true"] .cr-growth-card__toggle--front {
    transform: rotate(45deg);
}

/* ---- BACK ----
   Same image as the front, heavily blurred, with a frosted-glass overlay so
   the dark text reads cleanly on top. */
.cr-growth-card__face--back {
    transform: rotateY(180deg);
    background: var(--color-pure-white);
    padding: clamp(24px, 2.5vw, 36px);
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 1.5vw, 18px);
}

.cr-growth-card__back-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(18px);
    transform: scale(1.1); /* hide blur edge gaps */
    z-index: 0;
    pointer-events: none;
}

/* Slight dark tint over the blur for white-text legibility. */
.cr-growth-card__face--back::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.28);
    z-index: 1;
    pointer-events: none;
}

.cr-growth-card__back-eyebrow,
.cr-growth-card__back-title,
.cr-growth-card__back-body {
    position: relative;
    z-index: 2;
}

.cr-growth-card__back-eyebrow {
    font-family: var(--font-heading);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-pure-white);
}

.cr-growth-card__back-title {
    font-family: var(--font-body);
    font-size: clamp(1.25rem, 1.8vw, 1.65rem);
    font-weight: var(--font-bold);
    line-height: 1.15;
    letter-spacing: var(--tracking-tight);
    color: var(--color-pure-white);
}

.cr-growth-card__back-body {
    font-family: var(--font-body);
    font-size: clamp(0.9rem, 1.05vw, 1rem);
    font-weight: var(--font-regular);
    line-height: 1.55;
    color: var(--color-pure-white);
    overflow-y: auto;
}

.cr-growth-card__toggle--back {
    color: var(--color-text-primary);
}

.cr-growth-card[aria-expanded="true"] .cr-growth-card__toggle--back {
    transform: rotate(0deg);
}

@media (prefers-reduced-motion: reduce) {
    .cr-growth-card__inner,
    .cr-growth-card__image,
    .cr-growth-card__toggle {
        transition: none;
    }
}
