@import url('https://fonts.googleapis.com/css2?family=Libre+Bodoni:wght@400;700&family=Lato:wght@400;700&display=swap');

/* Global Styles */
:root {
    --primary-color: #95C4A3;
    --text-color: #555;
    --logo-color: #4a4a4a; 
    --accent-color: #C0743B;/*#E27D60;*/
    --background-color: #fff;
    --light-background: #f4f4f4;
    --main-background: #F8F8F8;
    --header-font: 'Libre Bodoni', 'Bodoni MT', 'Bodoni 72', 'Didot', 'Didot LT STD', 'Hoefler Text', Garamond, 'Times New Roman', serif;
    --body-font: 'Lato', 'Open Sans', Arial, Helvetica, sans-serif;
}

html {
    font-size: 100%; /* Base font size */
}

body {
    font-family: var(--body-font);
    font-size: 1rem; /* Relative to html font size */
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    margin: 0;
    padding: 6% 0 0 0; /* Adjust padding to account for sticky header */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.book-title {
    font-size:1rem !important;
    font-style: italic;
    font-weight: 600;
    color: var(--accent-color);
  }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--header-font);
    color: var(--accent-color);
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 0.5rem 0;
}

h1 { 
    font-size: 2.5rem; /* Relative to html font size */
    margin-bottom: 0.5rem;
}

h2 { 
    font-size: 2rem; /* Relative to html font size */
    margin-top: 0;
    margin-bottom: 1rem;
}

h3 { font-size: 1.75rem; /* Relative to html font size */ }
p { font-size: 1rem; /* Relative to html font size */ }

a {
    color: var(--accent-color);
    text-decoration: none;
}

a:hover {
    color: var(--primary-color);
}

.button {
    display: inline-block;
    padding: 1% 2%;
    background-color: var(--accent-color);
    color: var(--background-color);
    text-decoration: none;
    border-radius: 3px;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.1s ease;
    text-align: center;
}

.button:hover {
    background-color: var(--text-color);
    transform: translateY(-2px);
}

.button:active {
    transform: translateY(0);
}

/* Specific styles for book page headers */
.book-title {
    color: var(--logo-color);
    font-size: 1.75rem;
    line-height:25%;
    margin-top:5%;
}

.book-subtitle {
    font-size: 1.1rem;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--logo-color);
    font-weight: normal;
    font-style: italic;
}

/* Header Styles */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: var(--light-background);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px; /* Set a fixed height for the header */
    box-shadow: 0 1px 2px rgba(0,0,0,0.1); /* Optional: adds a subtle shadow */
}

nav ul {
    display: flex;
    list-style-type: none;
    padding: 0;
    margin: 0;
}

nav ul li {
    margin-left: 1rem;
}

nav ul li a {
    text-decoration: none;
    color: var(--accent-color);
    text-transform: uppercase; /* This makes the text uppercase */
    font-size: 0.875rem; /* Optionally reduce font size for uppercase text */
    letter-spacing: 0.05em; /* Optionally add letter spacing for better readability */
}

.logo {
    font-family: var(--header-font);
    font-size: 1.5rem;
    color: var(--logo-color);
    font-weight:700;
}

/* Responsive image */
img {
    max-width: 100%;
    height: auto;
}

