body {
    font-family: 'Montserrat', sans-serif; /* Modern sans-serif for UI */
    margin: 0;
    background-color: #f8f8f8; /* Light, soft background */
    color: #333; /* Dark grey for readability */
    line-height: 1.7; /* Increased for better readability */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    background-color: #fff; /* White header */
    padding: 1em 0;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Subtle shadow */
}

h1 {
    font-family: 'Cormorant Garamond', serif; /* Poetic serif for main title */
    margin: 0;
    color: #555;
    font-size: 2.8em; /* Slightly larger for impact */
    letter-spacing: 2px; /* Retained, good for a title */
}

main {
    flex-grow: 1;
    padding: 2em;
    max-width: 800px;
    margin: 2em auto;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.05); /* Soft box shadow */
    border-radius: 8px;
}

.poem {
    background-color: #ffffff; /* White background for poem cards */
    border-radius: 10px; /* Slightly more rounded corners */
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); /* More pronounced, soft shadow */
    padding: 2.5em; /* Increased padding within the card */
    margin-bottom: 3em;
    margin-top: 2em;
}

.poem:not(:last-child)::after {
    content: '***'; /* A subtle visual separator */
    display: block;
    text-align: center;
    margin-top: 3em; /* Space after the poem content */
    color: #ccc; /* Lighter color */
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5em;
    letter-spacing: 0.2em;
}

.poem:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.poem h2 {
    font-family: 'Cormorant Garamond', serif; /* Poetic serif for poem titles */
    color: #666;
    font-size: 2em; /* Slightly larger poem titles */
    margin-bottom: 0.5em;
    transition: color 0.3s ease;
    letter-spacing: 1px;
}

.poem h2:hover {
    color: #007bff; /* A nice blue on hover */
    cursor: pointer;
}

.poem p {
    /* font-size: 1.1em; */
    margin-bottom: 0.5em;
    /* white-space: pre-wrap; */ /* Preserves line breaks in poems - now handled by JS */
    font-family: 'Cormorant Garamond', serif; /* Poetic serif for content */
    font-size: 1.15em; /* Slightly larger font for poem content */
    line-height: 1.8; /* Increased line height for readability */
    letter-spacing: 0.02em; /* Subtle letter spacing for flow */
}

.poem-content p {
    font-size: 1.1em;
}

.poem-date {
    font-size: 0.9em; /* Slightly larger for readability */
    color: #999;
    margin-left: 10px; /* Added spacing from title */
    font-weight: 300; /* Lighter weight for subtlety */
}

footer {
    text-align: center;
    padding: 1em 0;
    color: #888;
    font-size: 0.9em;
    margin-top: auto;
    background-color: #fff;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.05); /* Subtle shadow */
}

/* Subtle background animation */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #f0f0f0, #e0e0e0);
    animation: gradientBackground 15s ease infinite;
    z-index: -1;
    opacity: 0.5;
}

@keyframes gradientBackground {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.filter-controls {
    margin-top: 1em;
    display: flex;
    justify-content: center;
    gap: 10px; /* Space between filter elements */
    flex-wrap: wrap; /* Allow elements to wrap on smaller screens */
}

.filter-controls input[type="text"],
.filter-controls input[type="date"],
.filter-controls button {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
    font-family: 'Montserrat', sans-serif; /* Consistent sans-serif for UI */
}

/* Enhanced Hover States */
.filter-controls button {
    background-color: #f0f0f0;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.filter-controls button:hover {
    background-color: #e0e0e0;
    transform: translateY(-2px); /* Subtle lift on hover */
}

.filter-controls input[type="text"]:focus,
.filter-controls input[type="date"]:focus {
    border-color: #007bff; /* Highlight border on focus */
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25); /* Soft focus ring */
}

/* Loading Indicator */
.loading-indicator {
    text-align: center;
    font-size: 1.1em;
    color: #888;
    margin-top: 30px;
    margin-bottom: 30px;
    display: none; /* Hidden by default */
    font-family: 'Montserrat', sans-serif;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2em;
    }

    main {
        margin: 1em;
        padding: 1.5em;
    }

    .poem h2 {
        font-size: 1.5em;
    }

    .poem-content p {
        font-size: 1em;
    }

    .filter-controls {
        flex-direction: column;
        align-items: center;
    }

    .filter-controls input,
    .filter-controls button {
        width: 80%; /* Make filter inputs/buttons wider on smaller screens */
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8em;
    }

    main {
        margin: 0.5em;
        padding: 1em;
    }

    .poem h2 {
        font-size: 1.3em;
    }

    .poem-content p {
        font-size: 0.9em;
    }
}

.menu-icon {
    cursor: pointer;
    font-size: 1.5em;
    color: #555;
    margin-right: 15px;
    transition: color 0.3s ease;
}

.menu-icon:hover {
    color: #007bff;
}

.year-filter-menu {
    position: absolute;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-radius: 5px;
    z-index: 1000;
    top: 60px; /* Adjust based on header height */
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out, padding 0.5s ease-out;
    padding: 0 10px; /* Initial padding 0 */
}

.year-filter-menu.open {
    max-height: 300px; /* Max height when open */
    padding: 10px; /* Padding when open */
}

.year-filter-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.year-filter-menu ul li {
    padding: 8px 15px; /* Added horizontal padding */
    cursor: pointer;
    color: #333;
    font-family: 'Montserrat', sans-serif; /* Consistent sans-serif for UI */
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
    border-radius: 3px;
}

.year-filter-menu ul li:hover {
    background-color: #e0e0e0; /* Slightly darker on hover */
    color: #000; /* Darker text on hover */
    transform: translateX(5px); /* Subtle slide effect */
}

/* Scroll to Top Button */
#scroll-to-top {
    display: none; /* Hidden by default */
    position: fixed; /* Fixed position */
    bottom: 20px; /* 20px from the bottom */
    right: 20px; /* 20px from the right */
    z-index: 99; /* Ensure it's above other content */
    border: none; /* Remove default border */
    outline: none; /* Remove outline on focus */
    background-color: #007bff; /* Primary blue background */
    color: white; /* White arrow */
    cursor: pointer; /* Pointer cursor on hover */
    padding: 15px; /* Padding for size */
    border-radius: 50%; /* Make it round */
    font-size: 1.2em; /* Larger icon */
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease, transform 0.3s ease;
}

#scroll-to-top:hover {
    background-color: #0056b3; /* Darker blue on hover */
    transform: translateY(-3px); /* Subtle lift on hover */
}

/* Empty State Message */
.empty-state-message {
    text-align: center;
    color: #666; /* Softer color */
    font-size: 1.2em;
    margin-top: 50px;
    padding: 20px;
    border: 1px dashed #e0e0e0;
    border-radius: 8px;
    background-color: #f9f9f9;
    font-family: 'Montserrat', sans-serif;
}