/*
 * Theme Name: YMCA National Media Location Finder
 * Description: National Media Campaign Association location landing page, based on Timber.
 * Author: Outpost379
*/

:root {
    --wrapper-padding: 2rem;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: "Calibri", "Arial", sans-serif;
    line-height: 1.25;
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
}

p {
    white-space: pretty;
}

a {
    color: #666;
}

a:hover,
a:focus {
    color: #cc0130;
}

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

.pill-btn {
    --height: 2rem;

    background: #cc0130;
    color: #fff;
    appearance: none;
    font: inherit;
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--height);
    border-radius: var(--height);
    padding: 0 1.25em;
    box-sizing: border-box;
}

.pill-btn.-clear {
    border: 1px solid currentColor;
    background: transparent;
}

.pill-btn.-alt {
    background: #d9d9d9;
    color: #000;
}

.pill-btn:not(.search-field button):hover,
.pill-btn:not(.search-field button):focus {
    background: #000;
    color: #fff;
}

.pill-btn.-clear.-clear:hover,
.pill-btn.-clear.-clear:focus {
    background: #fff;
    color: #000;
}

.wrapper {
    max-width: 68rem;
    padding-inline: var(--wrapper-padding);
    margin-inline: auto;
}

.hide-visually {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.toggle-nav {
    appearance: none;
    background-color: transparent;
    border: none;
    width: 1.8rem;
    height: 1.8rem;
}

body[data-show-nav="true"] .toggle-nav,
.close-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='1 2 22 21' fill='%23fff'%3e%3cpath d='M0 0h24v24H0V0z' fill='none'/%3e%3cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z'/%3e%3c/svg%3e");
}

