/* Services section */

.services-section {
    position: relative;
    isolation: isolate;
    padding-top: 3.8rem;
    padding-bottom: 4.2rem;
    border: 0;
}

.services-section::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    z-index: -1;
    width: 100vw;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background:
        radial-gradient(
            ellipse at 75% 30%,
            rgba(199, 243, 106, 0.08),
            transparent 34rem
        ),
        var(--paper);
    content: "";
    transform: translateX(-50%);
    transition:
        background-color 950ms cubic-bezier(0.22, 1, 0.36, 1),
        border-color 950ms cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 950ms cubic-bezier(0.22, 1, 0.36, 1);
}

.services-section:has(.service-detail:not([hidden]))::before {
    border-color: rgba(46, 118, 87, 0.16);
    background:
        radial-gradient(
            ellipse at 72% 28%,
            rgba(199, 243, 106, 0.2),
            transparent 34rem
        ),
        #e8f0e3;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.services-section > .section-eyebrow {
    margin-bottom: 0.7rem;
}

.services-section > h2 {
    max-width: 720px;
    margin: 0;
    color: var(--forest);
    font-size: clamp(2rem, 3.6vw, 3rem);
    font-weight: 750;
    letter-spacing: -0.06em;
    line-height: 1.05;
}

/* Service cards */

.service-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    margin-top: 2rem;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    transition: border-color 850ms cubic-bezier(0.22, 1, 0.36, 1);
}

.services-section:has(.service-detail:not([hidden])) .service-grid {
    border-color: rgba(46, 118, 87, 0.2);
}

.service-item {
    min-width: 0;
    padding: 0;
    border: 1px solid transparent;
    transition:
        border-color 700ms cubic-bezier(0.22, 1, 0.36, 1),
        background-color 700ms cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 700ms cubic-bezier(0.22, 1, 0.36, 1);
}

.service-item + .service-item {
    border-left-color: var(--line);
}

.services-section:has(.service-detail:not([hidden])) .service-item + .service-item {
    border-left-color: rgba(46, 118, 87, 0.2);
}

.service-item.is-open {
    z-index: 2;
    border-color: rgba(46, 118, 87, 0.2);
    background: rgba(255, 255, 255, 0.55);
    box-shadow: 0 16px 38px rgba(21, 60, 49, 0.07);
}

.service-card-button {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 13.8rem;
    align-items: flex-start;
    flex-direction: column;
    padding: 1.4rem 1.4rem 1.7rem;
    overflow: hidden;
    border: 0;
    background: transparent;
    color: var(--forest);
    text-align: left;
    cursor: pointer;
    transition:
        background-color 700ms cubic-bezier(0.22, 1, 0.36, 1),
        color 700ms cubic-bezier(0.22, 1, 0.36, 1);
}

.service-card-button::before {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(
            circle at 12% 12%,
            rgba(199, 243, 106, 0.23),
            transparent 52%
        );
    content: "";
    opacity: 0;
    transition: opacity 600ms ease;
    pointer-events: none;
}

.service-card-button:hover,
.service-card-button:focus-visible,
.service-card-button.is-active {
    background-color: rgba(255, 255, 255, 0.3);
}

.service-card-button:hover::before,
.service-card-button:focus-visible::before,
.service-card-button.is-active::before {
    opacity: 1;
}

.service-card-button:focus-visible {
    z-index: 1;
    outline: 2px solid var(--green);
    outline-offset: -3px;
}

.service-icon {
    position: relative;
    z-index: 1;
    display: grid;
    width: 3rem;
    height: 3rem;
    margin-bottom: 1.3rem;
    place-items: center;
    border: 1px solid rgba(46, 118, 87, 0.16);
    border-radius: 0.85rem 0.85rem 0.85rem 0.25rem;
    background: rgba(232, 240, 228, 0.95);
    color: var(--green);
    font-size: 1.2rem;
    transition:
        transform 500ms cubic-bezier(0.22, 1, 0.36, 1),
        border-radius 500ms ease,
        background-color 750ms cubic-bezier(0.22, 1, 0.36, 1),
        color 750ms cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 500ms ease;
}

.service-card-button:hover .service-icon,
.service-card-button:focus-visible .service-icon,
.service-card-button.is-active .service-icon {
    transform: translateY(-2px) rotate(-4deg);
    border-radius: 0.7rem;
    background: var(--forest);
    color: var(--lime);
    box-shadow: 0 10px 22px rgba(21, 60, 49, 0.13);
}

.service-number {
    position: relative;
    z-index: 1;
    margin-bottom: 0.65rem;
    color: var(--green);
    font-family: monospace;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
}

.service-title {
    position: relative;
    z-index: 1;
    margin-bottom: 0.45rem;
    color: var(--forest);
    font-size: 1.12rem;
    font-weight: 750;
    letter-spacing: -0.03em;
}

