@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Inter:wght@300;400;700&family=Lora:wght@400;700&display=swap');

/* Global Resets and Base Styles */
:root {
    /* Color Palette */
    --primary-text-color-light: #222222;
    /* Dark Grey */
    --secondary-text-color-light: #777777;
    /* Medium Grey */
    --background-color-light: #F8F8F8;
    /* Off-white for softness */
    --bg-color-rgb: 248, 248, 248;
    /* RGB for background-color-light */
    --card-background-light: #ffffff;
    /* Pure white cards for contrast */
    --accent-color-light: #00F5D4;
    /* Vibrant Teal */
    --accent-color-light-rgb: 0, 245, 212;
    /* RGB for Vibrant Teal */
    --secondary-accent-color-light: #FFC857;
    /* Warm Amber */
    --border-color-light: #dee2e6;
    /* Lighter border */

    --primary-text-color-dark: #E0E0E0;
    /* Light Grey */
    --secondary-text-color-dark: #888888;
    /* Mid-Dark Grey */
    --background-color-dark: #1A1A1A;
    /* Very Dark Grey/Charcoal */
    --bg-color-rgb-dark: 26, 26, 26;
    /* RGB for background-color-dark */
    --card-background-dark: #1e1e1e;
    /* Slightly lighter cards in dark mode */
    --accent-color-dark: #00F5D4;
    /* Vibrant Teal */
    --accent-color-dark-rgb: 0, 245, 212;
    /* RGB for Vibrant Teal */
    --secondary-accent-color-dark: #FFC857;
    /* Warm Amber */
    --border-color-dark: #343a40;
    /* Darker, subtle border */

    /* ===== LIQUID GLASS DESIGN SYSTEM ===== */
    /* Glass Effect Properties */
    --glass-blur: 20px;
    --glass-blur-strong: 30px;
    --glass-opacity: 0.75;
    --glass-opacity-light: 0.85;
    --glass-saturation: 180%;

    /* Glow Effect Colors */
    --glow-primary: rgba(0, 245, 212, 0.4);
    --glow-secondary: rgba(255, 200, 87, 0.3);
    --glow-ambient: rgba(0, 245, 212, 0.15);

    /* Glass Border Properties */
    --glass-border: 1px solid rgba(255, 255, 255, 0.18);
    --glass-border-light: 1px solid rgba(255, 255, 255, 0.25);
    --glass-border-glow: 0 0 20px var(--glow-ambient);

    /* Animation Timing */
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --ease-glass: cubic-bezier(0.25, 0.46, 0.45, 0.94);

    /* Typography */
    --font-family-heading: 'Playfair Display', serif;
    --font-family-body: 'Inter', 'Lora', serif;
    --font-family-ui: 'Inter', sans-serif;

    --font-size-base: 1rem;
    /* 16px */
    --font-size-h1: 3.5rem;
    /* 56px */
    --font-size-h2: 2.5rem;
    /* 40px */
    --font-size-h3: 1.75rem;
    /* 28px */
    --font-size-h4: 1.25rem;
    /* 20px */
    --font-size-small: 0.875rem;
    /* 14px */

    --line-height-body: 1.7;
    --line-height-heading: 1.2;

    --font-primary: var(--font-family-body);
    /* Updated to use new typography variables */
    --font-headings: var(--font-family-heading);
    /* Updated to use new typography variables */

    --text-color: var(--primary-text-color-light);
    --bg-color: var(--background-color-light);
    --card-bg: var(--card-background-light);
    --accent-color: var(--accent-color-light);
    --border-color: var(--border-color-light);
    --secondary-text-color: var(--secondary-text-color-light);

    --header-height: 75px;
    /* Slightly taller header */
    --footer-height: 65px;
    /* Slightly taller footer */
    --global-border-radius: 16px;
    /* Increased for softer look */
    --transition-speed-fast: 0.2s;
    --transition-speed-medium: 0.3s;
    --transition-speed-slow: 0.5s;
}

/* Dark mode styles */
body.dark-mode {
    --text-color: var(--primary-text-color-dark);
    --bg-color: var(--background-color-dark);
    --card-bg: var(--card-background-dark);
    --accent-color: var(--accent-color-dark);
    --border-color: var(--border-color-dark);
    --secondary-text-color: var(--secondary-text-color-dark);

    /* Dark mode glass adjustments */
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --glass-border-light: 1px solid rgba(255, 255, 255, 0.12);
    --glow-ambient: rgba(0, 245, 212, 0.2);
}

