
.features {
    --popup-size: 434px;
    --popup-padding: 30px;
    position: relative;
}

/* Description Section Layout */
.description {
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 80px 20px;
    text-align: center;
    overflow: hidden;
}

/* Como Funciona Section */
.como-funciona {
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 80px 20px;
}

.section-header {
    margin-bottom: 50px;
}

.como-title {
    display: block;
    font-family: 'Instrument Sans', sans-serif;
    font-size: clamp(4rem, 8vw, 10rem);
    line-height: 0.8;
    letter-spacing: -0.06em;
    font-weight: 200;
    text-shadow: 1px 1px 2px var(--black), 0 2px 2px var(--yellow), 1px 0 2px var(--green);
}

.funciona-title {
    display: block;
    font-family: 'Redaction', serif;
    font-size: clamp(4rem, 8vw, 10rem);
    line-height: 0.8;
    letter-spacing: -0.03em;
    font-weight: 200;
    text-shadow: 1px 1px 2px var(--black), 0 2px 2px var(--yellow), 1px 0 2px var(--green);
}

/* Features Grid */
.features {
    width: 100%;
    max-width: 1366px;
    margin: 0 auto;
}

.feature {
    width: 100%;
    border-top: 1px solid var(--black);
    border-bottom: 1px solid var(--black);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 15px;
    margin-bottom: 8px;
    position: relative;
    cursor: pointer;
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    text-align: inherit;
    border-left: none;
    border-right: none;
}

.feature-title {
    font-family: 'Instrument Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(2rem, 4vw, 4.4rem);
    line-height: 1.2;
    letter-spacing: -0.04em;
    text-transform: uppercase;
}

.feature-number {
    font-family: 'Redaction', serif;
    font-size: clamp(1.5rem, 3vw, 2.8rem);
    line-height: 1.2;
    text-transform: uppercase;
    font-weight: 200;
}

.feature-popup {
    position: absolute;
    right: 0;
    top: 0;
    width: var(--popup-size);
    height: var(--popup-size);
    background: var(--black);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    padding: var(--popup-padding);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    will-change: transform, opacity;
    z-index: 100;
    overflow: hidden;
    background: var(--black);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    transform: scale(0);
}

.feature:hover .feature-popup,
.feature:focus-visible .feature-popup {
    height: auto;
    opacity: 1;
    visibility: visible;
    padding: 30px;
}

.feature-popup-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 320px;
    min-height: 320px;
    padding: 0;
    width: 100%;
    height: 100%;
    transform: scale(0);
    transition: transform 0.4s ease-out 0.1s;
}

.feature-popup-icon img {
    max-width: 97.5%;
    max-height: 97.5%;
}

.feature:hover .feature-popup-icon,
.feature:focus-visible .feature-popup-icon,
.feature[aria-expanded="true"] .feature-popup-icon {
    transform: scale(1);
}


.feature:focus,
.feature:focus-within {
    border-color: var(--yellow);
    box-shadow: 0 0 0 2px var(--yellow-transparent);
}

/* Base popup styling */
.feature-popup {
}

/* Show popup on hover/focus */
.feature:hover .feature-popup,
.feature:focus-visible .feature-popup,
.feature[aria-expanded="true"] .feature-popup {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: scale(1);
}

/* Positioning for each popup using CSS variables */
.feature:nth-child(1) .feature-popup {
    transform-origin: 10% top;
}

.feature:nth-child(2) .feature-popup {
    transform-origin: 20% 5%;
}

.feature:nth-child(3) .feature-popup {
    transform-origin: 30% 10%;
}

.feature:nth-child(4) .feature-popup {
    transform-origin: 40% 15%;
}

.feature:nth-child(5) .feature-popup {
    transform-origin: 50% 20%;
}

.feature:nth-child(6) .feature-popup {
    transform-origin: 60% 25%;
}
/* Accessibility: Allow hiding popup on Escape even when focused */
.feature.hide-focus-popup .feature-popup {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: scale(0) !important;
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .feature-popup,
    .feature-popup-icon {
        transition: none !important;
        transform: none !important; /* To avoid scaling */
    }

    /* Ensure popup is hidden by default (since transform: scale(0) is removed) */
    .feature-popup {
        opacity: 0;
        visibility: hidden;
    }

    /* Active state simply toggles opacity/visibility instantly */
    .feature:hover .feature-popup,
    .feature:focus-visible .feature-popup,
    .feature[aria-expanded="true"] .feature-popup {
        opacity: 1;
        visibility: visible;
        transform: none !important;
    }

    /* Ensure icon is shown */
    .feature:hover .feature-popup-icon,
    .feature:focus-visible .feature-popup-icon,
    .feature[aria-expanded="true"] .feature-popup-icon {
        transform: none !important;
    }
}
