/* BookHaven storefront — built on Bootstrap 5 */
:root {
    --ink: #1b2a41;
    --ink-soft: #2c3e5a;
    --cloth: #2f5d50;
    --marigold: #e0a526;
    --marigold-deep: #b9821a;
    --paper: #ffffff;
    --sage: #eef2ef;
    --line: #dfe4e1;
    --muted: #5b6472;
    --danger: #b3412f;
    --serif: "Literata", Georgia, serif;
    --sans: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
    --radius: 10px;

    --bs-body-font-family: var(--sans);
    --bs-body-color: var(--ink);
    --bs-link-color-rgb: 47, 93, 80;
    --bs-link-hover-color-rgb: 27, 42, 65;
    --bs-border-color: var(--line);
    --bs-primary-rgb: 27, 42, 65;
}

body { background: var(--paper); font-size: 1rem; line-height: 1.6; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, .serif { font-family: var(--serif); color: var(--ink); letter-spacing: -0.01em; }
h1 { font-weight: 700; }
h2, h3 { font-weight: 600; }
a { text-decoration: none; }
.text-muted { color: var(--muted) !important; }
::selection { background: var(--marigold); color: var(--ink); }
:focus-visible { outline: 3px solid var(--marigold) !important; outline-offset: 2px; }

/* Buttons */
.btn { border-radius: 8px; font-weight: 600; padding: .6rem 1.15rem; }
.btn-sm { padding: .35rem .75rem; }
.btn-ink { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
.btn-ink:hover, .btn-ink:focus { background: var(--ink-soft); color: #fff; }
.btn-marigold { background: var(--marigold); color: var(--ink); border: 1px solid var(--marigold); }
.btn-marigold:hover, .btn-marigold:focus { background: var(--marigold-deep); border-color: var(--marigold-deep); color: #fff; }
.btn-outline-ink { border: 1px solid var(--ink); color: var(--ink); background: transparent; }
.btn-outline-ink:hover { background: var(--ink); color: #fff; }
.form-control, .form-select { border-radius: 8px; padding: .6rem .85rem; border-color: #cfd6d2; }
.form-control:focus, .form-select:focus { border-color: var(--cloth); box-shadow: 0 0 0 .2rem rgba(47, 93, 80, .15); }
.form-label { font-weight: 600; font-size: .925rem; margin-bottom: .35rem; }
.form-check-input:checked { background-color: var(--cloth); border-color: var(--cloth); }

/* Top bar + header */
.announce { background: var(--cloth); color: #e8f0ec; font-size: .875rem; padding: .45rem 0; }
.announce a { color: #fff; }
.site-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1030; }
.brand { font-family: var(--serif); font-weight: 700; font-size: 1.55rem; color: var(--ink); display: flex; align-items: center; gap: .5rem; }
.brand-mark { width: 34px; height: 34px; border-radius: 6px; background: var(--ink); position: relative; flex-shrink: 0; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; bottom: 7px; width: 6px; border-radius: 1px; }
.brand-mark::before { left: 9px; height: 18px; background: var(--marigold); }
.brand-mark::after { left: 18px; height: 14px; background: #9cc5b5; transform: rotate(12deg); transform-origin: bottom left; }
.site-header .nav-link { color: var(--ink); font-weight: 500; padding: .5rem .85rem !important; }
.site-header .nav-link:hover, .site-header .nav-link.active { color: var(--cloth); }
.header-search { max-width: 440px; }
.header-search .form-control { border-radius: 8px 0 0 8px; background: var(--sage); border-color: var(--sage); }
.header-search .btn { border-radius: 0 8px 8px 0; }
.icon-btn { position: relative; color: var(--ink); font-size: 1.3rem; padding: .35rem .5rem; display: inline-flex; align-items: center; }
.icon-btn .count { position: absolute; top: -2px; right: -4px; background: var(--marigold); color: var(--ink); font-size: .7rem; font-weight: 700; border-radius: 99px; min-width: 19px; height: 19px; display: grid; place-items: center; padding: 0 5px; }
.dropdown-menu { border-color: var(--line); border-radius: var(--radius); box-shadow: 0 12px 30px rgba(27, 42, 65, .12); }

/* Hero: a shelf of real covers */
.hero { background: var(--ink); color: #e9edf3; overflow: hidden; position: relative; }
.hero h1 { color: #fff; font-size: clamp(2.2rem, 4.6vw, 3.6rem); line-height: 1.08; max-width: 14ch; }
.hero .lead { color: #c4cddb; max-width: 46ch; font-size: 1.125rem; }
.hero-search .form-control { padding: .85rem 1rem; border: 0; border-radius: 8px 0 0 8px; }
.hero-search .btn { border-radius: 0 8px 8px 0; padding: 0 1.4rem; }
.shelf { display: flex; align-items: flex-end; justify-content: center; gap: 1.6%; padding: 0 2%; position: relative; min-height: 330px; container-type: inline-size; }
.shelf::after { content: ""; position: absolute; left: -40px; right: -40px; bottom: -14px; height: 14px; background: #8a6a3d; box-shadow: 0 10px 0 #6b4f2a, 0 24px 40px rgba(0,0,0,.35); border-radius: 2px; }
.shelf a { flex: 0 0 auto; width: 19%; font-size: 1.85cqw; transition: transform .25s ease; transform-origin: bottom center; }
.shelf a:nth-child(1) { width: 20%; }
.shelf a:nth-child(2) { width: 17.5%; font-size: 1.7cqw; }
.shelf a:nth-child(3) { width: 21.5%; font-size: 2cqw; }
.shelf a:nth-child(4) { width: 18.5%; }
.shelf a:nth-child(5) { width: 16.5%; font-size: 1.6cqw; }
.shelf a:hover, .shelf a:focus-visible { transform: translateY(-14px); }
.shelf a:nth-child(2) { transform: rotate(-3deg); }
.shelf a:nth-child(2):hover { transform: rotate(-3deg) translateY(-14px); }
.shelf a:nth-child(4) { transform: rotate(4deg); margin-left: 6px; }
.shelf a:nth-child(4):hover { transform: rotate(4deg) translateY(-14px); }
.hero-facts { color: #c4cddb; font-size: .95rem; }
.hero-facts strong { color: var(--marigold); font-family: var(--serif); font-size: 1.3rem; display: block; }

/* Generated book cover */
.cover { position: relative; aspect-ratio: 2 / 3; border-radius: 3px 8px 8px 3px; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 12% 10% 10% 16%; box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 10px 22px rgba(27, 42, 65, .18); }
.cover::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 9%; background: linear-gradient(90deg, rgba(0,0,0,.28), rgba(255,255,255,.12) 70%, rgba(0,0,0,.08)); }
.cover::after { content: ""; position: absolute; left: 16%; right: 10%; top: 50%; height: 2px; background: currentColor; opacity: .55; }
.cover-title { font-family: var(--serif); font-weight: 700; line-height: 1.12; font-size: 1.05em; position: relative; z-index: 1; overflow-wrap: break-word; }
.cover-author { font-size: .62em; font-weight: 600; opacity: .85; position: relative; z-index: 1; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover.has-img { padding: 0; }
.cover.has-img::after { display: none; }

/* Book cards */
.book-card { position: relative; display: flex; flex-direction: column; height: 100%; }
.book-card .cover-wrap { display: block; font-size: clamp(14px, 1.6vw, 19px); margin-bottom: .85rem; transition: transform .2s ease; }
.book-card:hover .cover-wrap { transform: translateY(-4px); }
.book-card .title { font-family: var(--serif); font-weight: 600; font-size: 1.02rem; line-height: 1.3; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-card .title:hover { color: var(--cloth); }
.book-card .author { color: var(--muted); font-size: .875rem; }
.price { font-weight: 700; color: var(--ink); }
.price del { color: var(--muted); font-weight: 400; font-size: .85em; margin-left: .35rem; }
.badge-sale { position: absolute; top: 8px; right: 8px; z-index: 2; background: var(--marigold); color: var(--ink); font-weight: 700; font-size: .75rem; border-radius: 6px; padding: .2rem .45rem; }
.badge-out { position: absolute; top: 8px; right: 8px; z-index: 2; background: #fff; color: var(--danger); font-weight: 700; font-size: .75rem; border-radius: 6px; padding: .2rem .45rem; }
.stars { color: var(--marigold); font-size: .85rem; letter-spacing: 1px; }
.stars .bi-star { color: #c8cfcb; }
.book-card .actions { margin-top: auto; padding-top: .6rem; display: flex; gap: .4rem; }
.book-card .actions .btn { flex: 1; font-size: .875rem; padding: .45rem .6rem; }

/* Sections */
.section { padding: 4.5rem 0; }
.section-tint { background: var(--sage); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); margin: 0; }
.section-head p { margin: .3rem 0 0; color: var(--muted); }
.link-more { font-weight: 600; color: var(--cloth); white-space: nowrap; }
.link-more:hover { text-decoration: underline; }

.cat-tile { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); color: var(--ink); height: 100%; transition: border-color .2s, background .2s; }
.cat-tile:hover { border-color: var(--cloth); background: #f9fbfa; }
.cat-tile i { font-size: 1.5rem; color: var(--cloth); width: 46px; height: 46px; display: grid; place-items: center; background: var(--sage); border-radius: 8px; flex-shrink: 0; }
.cat-tile strong { display: block; font-weight: 600; }
.cat-tile small { color: var(--muted); }

.author-chip { text-align: center; color: var(--ink); display: block; }
.author-chip .avatar { width: 112px; height: 112px; margin: 0 auto .8rem; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-size: 2rem; font-weight: 700; color: #fff; background: var(--cloth); overflow: hidden; border: 4px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.author-chip .avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-chip:hover strong { color: var(--cloth); }

.deal-band { background: var(--marigold); color: var(--ink); border-radius: 14px; padding: 2.5rem; }
.deal-band h2 { color: var(--ink); }
.promise { display: flex; gap: .85rem; align-items: flex-start; }
.promise i { font-size: 1.6rem; color: var(--cloth); }
.promise strong { display: block; }
.promise span { color: var(--muted); font-size: .925rem; }

.quote-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; height: 100%; }
.quote-card blockquote { font-family: var(--serif); font-size: 1.08rem; line-height: 1.55; margin: .6rem 0 1rem; }

/* Listing */
.page-banner { background: var(--sage); padding: 2.5rem 0; border-bottom: 1px solid var(--line); }
.page-banner h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); margin: 0; }
.breadcrumb { font-size: .875rem; margin-bottom: .5rem; }
.breadcrumb a { color: var(--cloth); }
.filter-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; background: #fff; }
.filter-box h6 { font-weight: 700; font-size: .95rem; margin: 1.2rem 0 .6rem; }
.filter-box h6:first-child { margin-top: 0; }
.filter-list { max-height: 220px; overflow: auto; }
.pagination { --bs-pagination-color: var(--ink); --bs-pagination-active-bg: var(--ink); --bs-pagination-active-border-color: var(--ink); --bs-pagination-border-radius: 8px; }

/* Book detail */
.detail-cover { font-size: clamp(20px, 2.6vw, 30px); max-width: 360px; }
.detail-meta dt { font-weight: 500; color: var(--muted); }
.detail-meta dd { font-weight: 600; }
.qty { width: 136px; flex-wrap: nowrap; }
.qty .btn { padding: .45rem .7rem; }
.qty .form-control { text-align: center; }
.rating-bar { height: 8px; border-radius: 99px; background: var(--sage); overflow: hidden; }
.rating-bar span { display: block; height: 100%; background: var(--marigold); }
.prose { max-width: 70ch; }
.prose p { margin-bottom: 1rem; }
.prose h4 { font-size: 1.2rem; margin-top: 1.8rem; }
.star-input { display: inline-flex; flex-direction: row-reverse; gap: .2rem; }
.star-input input { display: none; }
.star-input label { font-size: 1.6rem; color: #c8cfcb; cursor: pointer; }
.star-input input:checked ~ label, .star-input label:hover, .star-input label:hover ~ label { color: var(--marigold); }

/* Cart + checkout */
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 1.5rem; }
.summary { position: sticky; top: 96px; }
.summary .row-line { display: flex; justify-content: space-between; padding: .4rem 0; }
.summary .total { border-top: 1px solid var(--line); margin-top: .5rem; padding-top: .8rem; font-weight: 700; font-size: 1.15rem; }
.cart-thumb { width: 64px; font-size: 9px; flex-shrink: 0; }
.pay-option { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; display: flex; gap: .8rem; align-items: center; cursor: pointer; }
.pay-option:has(input:checked) { border-color: var(--cloth); background: #f6faf8; }
.steps { display: flex; gap: 1.5rem; font-size: .925rem; color: var(--muted); flex-wrap: wrap; }
.steps .on { color: var(--ink); font-weight: 700; }

/* Account */
.account-nav .list-group-item { border: 0; border-radius: 8px !important; padding: .65rem .9rem; color: var(--ink); font-weight: 500; }
.account-nav .list-group-item i { width: 1.4rem; display: inline-block; color: var(--cloth); }
.account-nav .list-group-item.active { background: var(--sage); color: var(--ink); font-weight: 700; }
.stat-tile { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.stat-tile strong { font-family: var(--serif); font-size: 1.6rem; display: block; }
.stat-tile span { color: var(--muted); font-size: .9rem; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 1.1rem 1.6rem; border-left: 2px solid var(--line); margin-left: .4rem; }
.timeline li:last-child { border-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--cloth); }
.msg { max-width: 82%; border-radius: 12px; padding: .9rem 1.1rem; margin-bottom: 1rem; }
.msg.me { background: var(--sage); margin-left: auto; }
.msg.staff { background: #fff; border: 1px solid var(--line); }
.msg .meta { font-size: .8rem; color: var(--muted); margin-bottom: .3rem; }
.table > :not(caption) > * > * { padding: .8rem .75rem; }
.table thead th { font-size: .85rem; color: var(--muted); font-weight: 600; background: #fafbfa; }

/* Auth */
.auth-wrap { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 3rem 0; background: var(--sage); }
.auth-card { width: 100%; max-width: 440px; background: #fff; border-radius: 14px; padding: 2.25rem; border: 1px solid var(--line); }

/* Footer */
.site-footer { background: var(--ink); color: #b9c3d2; padding: 4rem 0 1.5rem; font-size: .95rem; }
.site-footer h5 { color: #fff; font-family: var(--sans); font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.site-footer a { color: #b9c3d2; }
.site-footer a:hover { color: var(--marigold); }
.site-footer .brand { color: #fff; }
.site-footer .brand-mark { background: #fff; }
.site-footer ul { list-style: none; padding: 0; }
.site-footer li { margin-bottom: .45rem; }
.site-footer .bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 2.5rem; padding-top: 1.25rem; font-size: .875rem; }
.social a { width: 38px; height: 38px; border-radius: 8px; display: inline-grid; place-items: center; background: rgba(255,255,255,.08); margin-right: .35rem; }

.toast-container { z-index: 2000; }
.empty { text-align: center; padding: 3.5rem 1rem; }
.empty i { font-size: 3rem; color: var(--cloth); }

@media (max-width: 991.98px) {
    .shelf { min-height: 0; margin-top: 1.5rem; }
    .summary { position: static; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
    .site-header, .site-footer, .announce, .no-print { display: none !important; }
}
