/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

/* Pigeon - the top bar

   The logo, the pages and a button. Finishing touches chooses how it
   sits ( styleTopBar() in site-style.php works out the colours ):

     .top-bar-solid  a bar of its own colour above the banner
     .top-bar-over   no bar - laid over the top of the banner's photo

   Desktop ( 1200px and up ): logo | pages | button, the pages spread
   across the middle. Smaller: button | logo | menu, and the pages open in
   a panel under the bar, on the right, pushing the page down ( over the
   photo: covering it ). */

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

.top-bar {
    display: grid;
    position: relative;
    z-index: 5;

    background-color: transparent;
}

/* over the photo: out of the flow, on top of the banner */
.top-bar-over {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
}

.nav-container {
    display: grid;
    /* the button and the menu take what they need, the logo sits in the
       middle of what is left - a long button never runs into it */
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-gap: 12px;
    align-items: center;

    width: min(100%, 1440px);
    justify-self: center;
    padding: 16px 20px;
    box-sizing: border-box;
}

/* - the logo - */

.logo-container {
    display: grid;
    min-width: 0;
    max-width: 150px;
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    align-self: center;
}

.logo {
    display: block;
    max-width: 100%;
    max-height: 100px;
    width: auto;
    height: auto;
}

/* - the button - */

.nav-button {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    font-family: "filson-soft", sans-serif;
    font-weight: 800;
    font-style: normal;
    padding: 10px 18px;
    box-sizing: border-box;

    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1.2;
    text-decoration: none;
    text-transform: uppercase;
    white-space: nowrap;
    color: #ffffff;

    background-color: #4c72ec;
    border: solid 2px #4c72ec;
    border-radius: 24px;

    /* the same pill and spring as the page's buttons - filled here, as
       the bar's one call to action, and an outline on hover */
    transition: color .33s ease, background-color .33s ease, border-color .33s ease, transform .33s cubic-bezier(.175, .885, .32, 1.275);
}

.nav-button:hover {
    transform: scale(1.06);

    color: #ffffff;

    background-color: transparent;
    border-color: #ffffff;
}

@media(prefers-reduced-motion: reduce) {
    .nav-button:hover {
        transform: none;
    }
}

/* - the menu button - */

.nav-toggle {
    display: grid;
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    place-items: center;

    width: 44px;
    height: 44px;
    padding: 0;

    font-size: 24px;
    color: #ffffff;

    background: none;
    border: none;
    cursor: pointer;
}

.nav-toggle .nav-icon {
    grid-row: 1;
    grid-column: 1;
}

.hide-icon {
    display: none;
}

/* - the pages - */

.link-container {
    display: none;
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: end;
    grid-gap: 18px;

    min-width: 220px;
    margin-right: -20px;
    padding: 24px 28px 28px;
    box-sizing: border-box;

    text-align: right;

    background-color: #4d4c4c;
}

.show-nav {
    display: grid !important;
}

.page-link {
    justify-self: end;
    font-family: "filson-soft", sans-serif;
    font-weight: 800;
    font-style: normal;
    text-decoration: none;
    text-transform: uppercase;
    color: #ffffff;

    border-bottom: solid 2px transparent;

    transition: ease color .2s, border-color .2s;
}

.page-link p {
    margin: 0;
    font-family: "filson-soft", sans-serif;
    font-weight: 800;
    font-style: normal;
    font-size: 19px;
    line-height: 1.4;
    color: inherit;
}

.page-link:hover,
.page-link.active-link {
    color: #4c72ec;
}

/* the page you are on is underlined too - it still shows when the
   accent cannot be used on the bar */
.page-link.active-link {
    border-bottom-color: currentColor;
}

@media(max-width: 479px) {
    .nav-container {
        padding: 12px 15px;
    }

    .logo-container {
        max-width: 110px;
    }

    .logo {
        max-height: 48px;
    }

    .nav-button {
        padding: 8px 12px;

        font-size: 12px;
    }

    .link-container {
        margin-right: -15px;
    }
}

@media(max-width: 359px) {
    .nav-container {
        grid-gap: 8px;
        padding: 12px 10px;
    }

    .logo-container {
        max-width: 92px;
    }

    .nav-button {
        padding: 7px 9px;

        font-size: 11px;
        letter-spacing: .5px;
    }

    .nav-toggle {
        width: 36px;
    }

    .link-container {
        margin-right: -10px;
    }
}

/* - desktop: logo | pages | button - */

@media(min-width: 1200px) {
    .nav-container {
        grid-template-columns: auto 1fr auto;
        grid-gap: 24px;
        padding: 18px 32px;
    }

    .logo-container {
        grid-column: 1;
        justify-self: start;
        max-width: 200px;
    }

    .logo {
        max-height: 120px;
    }

    .link-container,
    .link-container.show-nav {
        display: grid !important;
        grid-column: 2;
        grid-row: 1;
        grid-auto-flow: column;
        justify-content: center;
        justify-self: stretch;

        /* kept fairly tight so five links with longer names stay on one
           line at full width ( the bar stops at 1440px ) - more or longer
           ones wrap to two */
        grid-gap: 20px;

        min-width: 0;
        margin: 0;
        padding: 0;

        text-align: center;

        background: none;
    }

    .page-link {
        justify-self: center;

        color: #ffffff;
    }

    .page-link:hover,
    .page-link.active-link {
        color: #ffffff;
    }

    .page-link p {
        font-size: 20px;
    }

    .nav-button {
        grid-column: 3;
        justify-self: end;
        padding: 12px 22px;

        font-size: 15px;
    }

    .nav-toggle {
        display: none;
    }
}
