﻿:root {
    --width-article: 700px;
}

div.directory {
    &.search {
        & div.header {
            position: relative;
            background-color: var(--color-dark-blue);
            background-image: url(../content/common/default-header.png);
            background-repeat: no-repeat;
            background-position: center;
            background-size: cover;
    
            min-height: 250px;
            min-width: 100%;
            padding: 2rem 1rem;
            padding-bottom: calc(1rem + 5px);
    
            display: grid; 
            align-content: center;
            align-items: center;
            padding: 1rem;
    
            margin-bottom: 10px;
        
            & div.titles {
                position: relative;
                z-index: 5;
    
                & span {
                    display: block;
                    text-align: center;
                    color: var(--color-whitish);
    
                    &.title {
                        font-family: var(--fonts-serif);
                        font-size: 2rem;
                        font-weight: bold;
                        text-transform: uppercase;
                        text-shadow: 0px 0px 5px #000000;
                    }
    
                    &.sub-title {
                        font-family: var(--fonts-serif);
                        font-size: .8rem;
                        font-weight: bold;
                        text-shadow: 0px 0px 5px #000000;
                    }
                }
            }
    
            &::after {
                content: '';
                background-color: var(--color-whitish);
                position: absolute;
                bottom: -5px;
                width: 75vw;
                left: 50%;
                transform: translateX(-50%);
                height: 10px;
            }
        }

        & div.host {
            margin-left: max(1rem, 12.5vw);
            margin-right: max(1rem, 12.5vw);

            & div.intro {
                margin-top: 3rem;
                margin-bottom: 3rem;

                & div:first-child {
                    color: var(--color-dark-blue);
                    font-family: var(--fonts-serif);
                    font-size: 1.5rem;
                    font-weight: bold;
                    margin-bottom: 1rem;
                }

                & div:not(:first-child) {
                    color: var(--color-dark-blue);
                    font-family: var(--fonts-sans-serif);
                    font-size: 1em;
                }
            }

            & div.filters {
                margin-top: 3rem;
                margin-bottom: 2rem;

                & div.toggle {
                    color: var(--color-links);
                    padding: .5rem;
                    border: solid 1px var(--color-links);
                    font-weight: bold;
                    position: relative;

                    & b.arrow {
                        content: "▲";
                        position: absolute;
                        right: .75em;
                    }
                }

                & div.fields {
                    background: var(--color-whitish);
                    padding: .5rem;
                    display: flex;
                    flex-wrap: wrap;
                    justify-content: space-evenly;
                    gap: 1rem;

                    & * {
                        color: var(--color-dark-blue);
                        font-size: .9rem;
                    }

                    & div.field {
                        flex-grow: 1;
                        display: grid;
                        grid-auto-flow: row;
                        gap: 5px;
                        position: relative;

                        &[data-field=name] {
                            input[type=text] {
                                padding-right: 30px;
                            }

                            img {
                                height: 17px;
                                width: 17px;
                                position: absolute;
                                right: 5px;
                                bottom: 2px;
                                cursor: pointer;
                            }
                        }
                    }
                }

                & div.letterbar {
                    div {
                        color: darkgray;
                        padding: 4px;
                        border: solid 1px transparent;
                    
                        &[onclick]:not([onclick='']) {
                            cursor: pointer;
                            color: var(--color-links);
                            font-weight: bold;

                            &:hover {
                                text-decoration: underline;
                            }
                        }

                        &.selected {
                            border: solid 1px var(--color-links);
                            border-radius: 2px;
                        }
                    }

                    margin-top: 1rem;
                    margin-bottom: 2rem;
                    padding: .5rem;
                    display: flex;
                    flex-wrap: wrap;
                    justify-content: flex-start;
                    gap: 1rem;                    
                }
            }

            & div.results {
                /* display: flex;
                flex-wrap: wrap;
                justify-content: space-between;
                gap: 1rem;
                margin-bottom: 2rem; */

                display: grid;
                grid-template-columns: repeat(auto-fill, 200px);
                gap: 1rem;
                justify-content: space-around;

                & div.result {
                    width: 200px;

                    & a.image {
                        display: block;
                        width: 100%;
                        aspect-ratio: 1;

                        background-repeat: no-repeat;
                        background-position: center;
                        background-size: cover;
                    }

                    & div.text {
                        padding: 5px;

                        & div.name {
                            color: var(--color-dark-blue);
                            font-weight: bold;
                            font-size: 1rem;
                        }

                        & div.title {
                            margin-top: .5rem;
                            color: var(--color-dark-blue);
                            font-weight: bold;
                            font-size: .8rem;
                        }

                        & div.email {
                            margin-top: .75rem;

                            & * {
                                color: var(--color-orange);
                                font-size: .75rem;
                                font-weight: bold;
                            }
                        }

                        & div.link {
                            padding-top: .75rem;
                            margin-top: .75rem;
                            border-top: solid 1px var(--color-whitish);

                            & * {
                                font-size: .75rem;
                                font-weight: bold;
                            }
                        }
                    }

                    &:hover, &:focus, &:focus-within {
                        box-shadow: var(--box-shadow-hover);
                        border-radius: 5px;
                    }
                }     
                
                &::after {
                   content: '';
                   flex: auto; 
                }
            }
        }
    }

    &.person {
        & div.header {
            margin-inline: auto; 
            max-width: calc(700px + 3rem);
            padding-inline: 1.5rem;
            margin-top: 2.5rem;

            & div.page-title {
                text-align: center;
                color: var(--color-links);
                font-weight: bold;
            }

            & div.name {
                color: var(--color-dark-blue);
                font-family: var(--fonts-serif);
                font-weight: bold;
                font-size: 2rem;
                margin-block: 1.5rem;
            }

            & div.title {
                color: var(--color-dark-blue);
                font-family: var(--fonts-serif);
                font-weight: bold;
                font-size: 1.3rem;
                margin-bottom: 1.5rem;
            }

            & div.profile-image {
                aspect-ratio: 1;
                background-size: cover;
                background-position: center;
                background-repeat: no-repeat;
            }

            & div.contact {
                margin-top: 1.5rem;

                display: grid;
                grid-auto-flow: row;
                grid-template-rows: 1fr 1fr;
                gap: 1rem;
                 
                & div.email {
                    & * {
                        color: var(--color-orange);
                    }
                }

                & div.phone {
                    img {
                        height: .8rem;
                        vertical-align: middle;
                        filter: invert(41%) sepia(52%) saturate(4841%) hue-rotate(165deg) brightness(84%) contrast(94%);                    }
                }
            }
            
            & div.addresses {
                & * {
                    color: var(--color-dark-blue);
                }

                padding: .5rem;

                border: solid 1px var(--color-dark-blue);
                border-radius: 5px;
                margin-block: 1rem;

                & div.address {
                    margin-top: .5rem;
                    padding: .25rem;
                    border-radius: 3px;

                    &:hover {
                        background-color: var(--color-whitish);
                        box-shadow: var(--box-shadow-hover);
                    }
                }
            }

        }

        & div.bio {
            margin-block: 3rem;
            margin-inline: auto; 
            max-width: calc(700px + 3rem);
            padding-inline: 1.5rem;
        }

        & div.links {
            margin-bottom: 3rem;
            margin-inline: auto; 
            max-width: calc(700px + 3rem);
            padding-inline: 1.5rem;

            & b {
                color: var(--color-dark-blue);
            }
        }

        & div.footer {
            & div.details-host {
                & div.details {
                    height: 100%;
                
                    padding: 1.5rem;
                    background-color: var(--color-whitish);
                    display: grid; 
                    grid-auto-flow: column;
                    grid-template-columns: max-content min-content 1fr;
                    gap: 1rem;

                    & * {
                        color: var(--color-dark-blue);
                    }

                    hr {
                        border: none;
                        background: var(--color-dark-blue);
                        width: 1px;
                        margin: 0px;
                    }
                }
            }

            & div.map-host {
                & div.map {
                    cursor: pointer;
                    position: relative;

                    & img {
                        width: 100%;
                    }

                    & div.zoom {
                        background-color: var(--color-whitish);
                        font-size: .75rem;
                        font-weight: bold;
                        font-style: italic;
                        padding: 3px; 
                        border: solid 1px var(--color-dark-blue);
                        border-radius: 3px;
                        
                        position: absolute;
                        left: 5px;
                        bottom: 5px;
                    }
                }
            }
        }

        & dialog#dlgMapZoom {
            position: relative;

            & div {
                background-color: var(--color-whitish);
                border: solid 1px var(--color-dark-blue);
                border-radius: 50vw;
                cursor: pointer;
                position: absolute;
                top: 1rem;
                right: 1rem;
                font-size: 1.25rem;
                text-align: center;
                vertical-align: middle;
                width: 2rem;
                height: 2rem;
            }
        }
    }
}