/* ===== LIQUID GLASS UTILITY CLASSES ===== */
.liquid-glass {
    background: rgba(var(--bg-color-rgb), var(--glass-opacity));
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
    border: var(--glass-border);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body.dark-mode .liquid-glass {
    background: rgba(var(--bg-color-rgb-dark), var(--glass-opacity));
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.glass-glow {
    position: relative;
}

.glass-glow::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg,
            var(--glow-primary),
            transparent 40%,
            transparent 60%,
            var(--glow-secondary));
    opacity: 0;
    z-index: -1;
    transition: opacity 0.4s var(--ease-glass);
}

.glass-glow:hover::before {
    opacity: 1;
}

/* Animated glow border */
.glass-glow-animated::before {
    animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.7;
    }
}

/* Entrance animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.animate-in {
    animation: slideUp 0.6s var(--ease-smooth) forwards;
}

.animate-fade-scale {
    animation: fadeInScale 0.4s var(--ease-smooth) forwards;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: var(--line-height-body);
    /* Use new variable */
    transition: background-color var(--transition-speed-medium) ease, color var(--transition-speed-medium) ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: var(--font-size-base);
    /* Use new variable */
    -webkit-font-smoothing: antialiased;
    /* Smoother fonts */
    -moz-osx-font-smoothing: grayscale;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color var(--transition-speed-fast) ease;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Header Styles - Liquid Glass Enhanced */
header {
    background: rgba(var(--bg-color-rgb, 248, 248, 248), var(--glass-opacity-light));
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
    color: var(--text-color);
    padding: 0 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height);
    border-bottom: var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.4s var(--ease-glass);
    box-shadow:
        0 4px 30px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Animated gradient border effect at bottom */
header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
            transparent,
            var(--accent-color) 20%,
            var(--secondary-accent-color-light) 50%,
            var(--accent-color) 80%,
            transparent);
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

header:hover::after {
    opacity: 0.8;
}

body.dark-mode header {
    background: rgba(var(--bg-color-rgb-dark, 26, 26, 26), 0.8);
    box-shadow:
        0 4px 30px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

header .logo a {
    font-family: var(--font-family-heading);
    font-size: var(--font-size-h3);
    /* Use new variable */
    font-weight: 700;
    /* Bolder logo */
    color: var(--text-color);
    text-decoration: none;
    letter-spacing: 0.5px;
}

header nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

header nav ul li a {
    font-size: 1.1rem;
    /* Slightly larger nav links */
    font-weight: 500;
    color: var(--secondary-text-color);
    letter-spacing: 0.3px;
}

header nav ul li a:hover,
header nav ul li a.active {
    color: var(--accent-color);
    text-decoration: none;
}

/* Header Search */
.header-search {
    position: relative;
    display: flex;
    align-items: center;
    margin: 0 1rem;
}

.header-search input {
    width: 200px;
    padding: 0.6rem 1rem;
    padding-left: 2.5rem;
    font-size: 0.9rem;
    border-radius: 50px;
    transition: width 0.3s var(--ease-glass), box-shadow 0.3s var(--ease-glass);
}

.header-search input:focus {
    width: 280px;
}

.header-search .search-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-text-color);
    pointer-events: none;
    transition: color 0.3s ease;
}

.header-search input:focus+.search-icon {
    color: var(--accent-color);
}

/* Responsive: hide on small screens */
@media (max-width: 768px) {
    .header-search {
        display: none;
    }
}

#theme-toggle {
    background-color: transparent;
    border: 1px solid transparent;
    /* Prepare for focus */
    color: var(--text-color);
    cursor: pointer;
    padding: 0.6rem;
    /* Slightly more padding */
    border-radius: var(--global-border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-speed-fast) ease, border-color var(--transition-speed-fast) ease;
}

#theme-toggle:hover {
    background-color: rgba(var(--accent-color-rgb, 0, 245, 212), 0.1);
    /* Use accent color for hover */
}

#theme-toggle:focus {
    outline: none;
    border-color: var(--accent-color);
}

#theme-toggle svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.sun-icon {
    display: block;
}

.moon-icon {
    display: none;
}

body.dark-mode .sun-icon {
    display: none;
}

body.dark-mode .moon-icon {
    display: block;
}


/* Main Content Styles */
main {
    flex-grow: 1;
    padding: 2.5rem 2rem;
    /* Increased top/bottom padding */
    width: 100%;
    max-width: 1400px;
    /* Increased max-width for more expansive layouts */
    margin: 0 auto;
    /* Center content */
}

