:root {
    --header-height: 4rem;
    --ranking-row-height: 60px;
}

.site-size {
    width: 100%;
}

body {
    text-size-adjust: none;
    font-size: 18px;
}

#site {
    overflow-x: clip;
}

.desktop {
    display: none;
}

.mobile {
    display: revert;
}

/* pokemon name */
#strongest-table tr > *:nth-child(3) { 
    width: auto !important;
    padding-right: 10px;
}

#strongest-scroller {
    max-height: calc(10 * var(--ranking-row-height));
    overflow-y: scroll;
}

.type-links {
    width: 75%;
}

#type-matrix {
    font-size: 0.8em;
}

#type-matrix-table {
    font-size: 12px;
}

.dex-layout-table {
    display: flex;
    flex-flow: column-reverse nowrap;
}

.dex-layout-tablecell {
    flex-flow: row nowrap;
    gap: 1em;
    align-items: center;
    height: 2.5rem;
}

.dex-layout-header {
    text-align: right;
    justify-content: right;
    padding: 0;
    height: 2.5rem;
    width: 10vw;
    white-space: nowrap;
}

#attack-tiers .dex-layout-header {
    text-align: left;
    justify-content: center;
}

.dex-layout-content {
    /*flex-basis: 80%;*/
    flex: 1 1 0;
    flex-flow: row wrap;
    gap: 4px;
    justify-content: start;
    padding: 0;
}

#attack-tier-results-shadow .dex-layout-content {
    padding-left: 1em;
}

.dex-layout-content > * {
    flex: 0 1 0;
}

#attack-tiers .card-body {
    display: flex;
    flex-flow: row nowrap;
}

#attack-tier-results {
    flex: 0 0 50%;
}

#attack-tier-shadow-header {
    writing-mode: vertical-lr;
    transform: scale(-1);
}

#attack-tier-results-shadow {
    flex: 1 1 40%;
}

.card .drawer-popup {
    width: calc(100vw - 2 * var(--site-margin) - 2px);
    font-size: 18px;
}
#filter-settings {
    flex-flow: column nowrap;
    padding: 0;
    gap: 0;
}

.card {
    margin: 1rem 0;
}

dialog.card, #search-string-popup {
    max-width: calc(100vw - 2 * var(--site-margin));
    min-width: calc(100vw - 2 * var(--site-margin));
}
dialog.card .card-body {
    font-size: 0.8em;
}

@media screen and (max-width:800px) { 
    /* fast and charge move */
    #strongest-table tr > *:nth-child(4), #strongest-table tr > *:nth-child(5)  { 
        margin: 3px 0;
        display: flex; 
        width: auto;
    }

    .type-links {
        width: 100%;
    }

    /* rename moveset column */
    #pokedex-move-table thead tr > *:nth-child(1) {
        font-size: 0;
    }
    #pokedex-move-table thead tr > *:nth-child(1):before {
        content: "Moveset";
        font-size: 18px;
        display: inline-block;
        padding: 0.25em 0;
    }

    #pokedex-move-table thead tr > *:nth-child(2), #pokedex-move-table thead tr > *:nth-child(2n+3) {
        display: none;
    }

    #pokedex-move-table, #pokedex-move-table > * {
        display: block;
    }
    #pokedex-move-table tbody tr {
        display: grid;
        grid-auto-flow: column;
        grid-template-columns: 2fr repeat(3, 1fr);
        grid-template-rows: repeat(2, auto);
    }

    #pokedex-move-table tbody td {
        width: 100% !important;
        text-align: center;
    }

    #pokedex-move-table tbody td:nth-child(2n+4) {
        font-size: 0.8em;
        font-weight: bold;
        color: var(--col-shadow);
    }

    #pokedex-move-table tbody td:nth-child(2n+4)::before {
        content: "(";
    }
    #pokedex-move-table tbody td:nth-child(2n+4)::after {
        content: ")";
    }

    #pokedex-move-table thead tr {
        display: grid;
        grid-auto-flow: column;
        grid-template-columns: 2fr repeat(3, 1fr);
        grid-template-rows: auto;
    }
    #pokedex-move-table thead th {
        width: 100% !important;
    }
    
    #counters-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    #move-data-table tr > *:last-child {
        display: none;
    }

    #move-data-table tr > *:nth-child(n+2) {
        width: auto;
    }
    
    #move-data-table {
        font-size: 14px;
        table-layout: auto;
    }
}

/* % rating */
#strongest-table tr > *:nth-child(6) {
    padding: 0 10px;
}

/* % comparison bars */
#strongest-table tr > *:nth-child(7) {
    display: none;
}

#settings-tiermethod, #settings-tiermethod-header {
    display: none;
}
#strongest #settings-compare, #strongest #settings-compare-header {
    display: none;
}

