.footer-scroll-top-band {
    --footer-band-background: #fff;
    --footer-band-ink: #6b625e;
    background: var(--footer-band-background);
}

/* Continue the OUTER closing section, never an inset CTA card. Match the
   rendered page/section rather than its URL (including categories and 404s). */
.services-overview:has(> .services-overview__final:last-child) ~ .footer-scroll-top-band,
.blog-index:has(> .blog-index__final:last-child) ~ .footer-scroll-top-band,
.portfolio-page:has(> .portfolio-final:last-child) ~ .footer-scroll-top-band,
.reviews-page:has(> .reviews-final:last-child) ~ .footer-scroll-top-band {
    --footer-band-background: #fff5f1;
}

.home-page ~ .footer-scroll-top-band,
.expedition-case:has(> .expedition-final:last-child) ~ .footer-scroll-top-band,
.calculator-page:has(> .calculator-page__guide:last-child) ~ .footer-scroll-top-band,
.author-sign-page:has(> .author-sign-page__cta:last-child) ~ .footer-scroll-top-band {
    --footer-band-background: #fffbed;
}

.isbn-barcode-page:has(> .isbn-barcode-page__cta:last-child) ~ .footer-scroll-top-band {
    --footer-band-background: #ff7568;
    --footer-band-ink: #382c29;
}

.publishing-service-tool ~ .footer-scroll-top-band,
.service-page:has(> .publishing-service-tool:last-child) ~ .footer-scroll-top-band {
    --footer-band-background: #fff9e8;
}

.not-found-page ~ .footer-scroll-top-band {
    --footer-band-background: #fffbec;
}

.footer-scroll-top {
    display: flex;
    justify-content: flex-end;
    padding-top: 20px;
    padding-bottom: 20px;
}

.footer-scroll-top .btn {
    display: grid;
    width: 48px;
    height: 48px;
    padding: 0;
    place-items: center;
    border-radius: 50%;
    color: var(--footer-band-ink);
    background: transparent;
    transition: background-color 160ms ease, transform 160ms ease-out;
}

.footer-scroll-top .btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 4px;
    box-shadow: none;
}

.footer-scroll-top .btn:active {
    transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
    .footer-scroll-top .btn:hover {
        color: var(--footer-band-ink);
        background: rgba(255, 255, 255, 0.4);
    }
}

@media (prefers-reduced-motion: reduce) {
    .footer-scroll-top .btn {
        transition: background-color 160ms ease;
    }

    .footer-scroll-top .btn:active {
        transform: none;
    }
}

.footer {
    padding: clamp(48px, 6vw, 82px) 0 30px;
    border-top: 1px solid #eee1d9;
    background: #fffbea !important;
    font-size: 17px;
}

.footer__lead {
    display: grid;
    grid-template-columns: minmax(220px, 0.75fr) minmax(520px, 1.25fr);
    gap: clamp(40px, 6vw, 96px);
    align-items: center;
    padding-bottom: clamp(38px, 5vw, 64px);
    border-bottom: 1px solid #e8dcd4;
}

.footer__brand {
    max-width: 390px;
}

.footer__logo {
    display: inline-block;
    margin-bottom: 18px;
}

.footer__logo img {
    display: block;
    width: min(100%, 235px);
    height: auto;
    max-width: none;
}

.footer__brand > p {
    max-width: 360px;
    margin: 0;
    color: #665f5b;
    line-height: 1.5;
}

.footer__cta {
    display: flex;
    gap: 30px;
    align-items: center;
    justify-content: space-between;
    padding: clamp(28px, 4vw, 42px);
    border: 1px solid #ead8cf;
    border-radius: 34px 5px 34px 5px;
    background: rgba(255, 255, 255, 0.72);
}

.footer__cta > div {
    max-width: 560px;
}

.footer__eyebrow {
    display: block;
    margin-bottom: 10px;
    color: #d95649;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.footer__cta-title {
    margin: 0 0 8px;
    color: #2f2e2d;
    font-size: clamp(24px, 2.2vw, 34px);
    font-weight: 700;
    line-height: 1.2;
}

.footer__cta > div > p:last-child {
    margin: 0;
    color: #665f5b;
    line-height: 1.5;
}

.footer__consultation-button {
    flex: 0 0 auto;
    min-width: 225px;
    min-height: 54px;
    padding: 13px 25px;
    border-radius: 999px;
    font-size: 17px;
    font-weight: 700;
}