.homepage-main {
    padding-top: 1rem;
    /* Adjust if header is fixed and overlaps */
}

/* Poem Grid Styles (Homepage & Archive) */
.poem-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    /* Flexible grid columns */
    gap: 2.5rem;
    /* Increased gap */
    padding-bottom: 2.5rem;
    align-items: start;
    /* Align items to the start for varied heights */
}

.poem-card {
    background: var(--card-bg);
    border-radius: var(--global-border-radius);
    overflow: hidden;
    border: var(--glass-border);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.06),
        0 1px 3px rgba(0, 0, 0, 0.03);
    transition: all 0.4s var(--ease-glass);
    display: flex;
    flex-direction: column;
    position: relative;
    /* Entrance animation */
    opacity: 0;
    animation: slideUp 0.6s var(--ease-smooth) forwards;
}

/* Staggered entrance for grid items */
.poem-card:nth-child(1) {
    animation-delay: 0.05s;
}

.poem-card:nth-child(2) {
    animation-delay: 0.1s;
}

.poem-card:nth-child(3) {
    animation-delay: 0.15s;
}

.poem-card:nth-child(4) {
    animation-delay: 0.2s;
}

.poem-card:nth-child(5) {
    animation-delay: 0.25s;
}

.poem-card:nth-child(6) {
    animation-delay: 0.3s;
}

.poem-card:nth-child(n+7) {
    animation-delay: 0.35s;
}

/* Glass glow effect on hover */
.poem-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg,
            var(--glow-primary) 0%,
            transparent 30%,
            transparent 70%,
            var(--glow-secondary) 100%);
    opacity: 0;
    z-index: 0;
    transition: opacity 0.4s var(--ease-glass);
    pointer-events: none;
}

.poem-card:hover::before {
    opacity: 1;
}

.poem-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.12),
        0 8px 16px rgba(0, 0, 0, 0.06),
        var(--glass-border-glow);
}

body.dark-mode .poem-card {
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.15),
        0 1px 3px rgba(0, 0, 0, 0.1);
}

body.dark-mode .poem-card:hover {
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.3),
        0 8px 16px rgba(0, 0, 0, 0.15),
        var(--glass-border-glow);
}


.poem-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.poem-card-image-placeholder {
    width: 100%;
    height: 220px;
    /* Increased placeholder height */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--secondary-text-color);
    /* Use secondary text color for placeholder text */
    background: linear-gradient(45deg, var(--accent-color-light), var(--secondary-accent-color-light));
    /* Dynamic gradient for placeholder */
    background-size: 200% 200%;
    /* For animation */
    animation: gradientShift 10s ease infinite;
    /* Subtle animation */
    transition: background-color var(--transition-speed-medium) ease;
    overflow: hidden;
    /* Ensure zoomed image doesn't overflow placeholder */
    position: relative;
    /* For potential pseudo-elements or overlays */
}

.poem-card-image-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: inherit;
}

body.dark-mode .poem-card-image-placeholder {
    background: linear-gradient(45deg, var(--accent-color-dark), var(--secondary-accent-color-dark));
    background-size: 200% 200%;
    animation: gradientShift 10s ease infinite;
}



body.dark-mode .poem-card-image-placeholder {
    background-color: #3a3a3a;
    color: #aaa;
}

.poem-card-content {
    padding: 1.5rem;
    flex-grow: 1;
}

.poem-card-title {
    font-family: var(--font-family-heading);
    font-size: var(--font-size-h4);
    /* Use new variable */
    font-weight: 700;
    /* Bolder card title */
    margin-bottom: 0.75rem;
    /* Increased margin */
    color: var(--text-color);
    line-height: var(--line-height-heading);
}

.poem-card-author {
    font-size: 0.95rem;
    /* Slightly larger author text */
    color: var(--secondary-text-color);
    margin-bottom: 1.25rem;
    /* Increased margin */
}

.poem-card-excerpt {
    font-size: 1rem;
    /* Slightly larger excerpt text */
    color: var(--secondary-text-color);
    line-height: 1.6;
    /* Improved line height for excerpt */
    /* For multi-line ellipsis if desired:
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    */
}


/* Footer Styles */
footer {
    background-color: var(--bg-color);
    color: var(--secondary-text-color);
    text-align: center;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    height: auto;
    /* Adjust based on content */
    transition: background-color var(--transition-speed-medium) ease, border-color var(--transition-speed-medium) ease, color var(--transition-speed-medium) ease;
}

footer p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

footer a {
    color: var(--secondary-text-color);
}

