:root {
    --ink: #393939;
    --bottom-border: 2px;
}

/* Base style for mobile devices */
body {
    display: flex;
    flex-direction: column;
    height: 100dvh;       
    margin: 0px;
    padding: 24px;
    box-sizing: border-box;
    font-family: "Quintessential", serif;
    color: #393939;
    white-space: pre-line;
    overflow: hidden;
}

#twigs {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

#twig {
    width: 250px;
    position: absolute;
}

/* left */
#twig:nth-child(1) {
    top: 5%;
    left: -145px;
    transform: rotate(-15deg);
}

#twig:nth-child(2) {
    top: 20%;
    left: -145px;
    transform: rotate(45deg);
}

#twig:nth-child(3) {
    top: 50%;
    left: -150px;
    transform: rotate(-45deg);
}

#twig:nth-child(4) {
    top: 80%;
    left: -150px;
    transform: rotate(20deg);
}

#twig:nth-child(5) {
    top: 85%;
    left: -80px;
    transform: rotate(-50deg);
}

/* bottom */
#twig:nth-child(6) {
    bottom: -100px;
    left: 10%;
    transform: scaleX(-1) rotate(-250deg);
}

#twig:nth-child(7) {
    bottom: -50px;
    left: 10%;
    transform: scaleX(-1) rotate(45deg);
}

#twig:nth-child(8) {
    bottom: -50px;
    left: 30%;
    transform: scaleY(-1) rotate(-30deg);
}

#twig:nth-child(9) {
    left: 50%;
    bottom: -90px;
    transform: scaleX(-1) rotate(-50deg);
}

#twig:nth-child(10) {
    bottom: -20px;
    left: 90%;
    transform: scaleX(-1) rotate(-45deg);
}

#twig:nth-child(11) {
    bottom: -50px;
    left: 10%;
    transform: scaleX(-1) rotate(45deg);
}

#twig:nth-child(12) {
    bottom: -30px;
    left: 70%;
    transform: scaleX(-1) rotate(10deg);
}


#twig:nth-child(13) {
    bottom: -20px;
    left: 70%;
    transform: scaleX(-1) rotate(120deg);
}

/* right */
#twig:nth-child(14) {
    top: 85%;
    right: -100px;
    transform: rotate(30deg);
}

#twig:nth-child(15) {
    top: 55%;
    right: -150px;
    transform: rotate(-50deg);
}

#twig:nth-child(16) {
    top: 55%;
    right: -180px;
    transform: scaleX(-1) rotate(-10deg);
}

#twig:nth-child(17) {
    top: 25%;
    right: -160px;
    transform: scaleX(-1) rotate(20deg);
}

#twig:nth-child(18) {
    top: 5%;
    right: -160px;
    transform: scaleX(-1) rotate(-20deg);
}

/* top */
#twig:nth-child(19) {
    top: -50px;
    left: -50px;
    transform: scaleX(-1) rotate(-25deg);
}

#twig:nth-child(20) {
    top: -20px;
    left: 30%;
    transform: scaleX(-1) rotate(-20deg);
}

#twig:nth-child(21) {
    top: -50px;
    left: 30%;
    transform: rotate(-45deg);
}

#twig:nth-child(22) {
    top: -40px;
    left: 50%;
    transform: rotate(120deg);
}

#twig:nth-child(23) {
    top: -30px;
    left: 75%;
    transform: scaleX(-1) rotate(35deg);
}

#loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    z-index: -1;
    font-size: 20px;
    gap: 8px;
}

#progress {
    width: 250px;
}

h1 {
    text-align: center;
    font-size: 2rem;
    filter: url(#text);
}

.content {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    min-height: 0;
}

.crow {
    width: 100%;
    max-width: 300px;
    height: auto;
    opacity: 0;
    transition: opacity 1.5s linear;
    z-index: -1;
}

.book-wrapper {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    width: 100%;
    max-width: 950px;
    gap: 16px;
}

#book {
    overflow: hidden;
    flex: 1;
    min-height: 0;
    position: relative;
    display: flex;
    opacity: 0;
    transition: opacity 2.5s linear;
    transform: translateY(500px);
    transition: transform 1s ease-out;
    background-color: white;
}


.book-border {
    position: absolute;
    width: 100%;
    height: 100%;
    inset: 0;
    pointer-events: none;
    filter: url(#pencil);
}

path {
    stroke: #393939;
    stroke-width: 2;
    /* fill: url(#paper); */
    fill: none;
}

#page {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin: 24px 12px;
    padding: 24px 24px;
    font-size: 1.25rem;
    /* filter: url(#text); */
    transition: opacity .6s ease-in-out;
}

.tooltiptext {
    font-family: "Quintessential", serif;
    filter: url(#text);
    visibility: hidden;
    font-size: 16px;
    color: white;
    background-color: var(--ink);
    text-align: center;
    padding: 6px 12px;
    border-radius: 4px;
    position: absolute;
    top: -40px;
    width: 60px;
}

/* #prev .tooltiptext {
    left: 0px;
} */

#menu .tooltiptext, #shuffle .tooltiptext, #next .tooltiptext   {
    left: -20px;
}

.footer {
    display: flex; 
    flex-direction: row;
    gap: 16px;
    justify-content: space-between;
    padding-bottom: 8px;
}

.footer-center {
    display: flex;
    flex-direction: row;
    gap: 16px;
}

button {
    position: relative;
    font-family: "Felipa";
    font-size: 1.25rem;
    color: #393939;
    background: transparent;
    border: none;
    height: 48px;
    width: 48px;
    opacity: 0;
    transition: opacity .5s linear;
    transform: translateY(48px);
    transition: transform .5s ease-out;
    background-color: white;
}

button::before {
    content:"";
    position: absolute;
    inset: 0;
    border: 2px solid var(--ink);
    border-bottom: var(--bottom-border) solid var(--ink);
    filter: url(#pencil);
}

button:hover {
    cursor: pointer;
}

button:active {
    background-color:  #3939391d;
}

button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

button img {
    filter: url(#text);
}

.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
}

ul {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

li:hover {
    text-decoration: underline;
    cursor: pointer;
}


/* for devices with a minimum width of 768px (Medium) */
@media screen and (min-width: 768px) {
    body {
        padding: 40px 80px;
    }

    .title {
        font-size: 2.5rem;
    }

    .crow {
        max-width: 450px;
        height: auto;
    }
}


/* for devices with a minimum width of 1400px (Large) */
@media screen and (min-width: 1400px) {
    .content {
        flex-flow: row; 
        justify-content: center;
        flex-direction: row-reverse;
        gap: 80px;
    }

    h1 {
        font-size: 3rem;
    }

    .book-wrapper {
        height: 100%;
        max-width: 500px;
        max-height: 650px;
    }

    .crow {
        max-width: 700px;
        height: auto;
    }
}


/* only display tooltips on hover devices */
@media (hover: hover) {
    button:hover .tooltiptext {
        visibility: visible;
    }

    button:hover::before {
        content:"";
        border-bottom-width: 4px;
    }
}

/* change vid on small heights */
@media screen and (max-height: 800px) and (max-width: 1399px) {
    .crow {
        max-width: 200px;
    }
}

@media screen and (max-height: 600px) and (max-width: 1399px) {
    .crow {
        display: none;
    }
}

@media screen and (max-height: 600px) and (min-width: 1400px) {
    .crow {
        max-width: 400px;
    }
}

@media screen and (max-height: 500px) and (min-width: 1400px) {
    .crow {
        display: none;
    }

    .book-wrapper {
        height: 100%;
        max-width: 100%;
    }
}

