/**
 * FIFE Approaches — Elementor widget styles.
 *
 * Scoped entirely under .fife-elementor-approaches so this can never
 * collide with the legacy homepage Approaches section markup, which
 * keeps its own separate .ap-flip-card classes and rules in style.css.
 *
 * Base values below intentionally match the legacy .ap-flip-card design
 * exactly; the widget's Elementor style controls only add inline
 * overrides on top when a value is explicitly set.
 */

.fife-elementor-approaches {
    --fife-approaches-columns: 4;
    --fife-approaches-gap: 1.5rem;
    --fife-approaches-card-height: 300px;
}

.fife-elementor-approaches__header {
    max-width: 760px;
    margin: 0 auto 2rem;
    text-align: center;
}

.fife-elementor-approaches__heading {
    margin: 0 0 0.75rem;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.15;
    color: hsl(311, 50%, 37%);
}

.fife-elementor-approaches__description {
    margin: 0;
    font-size: 1.05rem;
    color: #6b6b70;
}

.fife-elementor-approaches__grid {
    display: grid;
    grid-template-columns: repeat(var(--fife-approaches-columns), minmax(0, 1fr));
    gap: var(--fife-approaches-gap);
}

.fife-elementor-approaches__card {
    height: var(--fife-approaches-card-height);
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.fife-elementor-approaches__front,
.fife-elementor-approaches__back {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* FRONT — always visible by default */
.fife-elementor-approaches__front {
    transition: opacity 0.5s ease, transform 0.5s ease;
    opacity: 1;
    transform: rotateY(0deg);
}

.fife-elementor-approaches__front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.fife-elementor-approaches__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0.75) 100%);
}

.fife-elementor-approaches__front-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.25rem;
}

.fife-elementor-approaches__icon {
    width: 2.5rem;
    height: 2.5rem;
    background: hsl(310, 58%, 35%);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    color: #fff;
}

.fife-elementor-approaches__icon svg,
.fife-elementor-approaches__icon img {
    width: 1.2rem;
    height: 1.2rem;
    object-fit: contain;
}

.fife-elementor-approaches__title {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/*
 * Plain front (no image set on the card): renders as a flat icon+title
 * card instead of the photo-with-dark-overlay treatment above, since the
 * default styling assumes a background photo for contrast. Used by pages
 * like Research/Strategic Planning whose flip cards never had a photo.
 */
.fife-elementor-approaches__front--plain {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    border: 1px solid #e5e7eb;
    padding: 2rem;
}

.fife-elementor-approaches__front--plain .fife-elementor-approaches__front-content {
    position: static;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0;
}

.fife-elementor-approaches__front--plain .fife-elementor-approaches__icon {
    width: 3.5rem;
    height: 3.5rem;
    background: rgba(147, 49, 131, 0.1);
    margin-bottom: 1.25rem;
}

.fife-elementor-approaches__front--plain .fife-elementor-approaches__icon svg,
.fife-elementor-approaches__front--plain .fife-elementor-approaches__icon img {
    width: 1.5rem;
    height: 1.5rem;
    color: hsl(310, 58%, 35%);
}

.fife-elementor-approaches__front--plain .fife-elementor-approaches__title {
    color: #1f2937;
    text-shadow: none;
}

/* BACK — hidden by default */
.fife-elementor-approaches__back {
    background: hsl(310, 58%, 35%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    text-align: center;
    opacity: 0;
    transform: rotateY(180deg);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* ON HOVER / FOCUS — show back, hide front */
.fife-elementor-approaches__card:hover .fife-elementor-approaches__front,
.fife-elementor-approaches__card:focus-within .fife-elementor-approaches__front {
    opacity: 0;
    transform: rotateY(-180deg);
}

.fife-elementor-approaches__card:hover .fife-elementor-approaches__back,
.fife-elementor-approaches__card:focus-within .fife-elementor-approaches__back {
    opacity: 1;
    transform: rotateY(0deg);
}

.fife-elementor-approaches__icon-back {
    width: 3.25rem;
    height: 3.25rem;
    background: rgba(255, 255, 255, 0.18);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: #fff;
}

.fife-elementor-approaches__icon-back svg,
.fife-elementor-approaches__icon-back img {
    width: 1.4rem;
    height: 1.4rem;
    object-fit: contain;
}

.fife-elementor-approaches__back-title {
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.75rem;
}

.fife-elementor-approaches__back-description {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    line-height: 1.65;
    margin: 0;
}

.fife-elementor-approaches__button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    padding-bottom: 0.125rem;
    transition: opacity 0.3s ease;
}

.fife-elementor-approaches__button:hover,
.fife-elementor-approaches__button:focus-visible {
    opacity: 0.8;
}

.fife-elementor-approaches__button svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.fife-elementor-approaches__card:focus-visible {
    outline: 2px solid hsl(311, 50%, 37%);
    outline-offset: 2px;
}

/**
 * Column count and card height are fully responsive via the widget's own
 * responsive controls (desktop/tablet/mobile), which set the CSS custom
 * properties above per breakpoint using Elementor's breakpoint system —
 * no manual media queries needed here for those.
 */
@media (max-width: 767px) {
    /* Mobile: tap-to-flip (see approaches.js) instead of hover. */
    .fife-elementor-approaches__card.fife-elementor-approaches__card--flipped .fife-elementor-approaches__front {
        opacity: 0;
        transform: rotateY(-180deg);
    }

    .fife-elementor-approaches__card.fife-elementor-approaches__card--flipped .fife-elementor-approaches__back {
        opacity: 1;
        transform: rotateY(0deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .fife-elementor-approaches__front,
    .fife-elementor-approaches__back,
    .fife-elementor-approaches__button {
        transition-duration: 0.01ms !important;
    }
}