footer a:hover {
    color: var(--accent-color);
}

/* Responsive Adjustments */

/* Poem Display Page Specific Styles */
.poem-display-main {
    padding-top: 1rem;
    /* Adjust if header is fixed and overlaps */
}

.poem-full-view {
    display: flex;
    flex-direction: row;
    /* Default for wider screens */
    gap: 4rem;
    /* Increased gap for more breathing room */
    margin-bottom: 4rem;
    /* Increased bottom margin */
    align-items: flex-start;
    /* Align items to the top */
}

.poem-image-section {
    flex: 1 1 40%;
    /* Takes up 40% of the space, can shrink/grow */
    max-width: 450px;
    /* Max width for the image container */
    position: sticky;
    /* Make image sticky on scroll */
    top: calc(var(--header-height) + 2rem);
    /* Position below header + padding */
    height: calc(100vh - var(--header-height) - 4rem);
    /* Attempt to make it viewport height responsive */
    overflow: hidden;
    /* In case image is larger */
}

.poem-main-image-placeholder {
    width: 100%;
    height: 100%;
    /* Fill the sticky container */
    min-height: 300px;
    /* Minimum height */
    background-color: #ccc;
    /* Placeholder color */
    border-radius: var(--global-border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #666;
    background: linear-gradient(60deg, var(--accent-color-light), var(--secondary-accent-color-light));
    /* Dynamic gradient */
    background-size: 200% 200%;
    animation: gradientShift 10s ease infinite;
    transition: background-color var(--transition-speed-medium) ease, transform var(--transition-speed-slow) ease;
    overflow: hidden;
    position: relative;
}

.poem-main-image-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: inherit;
}

/* Loading and error states */
.loading-message {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--secondary-text-color);
    font-family: var(--font-family-ui);
}

/* Poem page loading state */
.poem-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: var(--secondary-text-color);
    font-family: var(--font-family-ui);
    gap: 1.5rem;
}

.poem-loading-state p {
    font-size: 1.1rem;
    color: var(--accent-color);
    font-weight: 500;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Hide poem content while loading */
.poem-full-view.poem-loading {
    opacity: 0;
    visibility: hidden;
    position: absolute;
    pointer-events: none;
}

/* Show poem content when loaded */
.poem-full-view.poem-loaded {
    opacity: 1;
    visibility: visible;
    position: relative;
    pointer-events: auto;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hide loading state when poem is loaded */
.poem-loading-state.hidden {
    display: none;
}

.loading-message p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
}

.loading-message p:first-child {
    color: var(--accent-color);
    font-weight: 600;
}

body.dark-mode .poem-main-image-placeholder {
    background: linear-gradient(60deg, var(--accent-color-dark), var(--secondary-accent-color-dark));
    background-size: 200% 200%;
    animation: gradientShift 10s ease infinite;
    color: #aaa;
    /* Ensure text color is still set if any text is in placeholder */
}

.poem-text-section {
    flex: 1 1 60%;
    /* Takes up 60% of the space */
    padding-left: 1rem;
    /* Spacing from image */
}

.poem-title-full {
    font-family: var(--font-family-heading);
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.1;
    color: var(--text-color);
    letter-spacing: -0.02em;
    text-wrap: balance;
    position: relative;
}

.poem-author-full {
    font-size: 1.1rem;
    color: var(--secondary-text-color);
    margin-bottom: 3rem;
    font-style: italic;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.poem-content-full .stanza {
    font-family: var(--font-family-body);
    font-size: clamp(1.1rem, 2.5vw, 1.25rem);
    line-height: 1.8;
    margin-bottom: 2.5rem;
    color: var(--text-color);
    padding: 1rem 1.2rem;
    border-radius: 8px;
    transition: all var(--transition-speed-medium) ease;
    position: relative;
    border-left: 3px solid transparent;
}

.poem-content-full .stanza:first-of-type::first-letter {
    font-family: var(--font-family-heading);
    font-size: clamp(3.5rem, 8vw, 5rem);
    line-height: 0.8;
    float: left;
    margin: 0.1em 0.15em 0 0;
    color: var(--accent-color);
    font-weight: 700;
    text-shadow: 2px 2px 8px rgba(var(--accent-color-rgb, 0, 245, 212), 0.3);
    background: linear-gradient(135deg, var(--accent-color), var(--secondary-accent-color-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.poem-content-full .stanza:hover {
    background-color: rgba(var(--accent-color-rgb, 0, 245, 212), 0.05);
    border-left-color: var(--accent-color);
    transform: translateX(8px);
    box-shadow: 0 4px 20px rgba(var(--accent-color-rgb, 0, 245, 212), 0.1);
}

body.dark-mode .poem-content-full .stanza:hover {
    background-color: rgba(var(--accent-color-rgb, 0, 245, 212), 0.08);
    border-left-color: var(--accent-color);
    transform: translateX(8px);
    box-shadow: 0 4px 20px rgba(var(--accent-color-rgb, 0, 245, 212), 0.15);
}


.poem-controls-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    border-bottom: none;
    justify-content: flex-start;
}

.control-button {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--secondary-text-color);
    cursor: pointer;
    padding: 0.75rem 1.25rem;
    border-radius: var(--global-border-radius);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    transition: all var(--transition-speed-fast) ease;
    font-family: var(--font-family-ui);
    font-size: 0.9rem;
    font-weight: 500;
    min-width: 120px;
}

.control-button:hover {
    color: var(--accent-color);
    background-color: rgba(var(--accent-color-rgb, 0, 245, 212), 0.1);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--accent-color-rgb, 0, 245, 212), 0.2);
}

.control-button:focus {
    outline: none;
    border-color: var(--accent-color);
    background-color: rgba(var(--accent-color-rgb, 0, 245, 212), 0.1);
}

/* Removed duplicate hover style, it's combined above */
/* Extraneous closing brace removed from here */

.control-button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    stroke: currentColor;
    flex-shrink: 0;
}

