/* Adaptive Layout 2.1.1 — only the homepage service directory.
   Natural height: no fixed heights or clipping of text. */
.am-home-services {
    --service-section-pad: 40px;
    --service-title-gap: 28px;
    --service-grid-gap: 20px;
    --service-card-pad: 20px;
    --service-header-gap: 12px;
    --service-icon-size: 40px;
    --service-row-size: 44px;
    --service-row-gap: 6px;
    --service-title-size: 36px;
    padding-block: var(--service-section-pad);
}
.am-home-services .section-title {
    font-size: var(--service-title-size);
    line-height: 1.2;
    padding-bottom: 12px;
    margin-bottom: var(--service-title-gap);
}
.am-home-services .services__grid--home {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--service-grid-gap);
    align-items: stretch;
}
.am-home-services .service-card--home {
    min-width: 0;
    padding: var(--service-card-pad);
    border-radius: var(--radius-xl, 16px);
    /* The legacy global scroll script animates all .service-card elements.
       Keep this directory immediately visible and stable while scrolling. */
    opacity: 1 !important;
    transform: none !important;
    animation: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.am-home-services .service-card--home:hover {
    background: var(--color-surface);
}
.am-home-services .service-card__header {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 12px;
    margin: 0 0 var(--service-header-gap);
}
.am-home-services .service-card__icon {
    width: var(--service-icon-size);
    height: var(--service-icon-size);
    margin: 0;
    border-radius: var(--radius-lg, 12px);
    transform: none;
}
.am-home-services .service-card__icon svg { width: 22px; height: 22px; }
.am-home-services .service-card__title { font-size: 19px; line-height: 1.25; }
.am-home-services .service-card__subservices:not(:empty) {
    gap: var(--service-row-gap);
    margin: 0;
}
.am-home-services .am-home-service-link {
    min-width: 0;
    min-height: var(--service-row-size);
    height: auto;
    padding: 4px 12px;
    gap: 8px;
    border-radius: var(--radius-md, 8px);
    color: var(--color-text-primary);
    text-decoration: none;
    line-height: 1.35;
    transform: none;
    transition: background-color .15s, border-color .15s;
}
.am-home-services .am-home-service-link:hover,
.am-home-services .am-home-service-link:focus-visible {
    border-color: var(--color-accent-dark);
    background: var(--color-surface);
    transform: none;
}
.am-home-services .am-home-service-link:focus-visible {
    outline: 2px solid var(--color-accent-dark);
    outline-offset: -3px;
}
.am-home-services .subservice-item__content { min-width: 0; gap: 0; }
.am-home-services .subservice-item__name,
.am-home-services .nav-link__title {
    font-size: 15px;
    line-height: 1.35;
    font-weight: 600;
    overflow-wrap: anywhere;
}
.am-home-services .subservice-item__link {
    width: 24px;
    height: 24px;
    font-size: 17px;
    border-radius: 6px;
    color: var(--color-accent-dark);
    transform: none;
}
.am-home-services .am-home-service-link:hover .subservice-item__link,
.am-home-services .am-home-service-link:focus-visible .subservice-item__link {
    background: var(--color-accent-dark);
    color: #fff;
    transform: none;
}
.am-home-services .link__wrapper_service_main {
    flex-wrap: wrap;
    gap: 4px 8px;
}
.am-home-services .nav-link__badge {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.25;
    padding: 3px 6px;
}
/* Optional existing audit banner is retained, if enabled in the admin panel. */
.am-home-services .audit-banner {
    padding: 16px 20px;
    margin-bottom: var(--service-grid-gap);
    gap: 12px;
    flex-wrap: wrap;
}
.am-home-services .audit-banner__content h3 { font-size: 20px; margin: 0; }
@media (min-width: 700px) and (max-height: 950px) {
    .am-home-services {
        --service-section-pad: 24px;
        --service-title-gap: 20px;
        --service-grid-gap: 14px;
        --service-card-pad: 16px;
        --service-header-gap: 8px;
        --service-icon-size: 36px;
        --service-row-size: 36px;
        --service-row-gap: 4px;
        --service-title-size: 32px;
    }
}
/* Very short laptop viewport (browser chrome and fixed header take space). */
@media (min-width: 700px) and (max-height: 740px) {
    .am-home-services {
        --service-section-pad: 16px;
        --service-title-gap: 14px;
        --service-grid-gap: 12px;
        --service-card-pad: 12px;
        --service-header-gap: 6px;
        --service-icon-size: 32px;
        --service-row-size: 32px;
        --service-title-size: 28px;
    }
    .am-home-services .section-title { padding-bottom: 8px; }
    .am-home-services .service-card__title { font-size: 17px; }
}
/* Short desktop windows: preserve text size and all 14 links. */
@media (min-width: 700px) and (max-height: 640px) {
    .am-home-services {
        --service-section-pad: 12px;
        --service-title-gap: 8px;
        --service-grid-gap: 8px;
        --service-header-gap: 4px;
        --service-icon-size: 28px;
        --service-row-gap: 2px;
    }
}
/* Tablet widths: keep two columns without squeezing titles. */
@media (min-width: 700px) and (max-width: 900px) and (min-height: 951px) {
    .am-home-services {
        --service-section-pad: 24px;
        --service-title-gap: 20px;
        --service-grid-gap: 12px;
        --service-card-pad: 14px;
        --service-header-gap: 10px;
        --service-icon-size: 36px;
        --service-title-size: 30px;
    }
}
@media (max-width: 699px) {
    .am-home-services {
        --service-section-pad: 24px;
        --service-title-gap: 20px;
        --service-grid-gap: 12px;
        --service-card-pad: 14px;
        --service-header-gap: 10px;
        --service-icon-size: 36px;
        --service-row-size: 44px;
        --service-row-gap: 4px;
        --service-title-size: clamp(24px, 5vw, 30px);
    }
    .am-home-services .services__grid--home { grid-template-columns: minmax(0, 1fr); }
    .am-home-services .service-card__title { font-size: 18px; }
}
/* Touch targets stay at least 44px even on a short touchscreen laptop. */
@media (pointer: coarse) {
    .am-home-services { --service-row-size: 44px; }
}
@media (prefers-reduced-motion: reduce) {
    .am-home-services .am-home-service-link,
    .am-home-services .service-card--home,
    .am-home-services .subservice-item__link { transition: none !important; }
}

/* 2.1.1.1: extra breathing room below the service grid. */
.am-home-services {
    padding-bottom: calc(var(--service-section-pad) + 24px);
}
@media (min-width: 700px) and (max-height: 950px) {
    .am-home-services { padding-bottom: calc(var(--service-section-pad) + 20px); }
}
@media (min-width: 700px) and (max-height: 740px) {
    .am-home-services { padding-bottom: calc(var(--service-section-pad) + 12px); }
}
@media (min-width: 700px) and (max-height: 640px) {
    .am-home-services { padding-bottom: calc(var(--service-section-pad) + 8px); }
}

/* 2.1.1.2: slightly more space between individual service links. */
.am-home-services { --service-row-gap: 8px; }
@media (min-width: 700px) and (max-height: 950px) {
    .am-home-services { --service-row-gap: 6px; }
}
@media (min-width: 700px) and (max-height: 740px) {
    .am-home-services { --service-row-gap: 5px; }
}
@media (min-width: 700px) and (max-height: 640px) {
    .am-home-services { --service-row-gap: 3px; }
}
@media (max-width: 699px) {
    .am-home-services { --service-row-gap: 6px; }
}

/* v2.1.6 — approved service showcase. Decorative layers are CSS-only. */
.am-home-services {
    background: linear-gradient(180deg, #f8fafc 0%, #f0f5fa 100%);
    position: relative;
    isolation: isolate;
    --service-icon-size: 64px;
    --service-header-gap: 16px;
    --service-grid-gap: 24px;
    --service-card-pad: 24px;
    --service-row-size: 44px;
}
.am-home-services::before,
.am-home-services::after {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 128px;
    background: linear-gradient(180deg,#cce7ef,transparent);
    clip-path: polygon(0 45%, 9% 9%, 15% 34%, 23% 13%, 34% 64%, 50% 100%, 67% 71%, 79% 31%, 85% 43%, 92% 8%, 100% 36%,100% 100%,0 100%);
    z-index: -1;
    pointer-events: none;
    opacity: .65;
}
.am-home-services::after { transform: scaleX(-1); opacity: .35; }
.am-home-services .section-title { color: #102748; }
.am-home-services .service-card--home,
.am-home-services .service-card--home:hover {
    border: 1px solid #dce5ef;
    border-radius: 22px;
    background: linear-gradient(145deg,#fff 0%,#f4f8fc 100%);
    box-shadow: 0 10px 24px rgba(34,68,107,.09);
}
.am-home-services .service-card--home::before {
    display: block;
    content: '';
    position: absolute;
    top: -110px;
    right: 0;
    width: 25%;
    height: 220px;
    border-radius: 0 0 60% 100%;
    background: linear-gradient(155deg,#bcecf0,rgba(218,245,248,0));
    pointer-events: none;
}
.am-home-services .service-card--home .service-card__header { gap: 16px; }
.am-home-services .service-card--home .service-card__icon {
    background: linear-gradient(145deg,#e9fbfc,#c8eef0);
    color: #00858d;
    border-radius: 17px;
    box-shadow: 0 3px 8px #246b7312;
}
.am-home-services .service-card--home .service-card__icon svg { width: 62%; height: 62%; }
.am-home-services .am-service-heading { min-width: 0; flex: 1; }
.am-home-services .service-card__title { font-size: clamp(20px,1.8vw,28px); color: #102748; margin: 0; }
.am-home-services .am-service-description { font-size: 15px; line-height: 1.35; color: #405b78; margin: 4px 0 0; overflow-wrap: anywhere; }
.am-home-services .am-home-service-link {
    background: linear-gradient(110deg,#fff,#f7f9fc);
    border: 1px solid #d9e3ef;
    border-radius: 12px;
    box-shadow: 0 2px 4px #223a5910;
    padding-inline: 14px;
}
.am-home-services .subservice-item__name,
.am-home-services .nav-link__title { color: #142a48; font-weight: 500; }
.am-home-services .subservice-item__link { background: transparent; color: #00858d; font-size: 23px; }
.am-home-services .nav-link__badge { color: #222; background: #ffda25; border-radius: 20px; }
@media (min-width:700px) and (max-height:950px) {
    .am-home-services { --service-icon-size: 48px; --service-card-pad: 16px; --service-header-gap: 10px; --service-grid-gap: 16px; --service-row-size: 36px; }
    .am-home-services .service-card__title { font-size: 23px; }
    .am-home-services .am-service-description { font-size: 14px; }
}
@media (min-width:700px) and (max-height:740px) {
    .am-home-services { --service-icon-size: 40px; --service-card-pad: 12px; --service-header-gap: 7px; --service-grid-gap: 12px; --service-row-size: 32px; }
    .am-home-services .service-card__title { font-size: 20px; }
    .am-home-services .service-card--home .service-card__header { gap: 10px; }
}
@media (min-width:700px) and (max-height:640px) {
    .am-home-services { --service-icon-size: 32px; --service-header-gap: 5px; --service-grid-gap: 8px; --service-card-pad: 10px; }
    .am-home-services .am-service-description { margin-top: 2px; font-size: 13px; }
    .am-home-services .service-card__title { font-size: 18px; }
}
@media (max-width:699px) {
    .am-home-services { --service-icon-size: 48px; --service-card-pad: 16px; --service-grid-gap: 14px; --service-header-gap: 12px; }
    .am-home-services .service-card__title { font-size: 20px; }
    .am-home-services .am-service-description { font-size: 14px; }
    .am-home-services .service-card--home .service-card__header { gap: 12px; }
    .am-home-services .am-home-service-link { padding-inline: 10px; }
}
@media (pointer:coarse) { .am-home-services { --service-row-size: 44px; } }

/* The curved accent stays in the upper-right corner, behind the header. */
.am-home-services .service-card--home::before {
    top: 0;
    width: 25%;
    height: 112px;
    border-radius: 0;
    clip-path: ellipse(95% 100% at 100% 0%);
    background: linear-gradient(150deg,#bcecf0,rgba(218,245,248,0));
}
@media (min-width:700px) and (max-width:1100px) and (max-height:850px) {
    .am-home-services { --service-section-pad: 16px; --service-title-gap: 12px; --service-grid-gap: 12px; --service-card-pad: 12px; --service-header-gap: 6px; --service-icon-size: 40px; --service-row-size: 32px; --service-row-gap: 5px; }
    .am-home-services .service-card__title { font-size: 20px; }
    .am-home-services .service-card--home .service-card__header { gap: 10px; }
}
@media (min-width:700px) and (max-height:640px) {
    .am-home-services { --service-section-pad: 8px; --service-title-gap: 6px; --service-grid-gap: 8px; --service-card-pad: 9px; --service-header-gap: 4px; --service-row-gap: 3px; }
    .am-home-services .section-title { padding-bottom: 6px; }
    .am-home-services .am-service-description { line-height: 1.2; }
}
@media (pointer:coarse) { .am-home-services { --service-row-size: 44px; } }

/* v2.1.6.2: stable, centered service arrows in every interaction state. */
.am-home-services .am-home-service-link .subservice-item__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    align-self: center;
    width: 24px;
    height: 24px;
    margin: 0;
    padding: 0;
    font-size: 0;
    line-height: 1;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #00858d;
    box-shadow: none;
    transform: none;
    transition: color .15s ease;
}
.am-home-services .am-home-service-link .subservice-item__link::before {
    content: '';
    display: block;
    width: 18px;
    height: 18px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12h15m-5-5 5 5-5 5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12h15m-5-5 5 5-5 5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.am-home-services .am-home-service-link:hover .subservice-item__link,
.am-home-services .am-home-service-link:focus-visible .subservice-item__link {
    background: transparent;
    color: #075e70;
    box-shadow: none;
    transform: none;
}
