html{
    box-sizing: border-box;
    -moz-box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -webkit-text-size-adjust: none;
}

html,
body{
    background-color: var(--color-background);
    color: var(--color-text-pri);
    font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, Roboto, sans-serif;
    font-size: 14px;
    font-weight: 400;
    height: auto;
    letter-spacing: -.012em;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    width: 100%;
}

*,
*:before,
*:after{
    box-sizing: inherit;
    -moz-box-sizing: inherit;
    -webkit-box-sizing: inherit;
}

:root{
    module-spacing: 3vh;
}


/* TEXT STYLES */

h1, h2{
    font-weight: 300;
    margin: 0;
    padding: 0;
    text-align: left;
}

h2, h3, h4{
    text-transform: uppercase;
}

h1{
    font-size: 4em;
    font-weight: 700;
    margin-bottom: 0.5em;
}

h2{
    font-size: 16px;
    height: 30px;
    
}

h3{
    font-size: 20px;
    font-weight: 900;
    height: 10px;
}

h4{
    font-size: 1.1em;
    font-weight: 400;
    height: 10px;
}

a{
    color: var(--color-text-pri);
    text-decoration: none;
}

a:hover .app-name, .links_item a:hover{
    text-decoration: underline;
}

.icon{
    font-size: 2.5em;
}

img.icon{
    width: 35px;
    height: 35px;
    object-fit: contain;
}

.btn{
    font-size:2em;
    color: var(--color-text-pri);
}

.btn:hover{
    color: var(--color-text-acc);
    cursor: pointer;
}


/* FORMS */

input{
    background-color: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: 0 1px 0 0 var(--color-text-pri,black);
    color: var(--color-text-pri);
    font-size: 0.8em;
    height: 3.5em;
    transition: all 0.4s ease;
    width: 100%;
}

input:focus{
    box-shadow: 0 1px 0 0 var(--color-text-acc,black);
    outline: none;
}


/* TABLES */

table{
    border: thin solid var(--color-text-pri,black);
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 1em;
    text-align: left;
    width: 100%;
}

table td:nth-of-type(2){
    padding-right: 5em;
}

table td{
    border: thin solid var(--color-text-pri,black);
    color: var(--color-text-pri);
    font-size: 1em;
    overflow: hidden;
    padding: 10px 5px;
    word-break: normal;
}

table th{
    border: thin solid var(--color-text-pri,black);
    color: var(--color-text-pri);
    font-weight: bold;
    padding: 10px 5px;
}

table a{
    color: var(--color-text-pri);
}

table a:hover{
    color: var(--color-text-acc);
}

/* ANIMATION */

.fade{
    opacity: 0;
}

@keyframes fadeseq{
    100%    {
        opacity: 1;
    }
}

.fade{
    opacity: 0;
}

.fade{
    animation: fadeseq .3s forwards;
}

.fade:nth-child(2){
    animation-delay: .4s;
}


/* LAYOUT */

#container{
    align-items: stretch;
    display: grid;
    grid-column-gap: 20px;
    grid-row-gap: 3vh;
    grid-template-columns: 1fr;
    grid-template-rows: 8vh auto;
    justify-items: stretch;
    margin-left: auto;
    margin-right: auto;
    padding-top: 5vh;
    width: 60%;
}



/* SECTIONS */

#header{
    border-bottom: 0px solid var(--color-text-acc);
    z-index: 1;
}

.apps_loop{
    border-bottom: 0px solid var(--color-text-acc);
    display: grid;
    grid-column-gap: 20px;
    grid-row-gap: 0px;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-template-rows: 64px;
    padding-bottom: var(--module-spacing);
}

.apps_icon{
    height: 64px;
    margin-right: 1em;
    padding-top: 15px;
}

.apps_icon span{
    font-size: 2.5em;
    line-height: 3rem;
}

.apps_item{
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    height: 64px;
    margin: 0;
}

.apps_text{
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    overflow: hidden;
    text-transform: uppercase;
}

.apps_text .app-name{
    font-size: 1em;
    font-weight: 500;
}

.apps_text .app-address{
    color: var(--color-text-acc);
    font-size: 0.8em;
}


.links_loop{
    display: grid;
    flex-wrap: nowrap;
    grid-column-gap: 20px;
    grid-row-gap: 0px;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-template-rows: auto;
}

.links_item{
    line-height: 1.5rem;
    margin-bottom: 2em;
    -webkit-font-smoothing: antialiased;
}

.links_item h4{
    color: var(--color-text-acc);
}

.links_item a{
    display: block;
    line-height: 2;
}















/* MODAL */


#modal{
    bottom: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    right: 0;
    top: 0;
    transition: all 0.3s;
    z-index: 20;
}

#modal:target{
    opacity: 1;
    pointer-events: auto;
}

#modal>div{
    background-color: var(--color-background, white);
    border: 4px solid var(--color-text-pri,black);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.30), 0 15px 12px rgba(0, 0, 0, 0.25);
    margin-left: auto;
    margin-right: auto;
    padding: 2em;
    margin-top: 5vh;
    /* Approximately half the width of a 16/9 ratio */
    width: calc(45vh * (16 / 9));
    max-height: 90%;
    display: flex;
    flex-direction: column;
}

