/* ==========================================================================
   Applied InTouch — Site chrome + landing page sections
   ========================================================================== */

/* --------------------------------------------------------------------------
   Announcement bar
   -------------------------------------------------------------------------- */

.ai-announcement {
    background: var(--ai-gradient-brand);
    color: var(--ai-color-ink-inverse);
    font-size: var(--ai-text-sm);
    text-align: center;
    padding: var(--ai-space-2) var(--ai-container-gutter);
}

.ai-announcement a {
    color: inherit;
    font-weight: var(--ai-weight-semibold);
}

/* --------------------------------------------------------------------------
   Sticky header
   -------------------------------------------------------------------------- */

.ai-header {
    position: sticky;
    top: 0;
    z-index: var(--ai-z-header);
    background-color: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid transparent;
    transition:
        box-shadow var(--ai-duration) var(--ai-ease),
        border-color var(--ai-duration) var(--ai-ease),
        background-color var(--ai-duration) var(--ai-ease);
}

@supports (backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px)) {
    .ai-header {
        -webkit-backdrop-filter: saturate(180%) blur(12px);
        backdrop-filter: saturate(180%) blur(12px);
    }
}

/* Applied by JS once the page has scrolled past the header. */
.ai-header.is-stuck {
    border-bottom-color: var(--ai-color-border);
    box-shadow: var(--ai-shadow-header);
}

.ai-header.is-nav-open {
    background-color: var(--ai-color-surface);
    border-bottom-color: var(--ai-color-border);
}

.ai-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ai-space-4);
    min-height: var(--ai-header-height);
}

/* ---- Logo ----------------------------------------------------------------
   The .ai-logo rules live in app.css: the admin shell and the sign-in screen
   render the same component but do not load this stylesheet, so keeping them
   here left the wordmark completely unstyled there.
   -------------------------------------------------------------------------- */

/* ---- Nav toggle (mobile only) -------------------------------------------- */

.ai-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 2.75rem;
    height: 2.75rem;
    margin-right: calc(var(--ai-space-2) * -1);
    border-radius: var(--ai-radius-md);
    color: var(--ai-color-ink);
    transition: background-color var(--ai-duration) var(--ai-ease);
}

.ai-nav-toggle:hover {
    background-color: var(--ai-color-surface-sunken);
}

.ai-nav-toggle .ai-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.ai-nav-toggle__close,
.ai-nav-toggle[aria-expanded="true"] .ai-nav-toggle__open {
    display: none;
}

.ai-nav-toggle[aria-expanded="true"] .ai-nav-toggle__close {
    display: block;
}

/* ---- Nav ------------------------------------------------------------------ */

/* Positioned ABSOLUTE against the header, not fixed against the viewport:
   .ai-header carries a backdrop-filter, which makes it the containing block
   for any fixed-position descendant. `top: 100%` puts the panel directly under
   the sticky header and an explicit height fills the rest of the viewport. */
.ai-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: calc(100vh - var(--ai-header-height));
    z-index: var(--ai-z-nav-panel);
    display: flex;
    flex-direction: column;
    gap: var(--ai-space-6);
    padding: var(--ai-space-6) var(--ai-container-gutter) var(--ai-space-10);
    background-color: var(--ai-color-surface);
    border-top: 1px solid var(--ai-color-border);
    overflow-y: auto;
    overscroll-behavior: contain;
    /* visibility:hidden also removes the links from the tab order while closed. */
    visibility: hidden;
    opacity: 0;
    transform: translateY(-0.5rem);
    transition:
        opacity var(--ai-duration) var(--ai-ease),
        transform var(--ai-duration) var(--ai-ease),
        visibility 0s linear var(--ai-duration);
}

@supports (height: 100dvh) {
    .ai-nav {
        /* Accounts for the collapsing mobile browser chrome. */
        height: calc(100dvh - var(--ai-header-height));
    }
}

.ai-header.is-nav-open .ai-nav {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition-delay: 0s;
}

.ai-nav__list {
    display: flex;
    flex-direction: column;
    gap: var(--ai-space-1);
    margin: 0;
    padding: 0;
    list-style: none;
}