.a-poke-name {
    display: grid;
    grid-template-rows: 1fr min-content;
    align-items: center;

    .pokemon-icon {
        grid-column: 1;
        grid-row: 1/3;
    }
    
    .strongest-name {
        grid-column: 2;
        grid-row: 1;
        text-wrap: wrap;
    }

    .poke-form-name {
        grid-column: 2;
        grid-row: 2;
        text-wrap: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}
/*
#settings {
    position: fixed;
    transform: none;
    width: 90vw;
    left: 5vw;
    top: 1vw;
}*/

/* fixes to header searchbar + strongest link */
#strongest-button-c {
    position: static;
    transform: none;
    width: 100%;
}
#strongest-button {
    position: static;
    width: fit-content;
    margin-left: auto;
    margin-right: 4%;
}
#search-label {
    margin-left: 4%;
    margin-right: auto;
    text-align: left;
}

#pokedex {
    height: auto;
}

#nav-links-c {
    display: flex;
    flex-flow: row nowrap;
    justify-content: space-evenly;

    position: static;

    width: 90vw;
    margin: 0 auto;
}

@media screen and (max-width:600px) { 
    :root {
        --ranking-row-height: 50px;
    }

    #strongest-scroller::-webkit-scrollbar {
        width: 10px;
    }

    #strongest-table, 
    #pokedex, #pokedex-page, 
    #faq, #about,
    .type-links,
    #pokedex-move-table thead tr > *:nth-child(1):after {
        font-size: 14px;
    }

    #strongest-table tr > *:nth-child(1) {
        width: 10px;
        min-width: 0 !important;
    }
    #strongest-table .tier-label {
        font-size: 8px;
        writing-mode: vertical-lr;
        transform: scale(-1);
    }

    #base-stats tr > *:nth-child(1), #stats-form tr > *:nth-child(1),
    #base-stats tr > *:nth-child(12), #stats-form tr > *:nth-child(12) { 
        width: 0%;
    }

    #attack-tiers, #effectiveness {
        margin-left: 0%;
        width: 100%;
    }

    #previous-containers > *:nth-child(1), #next-containers > *:nth-child(2) {
        display: none;
    }

    #move-data-table tr > *:nth-child(5),
    #move-data-table tr > *:nth-child(6),
    #move-data-table tr > th:nth-child(7) {
        display: none;
    }

    .table-with-leftheader {
        overflow-x: scroll;
    }

    #type-matrix-table tr > *:nth-child(1) {
        position: absolute;
        left: 1px;
        z-index: 1;
        background-color: var(--col-header);
        min-width: 58px;
    }

    #type-matrix-table tbody tr > *:nth-child(1) {
        padding: 0;
    }

    #type-matrix {
        position: relative;
    }

    #type-matrix .table-leftheader {
        min-width: 60px;
        padding-left: 0;
        padding-right: 0;
    }

    #type-matrix .corner-writing {
        display: flex;
    }

    #type-matrix .table-title {
        display: none;
    }

    .header-area {
        gap: 0;
    }
    .drawer-icon {
        margin-left: 0;
    }
    #poke-search {
        margin: 0 0.5em;
    }

    header h2 {
        font-size: 1.25em;
    }

    header .drawer-popup {
        font-size: 1.25em;
    }
    
    header .drawer-popup, #poke-suggestions {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        transform: none;

        width: auto;
        height: auto;
        border-left: none;
        border-right: none;
    }

    .column-l, .column-r { flex-basis: 100%; }
    *:has(> .column-l, > .column-r) { flex-direction: column; }
}

@media screen and (max-width:500px) { 
    #poke-search {
        min-width: 0;
    }
    #poke-search-box {
        color: transparent;
        width: 1.5em;
        padding: 0;
        border: none;
        background-color: transparent;
    }
    #poke-search .inlaid-icon {
        left: 0;
        font-size: 1.5em;
        z-index: -1;
    }

    #poke-search-box:focus {
        color: var(--col-text);
        width: 100%;
        font-size: 1.5em;
        box-sizing: border-box;
        padding: 0 0 0 2em;
        border: 1px solid var(--col-outline);
        background-color: var(--col-widget-back);
    }

    #poke-search:focus-within {
        position: fixed;
        left: 3rem;
        right: 4.5em;
    }
    #poke-search:focus-within .inlaid-icon {
        left: 0.5em;
        font-size: 1.5em;
        z-index: 2;
    }
    #poke-search:not(:focus-within) .search-icon {
        filter: brightness(0) invert(1);
    }
    
    #counters-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    #counters-grid > *:nth-child(10) {
        display: none;
    }
}

@media screen and (max-width:400px) { 
    :root {
        --ranking-row-height: 45px;
    }

    #strongest-table, ul.footnotes {
        font-size: 12px;
    }

    #strongest-scroller::-webkit-scrollbar {
        width: 5px;
    }
    
    #strongest-table tr > *:nth-child(1) {
        width: 5px;
        min-width: 0 !important;
    }

    #strongest-header .card-title { font-size: 0.9em; }
    #strongest-header .drawer-icon { font-size: 0.8em; }

    #strongest-table .tier-label {
        font-size: 0;
    }

    #filter-settings .settings-list,
    #settings .settings-list {
        font-size: 0.8em;
    }

    /*
    .type-links {
        font-size: 1rem;
    }

    .type-links ul {
        grid-template-columns: repeat(3, 1fr);
    }
    #any-type-move-link {
        grid-column-end: span 3;
    }
    */

    .type-links ul {
        overflow: clip;
    }
}