/* todo: css reorganization !!! woohoo !!! */
:root {
    --color-taunt: #b8860b;
    --color-h: #dc143c;
    --color-s: #228b22;
    --color-k: #4682b4;
    --color-p: #b22ea1;

    --color-x: #696969;
    --color-or: #000;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: linear-gradient(180deg, #fff 0%, #eaeaea 128px);
}

header {
    padding: 4px 12px;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

header h1 {
    margin: 12px 0;
    border-bottom: 1px solid #000;
}

header a {
    color: #000;
    display: inline-block;
    font-weight: normal;
    text-decoration: none;
}

.main .container {
    display: flex;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 0 12px 12px;
    gap: 12px;
    max-width: 1400px;
}

.sidebar {
    width: 200px;
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: fit-content;
    max-height: calc(100vh - 24px);
    padding-bottom: 24px;
    overflow-y: scroll;
    position: sticky;
    top: 12px;
    z-index: 5;

    @media (width <= 740px) {
        display: none;
        position: fixed;
        top: 56px;
        background: #d3d3d3;
        padding: 12px;
        border: 1px solid #000;
        max-height: calc(100vh - 123px - 48px);
        overflow-y: scroll;
    }

    &.shown {
        display: flex !important;
    }
}

.nav-toggle {
    display: none;
    position: fixed;
    top: 16px;
    border-radius: 0;
    border: 1px solid #000;
    font-size: 20px;
    height: 32px;
    width: 32px;
    cursor: pointer;
    z-index: 5;

    @media (width <= 740px) {
        display: block;
    }
}

.nav-top {
    border-radius: 0;
    border: 1px solid #000;
    text-decoration: none;
    color: #000;
    font-weight: bold;
    font-size: 12px;
    padding: 3px;
    background: linear-gradient(0deg, #d4d4d4 0%, #fff 100%);
    text-align: center;
}

.nav-top:hover {
    background: linear-gradient(0deg, #d4d4d4 0%, #eaeaea 100%);
}

.nav-top:active {
    background: linear-gradient(0deg, #eaeaea 0%, #d4d4d4 100%);
}

nav {
    background: #fff;
    border: 1px solid #000;
    box-sizing: border-box;
}

nav h3 {
    margin: 0;
    font-size: 12px;
    padding: 6px 12px;
    border-bottom: 1px solid #808080;
    background: linear-gradient(0deg, #d4d4d4 0%, #fff 100%);
}

nav h3 input {
    margin-top: 2px;
    margin-right: -4px;
    padding: 0;
    cursor: pointer;
    float: right;
}

nav h3:has(input:checked) + ul {
    display: block;
}

/* when the input is not checked */
nav h3:not(:has(input:checked)) {
    border-bottom: none;
}

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

nav li {
    margin: 0;
    font-size: 11px;
    cursor: pointer;
}

nav li a {
    padding: 2px 8px;
    display: flex;
    text-decoration: none;
}

nav li a:hover {
    text-decoration: underline;
}

nav li.active a {
    background: #3d3d3d;
    color: #fff;
    font-weight: bold;
    cursor: default;
    text-decoration: none !important;
}

nav li.header {
    padding: 2px 8px;
    margin: 0;
    background: #d4d4d4;
    cursor: default;
    border: 1px solid #808080;
    border-left: none;
    border-right: none;
}

main {
    background: #fff;
    border: 1px solid #000;
    flex: 1;
    box-sizing: border-box;
    padding: 12px;
    min-width: 0;
    overflow-y: hidden;
}

main h2 {
    padding-bottom: 6px;
    border-bottom: 1px solid #808080;
    margin: 18px 0 12px;
}

main > h2 {
    margin-top: 0;
}

main h2 a:nth-child(1) {
    text-decoration: none;
    color: #000;
}

main h2 a:nth-child(2) {
    float: right;
    font-size: 12px;
    line-height: 28px;
    text-decoration: none;
}

main h2 a:nth-child(2):hover {
    text-decoration: underline;
}

section {
    background: #fff;
    width: 90%;
    max-width: 720px;
    margin: 12px auto;
    border: 1px solid #000;
    overflow: hidden;
}

section h3 {
    margin: 0;
    font-size: 14px;
    padding: 6px 12px;
    border-bottom: 1px solid #808080;
    background: linear-gradient(0deg, #d4d4d4 0%, transparent 100%);
}

h4 {
    margin-bottom: 4px;
}

div.roster {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px;
    align-items: center;
    justify-content: space-around;
    text-align: center;
}

div.roster a {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid #000;
    width: 96px;
    min-height: 150px;
    text-decoration: none;
}

div.roster a .name {
    padding: 4px 8px;
    box-sizing: border-box;
    border-bottom: 1px solid #000;
    background: #e4e4e4;
    font-size: 14px;
    font-weight: bold;
}

div.roster a .type {
    padding: 4px 8px;
    box-sizing: border-box;
    font-size: 12px;
    border-top: 1px solid #000;
}

.overview .content {
    display: flex;
    @media (max-width: 500px) {
        .info {
            width: 100%;
            min-width: 100%;
            margin: 0 0 12px;
        }

        flex-direction: column-reverse;
    }
}

.overview span {
    margin-top: 0;
    width: 100%;
    font-size: 14px;
}

.info {
    width: 240px;
    min-width: 240px;
    height: fit-content;
    margin: 0 0 0 12px;
    border-bottom: none;
}

.info img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 12px auto;
}

.portrait {
    display: block;
}

.alt-portrait {
    display: none !important;
}

.info:has(.alternate-checkbox:checked) {
    .alt-portrait { display: block !important; }
    .portrait { display: none !important; }
}

.alternate-toggle {
    display: flex;
    width: 100%;
    position: relative;
    user-select: none;

    .alternate-btn {
        padding: 2px 16px;
        background: linear-gradient(0deg, #d4d4d4 0%, #fff 100%);
        cursor: pointer;
        border: 1px solid #000;
        font-size: 12px;
        font-weight: bold;
        margin: 0 auto 12px;
    }
}

.table-container {
    overflow-x: auto;
    width: 100%;
    max-width: 100vw;
}

table {
    width: 100%;
    table-layout: fixed;
    border: 1px solid #000;
    border-collapse: collapse;
    font-size: 11px;
    text-align: center;

    th {
        background: #e4e4e4;
        font-weight: bold;
    }

    td, th {
        border: 1px solid #000;
        padding: 2px 0;
    }

    &[orientation="vertical"] {
        text-align: left;

        td, th {
            padding: 4px 8px;
            width: 50%;
            vertical-align: top;
        }
    }
}

.mechanics {
    margin-bottom: 12px;
}

.section-text {
    margin: 10px 0;
    font-size: 14px;
}

.section {
    width: 100%;
}

.move {
    border: 1px solid #000;
    display: flex;
    margin: 0 0 12px;
    width: 100%;
    min-height: fit-content;
    overflow: hidden;

    /* re-shifts sizing again when the screen is small enough to justify hiding the sidebar */
    @media (width < 900px) and (width > 740px), (width <= 700px) {
        flex-direction: column;
        .move-info {
            width: unset;
            border-right: none;
            border-bottom: 1px solid #000;
        }
    }
}

.move-info {
    display: flex;
    flex-direction: column;
    background: #e4e4e4;
    border-right: 1px solid #000;
    min-width: 230px;
    width: 240px;
    padding: 4px 8px 28px;
    gap: 4px;
    text-align: center;
    position: relative;
}

a:has(.move-name) {
    text-decoration: none;
    width: fit-content;
    display: block;
}

.move-name {
    width: 100%;
    margin-bottom: 4px;
    color: #000;
    scroll-margin-top: 18px;
}

.move-info .move-input {
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    font-size: 14px;
    font-weight: bold;
    color: var(--color-x);
}

.image-note {
    font-size: 12px;
    color: #696969;
    text-align: center;
    font-style: italic;
}

em { font-style: normal }
[button=taunt] { color: var(--color-taunt) }
[button=h] { color: var(--color-h) }
[button=s] { color: var(--color-s) }
[button=k] { color: var(--color-k) }
[button=p] { color: var(--color-p) }
[button=x] { color: var(--color-x) }
[button=or] { color: var(--color-or) }
[button=_]{ /* inherit from browser default */ }

.ref:has([button=taunt]) { text-decoration-color: var(--color-taunt) }
.ref:has([button=h]) { text-decoration-color: var(--color-h) }
.ref:has([button=s]) { text-decoration-color: var(--color-s) }
.ref:has([button=k]) { text-decoration-color: var(--color-k) }
.ref:has([button=p]) { text-decoration-color: var(--color-p) }
.ref:has([button=x]) { text-decoration-color: var(--color-x) }

.move-info img {
    max-width: 230px;
    height: auto;
    display: block;
    margin: 0 auto;
    font-size: 12px;
}

.move-info .hitbox-container {
    display: none;
}

.move-info:has(input:checked) {
    .hitbox-container { display: block }
    .image-container { display: none }
}

.hitbox-btn {
    padding: 2px 16px;
    background: linear-gradient(0deg, #d4d4d4 0%, #fff 100%);
    cursor: pointer;
    border: 1px solid #000;
    font-size: 12px;
    font-weight: bold;
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
}

.hitbox-checkbox:checked + .hitbox-btn, .alternate-checkbox:checked + .alternate-btn {
    background: linear-gradient(0deg, #ebebeb 0%, #b6b6b6 100%);
}

.move-details {
    font-size: 14px;
    width: 100%;
}

.advanced-btn {
    cursor: pointer;
    float: right;
    margin-top: -6px;
    padding: 0 8px 4px;
    text-decoration: underline;
}

.advanced {
    display: none;

    .table-container {
        margin: 0 12px;
        width: calc(100% - 24px);
    }
}

.move-details:has(input:checked) {
    .advanced { display: block }
}

.move-details > div > table, .info > div > table {
    border: none;
    th, td {
        border-top: none !important;
        &:first-child { border-left: none !important; }
        &:last-child { border-right: none !important; }
    }
}

.info > div > table {
    border-top: 1px solid #000;
}

.move-details span {
    display: block;
    margin: 0;
    font-weight: normal;
    padding: 6px 12px 10px;
}

.move-details ul {
    margin: 8px 0;
    padding-left: 24px;
}

.ref {
    text-decoration: underline;
    text-decoration-style: dotted;
    font-weight: bold;
}

.ref:hover {
    text-decoration-style: solid;
}

.btn {
    font-weight: bold;
}

.note {
    display: inline !important;
    padding: 0 !important;
    text-decoration: underline;
    text-decoration-style: dotted;
}

.note:hover {
    text-decoration-style: solid;
}

.embed {
    border: 1px solid #000;
    margin: 12px auto;
    padding : 12px 32px;
    width: fit-content;
    max-width: 90%;
    background: #e4e4e4;
}

.embed img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.embed p {
    margin-bottom: 0;
    margin-top: 10px;
    font-size: 12px;
    text-align: center;
    color: #696969;
}

footer {
    padding: 12px;
    font-size: 12px;
    text-align: center;
    width: 100%;
    border-top: 1px solid #808080;
    box-sizing: border-box;
    margin-top: auto;
}