:root {
    /* Earthstone color palette */
    --dark-brown: #3e2a1f;
    --mid-brown: #5f3919;
    --light-brown: #a57c52;
    --light-green: #b8b676;
    --dark-green: #1e391b;

    /* Forest green color palette */
    --deep-forest-green: #2a442a;
    --forest-green: #3c6e3c;
    --moss-green: #629462;
    --light-moss: #7bb47b;
    --bright-green: #97d497;
}

#book-animation {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: transparent;
    z-index: 9999; /* Cover page */
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none; /* Disable mouse events */
}

.book-cover {
    background: url("../img/cover_placeholder_stars.png") no-repeat center;
    background-size: cover;
    position: fixed; /* Fixed to cover whole screen */
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    transform-origin: 0% 50%; /* Pivot from the left edge */
    transition: transform 2s ease, opacity 1s ease; /* Smooth transition for turning and fading */
    z-index: 9999; /* Make it above all other content */
    pointer-events: none; /* Disable mouse events */
}

body, html { 
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    height: 100%;
    margin: 0;
}

html {
    position: relative;
    height: 100%;
    width: 100%;
}

html::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    z-index: -1; /* bg behind all other content */
}

h1, h2, h3, p, a, li {
    color: #ffffff;
    text-shadow: 2px 2px 4px #000000; /* Black shadow for better readability */
}

.sidebar {
    padding: 2vh 1vw;
    text-align: left;
}

.sidebar header h1 {
    margin: 0;
    padding: 0;
    color: var(--light-moss);
    width: 100%;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 1vw;
    color: white;
}

.logo {
    height: 10vh;
    margin-right: 2vw;
    padding: 0;
    border-radius: 1vh; /* 16 / sqrt(1920*1080) x 100 */
}

.header-inner > h1 {
    font-size: 3.26vw;
    white-space: nowrap;
    text-align: left;
}

nav {
    display: flex;
    justify-content: center;
}

main {
    flex: 1;
}

.grid-container {
    display: grid;
    justify-content: center;
}

.grid-item {
    width: 100%;
    /*height: 600px; <-- set in script */
    display: inline-block;
    max-height: 55vh;
    border: none;
    border-radius: calc(16 / 1920 * 100vw);
    background: none;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.3s ease; /* Smooth scaling transition for button */
}

.grid-item img {
    width: 100%; /* Make image cover button width */
    object-fit: cover; /* Cover & crop if necessary */
    transition: transform 0.3s ease; 
    border-radius: calc(16 / 1920 * 100vw);
}

nav .grid-container {
    grid-template-columns: repeat(10, 1fr); /* 10 columns */
    padding: 0px; /* Padding around grid */
    width: 87.5%;
    column-gap: 1vw;
    align-items: center;
}

nav .grid-item {
    padding: 0;
    border-radius: 0%;
    overflow: visible;
    text-align: center;
    text-decoration: none;
}

nav .grid-item > h1 { 
    color: #FFF;
    font-size: calc(26 / 1920 * 100vw);
    /*-webkit-text-stroke-color: black;
    -webkit-text-stroke-width: 1px;*/
}

nav .grid-item > h1:hover {
    color: var(--bright-green); /* Example color: Yellow */
    transition: all 0.3s ease; /* Smooth transition */
    transform: scale(1.05); /* Scale up button on hover */
}

/* The modal (background) */
.modal {
    display: none;
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
    align-items: center;
    justify-content: center;
}

.modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 80%;
    margin: auto; /* Center modal-body within the modal */
}

/* Modal content (image) */
.modal-content {
    max-width: 100%; /* Make responsive within modal-body */
    max-height: 80vh; /* Do not exceed 80% of viewport height */
    margin-bottom: 1.85vh; /* Space between image and caption */
}

/* Caption of modal image */
#caption {
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    width: 100%; /* Ensure it spans width of its container */
}

/* Add animation */
.modal-content, #caption {  
    animation-name: zoom;
    animation-duration: 0.3s;
}

@keyframes zoom {
    from {transform:scale(0)} 
    to {transform:scale(1)}
}

/* The close button */
.close {
    position: absolute;
    top: 1.39vh;
    right: 1.82vw;
    color: #f1f1f1;
    font-size: 2.08vw;
    font-weight: bold;
    transition: 0.3s;
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

@media screen and (max-width: 40vw) {
    .sidebar {
        text-align: center;
    }

    .header-inner {
        flex-direction: column;
        text-align: center;
    }
}

footer {
    text-align: center;
    padding: 10px;
    font-size: calc(16 / 1920 * 100vw);
}
