/* The homepage: the search and MermAId heroes, the section labels, the trust band, the NMEA logo and the slideshow, with its pause button. */

@layer reset, tokens, base, layout, components, pages, utilities;

@layer pages {
    /* Homepage Search Hero */
    .search-hero {
        padding-top: var(--space-5);
    }

    .search-hero__content {
        max-width: 700px;
        margin: 0 auto;
        text-align: center;
    }

    .search-hero__title {
        font-size: var(--text-xl);
        margin-bottom: var(--space-2);
        font-weight: bold;
    }

    .search-hero__form {
        width: 100%;
    }

    .search-hero__input-wrapper {
        display: flex;
        max-width: 600px;
        margin: 0 auto;
        box-shadow: var(--shadow-3);
        border-radius: var(--radius-md);
        overflow: hidden;
    }

    .search-hero__input {
        flex: 1;
        padding: 0.875rem var(--space-4);
        border: none;
        font-size: var(--text-base);
    }

    /* The box clips outside its corners, so the focus ring is drawn inside;
       white on the green button. */
    .search-hero__input:focus-visible,
    .search-hero__button:focus-visible {
        outline-offset: -3px;
    }

    /* A .btn .btn--green, as tall as the field. */
    .search-hero__button {
        --focus-ring: var(--color-focus-on-dark);
        padding: 0.875rem var(--space-5);
    }

    /* Full navy: at 70% opacity it was 3.0:1 on the sky. */
    .search-hero__hint {
        font-size: var(--text-sm);
        margin-top: var(--space-3);
    }

    /* MermAId hero co-star — the page's single bold accent. Sits directly under the
       search and links to the mermaid.php launch page. The one place orange + the
       live-signal cyan are used, so it can't be missed. */
    .mermaid-hero {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: var(--space-4) var(--space-5);
        max-width: 640px;
        margin: 1.25rem auto 0;
        padding: 1.1rem 1.35rem;
        border-radius: var(--radius-xl);
        background: linear-gradient(135deg, var(--navy-950) 0%, var(--navy-800) 58%, var(--navy-600) 100%);
        box-shadow: var(--shadow-4);
        color: var(--color-white);
        text-align: left;
        text-decoration: none;
        transition: box-shadow var(--duration-base) ease, transform var(--duration-base) ease;
    }

    .mermaid-hero:hover,
    .mermaid-hero:focus-visible {
        transform: translateY(-2px);
        box-shadow: var(--shadow-5);
    }

    .mermaid-hero__text {
        flex: 1 1 240px;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }

    .mermaid-hero__title {
        display: block;
        font-size: var(--text-lg);
        font-weight: 800;
        line-height: 1.1;
        letter-spacing: -0.01em;
        margin: 0.3rem 0 0.35rem;
    }

    /* Description sits in the right-hand column, beside the title + CTA. */
    .mermaid-hero__sub {
        flex: 1 1 240px;
        font-size: var(--text-sm);
        line-height: 1.5;
        color: rgba(255, 255, 255, 0.88);
    }

    .mermaid-hero__cta {
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
        margin-top: 0.7rem;
        padding: var(--space-2) 1.1rem;
        border-radius: var(--radius-pill);
        /* The accent: white on it is 5.2:1 (3.8:1 on #E65100). */
        background: var(--color-accent);
        color: var(--color-white);
        font-size: var(--text-sm);
        font-weight: 700;
    }

    .mermaid-hero__cta-arrow {
        transition: transform var(--duration-base) ease;
    }

    .mermaid-hero:hover .mermaid-hero__cta-arrow,
    .mermaid-hero:focus-visible .mermaid-hero__cta-arrow {
        transform: translateX(3px);
    }

    /* The lift on hover is motion too (utilities.css stops the transitions). */
    @media (prefers-reduced-motion: reduce) {
        .mermaid-hero:hover,
        .mermaid-hero:focus-visible {
            transform: none;
        }
    }

    /* Phones stack the search box over its button; from 600px they sit in a row. */
    .search-hero__input-wrapper {
        flex-direction: column;
    }

    .search-hero__input {
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }

    .search-hero__button {
        border-radius: 0 0 var(--radius-md) var(--radius-md);
    }

    @media (width >= 600px) {
        .search-hero__title {
            font-size: var(--text-2xl);
        }

        .search-hero__input-wrapper {
            flex-direction: row;
        }

        .search-hero__input,
        .search-hero__button {
            border-radius: 0;
        }

        .mermaid-hero__title {
            font-size: var(--text-xl);
        }
    }

    /* Quiet uppercase band labels that give the page rhythm and orientation —
       they replace the old "Click in the blue panels" instructions. */
    .section-eyebrow {
        margin: var(--space-3) 0 -0.1rem;
        padding-left: 0.15rem;
        font-size: var(--text-2xs);
        font-weight: 700;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        /* Navy clears WCAG AA on the sky background; white did not. */
        color: var(--color-on-sky);
    }

    /* Company positioning ("Authorized Dealer for every manufacturer"). A soft
       frosted backing lifts the two sentences off the sky gradient so they read
       with clearly stronger contrast than plain text on the background. */
    .trust-band {
        max-width: 760px;
        margin: 0 auto;
        padding: var(--space-4) var(--space-5);
        background: rgba(255, 255, 255, 0.66);
        border: 1px solid rgba(255, 255, 255, 0.6);
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-2);
        text-align: center;
        color: var(--navy-900);
    }

    .trust-band p {
        font-size: var(--text-base);
        line-height: 1.55;
    }

    .trust-band strong {
        color: var(--color-primary);
        font-weight: 700;
    }

    /*
     * A square box (its width follows the height, not the width
     * attribute), with the logo fitted inside it, not stretched to fill it.
     */
    .nmea-logo {
        aspect-ratio: 1;
        width: auto;
        height: min(25vh, 125px);
        object-fit: contain;
    }

    .slideshow-container {
        width: 100%;
        aspect-ratio: 16/9;
        position: relative;
        overflow: hidden;
    }

    /* The photos, stacked; the one showing is .visible, and the change fades. */
    .slideshow-container__slide {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: contain;

        opacity: 0;
        transition: opacity var(--duration-fade) ease-in-out;
    }

    .slideshow-container__slide.visible {
        opacity: 1;
    }

    /*
     * The slideshow's pause button (partials/autoplay.twig): a dark disc in
     * the bottom right corner, so it shows on any photo, 28px (WCAG 2.5.8:
     * at least 24). Pause bars, or a play triangle while it is pressed.
     */
    .slideshow-container__pause {
        position: absolute;
        right: var(--space-2);
        bottom: var(--space-2);
        width: 28px;
        height: 28px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        /* Opaque navy, not a veil over the photo: the white glyph is 9:1
           against it whatever the photo is. */
        background: var(--color-primary);
        cursor: pointer;
        --focus-ring: var(--color-focus-on-dark);
    }

    .slideshow-container__pause:hover {
        background: var(--navy-950);
    }

    .slideshow-container__pause::before {
        content: "";
        position: absolute;
        top: 10px;
        left: 11px;
        width: 2px;
        height: 8px;
        border-inline: 2px solid var(--color-white);
    }

    .slideshow-container__pause[aria-pressed="true"]::before {
        top: 9px;
        left: 11px;
        width: 0;
        height: 0;
        border-inline: 0;
        border-left: 8px solid var(--color-white);
        border-block: 5px solid transparent;
    }
}