.control-text {
    font-size: 0.9rem;
    white-space: nowrap;
}

#favorite-poem.favorited svg {
    fill: var(--accent-color);
    /* Or a specific favorite color e.g. red */
    stroke: var(--accent-color);
}


.audio-progress-placeholder {
    flex-grow: 1;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

/* Placeholder for actual progress */
.audio-progress-placeholder::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 30%;
    /* Example progress */
    background-color: var(--accent-color);
}


/* Breadcrumb Navigation */
.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 1rem 0;
    font-family: var(--font-family-ui);
    font-size: 0.9rem;
    color: var(--secondary-text-color);
}

.breadcrumb-link {
    color: var(--secondary-text-color);
    text-decoration: none;
    transition: color var(--transition-speed-fast) ease;
}

.breadcrumb-link:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--border-color);
    font-weight: 300;
}

.breadcrumb-current {
    color: var(--text-color);
    font-weight: 500;
}

/* Poem Metadata Section */
.poem-metadata {
    margin: 1.5rem 0 2rem 0;
    padding: 1.2rem;
    background-color: rgba(var(--accent-color-rgb, 0, 245, 212), 0.05);
    border-radius: var(--global-border-radius);
    border-left: 4px solid var(--accent-color);
}

.poem-details {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-family: var(--font-family-ui);
    font-size: 0.9rem;
}

.poem-details span {
    color: var(--secondary-text-color);
}

.poem-details span span {
    color: var(--text-color);
    font-weight: 500;
}

/* Keyframe animation for gradient shift */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Related Poems Section */
.related-poems-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.section-title {
    font-family: var(--font-family-heading);
    font-size: var(--font-size-h2);
    /* Use new variable */
    font-weight: 600;
    margin-bottom: 2rem;
    /* Increased margin */
    color: var(--text-color);
}

.related-poems-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    /* Slightly larger small cards */
    gap: 2rem;
    /* Consistent gap */
}

.poem-card-small .poem-card-image-placeholder {
    height: 150px;
}

.poem-card-small .poem-card-title {
    font-size: 1.3rem;
    /* Larger title for small cards */
    font-weight: 600;
}

.poem-card-small .poem-card-content {
    padding: 1rem;
}


/* Archive Page Specific Styles */
.archive-main {
    padding-top: 1rem;
}

/* Archive header with stats */
.archive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.archive-title {
    font-family: var(--font-headings);
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}

.archive-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 0.9rem;
    color: var(--secondary-text-color);
}

.filtered-count {
    font-size: 0.8rem;
    color: var(--accent-color);
    margin-left: 0.5rem;
}

.filtering-sorting-bar {
    background: rgba(var(--bg-color-rgb), var(--glass-opacity-light));
    backdrop-filter: blur(var(--glass-blur-strong)) saturate(var(--glass-saturation));
    -webkit-backdrop-filter: blur(var(--glass-blur-strong)) saturate(var(--glass-saturation));
    padding: 2rem;
    border-radius: var(--global-border-radius);
    margin-bottom: 2.5rem;
    border: var(--glass-border);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transition: all 0.4s var(--ease-glass);
    position: relative;
    overflow: hidden;
}

