/* ===========================================================================
   Bindery — storefront design system
   A warm, editorial, "indie bookshop" aesthetic. Cream paper, ink type, a
   single confident accent. Built to feel premium without feeling busy.
   =========================================================================== */

:root {
    --paper: #faf7f0;
    --paper-2: #f3eee3;
    --card: #ffffff;
    --ink: #211f1c;
    --ink-soft: #5d574d;
    --ink-faint: #908a7d;
    --line: #e7e0d1;
    --accent: #d2603a;
    --accent-dark: #b14e2d;
    --gold: #c79a3f;
    --success: #2f7d5b;
    --error: #c0392b;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(33,31,28,.06), 0 2px 8px rgba(33,31,28,.05);
    --shadow-md: 0 6px 24px rgba(33,31,28,.10);
    --shadow-lg: 0 24px 60px rgba(33,31,28,.18);
    --maxw: 1180px;
    --serif: "Fraunces", Georgia, "Times New Roman", serif;
    --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--sans);
    color: var(--ink);
    background: var(--paper);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.12; margin: 0 0 .4em; letter-spacing: -.01em; }
p { margin: 0 0 1em; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--ink-faint); }
.center { text-align: center; }

/* --- Buttons -------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5em;
    font-family: var(--sans); font-weight: 600; font-size: .95rem;
    padding: .8rem 1.4rem; border-radius: 999px; border: 1px solid transparent;
    cursor: pointer; transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
    white-space: nowrap; line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(210,96,58,.32); }
.btn--primary:hover { background: var(--accent-dark); box-shadow: 0 10px 24px rgba(210,96,58,.4); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--paper-2); border-color: var(--ink-faint); }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: #000; transform: translateY(-1px); }
.btn--block { width: 100%; }
.btn--lg { padding: 1rem 1.8rem; font-size: 1.05rem; }
.btn--sm { padding: .5rem .9rem; font-size: .85rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.link-button { background: none; border: 0; cursor: pointer; color: var(--ink-soft); font: inherit; padding: 0; }
.link-button:hover { color: var(--accent); }
.inline-form { display: inline; }

/* --- Header --------------------------------------------------------------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(250,247,240,.85); backdrop-filter: saturate(140%) blur(12px);
    border-bottom: 1px solid var(--line);
}
.site-header__inner { display: flex; align-items: center; gap: 28px; height: 72px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 1.4rem; font-weight: 600; }
.brand__mark { color: var(--accent); font-size: 1.5rem; line-height: 1; }
.brand__name { letter-spacing: -.02em; }
.site-nav { display: flex; align-items: center; gap: 22px; margin-left: 8px; }
.site-nav > a, .dropdown__toggle { font-size: .95rem; font-weight: 500; color: var(--ink-soft); background: none; border: 0; cursor: pointer; font-family: var(--sans); padding: 0; }
.site-nav > a:hover, .dropdown__toggle:hover { color: var(--ink); }
.dropdown { position: relative; }
.dropdown__menu {
    position: absolute; top: 140%; left: 0; min-width: 220px; background: var(--card);
    border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
    padding: 8px; opacity: 0; visibility: hidden; transform: translateY(6px); transition: .18s ease;
}
.dropdown:hover .dropdown__menu, .dropdown:focus-within .dropdown__menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown__menu a { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 8px; font-size: .92rem; color: var(--ink-soft); }
.dropdown__menu a:hover { background: var(--paper-2); color: var(--ink); }
.dropdown__menu a span { color: var(--ink-faint); font-size: .8rem; }
.site-header__actions { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.search-mini { display: flex; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 14px; }
/* High-specificity + attribute selector so this beats the generic input rule
   and the input blends into the pill (no inner box). */
