:root {
    --primary-background: #fff;
    --primary-color: #000;
    --secondary-background: #36435a;
    --secondary-color: #fff;
    --tertiary: #7bacd5;

    --pop-background: #015eb7;
    --pop-color: #fff;

    --nav-button-background: rgba(255, 255, 255, 0.1);
    --nav-button-background-hover: rgba(255, 255, 255, 0.2);
    --nav-button-color: rgba(255, 255, 255, 0.9);
    --nav-button-active: var(--pop-background);

    --action-button-background: #da2a1c;
    --action-button-background-hover: #ef3f2f;
    --action-button-color: #fff;

    --disabled-background: #e0e0e0;

    --shadow: 0 5px 10px rgba(0, 0, 0, 0.3);

    --table-stripe-1: #efefef;
    --table-stripe-2: #e0e0e0;
    --table-stripe-3: #d9d9d9;
    --transparent-white: rgba(255, 255, 255, 0.8);

    --length-unit: 8px;

    --light-blue: #7bacd5;
    --dark-blue: #015eb7;
    --red: #da2a1c;
    --light-red: #ef3f2f;
    --orange: #ff9e15;
    --dark-orange: #ef8e05;
    --white: #ffffff;
    --more-transparent-white: rgba(255, 255, 255, 0.5);
    --body-colour: #36435a;
    --light-grey: #efefef;
    --less-light-grey: #e0e0e0;
    --transparent-grey: rgba(240, 240, 240, 0.7);
}

body {
    margin: 0;
    padding: 0;
    font-family: Helvetica, sans-serif;
}

body > header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--body-colour);
    border-top: 8px solid var(--dark-blue);
    border-bottom: 8px solid var(--dark-blue);
    padding: 1rem;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
    font-size: 120%;
}

.header-nav {
    display: flex;
    flex: 1;
    gap: 1rem;
    align-items: center;
    overflow: clip;

    & > span {
        flex-grow: 0;
        height: 100px;
        width: 180px;
        background: white;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        transform: rotate(-4deg) translate(0, 20px);

        & img {
            transform: rotate(4deg);
        }
    }

    & > div {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        flex: 1;

        & > div {
            flex-grow: 0;
            display: flex;
            flex-direction: column;
        }

        nav {
            flex: 1;

            ul {
                list-style: none;
                padding: 0;
                margin: 0;
                display: flex;
                justify-content: center;
                align-items: center;
                gap: 0.5rem;

                li {
                    font-size: 100%;

                    a {
                        display: inline-block;
                        min-width: 6rem;
                        text-decoration: none;
                        padding: 0.6rem 1rem;
                        margin: 0.75rem 0;
                        background: #4b566b;
                        color: rgba(255, 255, 255, 0.9);
                        border: 2px solid transparent;
                        border-radius: 8px;
                        text-align: center;
                        transition: background-color 300ms ease-in-out;

                        &:hover {
                            background: #222;
                            border: 2px solid var(--dark-blue);
                        }
                    }

                    &.active a {
                        background: var(--dark-blue);
                    }

                    &:first-child {
                        position: relative;

                        ul {
                            position: absolute;
                            top: 3.6rem;
                            left: -8px;
                            display: none;
                            z-index: 1000;
                            background: rgba(255, 255, 255, 0.5);
                            padding: 4px 8px;
                            border-radius: 8px;

                            li a {
                                margin: 0.2rem 0;
                            }
                        }

                        &:hover ul {
                            display: block;
                        }
                    }
                }
            }
        }

        h1 {
             flex-grow: 0;
             font-size: 160%;
             letter-spacing: 2px;
             color: var(--white);
             margin: 0;
         }

        h2 {
              flex-grow: 0;
              font-size: 100%;
              color: var(--light-blue);
              margin: 4px 0 1rem;

              & a {
                  color: inherit;
                  font-size: 100%;

                  &:hover {
                      color: var(--white);
                  }
              }
          }
    }
}

