/* Premium Bookstore - Custom Styles */

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 99px;
}
.dark ::-webkit-scrollbar-thumb {
    background: #374151;
}

/* Line clamp utility */
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Animations */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeRight {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeLeft {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

[data-animate] {
    opacity: 0;
}

[data-animate].animated {
    animation-duration: 0.8s;
    animation-fill-mode: forwards;
    animation-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

[data-animate="fade-up"].animated { animation-name: fadeUp; }
[data-animate="fade-right"].animated { animation-name: fadeRight; }
[data-animate="fade-left"].animated { animation-name: fadeLeft; }

/* Nav link hover effect */
.nav-link {
    position: relative;
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    border-radius: 99px;
    transition: width 0.3s ease;
}
.nav-link:hover::after {
    width: 100%;
}

/* Glassmorphism utility */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.dark .glass {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Toast notification */
.toast-enter {
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Prose styling for descriptions */
.prose p { margin-bottom: 1em; }
.prose p:last-child { margin-bottom: 0; }

/* Selection styling */
::selection {
    background-color: #D4A574;
    color: white;
}

/* Focus ring styling */
*:focus-visible {
    outline: 2px solid #D4A574;
    outline-offset: 2px;
    border-radius: 8px;
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

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

/* Cart badge bounce animation */
@keyframes cartBounce {
    0% { transform: scale(1); }
    25% { transform: scale(1.5); }
    50% { transform: scale(0.9); }
    75% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.animate-cart-bounce {
    animation: cartBounce 0.6s ease;
}

/* Button add-to-cart transition */
button[onclick*="addToCart"] {
    transition: all 0.2s ease;
}

/* Image lazy load transition */
img[loading="lazy"] {
    transition: opacity 0.3s ease;
}

/* About page motion */
.about-line {
    width: 0;
    height: 3px;
    border-radius: 99px;
    background: #D4A574;
    animation: aboutLine 0.8s ease 0.25s forwards;
}
@keyframes aboutLine { to { width: 5rem; } }

.about-orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(8px);
    pointer-events: none;
    animation: aboutFloat 7s ease-in-out infinite;
}
.about-orb-a {
    width: 180px; height: 180px;
    background: rgba(212, 165, 116, 0.28);
    top: 12%; left: 8%;
}
.about-orb-b {
    width: 240px; height: 240px;
    background: rgba(255, 255, 255, 0.08);
    bottom: 8%; right: 6%;
    animation-delay: -2.5s;
}
@keyframes aboutFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-16px); }
}

.about-float { animation: aboutFloat 6s ease-in-out infinite; }

.about-story-art {
    background: linear-gradient(145deg, #e7f2eb 0%, #f8efe2 55%, #f3e4cf 100%);
}
.dark .about-story-art {
    background: linear-gradient(145deg, #163528 0%, #1d3b2e 50%, #3a2a1c 100%);
}
.about-book {
    position: absolute;
    width: 72px;
    height: 100px;
    border-radius: 6px 12px 12px 6px;
    box-shadow: 8px 12px 24px rgba(20, 40, 31, 0.12);
    animation: aboutFloat 5.5s ease-in-out infinite;
}
.about-book-1 { background: #1B3A2D; left: 32%; transform: rotate(-12deg); }
.about-book-2 { background: #D4A574; left: 44%; height: 112px; animation-delay: -1s; }
.about-book-3 { background: #3d7a5c; left: 56%; transform: rotate(10deg); animation-delay: -2s; }

.about-stat, .about-card {
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.about-card {
    background: linear-gradient(160deg, #f3f8f5, #e7f0ea);
    border: 1px solid rgba(27, 58, 45, 0.08);
}
.dark .about-card {
    background: linear-gradient(160deg, rgba(27,58,45,.45), rgba(15,31,24,.65));
    border-color: rgba(255,255,255,.06);
}
.about-card-warm {
    background: linear-gradient(160deg, #fbf6ee, #f3e6d4);
}
.dark .about-card-warm {
    background: linear-gradient(160deg, rgba(90,62,32,.35), rgba(27,58,45,.4));
}
.about-stat:hover, .about-card:hover, .about-note:hover {
    transform: translateY(-6px);
}
.about-icon { animation: aboutFloat 4.5s ease-in-out infinite; }

.about-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,.18);
    font-size: 0.82rem;
    backdrop-filter: blur(8px);
}
.about-frame {
    position: relative;
    border-radius: 2rem;
    overflow: hidden;
    min-height: 420px;
    box-shadow: 0 30px 60px rgba(15, 31, 24, 0.16);
}
.about-frame img { width: 100%; height: 100%; object-fit: cover; min-height: 420px; }
.about-frame-caption {
    position: absolute;
    left: 1.1rem;
    bottom: 1.1rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(255,255,255,.9);
    color: #1B3A2D;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
}
.about-quote {
    margin: 0;
    padding: 1.1rem 1.25rem 1.1rem 1.15rem;
    border-left: 3px solid #D4A574;
    background: linear-gradient(90deg, rgba(212,165,116,.16), transparent);
    border-radius: 0 1.2rem 1.2rem 0;
    color: #1B3A2D;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.2rem;
    line-height: 1.45;
}
.dark .about-quote { color: #f6ead8; }
.about-note {
    padding: 1.4rem 1.35rem 1.5rem;
    border-radius: 1.6rem;
    background: #fff;
    border: 1px solid #efe8dc;
    box-shadow: 0 10px 30px rgba(15,31,24,.04);
    transition: transform .35s ease, box-shadow .35s ease;
}
.dark .about-note { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.08); }
.about-note-mark {
    display: block;
    margin-bottom: 0.7rem;
    color: #D4A574;
    font-weight: 700;
    letter-spacing: 0.14em;
    font-size: 0.78rem;
}
.about-note h3 {
    margin: 0 0 0.45rem;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.35rem;
    color: #14281f;
}
.dark .about-note h3 { color: #fff; }
.about-note p { margin: 0; color: #5a6a62; line-height: 1.55; font-size: 0.95rem; }
.dark .about-note p { color: #c9d5ce; }
.about-stats-band {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    overflow: hidden;
    border-radius: 2rem;
    background: rgba(255,255,255,.08);
    background-image: linear-gradient(135deg, #163528, #1B3A2D 45%, #2a4a38);
    color: #fff;
}
@media (min-width: 1024px) {
    .about-stats-band { grid-template-columns: repeat(4, 1fr); }
}
.about-stats-band .about-stat {
    padding: 1.6rem 1rem;
    text-align: center;
}
.about-stats-band .about-stat p {
    margin: 0.4rem 0 0;
    color: rgba(255,255,255,.72);
    font-size: 0.9rem;
}
.about-invite {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 2rem 1.4rem;
    border-radius: 2rem;
    background:
        radial-gradient(500px 180px at 100% 0%, rgba(212,165,116,.35), transparent 60%),
        linear-gradient(135deg, #10261c, #1B3A2D);
}
@media (min-width: 768px) {
    .about-invite {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 2.4rem 2.6rem;
    }
}
.about-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0.75rem 1.3rem;
    border-radius: 999px;
    font-weight: 700;
    text-decoration: none;
}
.about-btn-gold { background: #D4A574; color: #1a140c; }
.about-btn-ghost { color: #fff; border: 1px solid rgba(255,255,255,.35); }

/* Homepage hero motion */
.home-rise {
    opacity: 0;
    animation: homeRise 0.9s cubic-bezier(0.22, 0.7, 0.3, 1) forwards;
}
@keyframes homeRise {
    from { opacity: 0; transform: translateY(22px); }
    to { opacity: 1; transform: none; }
}
.home-hero-drift {
    animation: homeDrift 18s ease-in-out infinite alternate;
    transform-origin: 68% 55%;
}
@keyframes homeDrift {
    from { transform: scale(1); }
    to { transform: scale(1.08); }
}
.home-float { animation: aboutFloat 4.8s ease-in-out infinite; }
.home-line {
    transform-origin: center;
    animation: homeLine 0.85s ease 0.55s both;
}
@keyframes homeLine {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}
.home-hero-glow {
    width: 220px;
    height: 220px;
    background: rgba(212, 165, 116, 0.32);
    top: 18%;
    left: 6%;
}
.shelf-mark {
    display: none;
    position: absolute;
    z-index: 0;
    pointer-events: none;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.38;
}
@media (min-width: 1024px) {
    .shelf-mark { display: block; }
}
.shelf-book {
    width: 46px;
    height: 36px;
    top: 46%;
    left: 9%;
    background-image: url("../images/mark-book.svg");
}
.shelf-journal {
    width: 34px;
    height: 46px;
    top: 38%;
    right: 10%;
    background-image: url("../images/mark-journal.svg");
}
.shelf-pen {
    width: 22px;
    height: 52px;
    top: 42%;
    right: 11%;
    background-image: url("../images/mark-pen.svg");
}
.dark .shelf-mark {
    opacity: 0.3;
    filter: brightness(1.7);
}
.page-panel {
    background: #fffaf3;
    border: 1px solid #eadcc6;
    box-shadow: 0 12px 32px rgba(27, 58, 45, 0.06);
}
.dark .page-panel {
    background: rgba(18, 38, 28, 0.55);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}
.nav-search-wrap {
    flex: 1 1 auto;
    max-width: 36rem;
    margin: 0 1.5rem;
}
.nav-search {
    width: 100%;
    height: 2.75rem;
    border-radius: 999px;
    border: 1px solid #eadcc6;
    background: #f7f3ea;
    color: #1B3A2D;
    padding: 0 2.8rem 0 1.15rem;
    font-size: 0.95rem;
}
.nav-search::placeholder { color: #8a8174; }
.nav-search:focus {
    outline: none;
    background: #fff;
    border-color: #1B3A2D;
    box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.35);
}
.dark .nav-search {
    background: #1a2e26;
    border-color: #374151;
    color: #f4efe4;
}
.nav-search-btn {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2.1rem;
    height: 2.1rem;
    border: 0;
    border-radius: 999px;
    background: #1B3A2D;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.nav-search-btn:hover { background: #24523f; }
.catalog-bar {
    background: #f7f3ea;
    border-top: 1px solid #eadcc6;
}
.dark .catalog-bar {
    background: #12261c;
    border-top-color: rgba(255,255,255,.08);
}
.catalog-row { justify-content: space-evenly; }
.catalog-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    height: 3.15rem;
    padding: 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: #1f2937;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
}
.catalog-link::after {
    content: "";
    position: absolute;
    left: 0.2rem;
    right: 0.2rem;
    bottom: 0.55rem;
    height: 1px;
    background: #D4A574;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform .2s ease;
}
.catalog-item:hover > .catalog-link::after,
.catalog-link:hover::after { transform: scaleX(1); }
.dark .catalog-link { color: #e5e7eb; }
.catalog-item:hover > .catalog-link,
.catalog-link:hover { color: #1B3A2D; }
.dark .catalog-item:hover > .catalog-link,
.dark .catalog-link:hover { color: #D4A574; }
.catalog-caret { font-size: 1rem; line-height: 1; }
.catalog-panel {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 40;
    background: #fffaf3;
    border-top: 1px solid #eadcc6;
    box-shadow: 0 18px 40px rgba(27, 58, 45, 0.08);
    padding: 0;
}
.dark .catalog-panel {
    background: #12261c;
    border-top-color: rgba(255,255,255,.08);
}
.catalog-item:hover .catalog-panel,
.catalog-item:focus-within .catalog-panel { display: block; }
.catalog-mega {
    position: relative;
    max-width: 80rem;
    margin: 0 auto;
    min-height: 22rem;
}
.catalog-side {
    width: 16.5rem;
    padding: 0.45rem 0;
    border-right: 1px solid #eadcc6;
}
.dark .catalog-side { border-right-color: rgba(255,255,255,.08); }
.catalog-side-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 1.15rem;
    color: #1f2937;
    text-decoration: none;
}
.catalog-side-item:hover > .catalog-side-link,
.catalog-side-item:focus-within > .catalog-side-link {
    color: #1B3A2D;
    background: rgba(27, 58, 45, 0.06);
}
.dark .catalog-side-link { color: #e5e7eb; }
.dark .catalog-side-item:hover > .catalog-side-link,
.dark .catalog-side-item:focus-within > .catalog-side-link {
    color: #D4A574;
    background: rgba(255,255,255,.04);
}
.catalog-fly {
    display: none;
    position: absolute;
    left: 16.5rem;
    top: 0;
    right: 0;
    bottom: 0;
    padding: 1.15rem 1.6rem 1.4rem;
    overflow: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.15rem 1.5rem;
    align-content: start;
}
.catalog-side-item:first-child .catalog-fly { display: grid; }
.catalog-mega:hover .catalog-side-item:first-child:not(:hover):not(:focus-within) .catalog-fly { display: none; }
.catalog-side-item:hover .catalog-fly,
.catalog-side-item:focus-within .catalog-fly { display: grid; }
.catalog-fly a {
    display: block;
    padding: 0.38rem 0;
    color: #374151;
    text-decoration: none;
}
.catalog-fly a:hover { color: #1B3A2D; }
.dark .catalog-fly a { color: #e5e7eb; }
.dark .catalog-fly a:hover { color: #D4A574; }
.catalog-fly-main { display: contents; }
.catalog-fly-grades { display: none; }
.catalog-fly:has(.catalog-grade) {
    grid-template-columns: 15.5rem minmax(0, 1fr);
}
.catalog-fly:has(.catalog-grade) .catalog-fly-main {
    display: flex;
    flex-direction: column;
    padding-right: 1.2rem;
    border-right: 1px solid #eadcc6;
}
.dark .catalog-fly:has(.catalog-grade) .catalog-fly-main { border-right-color: #374151; }
.catalog-fly:has(.catalog-grade) .catalog-fly-grades {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.1rem 1.25rem;
    align-content: start;
    padding-left: 1.25rem;
}
.catalog-grade-link { font-weight: 600; color: #1B3A2D !important; }
.dark .catalog-grade-link { color: #D4A574 !important; }
.catalog-subjects { display: none; }
.catalog-grade:hover .catalog-subjects,
.catalog-grade:focus-within .catalog-subjects { display: block; }
.catalog-subjects a { padding: 0.16rem 0 0.16rem 0.55rem; font-size: 0.875rem; }
body.studio { padding-bottom: 3.4rem; }
body.studio [data-studio] {
    outline: 2px dashed #1B3A2D;
    outline-offset: 4px;
    cursor: pointer;
}
body.studio [data-studio]:not(.shelf-mark) { position: relative; }
body.studio [data-studio]:hover {
    outline-color: #8a5a2b;
    background-color: rgba(212, 165, 116, 0.22);
}
body.studio [data-studio]:hover::after {
    content: attr(data-studio-label);
    position: absolute;
    z-index: 90;
    left: 0;
    top: -1.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 0.4rem;
    background: #1B3A2D;
    color: #fff;
    font-size: 0.75rem;
    line-height: 1.3;
    white-space: nowrap;
    pointer-events: none;
}
body.studio .studio-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    background: #1B3A2D;
    color: #fff;
    text-align: center;
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
}
body.studio .shelf-mark {
    display: block;
    pointer-events: auto;
    opacity: 1;
    min-width: 4.5rem;
    min-height: 3rem;
    background-color: rgba(212, 165, 116, 0.45);
}
body.studio .about-hero .bg-gradient-to-t { pointer-events: none; }
@media (min-width: 1024px) {
    main.min-h-screen { padding-top: 3rem; }
}
.shelf-row {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
}
.shelf-card {
    flex: 0 0 46%;
    max-width: 180px;
    scroll-snap-align: start;
    text-decoration: none;
}
@media (min-width: 768px) {
    .shelf-card { flex-basis: 180px; }
}
.shelf-cover {
    aspect-ratio: 3 / 4;
    border-radius: 0.75rem;
    overflow: hidden;
}
.shelf-cover img { width: 100%; height: 100%; object-fit: cover; }
.home-paper {
    background:
        radial-gradient(540px 240px at 0% 0%, rgba(212, 165, 116, 0.28), transparent 68%),
        radial-gradient(420px 260px at 100% 80%, rgba(27, 58, 45, 0.09), transparent 70%),
        #f4efe4;
}
.dark .home-paper {
    background:
        radial-gradient(540px 240px at 0% 0%, rgba(212, 165, 116, 0.12), transparent 68%),
        #0e1a14;
}
.home-paper-deep {
    background:
        radial-gradient(640px 280px at 50% -10%, rgba(212, 165, 116, 0.32), transparent 62%),
        radial-gradient(380px 220px at 100% 100%, rgba(27, 58, 45, 0.1), transparent 70%),
        linear-gradient(180deg, #efe4d2 0%, #f6f0e6 100%);
}
.dark .home-paper-deep {
    background:
        radial-gradient(640px 280px at 50% -10%, rgba(212, 165, 116, 0.14), transparent 62%),
        #12261c;
}
.home-hero-glow-b {
    width: 140px;
    height: 140px;
    background: rgba(212, 165, 116, 0.18);
    bottom: 16%;
    left: 28%;
    animation-delay: -2.2s;
}

@media (prefers-reduced-motion: reduce) {
    .about-orb, .about-float, .about-book, .about-icon, .about-line,
    .home-rise, .home-hero-drift, .home-float, .home-line { animation: none; }
    .about-line { width: 5rem; }
    .home-rise, .home-line { opacity: 1; transform: none; }
}

/* Alpine cloak + mobile shell */
[x-cloak] { display: none !important; }

html, body {
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

@media (max-width: 640px) {
    .fixed.top-20.right-4 {
        left: 1rem;
        right: 1rem;
        top: 4.5rem;
    }

    .scrollbar-none::-webkit-scrollbar { display: none; }
}

/* Phone bottom dock clearance for main pages */
@media (max-width: 1023px) {
    main.min-h-screen {
        padding-bottom: calc(5rem + env(safe-area-inset-bottom));
    }
    nav.fixed.top-0 {
        padding-top: env(safe-area-inset-top);
    }
    input, select, textarea {
        font-size: 16px !important;
    }
    .about-frame,
    .about-frame img {
        min-height: 240px;
    }
    .about-hero {
        min-height: 68dvh;
    }
    .about-card,
    .page-panel {
        padding: 1.25rem;
    }
}
