/* Define Variables */
:root{
    --background-color: white;
    --foreground-color: rgb(45, 45, 45);
    --elevation-one-color: rgb(210, 235, 250);
    --elevation-one-shadow: 0px 7.5px 15px 0px rgba(0, 0, 0, 0.1);
    --elevation-two-color: rgb(165, 215, 250);
    --elevation-two-shadow: 0px 10px 17.5px 0px rgba(0, 0, 0, 0.125);
    --error-color: rgb(225, 20, 20);
    --warning-color: rgb(250, 160, 50);
    --default-font-size: 1em;
    --small-font-size: 0.75em;
    --large-font-size: 2.5em;
    --x-large-font-size: 3.5em;
    --menu-font-size: 1.5em;
    --responsive-font-size: 0.9em;
    --responsive-large-font-size: 2em;
    --ease-in-out-quad: cubic-bezier(0.45, 0, 0.55, 1);
}

/* Sets the background and default styles, a black font with a white background that spans the viewports full width with the san francisco font at 1em with a line height of 1.2 */
html,body{
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    text-decoration: none;
    max-width: 100vw;
    width: 100vw;
    background-color: var(--background-color);
    color: var(--foreground-color);
    overflow-x: hidden;
    font-size: var(--default-font-size);
    line-height: 1.2;
}

/* Set the hyperlinks to always be black and have no underline */
a{
    text-decoration: none;
    color: var(--foreground-color);
}

/* Add padding to summary elements */
summary{
    padding: 0.5vh;
}

/* Set the grid for the entire page
Set width to span the full page or a max of 1920 pixels
Set the grid to cover the full window
Center the grid horizontally
Split the grid into three columns, 20%, 10% and the remaining width
Set the header grid area to span the first two columns
Set the main and footer grid areas to span the entire width */
.container{
    width: 100vw;
    max-width: 1920px;
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 20% 10% 1fr;
    grid-template-areas: 'header header placeholder' 'main main main' 'footer footer footer';
}

/* Set the header div to the grid area 'header'
Add 1% of the windows height as padding
Center align text
Set the height to be at least 5% of the window height or to fit the content inside of it
Make the font bolder */
.header{
    grid-area: header;
    padding: 1vh;
    text-align: center;
    height: fit-content;
    min-height: 5vh;
    font-weight: bold;
    display: block;
}

/* Enlargen the font size */
.header a{
    font-size: var(--large-font-size);
}

/* Make the menu span the entire width of it's parent element and give it 3/4 of the font size as a margin on top */
.menu{
    margin-top: calc(var(--menu-font-size)*0.75);
    width: 100%;
}

/* Make the menu's links the associated font size
Add a small portion of padding
Set the corner radius to be 10px
Set a transition for the hover effect */
.menu a{
    font-size: var(--menu-font-size);
    padding: calc(var(--menu-font-size)/4);
    border-radius: 10px;
    background-color: var(--background-color);
    box-shadow: none;
    transition: all 0.5s var(--ease-in-out-quad);
}

/* When hyperlinks in the menu are hovered on or focused then transition the background and shadow to the first elevation level */
.menu a:hover, .menu a:focus{
    background-color: var(--elevation-one-color);
    box-shadow: var(--elevation-one-shadow);
    transition: all 0.5s var(--ease-in-out-quad);
}

/* Give the search div 1% of the windows width as padding
Center align text
Set a minimum height of 5% of the windows height or enough height to fit the content within */
.search{
    padding: 1vw;
    text-align: center;
    min-height: 5vh;
    height: fit-content;
}

/* Style the advanced search button
Set the font size to the menu's and make it bold
Add padding
Set a corner radius of 10px
Set the width to fit the content
Add top margin and center horizontally
Set a transition for the hover effect */
.advanced_search{
    display: block;
    font-size: var(--menu-font-size);
    font-weight: bold;
    padding: 0.5em;
    border-radius: 10px;
    background-color: inherit;
    box-shadow: none;
    width: fit-content;
    margin: 0.5em auto 0 auto;
    transition: all 0.5s var(--ease-in-out-quad);
}

/* When the advanced search button is hovered on or focused then transition the background second elevation level but the shadow to the first */
.advanced_search:hover{
    background-color: var(--elevation-two-color);
    box-shadow: var(--elevation-one-shadow);
    transition: all 0.5s var(--ease-in-out-quad);
}

/* Set the main div to the grid area 'main'
Set the height to fit the contents but at least 75% of the window's height
Add a little padding and left align text */
.main{
    grid-area: main;
    height: fit-content;
    min-height: 75vh;
    padding: 1vw;
    text-align: left;
}

/* Set the splash screen to take up 75% of the width and 90% of the height
Set the background and shadow to the first elevation and the corner radius to 10px
Give the container a 5% padding and horizontally center align along with the text */
.splashscreen_container{
    width: 75%;
    height: 90%;
    background-color: var(--elevation-one-color);
    border-radius: 10px;
    box-shadow: var(--elevation-one-shadow);
    padding: 5%;
    margin: auto;
    text-align: center;
}

