
/* =====================================================
   ATHERIOT SERVICES WRAPPER
===================================================== */

.services-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}


/* =====================================================
   NINE DOTS BUTTON
===================================================== */

.nine-dots {
    display: grid;

    grid-template-columns: repeat(3, 5px);
    grid-template-rows: repeat(3, 5px);

    place-content: center;
    gap: 4px;

    width: 42px;
    height: 42px;

    padding: 0;

    background: transparent;
    border: none;
    border-radius: 50%;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        transform 0.2s ease;
}

.nine-dots span {
    display: block;

    width: 5px;
    height: 5px;

    background-color: var(--heading, #333);

    border-radius: 50%;
}

.nine-dots:hover {
    background-color: var(--nav-hover, #eef2f7);
}

.nine-dots:active {
    transform: scale(0.94);
}

.nine-dots[aria-expanded="true"] {
    background-color: color-mix(
        in srgb,
        var(--primary, #4285f4) 12%,
        var(--surface, #fff)
    );
}


/* =====================================================
   FLOATING SERVICES POPUP
===================================================== */

.services-popup {
    position: absolute;

    top: calc(100% + 14px);
    left: 0;

    width: 320px;
    max-width: calc(100vw - 24px);

    max-height: min(70vh, 500px);

    padding: 18px;

    box-sizing: border-box;

    overflow-x: hidden;
    overflow-y: auto;

    background: var(--surface, #fff);
    color: var(--heading, #222);

    border: 1px solid var(--border, #e5e7eb);
    border-radius: 22px;

    box-shadow:
        0 16px 45px rgba(0, 0, 0, 0.16),
        0 4px 12px rgba(0, 0, 0, 0.06);

    z-index: 1000;

    transform-origin: top left;

    animation: servicesAppear 0.22s ease-out;
}


/* =====================================================
   HIDDEN STATE
===================================================== */

.services-popup[hidden] {
    display: none !important;
}


/* =====================================================
   POPUP ANIMATION
===================================================== */

@keyframes servicesAppear {

    from {
        opacity: 0;

        transform:
            translateY(-8px) scale(0.96);
    }

    to {
        opacity: 1;

        transform:
            translateY(0) scale(1);
    }

}


/* =====================================================
   POPUP HEADING
===================================================== */

.services-popup h3 {
    margin: 0 0 18px;

    padding: 0 4px 14px;

    font-size: 16px;
    font-weight: 700;

    line-height: 1.4;
    letter-spacing: -0.2px;

    text-align: center;

    color: var(--heading, #222);

    border-bottom:
        1px solid var(--border, #e5e7eb);
}


/* =====================================================
   SERVICES GRID
===================================================== */

.services-grid {
    display: grid;

    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 12px 8px;

    align-items: stretch;
}


/* =====================================================
   INVITE FRIENDS SERVICE
===================================================== */

.service-item {
    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 10px;

    min-width: 0;
    min-height: 100px;

    padding: 12px 6px;

    box-sizing: border-box;

    background: transparent;

    border: 1px solid transparent;
    border-radius: 16px;

    color: var(--heading, #222);

    font-family: inherit;
    text-decoration: none;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}


/* =====================================================
   INVITE FRIENDS ICON
===================================================== */

.service-item i {
    display: grid;

    place-items: center;

    flex-shrink: 0;

    width: 52px;
    height: 52px;

    font-size: 24px;

    color: var(--primary, #4285f4);

    background: color-mix(
        in srgb,
        var(--primary, #4285f4) 10%,
        transparent
    );

    border-radius: 16px;

    transition:
        background-color 0.2s ease,
        transform 0.2s ease;
}


/* =====================================================
   INVITE FRIENDS LABEL
===================================================== */

.service-item span {
    font-size: 12px;

    font-weight: 600;

    line-height: 1.4;

    text-align: center;

    color: var(--heading, #222);

    overflow-wrap: anywhere;
}


/* =====================================================
   HOVER EFFECTS
===================================================== */

.service-item:hover {
    background-color: color-mix(
        in srgb,
        var(--primary, #4285f4) 7%,
        var(--surface, #fff)
    );

    border-color: color-mix(
        in srgb,
        var(--primary, #4285f4) 15%,
        transparent
    );

    transform: translateY(-2px);
}

.service-item:hover i {
    transform: scale(1.07);
}

.service-item:active {
    transform: scale(0.97);
}


/* =====================================================
   KEYBOARD ACCESSIBILITY
===================================================== */

.service-item:focus-visible,
.nine-dots:focus-visible {
    outline: 2px solid var(--primary, #4285f4);

    outline-offset: 3px;
}


/* =====================================================
   DARK / AMOLED THEMES
===================================================== */

body.dark .services-popup,
body.amoled .services-popup {
    border-color: var(--border, #333);

    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.45);
}


/* =====================================================
   MOBILE RESPONSIVE
===================================================== */

@media (max-width: 480px) {

    .services-popup {
        width: 290px;

        max-width: calc(100vw - 24px);

        padding: 16px 12px;

        border-radius: 20px;
    }

    .services-grid {
        gap: 8px;
    }

    .service-item {
        min-height: 88px;

        padding: 10px 4px;

        gap: 8px;
    }

    .service-item i {
        width: 46px;
        height: 46px;

        font-size: 22px;

        border-radius: 14px;
    }

    .service-item span {
        font-size: 11px;
    }

}


/* =====================================================
   SMALL MOBILE
===================================================== */

@media (max-width: 320px) {

    .services-popup {
        width: min(
            260px,
            calc(100vw - 16px)
        );

        padding: 12px 8px;
    }

    .services-grid {
        gap: 4px;
    }

    .service-item {
        min-height: 76px;

        padding: 8px 2px;
    }

    .service-item i {
        width: 38px;
        height: 38px;

        font-size: 19px;
    }

}


/* =====================================================
   REDUCED MOTION
===================================================== */

@media (prefers-reduced-motion: reduce) {

    .services-popup {
        animation: none;
    }

    .service-item,
    .nine-dots {
        transition: none;
    }

}
