
.piano-body h1{
    font-size: 2.5em;;
}

:root{
    --totalwidth: 90vw;
    --width:calc(var(--totalwidth)/3);
    --k13: calc(var(--width)*13/168);
    --k14: calc(var(--width)*14/168);
    --k15: calc(var(--width)*15/168);
}

.header-piano{
    position: sticky;
}

/* piano body, main */
.piano-body{
    background-color: var(--darkblue);
    justify-content: start;
}

.main-piano{
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.main-piano section{
    margin: 1em;
}

.piano-title{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
}

.piano-info{
    display: flex;
    flex-direction: column;
    align-content: center;
}

.piano-controls{
    background-color: rgba(255, 255, 255, 0.421);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    padding: 1em;
}

/* piano section */
.piano{
    display: flex;
    flex-direction: row;
    width: var(--totalwidth);
    justify-content: center;
}

/* piano wrapper */
.piano-wrapper{
    align-self: center;
    position: relative;
    background-color: none;
    display: flex;
    justify-content: center;
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    aspect-ratio: 168/150;
}

.keys button{
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: end;
    border-top: none;
}

.white-keys{
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    aspect-ratio: 168/150;
}

.white-keys button{
    width: calc(var(--width)/7);
    border: 1px solid #999;
    box-shadow: inset 0 0 8px #999999;
    background: linear-gradient(#ddd, #fff 25%);
    font-size: calc(var(--width)/20);
    color: black;
}

.black-keys{
    width: 100%;
    position: absolute;
    top: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    z-index: 1000;
}

.black-keys button{
    width: var(--k14);
    height: calc(var(--width)/(168/90));;
    position: absolute;
    background: linear-gradient(#555, #000 30%); 
    box-shadow:  0 4px 5px #ccc, inset 0px 0px 0px 2px rgba(220, 220, 220, 0.2);
    border: solid #000;
    border-width: 0 8px 14px;
    border-bottom-color: #424546;
    border-left-color: #121516;
    border-right-color: #121516;
    color: white;
    font-size: calc(var(--width)/30);
}

.black-keys button:nth-child(1){
    left: var(--k15);
}

.black-keys button:nth-child(2){
    left: calc(var(--k15) + var(--k14)*2);
}

.black-keys button:nth-child(3){
    left: calc(var(--k15)*2 + var(--k14)*3 + var(--k13));
}

.black-keys button:nth-child(4){
    left: calc(var(--k15)*2 + var(--k14)*5 + var(--k13));
}

.black-keys button:nth-child(5){
    left: calc(var(--k15)*2 + var(--k14)*7 + var(--k13));
} 

.white-keys button:hover{
    background: linear-gradient(#ffffff, #eeeded 25%);
}

.black-keys button:hover{
    background: black;
    background: linear-gradient(#5c5c5c, #353535 30%); 
}

.black-keys button.active{
    box-shadow:  inset 0px 0px 0px 2px rgba(220, 220, 220, 0.2);
    background: linear-gradient(#818181, #505050 30%); 
    border-width: 0 8px 8px;
}

.white-keys button.active{
    background: linear-gradient(#ffffff, #ddd 25%);
}

#volume-slider{
    accent-color: var(--darkblue);
}

/* Style for switch controls */
@supports (-webkit-appearance: none) or (-moz-appearance: none){

.checkbox-wrapper-14 input[type=checkbox]{
    appearance: none;
    --active: var(--darkblue);
    --active-inner: #fff;
    --focus: 2px rgba(39, 94, 254, .3);
    --border: #BBC1E1;
    --border-hover: var(--darkblue);
    --background: #fff;
    --disabled: #F6F8FF;
    --disabled-inner: #E1E6F9;
    -webkit-appearance: none;
    -moz-appearance: none;
    height: 21px;
    outline: none;
    display: inline-block;
    vertical-align: top;
    position: relative;
    margin: 0;
    cursor: pointer;
    border: 1px solid var(--bc, var(--border));
    background: var(--b, var(--background));
    transition: background 0.3s, border-color 0.3s, box-shadow 0.2s;
}

.checkbox-wrapper-14 input[type=checkbox]:after{
    content: "";
    display: block;
    left: 0;
    top: 0;
    position: absolute;
    transition: transform var(--d-t, 0.3s) var(--d-t-e, ease), opacity var(--d-o, 0.2s);
}

.checkbox-wrapper-14 input[type=checkbox]:checked{
    --b: var(--active);
    --bc: var(--active);
    --d-o: .3s;
    --d-t: .6s;
    --d-t-e: cubic-bezier(.2, .85, .32, 1.2);
}

.checkbox-wrapper-14 input[type=checkbox]:disabled{
    --b: var(--disabled);
    cursor: not-allowed;
    opacity: 0.9;
}

.checkbox-wrapper-14 input[type=checkbox]:disabled:checked{
    --b: var(--disabled-inner);
    --bc: var(--border);
}

.checkbox-wrapper-14 input[type=checkbox]:disabled + label{
    cursor: not-allowed;
}

.checkbox-wrapper-14 input[type=checkbox]:hover:not(:checked):not(:disabled){
    --bc: var(--border-hover);
}

.checkbox-wrapper-14 input[type=checkbox]:focus{
    box-shadow: 0 0 0 var(--focus);
}

.checkbox-wrapper-14 input[type=checkbox]:not(.switch){
    width: 21px;
}

.checkbox-wrapper-14 input[type=checkbox]:not(.switch):after{
    opacity: var(--o, 0);
}

.checkbox-wrapper-14 input[type=checkbox]:not(.switch):checked{
    --o: 1;
}

.checkbox-wrapper-14 input[type=checkbox] + label{
    display: inline-block;
    vertical-align: middle;
    cursor: pointer;
    margin-left: 4px;
}

.checkbox-wrapper-14 input[type=checkbox]:not(.switch){
    border-radius: 7px;
}

.checkbox-wrapper-14 input[type=checkbox]:not(.switch):after{
    width: 5px;
    height: 9px;
    border: 2px solid var(--active-inner);
    border-top: 0;
    border-left: 0;
    left: 7px;
    top: 4px;
    transform: rotate(var(--r, 20deg));
}

.checkbox-wrapper-14 input[type=checkbox]:not(.switch):checked{
    --r: 43deg;
}

.checkbox-wrapper-14 input[type=checkbox].switch{
    width: 38px;
    border-radius: 11px;
}

.checkbox-wrapper-14 input[type=checkbox].switch:after{
    left: 2px;
    top: 2px;
    border-radius: 50%;
    width: 17px;
    height: 17px;
    background: var(--ab, var(--border));
    transform: translateX(var(--x, 0));
}

.checkbox-wrapper-14 input[type=checkbox].switch:checked{
    --ab: var(--active-inner);
    --x: 17px;
}

.checkbox-wrapper-14 input[type=checkbox].switch:disabled:not(:checked):after{
    opacity: 0.6;
}
}

 .checkbox-wrapper-14 *{
    box-sizing: inherit;
}

.checkbox-wrapper-14 *:before,
.checkbox-wrapper-14 *:after{
    box-sizing: inherit;
}

/* Media queries */
@media (max-width: 480px){

    :root{
        --totalwidth: 90vh;
    }

    .main-piano{
        justify-content: start;
        height: fit-content;
    }

    .piano{
        margin-top: 100px;
        transform: rotate(90deg);
        transform-origin: 30% 110%;
        z-index: 100;
    }

    .piano::after{
        content: "";
        margin-right: 50px;
    }

    .piano-info{
        flex-direction: row;
    }
}