.footer__nav-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: clamp(28px, 4vw, 62px);
    padding: clamp(38px, 5vw, 62px) 0;
    border-bottom: 1px solid #e8dcd4;
}

.footer__nav-group {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
}

.footer__nav-group--services {
    display: block;
    grid-column: span 2;
    column-count: 2;
    column-gap: clamp(24px, 4vw, 58px);
    align-content: start;
}

.footer__nav-title {
    width: 100%;
    margin: 0 0 17px;
    color: #2f2e2d;
    font-size: 19px;
    font-weight: 700;
    line-height: 1.3;
}

.footer__nav-group--services .footer__nav-title {
    column-span: all;
}

.footer .footer__nav-group--services a {
    display: block;
    break-inside: avoid;
}

.footer .footer__nav-group a {
    display: inline-block;
    width: fit-content;
    margin: 0 0 10px;
    color: #5f5a57;
    line-height: 1.45;
    text-decoration: none;
    text-underline-offset: 4px;
    overflow-wrap: anywhere;
    transition: color 160ms ease;
}

.footer .footer__nav-group a:hover,
.footer .footer__nav-group a:focus-visible {
    color: #c7483d;
    text-decoration: underline;
}

.footer__contacts {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 36px;
    align-items: end;
    padding: clamp(32px, 4vw, 48px) 0;
    border-bottom: 1px solid #e8dcd4;
}

.footer__address address {
    margin: 0;
    color: #45413f;
    font-size: 18px;
    font-style: normal;
    line-height: 1.55;
}

.footer__contact-links {
    display: flex;
    gap: 28px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.footer__contact-links .icon-link {
    display: inline-flex;
    gap: 9px;
    align-items: center;
    color: #373534;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    white-space: nowrap;
}

.footer__contact-links .icon-link svg {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
}

.footer__contact-links .icon-link,
.footer__contact-links .icon-link svg path {
    transition: color 160ms ease, stroke 160ms ease;
}

.footer__contact-links .icon-link:hover,
.footer__contact-links .icon-link:focus-visible {
    color: #c7483d;
}

.footer__contact-links .icon-link:hover svg path,
.footer__contact-links .icon-link:focus-visible svg path {
    stroke: #c7483d;
}

.footer__bottom {
    display: flex;
    gap: 24px;
    align-items: center;
    justify-content: space-between;
    padding-top: 27px;
    color: #77706c;
    font-size: 15px;
    line-height: 1.45;
}

.footer__bottom a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: #cbbcb4;
    text-underline-offset: 4px;
}

.footer__bottom a:hover,
.footer__bottom a:focus-visible {
    color: #c7483d;
    text-decoration-color: currentColor;
}

@media (min-width: 992px) and (max-width: 1679.98px) {
    .footer > .container {
        padding-right: clamp(140px, 11vw, 180px);
    }

    .footer__lead {
        grid-template-columns: 0.65fr 1.35fr;
        gap: 36px;
    }

    .footer__cta {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 1199.98px) {
    .footer__lead {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .footer__brand {
        max-width: 620px;
    }

    .footer__brand > p {
        max-width: 620px;
    }

    .footer__nav-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .footer__nav-group--services {
        grid-column: span 3;
    }
}

@media (max-width: 767.98px) {
    .footer-scroll-top {
        padding-right: 20px;
    }

    .footer {
        padding-top: 42px;
    }

    .footer__lead {
        padding-bottom: 34px;
    }

    .footer__cta {
        align-items: stretch;
        flex-direction: column;
        gap: 24px;
        padding: 28px 24px;
        border-radius: 28px 4px 28px 4px;
    }

    .footer__consultation-button {
        width: 100%;
        min-width: 0;
    }

    .footer__nav-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 34px 24px;
    }

    .footer__nav-group--services {
        grid-column: span 2;
    }

    .footer__contacts {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .footer__contact-links {
        align-items: flex-start;
        justify-content: flex-start;
        flex-direction: column;
        gap: 17px;
    }

    .footer__bottom {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }
}

@media (max-width: 479.98px) {
    .footer__nav-grid,
    .footer__nav-group--services {
        grid-template-columns: 1fr;
    }

    .footer__nav-group--services {
        grid-column: auto;
        column-count: 1;
    }

    .footer__nav-group--services .footer__nav-title {
        grid-column: auto;
    }

    .footer__contact-links .icon-link {
        font-size: 17px;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

@media (prefers-reduced-motion: reduce) {
    .footer .footer__nav-group a,
    .footer__contact-links .icon-link,
    .footer__contact-links .icon-link svg path {
        transition: none;
    }
}