.ai-nav__link {
    display: block;
    padding: var(--ai-space-3) var(--ai-space-3);
    font-size: var(--ai-text-lg);
    font-weight: var(--ai-weight-medium);
    color: var(--ai-color-ink);
    text-decoration: none;
    border-radius: var(--ai-radius-md);
    transition:
        background-color var(--ai-duration) var(--ai-ease),
        color var(--ai-duration) var(--ai-ease);
}

.ai-nav__link:hover {
    background-color: var(--ai-color-primary-tint);
    color: var(--ai-color-primary-dark);
}

.ai-nav__link.is-current {
    color: var(--ai-color-primary-dark);
    background-color: var(--ai-color-primary-light);
}

.ai-nav__actions {
    display: flex;
    flex-direction: column;
    gap: var(--ai-space-3);
    padding-top: var(--ai-space-4);
    border-top: 1px solid var(--ai-color-border);
}

.ai-nav__contact {
    display: inline-flex;
    align-items: center;
    gap: var(--ai-space-2);
    font-size: var(--ai-text-sm);
    font-weight: var(--ai-weight-medium);
    color: var(--ai-color-ink-muted);
    text-decoration: none;
}

.ai-nav__contact .ai-icon {
    width: 1rem;
    height: 1rem;
    color: var(--ai-color-primary);
}

/* Desktop nav starts at 68em rather than 60em: with eight section links plus
   the logo and CTA button, the bar needs ~1050px before it stops crowding. */
@media (min-width: 68em) {
    .ai-nav-toggle {
        display: none;
    }

    .ai-nav {
        position: static;
        height: auto;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: var(--ai-space-6);
        flex: 1 1 auto;
        padding: 0;
        border-top: 0;
        overflow: visible;
        visibility: visible;
        opacity: 1;
        transform: none;
        background: transparent;
        transition: none;
    }

    .ai-nav__list {
        flex-direction: row;
        align-items: center;
        gap: 0;
        min-width: 0;
        /* Centre the links in the space between the wordmark and the CTA.
           Hard-right alignment left a dead gap in the middle of the bar on
           wide screens while crowding the button on narrow ones. */
        margin-inline: auto;
        /* Safety valve: if a future nav label is long enough to overflow, the
           list scrolls rather than pushing the CTA button off the bar. */
        overflow-x: auto;
        scrollbar-width: none;
    }

    .ai-nav__list::-webkit-scrollbar {
        display: none;
    }

    .ai-nav__link {
        position: relative;
        padding: var(--ai-space-2) clamp(0.5rem, 1vw, 0.875rem);
        font-size: var(--ai-text-sm);
        font-weight: var(--ai-weight-medium);
        color: var(--ai-color-ink-muted);
        white-space: nowrap;
    }

    .ai-nav__link.is-current {
        background-color: transparent;
    }

    .ai-nav__link.is-current::after {
        content: "";
        position: absolute;
        left: clamp(0.5rem, 1vw, 0.875rem);
        right: clamp(0.5rem, 1vw, 0.875rem);
        bottom: 0.125rem;
        height: 2px;
        border-radius: 2px;
        background-color: var(--ai-color-primary);
    }

    .ai-nav__actions {
        flex: none;
        flex-direction: row;
        align-items: center;
        gap: var(--ai-space-4);
        padding-top: 0;
        border-top: 0;
    }

    /* The phone number is the first thing to go when space is tight -- it is
       repeated in the footer and the CTA button matters more. */
    .ai-nav__contact {
        display: none;
    }
}

@media (min-width: 82em) {
    .ai-nav__contact {
        display: inline-flex;
    }
}

/* --------------------------------------------------------------------------
   Hero (#hero)
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   Centred hero: copy in one column, photograph running wide underneath.

   The picture is deliberately flush with the bottom of the section rather than
   inset -- it meets the band that follows, so the two read as one composition
   instead of a hero with a picture parked in it. That is why the block-end
   padding is 0 and the photograph is rounded only along its top edge.
   -------------------------------------------------------------------------- */

.ai-hero {
    position: relative;
    overflow: hidden;
    /* Vertical rather than the 168deg diagonal: a centred column wants the
       tone to change down the page, not across it. */
    background: linear-gradient(
        180deg,
        var(--ai-color-primary-tint) 0%,
        var(--ai-color-primary-light) 62%,
        var(--ai-color-surface) 100%
    );
    padding-block: clamp(2.5rem, 5.5vw, 4.5rem) 0;
    text-align: center;
}

