
/* CSS Style Reset */

/* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 100%;
	font: inherit;
	vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
	display: block;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}
table {
	border-collapse: collapse;
	border-spacing: 0;
}

/* Base Styling */

:root {
    --green-accent: #74992E;
    --wood-accent: #443022;
    --gray-accent: whitesmoke;
}

body, button, input {
    font-family: Garamond, serif;
    font-size: 16px;
    line-height: normal;
}

body {
    min-height: 100vh;
    background-color: white;
    color: black;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

/* Add Book Form Styling */

dialog {
    background-color: whitesmoke;
    padding: 0;
    border: 0;
    border-radius: 5px;
}

dialog::backdrop {
    backdrop-filter: blur(0.25rem);
}

form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;

    min-width: 20vh;
    min-height: 30vh;
    padding: 2rem;
} 

form > * {
    display: flex;
    justify-content: center;
    align-items: center;
}

form h2 {
    font-size: 22px;
    font-weight: bold;
}

form input {
    outline: 0;
    padding: 0.5rem;
    border: 1px solid transparent;
    border-radius: 5px;
}

form input::placeholder {
    color: gray;
}

form input:valid {
    border-color: var(--green-accent);
}

form input:invalid {
    border-color: red;
}

form input:focus {
    border-color: blue;
}

form label, form button {
    padding: 1rem 0;
    font-weight: bold;
    transition: 0.5s ease-in-out;
}

form button {
    background-color: whitesmoke;
    border: 1px solid var(--green-accent);
    border-radius: 5px;
} 

form button:hover {
    background-color: var(--green-accent);
    cursor: pointer;
} 

/* Header Styling */

header {
    display: flex;
    gap: 2rem;
}

header > h1 {
    color: var(--green-accent);
    font-size: 2.5rem;
    font-weight: bold;
}

header > div {
    display: flex;
    gap: 1rem;
}

header .select-wrapper {
    min-width: 130px;
    position: relative;
}
  
header .select-wrapper::after {
    content: "▼";
    color: var(--green-accent);
    font-size: 1rem;
    
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);

    pointer-events: none;
    transition: 0.25s ease-in-out;
}

body header .select-wrapper:has(select.showing)::after {
    color: var(--green-accent);
}

header .select-wrapper:has(select:hover)::after {
    color: white;
}

header select {
    color: var(--green-accent);
    font-family: inherit;
    font-size: 100%;

    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0.5rem 1rem;

    appearance: none;
    border: 1px solid var(--green-accent);
    border-radius: 5px;
    box-shadow: 1px 1px 3px #ccc;
    transition: 0.25s ease-in-out;
}

body header select.showing {
    color: var(--green-accent);
    background-color: white;
    border-color: var(--green-accent);
}

header select:hover {
    color: white;
    background-color: var(--green-accent);
    border-color: var(--green-accent);
    user-select: none;
    cursor: pointer;
}

header select:focus {
    outline: none;
}

header label, header button {
    display: flex;
    align-items: center;
    gap: 0.25rem;

    padding: 0.5rem 1rem;
    background-color: white;
    border: 1px solid var(--green-accent);
    border-radius: 5px;
    box-shadow: 1px 1px 3px #ccc;

    color: var(--green-accent);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 14px;
    transition: 0.5s ease-in-out;
}

header label:hover {
    color: white;
    background-color: rgba(116, 153, 46, 0.5);
    border-color: rgba(116, 153, 46, 0.5);
    user-select: none;
    cursor: pointer;
}

header label:has(input:checked) {
    color: white;
    background-color: var(--green-accent);
}

header label:has(input:checked):hover {
    filter: brightness(0.8);
}

header label span.material-icons.md-18 {
    font-size: 18px;
}

header input {
    position: absolute;
    opacity: 0;
    height: 0;
    width: 0;
    margin: 0;
}

header button:hover {
    color: white;
    background-color: var(--green-accent);
    cursor: pointer;
}

header button:focus {
    outline: none;
}

header button > div {
    box-sizing: border-box;
    position: relative;
    min-width: 20px;
    min-height: 20px;
    margin-right: 0.25rem;

    border: 1px solid var(--green-accent);
    border-radius: 50%;
    transition: 0.5s ease-in-out;
}

header button:hover > div {
    border-color: white;
    transform: rotateZ(360deg);
}

header button span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    color: var(--green-accent);
    transition: 0.5s ease-in-out;
}

header button:hover span {
    color: white;
}

/* Library Grid Styling */

.library-grid {
    display: grid;
    grid-template: minmax(250px, 1fr) / repeat(auto-fit, minmax(200px, 1fr));
    grid-auto-rows: minmax(250px, 1fr);

    min-width: 300px;
    max-width: 900px;
    background: radial-gradient(ellipse at center, #C69C6D 0%, #754224 100%);
    border: 4px solid var(--wood-accent);
    border-radius: 5px;
    box-shadow: 1px 1px 3px #ccc;
    padding: 0.5rem;
    gap: 0.5rem;
}

.library-grid .book-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;

    background-color: var(--gray-accent);
    border: 1px solid black;
    border-radius: 5px;
    padding: 0.5rem 1rem;
}

.library-grid .book-container > * {
    display: flex;
    align-items: center;
    justify-content: center;
}

.library-grid .book-container > div {
    margin-bottom: 0.5rem;
}

.library-grid .book-container label, .library-grid .book-container button {
    padding: 0.5rem 0;
}

.library-grid .book-container button {
    border: 1px solid red;
    border-radius: 5px;
    transition: ease-in-out 0.5s;
}

.library-grid .book-container button:hover {
    background-color: red;
    cursor: pointer;
}

/* Read Label Styling */

label.read-label {
    border-radius: 5px;
    transition: 0.5s ease-in-out;
}

label.read-label:hover {
    filter: brightness(0.8);
    cursor: pointer;
}

label.read-label:has(input:checked) {
    background-color: var(--green-accent);
}

label.read-label:has(input:not(:checked)) {
    background-color: red;
}

input.read-input {
    position: absolute;
    opacity: 0;
    height: 0;
    width: 0;
    margin: 0;
}

/* Media Queries */

@media (max-width: 1100px) and (min-width: 901px) {
    .library-grid {
        width: clamp(300px, 75vw, 900px);
    }
}

@media (max-width: 900px) {
    body {
        align-items: stretch;
        padding: 2rem;
    }

    header {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .library-grid {
        max-width: none;
    }
}

@media (max-width: 500px) {
    body {
        padding: 0.5rem;
    }

    header > div {
        justify-content: center;
        flex-wrap: wrap;
        column-gap: 1rem;
        row-gap: 0.5rem;
    }
}