/**
 * Plan Card Item Styles
 *
 * Desktop is the base: every card is fully expanded, the summary button is
 * inert and the chevron is hidden. The max-width: 991px block turns the same
 * markup into an accordion; plans-accordion.js only adds the open/closed state
 * and the height animation on top of that.
 */

.plan-card-item {
    --plan-card-accent: var(--plan-accent, #5956E4);

    position: relative;
    display: flex;
    flex-direction: column;
    padding: 32px 28px 28px;
    background: var(--plan-surface, #FFFFFF);
    border: 1px solid var(--plan-border, rgba(212, 210, 240, 1));
    border-radius: var(--plan-radius, 20px);
    box-shadow: 0 2px 12px rgba(89, 86, 228, 0.06);
}

.plan-card-item--featured {
    border: 2px solid var(--plan-card-accent);
    box-shadow:
        0 2px 8px 0 rgba(89, 86, 228, 0.08),
        0 8px 40px 0 rgba(89, 86, 228, 0.18);
    transform: translateY(-20px);
}

.plan-card-item__badge {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 14px;
    background: linear-gradient(90deg, var(--plan-card-accent) 0%, #7B79EC 100%);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.5;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
    color: #FFFFFF;
}

/* -- Summary (plan label + price) -------------------------------------- */

.plan-card-item__summary {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    margin: 0 0 28px;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    font: inherit;
    text-align: left;
    cursor: default;
}

.plan-card-item__label {
    flex: 1 1 100%;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--plan-ink-light, #54517A);
}

.plan-card-item--featured .plan-card-item__label {
    color: var(--plan-card-accent);
}

.plan-card-item__price {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    font-size: 56px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--plan-ink, #1B1C4B);
}

.plan-card-item__period {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0;
    color: var(--plan-ink-light, #54517A);
}

.plan-card-item__chevron {
    display: none;
    flex: none;
    margin-left: auto;
    color: var(--plan-ink-muted, #666B8C);
    transition: transform 0.25s ease;
}

/* -- Panel ------------------------------------------------------------- */

.plan-card-item__panel {
    flex: 1 1 auto;
}

.plan-card-item__panel-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* -- Specs ------------------------------------------------------------- */

.plan-card-item__specs {
    /* The icon column. --spec-indent is derived, so changing the gap or the
       icon size keeps the label text aligned with the value underneath it.
       --spec-icon must match the svg's width/height in block.php. */
    --spec-icon: 14px;
    --spec-gap: 5px;
    --spec-indent: calc(var(--spec-icon) + var(--spec-gap));

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 14px;
    margin: 0;
    padding: 18px 20px;
    background-color: #F4F3FF;
    border: 1px solid rgba(221, 217, 251, 1);
    border-radius: 14px;
}

.plan-card-item__spec {
    padding-left: var(--spec-indent);
}

.plan-card-item--featured .plan-card-item__specs {
    background-color: var(--plan-accent-tint, #F0EEFE);
}

.plan-card-item__spec-label {
    display: flex;
    align-items: center;
    gap: var(--spec-gap);
    margin: 0 0 3px;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--plan-ink-muted, #666B8C);
}

.plan-card-item__spec-icon {
    flex: none;
    margin-left: calc(var(--spec-indent) * -1);
    color: var(--plan-card-accent);
}

.plan-card-item__spec-value {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
    color: var(--plan-ink, #1B1C4B);
}

/* -- Features ---------------------------------------------------------- */

.plan-card-item__features {
    margin: 24px 0;
    padding-top: 20px;
    border-top: 1px solid var(--plan-border, #DDD9FB);
}

.plan-card-item__features ul {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.plan-card-item__features li {
    position: relative;
    padding: 0 0 0 22px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--plan-ink-muted, #3D3A72);
}

.plan-card-item__features li::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 0;
    width: 14px;
    height: 14px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M7 14C10.866 14 14 10.866 14 7C14 3.13401 10.866 0 7 0C3.13401 0 0 3.13401 0 7C0 10.866 3.13401 14 7 14Z' fill='%23DDD8F8'/%3E%3Cpath d='M4 7L6 9L10 5' stroke='%233D3888' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
}

.plan-card-item--featured .plan-card-item__features li::before {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M4 7L6 9L10 5' stroke='white' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain,
        var(--plan-card-accent);
    border-radius: 50%;
}

/* -- Button ------------------------------------------------------------ */

.plan-card-item__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    /* Pinned to the bottom so the row of cards ends on one line. */
    margin-top: auto;
    padding: 11px 20px;
    background-color: transparent;
    border: 1px solid var(--plan-border, #E7E6F5);
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    color: var(--plan-ink, #1B1C4B);
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.plan-card-item__button:hover,
.plan-card-item__button:focus-visible {
    border-color: var(--plan-card-accent);
    color: var(--plan-card-accent);
}

.plan-card-item--featured .plan-card-item__button {
    background: linear-gradient(90deg, var(--plan-card-accent) 0%, #7B79EC 100%);
    border-color: var(--plan-card-accent);
    color: #FFFFFF;
    box-shadow: 0 6px 16px rgba(89, 86, 228, 0.3);
}

.plan-card-item--featured .plan-card-item__button:hover,
.plan-card-item--featured .plan-card-item__button:focus-visible {
    color: #FFFFFF;
    box-shadow: 0 8px 22px rgba(89, 86, 228, 0.42);
}

/* -- Accordion layout -------------------------------------------------- */

@media (max-width: 991px) {
    .plan-card-item {
        padding: 14px 16px;
    }

    .plan-card-item--featured {
        /* Clearance for the badge, which sits above the card when stacked. */
        margin-top: 23px;
        transform: none;
        box-shadow: 0 6px 20px rgba(89, 86, 228, 0.1);
    }

    .plan-card-item__badge {
        /* Above the card and flush left, rather than straddling the top edge
           centred as it does on desktop. bottom:100% keeps it seated on the
           card's top edge whatever the badge text does to its height. */
        top: auto;
        bottom: 100%;
        left: 0;
        margin-bottom: 8px;
        padding: 3px 13px;
        font-size: 10px;
        letter-spacing: 0.1em;
        transform: none;
    }

    .plan-card-item__summary {
        align-items: center;
        flex-wrap: nowrap;
        gap: 12px;
        margin: 0;
        padding: 2px 0;
        cursor: pointer;
    }

    .plan-card-item__label {
        flex: 1 1 auto;
        font-size: 11px;
    }

    .plan-card-item__price {
        flex: none;
        font-size: 32px;
        line-height: 1.15;
    }

    .plan-card-item__period {
        font-size: 13px;
    }

    .plan-card-item__chevron {
        display: block;
    }

    .plan-card-item__summary[aria-expanded="true"] .plan-card-item__chevron {
        transform: rotate(180deg);
    }

    /* Collapsed cards keep their markup, so the panel can animate back open. */
    .plan-card-item.is-collapsed .plan-card-item__panel {
        display: none;
    }

    .plan-card-item__panel {
        flex: 0 1 auto;
        overflow: hidden;
    }

    .plan-card-item__panel-inner {
        padding-top: 16px;
    }

    .plan-card-item__features {
        margin: 18px 0 20px;
        padding-top: 18px;
    }

    .plan-card-item__specs {
        gap: 13px 12px;
        padding: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .plan-card-item__chevron,
    .plan-card-item__button {
        transition: none;
    }
}