body:not([data-show-nav="true"]) .toggle-nav,
.mobile-nav-icon {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='%23fff' stroke-width='4' stroke-linecap='square' stroke-miterlimit='8' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

/* --- header --*/

.top-bar {
    background: #cc0130;
    color: #fff;
    padding-block: 0.75rem;
    position: relative;
}

.top-bar {}

.top-bar .wrapper {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.top-bar.-mobile {
    align-items: center;
}

.top-bar h1 {
    margin: 0;
    font-weight: normal;
    font-size: 1.6rem;
}

.nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

.nav.-mobile ul {
    flex-direction: column;
    width: 100%;
    border-top: 1px solid #000;
    padding-block: 0.75rem;
    box-shadow: 0 2rem 1.9rem -2rem rgba(0,0,0,0.6);
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    z-index: 2;
    background: #cc0130;
}

body:not([data-show-nav="true"]) .nav.-mobile ul {
    display: none;
}

.nav ul a {
    display: block;
    text-decoration: none;
    color: inherit;
    text-align: center;
    padding: 0.5rem;
    margin-block: -0.25rem;
}

.nav a:hover,
.nav a:focus {
    text-decoration: underline;
}

.nav.-mobile ul a {
    text-transform: uppercase;
    font-size: 1.2rem;
    padding: 1rem;
}

.nav.-top ul {
    color: #fff;
    justify-content: flex-end;
    text-transform: uppercase;
    font-size: 1.125rem;
    gap: 1vw;
}

.nav.-main {
    background: rgb(76 76 76);
    color: #fff;
    font-size: 1.125rem;
    text-transform: uppercase;
    padding-block: 0.75rem;
}

.nav.-main .wrapper {
    display: flex;
}

.nav.-main ul {
    align-items: center;
    flex: 1;
    justify-content: end;
}

.nav.-main .spacer {
    flex: 1;
    width: 100%;
    min-width: 1rem;
    max-width: 6.75rem;
}

.nav.-main ul a {
    width: max-content;
}

.y-logo img {
    display: block;
    width: 2.5rem;
    height: auto;
}

/* --- Masthead --- */

.masthead {
    --pad-top: 1.5rem;
    --pad-bottom: 2rem;

    background: #000;
    padding-block: var(--pad-top) var(--pad-bottom);
    color: #fff;
}

.masthead .wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
}

.masthead-image {
    display: block;
    margin-block: calc(var(--pad-top) * -1) calc(var(--pad-bottom) * -1);
    margin-right: calc(var(--wrapper-padding) * -1);
    /* min-height: 100%; */
    width: calc(100% + var(--wrapper-padding));
    aspect-ratio: 80/45;
    height: auto;
}

.masthead h2 {
    font-size: 2.4rem;
    margin: 0 0 1rem;
    text-wrap: balance;
    line-height: 1;
}

html[lang="fr-CA"] .masthead h2 {
    font-size: 2.1rem;
    line-height: 1;
}

.masthead p {
    margin: 0 0 1.5rem;
    text-wrap: pretty;
}

.search-field {
    background: #fff;
    display: flex;
    box-shadow: 0 0 0 1px inset #cc0130;
    height: 2.4rem;
    border-radius: 1.2rem;
    padding: 0.2rem 1rem;
    box-sizing: border-box;
    align-items: stretch;
    position: relative;
}

.search-field input {
    appearance: none;
    border: none;
    background: transparent;
    flex: 1;
    display: flex;
}

.search-field input:focus {
    outline: none;
}

.search-field:focus-within {
    box-shadow: 0 0 0 1px inset #cc0130, 0 0 0 1px #cc0130;
}

.search-field button {
    margin: -0.2rem -1rem -0.2rem 0;
    background: url('./static/search-icon.svg') center no-repeat #cc0130;
    background-size: 1.125rem;
    width: 4rem;
    border-radius: calc(1.2rem - 1px);
    height: auto;
}

.search-field button:focus-visible,
.search-field button:hover {
    outline: none;
    box-shadow: 0 0 0 1px inset #cc0130, 0 0 0 2.5px inset #fff, 0 0 0 1px #cc0130;
}

.use-location {
    color: #fff;
    margin-top: 2rem;
}

.error {
    position: absolute;
    padding-inline: 1rem;
    margin-top: 0.125rem;
    color: #cc0130;
    font-weight: bold;
    display: none;
    top: 100%;
}

/* --- Body -- */

.body {
    flex: 1;
    padding: 1.25rem 0;
    font-size: 1.1rem;
}

.main-copy a:not(.pill-btn) {
    color: #cc0130;
    text-decoration: underline;
    font-weight: bold;
}

.main-copy h2 {
    margin-bottom: 0;
    font-size: 1.25rem;

    & + p {
        margin-top: 0.2rem;
    }
}

.main-copy[data-show-search="true"] .home,
.main-copy:not([data-show-search="true"]) .search-results {
    display: none;
}

.col {
    display: grid;
    gap: 2rem;
}

.c-3-1 {
    grid-template-columns: 1fr max-content;
}

/* --- Listings --- */

.location-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.location-result {
    display: grid;
    grid-template-columns: 1fr max-content;
    padding-block: 2rem;
    gap: 2rem;

    li:first-child & {
        padding-top: 0.25rem;
    }
}

.location-list > li + li {
    border-top: 1px solid #000;
}

.location-list > li:nth-child(3) ~ li {
    display: none;
}

.location-name {
    color: #cc0130;
    font-size: 2.4rem;
    margin: 0 0 0.25em;
    white-space: balance;
    line-height: 1;
}

.location-distance {
    color: #888;
    margin-bottom: 0.5rem;
}

.location-province {
    font-weight: bold;
}

.location-features {
    --icon-size: 2rem;

    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    display: flex;
    gap: 0.5rem;
}

.location-features li {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.location-features li::before {
    content: "";
    display: block;
    flex: none;
    width: var(--icon-size);
    height: var(--icon-size);
    background: #000;
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    z-index: -1;
}

.location-features li img {
    display: block;
    width: var(--icon-size);
    height: var(--icon-size);
}

.location-actions {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.location-actions a,
.location-actions button {
    width: 100%;
    text-decoration: none;
}

[lang="fr-CA"] .view-details {
    max-width: 18rem;
    height: auto;
    text-align: center;
    white-space: balance;
    line-height: 1.1;
    padding: 0.35rem;
}

/* --- Footer -- */

.footer {
    display: grid;
    grid-template-areas:
        "social logo"
        "legal logo";
    grid-template-columns: 1fr 1fr;
    padding-block: 2.5rem 1.5rem;
    gap: 1.5rem;
    font-size: 0.9rem;
}

.footer-group {
    background: #cc0130;
    color: #fff;
}

.nav.-footer {
    background: #8c1818;
    padding-block: 0.5rem;
}

.nav.-footer ul {
    gap: 2vw;
    justify-content: center;
}

.nav.-footer a {
    margin-block: 0;
}

.nav.-social {
    grid-area: social;
}

.nav.-social ul {
    gap: 0.5rem;
}

.nav.-social a {
    font-size: 1rem;
    width: 1rem;
    height: 1rem;
    text-align: center;
    text-decoration: none;
    border-radius: 50%;
    background-color: #fff;
    color: #cc0130;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.legal {
    grid-area: legal;
}

.legal p {
    margin-top: 0;
    margin-bottom: 0.25rem;
}

.foot-logo {
    grid-area: logo;
    display: flex;
    align-items: start;
    justify-content: end;
}

.foot-logo img {
    width: 50%;
    max-width: 220px;
    height: auto;
    margin-top: -3%;
}

/* --- Popover --- */

.popover {
    margin-inline: auto;
    width: 96%;
    max-width: 50rem;
    border: none;
    border-radius: 1.5rem;
    padding: calc(1vw + 1.5rem) calc(2vw + 1rem);
    box-shadow: 0 0 3rem rgba(0,0,0,0.3);
    box-sizing: border-box;
}

.popover::backdrop {
    background: rgba(0,0,0,0.6);
}

.popover-header {
    display: grid;
    grid-template-columns: 3fr max-content;
    margin-right: 2rem;
}

.popover .close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 2rem;
    height: 2rem;
    background-color: #000;
    background-size: 65%;
    background-repeat: no-repeat;
    background-position: center;
    appearance: none;
    border: none;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.popover h2 {
    color: #cc0130;
    font-size: 2rem;
    margin-block: 0 0.25rem;
    white-space: balance;
    line-height: 0.9;
}

.popover h3 {
    color: #cc0130;
    margin-block: 0 0.25rem;
}

.popover p {
    margin-block: 0 1.5rem;
}

.popover .province {
    text-transform: uppercase;
}

.popover .location-features {
    --icon-size: 2.4rem;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.popover .location-features li {
    width: calc(50% - 2rem);
    font-weight: bold;
}

@media screen and (width > 68rem) {
    .masthead-image.-mobile {
        display: none;
    }

    .mobile-nav-break {
        display: none !important;
    }
}

@media screen and (width <= 68rem) {

    .search-results {
        margin-top: 2rem;
    }

    .desktop-nav-break {
        display: none !important;
    }

    .masthead {
        padding: 0;
        background: #fff;
    }

    .masthead .wrapper {
        grid-template-columns: 1fr;
        grid-template-areas: "masthead" "content";
        padding: 0;
    }

    .masthead .content {
        display: grid;
        grid-template-columns: subgrid;
        grid-template-rows: subgrid;
        grid-row: 1/-1;
        grid-column: 1;
        background: transparent;
    }

    .masthead-image {
        grid-area: masthead;
        margin: 0;
        width: 100%;
        grid-column: 1;
    }

    .masthead-image.-desktop {
        display: none;
    }

    .masthead .tagline {
        grid-area: masthead;
        z-index: 1;
        align-self: center;
        justify-self: center;
        text-align: center;
        font-size: calc(1rem + 4vw) !important;
        text-shadow: 0 0 4px rgba(0,0,0,0.6), 0 0 20px #000;
    }

    .masthead .instructions {
        padding: var(--wrapper-padding) var(--wrapper-padding) 0;
        grid-area: content;
        background: #fff;
        color: #000;
        text-align: center;
    }

    .masthead .instructions p {
        padding-inline: 0.75rem;
    }

    .masthead .instructions strong {
        font-size: 1.25rem;
    }

    .masthead .pill-btn.-clear {
        background: #cc0130;
        color: #fff;
        border: none;
        margin-inline: auto;

        &:hover,
        &:focus {
            background: #000;
            color: #fff;
        }
    }

    .body .wrapper,
    .instructions {
        max-width: 42rem;
        margin: auto;
    }
}

@media screen and (width <= 48rem) {

    .location-result {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .location-features {
        margin-inline: auto;
        flex-wrap: wrap;
        justify-content: center;
    }

    .location-actions {
        width: max-content;
        margin: 0 auto;
    }

    .location-name {
        margin-bottom: 0.25rem;
    }

    .location-serving {
        margin-top: 0.25rem;
        line-height: 1;
    }

    .location-serving .where {
        display: block;
    }

    .location-list + .pill-btn {
        /* display: block; */
        margin-inline: auto !important;
    }

    .popover {
        margin: 1rem auto 0;
        max-height: calc(100vh - 2rem);
        max-height: calc(100dvh - 2rem);
    }

    .popover-header {
        grid-template-columns: 1fr;
        gap: 2rem;

        & img {
            grid-row: 1;
            align-self: center;
        }
    }

    .popover .location-features {
        width: 100%;
    }

    .popover .location-features li {
        width: 100%;
    }

    .footer {
        display: block;
        text-align: center;
    }

    .nav.-social ul {
        margin: 0 auto 1.5rem;
        width: min-content;
    }

    .foot-logo {
        margin: 2rem auto 0.5rem;
        text-align: center;
        display: inline-block;
    }

    .foot-logo img {
        width: 10rem;
    }
}

@media screen and (width <= 48rem) {
    .col {
        display: block;
    }

    .shine-logo {
        text-align: center;
        margin-top: 2rem;
    }

    [lang="fr-CA"] .search-results a:last-child {
        max-width: 18rem;
        height: auto;
        text-align: center;
        white-space: balance;
        line-height: 1.1;
        padding: 0.35rem;
    }
}