main {
    margin: 2rem 4rem;
}

main > header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    span {
        display: flex;
        gap: 0.5rem;
    }
}

.cards-list-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 0.5rem;
    .cards-list-filters-select {
        display: flex;
        gap: 0.5rem;
    }
}

.item-list {
    width: 100%;
    overflow: scroll;
    border-collapse: collapse;
}

.item-list th {
    background: var(--pop-background);
    color: var(--pop-color);
    padding: 1rem;
    text-align: left;
}

.item-list th:first-child {
    border-radius: var(--length-unit) 0 0 0;
}

.item-list th:last-child {
    border-radius: 0 var(--length-unit) 0 0;
}


.tags-list-wrapper {
    display: flex;
    gap: 2rem;
}
.tags-list-filters {
    min-width: 20rem;
}
.tags-list {
    flex: 1;
}
.tags-list .pagination {
    margin: 1rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    font-size: 100%;
    background: var(--action-button-background);
    color: var(--action-button-color);
    border: none;
    border-radius: var(--length-unit);
    transition: background-color 300ms ease-in-out;
}

.btn:hover {
    cursor: pointer;
    background: var(--action-button-background-hover);
}

.btn:disabled {
    cursor: not-allowed;
    background: var(--disabled-background);
}


label {
    display: block;
    margin: 1rem 0 6px;
    &[hidden] {
        display: none;
    }
}
select {
    font-size: 140%;
    min-width: 50%;
}


.images-grid {
    --min-card-width: 400px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(var(--min-card-width), 100%), 1fr));
    gap: 8px;
    margin: 1rem 1.5rem 80px;
}
.images-grid img {
    max-width: 100%;
}

.tab-panels {
    position: relative;
    display: flex;
    .tab {
        position: absolute;
        width: 100%;
        box-sizing: border-box;
        &:not(.invisible) {
            position: initial;
        }
    }
}
.tab-buttons {
    display: flex;
    margin: 2rem 0;
    padding: 0.5rem 0;
    list-style: none;
    border-bottom: 1px solid silver;
    gap: 0.2rem;
    button {
        font-size: 1rem;
        padding: 0.2rem 0.5rem;
        min-width: 6rem;
    }
}
.core-fields {
    display: flex;
    gap: 2rem;
}
fieldset {
    border: none;
    padding: 0;
}

bst-tag-picker button svg {
    width: 1em;
    height: 1em;
}
bst-tags-picker ul {
    margin: 0;
    padding: 0;
    list-style-type: none;
    display: flex;
    flex-wrap: wrap;
    gap: 2%;
}
.tags {
    flex: 1;
    padding: 1rem 2rem 2rem;
}
.tags ul:has(.card-tag-picker) {
    flex-direction: column;
    list-style: none;
}
.tags li {
    flex-basis: 48%;
    background: var(--white);
    margin-bottom: 0.5rem;
    border: 1px solid var(--less-light-grey);
    border-radius: var(--length-unit);
}
.tags li:has(.card-tag-picker) {
    flex-basis: 100%;
    max-width: 20rem;
    display: flex;
    padding: 4px;
}

bst-tag-picker {
    width: max-content;
    display: flex;
    padding: 2px;
    border: 1px solid silver;
    border-radius: 8px;
    margin-bottom: 8px;
}
.card-tag-picker {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    width: 12rem;
}
.card-tags-picker .suggested-tags {
     margin-top: 2rem;
 }

.card-tags-picker li button {
    font-size: 100%;
    width: 2em;
    border: none;
    border-radius: 8px;
    background-color: #eee;
    margin-left: 2px;
    &:hover {
        cursor: pointer;
        background-color: #ccc;
    }
}
.card-tags-picker p button {
    font-size: 100%;
    padding: 0.5rem 1rem;
    border: 2px solid #ccc;
    border-radius: 8px;
    background-color: #eee;
    margin: 8px 8px 0 0;
    &:hover {
        cursor: pointer;
        background-color: #ccc;
    }
}