/* Soft radial wash. Centred above the headline now that the copy is centred --
   left where it was, top-right, it pulled the eye away from the column. */
.ai-hero::before {
    content: "";
    position: absolute;
    top: -34%;
    left: 50%;
    transform: translateX(-50%);
    width: 52rem;
    height: 52rem;
    border-radius: 50%;
    background: radial-gradient(
        circle at center,
        rgba(62, 146, 204, 0.16) 0%,
        rgba(62, 146, 204, 0) 62%
    );
    pointer-events: none;
}

.ai-hero__inner {
    position: relative;
    display: block;
}

.ai-hero__content > * + * {
    margin-top: var(--ai-space-5);
}

/* The measure the copy is read at. Everything inside inherits the centring,
   so the individual max-widths below only need their own auto margins. */
.ai-hero__content {
    max-width: 42rem;
    margin-inline: auto;
}

.ai-hero__title {
    font-size: var(--ai-text-5xl);
    letter-spacing: var(--ai-tracking-tight);
}

.ai-hero__subheadline {
    font-size: var(--ai-text-lg);
    line-height: var(--ai-leading-relaxed);
    font-weight: var(--ai-weight-medium);
    color: var(--ai-color-ink-muted);
    max-width: 38rem;
    margin-inline: auto;
}

.ai-hero__body {
    font-size: var(--ai-text-base);
    line-height: var(--ai-leading-relaxed);
    color: var(--ai-color-ink-subtle);
    max-width: 38rem;
    margin-inline: auto;
}

/* .ai-cta-row is a column until 30em and a row above it, so both axes are set:
   align-items centres the buttons while it is stacked, justify-content once it
   turns horizontal. Setting only justify-content left them flush left on
   phones, which is the width the centring matters most at. */
.ai-hero__ctas {
    align-items: center;
    justify-content: center;
    margin-top: var(--ai-space-8);
}

.ai-hero__badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--ai-space-2);
    margin-top: var(--ai-space-8);
    padding: 0;
    list-style: none;
}

/* ---- The photograph ------------------------------------------------------
   Wider than the copy column and flush with the section's bottom edge. The
   two children behave differently on purpose: a photograph is a crop and can
   take the full width, while the fallback illustration is a fixed drawing
   that would look stretched and lost at 58rem, so it keeps its own scale.
   -------------------------------------------------------------------------- */

.ai-hero__media {
    position: relative;
    width: 100%;
    max-width: 58rem;
    margin: clamp(2rem, 4vw, 3rem) auto 0;
}

.ai-hero__illustration {
    display: block;
    width: 100%;
    max-width: 32rem;
    height: auto;
    margin: 0 auto clamp(2.5rem, 5vw, 4rem);
    filter: drop-shadow(0 18px 40px rgba(11, 27, 51, 0.13));
}

.ai-hero__photo {
    display: block;
    width: 100%;
    /* Natural 3:2 on narrow screens where the picture is small and a crop
       would cost more than it gains, widening as the column does. The faces
       sit between 35% and 65% of the frame's height, so even the widest crop
       keeps them whole. */
    aspect-ratio: 3 / 2;
    object-fit: cover;
    object-position: center;
    border-radius: var(--ai-radius-xl) var(--ai-radius-xl) 0 0;
    box-shadow: var(--ai-shadow-xl);
}

@media (min-width: 48em) {
    .ai-hero__photo {
        aspect-ratio: 2 / 1;
    }
}

@media (min-width: 64em) {
    .ai-hero__photo {
        aspect-ratio: 21 / 9;
    }
}

/* --------------------------------------------------------------------------
   Problem (#problem)
   -------------------------------------------------------------------------- */

.ai-problem__grid {
    --ai-grid-min: 19rem;
}

.ai-pain-card {
    gap: var(--ai-space-4);
}

.ai-pain-card__head {
    display: flex;
    align-items: flex-start;
    gap: var(--ai-space-4);
}

.ai-pain-card__title {
    font-size: var(--ai-text-lg);
    font-weight: var(--ai-weight-semibold);
    letter-spacing: var(--ai-tracking-normal);
    line-height: var(--ai-leading-snug);
    /* The seeded titles contain an arrow ("Missed Calls -> Lost Revenue");
       allow it to wrap rather than overflow on narrow phones. */
    overflow-wrap: anywhere;
}

