:root {
    --light-blue: #7bacd5;
    --dark-blue: #015eb7;
    --red: #c01002;
    --light-red: #ef3f2f;
    --dark-red: #840a00;
    --orange: #ff9e15;
    --dark-orange: #ef8e05;
    --white: #ffffff;
    --transparent-white: rgba(255, 255, 255, 0.9);
    --more-transparent-white: rgba(255, 255, 255, 0.5);
    --body-colour: #36435a;
    --light-grey: #efefef;
    --dark-grey: #cdcdcd;
    --card-font-size: 16px;
    --action-button-background: #cacad3;
    --action-button-background-hover: var(--red);
    --action-button-color: black;
    --action-button-color-hover: white;
}

html {
    height: 100vh;
    background: white;
}

body {
    height: 100%;
    margin: 0;
    padding: 0;
    background: white;
    font-family: Helvetica, sans-serif;
}

[hidden] {
    display: none;
}

select {
    padding: 4px 8px;
    border-radius: 8px;
}

bst-cards {
    background: white;
    overflow: scroll;
}


/* Page Header */

header.header-nav {
    position: relative;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1rem;
    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%;

    @media(max-width: 660px) {
        padding: 1rem 1rem 0.5rem;
    }
    &[hidden] {
        display: none;
    }
}

.staging header.header-nav {
    border-top: 8px solid var(--dark-orange);
}

.header-nav > 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);
    }

    @media(max-width: 660px) {
        display: none;
    }
}

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

.header-nav p {
    flex-grow: 0;
    font-size: 100%;
    color: var(--light-blue);
    margin: 0;
    letter-spacing: 0.8px;
    & a {
        color: inherit;
        font-size: 100%;
        text-decoration: none;

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

.header-nav > div {
    position: relative;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    .mini-stampie {
        display: none;
        height: 50px;
        width: 90px;
        background: white;
        border-radius: 50%;
        justify-content: center;
        align-items: center;
        transform: rotate(-4deg);

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

    @media(max-width: 660px) {
        margin: 0 auto;
        .mini-stampie {
            display: flex;
            position: absolute;
            top: 0.8rem;
            right: 4px;
        }
    }
}

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

.header-nav li 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 {
        border: 2px solid var(--dark-blue);
    }
    @media(max-width: 660px) {
        min-width: 4.5rem;
        padding: 0.3rem 0.9rem;
    }
}


/* Card Display Buttons */

.card-display-controls {
    display: grid;
    grid-template-columns: 2fr 1fr;
    align-items: stretch;
    gap: 1rem;
    background: var(--light-grey);
    margin: 0;
    padding: 1rem 1.7rem;

    .card-display-controls-top {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        & > span:nth-child(1) {
            justify-content: flex-start;
            @media(max-width: 1000px) {
                justify-content: right;
            }
            @media(max-width: 660px) {
                justify-content: center;
            }
        }
        & > span:nth-child(2) {
            justify-content: center;
            @media(max-width: 1000px) {
                justify-content: left;
            }
            @media(max-width: 660px) {
                justify-content: center;
            }
        }
        @media(max-width: 660px) {
            grid-template-columns: 1fr;
        }
    }

    & > span {
        justify-content: flex-end;
    }

    @media(max-width: 1000px) {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
        & > span {
            justify-content: center;
        }
    }

    @media(max-width: 660px) {
        grid-template-rows: 2.5fr 1fr;
        & > span {
            justify-content: center;
        }
    }

    button {
        min-width: max-content;
        margin: 0;
        padding: 0.4rem 0.8rem;
        background: var(--red);
        border: none;
        border-radius: 8px;
        color: white;
        font-size: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        transition: background-color 150ms ease-in-out;
        position: relative;
        svg {
            fill: white;
            height: 1.25em;
        }
        span {
            flex-grow: 1;
        }
        &:hover {
            cursor: pointer;
            background: var(--dark-red);
        }
    }

    button.font-smaller {
        margin-right: -6px;
        border-radius: 8px 0 0 8px;
        svg {
            height: 0.8rem;
            width: 1rem;
        }
    }
    button.font-larger {
        border-radius: 0 8px 8px 0;
        svg {
            height: 1.4rem;
            width: 1rem;
        }
    }
}
.card-display-controls > span,
.card-display-controls-top > span {
    display: flex;
    gap: 8px;
}



/* Cards Grid */

.card-display-wrapper {
    overflow: scroll;
    height: 100%;
    background: white;
}

.card-display-wrapper > .btn {
    margin: 1rem auto 0;
}

.card-display {
    --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;

    @media(max-width: 660px) {
        margin: 8px 8px 80px;
    }
}


/* Solo View */

bst-solo-view {
    --base-font-size: calc(2rem);
    font-size: var(--base-font-size);
    grid-template-rows: 4rem 1fr 8rem;
    grid-template-columns: 8rem 1fr 8rem;
    grid-template-areas:
          "header header header"
           "prev main next"
           "footer footer footer";
    height: 100%;
    min-height: max-content;
    margin: 0;
    display: grid;
    background: #112131;
    place-items: center;
    @media (max-width: 1200px) {
        grid-template-areas:
          "header header header"
           "main main main"
           "footer footer footer";
    }
    @media (max-width: 660px) {
        font-size: 1.2rem;
    }
    .card-header h3 span {
        display: none;
    }
}

.solo-controls {
    grid-area: header;
    color: white;
}

.card-nav button {
    font-size: 2rem;
    background: transparent;
    border: none;
    opacity: 0.7;
    &:hover {
        cursor: pointer;
        opacity: 1;
    }
}

.card-nav svg {
    width: 1em;
    height: 1em;
    fill: white;
    border: 2px solid white;
    border-radius: 50%;
    padding: 1rem;
}

.prev-card {
    grid-area: prev;
    @media (max-width: 1200px) {
        display: none;
    }
}

.card-cell {
    grid-area: main;
    width: 100%;
    height: 100%;
}

.next-card {
    grid-area: next;
    @media (max-width: 1200px) {
        display: none;
    }
}

.solo-footer {
    grid-area: footer;
    height: 8rem;
    display: grid;
    place-content: center;
    button {
        font-size: 2rem;
        background: transparent;
        border: none;
        opacity: 0.7;
        &:hover {
            cursor: pointer;
            opacity: 1;
        }
        svg {
            width: 1em;
            height: 1em;
            fill: white;
            border: 2px solid white;
            border-radius: 50%;
            padding: 1rem;
        }
    }
}


/* Card */

.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;

        button {
            font: inherit;
            background: none;
            border: none;
            color: inherit;
            display: flex;
            align-items: center;
        }
    }
    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: var(--card-font-size, 2rem);
    line-height: 1.2;
    display: grid;
    position: relative;
    grid-template-rows: 1px;
    padding: 0 2rem 1rem 3rem;
    box-sizing: border-box;
    gap: 0.5rem;
}
.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;
    display: grid;
    height: 100%;
    width: 100%;
    z-index: 2;
    justify-content: center;
    align-content: center;
}
.card-text-1, .card-text-2, .card-text-3 {
    padding: 0;
    margin: 0;
    place-self: center;
}
.card-main[style^="background-image"] {
    .card-main-controls {
        display: none;
    }
    &:has(div[lang]:not(.invisible):not([hidden])) .card-main-controls {
        display: flex;
        .card-font-smaller,
        .card-font-larger {
            background: white;
            svg {
                fill: var(--body-colour);
            }
        }
    }
}
.card-main-controls {
    display: flex;
    position: absolute;
    top: 6px;
    left: 8px;
    flex-direction: column;
    gap: 4px;
    font-size: 1rem;
    button.card-font-smaller {
        background: transparent;
        border-color: white;
        opacity: 0.7;
        &:hover {
            opacity: 1;
        }
        svg {
            height: 0.8rem;
            width: 1rem;
            fill: var(--white);
        }
    }
    button.card-font-larger {
        background: transparent;
        border-color: white;
        opacity: 0.7;
        &:hover {
            opacity: 1;
        }
        svg {
            height: 1.4rem;
            width: 1rem;
            fill: var(--white);
        }
    }
}
.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;
        }
    }
}