.book-cover {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

@media (min-width: 600px) {
    .book-cover {
        max-width: 50%;
    }
}

.featured-book-cover {
    float: left;
    margin-right: 1.25em; /* 20px ÷ 16 = 1.25em */
    max-width: 100%;
    height: auto;
}

@media (max-width: 600px) { /* 600px ÷ 16 = 37.5em */
    .featured-book-cover {
        float: none;
        margin-right: 0;
        margin-bottom: 1.25em; /* 20px ÷ 16 = 1.25em */
    }
}

.book-content {
    display: flex;
    align-items: center; /* Changed from flex-end to center */
    margin-bottom: 1.25em;
}

.featured-book-cover {
    flex-shrink: 0;
    margin-right: 1.25em;
    max-width: 100%;
    height: auto;
}

.book-description {
    flex-grow: 1;
}
.book-description p:first-child {
    margin-top: 0;
}

@media (max-width: 37.5em) { /* 600px */
    .book-content {
        flex-direction: column;
        align-items: center;
    }

    .featured-book-cover {
        margin-right: 0;
        margin-bottom: 1.25em;
    }

    .book-description {
        text-align: center;
    }
}

/* Main Content Styles */
main {
    flex: 1;
    padding: 1rem;
    max-width: 1000px;
    margin: 0 auto;
    width: 90%; /* Adjust width for smaller screens */
    background-color: var(--main-background);
}
section{
    margin-top: 2em;
}

/* Homepage Blog Posts */
.recent-posts {
    margin: 2rem 0;
}
.recent-posts h2{
    color: var(--primary-color);
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    padding-left:.5rem;
}

.post-preview {
    background: var(--light-background);
    padding: 1rem;
    border-radius: 0.25rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.post-preview h3 {
    margin-top: 0;
    font-size: 1rem;
}

.post-preview time {
    font-size: 0.75rem;
    color: var(--secondary-color);
}

.post-preview p {
    margin: 0.5rem 0;
    font-size: .8rem;
}

.read-more {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: bold;
}

.placeholder {
    background: var(--very-light-background);
    box-shadow:none !important;
}

.view-all {
    display: block;
    text-align: center;
    margin-top: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

@media (max-width: 768px) {
    .post-grid {
        grid-template-columns: 1fr;
    }
}

textarea#message {
    width: 100%;
    min-height: 150px;
    resize: vertical;
    padding: 8px;
    border: 1px solid var(--light-background);
    border-radius: 4px;
    box-sizing: border-box;
    font-family: var(--body-font);
    font-size: 1rem;
    line-height: 1.5;
}
  /* Specific styles for book page */
.book-cover {
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  }
  
  .book-info {
    text-align: center;
  }
  
  .book-title {
    margin-bottom: 0.5rem;
  }
  
  .book-subtitle {
    margin-bottom: 1.5rem;
    font-style: italic;
  }
  
  .book-description {
    text-align: left;
  }

  .book-description h2 {
    line-height: 1.5rem;
    margin-top:1.25rem;
  }

/* ERROR HANDLING */
.error-message {
    color: var(--accent-color);
    font-size: 0.875rem;
    margin-top: 5px;
}

#form-message {
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 5px;
}

#form-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#form-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Footer Styles */
footer {
    background-color: var(--light-background);
    padding: 1rem;
    text-align: center;
    font-size: 0.875rem; /* Relative to html font size */
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

footer nav ul {
    display: flex;
    list-style-type: none;
    padding: 0;
}

footer nav ul li {
    margin: 0 0.5rem;
}

footer nav ul li a {
    text-decoration: none;
    color: var(--accent-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    nav ul, .footer-content {
        flex-direction: column;
    }

    nav ul li, footer nav ul li {
        margin: 0.5rem 0;
    }

    main {
        padding: 0.5rem;
        width: 95%; /* Further adjust width for mobile */
    }

    h1 {
        font-size: 2rem; /* Smaller font size for mobile */
    }

    h2, .book-subtitle {
        font-size: 1.5rem;
    }

    body {
        padding-top: 100px; /* Adjust for taller header on mobile */
    }

    header {
        height: auto; /* Allow header to expand on mobile */
        flex-direction: column;
        align-items: flex-start;
        padding: 0.5rem 1rem;
    }

    .logo {
        margin-bottom: 0.5rem;
    }

    nav {
        width: 100%;
    }

    nav ul {
        flex-direction: row;
        justify-content: space-between;
    }

    nav ul li {
        margin: 0;
    }
}

/* Responsive typography */
@media screen and (min-width: 20rem) {
    html {
        font-size: calc(0.875rem + 0.5vw);
    }
}

.book-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}


@media (min-width: 768px) {
  .book-intro {
    flex-direction: row;
    align-items: flex-start;
  }

  .book-cover {
    max-width: 45%;
    margin-right: 1rem;
  }

  .book-info {
    flex: 1;
    text-align: left;
  }
}

/* 404 PAGE */
.error-404 {
    text-align: center;
    padding: 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.error-404 h1 {
    font-size: 3rem;
    color: #333;
    margin-bottom: 1rem;
}

.error-404 p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 1.5rem;
}

.error-404 ul {
    list-style-type: none;
    padding: 0;
}

.error-404 ul li {
    margin-bottom: 0.5rem;
}

.error-404 a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.error-404 a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Contact Form Styles */
#contact-form {
    max-width: 600px;
    margin: 0 auto;
}

fieldset {
    border: 1px solid var(--light-background);
    border-radius: 4px;
    padding: 2%;
    margin-bottom: 2%;
}

legend {
    font-family: var(--header-font);
    color: var(--accent-color);
    font-weight: 600;
    font-size: 1.2rem;
}

.form-group {
    margin-bottom: 2%;
}

label {
    display: block;
    margin-bottom: 0.25%;
    color: var(--text-color);
}

input[type="text"],
input[type="email"],
textarea {
    width: 100%;
    padding: 1%;
    border: 1px solid var(--light-background);
    border-radius: 4px;
    box-sizing: border-box;
    font-family: var(--body-font);
    font-size: 1rem;
}

input[type="text"],
input[type="email"] {
    height: 40px;
}

button[type="submit"] {
    display: inline-block;
    margin-top: -2%;
    padding: 1% 2%;
    background-color: var(--accent-color);
    color: var(--background-color);
    text-decoration: none;
    border: none;
    border-radius: 3px;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.1s ease;
    text-align: center;
    cursor: pointer;
    font-size: 1rem;
}

button[type="submit"]:hover {
    background-color: var(--text-color);
    transform: translateY(-2px);
}

.privacy-notice {
    font-size: 0.8rem;
    color: var(--text-color);
    margin-top: 0.8%;
}

.submit-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

#form-message {
    flex: 1 0 100%;
    margin-top: 10px;
}

.recent-posts {
    margin: 2rem 0;
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.post-preview {
    background: var(--light-background);
    padding: 1rem;
    border-radius: 0.25rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.post-preview h3 {
    margin-top: 0;
    font-size: 1.2rem;
}

.post-preview time {
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.post-preview p {
    margin: 0.5rem 0;
}

.read-more {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: bold;
}

.placeholder {
    background: var(--very-light-background);
    border: 2px dashed var(--light-border);
}

.view-all {
    display: block;
    text-align: center;
    margin-top: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

@media (max-width: 768px) {
    .post-grid {
        grid-template-columns: 1fr;
    }
}