/* ===================================================================
   Footer: brand + three short link lists (Product, Help, Company) + one quiet legal line with the company name.
   Deliberately plain: less to read, nothing to hunt for.
   =================================================================== */

.site-footer {
    position: relative;

    /* same colour as the page, so the wave rises straight out of the page, without a grey edge */
    background: var(--color-bg);
    overflow: hidden;
}

/* ===== the wave: a surface of Euler waves, drawn by build-wave.php ===== */

.footer-wave {
    width: 100%;
    max-width: 1680px;
    margin: 0 auto;

    /* same proportions as the drawing; on narrower screens it gets taller and the sides are cropped */
    aspect-ratio: 1440 / 280;
    min-height: 150px;
    min-width: 0; /* otherwise min-height is carried over to the width through the aspect ratio */

    /* the wave melts away towards the sides */
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);

    pointer-events: none;
}

.footer-wave {
    overflow: hidden;
}

.footer-wave svg {
    display: block;
    width: 100%;
    height: 100%;

    /* the bottom dissolves into the footer, so the wave is never cut by a hard edge */
    -webkit-mask-image: linear-gradient(to bottom, #000 62%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 62%, transparent 100%);
}

/* on a phone, slide the drawing so the highest peak sits in the middle of the screen */
@media (max-width: 600px) {

    .footer-wave svg {
        width: 200%;
        max-width: none;
        margin-left: -80%;
    }
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.7fr repeat(3, minmax(0, 1fr));
    gap: 48px;

    padding: 40px 0 56px;
}

/* ===== brand ===== */

.footer-logo {
    display: inline-flex;
    border-radius: 6px;
}

.footer-logo img {
    height: 28px;
    width: auto;
}

.footer-tagline {
    margin-top: 16px;
    max-width: 30ch;

    font-size: 15px;
    line-height: 1.6;
    color: var(--color-text-soft);
}

/* ===== link lists ===== */

.footer-col h3 {
    margin-bottom: 18px;

    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--color-text-quiet);
}

.footer-col ul {
    display: grid;
    gap: 12px;
}

.footer-col a {
    display: inline-block;

    font-size: 15px;
    font-weight: 500;
    color: var(--color-text-soft);

    transition: color .15s ease, transform .2s var(--ease);
}

.footer-col a:hover {
    color: var(--color-text);
    transform: translateX(3px);
}

/* ===== bottom line ===== */

.footer-bottom {
    display: flex;
    align-items: center;
    gap: 24px;

    padding: 24px 0 32px;
    border-top: 1px solid var(--color-border);

    font-size: 14px;
    color: var(--color-text-quiet);
}

.footer-legal {
    display: flex;
    gap: 24px;
    margin-left: auto;
}

.footer-legal a {
    transition: color .15s ease;
}

.footer-legal a:hover {
    color: var(--color-text);
}

.to-top {
    display: grid;
    place-items: center;
    flex-shrink: 0;

    width: 40px;
    height: 40px;

    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-bg);
    color: var(--color-text-soft);

    transition: color .18s ease, border-color .18s ease, transform .2s var(--ease);
}

.to-top svg {
    width: 16px;
    height: 16px;
}

.to-top:hover {
    color: var(--color-green-dark);
    border-color: color-mix(in srgb, var(--color-green) 55%, var(--color-border));
    transform: translateY(-2px);
}

/* ===== responsive ===== */

@media (max-width: 960px) {

    .footer-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 40px 32px;
        padding: 56px 0 44px;
    }

    .footer-brand {
        grid-column: 1 / -1;
    }
}

@media (max-width: 600px) {

    .footer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 36px 24px;
        padding: 44px 0 36px;
    }

    .footer-bottom {
        flex-wrap: wrap;
        gap: 16px;
        padding-bottom: 28px;
    }

    .footer-copy {
        order: 1;
    }

    .to-top {
        order: 2;
        margin-left: auto;
    }

    .footer-legal {
        order: 3;
        flex-basis: 100%;
        flex-wrap: wrap;
        gap: 8px 20px;
        margin-left: 0;
    }
}
