/* ===== FONTS ===== */
@font-face {
    font-family: 'Silkscreen';
    src: url('../fonts/Silkscreen-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Silkscreen';
    src: url('../fonts/Silkscreen-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Spectral';
    src: url('../fonts/Spectral-ExtraLight.ttf') format('truetype');
    font-weight: 200;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Spectral';
    src: url('../fonts/Spectral-ExtraLightItalic.ttf') format('truetype');
    font-weight: 200;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Spectral';
    src: url('../fonts/Spectral-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Spectral';
    src: url('../fonts/Spectral-LightItalic.ttf') format('truetype');
    font-weight: 300;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Spectral';
    src: url('../fonts/Spectral-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Spectral';
    src: url('../fonts/Spectral-Italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Spectral';
    src: url('../fonts/Spectral-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Spectral';
    src: url('../fonts/Spectral-MediumItalic.ttf') format('truetype');
    font-weight: 500;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Spectral';
    src: url('../fonts/Spectral-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Spectral';
    src: url('../fonts/Spectral-SemiBoldItalic.ttf') format('truetype');
    font-weight: 600;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Spectral';
    src: url('../fonts/Spectral-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Spectral';
    src: url('../fonts/Spectral-BoldItalic.ttf') format('truetype');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Spectral';
    src: url('../fonts/Spectral-ExtraBold.ttf') format('truetype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Spectral';
    src: url('../fonts/Spectral-ExtraBoldItalic.ttf') format('truetype');
    font-weight: 800;
    font-style: italic;
    font-display: swap;
}

/* ===== TYPOGRAPHY ===== */
html {
    font-size: 16px;
}

button, input, select, textarea {
    font: inherit;
}

body {
    font-family: 'Spectral', serif;
    font-weight: 400;
    line-height: 1.6;
    color: #f8f8ff;
    background-color: #1a1a2e;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Silkscreen', sans-serif;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: #ffd700;
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
    font-weight: 400;
    letter-spacing: 1px;
}

h2 {
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: 0.5px;
}

h3 {
    font-size: 1.75rem;
    font-weight: 400;
}

.book-info h3 {
    margin-top: 0;  /* Remove top margin from book card titles */
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
    line-height: 1.3;
}

h4 {
    font-size: 1.5rem;
    font-weight: 400;
}

p {
    margin-bottom: 1.2rem;
}

strong, b {
    font-weight: 600;
}

em, i {
    font-style: italic;
}

blockquote {
    border-left: 4px solid #4f3a65;
    padding-left: 1rem;
    margin-left: 0;
    margin-right: 0;
    font-style: italic;
    color: #e0e0ff;
}

.logo .site-name {
    font-family: 'Silkscreen', sans-serif;
    font-weight: 700;
    color: #ffd700;
}

.tagline {
    font-family: 'Spectral', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

.author {
    font-weight: 500;
    font-style: italic;
}

.description {
    font-weight: 300;
}

.featured-list h2 {
    border-top: 2px solid #ffd700;
    margin-top: 3rem;
}

.notable-multiple-winners h2 {
    font-family: 'Silkscreen', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #ffd700;
    margin-top: 3rem;
}

.timeline-year {
    font-family: 'Silkscreen', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #ffd700;
    border-top: 2px solid #ffd700;
    margin-top: 3rem;
}

/* Link Styles */
a {
    color: #ffd700;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #fff;
    text-decoration: underline;
}

/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #1a1a2e;
    color: #f8f8ff;
}

/* ===== LAYOUT & COMPONENTS ===== */

/* Homepage awards comparison: Hugo vs Nebula */
.awards-intro {
    margin-top: 3rem;
}

.awards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.award-box {
    display: flex;
    flex-direction: column;
    background-color: #2a2a40;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.award-box h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    line-height: 1.3;
}

/* Trophy plate: one fixed well so both marks sit at the same size */
.award-plate {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    isolation: isolate;
    background-color: #0f0f1a;
    border-radius: 4px;
}

.award-trophy {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* The Hugo mark is dark art on white: invert it to light-on-dark and let
   the black fall away into the plate */
.hugo-box .award-trophy {
    padding: 1rem;
    object-fit: contain;
    filter: invert(1);
    mix-blend-mode: screen;
}

.award-facts {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: baseline;
    gap: 0.25rem 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #4f3a65;
}

.award-facts dt {
    color: #e0e0ff;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.award-facts dd {
    margin: 0;
    font-weight: 600;
}

.award-box p {
    color: #e0e0ff;
}

.award-box .btn {
    margin-top: auto;
    align-self: flex-start;
    font-size: 0.9rem;
    text-align: center;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.center {
    display: block;
    margin-left: auto;
    margin-right: auto;
    width: 50%;
  }

/* Header Styles */
header {
    background-color: #0f0f1a;
    padding: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Logo Adjustments */
.logo {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Changed from center to flex-start for left alignment */
    margin-bottom: 0; /* Remove bottom margin since nav is on same line */
}


.logo .site-name {
    font-size: 1.5rem;
    line-height: 1.2;
    color: #ffd700;
    margin: 0;
}

.tagline {
    padding-top: 1.5rem;
    font-size: 2.5rem;
    color: #e0e0ff;
}

/* Navigation Styles */
.main-nav {
    display: flex;
    justify-content: flex-end; /* Changed from center to flex-end */
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-links a {
    color: #e0e0ff;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
}

.nav-links a:hover {
    color: #ffd700;
    border-bottom: 2px solid #ffd700;
}

.nav-links a:active {
    color: #fff;
    border-bottom: 2px solid #fff;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    background: none;
    border: 0;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #ffd700;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Bars morph into a close (X) while the menu is open */
.menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

@media (prefers-reduced-motion: reduce) {
    .menu-toggle span {
        transition: none;
    }
}

.view-more {
    margin-top: 2rem;;
}

/* Footer Styles */
footer {
    background-color: #0f0f1a;
    padding: 2rem 0 1rem;
    margin-top: 3rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.footer-section {
    flex: 1;
    min-width: 200px;
    margin-bottom: 1.5rem;
}

.footer-section h3 {
    color: #ffd700;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.copyright {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid #333;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #95a5a6;
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #4f3a65;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Spectral', serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.btn:hover {
    background-color: #6a4c8c;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.btn-primary {
    background-color: #ffd700;
    color: #1a1a2e;
}

/* Inline error / empty message inside a featured list */
.featured-message {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background-color: #2a2a40;
    border: 1px solid #4f3a65;
    border-radius: 8px;
}

.featured-message p {
    margin: 0;
    color: #e0e0ff;
}

.featured-message a {
    color: #ffd700;
}

/* Carousel Styling for Featured Books */
.featured-books {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 1.5rem;
    padding: 0.5rem 0;
    -webkit-overflow-scrolling: touch; /* For smooth scrolling on iOS */
    scrollbar-width: thin; /* For Firefox */
  }
  
  .featured-books::-webkit-scrollbar {
    height: 6px;
  }
  
  .featured-books::-webkit-scrollbar-thumb {
    background-color: #4f3a65;
    border-radius: 3px;
  }
  
  .featured-books .book-card {
    flex: 0 0 auto;
    width: calc(25% - 1.125rem); /* 4 items per row with gap consideration */
    scroll-snap-align: start;
    transition: transform 0.3s ease;
  }

  /* Previous/next controls (added by main.js; touch widths swipe instead) */
.carousel-controls {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.carousel-controls[hidden] {
    display: none;
}

.carousel-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background-color: #2a2a40;
    color: #e0e0ff;
    border: 1px solid #4f3a65;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.carousel-btn:hover:not(:disabled) {
    background-color: #4f3a65;
    color: #f8f8ff;
}

.carousel-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

@media screen and (max-width: 767px) {
    .carousel-controls {
        display: none;
    }
}

/* Keyboard focus: gold ring that stays visible on navy (cover wells clip, so those rings sit inside) */
.book-card a:focus-visible,
.carousel-btn:focus-visible,
.featured-books:focus-visible,
.menu-toggle:focus-visible,
.nav-links a:focus-visible,
.logo a:focus-visible,
.featured-message a:focus-visible,
.btn:focus-visible {
    outline: 3px solid #ffd700;
    outline-offset: 3px;
}

.book-cover a:focus-visible {
    outline-offset: -3px;
}

/* Hero's "View latest winners" lands below the sticky header */
.featured-list[id] {
    scroll-margin-top: 6rem;
}

/* The compact mobile header is ~60px */
@media screen and (max-width: 767px) {
    .featured-list[id] {
        scroll-margin-top: 5rem;
    }
}

  /* Featured books (homepage) specific sizing */
.featured-books .book-cover {
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #1a1a2e;
    /* Don't set a fixed height for featured books - let them be responsive */
}

.featured-books .book-cover img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* Mobile responsive fixes for featured books */
@media screen and (max-width: 767px) {
    .featured-books .book-cover {
        height: auto;
        max-height: 200px;
    }
    
    .featured-books .book-cover a img {
        max-height: 200px;
        width: auto;
        object-fit: contain;
    }
}
  

  /* Make the scrollbar more visible on hover */
  .featured-books:hover::-webkit-scrollbar-thumb {
    background-color: #6a4c8c;
  }

  .featured-list {
    position: relative;
  }

/* ===== BUYING GUIDE SPECIFIC STYLES ===== */

/* Page Header */
.page-header {
    background: linear-gradient(to right, #1a1a2e, #4f3a65);
    padding: 1.5rem 0;
    text-align: center;
    margin-bottom: 0;
}

.page-header h1 {
    font-size: 2.25rem;
    margin-bottom: 0.4rem;
    color: #ffd700;
}

/* Accordion Filter Styles */
.filter-accordion {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.accordion-item {
    border-bottom: 1px solid #4f3a65;
    margin-bottom: 10px;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: #2a2a40;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.3s;
}

.accordion-header:hover {
    background-color: #3a3a50;
}

button.accordion-header {
    width: 100%;
    border: 0;
    color: #e0e0ff;
    text-align: left;
    font-family: 'Spectral', serif;
    font-size: 1.1rem;
}

button.accordion-header:hover,
button.accordion-header[aria-expanded="true"] {
    color: #ffd700;
}

.accordion-heading {
    margin: 0;
    font-size: 1.1rem;
    color: #e0e0ff;
}

.accordion-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #e0e0ff;
}

.accordion-header:hover h3,
.accordion-item.active .accordion-header h3 {
    color: #ffd700;
}

.accordion-icon {
    color: #e0e0ff;
    font-size: 1.5rem;
    transition: transform 0.3s, color 0.3s;
}

.accordion-header:hover .accordion-icon,
.accordion-item.active .accordion-icon {
    color: #ffd700;
}

.accordion-item.active .accordion-icon {
    transform: rotate(45deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background-color: #1a1a2e;
    padding: 0 15px;
}

.accordion-item.active .accordion-content {
    max-height: 16rem; /* long groups (themes, subgenre) scroll inside */
    overflow-y: auto;
    padding: 15px;
}

/* Filter Section */
.filter-section {
    background-color: #0f0f1a;
    padding: 1rem 0 0.5rem;
    margin-bottom: 0;
}

.filter-options {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 1rem;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group h3 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    color: #e0e0ff;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    background-color: #2a2a40;
    border: 1px solid #4f3a65;
    color: #e0e0ff;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Spectral', serif;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background-color: #4f3a65;
}

.filter-btn.active {
    background-color: #ffd700;
    color: #1a1a2e;
    border-color: #ffd700;
}

/* Book Grid */
.book-listings {
    padding: 0.75rem 0 2rem;
}

.results-count {
    margin-bottom: 0.75rem;
    color: #e0e0ff;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.book-card {
    display: flex;
    flex-direction: column;
    background-color: #2a2a40;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.book-cover {
    position: relative;
    height: 250px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #1a1a2e; /* Match the background color */
}

.book-cover a {
    display: flex;
    width: 100%;
    height: 100%;
    text-decoration: none;
    justify-content: center;
    align-items: center;
}

.book-card .book-cover a img,
.book-cover a img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

/* Ensure the book-cover container maintains its size for directory */
.book-grid .book-cover {
    position: relative;
    height: 250px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #1a1a2e;
}


/* Award and Nomination Badges */
.awards {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    max-width: calc(100% - 20px);
    gap: 5px;
    z-index: 10;
}

.award, .nomination {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    white-space: nowrap;
    line-height: 1.2;
    letter-spacing: 0.5px;
}

/* Award winner styles */
.award.hugo {
    background-color: #fff;
    color: #1a1a2e;
    border: 2px solid #1a1a2e;
}

.award.nebula {
    background-color: #ffd700;
    color: #1a1a2e;
    border: 2px solid #ffd700;
}

/* Nomination styles - more distinct from winners but with visual connection */
/* Nominee fills sit on Midnight Ink so the dotted badge stays legible over busy cover art */
.nomination.hugo {
    background-color: rgba(15, 15, 26, 0.85);
    color: #ffffff;
    border: 2px dotted #ffffff;
}

.nomination.nebula {
    background-color: rgba(15, 15, 26, 0.85);
    color: #ffd700;
    border: 2px dotted #ffd700;
}

.book-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Allow this to expand and push buttons to bottom */
    justify-content: space-between; /* Distribute space vertically */
    padding: 1.5rem;
}

.book-info h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.author {
    color: #e0e0ff;
    font-style: italic;
    margin-bottom: 0.25rem;
}

.year {
    color: #95a5a6;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

/* Update the book-meta class to use flexbox with wrap */
.book-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: center;
}

/* Style the subgenre badges for proper spacing and wrapping */
.subgenre {
    background-color: transparent;
    color: #e0e0ff;
    border: 1px solid #6a4c8c;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: normal;
    display: inline-block;
    margin-bottom: 0.25rem;
}

/* Ensure the genre badge has consistent styling */
.genre {
    background-color: #4f3a65;
    color: #f8f8ff;
    border: 1px solid #4f3a65;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: normal;
    display: inline-block;
    margin-bottom: 0.25rem;
}

/* Theme tags container */
.themes {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 10px 0;
}

/* Individual theme tag */
.theme-tag {
    background-color: #2a2a40;
    color: #e0e0ff;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    border: 1px solid #4f3a65;
}

/* Theme filter buttons - make them scrollable */
.theme-buttons {
    max-width: 100%;
    padding-bottom: 5px;
    display: flex;
    flex-wrap: wrap;
    -webkit-overflow-scrolling: touch;
}

/* Recommendation book genre display */
.book-genre {
    font-size: 0.9rem;
    margin: 5px 0;
    color: #e0e0ff;
}

.availability {
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 4px;
}

.availability.available {
    background-color: #00b894;
    color: #fff;
}

.availability.limited {
    background-color: #fdcb6e;
    color: #1a1a2e;
}

.availability.unavailable {
    background-color: #95a5a6;
    color: #fff;
}

.description {
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
    /* Same intentional 4-line clamp at every width */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    overflow: hidden;
}

.book-actions .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.5rem 0.6rem;
    font-size: 0.8rem;
    line-height: 1.2;
    letter-spacing: 0.5px;
    flex: 1;
    text-align: center;
}

/* Stacked so both labels stay on one line in the four-up grid */
.book-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: space-between;
    margin-top: auto; /* Push buttons to the bottom */
}

/* Lamplight Rule on cards: View Details is default violet, Add to Reading List is a ghost */
.book-actions .btn.btn-primary {
    background-color: #4f3a65;
    color: #fff;
}

.book-actions .btn.btn-primary:hover {
    background-color: #6a4c8c;
}

.book-actions .btn.add-to-reading-list {
    background-color: transparent;
    border: 1px solid #6a4c8c;
    color: #e0e0ff;
}

.book-actions .btn.add-to-reading-list:hover {
    background-color: #4f3a65;
    color: #fff;
}

.book-actions .btn.add-to-reading-list.on-reading-list {
    background-color: #6a4c8c !important;
    color: #fff;
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid #4f3a65;
    color: #e0e0ff;
}

.btn-secondary:hover {
    background-color: #4f3a65;
    color: #fff;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.page-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    background-color: #2a2a40;
    border: 1px solid #4f3a65;
    color: #e0e0ff;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    background-color: #3a3a50;
    border-color: #6a4c8c;
}

.page-btn.active,
.page-btn[aria-current="page"] {
    background-color: #ffd700;
    color: #1a1a2e;
    border-color: #ffd700;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-ellipsis {
    min-width: 1.5rem;
    text-align: center;
    color: #e0e0ff;
}

/* Disabled state */
.btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Responsive adjustments */
@media screen and (max-width: 767px) {
  .bookshop-widgets {
    flex-direction: column;
  }
  
  .bookshop-widget-container {
    min-width: 100%;
  }
}

/* Recommendation Tool */
.recommendation-tool {
    background-color: #0f0f1a;
    padding: 3rem 0;
    margin: 3rem 0;
}

.quiz-container {
    max-width: 700px;
    margin: 2rem auto 0;
    background-color: #2a2a40;
    border-radius: 8px;
    padding: 2rem;
    position: relative;
}

.quiz-question {
    display: none;
}

.quiz-question.active {
    display: block;
}

.quiz-question h3 {
    margin-bottom: 1.5rem;
    text-align: center;
}

.quiz-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.quiz-option {
    padding: 1rem;
    background-color: #1a1a2e;
    border: 1px solid #4f3a65;
    color: #e0e0ff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Spectral', serif;
    font-size: 1rem;
}

.quiz-option:hover {
    background-color: #4f3a65;
}

.quiz-option.selected {
    background-color: #ffd700;
    color: #1a1a2e;
    border-color: #ffd700;
}

.quiz-results {
    display: none;
}

.quiz-results.active {
    display: block;
}

.quiz-results h3 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.recommendation-result {
    background-color: #1a1a2e;
    border-radius: 6px;
    padding: 1.5rem;
}

.recommendation-book {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.recommendation-book img {
    width: 100px;
    height: auto;
    border-radius: 4px;
}

.recommendation-book h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
}

.recommendation-reason {
    font-style: italic;
    color: #e0e0ff;
}

.quiz-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
}

.quiz-btn {
    padding: 0.5rem 1rem;
    background-color: #4f3a65;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Spectral', serif;
    transition: all 0.3s ease;
}

.quiz-btn:hover {
    background-color: #6a4c8c;
}

.quiz-btn.restart {
    display: none;
}

/* Further Reading Section */
.further-reading {
    padding: 3rem 0;
}

.reading-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 1.5rem;
}

.reading-option {
    background-color: #2a2a40;
    padding: 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 400;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.reading-option:hover {
    text-decoration: none;
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    background-color: #3a3a50;
}

.reading-option:focus-visible {
    outline: 3px solid #ffd700;
    outline-offset: 3px;
}

.reading-option h3 {
    color: #ffd700;
    font-size: 1.3rem;
    line-height: 1.3;
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.reading-option p {
    color: #e0e0ff;
    margin: 0;
}

@media (prefers-reduced-motion: reduce) {
    .reading-option {
        transition: none;
    }

    .reading-option:hover {
        transform: none;
    }
}

/* ===== filterbar agent: active filter bar, accordion summary, scroll fade ===== */
.fb-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.results-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.75rem;
    margin-bottom: 1rem;
}

.results-bar .results-count {
    margin: 0;
}

.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.active-filters[hidden] {
    display: none;
}

.active-filter-chip {
    min-height: 32px;
    padding: 0.2rem 0.65rem;
    background-color: #2a2a40;
    border: 1px solid #6a4c8c;
    border-radius: 4px;
    color: #e0e0ff;
    font-family: 'Spectral', serif;
    font-size: 0.85rem;
    cursor: pointer;
}

.active-filter-chip:hover,
.active-filter-chip:focus-visible {
    background-color: #4f3a65;
}

.active-filters-clear {
    background: none;
    border: 0;
    padding: 0.2rem 0.4rem;
    color: #e0e0ff;
    font-family: 'Spectral', serif;
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
}

.active-filters-clear:hover {
    color: #ffd700;
}

.accordion-header .accordion-title {
    flex: 0 0 auto;
}

.accordion-selected {
    flex: 1 1 auto;
    margin: 0 0.75rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
    color: #e0e0ff;
    font-family: 'Spectral', serif;
    font-size: 0.85rem;
}

.accordion-selected:empty {
    display: none;
}

#acc-subgenre.accordion-content,
#acc-theme.accordion-content {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 1.5rem), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 1.5rem), transparent);
}

/* ===== a11y agent: accordion button reset, focus rings ===== */
.accordion-heading {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
}

button.accordion-header {
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
    font-size: inherit;
    line-height: inherit;
}

/* Collapsed content is inert; keep it out of layout flow of focus too */
.accordion-content[inert] {
    visibility: hidden;
    transition: max-height 0.3s ease-out, visibility 0s linear 0.3s;
}

.filter-btn:focus-visible,
.accordion-header:focus-visible,
.page-btn:focus-visible,
.quiz-option:focus-visible,
.quiz-btn:focus-visible,
.active-filter-chip:focus-visible,
.active-filters-clear:focus-visible,
button:focus-visible {
    outline: 3px solid #ffd700;
    outline-offset: 3px;
}

/* Gold-filled chips/pages: a gold ring would blend in, so ring in lavender with a navy gap */
.filter-btn.active:focus-visible,
.page-btn.active:focus-visible,
.quiz-option.selected:focus-visible {
    outline-color: #e0e0ff;
    box-shadow: 0 0 0 2px #0f0f1a;
}

.accordion-header:focus-visible {
    outline-offset: -3px; /* .filter-accordion clips overflow */
}

/* ===== empty agent: empty state and load error ===== */
.empty-state {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 40rem;
    margin: 2rem auto;
    padding: 3rem;
    background-color: #2a2a40;
    border: 1px solid #4f3a65;
    border-radius: 8px;
    text-align: center;
}

.empty-state h3 {
    font-family: 'Silkscreen', monospace;
    color: #ffd700;
    font-size: 1.25rem;
    margin: 0 0 1rem;
}

.empty-state p {
    font-family: 'Spectral', serif;
    color: #e0e0ff;
    font-size: 1.125rem;
    line-height: 1.6;
    margin: 0 0 2rem;
}

.empty-state-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.empty-state .btn {
    font-family: inherit;
    cursor: pointer;
}
