/* =========================================================
   CORALPATHS HEADER
   ========================================================= */

.header {
    position: sticky;
    z-index: 1000;

    top: 0;

    display: block;

    width: 100%;
    min-height: 112px;
    padding: 0 var(--page-padding);

    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid rgba(238, 221, 214, 0.7);

    transform: translateY(0);

    transition:
        transform 240ms ease,
        box-shadow 240ms ease,
        background-color 240ms ease;

    will-change: transform;

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

/* Applied after the visitor leaves the top of the page. */
.header.header-scrolled {
    box-shadow:
        0 10px 30px rgba(15, 75, 95, 0.08);
}

/* Hide the header while scrolling down. */
.header.header-hidden {
    transform: translateY(-100%);
}

/* Reveal the header while scrolling up. */
.header.header-visible {
    transform: translateY(0);
}

/* Logo left, navigation centre, app button right. */
.navbar {
    display: grid;
    grid-template-columns: 360px 1fr 240px;
    align-items: center;
    gap: 32px;

    width: 100%;
    max-width: var(--content-width);
    min-height: 112px;
    margin: 0 auto;
}

/* =========================================================
   HEADER LOGO
   ========================================================= */

.logo-container {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;

    width: fit-content;
    margin: 0;

    text-decoration: none;
}

.logo {
    display: block;

    width: 320px;
    max-width: none;
    height: auto;

    object-fit: contain;
}

/* =========================================================
   DESKTOP NAVIGATION
   ========================================================= */

.nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 38px;

    /* Optically align links with the logo and app button. */
    transform: translateY(4px);
}


.nav-links a {
    position: relative;

    color: var(--color-text);

    font-size: 20px;
    font-weight: 600;
    text-decoration: none;

    transition: color var(--transition-fast);
}

.nav-links a::after {
    content: "";

    position: absolute;
    right: 0;
    bottom: -7px;
    left: 0;

    height: 2px;

    /* Black underline instead of coral. */
    background: #000000;
    border-radius: 999px;

    transform: scaleX(0);
    transform-origin: center;

    transition: transform var(--transition-fast);
}

.nav-links a:hover {
    /* Darker and bolder when hovered. */
    color: #000000;
    font-weight: 700;
}

.nav-links a:hover::after {
    transform: scaleX(1);
}

.nav-links a:focus-visible {
    color: #000000;
    font-weight: 700;

    outline: 3px solid rgba(0, 0, 0, 0.2);
    outline-offset: 8px;

    border-radius: 4px;
}

.nav-links a:focus-visible::after {
    transform: scaleX(1);
}


/* =========================================================
   GET THE APP BUTTON
   ========================================================= */

.header-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: end;

    min-width: 170px;
    min-height: 56px;
    padding: 14px 28px;

    background: var(--color-primary);
    border-radius: var(--button-radius);

    color: var(--color-text-light);

    font-size: 16px;
    font-weight: 600;
    text-decoration: none;

    box-shadow:
        0 10px 25px rgba(255, 107, 107, 0.22);

    transition:
        background-color var(--transition-fast),
        box-shadow var(--transition-fast),
        transform var(--transition-fast);
}

.header-download-btn:hover {
    background: var(--color-primary-hover);

    box-shadow:
        0 14px 30px rgba(255, 107, 107, 0.3);

    transform: translateY(-2px);
}

.header-download-btn:active {
    transform: translateY(0);
}

.header-download-btn:focus-visible {
    outline: 3px solid rgba(255, 107, 107, 0.3);
    outline-offset: 4px;
}

/* =========================================================
   MOBILE MENU BUTTON
   ========================================================= */

.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    justify-self: end;
    gap: 5px;

    width: 46px;
    height: 46px;
    padding: 0;

    background: transparent;
    border: 0;
    border-radius: 50%;

    cursor: pointer;
}

.mobile-menu-btn span {
    display: block;

    width: 22px;
    height: 2px;

    background: var(--color-deep-ocean);
    border-radius: 999px;

    transition:
        opacity var(--transition-fast),
        transform var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: var(--color-surface-elevated);
}

.mobile-menu-btn:focus-visible {
    outline: 3px solid rgba(255, 107, 107, 0.3);
    outline-offset: 3px;
}

/* =========================================================
   MOBILE NAVIGATION
   ========================================================= */

.mobile-navigation {
    display: none;
}

/* Displayed when JavaScript removes the hidden attribute. */
.mobile-navigation:not([hidden]) {
    display: flex;
}

/* =========================================================
   SMALL LAPTOPS AND TABLETS
   ========================================================= */

@media (max-width: 1100px) {
    .navbar {
        grid-template-columns: 280px 1fr 175px;
        gap: 20px;
    }

    .logo {
        width: 255px;
        max-width: none;
        height: auto;
    }

    .nav-links {
        gap: 22px;
    }

    .nav-links a {
        font-size: 17px;
    }

    .header-download-btn {
        min-width: 145px;
        min-height: 50px;
        padding: 12px 20px;

        font-size: 14px;
    }
}

/* =========================================================
   MOBILE HEADER
   ========================================================= */

@media (max-width: 760px) {
    .header {
        min-height: 76px;
        padding: 0 var(--page-padding);
    }

    .navbar {
        display: flex;
        align-items: center;
        justify-content: space-between;

        min-height: 76px;
    }

    .logo {
        width: 210px;
        max-width: 210px;
        height: auto;
    }

    .nav-links,
    .header-download-btn {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .mobile-navigation {
        position: absolute;
        z-index: 120;

        top: 76px;
        right: 0;
        left: 0;

        align-items: stretch;
        flex-direction: column;
        gap: 4px;

        padding: 18px var(--page-padding) 24px;

        background: var(--color-surface);
        border-top: 1px solid var(--color-border);

        box-shadow:
            0 18px 35px rgba(15, 75, 95, 0.12);
    }

    .mobile-navigation a {
        display: block;

        padding: 13px 0;

        color: var(--color-text);

        font-size: 15px;
        font-weight: 500;
        text-decoration: none;

        transition: color var(--transition-fast);
    }

    .mobile-navigation a:hover,
    .mobile-navigation a:focus-visible {
        color: #000000;
        font-weight: 700;
        text-decoration: underline;
        text-decoration-thickness: 2px;
        text-underline-offset: 5px;
    }
}

/* =========================================================
   SMALL MOBILE HEADER
   ========================================================= */

@media (max-width: 420px) {
    .header {
        min-height: 70px;
    }

    .navbar {
        min-height: 70px;
    }

    .logo {
        width: 180px;
        max-width: 180px;
        height: auto;
    }

    .mobile-menu-btn {
        width: 42px;
        height: 42px;
    }

    .mobile-navigation {
        top: 70px;
    }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    .header {
        transition: none;
    }
}