/* Subtle shimmer overlay */
.filtering-sorting-bar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.03),
            transparent);
    background-size: 200% 100%;
    animation: shimmer 8s ease-in-out infinite;
    pointer-events: none;
}

body.dark-mode .filtering-sorting-bar {
    background: rgba(var(--bg-color-rgb-dark), 0.75);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}


.filters-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    /* Gap between all items */
    align-items: flex-end;
    /* Align items to bottom for mixed heights */
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    /* Gap between label and select */
    flex-grow: 1;
    /* Allow groups to grow */
    min-width: 150px;
    /* Minimum width for filter groups */
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--secondary-text-color);
}

.filter-group select {
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    transition: border-color var(--transition-speed-fast) ease, background-color var(--transition-speed-medium) ease, box-shadow var(--transition-speed-fast) ease;
    width: 100%;
    /* Make select take full width of its group */
    appearance: none;
    /* Remove default system appearance */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23495057'%3E%3Cpath fill-rule='evenodd' d='M8 11.646l-4.854-4.853.708-.708L8 10.232l4.146-4.147.708.708L8 11.646z'/%3E%3C/svg%3E");
    /* Default arrow for light mode */
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
    /* Make space for custom arrow */
}

body.dark-mode .filter-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23adb5bd'%3E%3Cpath fill-rule='evenodd' d='M8 11.646l-4.854-4.853.708-.708L8 10.232l4.146-4.147.708.708L8 11.646z'/%3E%3C/svg%3E");
    /* Arrow for dark mode */
}

.filter-group select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
    /* Standard blue focus ring, adjust as needed */
}

body.dark-mode .filter-group select:focus {
    border-color: var(--accent-color-dark);
    box-shadow: 0 0 0 2px rgba(107, 183, 255, 0.25);
    /* Lighter blue focus ring for dark mode */
}


.view-toggle {
    display: flex;
    align-items: center;
    /* Align with bottom of select boxes */
    margin-left: auto;
    /* Pushes it to the right if space allows */
    padding-top: 1.4rem;
    /* Align with selects that have labels */
}

.view-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--secondary-text-color);
    padding: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:first-child {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    border-right: none;
}

.view-btn:last-child {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.view-btn.active {
    background-color: var(--accent-color);
    color: var(--background-color-light);
    /* Text color on active button */
    border-color: var(--accent-color);
}

body.dark-mode .view-btn.active {
    color: var(--background-color-dark);
}


.view-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* List View Styles */
.poem-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.poem-list-item {
    display: flex;
    gap: 1.5rem;
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
}

body.dark-mode .poem-list-item {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}


.poem-list-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

body.dark-mode .poem-list-item:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.poem-list-item-image-placeholder {
    width: 100px;
    height: 100px;
    background-color: #e0e0e0;
    border-radius: 4px;
    flex-shrink: 0;
    /* Prevent shrinking */
    transition: background-color 0.3s ease;
}

body.dark-mode .poem-list-item-image-placeholder {
    background-color: #3a3a3a;
}


.poem-list-item-details {
    flex-grow: 1;
}

.poem-list-item-title {
    font-family: var(--font-headings);
    font-size: 1.4rem;
    margin-bottom: 0.3rem;
}

.poem-list-item-title a {
    color: var(--text-color);
    text-decoration: none;
}

.poem-list-item-title a:hover {
    color: var(--accent-color);
    text-decoration: underline;
}

.poem-list-item-author {
    font-size: 0.95rem;
    color: var(--secondary-text-color);
    margin-bottom: 0.5rem;
}

.poem-list-item-meta {
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    opacity: 0.8;
}

/* Enhanced Search and Filter Controls */
.search-section {
    margin-bottom: 1rem;
}

.search-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

#search-input,
.header-search input {
    width: 100%;
    padding: 0.85rem 1.25rem;
    padding-right: 2.5rem;
    border: var(--glass-border);
    border-radius: 50px;
    font-size: 1rem;
    background: rgba(var(--bg-color-rgb), var(--glass-opacity));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-color);
    transition: all 0.4s var(--ease-glass);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#search-input::placeholder,
.header-search input::placeholder {
    color: var(--secondary-text-color);
    opacity: 0.7;
}

#search-input:focus,
.header-search input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow:
        0 0 0 4px rgba(var(--accent-color-light-rgb), 0.15),
        0 8px 24px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

body.dark-mode #search-input,
body.dark-mode .header-search input {
    background: rgba(var(--bg-color-rgb-dark), 0.6);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.search-clear {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--secondary-text-color);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    display: none;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.search-clear:hover {
    color: var(--text-color);
    background-color: var(--border-color);
}

.filter-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    position: relative;
}

.toggle-btn:hover,
.toggle-btn.active {
    border-color: var(--accent-color);
    background-color: rgba(var(--accent-color-light-rgb), 0.05);
}

.filter-badge {
    background-color: var(--accent-color);
    color: white;
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    font-weight: 600;
}

.clear-filters-btn {
    padding: 0.5rem 1rem;
    background-color: transparent;
    border: 1px solid var(--secondary-text-color);
    border-radius: 6px;
    color: var(--secondary-text-color);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.clear-filters-btn:hover {
    background-color: var(--secondary-text-color);
    color: var(--card-bg);
}

.filters-panel {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}

.filters-panel.open {
    max-height: 500px;
    opacity: 1;
    padding: 1.5rem;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    align-items: end;
}

.view-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.view-controls .view-toggle {
    padding-top: 0;
    margin-left: 0;
}

.view-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--secondary-text-color);
    padding: 0.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
}

