
/* 
GLOBALS STYLES AND POKEMON CRYSTAL PALETTES
----------------------------------------------------------------
*/

:root{
    --back: #deffde;
    --alt-back: #c69439;
    --acc-back: #b5ff52;
    --c1: #ff9cc6;
    --c2: #0821ff;
    --text: #393939;

    /* --back-text:  #ffff84; */

    --back-text: color-mix(in lab, #ffff84, var(--back) 20%);
    --border-thick-w: 0.4rem;
    --border: 1px solid currentColor;
    --border-thick: var(--border-thick-w) solid currentColor;

    --card-w: min(16rem, 100%);
    --split: min(45%, 32rem);
}

/* pure CSS palette selector */
.palettes{
    position: fixed;
    top: 1em;
    right: 1em;
    z-index: 3;
    background-color: var(--back-text);
    /* color: var(--back-text); */
    border: var(--border);
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-thick-w);
    box-sizing: border-box;
}

.palettes label{
    cursor: pointer;
}
body:has(input[value="morning"]:checked) {
    --back: #e7ff84;
    --back-text: color-mix(in lab, #ffff84, var(--back) 20%);
}
body:has(input[value="day"]:checked) {
    --back: #deffde;
    --back-text: color-mix(in lab, #ffff84, var(--back) 20%);
}
body:has(input[value="night"]:checked) {
    --back: #7b73c6;
    --alt-back: #634a7b;
    --acc-back: #426b9c;
    --c1: #73398c;
    --c2: #005a6b;
    --text: black;
    --back-text: color-mix(in lab, #ffff84, var(--back) 20%);
}
body:has(input[value="inside"]:checked) {
    --back: #f7e7d6;
    --acc-back: #9c9c9c;
    --c1: #ff9cc6;
    --c2: #4a4aff;
    --back-text: color-mix(in lab, #ffff84, var(--back) 20%);
}

@media screen and (max-width: 36rem) {
    .palettes{
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 0;
        display: flex;
        gap: 0.25rem;
        flex-wrap: wrap;
    }
}

/* global styles */
html{
    scroll-behavior: smooth;

    /* big fs for comfy reading */
    font-size: 1.125rem;
}
body{
    background: var(--back);
    color: var(--text);
    margin: 0;
    line-height: 1.5;
    --s: 0.2em;
    --side: calc(var(--s) * 13);
    margin: 0 var(--side);

    accent-color: var(--c1);
}
body:before,
body:after{
    content: '';
    position: fixed;
    inset: 0;
    height: 100%;
    background-image: 
        linear-gradient(to right, 
        var(--acc-back) 0, var(--acc-back) var(--s), 
        transparent var(--s), transparent calc(var(--s) * 3)
        );
    background-size: calc(var(--s) * 3);
    width: var(--side);
    overflow: hidden;
}
body:before{
    right: auto;
}
body:after{
    left: auto;
    transform: scaleX(-1);
}

::selection{
    background-color: var(--c1);
}

@media screen and (max-width: 36rem) {
    html{
        font-size: 1rem;
    }
    body{
        --side: calc(var(--s) * 4);
    }
}

/* 
CLICKABLE STATES
----------------------------------------------------------------
*/

a{
    font-weight: bold;
    color: var(--c2);
}
a:hover,
a:focus{
    color: var(--c1);
    text-decoration: none;
}

details{
    background-color: var(--acc-back);
    border-radius: var(--border-thick-w);
    overflow: hidden;
}
summary{
    cursor: pointer;
    padding: 0.25em 0.5em;
}
summary:hover{
    background-color: var(--c1);
}
details summary + div{
    border-top: var(--border);
    padding: 0.25em 0.5em;
}

:focus{
    outline-offset: 0.1rem;
    outline: 0.1rem dashed var(--c2);
}

/* fix for home link focus */
.home-link:focus{
    outline: none !important;
}
.home-link:focus span,
.home-back:focus{
    outline-offset: 0.1rem !important;
    outline: 0.1rem dashed var(--c2) !important;
}

/* fix for card */
.card a:focus{
    outline-offset: calc(var(--border-thick-w) + 0.1rem);
}


/* TODO: 
* remove has() from :focus
* remove has() from palettes
*/

/* 
TYPOGRAPHY
----------------------------------------------------------------
*/

.home-link, h1, h2, .card p{
    text-transform: lowercase;
    font-style: italic;
    font-weight: normal;
    letter-spacing: -0.025em;
}
.home-link{
    font-size: 2em;
    color: var(--text);
    text-decoration: none;
}
.home-link span{
    vertical-align: top;
    display: inline-block;

    background-color: var(--c1);
    padding: 0.25rem 0.5rem;
    outline-width: 0.2rem;
    outline-color: var(--c1);
    outline-style: dashed;
}
.home-link span:nth-of-type(2){
    margin-top: 1em; 
}
.home-link:hover span,
.home-back:hover,
.home-link:focus span,
.home-back:focus{
    background-color: var(--acc-back);
    outline-color: var(--acc-back);
    color: var(--text);
}
.home-back{
    display: block;
    margin: 1rem auto;
    color: var(--text);
    text-decoration: none;
    background-color: var(--c1);
    padding: 0.5rem 1rem;
    outline-width: 0.2rem;
    outline-color: var(--c1);
    outline-style: dashed;
    font-weight: normal;
    font-style: italic;
    width: fit-content;
    text-align: center;
}
.home-back-container{
    flex-basis: 100%;
    grid-column: 1 / -1;
}

main > *:first-child{
    margin-top: 0;
}

/* h1 are like the cards */
h1{
    font-size: 1.66rem;
    padding: 0.5rem 1em;
    background-color: var(--acc-back);
    color: var(--text);
    border-radius: 0.5em / 50%;
    border: var(--border);
    width: fit-content;
    margin: 0 auto;
}
h2{
    border-bottom: var(--border);
}

@media screen and (max-width: 54rem) {
    .home-link span:nth-of-type(2){
        display: block;
        width: fit-content;
        margin-top: 0.25em;
        margin-left: 2em;
    }  
}

/* 
LAYOUT
----------------------------------------------------------------
*/

header{
    position: sticky;
    top: 0;
    padding: 1.5rem 1rem;
    z-index: 2;
    width: fit-content;
    margin: 0 auto;
    margin-left: calc(var(--split) - 12em);
}

main,
footer > div{
    max-width: 42rem;
    margin: 0 auto;
    padding: 0 1em;
}

/* navigation */
nav{
    padding: 1rem;
}
nav ul{
    padding: 0;
    margin: 0;
    list-style: none;

    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2em;
}

ul{
    list-style-type: square;
}
li::marker {
    color: var(--c1);
}
ol li::marker{
    color: var(--text);
}

blockquote{
    background-color: var(--alt-back);
    padding: 1rem;
    outline-width: 0.1rem;
    outline-color: var(--alt-back);
    outline-style: dashed;
    margin: 1em;
}
blockquote p{
    margin: 0;
}
blockquote:nth-of-type(odd){
    margin-right: 4em;
}
blockquote:nth-of-type(even){
    margin-left: 4em;
}

/* footer */
footer{
    position: relative;
    z-index: 1;
    margin: 0 calc(-1 * var(--side));
    margin-top: 2rem;
    border-top: var(--border);
    padding: 1rem 0;
    background-color: var(--alt-back);
}
footer > div{
    padding: 0 var(--side);
}
footer a{
    color: currentColor;
}

@media screen and (max-width: 36rem){
    header,
    main,
    nav{
        margin-left: 0rem;
        margin-right: 0rem;
    }
}

/* 
SPLIT IT WITH BACK IMAGE
----------------------------------------------------------------
*/

.image-back{
    mix-blend-mode: darken;
    background-color: var(--back);
    pointer-events: none;

    position: fixed;
    z-index: -1;
    left: calc(var(--s) * 14);
    top: 0;
    bottom: 0;
    width: var(--split);

    display: flex;
    align-items: center;
}
.image-back + main,
.inside-nav{
    margin-left: calc(var(--split) + calc(var(--s) * 14));
}
.inside-nav{
    margin-bottom: 2rem;
}

.image-back img {
	max-width: 100%;
	max-height: 36rem;
    position: relative;
    bottom: -2rem;
	margin: 0 auto;
	display: block;
}
.image-back::after{
    /* color image in blue when active */
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--c2);
    pointer-events: none;
    mix-blend-mode: lighten;
    animation: flash 2.5s;
}
@media screen and (max-width: 54rem){

    :root{
        --split: auto;
    }
    .image-back{
        position: relative;
        inset: 0;
        margin: -6em 0 -1.5em;
        width: 100%;

        display: flex;
        align-items: center;
    }
    .image-back img {
	    max-height: 30rem;
    }
}
@media screen and (max-width: 36rem){
    .image-back{
        margin: -3rem 0 0rem;
        width: 100%;
    }
}

/* 
THE CARDS ARE IN YOUR HANDS PLAY THEM
----------------------------------------------------------------
*/

.card{
    min-width: 0;
    line-height: 1.25;

    box-sizing: border-box;
    width: var(--card-w);

    background-color: var(--back-text);
    border: var(--border-thick);
    border-color: var(--text);
    border-radius: var(--border-thick-w);

    position: relative;
    bottom: 0em;
    transition: 0.25s bottom;
}
.card img{
    max-width: 100%;
    height: auto;
    display: block;
    margin: -8% 0;
    mix-blend-mode: darken;
}
.card a{
    display: block;
    text-decoration: none;
    color: currentColor;
    overflow: hidden;
    font-weight: normal;
}
.card h2{
    font-size: 1rem;
    margin: 1rem 1rem 0;

    display: block;
    text-align: center;

    padding: 0.5rem 1rem;
    border: var(--border);
    border-radius: 0.5em / 50%;
}
.card p{
    margin: 0em 1rem 1em;
}

/* color image in blue when active */
.card::after{
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--text);
    pointer-events: none;
    mix-blend-mode: lighten;
}
.card.active::after{
    background-color: var(--c2);
}
.card.active{
    border-color: var(--c2);
}
.card.active h2{
    background-color: var(--c2);
    color: var(--back-text);
    border-color: var(--c2);
}
.card:hover,
.card:has(:focus){
    border-color: var(--c1);
    bottom: 0.5em;
}
.card:hover:after,
.card:has(:focus):after{
    background-color: var(--c1);
    border-color: var(--c1);
}

@media screen and (max-width: 72rem){
    .inside-nav ul{
        gap: 1em;
    }
}

/* mini card */
@media screen and (max-width: 36rem){
    nav ul{
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1em;
    }
    .card h2{
        margin: 0.5em 0.5em 0;
        padding: 0.5em 0.5em;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    .card p{
        margin: 0 0.5rem 0.5rem;
    }
}

@keyframes flash {
    0%{
        background-color: var(--c1);
    }
    100%{
        background-color: var(--c2);
    }
}