:root {
    --color-0: pink;
    --color-1: yellow;
    --color-2: skyblue;
    --color-3: greenyellow;
    --white: rgba(245, 255, 255, 1);
    --black: rgba(69, 73, 139, 1);
    --scrollbarBG: rgba(0, 0, 0, 0);
    --thumbBG: rgba(102, 108, 206, 0.4);
}

/* Scrollbar styling */

.scroll::-webkit-scrollbar {
    height: 5px;
    width: 5px;
}

.scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--thumbBG) var(--scrollbarBG);
}

.scroll::-webkit-scrollbar-track {
    background: var(--scrollbarBG);
    z-index: 100;
}

.scroll:hover::-webkit-scrollbar-thumb,
.scroll:active::-webkit-scrollbar-thumb {
    background-color: var(--thumbBG);
    border-radius: 6px;
    z-index: 50;
}

html,
body {
    padding: 0;
    margin: 0;
}

body {
    width: 100vw;
    height: 100vh;
    overflow-x: hidden;
    background-color: var(--white);
    color: var(--black);
    font-family: sans-serif;
}

.category[data-color='0'] .header {
    border-color: var(--color-0);
}

.category[data-color='1'] .header {
    border-color: var(--color-1);
}

.category[data-color='2'] .header {
    border-color: var(--color-2);
}

.category[data-color='3'] .header {
    border-color: var(--color-3);
}

*[data-color='0'],
[data-color='0']>div>.post {
    background-color: var(--color-0);
}

*[data-color='1'],
[data-color='1']>div>.post {
    background-color: var(--color-1);
}

*[data-color='2'],
[data-color='2']>div>.post {
    background-color: var(--color-2);
}

*[data-color='3'],
[data-color='3']>div>.post {
    background-color: var(--color-3);
}

button {
    outline: none;
    border: none;
    background-color: transparent;
    color: inherit;
    padding: 0;
}

.hidden {
    display: none !important;
}

.invisible {
    visibility: hidden;
    pointer-events: none;
}

.warn {
    background-color: red !important;
}

/* Error shake */
.shake {
    animation: shake .2s;
}

@keyframes shake {
    0% {
        transform: translateX(-5%);
    }

    20% {
        transform: translateX(5%);
    }

    40% {
        transform: translateX(-5%);
    }

    60% {
        transform: translateX(5%);
    }

    80% {
        transform: translateX(-5%);
    }

    100% {
        transform: translateX(0%);
    }
}

/* Main wrapper */
#wrapper {
    display: flex;
    flex-direction: column;
    padding: 60px 0 0 0;
    width: 100vw;
    height: 100vh;
    overflow-x: hidden;
    box-sizing: border-box;
}

/*** LOADING ANIMATIONS ***/

#wrapper.loading #header {
    animation: slide-down .5s cubic-bezier(0, 0.1, 0, 1);
}

#wrapper.loading #tabs {
    animation: slide-from-left .2s .2s cubic-bezier(0, 0.85, 0, 1) backwards;
}

#wrapper.loading .category {
    animation: fade-in .2s .2s cubic-bezier(0, 0.85, 0, 1) both;
}

#wrapper.loading .category:nth-of-type(n) {
    animation: fade-in 0s .4s both, slide-from-right .2s .4s cubic-bezier(0, 0.85, 0, 1) both;
}

#wrapper.loading .category:nth-of-type(2n) {
    animation: fade-in 0s .4s both, slide-from-left .2s .4s cubic-bezier(0, 0.85, 0, 1) both;
}

#wrapper.loading .category .container {
    animation-delay: .6s;
}

#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    width: 100vw;
    height: 50px;
    padding: 0 20px;
    color: var(--white);
    background-color: #666cce;
    background-image: url(../assets/img/styykr-title.svg);
    background-position: center;
    background-size: auto 2rem;
    background-repeat: no-repeat;
    box-shadow: 0 0 10px rgba(0, 0, 0, .5);
    box-sizing: border-box;
    z-index: 100;
}

#header button {
    height: 2rem;
    width: 2rem;
    border: solid 1px var(--white);
    border-radius: 11px;
}

.menu {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    background-color: rgba(0, 0, 0, .8);
    color: white;
    text-align: center;
    z-index: 100;   
}

.menu > * {
    padding: 1rem;
    width: 95vw;
    max-width: 500px;
    box-sizing: border-box;
}

.menu button {
    border: solid 1px var(--white);
    border-radius: 11px;
}


#tabs {
    height: 35px;
    overflow: scroll;
    overflow-y: hidden;
    display: flex;
}

.tab-button,
#add-tab {
    max-width: 60vw;
    margin-right: 10px;
    padding: .3rem 1.1rem;
    flex: 0 0 auto;
    overflow: hidden;
    font-size: 1.2rem;
    font-weight: 200;
    text-transform: uppercase;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-radius: 1000px 1000px 0 0;
}