#modal-content {
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 20px;
}

#modal h1{
    color: var(--color-text-pri);
    font-size: 2em;
    margin-bottom: 0;
}

#modal-header{
    display:flex;
    justify-content: space-between;
}

#modal-footer{
    display:flex;
    justify-content: flex-start;
}

#modal-footer a{
    margin-right:0.25em;
}

#modal_init a{
    top: 1vh;
    right: 1vh;
    position: fixed;
}

#logo img{
    top: 1vh;
    left: 1vh;
    position: fixed;
	/* apps take 60% of width so logo should not exceed half of the remaining 40% */
	/* should set better size and position on mobile */
	max-width: 15%;
}

#themes{
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 2em;
}

#search-engines{
    margin-bottom: 2em;
}


/* THEMING */

.color-scheme {
    margin: 10px 15px;
    cursor: pointer;
}

.palette {
    display: flex;
    width: 75px;
    box-shadow: 0 0 0 2px var(--color-text-pri,black);
}

.palette-color {
    width: 25px;
    height: 25px;
}
.palette-label {
    padding-top: 2px;
}

.color-scheme:hover .palette {
    box-shadow: 0 0 0 2px var(--color-text-acc,black);
}

.color-scheme:hover .palette-label {
    color: var(--color-text-acc,black);
}

/* SCROLLBARS */

@media screen and (min-width: 400px) {

    ::-webkit-scrollbar {
        width: 12px;
    }

    ::-webkit-scrollbar-track,
    ::-webkit-scrollbar-thumb {
        border-radius: 10px;
    }

    ::-webkit-scrollbar-track {
        background-color: rgba(255,255,255,0.1);
        /* Maybe find a way to change track opacity depending on theme dark/light (not system/browser color scheme) */
        /* background-color: rgba(0,0,0,0.2); */
    }

    ::-webkit-scrollbar-thumb {
        background-color: var(--color-text-pri,black);
    }

    ::-webkit-scrollbar-thumb:hover {
        background-color: var(--color-text-acc,black);
    }

}

/* MEDIA QUERIES */

@media screen and (max-width: 1260px)
{
    #container
    {
        align-items: stretch;
        display: grid;
        grid-column-gap: 10px;
        grid-row-gap: 0px;
        grid-template-columns: 1fr;
        grid-template-rows: 80px auto;
        justify-items: stretch;
        margin-bottom: 1vh;
        margin-left: auto;
        margin-right: auto;
    }
    
    .apps_loop{
        grid-template-columns: 1fr 1fr 1fr;
        width: 100%;
    }

    .links_loop {
        grid-template-columns: 1fr 1fr 1fr;
    }

    #modal>div{
        margin-left: auto;
        margin-right: auto;
        margin-top: 5vh;
        max-width: 90%;
    }
}

@media screen and (max-width: 667px)
{
    html{
        font-size: calc(16px + 6 * ((100% - 320px) / 680));
    }

    #container{
        align-items: stretch;
        display: grid;
        grid-column-gap: 20px;
        grid-row-gap: 0px;
        grid-template-columns: 1fr;
        grid-template-rows: 80px auto;
        justify-items: stretch;
        margin-bottom: 1vh;
        width: 90%;
    }

    h1{
        font-size: 4em;
        height: auto;
        margin-bottom: 0em;
    }

    h2{
        font-size: 1em;
        height: auto;
        margin-bottom: 0em;
    }

    h3{
        font-size: 1em;
    }

    .apps_loop{
        grid-column-gap: 0px;
        grid-row-gap: 0px;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .apps_icon{
        height: 64px;
        margin-right: 0.8em;
        padding-top: 14px;
    }

    .apps_icon span{
        font-size: 2em;
        line-height: 2.5rem;
    }
    
    .links_loop{
        display: grid;
        flex-wrap: nowrap;
        grid-column-gap: 20px;
        grid-row-gap: 0px;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }
}

/* Small Screens */
@media only screen and (max-width: 400px) {
    .app-address {
        display: none;
    }
}

/* MODAL TABS */

.tabs {
    display: flex;
    flex-wrap: wrap;
}
   
.tabs label {
    padding: 1em ;
    margin-right: 0.2em;
    cursor: pointer;
    border-bottom: 4px solid var(--color-text-pri,black);
    text-transform: uppercase;
}

.tabs label:hover {
    color: var(--color-text-acc);
}
   
.tabs .tab-content {
    order: 99;
    width: 100%;
    display: none;
}
   
.tabs input[type="radio"] {
    display: none;
}
   
.tabs input[type="radio"]:checked + label {
    border-bottom: 4px solid var(--color-text-acc,black);
}
   
.tabs input[type="radio"]:checked + label + .tab-content {
    display: block;
}
   

@media (min-width: 400px) {
    .tabs label {
        flex: 1;
        min-width: 25%;
        margin-bottom: 1.5em;
    }
}

@media (max-width: 400px) {
    .tabs label {
        width: 100%;
        margin-right: 0;
        margin-top: 0.2rem;
        text-align: center;
    }
    .tabs label:last-of-type {
        margin-bottom: 1.5em;
    }
}

section > :not(input) {
	caret-color: transparent;
}

select {
  border: 1px solid var(--color-text-pri, black);
}