* {
    box-sizing: border-box;
}

body {
    margin: 0;
    /* body will not be scrollable instead we have a div for that */
    height: 100vh;
    overflow: hidden;
    font-size: 1.5em;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: white;
}

#loading-overlay {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.50);
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: all 1s cubic-bezier(0.075, 0.82, 0.165, 1);
}

.loading-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -70%);
    width: 20em;
    height: 20em;
    border-radius: 50%;
    background-color: #fff;
    filter: drop-shadow( 0 0 5em #fff ) blur( 5em );
    animation: pulse 3s infinite;
}

@keyframes pulse {
    0%{
        font-size: 0.75em;
    }
    50% {
        font-size: 1.25em;
    }
    100% {
        font-size: 0.75em;
    }
}

.solid {
    margin-bottom: 5em;
}

.loading-text {
    font-size: 3em;
    font-weight: bold;
    letter-spacing: 0.1em;
}

.table-wrapper.preload {
    opacity: 0%
}

header {
    display: flex;
    flex-direction: row;
    align-items: center;
    background-color: hsla(208, 20%, 20%, 0.800);
    font-weight: bold;
    width: 100%;
    flex: 0 0 4em;
    margin: 0;
}

nav ul {
    display: flex;
    justify-content: space-around;
}

nav ul a {
    display: inline-block;
    padding: 10px 20px;
    margin-top: .5em;
    margin-bottom: .5em;
}

ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

a {
    color: unset;
    text-decoration: none;
}

nav ul a:hover {
    color: skyblue;
}

#granim-background {
    position: absolute;
    z-index: -1;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
}

.scrollable-main-container {
    height: 100%;
    width: 100%;
    overflow: auto;
}

.inner-main-container {
    display: flex;  
    flex-direction: column;
    align-items: center;
    min-height: 100%;
}

#dice-box {
    /* background-color: hsla(100, 100%, 80%, 0.5); bgcol for debugging */
    height: 0;
    flex-basis: 400px;
    flex-shrink: 0;
    flex-grow: 1;
    width: 100%;
    /* shouldn't be needed, but the canvas is going rogue and adding a few extra px to it's height for reasons unknown */
    overflow: hidden;
}

#dice-box > canvas {
    height: 100%;
    width: 100%;
}

.dice-ui {
    position: relative;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.overlay-dice-ui {
    position: absolute;
    /* transform: translateX( -50% ); */
    right: 0;
    left: 0;
}

.dice-button-container {
    display: grid;
    grid-template-columns: repeat(6, auto);

    justify-content: space-evenly;
    align-items: center;
}

.dice-controls-container {
    grid-column: auto;
    display: flex;
    flex-direction: column;
    width: min-content;
    margin: 0 auto;
}

.add-and-remove-dice-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
}

.display-dice-result {
    text-align: center;
    font-weight: bold;
    font-size: 2em;
}

search {
    margin-top: 5em;
    /* should always be height of the caption */
    transform: translateY( 1.33em ); 
    width: 0;
}

search form input {
    height: 2em;
    width: 300px;
    border-radius: 1.5em;
    border: 0.1em solid hsla(208, 10%, 90%, 0.2);
    font-size: 0.6em;
    padding: 1.25em;
    background-color: hsla(208, 10%, 10%, 0.8);
    color: unset;
}

search form input::placeholder {
    color: unset;
}

search label {
    display: block;
    font-size: 0.6em;
    margin-left: 1.25em;
    color: unset;
}

.table-styles {
    width: 100%;
    height: min-content;
    margin: auto;
    margin-bottom: 5em;
    border-radius: 0 0 1em 1em;
    overflow: hidden;
    text-align: center;
}

.table-styles caption {
    margin-bottom: 0.25em;
    font-weight: bold;
}

.table-styles thead tr {
    border-radius: 1em 1em 0 0;
}

.table-styles th:not(.expand-button-header, .spell-item-name) {
    border-left: 0.1em solid hsla(208, 10%, 90%, 0.2);
}

.table-styles, .table-styles th, .table-styles td {
    border-collapse: collapse;
}

.table-styles .table-button, .dice-button {
    border-radius: 1em;
    background-color: hsla(208, 10%, 5%, 0.700);
    border: 0.1em solid hsla(208, 10%, 90%, 0.2);
    border-radius: 0.25em;
    padding: 0.1em 0.5em;
    margin: 0 0.25em;
    color: unset;
    font-size: unset;
    font-weight: bold;
}

.table-styles .table-button:disabled {
    background-color: hsla(208, 10%, 50%, 0.2);
    color: hsla(208, 10%, 95%, 0.25);
    filter: blur( 1px );
}

.score {
    min-width: 25.88px;
    display: inline-block;
}

.sort {
    color: unset;
    font-weight: unset;
    font-size: unset;
    width: 100%;
    height: 100%;
    background-color: unset;
    border: unset;
    position: relative;
}

.sort.asc::after {
    content: "\002B06";
    position: absolute;
    top: 0;
    right: 0.25em;
    color: green;
}

.sort.desc::after {
    content: "\002B07";
    position: absolute;
    top: 0;
    right: 0.25em;
    color: green;
}

.table-wrapper, .calculator-frame {
    width: 100%;
    max-width: 1200px;
    padding: 1em;
    margin: auto;
}

.table-styles tr {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    background-color: hsla(208, 10%, 5%, 0.700);
    border-top: 0.1em solid hsla(208, 10%, 90%, 0.2);
    border-bottom: 0.1em solid hsla(208, 10%, 90%, 0.2);
    border-collapse: collapse;
    padding: 0.5em;
}