#add-tab {
    margin-left: 10px;
    color: var(--white);
    background-color: rgba(102, 108, 206, 0.7);
}


/* Category wrapper */
#container {
    display: flex;
    flex-direction: column;
    /* Height equals total height minus top padding minus tabs height*/
    height: calc(100vh - 85px);
    width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
    user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-select: none;
}

.scrolling #container {
    pointer-events: none;
}

/* Tab is container of all categories and styykrs */
.tab {
    display: none;
    position: relative;
    width: 100vw;
    /* Space for add-category button*/
    padding-bottom: 6rem;
}

.tab.active {
    display: block;
}

.tab.active.left {
    animation: fade-in .2s both, slide-from-left .2s;
}

.tab.active.right {
    animation: fade-in .2s both, slide-from-right .2s;
}

@keyframes slide-from-right {
    0% {
        transform: translateX(100%);
    }

    100% {
        transform: translateX(0%);
    }
}

@keyframes slide-from-left {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(0%);
    }
}

.tab-button {
    opacity: .5;
    transform: opacity .5s;
}

.tab-button.active,
.placeholder~.tab-button {
    opacity: 1;
}

.category,
.category::before {
    transition: transform .2s, opacity .2s;
}

.category {
    position: relative;
    min-height: 80px;
    width: calc(100% - 20px);
    margin: 0 auto;
    box-sizing: border-box;
    border-radius: 25px 0 0 0;
    background-color: var(--white);
}

.category .container {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
    width: 100%;
    padding: 1rem 0 4rem 0;
    margin: 0 auto;
    box-sizing: border-box;
    animation: fade-in 1s .2s both;
}

/*.category::before*/
.category .header {
    /*content: attr(id);*/
    display: block;
    height: 1.5em;
    width: 100%;
    padding: .2em 1em 0 1.5rem;
    margin: 0 10px 0 0;
    font-size: 1.5rem;
    text-transform: uppercase;
    font-weight: bolder;
    overflow-x: hidden;
    overflow-y: visible;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--black);
    border: solid 3px;
    border-right: none;
    border-bottom: none;
    border-radius: 100px 0 0 0;
    cursor: grab;
    box-sizing: border-box;
}

.add-category {
    position: absolute;
    bottom: 0;
    width: 100%;
    font-size: 6rem;
    color: rgba(0, 0, 0, .2);
}

.bodyspace {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 1.5em);
}

.posts {
    padding-top: 50px;
}

.dragging-styykr .post-slot:hover {
    box-shadow: 0 0 5px rgba(100, 100, 255, .5);
    background-color: rgba(100, 100, 255, .3);
}

.dragging-category .category:hover,
.dragging-styykr .category:hover {
    box-shadow: 0 -5px 5px rgba(100, 100, 255, .5);
}

.dragging-category .post-slot {
    pointer-events: none;
}

.placeholder {
    pointer-events: auto !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    opacity: .5 !important;
    filter: blur(2px);
}


.post-slot.moving {
    pointer-events: none !important;
}

.post-slot {
    /* Half the screen minus right padding*/
    /*max-width: calc(50% - 1rem);*/
    width: 100%;
    max-width: 200px;
    margin-top: 20px;
    transition: transform .5s;
    font-size: 2em;
    color: var(--black);
    pointer-events: auto;
    background: transparent !important;
    box-sizing: border-box;
}

.post-container,
.post-container::before {
    height: 50px;
    width: 200px;
    max-width: 44vw;
}

.post-container {
    width: 90%;
    max-width: 190px;
    perspective: 40px;
    text-align: center;
    user-select: none;
    transition: transform .2s;
    cursor: pointer;
}

.dragging-elem {
    position: fixed;
    pointer-events: none;
    opacity: .9;
    z-index: 100;
    transform: scale(1.2) !important;
}

.dragging-elem>.post-container::before {
    transform: translate(0%, 50%);
    opacity: .05;
    animation: none;
}

.dragging-active:hover {
    cursor: dragging !important;
}

.post-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    background: linear-gradient(to right, rgba(0, 0, 0, .2) 5%, rgba(0, 0, 0, .4) 40%, rgba(0, 0, 0, 0));
    transform: translate(0%, 0%) scale(1);
    transition: transform .2s, opacity .2s;
    z-index: -1;
    filter: blur(2px);
    animation: fade-in .2s;
}

.post {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    transform-origin: left;
    transition: transform .2s .2s;
    background-color: inherit;
    animation: fall-down .1s forwards;
}

.post>div {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.placeholder .post,
.dragging-elem .post {
    animation: none;
}

.post-slot div {
    pointer-events: none;
}

.post-rotation {
    /*transform: rotate3d(0, 1, 5, -5deg);*/
}

.post-rotation>div {
    transition: none;
}

.dragging-elem>div>.post-rotation {
    transform: initial;
}

.popup~#add {
    animation: fade-away .2s forwards;
}