.search-mini input[type="search"] {
    border: 0; background: none; outline: none; box-shadow: none;
    border-radius: 0; padding: 0; margin: 0; width: 150px;
    font: inherit; font-size: .9rem; color: var(--ink);
    -webkit-appearance: none; appearance: none;
}
.search-mini input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-mini button { border: 0; background: var(--paper-2); width: 30px; height: 30px; border-radius: 999px; cursor: pointer; font-size: 1.1rem; color: var(--ink-soft); }
.search-mini button:hover { background: var(--accent); color: #fff; }
.icon-link { font-size: .92rem; font-weight: 500; color: var(--ink-soft); }
.icon-link:hover { color: var(--ink); }
.cart-link { position: relative; font-size: 1.35rem; }
.cart-link__badge { position: absolute; top: -8px; right: -10px; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 999px; display: grid; place-items: center; padding: 0 4px; font-family: var(--sans); }

/* --- Flash --------------------------------------------------------------- */
.flash-stack { margin: 18px 0 -6px; display: grid; gap: 10px; }
.flash { padding: 12px 18px; border-radius: var(--radius-sm); font-size: .92rem; font-weight: 500; border: 1px solid; }
.flash--success { background: #eaf6ef; color: var(--success); border-color: #c6e7d4; }
.flash--error { background: #fbecea; color: var(--error); border-color: #f3cfca; }
.flash--info { background: #eef2f8; color: #3a5a8c; border-color: #d4e0f0; }

/* --- Hero ----------------------------------------------------------------- */
.hero { position: relative; overflow: hidden; padding: 84px 0 72px; }
.hero::before {
    content: ""; position: absolute; inset: 0;
    background:
        radial-gradient(900px 500px at 85% -10%, rgba(210,96,58,.14), transparent 60%),
        radial-gradient(700px 500px at 0% 110%, rgba(199,154,63,.12), transparent 55%);
    pointer-events: none;
}
.hero__inner { position: relative; display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
.hero__eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 18px; }
.hero h1 { font-size: clamp(2.6rem, 5vw, 4.1rem); line-height: 1.04; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero__lede { font-size: 1.18rem; color: var(--ink-soft); max-width: 30ch; margin: 18px 0 28px; }
.hero__cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero__stats { display: flex; gap: 32px; margin-top: 36px; }
.hero__stat strong { font-family: var(--serif); font-size: 1.7rem; display: block; }
.hero__stat span { font-size: .85rem; color: var(--ink-faint); }

/* Stacked book "fan" art in the hero */
.hero__art { position: relative; height: 420px; }
.hero__art .cover { position: absolute; width: 230px; height: 340px; box-shadow: var(--shadow-lg); border-radius: 6px 12px 12px 6px; }
.hero__art .cover:nth-child(1) { left: 50%; top: 10px; transform: translateX(-50%) rotate(-7deg); z-index: 1; }
.hero__art .cover:nth-child(2) { left: 50%; top: 30px; transform: translateX(-30%) rotate(5deg); z-index: 2; }
.hero__art .cover:nth-child(3) { left: 50%; top: 50px; transform: translateX(-58%) rotate(-1deg); z-index: 3; }

/* --- Section headers ------------------------------------------------------ */
.section { padding: 64px 0; }
.section--tint { background: var(--paper-2); }
.section__head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 32px; gap: 20px; }
.section__head h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); }
.section__head p { color: var(--ink-faint); margin: 6px 0 0; }
.section__link { font-weight: 600; color: var(--accent); white-space: nowrap; }
.section__link:hover { color: var(--accent-dark); }

/* --- Book covers (generated) ---------------------------------------------- */
.cover { position: relative; border-radius: 6px 10px 10px 6px; overflow: hidden; background: #ddd; }
.cover--image img { width: 100%; height: 100%; object-fit: cover; }
/* Generated covers scale their art to their own width (container queries),
   so they look like a proper book at any size — from the 64px cart thumb to
   the 380px product page. Older browsers fall back to the rem sizes. */
.cover--gen {
    container-type: inline-size;
    display: flex; flex-direction: column; justify-content: flex-end;
    padding: 8% 8% 9% 11%; overflow: hidden;
    background: linear-gradient(150deg, var(--c1), var(--c2));
    color: #fff;
}
.cover--gen::before { /* spine shadow */
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4.5cqw; min-width: 4px;
    background: linear-gradient(90deg, rgba(0,0,0,.28), rgba(0,0,0,0));
}
.cover--gen::after { /* subtle paper sheen */
    content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, rgba(255,255,255,.18), transparent 40%); pointer-events: none;
}
.cover__band { position: absolute; top: 0; left: 0; right: 0; height: 2.2cqw; min-height: 2px; background: rgba(255,255,255,.55); }
.cover__title {
    font-family: var(--serif); font-weight: 600; line-height: 1.12; letter-spacing: -.01em;
    text-shadow: 0 1px 8px rgba(0,0,0,.18);
    font-size: 1.1rem; font-size: 10cqw;
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.cover__author {
    opacity: .9; margin-top: 4cqw; text-transform: uppercase; letter-spacing: .06em;
    font-size: .75rem; font-size: 4.4cqw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* --- Book grid + cards ---------------------------------------------------- */
.book-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px 24px; }
.book-grid--3 { grid-template-columns: repeat(3, 1fr); }
.book-card { position: relative; transition: transform .2s ease; }
.book-card:hover { transform: translateY(-6px); }
.book-card__cover { aspect-ratio: 3/4.4; margin-bottom: 16px; box-shadow: var(--shadow-md); transition: box-shadow .25s ease; }
.book-card:hover .book-card__cover { box-shadow: var(--shadow-lg); }
.book-card__cover .cover { width: 100%; height: 100%; }
.book-card__tag { position: absolute; top: 10px; right: 10px; z-index: 5; background: var(--ink); color: #fff; font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; }
.book-card__tag--sale { background: var(--accent); }
.book-card__title { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; line-height: 1.2; }
.book-card__author { font-size: .85rem; color: var(--ink-faint); margin: 2px 0 8px; }
.book-card__rating { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: .82rem; color: var(--ink-faint); }
.book-card__rating .stars { font-size: .82rem; }
.book-card__price { display: flex; align-items: baseline; gap: 8px; }
.price { font-weight: 700; font-size: 1.02rem; }
.price--old { color: var(--ink-faint); text-decoration: line-through; font-weight: 500; font-size: .9rem; }
.price--free { color: var(--success); }

/* --- Category chips ------------------------------------------------------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: .9rem; font-weight: 500; color: var(--ink-soft); transition: .15s; }
.chip:hover { border-color: var(--ink-faint); color: var(--ink); }
.chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip span { font-size: .78rem; opacity: .65; }

/* --- Category cards (home) ------------------------------------------------ */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.cat-card { display: block; padding: 26px 22px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); transition: .2s; }
.cat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: transparent; }
.cat-card h3 { font-size: 1.25rem; margin-bottom: 4px; }
.cat-card p { font-size: .88rem; color: var(--ink-faint); margin: 0; }
.cat-card__count { display: inline-block; margin-top: 14px; font-size: .8rem; font-weight: 600; color: var(--accent); }

/* --- Feature strip -------------------------------------------------------- */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.feature { display: flex; gap: 14px; align-items: flex-start; }
.feature__icon { font-size: 1.6rem; line-height: 1; }
.feature h4 { font-family: var(--sans); font-size: 1rem; margin-bottom: 2px; }
.feature p { font-size: .9rem; color: var(--ink-faint); margin: 0; }

/* --- Product page --------------------------------------------------------- */
.product { display: grid; grid-template-columns: 380px 1fr; gap: 56px; padding: 56px 0; align-items: start; }
.product__cover { position: sticky; top: 96px; }
.product__cover .cover { aspect-ratio: 3/4.4; box-shadow: var(--shadow-lg); }
.breadcrumb { font-size: .85rem; color: var(--ink-faint); margin-bottom: 16px; }
.breadcrumb a:hover { color: var(--accent); }
.product h1 { font-size: clamp(2rem, 4vw, 3rem); }
.product__author { font-size: 1.05rem; color: var(--ink-soft); margin-bottom: 20px; }
.product__author a { color: var(--accent); }
.product__price { display: flex; align-items: baseline; gap: 12px; margin: 24px 0; }
.product__price .price { font-size: 2rem; font-family: var(--serif); }
.product__price .price--old { font-size: 1.1rem; }
.product__save { background: #fbe7df; color: var(--accent-dark); font-size: .8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.product__buy { display: flex; gap: 12px; align-items: center; margin: 22px 0 28px; }
.product__meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 22px 0; margin: 28px 0; }
.product__meta div { font-size: .9rem; }
.product__meta dt { color: var(--ink-faint); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.product__meta dd { margin: 0; font-weight: 600; }
.product__desc { font-size: 1.05rem; color: var(--ink-soft); line-height: 1.8; }
.product__desc h2 { font-size: 1.4rem; color: var(--ink); margin-top: 8px; }
.assurance { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 8px; }
.assurance span { font-size: .85rem; color: var(--ink-faint); display: inline-flex; gap: 6px; align-items: center; }
.product__formats { font-size: .92rem; color: var(--ink-soft); margin: 6px 0 18px; }
.format-addons { display: grid; gap: 10px; margin: 4px 0 22px; }
.format-addon { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); }
.format-addon > div { display: flex; align-items: center; gap: 10px; }
.format-addon__icon { font-size: 1.2rem; }
.format-addon__price { font-weight: 700; color: var(--accent); }

/* --- Stars + reviews ------------------------------------------------------ */
.stars { position: relative; display: inline-block; font-size: 1rem; line-height: 1; color: #dcd5c4; white-space: nowrap; vertical-align: middle; }
.stars::before { content: "★★★★★"; letter-spacing: 2px; }
.stars__on { position: absolute; left: 0; top: 0; overflow: hidden; color: var(--gold); }
.stars__on::before { content: "★★★★★"; letter-spacing: 2px; }
.stars--lg { font-size: 1.5rem; }
.rating-inline { display: inline-flex; align-items: center; gap: 8px; font-size: .95rem; color: var(--ink-soft); margin: 0 0 6px; }
.rating-inline strong { color: var(--ink); }
.rating-inline span { color: var(--ink-faint); }
.rating-inline:hover { text-decoration: none; }

.reviews__layout { display: grid; grid-template-columns: 260px 1fr; gap: 48px; align-items: start; }
.reviews__summary { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; text-align: center; position: sticky; top: 96px; }
.reviews__avg { font-family: var(--serif); font-size: 3.2rem; line-height: 1; font-weight: 600; }
.reviews__count { color: var(--ink-faint); font-size: .9rem; margin-top: 6px; }
.reviews__bars { margin-top: 18px; display: grid; gap: 6px; text-align: left; }
.reviews__bar { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--ink-faint); }
.reviews__bar-label { width: 24px; }
.reviews__bar-track { flex: 1; height: 7px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.reviews__bar-fill { display: block; height: 100%; background: var(--gold); }
.reviews__bar-n { width: 18px; text-align: right; }

.verified-badge { display: inline-block; font-size: .7rem; font-weight: 700; color: var(--success); background: #eaf6ef; padding: 2px 8px; border-radius: 999px; vertical-align: middle; }

.review-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 28px; }
.review-form h3 { font-size: 1.2rem; margin-bottom: 14px; display: flex; align-items: center; gap: 10px; }
.review-prompt { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 18px; margin-bottom: 28px; color: var(--ink-soft); }
.review-prompt a { color: var(--accent); font-weight: 600; }

/* interactive star input (radios, fill on hover/check, RTL trick) */
.star-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; margin-bottom: 14px; }
.star-input input { position: absolute; opacity: 0; width: 0; height: 0; }
.star-input label { font-size: 2rem; line-height: 1; color: #dcd5c4; cursor: pointer; transition: color .12s, transform .12s; }
.star-input label:hover, .star-input label:hover ~ label,
.star-input input:checked ~ label { color: var(--gold); }
.star-input label:hover { transform: scale(1.12); }

.review-list { display: grid; gap: 20px; }
.review { border-bottom: 1px solid var(--line); padding-bottom: 20px; }
.review:last-child { border-bottom: 0; }
.review__head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.review__avatar { width: 40px; height: 40px; border-radius: 999px; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-family: var(--serif); }
.review__name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.review__meta { display: flex; align-items: center; gap: 10px; font-size: .82rem; color: var(--ink-faint); margin-top: 2px; }
.review__title { font-family: var(--serif); font-size: 1.1rem; margin: 4px 0 6px; }
.review__body { color: var(--ink-soft); margin: 0; line-height: 1.7; }

@media (max-width: 760px) {
    .reviews__layout { grid-template-columns: 1fr; gap: 28px; }
    .reviews__summary { position: static; }
}

/* --- Cart ----------------------------------------------------------------- */
.cart { display: grid; grid-template-columns: 1fr 360px; gap: 40px; padding: 48px 0 72px; align-items: start; }
.cart__list { display: grid; gap: 16px; }
.cart-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 18px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.cart-row .cover { width: 64px; height: 92px; }
.cart-row__title { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; }
.cart-row__author { font-size: .85rem; color: var(--ink-faint); }
.cart-row__price { font-weight: 700; }
.cart-summary { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; position: sticky; top: 96px; box-shadow: var(--shadow-sm); }
.cart-summary h3 { font-size: 1.3rem; }
.summary-line { display: flex; justify-content: space-between; padding: 8px 0; font-size: .95rem; color: var(--ink-soft); }
.summary-line--total { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 16px; font-size: 1.25rem; font-weight: 700; font-family: var(--serif); color: var(--ink); }
.summary-line--discount { color: var(--success); font-weight: 600; }
.discount-form { display: flex; gap: 8px; margin: 16px 0; }
.discount-form input { flex: 1; }
.checkout-fields { display: grid; gap: 12px; margin: 16px 0; }
.trust-row { display: flex; gap: 14px; justify-content: center; margin-top: 16px; font-size: .78rem; color: var(--ink-faint); }
.optin { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 14px; padding: 12px 14px; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .85rem; color: var(--ink-soft); line-height: 1.45; cursor: pointer; }
.optin input { margin-top: 3px; }
.optin strong { color: var(--ink); }

/* --- Forms ---------------------------------------------------------------- */
.field { display: block; margin-bottom: 16px; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--ink-soft); }
.input, input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], select, textarea {
    width: 100%; padding: .72rem .9rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--card); font: inherit; font-size: .95rem; color: var(--ink); transition: border .15s, box-shadow .15s;
}
.input:focus, input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(210,96,58,.14); }
textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.field-hint { font-size: .8rem; color: var(--ink-faint); margin-top: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checkbox { display: flex; align-items: center; gap: 10px; font-size: .92rem; }
.checkbox input { width: auto; }

/* --- Auth / narrow pages -------------------------------------------------- */
.auth-wrap { max-width: 420px; margin: 64px auto; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow-sm); }
.auth-card h1 { font-size: 1.8rem; }
.auth-alt { text-align: center; margin-top: 20px; font-size: .9rem; color: var(--ink-faint); }
.auth-alt a { color: var(--accent); font-weight: 600; }

