/* Responsive Styles */

/* Large Screens (Default) */
/* Styles for 1200px and above are in the main stylesheet */

/* Medium Screens (Tablets) */
@media screen and (max-width: 1199px) {
    /* Typography adjustments */
    h1 {
        font-size: 2.2rem;
    }
    
    h2 {
        font-size: 1.8rem;
    }
    
    /* Navigation adjustments */
    .nav-links {
        gap: 1rem;
    }
    
    /* Book grid adjustments */
    .book-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.75rem;
    }

    .reading-options {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Featured section adjustments */
    .featured-books {
        grid-template-columns: repeat(2, 1fr);
    }

    .featured-books .book-card {
        width: calc(50% - 0.75rem); /* 2 items per row */
    }

    /* Filter section adjustments */
    .filter-group {
        min-width: 100%;
    }
    
    .filter-buttons {
        justify-content: flex-start;
    }
}

/* Small Screens (Mobile Landscape) */
@media screen and (max-width: 767px) {
    /* Header adjustments: logo and toggle share one compact row */
    header {
        padding: 0.5rem 0;
    }

    .header-content {
        flex-direction: row;
        align-items: center;
    }

    .logo {
        margin-bottom: 0;
    }

    .logo .site-name {
        font-size: 1.1rem;
        letter-spacing: 0;
        white-space: nowrap;
    }

    /* Navigation adjustments */
    .menu-toggle {
        display: flex;
    }

    /* Drawer drops down beneath the header bar so the logo is never covered */
    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background-color: #0f0f1a;
        padding: 0.5rem 1.5rem 1rem;
        box-shadow: 0 10px 15px rgba(0, 0, 0, 0.5);
        z-index: 99;
        /* visibility keeps closed links out of the tab order */
        visibility: hidden;
        opacity: 0;
        transform: translateY(-8px);
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0.25s;
    }

    .nav-links.active {
        visibility: visible;
        opacity: 1;
        transform: translateY(0);
        transition-delay: 0s;
    }

    .nav-links li {
        margin: 0;
    }

    .nav-links a {
        display: block;
        padding: 0.75rem 0;
        min-height: 44px;
    }

    @media (prefers-reduced-motion: reduce) {
        .nav-links,
        .nav-links.active {
            transition: none;
        }
    }

    /* Book grid adjustments */
    /* Book card horizontal layout for mobile */
    .book-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .book-card {
        display: flex;
        flex-direction: column; /* cover well spans full card width so badges never clip */
        height: auto;
        align-items: stretch;
    }

    .book-cover {
        width: 100%;
        min-width: 0;
        height: 220px;
        flex-shrink: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0.5rem;
    }

    .book-cover img {
        max-height: 100%;
        object-fit: contain;
    }
    
    .awards {
        top: 5px;
        right: 5px;
    }
    
    .award, .nomination {
        padding: 3px 6px;
        font-size: 0.75rem;
    }
    
    .book-info {
        padding: 1rem;
        flex-grow: 1;
        display: flex;
        flex-direction: column;
    }
    
    .book-info h3 {
        font-size: 1.1rem;
        margin-bottom: 0.3rem;
    }
    
    .description {
        margin-bottom: 0.5rem;
        font-size: 0.85rem;
    }

    .book-actions {
        margin-top: auto;
    }
    
    /* Book metadata adjustments */
    .book-meta {
        flex-direction: row; /* Keep row direction for badges */
        flex-wrap: wrap; /* Allow wrapping */
        align-items: flex-start;
        gap: 4px; /* Smaller gap for mobile */
        margin-bottom: 0.5rem;
        max-width: 100%; /* Ensure it doesn't overflow */
    }
    
    .genre, .subgenre {
        font-size: 0.75rem; /* 12px floor */
        padding: 1px 6px;
        margin-bottom: 2px;
    }
    
    /* Theme tags adjustment */
    .themes {
        margin: 8px 0;
    }
    
    .theme-tag {
        font-size: 0.65rem;
        padding: 2px 6px;
    }
    
    /* Featured section adjustments */
    .featured-books {
        grid-template-columns: 1fr;
    }

    .featured-books .book-card {
        width: 85%; /* 1 larger item per view */
      }
    
    /* Filter adjustments */
    .filter-buttons {
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    
    .filter-options {
        flex-direction: column;
    }

    .reading-options {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .quiz-options {
        grid-template-columns: 1fr;
    }
    
    .recommendation-book {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    /* Awards comparison stacks */
    .awards-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .award-box .btn {
        align-self: stretch;
        font-size: 0.85rem;
        letter-spacing: 0.5px;
    }

    /* Footer adjustments */
    .footer-content {
        flex-direction: column;
    }
    
    .footer-section {
        margin-bottom: 2rem;
    }
}

/* Extra Small Screens (Mobile Portrait) */
@media screen and (max-width: 479px) {
    /* Typography adjustments */
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    /* Book grid adjustments */
    .book-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .book-cover {
        width: 100%;
        min-width: 0;
        height: 200px;
      }
      
      .book-info {
        padding: 0.75rem;
      }
      
      .book-actions {
        flex-direction: column;
        gap: 0.5rem;
      }
      
      .book-actions .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
      }
      
      .book-meta {
        margin-bottom: 0.3rem;
    }
    
    .genre, .subgenre {
        font-size: 0.75rem; /* 12px floor */
        padding: 1px 6px;
    }

    .featured-books .book-card {
        width: 85%; /* 1 larger item per view */
      }
    
    /* Award timeline adjustments */
    .timeline-container {
        padding-left: 1rem;
    }
    
    .timeline-item::before {
        left: -1.5rem;
    }
    
    .book-meta {
        margin-bottom: 0.5rem;
    }
    
    .theme-buttons button {
        min-width: auto;
        padding: 0.4rem 0.7rem;
    }
}

/* ===== filterbar agent: mobile hero ===== */
@media screen and (max-width: 767px) {
    .page-header {
        padding: 1rem 0;
    }

    .page-header h1 {
        font-size: 1.6rem;
        line-height: 1.2;
    }

    .page-header p {
        font-size: 0.95rem;
    }
}

@media screen and (max-width: 767px) {
    /* filterbar agent: compact accordion rows so covers reach the first screen */
    .accordion-item {
        margin-bottom: 6px;
    }

    .accordion-header {
        padding: 10px 14px;
    }

    .filter-section {
        padding: 0.75rem 0 0.25rem;
    }
}
