/* ============================================================
   4. Features — fanned card stack + detail modal
   ============================================================ */

.features__head { text-align: center; }
.features__head .section__lead { margin-inline: auto; }

.features__stage {
    position: relative;
    margin-top: clamp(2.4rem, 5vw, 4rem);
    perspective: 1400px;
}

/* --- card --- */
.fcard {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 0.4rem;
    width: 240px;
    height: 320px;
    padding: 1.4rem 1.4rem 1.5rem;
    border: none;
    border-radius: var(--r-card);
    background: linear-gradient(160deg, var(--card-a, #e8f1fc) 0%, var(--card-b, #d3e4f8) 100%);
    color: var(--ink);
    font-family: inherit;
    text-align: start;
    cursor: pointer;
    box-shadow:
        0 2px 6px   rgba(15, 23, 42, 0.08),
        0 18px 40px rgba(15, 23, 42, 0.16);
    transition: transform 0.7s var(--ease-spring), box-shadow 0.5s var(--ease-reveal);
}
.fcard::after {
    /* glass rim */
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(170deg,
        rgba(255, 255, 255, 0.95)  0%,
        rgba(255, 255, 255, 0.45) 30%,
        rgba(255, 255, 255, 0.12) 58%,
        rgba(255, 255, 255, 0.28) 78%,
        rgba(10, 14, 32, 0.22)   100%);
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
}

.fcard__plus {
    position: absolute;
    top: 0.95rem;
    inset-inline-end: 0.95rem;
    display: grid;
    place-items: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.72);
    color: var(--accent);
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1;
    transition: transform 0.5s var(--ease-spring), background 0.3s ease;
}
.fcard:hover .fcard__plus { transform: rotate(90deg); background: #ffffff; }

.fcard__icon {
    width: 52px; height: 52px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.65);
    color: var(--accent);
    margin-bottom: auto;
}
.fcard__icon svg { width: 28px; height: 28px; }

.fcard__title {
    margin: 0;
    font-size: 1.22rem;
    font-weight: 700;
    line-height: 1.3;
}
.fcard__tag {
    margin: 0;
    font-size: 0.86rem;
    font-weight: 500;
    color: rgba(11, 18, 32, 0.62);
    line-height: 1.45;
}

/* --- desktop: fanned stack --- */
@media (min-width: 900px) {
    .features__stage {
        height: 470px;
        display: block;
    }
    .fcard {
        position: absolute;
        top: 30px;
        left: 50%;
        margin-left: -120px;           /* half card width — physical, JS math is physical */
        will-change: transform;
    }
    .fcard:hover, .fcard:focus-visible {
        z-index: 30 !important;
        box-shadow:
            0 6px 14px  rgba(15, 23, 42, 0.12),
            0 30px 60px rgba(15, 23, 42, 0.24);
    }
}

/* --- mobile / tablet: grid --- */
@media (max-width: 899px) {
    .features__stage {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 1.1rem;
    }
    .fcard { width: 100%; height: 250px; position: relative; }
}

/* --- feature modal --- */
.fmodal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 1.2rem;
}
.fmodal[hidden] { display: none; }
.fmodal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 12, 24, 0.55);
    -webkit-backdrop-filter: blur(6px);
            backdrop-filter: blur(6px);
}
.fmodal__panel {
    position: relative;
    width: min(560px, 100%);
    max-height: min(82vh, 640px);
    overflow-y: auto;
    padding: 2.2rem 2.2rem 2rem;
    border-radius: var(--r-panel);
    background: #ffffff;
    box-shadow: 0 40px 90px rgba(8, 12, 24, 0.4);
    animation: fmodal-in 0.45s var(--ease-reveal);
}
@keyframes fmodal-in {
    from { opacity: 0; transform: translateY(26px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}
.fmodal__close {
    position: absolute;
    top: 1.1rem;
    inset-inline-end: 1.1rem;
    display: grid;
    place-items: center;
    width: 40px; height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(11, 18, 32, 0.06);
    color: var(--ink);
    cursor: pointer;
    transition: background 0.3s ease;
}
.fmodal__close:hover { background: rgba(11, 18, 32, 0.12); }
.fmodal__close svg { width: 18px; height: 18px; }

.fmodal__icon {
    width: 58px; height: 58px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: rgba(31, 122, 224, 0.1);
    color: var(--accent);
    margin-bottom: 1.1rem;
}
.fmodal__icon svg { width: 30px; height: 30px; }
.fmodal__title {
    margin: 0 0 1.1rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--ink);
}
.fmodal__points {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.fmodal__points li {
    position: relative;
    padding-inline-start: 1.7rem;
    color: var(--muted-2);
    font-size: 0.99rem;
    line-height: 1.65;
}
.fmodal__points li::before {
    content: "";
    position: absolute;
    top: 0.52em;
    inset-inline-start: 0.25rem;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-soft));
}

@media (prefers-reduced-motion: reduce) {
    .fcard, .fcard__plus { transition: none; }
    .fmodal__panel { animation: none; }
}