/* --- Empty states --------------------------------------------------------- */
.empty { text-align: center; padding: 72px 24px; }
.empty__mark { font-size: 3rem; }
.empty h2 { margin-top: 12px; }

/* --- Page content (about/terms) ------------------------------------------- */
.prose { max-width: 720px; margin: 56px auto; }
.prose h1 { font-size: 2.4rem; margin-bottom: 24px; }
.prose p { font-size: 1.08rem; color: var(--ink-soft); line-height: 1.8; }

/* --- Library (account) ---------------------------------------------------- */
.account-head { padding: 48px 0 8px; }
.account-head h1 { font-size: 2.4rem; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 24px; padding: 24px 0 64px; }
.library-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; transition: .2s; }
.library-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.library-card .cover { aspect-ratio: 3/4.2; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.library-card h3 { font-size: 1.05rem; }
.library-card small { color: var(--ink-faint); }
.order-table { width: 100%; border-collapse: collapse; }
.order-table th, .order-table td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.order-table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.badge--paid { background: #eaf6ef; color: var(--success); }
.badge--pending { background: #fdf3e2; color: #b07d24; }
.badge--refunded { background: #f1eef0; color: #8a6d80; }

/* --- Footer --------------------------------------------------------------- */
.site-footer { background: var(--ink); color: #cfc8bb; margin-top: 40px; }
.site-footer__inner { display: grid; grid-template-columns: 1.2fr 2fr; gap: 48px; padding: 56px 0 36px; }
.site-footer__brand .brand__mark { color: var(--accent); font-size: 1.6rem; }
.site-footer__brand strong { display: block; font-family: var(--serif); font-size: 1.4rem; color: #fff; margin: 6px 0; }
.site-footer__brand p { font-size: .92rem; max-width: 28ch; }
.site-footer__cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.site-footer__cols h4 { font-family: var(--sans); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: #fff; margin-bottom: 14px; }
.site-footer__cols a { display: block; font-size: .92rem; color: #b5ad9f; padding: 4px 0; }
.site-footer__cols a:hover { color: #fff; }
.site-footer__legal { display: flex; justify-content: space-between; padding: 20px 24px; border-top: 1px solid rgba(255,255,255,.1); font-size: .82rem; color: #908a7d; }
.site-footer__legal .powered strong { color: var(--accent); }

/* --- Success page --------------------------------------------------------- */
.success-hero { text-align: center; padding: 72px 0 32px; }
.success-hero__mark { width: 76px; height: 76px; border-radius: 999px; background: var(--success); color: #fff; display: grid; place-items: center; font-size: 2rem; margin: 0 auto 20px; box-shadow: 0 10px 30px rgba(47,125,91,.35); }
.download-list { max-width: 620px; margin: 0 auto 64px; display: grid; gap: 12px; }
.download-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; }
.download-row .cover { width: 44px; height: 62px; }

/* --- Cover carousel ------------------------------------------------------- */
/* An auto-scrolling shelf of covers. The edges are masked into the page so the
   books appear to rise out of the background; hover lifts a cover off the page. */
.carousel-section {
    position: relative;
    padding: 64px 0 76px;
    overflow: hidden;
    background:
        radial-gradient(58% 130% at 50% 8%, rgba(210,96,58,.10), transparent 60%),
        linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
}
.carousel-section__head { text-align: center; margin-bottom: 30px; padding: 0 24px; }
.carousel-section__head h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); }

.carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
    perspective: 1500px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 13%, #000 87%, transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 13%, #000 87%, transparent 100%);
}
.carousel__track {
    display: flex;
    gap: 40px;
    width: max-content;
    padding: 34px 40px 46px;
    animation: book-marquee 55s linear infinite;
    will-change: transform;
}
.carousel:hover .carousel__track { animation-play-state: paused; }
@keyframes book-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.carousel__item {
    flex: 0 0 auto;
    width: 184px;
    text-decoration: none;
    transition: transform .4s cubic-bezier(.2,.75,.2,1);
}
.carousel__cover {
    position: relative;
    aspect-ratio: 3 / 4.4;
    border-radius: 6px 12px 12px 6px;
    box-shadow: 0 20px 42px rgba(33,31,28,.30), 0 6px 14px rgba(0,0,0,.14);
    transition: box-shadow .4s ease, transform .4s ease;
}
.carousel__cover .cover { width: 100%; height: 100%; border-radius: 6px 12px 12px 6px; overflow: hidden; }
/* glossy spine + page edge so each cover reads like a real book */
.carousel__cover::before {
    content: "";
    position: absolute; left: 0; top: 0; bottom: 0; width: 13px; z-index: 2;
    border-radius: 6px 0 0 6px;
    background: linear-gradient(90deg, rgba(255,255,255,.30), rgba(255,255,255,0) 55%, rgba(0,0,0,.16));
    pointer-events: none;
}
/* soft "floor" glow so each book feels lifted off the page */
.carousel__cover::after {
    content: "";
    position: absolute;
    left: 8%; right: 8%; bottom: -22px; height: 26px;
    background: radial-gradient(closest-side, rgba(33,31,28,.28), transparent 80%);
    filter: blur(4px);
    opacity: .55;
    transition: opacity .4s ease, transform .4s ease;
    z-index: -1;
}
.carousel__item:hover { transform: translateY(-16px) scale(1.07); z-index: 5; }
.carousel__item:hover .carousel__cover { box-shadow: 0 40px 80px rgba(33,31,28,.42), 0 10px 20px rgba(0,0,0,.2); }
.carousel__item:hover .carousel__cover::after { opacity: .8; transform: translateY(10px) scaleX(1.1); }
.carousel__title {
    display: block; text-align: center; margin-top: 16px;
    font-family: var(--serif); font-size: .98rem; color: var(--ink);
    opacity: 0; transform: translateY(8px);
    transition: opacity .35s ease, transform .35s ease;
}
.carousel__item:hover .carousel__title { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    .carousel__track { animation: none; }
}

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 980px) {
    .hero__inner { grid-template-columns: 1fr; gap: 32px; }
    .hero__art { display: none; }
    .product { grid-template-columns: 1fr; }
    .product__cover { position: static; max-width: 280px; }
    .cart { grid-template-columns: 1fr; }
    .book-grid { grid-template-columns: repeat(3, 1fr); }
    .cat-grid { grid-template-columns: repeat(2, 1fr); }
    .features { grid-template-columns: 1fr; gap: 16px; }
    .site-footer__inner { grid-template-columns: 1fr; gap: 28px; }
}
@media (max-width: 680px) {
    .site-nav { display: none; }
    .search-mini { display: none; }
    .book-grid, .book-grid--3 { grid-template-columns: repeat(2, 1fr); gap: 20px 16px; }
    .cat-grid { grid-template-columns: 1fr; }
    .field-row { grid-template-columns: 1fr; }
    .hero { padding: 48px 0; }
    .hero h1 { font-size: clamp(1.9rem, 7.6vw, 2.6rem); overflow-wrap: break-word; hyphens: auto; }
    .hero__lede { font-size: 1.05rem; }

    /* Hero CTAs stay side-by-side, sharing the width evenly. */
    .hero__cta { flex-wrap: nowrap; gap: 10px; }
    .hero__cta .btn { flex: 1 1 0; min-width: 0; padding: .85rem .5rem; font-size: .9rem; }
    .hero__stats { gap: 22px 28px; flex-wrap: wrap; }

    /* Footer: clean, centered stack on small screens. */
    .site-footer__inner { text-align: center; padding: 40px 0 24px; gap: 30px; }
    .site-footer__brand p { max-width: 34ch; margin: 8px auto 0; }
    .site-footer__cols { grid-template-columns: repeat(3, 1fr); gap: 26px 10px; }
    .site-footer__cols h4 { margin-bottom: 10px; }
    .site-footer__cols a { padding: 5px 0; font-size: .88rem; }
    .site-footer__legal { flex-direction: column; gap: 10px; text-align: center; padding: 18px 24px; }

    /* Carousel keeps auto-scrolling on mobile too — just a little smaller. */
    .carousel__track { gap: 24px; padding: 26px 22px 36px; }
    .carousel__item { width: 142px; }
    .carousel__item:hover { transform: none; }
    .carousel__item:hover .carousel__cover { box-shadow: 0 20px 42px rgba(33,31,28,.30), 0 6px 14px rgba(0,0,0,.14); }

    /* Keep the three assurances on one line. */
    .assurance { gap: 8px; flex-wrap: nowrap; justify-content: space-between; }
    .assurance span { font-size: .7rem; gap: 4px; white-space: nowrap; }
}

@media (max-width: 360px) {
    .assurance span { font-size: .64rem; }
}

@media (max-width: 400px) {
    .book-grid, .book-grid--3 { grid-template-columns: 1fr; }
    .site-footer__cols { grid-template-columns: 1fr; }
}