#add {
    position: fixed;
    right: 30px;
    bottom: 30px;
    height: 75px;
    width: 75px;
    z-index: 99;
    transition: transform .2s;
    background-image: url('../assets/img/add.svg');
    background-size: contain;
    animation: fade-in .5s forwards;
}

#add img {
    height: 100%;
    width: 100%;
}

#add:hover {
    transform: scale(1.2);
}

.popup {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: fixed;
    height: 100%;
    width: 100%;
    top: 0;
    z-index: 100;
    padding: 20px;
    padding-top: 60px;
    animation: show .2s both;
    /*animation: expand-in .2s cubic-bezier(0, 1.08, .96, 1.01) backwards*/
    ;
    box-sizing: border-box;
    color: var(--white);
    text-transform: capitalize;
    font-weight: 900;
    background-color: rgba(0, 0, 0, .8);
    /*background-color: rgba(0, 0, 0, .5);*/
    box-sizing: border-box;
}

.popup~* {
    pointer-events: none;
}

.details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 600px;
    margin-top: -60px;
    animation: fade-in .2s .2s both;
}

.popup>button {
    position: fixed;
    bottom: 10px;
    width: 90%;
    max-width: 300px;
    animation: fade-in .2s .2s both;
}

.popup>button,
#type button {
    font-size: 1rem;
    padding: 1rem;
    color: var(--white);
    background-color: rgba(0, 0, 0, .4);
    border-radius: 10px;
}

.popup>button {
    animation: slide-up 1.5s .2s cubic-bezier(0, 0.85, 0, 1) both;
}

.popup>button::after {
    content: attr(data-text);
    animation: fade-in .2s .5s both;
}

#create {
    background-color: #57bf54;
}

.close {
    align-self: flex-end;
}

#type {
    position: absolute;
    top: calc(60px + 6vh);
    font-size: 1.5rem;
    font-weight: 400;
    border-bottom: solid 1px rgba(255, 255, 255, .5);
    overflow: hidden;
    animation: fade-in .2s .2s both;
    /* Pull things up above center */
    /*margin-top: -20vh;*/
}

#type button {
    width: 10rem;
    max-width: 40vw;
}

.selected {
    border: solid 1px blue;
    box-shadow: 0 0 2px blue;
}

#type button.selected {
    border: none;
    filter: invert(1);
}

#color-picker {
    display: flex;
    justify-content: space-around;
}

#styykrDetails {
    height: calc(100% - 50px);
    /* minus height of submit button */
}

input[type='text'] {
    width: 100%;
    margin: 10px auto;
    padding: 10px 0;
    border: none;
    /* background-color: transparent; */
    /*  border-bottom: solid 1px black; */
    font-size: 2em;
    text-align: center;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

input[type='text']::placeholder {
    font-style: italic;
}

#color-picker button {
    box-sizing: border-box;
    height: 20px;
    width: 20px;
    margin: 0 10px;
}

.button {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 50px;
    line-height: 50px;
    box-sizing: border-box;
    text-align: center;
    font-size: 1.5em;
    background-color: var(--white);
    cursor: default;
}

.fade-away {
    animation: fade-away .5s forwards !important;
}

.fade-in {
    animation: fade-in .5s forwards !important;
}

.translate-home {
    animation: translate-home .2s forwards;
}

body.updating {
    height: 100vh;
    width: 100vw;
    background-color: #666cce;
    background-image: url(../assets/img/styykr-title.svg);
    background-size: 50vw auto;
    background-repeat: no-repeat;
    background-position: center calc(50vh - 200px);
}


/* Inform user of update in progress */
body.updating::before,
body.updating::after {
    color: var(--white);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% - 1rem));
}

body.updating::before {
    content: 'Updating';
    animation: fade-in 1s infinite alternate;
}

body.updating::after {
    content: 'Update is taking a while. Try reloading the page? Sorry about that.';
    animation: fade-in .5s 20s both;
    transform: translate(-50%, 1rem);
}



body.updating * {
    display: none;
}

@keyframes slide-up {
    0% {
        transform: translateY(100%);
    }

    100% {
        transform: translateY(0%);
    }
}

@keyframes slide-down {
    0% {
        transform: translateY(-100%);
    }

    100% {
        transform: translateY(0%);
    }
}

@keyframes fall-down {
    0% {
        transform: translate(10px, -20px) scale(1.3) rotate3d(0, 0, 0, 0deg);
    }

    100% {
        transform: translate(0px, 0px) scale(1) rotate3d(0, 1, 5, -5deg);
    }
}

@keyframes fade-away {
    100% {
        opacity: 0;
    }
}

@keyframes fade-in {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes expand-in {
    0% {
        transform: scale(0);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes translate-home {
    100% {
        transform: translate(0, 0);
    }
}

@keyframes show {
    0% {
        transform: scale(0, 0);
    }

    5% {
        transform: scale(.1, .2);
    }

    50% {
        transform: scale(.1, 1);
    }

    100% {
        transform: scale(1, 1);
    }

}