#point-table.table-styles tr {
    display: table-row;
}

#point-table.table-styles tr td, #point-table.table-styles tr th {
    padding-top: 0.5em;
    padding-bottom: 0.5em;
}

.table-styles tr[aria-expanded="false"]:hover, .table-styles tr[aria-expanded="true"] {
    box-shadow: inset 0px 0px 2px 3px rgba(39, 39, 39, 0.3);
    background-color: hsla(0, 10%, 40%, 0.5)
}

.table-styles .expand-button {
    background-color: unset;
    border: unset;
    color: unset;
    font-size: unset;
    transform: scale(1.2);
    font-weight: bold;
}

.table-styles td, .table-styles th {
    flex: 1;
}

#spells-table caption {
    transition: all 1s cubic-bezier(0.075, 0.82, 0.165, 1);
}

#spells-table tr td, #spells-table tr th {
    transition: all 1s cubic-bezier(0.075, 0.82, 0.165, 1);
}

.table-wrapper, .calculator-frame, header, body, search form input {
    transition: all 1s cubic-bezier(0.075, 0.82, 0.165, 1);
}

#spells-table tr .spell-item-name {
    flex-basis: 8em;
    flex-grow: 12;
}

#spells-table tr .spell-item-level {
    flex-basis: 4em;
    flex-grow: 1;
}

#spells-table tr .spell-item-time {
    flex-basis: 6em;
    flex-grow: 6;
}

#spells-table tr .spell-item-school {
    flex-basis: 8em;
    flex-grow: 8;
}

#spells-table tr .spell-item-concentration {
    flex-basis: 35px;
    flex-grow: 1;
}

#spells-table tr .spell-item-range {
    flex-basis: 6em;
    flex-grow: 4;
}

#spell-table tr td:has(.expand-button), #spell-table tr th.expand-button-header {
    flex-basis: 1em;
    flex-grow: 0;
}

#spells-table tr .spell-item-detail {
    text-align: left;
    padding: 0 1em;
}

#spells-table tr .spell-item-detail p {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

@media ( max-width: 992px ) {
    #spells-table tr .spell-item-school {
        /* display: none would work but this is way cooler */
        flex-basis: 0%;
        flex-grow: 0;
        transform: scaleX( 0% );
        width: 0;
        height: 0;
    }
}

@media ( max-width: 840px ) {
    .table-styles .table-button {
        margin: 0 0.1em;
    }

    .dice-button-container {
        font-size: 0.9em;
    }
}

@media ( max-width: 768px ) {
    .table-wrapper, .calculator-frame {
        font-size: 0.75em;
    }

    #spells-table caption {
        transform: translateX( calc( 50% - 5em ) );
    }
}

@media ( max-width: 610px ) {
    .table-wrapper, .calculator-frame {
        font-size: 1em;
        padding: 0;
    }

    body {
        font-size: 1em;
    }

    .table-styles {
        border-radius: 0;
    }

    .table-styles thead tr {
        border-radius: 0;
    }

    .dice-button-container {
        font-size: 1em;
    }
}

@media ( max-width: 550px ) {
    #spells-table tr .spell-item-concentration {
        flex-basis: 0%;
        flex-grow: 0;
        transform: scaleX( 0% );
        width: 0;
        height: 0;
    }

    .table-styles .table-button {
        padding: 0.1em 0.25em;
    }
}

@media ( max-width: 460px ) {
    #spells-table tr .spell-item-range {
        flex-basis: 0%;
        flex-grow: 0;
        transform: scaleX( 0% );
        width: 0;
        height: 0;
    }

    #point-table td:has(.score), #point-table td:has(.racial) {
        display: flex;
        flex-direction: column-reverse;
        align-items: center;
    }

    .dice-controls-container {
        grid-column: auto / span 2;
    }
}

@media ( max-width: 420px ) {
    search form input {
        width: 200px;
    }

    header {
        font-size: 0.75em;
    }

    #point-table {
        font-size: 0.9em;
    }
}

@media ( max-width: 370px ) {
    #spells-table tr .spell-item-time {
        flex-basis: 0%;
        flex-grow: 0;
        transform: scaleX( 0% );
        width: 0;
        height: 0;
    }

    #point-table {
        font-size: 0.8em;
    }
}

@media ( max-width: 325px ) {
    search form input {
        width: 150px;
    }

    #point-table {
        font-size: 0.7em;
    }

    .dice-controls-container {
        grid-column: auto / span 3;
    }
}

#load-more {
    display: block;
    margin: 2em auto;
    padding: 0.5em 1.5em;
    border-radius: 1.5em;
    border: 0.1em solid hsla(208, 10%, 90%, 0.2);
    background-color: hsla(208, 10%, 10%, 0.8);
    color: white;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 1s cubic-bezier(0.075, 0.82, 0.165, 1);
}

#load-more:hover {
    background-color: hsla(208, 10%, 20%, 0.8);
    border-color: hsla(208, 10%, 90%, 0.4);
}

#load-more:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.roll-all-button {
    display: block;
    margin: 1em auto;
    border-radius: 1em;
    background-color: hsla(208, 10%, 5%, 0.700);
    border: 0.1em solid hsla(208, 10%, 90%, 0.2);
    border-radius: 0.25em;
    padding: 0.1em 1.5em;
    color: white;
    font-size: 1.2em;
    font-weight: bold;
}

.roll-all-button:disabled {
    background-color: hsla(208, 10%, 50%, 0.2);
    color: hsla(208, 10%, 95%, 0.25);
    filter: blur(1px);
}