.tags li label {
    display: flex;
    padding: 0.75rem;
    align-items: center;
    margin: 0;
}

.tags li label:hover {
    cursor: pointer;
}
.image-tabs {
    position: relative;
    display: flex;
    .image-tab {
        position: absolute;
        &:not(.invisible) {
            position: initial;
        }
    }
}
.image-tab.image-current {
    width: 100%;
    display: flex;
    margin: 1rem 1rem 2rem;
    gap: 1rem;
    .card {
        width: 50%;
    }
    table {
        width: 46%;
        border-collapse: collapse;
        th, td {
            padding: 0.5rem 1rem;
            border: 1px solid silver;
            text-align: left;
        }
    }
    .card, .card-body, .card-image-wrapper {
        border-radius: 16px;
    }
    img {
        border-radius: 0 0 16px 16px;
    }
}

form.cards {
    padding-bottom: 4rem;
}
.image-tab-switch {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    label {
        display: inline;
    }
}

.card-main.image-only {
    border-radius: 0 0 16px 16px;
}
.image-picker-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    width: 100%;
}
.image-gallery {
    width: 100%;
}

.card {
    width: 100%;
    max-width: 1200px;
    height: 100%;
    min-height: 400px;
    border-radius: 1rem;
    display: grid;
    grid-template-rows: min-content 1fr min-content;
    margin: 0 auto;
    font-family: "Helvetica Neue", sans-serif;
    button {
        opacity: 0.7;
        &:hover {
            opacity: 1;
            cursor: pointer;
        }
    }
}
.card-header {
    background: #015fb7;
    border-radius: 1rem 1rem 0 0;
    display: grid;
    grid-template-columns: 3em 1fr 3em;
    place-items: center;
    font-size: 1em;
    color: white;
    padding: 0.5rem;
    h3 {
        margin: 0;
        text-align: center;
        line-height: 1.2;
        font-weight: normal;
    }
    svg {
        fill: white;
        height: 1em;
        width: 1em;
    }
}
.card-main {
    background-image: linear-gradient(200deg,#36435a 0%,#7bacd5 0%,#015eb7 100%);
    background-position: 50% 50%;
    background-repeat: no-repeat;
    background-size: cover;
    width: 100%;
    font-size: 2rem;
    line-height: 1.2;
    display: grid;
}
.card-main-image {
    grid-column: 1/-1;
    grid-row: 1/-1;
}
.card-main-backdrop {
    grid-column: 1/-1;
    grid-row: 1/-1;
    background: black;
    opacity: 0.5;
    z-index: 1;
}
.card-main-text {
    box-sizing: border-box;
    grid-column: 1/-1;
    grid-row: 1/-1;
    padding: 1rem 2rem;
    display: grid;
    height: 100%;
    width: 100%;
    z-index: 2;
    justify-content: center;
    align-content: center;
    gap: 1rem;
}
.card-text-1, .card-text-2 {
    padding: 0.5rem 1rem;
    background: white;
    color: #112131;
    border-radius: 1rem;
}
.card-footer {
    background: #eee;
    border-radius: 0 0 1rem 1rem;
    display: grid;
    grid-template-columns: 3em 1fr 3em;
    place-items: center;
    font-size: 1em;
    padding: 0.5rem;
    .icon-button {
        color: #112131;
        border-color: #112131;
        svg {
            fill: #112131;
        }
    }
}

.icon-button {
    height: 2em;
    width: 2em;
    font: inherit;
    font-size: 1em;
    background: none;
    color: white;
    border: 1px solid white;
    border-radius: 1em;
    display: grid;
    place-items: center;
}
.icon-button:first-child {
    justify-self: start;
}
.icon-button:last-child {
    justify-self: end;
}
.card-control-buttons button {
    font-size: 1em;
    padding: 0.2rem 0.5rem;
    background: none;
    border: 1px solid #112131;
    border-radius: 0.5rem;
}

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