/* ============================================================
   Book Aura — Custom Styles
   ============================================================ */

[x-cloak] { display: none !important; }
/* --- Base & Typography --- */
@font-face {
    font-family: 'Kalpurush';
    src: url('../fonts/Kalpurush.ttf') format('truetype');
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

html {
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-family: 'Times New Roman', 'Kalpurush', serif;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'EB Garamond', 'Times New Roman', 'Kalpurush', serif;
}

/* --- Header Scroll Shadow --- */
.header-scrolled {
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

#site-header {
    transition: transform 0.24s cubic-bezier(0.2, 0.7, 0.2, 1);
    will-change: transform;
    border-bottom: 1px solid rgba(229, 231, 235, 0.8);
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.dark #site-header {
    border-bottom-color: rgba(55, 65, 81, 0.8);
    background: rgba(15, 23, 42, 0.96);
}

.mobile-menu-toggle {
    display: inline-flex;
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    margin-right: -0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    background: #fff;
    color: #374151;
    transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-toggle:hover,
.mobile-menu-toggle:focus-visible {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

.mobile-menu-toggle:focus-visible {
    outline: 2px solid #ef4444;
    outline-offset: 2px;
}

.dark .mobile-menu-toggle {
    border-color: #374151;
    background: #1f2937;
    color: #e5e7eb;
}

.dark .mobile-menu-toggle:hover,
.dark .mobile-menu-toggle:focus-visible {
    border-color: #7f1d1d;
    background: #374151;
    color: #fca5a5;
}

.mobile-contact-menu {
    position: relative;
    z-index: 110;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
}

.mobile-contact-toggle {
    display: inline-flex;
    width: 2.5rem;
    height: 2.5rem;
    align-items: center;
    justify-content: center;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    background: #fff;
    color: #4b5563;
    box-shadow: 0 2px 7px rgba(15, 23, 42, 0.12);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-contact-toggle:hover,
.mobile-contact-toggle:focus-visible,
.mobile-contact-toggle[aria-expanded="true"] {
    transform: translateY(-1px);
    border-color: #9ca3af;
    color: #111827;
    box-shadow: 0 4px 11px rgba(15, 23, 42, 0.18);
}

.mobile-contact-toggle:focus-visible {
    outline: 2px solid #9ca3af;
    outline-offset: 3px;
}

.dark .mobile-contact-toggle {
    border-color: #374151;
    background: #1f2937;
    color: #d1d5db;
}

.dark .mobile-contact-toggle:hover,
.dark .mobile-contact-toggle:focus-visible,
.dark .mobile-contact-toggle[aria-expanded="true"] {
    border-color: #6b7280;
    background: #374151;
    color: #fff;
}

.mobile-contact-whatsapp-icon {
    width: 1.35rem;
    height: 1.35rem;
}

.mobile-contact-links {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: -3rem;
    display: grid;
    width: min(15rem, calc(100vw - 2rem));
    gap: 0.375rem;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.2);
    transform-origin: top right;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.dark .mobile-contact-links {
    border-color: #374151;
    background: rgba(17, 24, 39, 0.98);
}

.mobile-contact-link {
    display: flex;
    min-height: 2.75rem;
    align-items: center;
    gap: 0.75rem;
    border-radius: 0.75rem;
    padding: 0.4rem 0.65rem;
    color: #1f2937;
    font-size: 0.875rem;
    font-weight: 650;
    transition: background-color 0.16s ease, transform 0.16s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-contact-link:hover,
.mobile-contact-link:focus-visible {
    background: #f3f4f6;
    transform: translateX(2px);
}

.mobile-contact-link:focus-visible {
    outline: 2px solid #16a34a;
    outline-offset: 1px;
}

.dark .mobile-contact-link {
    color: #f3f4f6;
}

.dark .mobile-contact-link:hover,
.dark .mobile-contact-link:focus-visible {
    background: #1f2937;
}

.mobile-contact-link-icon {
    display: inline-flex;
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 0.625rem;
    background: #eff6ff;
    color: #2563eb;
}

.mobile-contact-link-icon.is-whatsapp {
    background: #dcfce7;
    color: #16a34a;
}

.mobile-contact-link-icon.is-messenger {
    background: #f3e8ff;
    color: #9333ea;
}

.mobile-contact-link-icon.is-facebook {
    background: #dbeafe;
    color: #1877f2;
}

.dark .mobile-contact-link-icon {
    background: #1e3a8a;
    color: #bfdbfe;
}

.dark .mobile-contact-link-icon.is-whatsapp {
    background: #14532d;
    color: #86efac;
}

.dark .mobile-contact-link-icon.is-messenger {
    background: #581c87;
    color: #e9d5ff;
}

.dark .mobile-contact-link-icon.is-facebook {
    background: #1e3a8a;
    color: #93c5fd;
}

.mobile-contact-link-icon svg {
    width: 1.2rem;
    height: 1.2rem;
}

.mobile-contact-link-arrow {
    width: 1rem;
    height: 1rem;
    margin-left: auto;
    color: #9ca3af;
}

.mobile-contact-empty {
    margin: 0;
    padding: 0.75rem;
    color: #6b7280;
    font-size: 0.75rem;
    line-height: 1.5;
}

.dark .mobile-contact-empty {
    color: #9ca3af;
}

@media (min-width: 1024px) {
    .mobile-menu-toggle {
        display: none;
    }
}

.header-hidden {
    transform: translateY(-100%);
}

#site-header.search-active {
    transform: translateY(0);
}

.header-genres-nav {
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.header-desktop-nav-row {
    display: grid;
    min-height: 3.5rem;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
}

.header-primary-nav {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: flex-start;
    gap: clamp(0.5rem, 1.5vw, 1.5rem);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 0.25rem;
    scroll-padding-inline: 0.25rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    white-space: nowrap;
}

.header-primary-nav.is-dragging {
    cursor: grabbing;
    user-select: none;
}

.header-primary-nav::-webkit-scrollbar {
    display: none;
}

.header-desktop-nav-row.has-header-genres {
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: clamp(0.75rem, 1.5vw, 1.5rem);
}

.header-primary-nav > a,
.header-primary-nav > div {
    flex: 0 0 auto;
}

.header-genres-inline {
    min-width: 0;
    width: 100%;
}

.header-genres-inline .header-genres-links {
    min-width: 0;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: clamp(0.5rem, 1.5vw, 1.5rem);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 0.25rem;
    scroll-padding-inline: 0.25rem;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
}

.header-genres-inline .header-genres-links.is-dragging {
    cursor: grabbing;
    user-select: none;
}

.header-genres-inline .header-genres-links::-webkit-scrollbar {
    display: none;
}

.dark .header-genres-nav {
    border-bottom-color: #1f2937;
    background: #111827;
}

.header-genres-track {
    display: flex;
    min-height: 3.25rem;
    max-width: 80rem;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 0 auto;
    padding: 0.5rem 1.5rem;
}

.header-genres-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.header-genres-link {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    color: #1f2937;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.025em;
    line-height: 1.5;
    text-transform: uppercase;
    white-space: nowrap;
    transition: color 0.18s ease;
}

.header-genres-link:hover,
.header-genres-link:focus-visible {
    color: #b91c1c;
}

.header-genres-link:focus-visible {
    outline: 2px solid #ef4444;
    outline-offset: 2px;
}

.header-genres-link.is-active {
    color: #b91c1c;
}

.dark .header-genres-link {
    color: #e5e7eb;
}

.dark .header-genres-link:hover,
.dark .header-genres-link:focus-visible {
    color: #fca5a5;
}

.dark .header-genres-link.is-active {
    color: #fca5a5;
}

@media (min-width: 1024px) {
    .header-genres-track {
        justify-content: flex-start;
        overflow: hidden;
    }

    .header-genres-links {
        min-width: 0;
        flex: 1 1 auto;
        flex-wrap: nowrap;
        justify-content: safe center;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        padding: 0.25rem;
        scroll-padding-inline: 0.25rem;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        cursor: grab;
    }

    .header-genres-links.is-dragging {
        cursor: grabbing;
        user-select: none;
    }

    .header-genres-links::-webkit-scrollbar {
        display: none;
    }

    .header-genres-link {
        min-height: 2.25rem;
        scroll-snap-align: start;
    }
}

@media (max-width: 1023px) {
    .header-genres-track {
        min-height: 3rem;
        justify-content: flex-start;
        gap: 0;
        overflow: hidden;
        padding: 0.375rem 0;
    }

    .header-genres-links {
        width: 100%;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 0.5rem;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        padding: 0 1rem 0.125rem;
        scroll-padding-inline: 1rem;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .header-genres-links::-webkit-scrollbar {
        display: none;
    }

    .header-genres-link {
        font-size: 0.875rem;
        scroll-snap-align: start;
        -webkit-tap-highlight-color: transparent;
    }
}

/* --- Search Overlay Transitions --- */
.search-overlay-enter {
    animation: slideDown 0.3s ease-out forwards;
}

.search-overlay-leave {
    animation: slideUp 0.2s ease-in forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-100%);
    }
}

/* --- Cart Badge Pulse --- */
.cart-badge-pulse {
    animation: badgePulse 0.4s ease-out;
}

@keyframes badgePulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* --- Mobile Menu Slide --- */
.mobile-menu-layer {
    position: fixed;
    inset: 0;
    z-index: 200;
}

.mobile-menu-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(15, 23, 42, 0.58);
    cursor: default;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-drawer {
    position: absolute;
    inset: 0 0 0 auto;
    display: flex;
    width: min(21rem, 88vw);
    height: 100vh;
    height: 100dvh;
    flex-direction: column;
    overflow: hidden;
    border-radius: 1.25rem 0 0 1.25rem;
    background: #fff;
    color: #111827;
    box-shadow: -1rem 0 3rem rgba(15, 23, 42, 0.2);
    padding-top: env(safe-area-inset-top);
    overscroll-behavior: contain;
}

.dark .mobile-menu-drawer {
    background: #111827;
    color: #f9fafb;
}

.mobile-menu-header {
    display: flex;
    min-height: 4.5rem;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.5rem 1rem;
}

.dark .mobile-menu-header {
    border-color: #374151;
}

.mobile-menu-genres {
    flex: 0 0 auto;
}

.mobile-menu-brand {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.625rem;
    color: #b91c1c;
    font-size: 1.2495rem;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.mobile-menu-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-menu-close {
    display: inline-flex;
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0.75rem;
    background: #f3f4f6;
    color: #4b5563;
}

.dark .mobile-menu-close {
    background: #1f2937;
    color: #d1d5db;
}

.mobile-menu-nav {
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.875rem 0.75rem;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.mobile-menu-link {
    display: flex;
    min-height: 3rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-radius: 0.75rem;
    padding: 0.75rem 0.875rem;
    color: #374151;
    font-size: 0.9375rem;
    font-weight: 650;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.mobile-menu-link:hover,
.mobile-menu-link.is-active {
    background: #fef2f2;
    color: #b91c1c;
}

.dark .mobile-menu-link {
    color: #e5e7eb;
}

.dark .mobile-menu-link:hover,
.dark .mobile-menu-link.is-active {
    background: #1f2937;
    color: #fca5a5;
}

.mobile-menu-categories {
    display: grid;
    gap: 0.125rem;
    margin: 0.25rem 0 0.75rem 0.875rem;
    border-left: 2px solid #fee2e2;
    padding-left: 0.625rem;
}

.dark .mobile-menu-categories {
    border-color: #7f1d1d;
}

.mobile-menu-category {
    display: block;
    border-radius: 0.5rem;
    padding: 0.55rem 0.75rem;
    color: #6b7280;
    font-size: 0.8125rem;
    line-height: 1.35;
}

.mobile-menu-category:hover,
.mobile-menu-all-categories {
    color: #b91c1c;
}

.dark .mobile-menu-category {
    color: #9ca3af;
}

.dark .mobile-menu-category:hover,
.dark .mobile-menu-all-categories {
    color: #fca5a5;
}

.mobile-menu-footer {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    border-top: 1px solid #e5e7eb;
    padding: 0.625rem 1rem calc(0.625rem + env(safe-area-inset-bottom));
}

.dark .mobile-menu-footer {
    border-color: #374151;
}

.mobile-menu-language {
    display: flex;
    min-height: 2.25rem;
    align-items: center;
    gap: 0.375rem;
    border-radius: 0.625rem;
    background: #f3f4f6;
    padding: 0.45rem 0.625rem;
    color: #374151;
    font-size: 0.75rem;
    font-weight: 600;
}

.dark .mobile-menu-language {
    background: #1f2937;
    color: #e5e7eb;
}

.mobile-menu-language:hover,
.mobile-menu-language:focus-visible {
    background: #fef2f2;
    color: #b91c1c;
}

.dark .mobile-menu-language:hover,
.dark .mobile-menu-language:focus-visible {
    background: #374151;
    color: #fca5a5;
}

.mobile-menu-theme {
    border: 0;
    cursor: pointer;
}

.header-brand-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 0.15rem;
    line-height: 1.1;
}

.header-brand-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.header-brand-bio {
    display: -webkit-box;
    overflow: hidden;
    color: #6b7280;
    font-size: 0.625rem;
    font-weight: 500;
    line-height: 1.2;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.dark .header-brand-bio {
    color: #9ca3af;
}

body.mobile-menu-open {
    overflow: hidden;
}

body.mobile-menu-open > a.fixed {
    visibility: hidden;
    pointer-events: none;
}

.home-banner-image {
    display: block;
}

.featured-book-carousel {
    display: grid;
    width: 90%;
    margin-inline: auto;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 1.5rem;
    background: #0f172a;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    touch-action: pan-y;
}

.featured-book-slide {
    display: grid;
    grid-area: 1 / 1;
    grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
    color: #f8fafc;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.45s ease, visibility 0.45s ease;
}

.featured-book-slide.is-active {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.featured-book-media {
    position: relative;
    display: flex;
    min-width: 0;
    width: 100%;
    aspect-ratio: 16 / 9;
    align-self: start;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 50% 40%, rgba(185, 28, 28, 0.32), transparent 58%),
        linear-gradient(145deg, #1e293b, #111827 72%);
}

.featured-book-cover {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: drop-shadow(0 1.5rem 1.25rem rgba(0, 0, 0, 0.42));
}

.featured-book-best-seller {
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid rgba(253, 230, 138, 0.42);
    border-radius: 9999px;
    background: linear-gradient(135deg, #b45309, #92400e);
    padding: 0.55rem 0.85rem;
    color: #fffbeb;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.045em;
    text-transform: uppercase;
    box-shadow: 0 0.5rem 1.5rem rgba(120, 53, 15, 0.3);
    font-style: italic;
}

.featured-book-best-seller::before {
    content: '★';
    font-style: normal;
}

.featured-book-cover-rating {
    position: absolute;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1;
    display: inline-flex;
    min-height: 2.25rem;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid rgba(253, 230, 138, 0.5);
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.88);
    padding: 0.4rem 0.75rem;
    color: #fef3c7;
    font-size: 0.8rem;
    font-weight: 800;
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.3);
}

.featured-book-cover-rating span {
    color: #fbbf24;
}

.featured-book-cover-rating.is-unrated {
    border-color: rgba(203, 213, 225, 0.35);
    color: #cbd5e1;
}

.featured-book-cover-rating.is-unrated span {
    color: #cbd5e1;
}

.featured-book-icon {
    width: 0.9rem;
    height: 0.9rem;
    flex: 0 0 auto;
}

.featured-book-details {
    display: flex;
    min-width: 0;
    flex-direction: column;
    justify-content: flex-start;
    padding: clamp(1rem, 2vw, 1.75rem);
    background:
        radial-gradient(ellipse at 100% 0%, rgba(185, 28, 28, 0.18), transparent 45%),
        linear-gradient(145deg, #111827, #0b1120);
}

.featured-book-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 0;
}

.featured-book-info-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.featured-book-tag {
    display: inline-flex;
    min-height: 1.8rem;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    padding: 0.3rem 0.7rem;
    color: #e2e8f0;
    font-size: 0.67rem;
    font-weight: 800;
    letter-spacing: 0.065em;
}

.featured-book-category {
    border-color: rgba(252, 165, 165, 0.24);
    background: rgba(185, 28, 28, 0.2);
    color: #fecaca;
    text-transform: uppercase;
}

.featured-book-discount {
    background: rgba(22, 163, 74, 0.16);
    color: #86efac;
}

.featured-book-rating {
    background: rgba(245, 158, 11, 0.12);
    color: #fcd34d;
}

.featured-book-copy {
    min-width: 0;
}

.featured-book-heading {
    min-width: 0;
}

.featured-book-title {
    display: -webkit-box;
    overflow: hidden;
    color: #fff;
    font-size: clamp(1.8rem, 3.4vw, 3.15rem);
    font-weight: 800;
    line-height: 1.16;
    letter-spacing: -0.035em;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.featured-book-author {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-top: 0.8rem;
    color: #cbd5e1;
    font-size: 0.95rem;
    font-weight: 600;
}

.featured-book-author span {
    color: #fca5a5;
    font-size: 1.05rem;
}

.featured-book-description {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 1.1rem;
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.7;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.featured-book-pricing {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.8rem;
}

.featured-book-current-price {
    color: #fff;
    font-size: clamp(1.6rem, 2.6vw, 2.15rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.featured-book-original-price {
    color: #94a3b8;
    font-size: 1rem;
    text-decoration: line-through;
}

.featured-book-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 1rem;
}

.featured-book-add-button,
.featured-book-details-button,
.featured-book-buy-button {
    display: inline-flex;
    min-width: 0;
    min-height: 2.7rem;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 0.65rem;
    padding: 0.55rem 0.6rem;
    flex: 1 1 0;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.15;
    text-align: center;
    transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.featured-book-cart-control {
    display: flex;
    min-width: 0;
    flex: 1 1 0;
}

.featured-book-add-button {
    background: #b91c1c;
    color: #fff;
    box-shadow: 0 0.5rem 1.25rem rgba(185, 28, 28, 0.25);
}

.featured-book-cart-control .featured-book-add-button {
    width: 100%;
}

.featured-book-quantity-control {
    display: flex;
    min-width: 0;
    min-height: 2.9rem;
    flex: 1 1 0;
    align-items: center;
    justify-content: space-between;
    border: 1px solid rgba(203, 213, 225, 0.25);
    border-radius: 0.8rem;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.featured-book-quantity-control .book-card-quantity-button {
    width: 2.5rem;
    min-height: 2.75rem;
    color: #fff;
}

.featured-book-add-button:hover {
    transform: translateY(-1px);
    background: #991b1b;
}

.featured-book-buy-button {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
    box-shadow: 0 0.4rem 1rem rgba(185, 28, 28, 0.22);
}

.featured-book-buy-button:hover {
    transform: translateY(-1px);
    background: #991b1b;
}

.featured-book-details-button {
    border-color: rgba(203, 213, 225, 0.25);
    background: rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
}

.featured-book-details-button:hover {
    border-color: rgba(252, 165, 165, 0.5);
    background: rgba(255, 255, 255, 0.09);
}

.featured-book-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: auto;
    padding-top: 1.5rem;
}

.featured-book-dots {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.featured-book-dot {
    width: 0.5rem;
    height: 0.5rem;
    border: 0;
    border-radius: 9999px;
    background: #475569;
    transition: width 0.2s ease, background-color 0.2s ease;
}

.featured-book-dot.is-active {
    width: 1.5rem;
    background: #f87171;
}

.featured-book-arrow {
    display: inline-flex;
    width: 2.6rem;
    height: 2.6rem;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 9999px;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    box-shadow: 0 0.4rem 1.2rem rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(8px);
    transition: transform 0.18s ease, background-color 0.18s ease;
}

.featured-book-arrow:hover {
    transform: scale(1.05);
    background: #b91c1c;
}

.featured-book-arrow-prev {
    position: absolute;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
}

.featured-book-arrow-prev:hover {
    transform: translateY(-50%) scale(1.05);
}

.featured-book-arrow-next {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
}

.featured-book-arrow-next:hover {
    transform: translateY(-50%) scale(1.05);
}

.featured-book-carousel:focus-visible,
.featured-book-carousel button:focus-visible,
.featured-book-carousel a:focus-visible {
    outline: 2px solid #fca5a5;
    outline-offset: 3px;
}

@media (max-width: 767px) {
    .featured-book-carousel {
        width: 100%;
        border-radius: 0.9rem;
    }

    .featured-book-slide {
        grid-template-columns: minmax(0, 1fr);
    }

    .featured-book-media {
        min-height: 0;
        max-height: none;
    }

    .featured-book-cover {
        padding: 0;
    }

    .featured-book-best-seller {
        top: 0.6rem;
        left: 0.6rem;
        padding: 0.35rem 0.6rem;
        font-size: 0.62rem;
    }

    .featured-book-cover-rating {
        right: 0.6rem;
        bottom: 0.6rem;
        min-height: 1.8rem;
        padding: 0.3rem 0.55rem;
        font-size: 0.7rem;
    }

    .featured-book-details {
        min-height: 0;
        padding: 0.75rem 0.85rem;
    }

    .featured-book-tags {
        gap: 0.25rem;
        max-width: 62%;
    }

    .featured-book-tag {
        min-height: 1.4rem;
        padding: 0.2rem 0.45rem;
        font-size: 0.56rem;
        letter-spacing: 0.035em;
    }

    .featured-book-info-row {
        flex-wrap: nowrap;
        gap: 0.4rem;
        margin-top: 0.6rem;
    }

    .featured-book-category {
        max-width: 100%;
        overflow-wrap: anywhere;
        text-align: right;
    }

    .featured-book-title {
        font-size: clamp(1rem, 4.8vw, 1.35rem);
        -webkit-line-clamp: 1;
    }

    .featured-book-heading {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .featured-book-heading .featured-book-title {
        flex: 1 1 auto;
    }

    .featured-book-author {
        max-width: 40%;
        flex: 0 1 auto;
        overflow: hidden;
        margin-top: 0;
        font-size: 0.65rem;
        line-height: 1.2;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .featured-book-author span {
        font-size: 0.7rem;
    }

    .featured-book-description {
        margin-top: 0.45rem;
        font-size: 0.75rem;
        line-height: 1.45;
        -webkit-line-clamp: 2;
    }

    .featured-book-current-price {
        font-size: 1.05rem;
    }

    .featured-book-pricing {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }

    .featured-book-original-price {
        font-size: 0.62rem;
        line-height: 1.2;
    }

    .featured-book-actions {
        gap: 0.35rem;
        margin-top: 0.65rem;
    }

    .featured-book-add-button,
    .featured-book-details-button,
    .featured-book-buy-button {
        min-height: 2.4rem;
        padding: 0.45rem 0.35rem;
        font-size: 0.68rem;
    }

    .featured-book-quantity-control {
        min-height: 2.4rem;
    }

    .featured-book-quantity-control .book-card-quantity-button {
        width: 1.8rem;
        min-height: 2.25rem;
    }

    .featured-book-controls {
        padding-top: 0.6rem;
    }
}

@media (min-width: 640px) {
    .home-banner-slider {
        height: clamp(240px, 28vw, 380px);
    }

    .home-banner-slider > .relative,
    .home-banner-slide {
        height: 100%;
    }

    .home-banner-slider .home-banner-image {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }
}

/* --- Book Card Hover Effects --- */
.book-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.book-card .book-cover {
    transition: transform 0.3s ease;
    overflow: hidden;
}

.book-card:hover .book-cover img {
    transform: scale(1.03);
}

.best-selling-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 11;
    pointer-events: none;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    padding: 6px 9px;
    border-radius: 9999px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
    letter-spacing: 0.02em;
    white-space: nowrap;
    font-style: italic;
}

.best-selling-badge::before {
    content: '★';
    margin-right: 0.35rem;
    font-style: normal;
}

.book-card-cart-actions {
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.book-card:hover .book-card-cart-actions,
.book-card:focus-within .book-card-cart-actions {
    transform: translateY(0);
    opacity: 1;
}

.book-card-add-button,
.book-card-quantity-button {
    min-height: 2.75rem;
}

.book-card-quantity-button {
    width: 2.75rem;
    flex: 0 0 auto;
    font-size: 1.25rem;
    font-weight: 700;
}

@media (hover: none) {
    .book-card-cart-actions {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 767px) {
    .book-card-cart-actions {
        transform: translateY(0);
        opacity: 1;
        gap: 0.35rem;
        padding: 0.5rem;
    }

    .book-card-cart-actions > a,
    .book-card-cart-actions > button,
    .book-card-cart-actions > div {
        min-width: 0;
    }

    .book-card-cart-actions > .book-card-details-button {
        flex: 0 0 34%;
        padding-inline: 0.25rem;
        font-size: 0.65rem;
        white-space: nowrap;
    }

    .book-card-cart-actions > div {
        display: flex;
        flex: 1 1 0%;
    }

    .book-card-quantity-control {
        width: 100%;
        min-width: 0;
        flex: 1 1 0%;
    }

    .book-card-quantity-button {
        width: 1.5rem;
        min-height: 2.25rem;
        font-size: 1rem;
    }

    .book-card-quantity-control > span {
        min-width: 0;
        flex: 1 1 auto;
    }
}

/* Premium blue palette for the storefront landing page in dark mode. */
.dark body.home-page {
    background-color: #071426;
    color: #dceaff;
}

.dark body.home-page #site-header {
    border-bottom-color: #1e3a5f;
    background: rgba(11, 27, 51, 0.97);
}

.dark .header-brand-name,
.dark body.home-page #site-header [class~="text-book-red"],
.dark body.home-page #site-header [class~="hover:text-red-400"]:hover {
    color: #bfdbfe;
}

.dark body.home-page .header-genres-nav {
    border-color: #1e3a5f;
    background: #0b1b33;
}

.dark body.home-page .header-genres-link {
    color: #a6bddb;
}

.dark body.home-page .header-genres-link:hover,
.dark body.home-page .header-genres-link:focus-visible,
.dark body.home-page .header-genres-link.is-active {
    color: #dbeafe;
}

.dark body.home-page .mobile-menu-drawer,
.dark body.home-page .mobile-menu-header {
    background: #0b1b33;
}

.dark body.home-page .home-page-content [class~="bg-white"],
.dark body.home-page .home-page-content [class~="bg-white/95"] {
    background-color: #0d2039;
}

.dark body.home-page .home-page-content [class~="bg-gray-50"],
.dark body.home-page .home-page-content [class~="bg-gray-50/50"] {
    background-color: #102846;
}

.dark body.home-page .home-page-content [class~="bg-gray-100"],
.dark body.home-page .home-page-content [class~="bg-gray-800"],
.dark body.home-page .home-page-content [class~="bg-gray-900"] {
    background-color: #0d2039;
}

.dark body.home-page .home-page-content [class~="border-gray-100"],
.dark body.home-page .home-page-content [class~="border-gray-200"],
.dark body.home-page .home-page-content [class~="border-gray-700"] {
    border-color: #234365;
}

.dark body.home-page .home-page-content [class~="text-gray-900"],
.dark body.home-page .home-page-content [class~="text-gray-800"] {
    color: #f0f6ff;
}

.dark body.home-page .home-page-content [class~="text-gray-700"],
.dark body.home-page .home-page-content [class~="text-gray-600"],
.dark body.home-page .home-page-content [class~="text-gray-500"] {
    color: #a6bddb;
}

.dark body.home-page .home-page-content .book-card .book-cover {
    background-color: #0d2039;
}

.dark body.home-page .home-page-content .price-discounted {
    color: #93c5fd;
}

.dark body.home-page .home-page-content .featured-book-carousel {
    border-color: #234365;
    background: #0b1b33;
    box-shadow: 0 24px 60px rgba(2, 8, 23, 0.4);
}

.dark body.home-page .home-page-content .featured-book-media {
    background:
        radial-gradient(ellipse at 50% 40%, rgba(37, 99, 235, 0.3), transparent 58%),
        linear-gradient(145deg, #173454, #0b1b33 72%);
}

.dark body.home-page .home-page-content .featured-book-details {
    background:
        radial-gradient(ellipse at 100% 0%, rgba(37, 99, 235, 0.2), transparent 45%),
        linear-gradient(145deg, #0d2039, #071426);
}

.dark body.home-page .home-banner-slider {
    background: #0d2039;
}

.dark body.home-page .home-page-content .featured-book-add-button,
.dark body.home-page .home-page-content .featured-book-buy-button {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    box-shadow: 0 0.5rem 1.25rem rgba(37, 99, 235, 0.24);
}

.dark body.home-page .home-page-content .featured-book-add-button:hover,
.dark body.home-page .home-page-content .featured-book-buy-button:hover {
    background: #1d4ed8;
}

.dark body.home-page .home-page-content .featured-book-details-button:hover {
    border-color: rgba(96, 165, 250, 0.6);
}

.dark body.home-page .home-page-content [class~="text-book-red"] {
    color: #8dbbff;
}

.dark body.home-page .home-page-content [class~="border-book-red"] {
    border-color: #3b82f6;
}

.dark body.home-page .home-page-content [class~="bg-book-red"] {
    background-color: #2563eb;
}

.dark body.home-page .home-page-content [class~="hover:bg-red-700"]:hover {
    background-color: #1d4ed8;
}

.dark body.home-page .home-page-content [class~="hover:text-red-900"]:hover {
    color: #bfdbfe;
}

.dark body.home-page .featured-book-category {
    border-color: rgba(96, 165, 250, 0.3);
    background: rgba(37, 99, 235, 0.2);
    color: #bfdbfe;
}

.book-card .book-card-actions-below,
.book-card:hover .book-card-actions-below,
.book-card:focus-within .book-card-actions-below {
    position: static;
    inset: auto;
    z-index: auto;
    display: flex;
    gap: 0.5rem;
    margin-top: 0.65rem;
    padding: 0;
    opacity: 1;
    transform: none;
}

.book-card-home {
    height: auto;
    align-self: start;
    border-radius: 1.25rem;
}

.book-card-home > .relative.w-full {
    border-radius: 1.25rem;
}

.book-card-home .book-cover-image {
    border-radius: inherit;
}

.book-card-actions-below > a,
.book-card-actions-below > button,
.book-card-actions-below > div {
    min-width: 0;
}

.book-card-actions-below > .book-card-action-details {
    flex: 0 0 28%;
    padding-inline: 0.3rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

.book-card-actions-below > .book-card-action-cart,
.book-card-actions-below > div {
    flex: 1 1 0%;
}

@media (max-width: 767px) {
    .book-card-actions-below {
        gap: 0.35rem;
    }

    .book-card-actions-below > .book-card-action-details {
        padding-inline: 0.15rem;
        font-size: 0.6rem;
    }

    .book-card-actions-below > div {
        display: flex;
    }
}

/* --- Discount Badge --- */
.discount-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    padding: 6px 9px;
    border-radius: 9999px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* --- Price Display --- */
.price-original {
    text-decoration: line-through;
    color: #9ca3af;
    font-size: 0.85em;
}

.price-discounted {
    color: #dc2626;
    font-weight: 700;
}

/* --- Section Headings --- */
.section-heading {
    position: relative;
    display: inline-block;
    padding-bottom: 8px;
}

.section-heading::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 48px;
    height: 3px;
    background: linear-gradient(90deg, #4f46e5, #818cf8);
    border-radius: 2px;
}

/* --- Horizontal Book Scroll Container --- */
.book-scroll {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c7d2fe transparent;
    padding-bottom: 8px;
}

.book-scroll::-webkit-scrollbar {
    height: 6px;
}

.book-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.book-scroll::-webkit-scrollbar-thumb {
    background: #c7d2fe;
    border-radius: 3px;
}

.book-scroll > * {
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* --- Skeleton Loading Placeholder --- */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

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

/* --- Toast Notification --- */
.toast-enter {
    animation: toastIn 0.35s ease-out forwards;
}

.toast-leave {
    animation: toastOut 0.25s ease-in forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-12px) scale(0.96);
    }
}

/* --- Footer Link Hover --- */
.footer-link {
    position: relative;
    transition: color 0.2s ease;
}

.footer-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: currentColor;
    transition: width 0.25s ease;
}

.footer-link:hover::after {
    width: 100%;
}

/* --- AOS Overrides — prevent horizontal overflow --- */
[data-aos] {
    overflow-anchor: none;
}

body {
    overflow-x: hidden;
}

@media (max-width: 639px) {
    main .home-page-content {
        padding-top: 1rem;
    }

    .home-banner-slider {
        aspect-ratio: 16 / 5.5;
        margin-bottom: 1.5rem;
        border-radius: 0.875rem;
        background: #f3f4f6;
    }

    .dark .home-banner-slider {
        background: #111827;
    }

    .home-banner-slider > .relative {
        height: 100%;
    }

    .home-banner-slide {
        height: 100%;
    }

    .home-banner-slider .home-banner-image {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .home-banner-slider .home-banner-dots {
        bottom: 0.5rem;
    }

    .home-banner-dots button {
        width: 0.5rem;
        height: 0.5rem;
    }
}

/* --- Active Nav Indicator --- */
.nav-link-active {
    position: relative;
}

.nav-link-active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
}

/* --- Language Toggle --- */
.lang-toggle {
    transition: all 0.2s ease;
}

.lang-toggle:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

/* --- Responsive Image Container --- */
.img-cover {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* --- Custom Focus Ring --- */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
}

/* --- Header Search --- */
.search-form {
    position: relative;
    width: 100%;
}

.search-bar {
    position: relative;
    z-index: 30;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.search-control-row {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    min-height: 3.25rem;
    padding: 0.25rem;
    overflow: hidden;
    border: 1px solid #d1d5db;
    border-radius: 0.875rem;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.search-control-row:focus-within {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

.search-input {
    display: block;
    flex: 1 1 auto;
    width: 0;
    min-width: 0;
    height: 2.625rem;
    padding: 0.625rem 0.5rem 0.625rem 2.5rem;
    border: 0;
    outline: 0;
    background: transparent;
    color: #111827;
    font: inherit;
    font-size: 0.9375rem;
}

.search-input:focus {
    outline: none;
    box-shadow: none;
}

.search-input::placeholder {
    color: #9ca3af;
}

.search-control-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.375rem;
    margin-left: 0.25rem;
}

.search-close-button,
.search-submit-button {
    display: inline-flex;
    width: 2.5rem;
    height: 2.5rem;
    align-items: center;
    justify-content: center;
    flex: none;
    border: 0;
    border-radius: 9999px;
    cursor: pointer;
    transition: color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.search-close-button {
    background: transparent;
    color: #6b7280;
}

.search-close-button:hover {
    background: #f3f4f6;
    color: #111827;
}

.search-submit-button {
    background: #b91c1c;
    color: #fff;
}

.search-submit-button:hover {
    transform: scale(1.04);
    background: #991b1b;
}

.search-close-button:focus-visible,
.search-submit-button:focus-visible {
    outline: 2px solid #ef4444;
    outline-offset: 2px;
}

.dark .search-control-row {
    border-color: #374151;
    background: #1f2937;
}

.dark .search-control-row:focus-within {
    border-color: #f87171;
}

.dark .search-input {
    color: #f9fafb;
}

.dark .search-input::placeholder {
    color: #9ca3af;
}

.dark .search-close-button {
    color: #9ca3af;
}

.dark .search-close-button:hover {
    background: #374151;
    color: #fff;
}

/* --- Checkout Form Contrast --- */
.checkout-field {
    color: #111827;
    background-color: #fff;
}

.checkout-field::placeholder {
    color: #6b7280;
    opacity: 1;
}

.checkout-field option {
    color: #111827;
    background-color: #fff;
}

.dark .checkout-field {
    color: #f9fafb;
    background-color: #1f2937;
}

.dark .checkout-field::placeholder {
    color: #9ca3af;
}

.dark .checkout-field option {
    color: #f9fafb;
    background-color: #1f2937;
}

.checkout-field:-webkit-autofill,
.checkout-field:-webkit-autofill:hover,
.checkout-field:-webkit-autofill:focus {
    -webkit-text-fill-color: #111827;
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    caret-color: #111827;
}

.dark .checkout-field:-webkit-autofill,
.dark .checkout-field:-webkit-autofill:hover,
.dark .checkout-field:-webkit-autofill:focus {
    -webkit-text-fill-color: #f9fafb;
    -webkit-box-shadow: 0 0 0 1000px #1f2937 inset;
    caret-color: #f9fafb;
}

@media (max-width: 380px) {
    .search-control-actions {
        gap: 0.125rem;
    }

    .search-close-button,
    .search-submit-button {
        width: 2.25rem;
        height: 2.25rem;
    }

    .search-input {
        padding-left: 2.25rem;
        font-size: 0.875rem;
    }
}

#search-suggestions[hidden] {
    display: none !important;
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    left: 0;
    z-index: 40;
    margin-top: 0;
}

.search-suggestions:not([hidden]) {
    animation: searchSuggestionsIn 0.18s ease-out both;
}

.search-suggestion-heading {
    padding: 0.65rem 0.9rem 0.35rem;
    color: #6b7280;
    font-size: 0.75rem;
    font-weight: 700;
}

.search-author-heading {
    display: block;
    border-top: 1px solid #e5e7eb;
    color: #b91c1c;
}

.search-author-heading:hover,
.search-author-heading:focus-visible {
    outline: none;
    color: #991b1b;
}

.search-suggestion-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.9rem;
    color: #1f2937;
    font-size: 0.875rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.search-suggestion-row:hover,
.search-suggestion-row:focus-visible {
    outline: none;
    background: #fef2f2;
    color: #991b1b;
}

.search-suggestion-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-suggestion-author {
    flex: none;
    max-width: 45%;
    overflow: hidden;
    color: #6b7280;
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-suggestion-message {
    padding: 0.8rem 0.9rem;
    color: #6b7280;
    font-size: 0.875rem;
}

@keyframes searchSuggestionsIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dark .search-suggestion-heading {
    color: #9ca3af;
}

.dark .search-author-heading {
    border-color: #374151;
    color: #fca5a5;
}

.dark .search-suggestion-row {
    color: #e5e7eb;
}

.dark .search-suggestion-row:hover,
.dark .search-suggestion-row:focus-visible {
    background: #374151;
    color: #fca5a5;
}

.dark .search-suggestion-author,
.dark .search-suggestion-message {
    color: #9ca3af;
}

/* --- Fade-in Utility --- */
.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Hide number input spinners */
.hide-number-spinners::-webkit-outer-spin-button,
.hide-number-spinners::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.hide-number-spinners {
    -moz-appearance: textfield;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Keep utility-based public pages readable when dark mode is enabled. */
.dark main {
    color: #dceaff;
}

.dark main [class~="bg-white"],
.dark main [class~="bg-white/95"],
.dark main [class~="bg-white/90"] {
    background-color: #0d2039;
}

.dark main [class~="bg-gray-50"],
.dark main [class~="bg-gray-50/50"],
.dark main [class~="bg-gray-100"] {
    background-color: #102846;
}

.dark main [class~="border-gray-100"],
.dark main [class~="border-gray-200"],
.dark main [class~="border-gray-300"] {
    border-color: #234365;
}

.dark main [class~="text-gray-900"],
.dark main [class~="text-gray-800"] {
    color: #f0f6ff;
}

.dark main [class~="text-gray-700"],
.dark main [class~="text-gray-600"],
.dark main [class~="text-gray-500"] {
    color: #a6bddb;
}

.dark main [class~="text-gray-400"] {
    color: #86a1c2;
}

.dark main [class~="hover:bg-gray-50"]:hover,
.dark main [class~="hover:bg-gray-100"]:hover {
    background-color: #173454;
}

.dark main [class~="text-book-red"] {
    color: #8dbbff;
}

.dark main [class~="bg-book-red"] {
    background-color: #2563eb;
}

.dark main [class~="border-book-red"] {
    border-color: #3b82f6;
}

@media (max-width: 639px) {
    main {
        min-width: 0;
    }

    main h1 {
        overflow-wrap: anywhere;
    }
}