/* Make the h1 elements in the splashscreen extra large and bold */
.splashscreen_container h1{
    font-size: var(--x-large-font-size);
    font-weight: bold;
}

/* Center and seperate the search button */
.search input[type=submit]{
    display: block;
    margin: 1em auto;
}

/* Set the random book to take up 50% of the windows width and horizontally center it
Display a grid within it with the header taking up the full width and the book and details sharing 50% each of the width
Add a corner radius of 10 pixels 
Elevate the background colour and shadow to the first elevation level
Add 2.5 of the font size as padding */
.book_container{
    width: 50%;
    height: min-content;
    margin: 5vh auto;
    display: grid;
    grid-template-areas: 'heading heading' 'book book_details';
    grid-template-columns: 1fr 1fr;
    background-color: var(--elevation-one-color);
    border-radius: 10px;
    box-shadow: var(--elevation-one-shadow);
    padding: 2.5em;
}

/* Set the heading grid area */
.book_title{
    grid-area: heading;
}

/* Set the book grid area
Make the div fit its content and display alongside with other elements
Make the maximum width 40% and a minimum width of 300 pixels
Horizontally center align
Add 1% of the windows width as padding
Set the background colour as the second elevation and the shadow the first level */
.book{
    grid-area: book;
    display: inline-block;
    height: fit-content;
    width: fit-content;
    max-width: 40%;
    margin: 0 auto;
    min-width: 300px;
    padding: 1vw;
    border-radius: 10px;
    background-color: var(--elevation-two-color);
    box-shadow: var(--elevation-one-shadow);
}

/* Make the h3 elements in the book div center aligned
Make the width fit the content
Set the z index to 0
Add a border with a corner radius of 10 pixels
Adding 0.5% of the windows width as padding but no margin at the bottom */
.book h3{
    text-align: center;
    width: fit-content;
    z-index: 0;
    border: 5px solid;
    border-radius: 10px;
    padding: 0.5vw;
    margin-bottom: 0px;
}

/* Set the image to be as wide as possible but at least 200 pixels and a maximum of 500 pixels
Set the height automatically
Makes the image show within the space specified
Add a book like border */
.book img{
    width: 100%;
    min-width: 200px;
    height: auto;
    object-fit: contain;
    border-radius: 5px 15px 15px 5px;
    max-width: 500px;
    border-right: var(--book-outline-right);
    border-bottom: var(--book-outline-bottom);
}

/* Set the book details grid area */
.book_details{
    grid-area: book_details;
    max-height: inherit;
    overflow-y: scroll;
}

/* Add a vertical margin of the font size on header elements in the details */
.book_details h4, .book_details h5{
    margin: 1em 0;
}

/* Set the footer grid area
Add 1% of the windows width as padding
Center align text
Set height as the minimum for the content */
.footer{
    grid-area: footer;
    padding: 1vw;
    text-align: center;
    height: min-content;
}

/* Make elements within the footer have no padding or margin and as short as possible while containing their content */
.footer > *{
    margin: 0px;
    padding: 0px;
    height: min-content;
}

/* Make the privacy statement's font small
Set the width to be a minimum of 240px but normally 50% of the possible width
Horizontaly center align but add 5 font sizes of margin on the bottom
Left align text */
.privacy_statement{
    font-size: var(--small-font-size);
    width: 50%;
    min-width: 240px;
    margin: 0 auto 5em auto;
    text-align: left;
}

/* Center align the original privacy statement text */
.privacy_statement summary{
    text-align: center;
}

/* If the screen in smaller than 1200px */
@media screen and (max-width:1200px){
    /* Split the grid into two columns, 360 pixels wide and the remaining width */
    .container{
        grid-template-columns: 360px 1fr;
        grid-template-areas: 'header placeholder' 'main main' 'footer footer';
    }
    /* Set the grid in the book container to stack each part on each other */
    .book_container{
        grid-template-areas: 'heading' 'book' 'book_details';
        grid-template-columns: 1fr;
    }
    /* If the screen is smaller than 840 pixels */
    @media screen and (max-width:840px){
        /* Make the default font size smaller */
        html,body{
            font-size: var(--responsive-font-size);
        }
        /* Vertically stack each part of the grid with the header taking up the full width */
        .container{
            grid-template-areas: 'header' 'main' 'footer';
            grid-template-columns: 1fr;
        }
        /* Set the header to take the full width
        Set the minimum height to the height of the content
        Add a small margin at the bottom and a 3% padding all around
        Align the text left */
        .header{
            width: 100%;
            min-height: fit-content;
            margin-bottom: 0.5vh;
            text-align: left;
            padding: 3%;
        }
        /* Set the search div to take up the full width 
        Add a margin of 0.5% of the windows height on the bottom */
        .search{
            width: 100%;
            margin-bottom: 0.5vh;
        }
        /* Set the main grid area to be 100% of the possible width and horizontally center */
        .main{
            width: 100%;
            margin-left: auto;
            margin-right: auto;
        }
    }
}