.card-error {
    .card-header {
        background: var(--red);
    }
    .card-main {
        grid-template-rows: 1fr 1fr 1fr;
        background: var(--light-red);
        color: white;
        padding: 0 1.5rem;
        place-content: start;
        font-size: 2rem;
    }
}

.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;
    &:not(:last-child) {
        margin-right: 4px;
    }
}

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

.login {
    margin: 2rem;
    padding: 2rem;
}
.login label {
    color: white;
    display: block;
    margin-top: 1rem;
}


.speech-bubble {
    transition: opacity 300ms ease-in-out;
    margin: 0;
    pre {
        position: relative;
        border-radius: 1rem;
        padding: 0.7rem 1.4rem;
        margin: 0;
        font-family: inherit;
        text-align: left;
        background: var(--white);
        width: fit-content;
        text-wrap: wrap;
        border: 1px dotted silver;
    }
    &.hidden {
        opacity: 0;
    }
}
.speech-bubble-right pre {
    margin-left: auto;
}

bst-card-editor .card-main {
    padding-top: 1rem;
    color: white;
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    p:empty {
        display: none;
    }
}

bst-card-editor {
    display: flex;
    flex-direction: column;
}
bst-tag-picker {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 40ch;
}

.page-editor {
    padding: 4rem;
    min-height: 100%;
    bst-tag-picker {
        margin: 2rem 0;
    }
}

.page-editor-controls {
    margin-top: 2rem;
    display: flex;
    gap: 16px;
}

.btn-main {
    margin: 0;
    padding: 0.4rem 0.8rem;
    background: var(--red);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background-color 150ms ease-in-out;
    position: relative;
    &:hover {
        cursor: pointer;
        background: var(--dark-red);
    }
    &::after {
        content: "";
        position: absolute;
        inset: -4px;
        background: var(--red);
        border-radius: 12px;
        z-index: -1;
    }
    &:hover:after {
        background: var(--dark-red);
    }
}

.info-page {
    max-width: 40rem;
    margin: 0 auto 20rem;
    padding: 0 1rem 10rem;
    line-height: 1.6;

    h1 {
        margin-top: 2rem;
    }

    h2 {
        margin-top: 3rem;
    }

    .image-wrapper {
        background: #f8f8f8;
        text-align: center;
        border-radius: 8px;
        padding: 1rem;
        box-sizing: border-box;

        img {
            max-width: 100%;
        }
    }

    .social-links {
        color: var(--body-colour);
        font-size: 200%;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 1rem;
        svg {
            width: 2em;
            height: 2em;
            fill: var(--dark-blue);
        }
    }
}

.sign-up {
    display: block;
    margin: 1rem auto;
    width: max-content;
    padding: 1rem 2rem;
    background: var(--dark-blue);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    &:hover {
        text-decoration: underline;
        cursor: pointer;
    }
}