.ai-pain-card__title .ai-pain-card__arrow {
    color: var(--ai-color-warning);
    font-weight: var(--ai-weight-bold);
}

/* --------------------------------------------------------------------------
   Solution (#solution)
   -------------------------------------------------------------------------- */

.ai-solution__grid {
    /* auto-fit, so 7 cards flow 1 / 2 / 3 across without a hardcoded 3x3 */
    --ai-grid-min: 18rem;
}

.ai-service-card {
    gap: var(--ai-space-4);
    position: relative;
}

.ai-service-card__head {
    display: flex;
    flex-direction: column;
    gap: var(--ai-space-4);
}

.ai-service-card__title {
    font-size: var(--ai-text-lg);
    font-weight: var(--ai-weight-semibold);
    letter-spacing: var(--ai-tracking-normal);
    line-height: var(--ai-leading-snug);
}

.ai-service-card__bullets {
    margin-top: auto;
    padding-top: var(--ai-space-4);
    border-top: 1px solid var(--ai-color-border);
}

.ai-service-card__image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--ai-radius-md);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.ai-footer {
    background: var(--ai-gradient-dark);
    color: var(--ai-color-ink-inverse);
    padding-block: var(--ai-space-12) var(--ai-space-8);
}

.ai-footer a {
    color: var(--ai-color-ink-inverse-muted);
    text-decoration: none;
}

.ai-footer a:hover {
    color: var(--ai-color-ink-inverse);
    text-decoration: underline;
}

.ai-footer__grid {
    display: grid;
    gap: var(--ai-space-8);
    grid-template-columns: 1fr;
}

@media (min-width: 48em) {
    .ai-footer__grid {
        grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
        gap: var(--ai-space-10);
    }
}

.ai-footer__brand .ai-logo {
    color: var(--ai-color-ink-inverse);
}

.ai-footer__brand .ai-logo__name em {
    color: var(--ai-color-ink-inverse);
}

.ai-footer__description {
    margin-top: var(--ai-space-4);
    max-width: 28rem;
    font-size: var(--ai-text-sm);
    line-height: var(--ai-leading-relaxed);
    color: var(--ai-color-ink-inverse-muted);
}

.ai-footer__heading {
    font-size: var(--ai-text-xs);
    font-weight: var(--ai-weight-bold);
    letter-spacing: var(--ai-tracking-wide);
    text-transform: uppercase;
    color: var(--ai-color-ink-inverse);
    margin-bottom: var(--ai-space-4);
}

.ai-footer__list {
    display: flex;
    flex-direction: column;
    gap: var(--ai-space-3);
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: var(--ai-text-sm);
}

.ai-footer__list .ai-icon {
    width: 1rem;
    height: 1rem;
    flex: none;
}

.ai-footer__list li {
    display: flex;
    align-items: center;
    gap: var(--ai-space-2);
    color: var(--ai-color-ink-inverse-muted);
}

.ai-footer__bottom {
    display: flex;
    flex-direction: column;
    gap: var(--ai-space-3);
    margin-top: var(--ai-space-10);
    padding-top: var(--ai-space-6);
    border-top: 1px solid var(--ai-color-border-inverse);
    font-size: var(--ai-text-xs);
    color: var(--ai-color-ink-inverse-muted);
}

@media (min-width: 48em) {
    .ai-footer__bottom {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.ai-footer__legal {
    max-width: 46rem;
    line-height: var(--ai-leading-normal);
}

/* --------------------------------------------------------------------------
   Back-to-top
   -------------------------------------------------------------------------- */

.ai-to-top {
    position: fixed;
    right: var(--ai-space-4);
    bottom: var(--ai-space-4);
    z-index: var(--ai-z-sticky);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background-color: var(--ai-color-surface);
    border: 1px solid var(--ai-color-border);
    color: var(--ai-color-primary-dark);
    box-shadow: var(--ai-shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(0.5rem);
    transition:
        opacity var(--ai-duration) var(--ai-ease),
        transform var(--ai-duration) var(--ai-ease),
        visibility 0s linear var(--ai-duration);
}

.ai-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}

.ai-to-top .ai-icon {
    width: 1.25rem;
    height: 1.25rem;
    transform: rotate(-90deg);
}