.service-summary {
    position: relative;
    z-index: 1;
    max-width: 23rem;
    padding-right: 1.25rem;
    color: var(--muted);
    font-size: 0.87rem;
    line-height: 1.6;
}

.service-card-indicator {
    position: absolute;
    right: 1.2rem;
    bottom: 1.15rem;
    z-index: 1;
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border: 1px solid rgba(21, 60, 49, 0.14);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.65);
    color: var(--green);
    opacity: 0;
    transform: translate(-5px, 5px);
    transition:
        opacity 300ms ease,
        transform 350ms cubic-bezier(0.22, 1, 0.36, 1),
        background-color 600ms ease,
        color 600ms ease;
}

.service-card-button:hover .service-card-indicator,
.service-card-button:focus-visible .service-card-indicator,
.service-card-button.is-active .service-card-indicator {
    opacity: 1;
    transform: translate(0, 0);
}

.service-card-button.is-active .service-card-indicator {
    background: var(--forest);
    color: var(--white);
}

/* Dropdown content */

.service-detail[hidden] {
    display: none !important;
}

.service-detail {
    position: relative;
    padding: 1.5rem 1.4rem 1.7rem;
    border-top: 1px solid rgba(46, 118, 87, 0.16);
    background:
        radial-gradient(
            circle at 100% 0,
            rgba(199, 243, 106, 0.16),
            transparent 13rem
        ),
        rgba(255, 255, 255, 0.68);
}

.service-detail.is-active {
    animation: serviceDropdownOpen 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
    transform-origin: top center;
}

@keyframes serviceDropdownOpen {
    from {
        opacity: 0;
        transform: translateY(-12px) scaleY(0.97);
        filter: blur(2px);
    }

    to {
        opacity: 1;
        transform: translateY(0) scaleY(1);
        filter: blur(0);
    }
}

.service-detail-kicker {
    margin: 0 0 0.45rem;
    color: var(--green);
    font-family: monospace;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.service-detail h3 {
    margin: 0;
    color: var(--forest);
    font-size: clamp(1.35rem, 2vw, 1.7rem);
    font-weight: 760;
    letter-spacing: -0.055em;
    line-height: 1.08;
}

.service-detail-description {
    margin: 0.8rem 0 1.2rem;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.65;
}

.service-detail h4 {
    margin: 1.1rem 0 0.7rem;
    color: var(--forest);
    font-size: 0.64rem;
    font-weight: 750;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.service-detail-list {
    display: flex;
    flex-direction: column;
    gap: 0.58rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.service-detail-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.45;
}

.service-detail-list .bi {
    flex: 0 0 auto;
    margin-top: 0.04rem;
    color: var(--green);
    font-size: 0.86rem;
}

.service-detail-technologies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.38rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.service-detail-technologies li {
    padding: 0.38rem 0.52rem;
    border: 1px solid rgba(46, 118, 87, 0.16);
    border-radius: 999px;
    background: #f1f5ec;
    color: var(--forest);
    font-family: monospace;
    font-size: 0.61rem;
    transition:
        transform 220ms ease,
        background-color 350ms ease,
        border-color 350ms ease;
}

.service-detail-technologies li:hover {
    transform: translateY(-2px);
    border-color: rgba(46, 118, 87, 0.35);
    background: #e5efdc;
}

.service-detail-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.2rem;
    color: var(--forest);
    font-size: 0.76rem;
    font-weight: 750;
    text-decoration: none;
    transition: color 350ms ease;
}

.service-detail-link .bi {
    transition: transform 250ms ease;
}

.service-detail-link:hover {
    color: var(--green);
}

.service-detail-link:hover .bi {
    transform: translate(2px, -2px);
}

/* Responsive layout */

@media (max-width: 767.98px) {
    .service-grid {
        grid-template-columns: 1fr;
    }

    .service-item + .service-item {
        border-top: 1px solid var(--line);
        border-left-color: transparent;
    }

    .services-section:has(.service-detail:not([hidden])) .service-item + .service-item {
        border-top-color: rgba(46, 118, 87, 0.2);
    }

    .service-card-button {
        min-height: 0;
        padding: 1.2rem 1rem 1.4rem;
    }

    .service-icon {
        width: 2.7rem;
        height: 2.7rem;
        margin-bottom: 0.9rem;
    }

    .service-card-indicator {
        right: 1rem;
        bottom: 1rem;
        opacity: 1;
        transform: none;
    }

    .service-detail {
        padding: 1.2rem 1rem 1.4rem;
    }
}

@media (max-width: 575.98px) {
    .service-detail h3 {
        font-size: 1.4rem;
    }
}

/* Respect reduced-motion preferences */

@media (prefers-reduced-motion: reduce) {
    .services-section::before,
    .service-card-button,
    .service-icon,
    .service-card-indicator,
    .service-detail-technologies li,
    .service-detail-link,
    .service-detail-link .bi {
        transition: none;
    }

    .service-detail.is-active {
        animation: none;
    }
}