.view-btn:first-child {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    border-right: none;
}

.view-btn:nth-child(2) {
    border-right: none;
}

.view-btn:last-child {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.view-btn.active {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Results Info and Actions */
.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: rgba(var(--accent-color-light-rgb), 0.05);
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
}

.results-summary {
    font-size: 0.95rem;
    color: var(--text-color);
    font-weight: 500;
}

.quick-actions {
    display: flex;
    gap: 0.75rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background-color: transparent;
    border: 1px solid var(--accent-color);
    border-radius: 6px;
    color: var(--accent-color);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background-color: var(--accent-color);
    color: white;
}

/* Enhanced No Results */
.no-results {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    padding: 2rem;
}

.no-results-content {
    text-align: center;
    color: var(--secondary-text-color);
}

.no-results-content svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-results-content h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.no-results-content p {
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

/* Enhanced Poem Cards with Meta */
.poem-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--secondary-text-color);
}

.meta-item {
    background-color: rgba(var(--accent-color-light-rgb), 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
}

.meta-separator {
    color: var(--border-color);
}

/* Enhanced List View */
.poem-list-item-meta {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.meta-tag {
    background-color: rgba(var(--accent-color-light-rgb), 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--text-color);
}

.poem-list-item-excerpt {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--secondary-text-color);
    line-height: 1.5;
}

/* Compact View Styles */
.poem-compact {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.poem-compact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: var(--card-bg);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.poem-compact-item:hover {
    border-color: var(--accent-color);
    transform: translateX(4px);
}

.poem-compact-image {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.poem-compact-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.poem-compact-content {
    flex-grow: 1;
    min-width: 0;
}

.poem-compact-title {
    font-size: 1.1rem;
    margin: 0 0 0.25rem 0;
    font-family: var(--font-headings);
}

.poem-compact-title a {
    color: var(--text-color);
    text-decoration: none;
}

.poem-compact-title a:hover {
    color: var(--accent-color);
}

.poem-compact-author {
    font-size: 0.85rem;
    color: var(--secondary-text-color);
    margin: 0 0 0.25rem 0;
}

.poem-compact-excerpt {
    font-size: 0.8rem;
    color: var(--secondary-text-color);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.poem-compact-meta {
    flex-shrink: 0;
}

.compact-form {
    font-size: 0.75rem;
    color: var(--accent-color);
    background-color: rgba(var(--accent-color-light-rgb), 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}


@media (max-width: 992px) {

    /* Medium devices (tablets, less than 992px) */
    .filters-toolbar {
        gap: 1rem;
        /* Reduce gap for medium screens */
    }

    .filter-group {
        min-width: 120px;
        /* Adjust min-width */
    }

    .archive-title {
        font-size: 2.2rem;
    }

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

    .filters-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }

    .results-info {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .poem-compact-item {
        flex-direction: column;
        text-align: center;
    }

    .poem-compact-image {
        width: 80px;
        height: 80px;
    }

    .poem-full-view {
        flex-direction: column;
        /* Stack image and text */
        align-items: center;
        /* Center items when stacked */
    }

    .poem-image-section {
        position: static;
        /* Remove sticky positioning */
        height: auto;
        /* Let content define height */
        max-width: 100%;
        /* Allow full width */
        width: 100%;
        margin-bottom: 2rem;
    }

    .poem-main-image-placeholder {
        max-height: 400px;
        /* Max height for image on smaller screens */
    }

    .poem-text-section {
        padding-left: 0;
        /* Remove padding when stacked */
        width: 100%;
    }

    .poem-title-full {
        font-size: 2.2rem;
    }
}


@media (max-width: 768px) {

    /* Small devices (landscape phones, 768px and down) */
    .filtering-sorting-bar {
        padding: 1rem;
    }

    .filters-toolbar {
        flex-direction: column;
        /* Stack filters vertically */
        align-items: stretch;
        /* Make filter groups full width */
        gap: 1rem;
    }

    .filter-group {
        width: 100%;
        /* Full width for stacked filter groups */
    }

    .view-toggle {
        margin-left: 0;
        /* Reset margin */
        align-self: flex-end;
        /* Align to the right of the stacked column */
        padding-top: 0.5rem;
        /* Adjust padding */
    }

    .archive-title {
        font-size: 2rem;
    }

    .search-container {
        max-width: 100%;
    }

    .filter-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .filters-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .view-controls .view-toggle {
        justify-content: center;
    }

    .results-info {
        padding: 0.75rem;
    }

    .quick-actions {
        flex-direction: column;
        width: 100%;
    }

    .action-btn {
        justify-content: center;
    }

    .poem-list-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .poem-list-item-image-placeholder {
        width: 120px;
        /* Adjust size for stacked layout */
        height: 120px;
        margin-bottom: 1rem;
    }


    header {
        padding: 0 1rem;
        flex-direction: column;
        height: auto;
        padding-bottom: 0.5rem;
    }

    header .logo {
        margin-bottom: 0.5rem;
        padding-top: 0.5rem;
    }

    header nav ul {
        gap: 1rem;
        justify-content: center;
        flex-wrap: wrap;
    }

    #theme-toggle {
        position: absolute;
        top: 15px;
        right: 15px;
    }

    main {
        padding: 1rem;
    }

    .poem-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }

    .related-poems-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }


    .poem-card-content {
        padding: 1rem;
    }

    .poem-card-title {
        font-size: 1.3rem;
    }

    /* Poem page responsive adjustments */
    .poem-full-view {
        flex-direction: column;
        gap: 2rem;
    }

    .poem-image-section {
        flex: none;
        max-width: none;
        position: static;
        height: auto;
        max-height: 300px;
    }

    .poem-text-section {
        padding-left: 0;
    }

    .poem-metadata {
        margin: 1rem 0;
        padding: 1rem;
    }

    .poem-details {
        flex-direction: column;
        gap: 0.75rem;
    }

    .breadcrumb-nav {
        font-size: 0.8rem;
        gap: 0.25rem;
        flex-wrap: wrap;
    }

    .poem-controls-bar {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .control-button {
        flex: 1;
        min-width: 140px;
        justify-content: center;
    }
}

@media (max-width: 480px) {

    /* Extra small devices (phones, 480px and down) */
    .poem-grid {
        grid-template-columns: 1fr;
        /* Single column on very small screens */
    }

    .related-poems-grid {
        grid-template-columns: 1fr;
    }

    header nav ul li a {
        font-size: 0.9rem;
    }

    header .logo a {
        font-size: 1.5rem;
    }

    /* Extra small devices poem adjustments */
    .breadcrumb-nav {
        font-size: 0.75rem;
        margin-bottom: 1rem;
    }

    .poem-metadata {
        margin: 0.75rem 0;
        padding: 0.75rem;
    }

    .poem-details {
        gap: 0.5rem;
        font-size: 0.8rem;
    }

    .poem-controls-bar {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem 0;
    }

    .control-button {
        width: 100%;
        min-width: auto;
    }
}

/* Accessibility */
.sr-only {
    /* Screen-reader only */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible styling for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--bg-color), 0 0 0 6px var(--accent-color);
}

/* Remove default outline for non-keyboard focus if desired, but ensure focus-visible is robust */
*:focus:not(:focus-visible) {
    outline: none;
}

/* Import fonts (example using Google Fonts - ensure self-hosting for production if preferred) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Clash+Display:wght@400;500;600;700&display=swap');

/*
  Clash Display might need to be self-hosted or sourced differently.
  This @import is a placeholder. For production, download and serve fonts locally.
  Example for Clash Display (if available via a CDN or self-hosted):
  @font-face {
    font-family: 'Clash Display';
    src: url('/fonts/ClashDisplay-Variable.woff2') format('woff2-variations');
    font-weight: 200 700;
    font-style: normal;
  }
*/