.aifc {
    --aifc-accent: #4f46e5;
    --aifc-accent-dark: #3730a3;
    --aifc-surface: #ffffff;
    --aifc-soft: #eef2ff;
    --aifc-border: #d8dcf4;
    --aifc-text: #202338;
    margin-block: clamp(1rem, 3vw, 2.5rem);
    padding: clamp(1rem, 3vw, 2rem);
    color: var(--aifc-text);
    background: linear-gradient(145deg, #f7f8ff 0%, #eef2ff 100%);
    border: 1px solid var(--aifc-border);
    border-radius: 1rem;
    box-shadow: 0 0.75rem 2rem rgb(37 41 92 / 8%);
}

.aifc__title {
    margin-block: 0 0.35rem;
    font-size: clamp(1.35rem, 1rem + 1.2vw, 2rem);
    line-height: 1.2;
}

.aifc__instruction {
    max-width: 70ch;
    margin-block: 0 1.25rem;
    color: #4a4d65;
}

.aifc__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
    gap: clamp(0.75rem, 2vw, 1.25rem);
}

.aifc__card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background: var(--aifc-surface);
    border: 1px solid var(--aifc-border);
    border-radius: 0.85rem;
    box-shadow: 0 0.35rem 1rem rgb(37 41 92 / 7%);
}

.aifc__front,
.aifc__back {
    padding: 1rem 1.1rem;
}

.aifc__front {
    flex: 1 1 auto;
}

.aifc__back {
    background: var(--aifc-soft);
    border-top: 1px solid var(--aifc-border);
}

.aifc__front p,
.aifc__back p {
    margin-block: 0.35rem 0;
    overflow-wrap: anywhere;
    line-height: 1.55;
}

.aifc__eyebrow {
    color: var(--aifc-accent-dark);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.aifc__toggle {
    display: none;
    width: calc(100% - 2.2rem);
    margin: 0 1.1rem 1rem;
    padding: 0.65rem 0.9rem;
    color: #fff;
    background: var(--aifc-accent);
    border: 0;
    border-radius: 0.55rem;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.aifc--enhanced .aifc__toggle {
    display: block;
}

.aifc__toggle:hover,
.aifc__toggle:focus-visible {
    background: var(--aifc-accent-dark);
}

.aifc__toggle:focus-visible {
    outline: 0.2rem solid #818cf8;
    outline-offset: 0.15rem;
}

.aifc--enhanced .aifc__back[hidden] {
    display: none;
}

@media (max-width: 30rem) {
    .aifc {
        border-radius: 0.65rem;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .aifc__back {
        animation: aifc-reveal 160ms ease-out;
    }
}

@keyframes aifc-reveal {
    from { opacity: 0; transform: translateY(-0.25rem); }
    to { opacity: 1; transform: translateY(0); }
}

@media print {
    .aifc {
        break-inside: avoid;
        box-shadow: none;
    }

    .aifc__toggle {
        display: none;
    }

    .aifc .aifc__back[hidden] {
        display: block !important;
    }
}