@media(max-width: 420px) {
    div.directory {
        & div.filters {
            & div.fields {
                & div.field {
                    width: 100%;
                }
            }
        }
    }

}

@media(min-width: 420px) {
    div.directory.search {
        & div.filters {
            & div.toggle {
                display: none;
            }
        }

        & div.results {
            & div.result {
                position: relative;
                max-width: 200px;

                & a.edit-link {
                    position: absolute;
                    bottom: .4rem;
                    right: .75rem;
        
                    & img {
                        width: 2rem;
        
                        transition: all 200ms;
        
                        &:hover {
                            filter: drop-shadow(0px 0px 2px var(--color-dark-blue));
                            rotate: 10deg;
                        }
                    }
                }
            }
        }
    }
}

@media(min-width: 600px) {
    div.directory.person {
        & div.header {
            aspect-ratio: 2/1;
            position: relative;

            & div.content {
                margin-left: calc(50% + 1.5rem);
            }

            & div.page-title {
                text-align: left;
            }

            & div.name {
                margin-top: 3rem;
            }

            & div.profile-image {
                position: absolute;
                top: 0px;
                left: 1.5rem;
                width: calc(50% - 2rem);
            }

            & div.contact {
                grid-auto-flow: column;
                grid-template-columns: 1fr 1fr;
                grid-template-rows: initial;

                & div.phone {
                    & * {
                        color: var(--color-dark-blue);
                    }

                    img {
                        filter: invert(13%) sepia(11%) saturate(5311%) hue-rotate(173deg) brightness(95%) contrast(102%);
                    }
                }
            }
        }
    }
}

@media(min-width: 700px) {
    div.directory.search {
        & div.host {
            width: 75vw;
            margin-right: auto;
            margin-left: auto;
        }
    }

    div.directory.person {
        & div.header {
            & div.page-title {
                text-align: left;
            }

            & div.name {
                margin-top: 3rem;
            }
        }

        & div.footer {
            display: grid;
            grid-template-columns: 1fr 1fr;

            & div.details-host {
                padding-left: calc(50vw - 350px - .5rem);
            }

            & div.map-host {
                padding-right: calc(50vw - 350px - .5rem);
            }
        }
    }
}