:root {
  --bg: #f4f5f7;
  --white: #fff;
  --ink: #1f2328;
  --ink-2: #4b5260;
  --muted: #868d99;
  --line: #e4e6eb;
  --line-2: #eef0f3;
  --brand: #0d5c63;
  --brand-2: #0a4a50;
  --brand-soft: #e7f2f3;
  --orange: #f06a24;
  --orange-2: #d9581a;
  --green: #16a34a;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Merriweather", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.wrap { width: min(1320px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 6px; }
.skip:focus { left: 8px; }
fieldset { border: 0; margin: 0; padding: 0; }
.footer-h { color: #fff; margin: 6px 0 12px; font-size: 13px; letter-spacing: .05em; text-transform: uppercase; font-family: var(--font); }
.pcard-h { margin: 0; font-size: inherit; font-weight: inherit; }
.summary h2 { font-size: 17px; margin-bottom: 12px; }
.side-title { margin: 0; }
.center-search { max-width: 520px; margin: 20px auto; }
.center-search button { width: auto; padding: 0 18px; font-weight: 600; }
.small { font-size: 12px; }
.center { text-align: center; }
.hide-sm { }

/* ------------------------------------------------------------ utility + header */
.utility { background: var(--brand-2); color: #cfe3e5; font-size: 12px; }
.utility-inner { display: flex; justify-content: space-between; gap: 16px; height: 34px; align-items: center; }
.utility a:hover { color: #fff; }

.header { background: var(--white); position: sticky; top: 0; z-index: 40; box-shadow: 0 1px 0 var(--line); }
.header-inner { display: flex; align-items: center; gap: 32px; height: 76px; }
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo img { border-radius: 10px; }
.logo-text { font: 700 25px var(--serif); color: var(--brand); letter-spacing: -.02em; }
.logo-text b { color: var(--orange); font-weight: 900; }
.logo.light .logo-text { color: #fff; }
.search { flex: 1; display: flex; height: 46px; border: 2px solid var(--brand); border-radius: 8px; overflow: hidden; background: var(--white); }
.search input { flex: 1; border: 0; outline: none; padding: 0 16px; font: inherit; font-size: 15px; min-width: 0; }
.search button { width: 58px; border: 0; background: var(--brand); color: #fff; cursor: pointer; display: grid; place-items: center; }
.search button:hover { background: var(--brand-2); }
.header-actions { display: flex; gap: 8px; }
.hact { position: relative; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 8px; font-weight: 600; color: var(--ink); border: 1px solid var(--line); }
.hact:hover { border-color: var(--brand); color: var(--brand); }
.badge { position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--orange); color: #fff; font-size: 11px; display: grid; place-items: center; border: 2px solid #fff; }

/* ------------------------------------------------------------ main nav + mega menu */
.mainnav { border-top: 1px solid var(--line-2); background: var(--white); }
.mainnav-inner { display: flex; align-items: stretch; height: 46px; position: relative; }
.navitem { position: static; display: flex; }
.navlink { display: flex; align-items: center; gap: 8px; padding: 0 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap; border-bottom: 3px solid transparent; }
.navitem:hover > .navlink { color: var(--brand); border-bottom-color: var(--orange); }
.navlink.strong { background: var(--brand); color: #fff !important; border-radius: 6px 6px 0 0; margin: 4px 8px 0 0; font-weight: 600; border-bottom: 0 !important; }
.allcats:hover .navlink.strong { background: var(--brand-2); }
.mainnav-inner { overflow: visible; }
.mainnav-inner > .navitem:nth-child(n+6) { display: none; }
@media (min-width: 1280px) { .mainnav-inner > .navitem:nth-child(6) { display: flex; } }
@media (min-width: 1440px) { .mainnav-inner > .navitem:nth-child(7) { display: flex; } }

.mega { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--white); border: 1px solid var(--line); border-top: 3px solid var(--orange); box-shadow: var(--shadow-lg); padding: 22px 26px 26px; z-index: 50; border-radius: 0 0 var(--radius) var(--radius); max-height: 70vh; overflow-y: auto; }
.navitem:hover > .mega { display: block; }
.mega-title { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line-2); }
.mega-title a { font-size: 17px; font-weight: 700; color: var(--brand); }
.mega-title small { font-size: 13px; font-weight: 500; color: var(--orange); margin-left: 8px; }
.mega-grid, .mega-all { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px 28px; }
.mega-grid { display: grid; }
.navitem:hover > .mega-all { display: grid; }
.mega-col { display: flex; flex-direction: column; gap: 6px; }
.mega-col a { color: var(--ink-2); font-size: 13px; }
.mega-col a:hover { color: var(--orange); }
.mega-col .mega-head { color: var(--ink); font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.mega-col .more { color: var(--brand); font-weight: 600; }
.mega-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 24px; }
.mega-link { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 6px; color: var(--ink-2); font-size: 13.5px; }
.mega-link small { color: var(--muted); font-size: 11px; }
.mega-link:hover { background: var(--brand-soft); color: var(--brand); }

/* ------------------------------------------------------------ layout */
main { min-height: 50vh; }
.layout > * { min-width: 0; }
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; padding: 20px 0 40px; }
.crumbs { font-size: 12px; color: var(--muted); padding: 16px 0 0; }
.crumbs a:hover { color: var(--brand); }
.crumbs span { color: var(--ink-2); }
.crumbs + .layout, .wrap:has(.crumbs) + .layout { padding-top: 12px; }

/* ------------------------------------------------------------ sidebar category tree */
.sidebar { position: sticky; top: 140px; max-height: calc(100vh - 160px); overflow-y: auto; display: grid; gap: 16px; scrollbar-width: thin; }
.cattree, .side-box { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 0; }
.side-title { font-weight: 700; font-size: 15px; padding: 10px 16px 12px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.ct-top summary { list-style: none; display: grid; grid-template-columns: 1fr auto 14px; align-items: center; gap: 6px; padding: 9px 14px 9px 16px; cursor: pointer; font-weight: 600; color: var(--ink); }
.ct-top summary::-webkit-details-marker { display: none; }
.ct-top summary::after { content: "›"; color: var(--muted); font-size: 16px; transition: transform .15s; text-align: center; }
.ct-top[open] summary::after { transform: rotate(90deg); }
.ct-top summary:hover, .ct-top summary.active { background: var(--brand-soft); color: var(--brand); }
.ct-top summary small, .cattree li small { color: var(--muted); font-weight: 400; font-size: 11px; }
.ct-ico { font-size: 16px; }
.cattree ul { list-style: none; margin: 0 0 6px; padding: 0 0 0 28px; border-left: 0; }
.cattree ul ul { padding-left: 14px; margin: 2px 0 4px; border-left: 2px solid var(--line-2); }
.cattree li a { display: flex; justify-content: space-between; gap: 8px; padding: 5px 14px 5px 0; color: var(--ink-2); font-size: 13px; }
.cattree li a:hover { color: var(--orange); }
.cattree li.active > a { color: var(--orange); font-weight: 600; }
.cattree li.more-link a { color: var(--brand); font-weight: 600; }
.side-box { padding-bottom: 14px; }
.side-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 16px 6px; }
.radio { display: flex; align-items: center; gap: 8px; padding: 4px 16px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.radio input { accent-color: var(--brand); }

/* ------------------------------------------------------------ home */
.banner { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center; gap: 20px; padding: 36px 40px; border-radius: 14px; background: linear-gradient(120deg, #0d5c63 0%, #12707a 55%, #1b8a8f 100%); color: #fff; overflow: hidden; position: relative; min-height: 290px; }
.banner::before { content: ""; position: absolute; right: -80px; top: -80px; width: 360px; height: 360px; border-radius: 50%; background: rgba(255, 255, 255, .07); }
.banner-tag { display: inline-block; background: var(--orange); padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 14px; }
.banner h1 { font: 900 clamp(26px, 3vw, 38px)/1.2 var(--serif); }
.banner p { color: #d4ecee; font-size: 15px; max-width: 420px; margin: 12px 0 22px; }
.banner-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.banner-books { position: relative; height: 240px; }
.banner-books img { position: absolute; width: 140px; aspect-ratio: 2/3; object-fit: cover; border-radius: 4px; box-shadow: 0 18px 30px -10px rgba(0, 0, 0, .5); background: #e5e7eb; }
.banner-books img:nth-child(1) { left: 4%; top: 30px; transform: rotate(-6deg); }
.banner-books img:nth-child(2) { left: 33%; top: 0; z-index: 2; width: 156px; }
.banner-books img:nth-child(3) { left: 63%; top: 34px; transform: rotate(6deg); }

.quickcats { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; margin: 18px 0 6px; }
.qcat { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); text-align: center; font-size: 12px; font-weight: 600; color: var(--ink-2); line-height: 1.3; transition: all .15s; }
.qcat:hover { border-color: var(--brand); box-shadow: var(--shadow); color: var(--brand); }
.qcat-ico { width: 44px; height: 44px; border-radius: 50%; background: var(--brand-soft); display: grid; place-items: center; font-size: 22px; }

.rail { margin-top: 22px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 18px 18px 20px; }
.rail-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.rail-head h2 { font-size: 19px; font-weight: 700; }
.rail-head a { color: var(--orange); font-weight: 600; font-size: 13px; }
.rail .pgrid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.rail .pcard { border-color: var(--line-2); box-shadow: none; }
.subchips { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }
.subchips a { padding: 5px 12px; border-radius: 999px; background: var(--bg); font-size: 12px; color: var(--ink-2); border: 1px solid var(--line-2); }
.subchips a:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* ------------------------------------------------------------ product cards */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.pcard { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 10px 10px; transition: box-shadow .18s, border-color .18s, transform .18s; }
.pcard:hover { box-shadow: var(--shadow-lg); border-color: transparent; transform: translateY(-2px); z-index: 2; }
.pcard-img { position: relative; display: grid; place-items: center; height: 200px; margin-bottom: 10px; background: #fafbfc; border-radius: 6px; overflow: hidden; }
.pcard-img img { position: relative; z-index: 1; max-height: 184px; width: auto; max-width: 92%; object-fit: contain; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .35); background: #fff; }
.pcard-img .noimg-inner { padding: 20px; text-align: center; font: 700 14px/1.35 var(--serif); color: #fff; }
.pcard-img .fb { position: absolute; inset: 20px 30px; display: none; place-items: center; background: linear-gradient(150deg, var(--brand), #1b8a8f); border-radius: 3px; }
.pcard-img.noimg .fb { display: grid; }
.ribbon { position: absolute; z-index: 2; top: 8px; left: 8px; background: var(--green); color: #fff; font-size: 10px; font-weight: 700; padding: 3px 7px; border-radius: 4px; text-transform: uppercase; letter-spacing: .04em; }
.pcard-body { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.pcard-title { font-weight: 600; font-size: 13px; line-height: 1.35; height: 2.7em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--ink); }
.pcard-author { font-size: 12px; color: var(--brand); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-pub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-price { margin-top: auto; padding-top: 6px; font-size: 16px; font-weight: 700; color: var(--ink); }
.pcard-form { margin: 8px 0 0; }
.btn-cart { width: 100%; height: 34px; border: 0; border-radius: 6px; background: var(--orange); color: #fff; font: 600 13px var(--font); cursor: pointer; display: grid; place-items: center; margin-top: 8px; }
.pcard-form .btn-cart { margin-top: 0; }
.btn-cart:hover { background: var(--orange-2); }
.btn-cart.disabled { background: var(--line-2); color: var(--muted); cursor: default; }

/* ------------------------------------------------------------ listing */
.listhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.listhead h1 { font-size: 22px; font-weight: 700; }
.listhead p { margin: 4px 0 0; font-size: 13px; }
.sortbox { margin: 0; }
.sortbox label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.sortbox select, .filters select { font: inherit; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); color: var(--ink); cursor: pointer; }
.subcats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-bottom: 14px; }
.subcat { display: flex; flex-direction: column; padding: 11px 14px; background: var(--white); border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 8px; font-weight: 600; font-size: 13px; line-height: 1.3; }
.subcat small { color: var(--muted); font-weight: 400; font-size: 11px; margin-top: 3px; }
.subcat:hover { border-left-color: var(--orange); box-shadow: var(--shadow); }
.filters { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; padding: 12px 16px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; font-size: 13px; color: var(--ink-2); }
.filters label { display: flex; align-items: center; gap: 8px; }
.empty { padding: 50px; text-align: center; background: var(--white); border: 1px dashed var(--line); border-radius: var(--radius); color: var(--ink-2); }
.empty a { color: var(--orange); font-weight: 600; }
.pager { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 26px; }
.pager a, .pager b, .pager span { min-width: 38px; height: 38px; padding: 0 12px; display: grid; place-items: center; border-radius: 6px; font-size: 13px; }
.pager a { background: var(--white); border: 1px solid var(--line); }
.pager a:hover { border-color: var(--brand); color: var(--brand); }
.pager b { background: var(--brand); color: #fff; }

/* ------------------------------------------------------------ book detail */
.page { padding: 8px 0 50px; }
.page.narrow { max-width: 900px; }
.page-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin: 16px 0; }
.page-head h1 { font-size: 26px; }
.book-page .crumbs { padding-bottom: 14px; }
.book { display: grid; grid-template-columns: 340px 1fr; gap: 36px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 28px; align-items: start; }
.book-cover { position: relative; display: grid; place-items: center; background: #fafbfc; border-radius: 8px; padding: 24px; min-height: 380px; }
.book-cover img { position: relative; z-index: 1; max-height: 440px; width: auto; box-shadow: 0 18px 32px -14px rgba(0, 0, 0, .5); }
.book-cover .fallback { position: absolute; inset: 40px 60px; display: none; place-items: center; text-align: center; padding: 20px; background: linear-gradient(150deg, var(--brand), #1b8a8f); color: #fff; font: 700 18px/1.35 var(--serif); border-radius: 4px; }
.book-cover.noimg .fallback { display: grid; }
.book-info h1 { font-size: 26px; font-weight: 700; }
.subtitle { font-size: 16px; color: var(--ink-2); margin: 6px 0 0; }
.authors { margin: 10px 0 0; font-size: 14px; }
.authors a { color: var(--brand); font-weight: 600; }
.buybox { margin: 20px 0; padding: 18px 20px; background: #fafbfc; border: 1px solid var(--line); border-radius: var(--radius); display: grid; gap: 10px; }
.price.big { font-size: 30px; font-weight: 800; color: var(--ink); }
.stock { font-size: 13px; color: var(--ink-2); }
.stock.ok { color: var(--green); font-weight: 600; }
.buy-form { display: flex; gap: 10px; align-items: center; margin: 4px 0 0; }
.qty { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.qty input, .cart-qty input { width: 64px; height: 44px; font: inherit; border: 1px solid var(--line); border-radius: 6px; text-align: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 26px; border: 0; border-radius: 6px; background: var(--orange); color: #fff; font: 600 15px var(--font); cursor: pointer; }
.btn:hover { background: var(--orange-2); color: #fff; }
.btn.light { background: rgba(255, 255, 255, .15); border: 1px solid rgba(255, 255, 255, .4); }
.btn.light:hover { background: rgba(255, 255, 255, .25); }
.btn.ghost { background: var(--white); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn.wide { width: 100%; height: 50px; }
.buy-form .btn { flex: 1; max-width: 280px; }
.facts { display: grid; grid-template-columns: 150px 1fr; margin: 0; font-size: 13px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.facts dt, .facts dd { padding: 9px 14px; border-bottom: 1px solid var(--line-2); margin: 0; }
.facts dt { color: var(--muted); background: #fafbfc; }
.facts a { color: var(--brand); }
.prose { margin-top: 16px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 24px 28px; font-size: 14.5px; color: var(--ink-2); line-height: 1.7; }
.prose h2 { font-size: 18px; color: var(--ink); margin-bottom: 10px; }
.prose p { margin: 0 0 10px; }
.toc summary { cursor: pointer; font-weight: 700; font-size: 18px; color: var(--ink); }
.book-page .section { margin-top: 16px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { font-size: 19px; }
.section-head a { color: var(--orange); font-weight: 600; font-size: 13px; }
.book-page .pgrid { grid-template-columns: repeat(6, minmax(0, 1fr)); }

/* ------------------------------------------------------------ cart / checkout */
.cart { display: grid; gap: 10px; }
.cart-line { display: grid; grid-template-columns: 70px 1fr 90px 110px 36px; gap: 16px; align-items: center; padding: 14px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.cart-img { aspect-ratio: 2/3; border-radius: 3px; overflow: hidden; background: #f0f1f3; }
.cart-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-qty { margin: 0; }
.cart-total { font-weight: 700; text-align: right; font-size: 15px; }
.link-btn { border: 0; background: none; color: var(--muted); font-size: 16px; cursor: pointer; }
.link-btn:hover { color: var(--orange); }
.card-title { font-weight: 600; }
.card-author { color: var(--brand); font-size: 12px; }
.cart-sum { display: flex; justify-content: space-between; align-items: center; padding: 18px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); font-size: 16px; }
.cart-sum strong { font-size: 26px; }
.cart-actions { display: flex; justify-content: flex-end; gap: 10px; }
.checkout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: start; }
.form { display: grid; gap: 6px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: 8px; }
.form input, .form textarea { font: inherit; font-weight: 400; padding: 11px 12px; border: 1px solid var(--line); border-radius: 6px; outline: none; }
.form input:focus, .form textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.form .btn { margin-top: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.error { color: #dc2626; font-size: 12px; }
.summary { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; position: sticky; top: 140px; }
.summary h3 { font-size: 17px; margin-bottom: 12px; }
.sum-line { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.sum-line.total { border: 0; font-size: 16px; padding-top: 14px; }
.done { width: 76px; height: 76px; margin: 30px auto 20px; border-radius: 50%; background: var(--green); color: #fff; font-size: 38px; display: grid; place-items: center; }
.lead { font-size: 16px; color: var(--ink-2); }
.center .lead { margin-inline: auto; max-width: 560px; }

/* ------------------------------------------------------------ flash, trust, footer */
.flash { position: fixed; right: 20px; bottom: 20px; z-index: 60; background: var(--ink); color: #fff; padding: 14px 18px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; animation: flash 3.5s ease forwards; }
.flash a { color: #ffb68a; font-weight: 700; margin-left: 12px; }
@keyframes flash { 0% { opacity: 0; transform: translateY(10px); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(10px); pointer-events: none; } }
.trust { background: var(--white); border-top: 1px solid var(--line); margin-top: 20px; }
.trust-inner { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; padding: 24px 0; }
.trust-inner div { display: flex; flex-direction: column; gap: 2px; }
.trust-inner b { font-size: 14px; }
.trust-inner span { font-size: 12px; color: var(--muted); }
.footer { background: #12262a; color: #a9bcbf; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 36px; padding: 44px 0 28px; }
.footer p { max-width: 340px; font-size: 13px; margin-top: 14px; }
.footer h4 { color: #fff; margin: 6px 0 12px; font-size: 13px; letter-spacing: .05em; text-transform: uppercase; }
.footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; font-size: 13px; }
.footer a:hover { color: #fff; }
.copy { border-top: 1px solid rgba(255, 255, 255, .1); padding: 16px 0 24px; font-size: 12px; color: #7f9598; }

/* ------------------------------------------------------------ mobile menu */
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.menu-btn { display: none; width: 42px; height: 42px; border-radius: 8px; border: 1px solid var(--line); place-items: center; color: var(--ink); cursor: pointer; flex-shrink: 0; }
.mcats { display: none; }
.drawer, .drawer-overlay { display: none; }
.filters-box summary { list-style: none; cursor: pointer; }
.filters-box summary::-webkit-details-marker { display: none; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1200px) {
  .rail .pgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rail .pgrid .pcard:nth-child(n+9) { display: none; }
  .book-page .pgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .quickcats { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .cattree { display: none; }
  .banner { grid-template-columns: 1fr; padding: 28px; }
  .banner-books { display: none; }
  .book { grid-template-columns: 1fr; }
  .checkout { grid-template-columns: 1fr; }
  .summary { position: static; }
  .footer-inner, .trust-inner { grid-template-columns: 1fr 1fr; }
  .mainnav { display: none; }
  .menu-btn { display: grid; }
  .mcats { display: flex; gap: 8px; overflow-x: auto; padding: 8px 16px 10px; border-top: 1px solid var(--line-2); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .mcats::-webkit-scrollbar { display: none; }
  .mcats a { flex-shrink: 0; padding: 6px 12px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
  .drawer { display: block; position: fixed; inset: 0 auto 0 0; width: min(330px, 86vw); background: var(--white); z-index: 80; overflow-y: auto; transform: translateX(-102%); transition: transform .25s ease; box-shadow: var(--shadow-lg); padding-bottom: 30px; }
  .drawer-overlay { display: block; position: fixed; inset: 0; background: rgba(16, 24, 40, .45); z-index: 70; opacity: 0; pointer-events: none; transition: opacity .25s; }
  .nav-toggle:checked ~ .drawer { transform: none; }
  .nav-toggle:checked ~ .drawer-overlay { opacity: 1; pointer-events: auto; }
  .drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; background: var(--brand); color: #fff; font-weight: 700; font-size: 16px; position: sticky; top: 0; }
  .drawer-close { cursor: pointer; font-size: 18px; padding: 4px 8px; }
  .drawer-link { display: block; padding: 12px 18px; border-bottom: 1px solid var(--line-2); font-weight: 600; }
  .drawer-cat { border-bottom: 1px solid var(--line-2); }
  .drawer-cat summary { list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; font-weight: 600; cursor: pointer; }
  .drawer-cat summary::-webkit-details-marker { display: none; }
  .drawer-cat summary small { color: var(--muted); font-weight: 400; margin-left: auto; margin-right: 10px; }
  .drawer-cat summary::after { content: "›"; color: var(--muted); font-size: 18px; transition: transform .15s; }
  .drawer-cat[open] summary::after { transform: rotate(90deg); }
  .drawer-cat a { display: flex; justify-content: space-between; padding: 9px 18px 9px 30px; font-size: 14px; color: var(--ink-2); }
  .drawer-cat a small { color: var(--muted); }
  .drawer-cat a.all { color: var(--orange); font-weight: 600; }
  .sidebar { gap: 10px; }
  .filters-box { padding: 0; }
  .filters-box summary { padding: 12px 16px; border: 0; margin: 0; display: flex; justify-content: space-between; }
  .filters-box summary::after { content: "+"; font-weight: 400; color: var(--muted); }
  .filters-box[open] summary::after { content: "–"; }
  .filters-box[open] { padding-bottom: 12px; }
  .listhead { padding: 12px 14px; }
  .listhead h1 { font-size: 19px; }
  .subcats { grid-template-columns: repeat(2, 1fr); }
  .layout { padding-top: 12px; gap: 12px; }
  .rail { padding: 14px 12px 16px; }
  .header { position: sticky; }
}
@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 10px; }
  .search { order: 3; flex-basis: 100%; height: 42px; }
  .logo-text { font-size: 21px; }
  .logo img { width: 34px; height: 34px; }
  .hact { padding: 8px 10px; }
  .utility { display: none; }
  .banner { padding: 22px 20px; min-height: 0; }
  .banner h1 { font-size: 24px; }
  .wrap { width: calc(100% - 24px); }
  .book { padding: 16px; gap: 18px; }
  .book-cover { min-height: 0; padding: 14px; }
  .book-cover img { max-height: 320px; }
  .book-info h1 { font-size: 21px; }
  .buy-form { flex-wrap: wrap; }
  .buy-form .btn { max-width: none; }
  .prose { padding: 18px; }
  .pcard { padding: 8px; }
  .pcard-img { height: 170px; }
  .pcard-img img { max-height: 156px; }
  .pager a, .pager b, .pager span { min-width: 34px; height: 34px; padding: 0 8px; }
  .filters { flex-direction: column; align-items: stretch; }
  .sortbox select { max-width: 100%; }
  .header-actions { margin-left: auto; }
  .hide-sm { display: none; }
  .pgrid, .rail .pgrid, .book-page .pgrid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .pcard-img { height: 190px; }
  .pcard-img img { max-height: 170px; }
  .quickcats { grid-template-columns: repeat(4, 1fr); }
  .cart-line { grid-template-columns: 60px 1fr auto; }
  .cart-line .cart-total { grid-column: 2; text-align: left; }
  .row2 { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 110px 1fr; }
  .footer-inner, .trust-inner { grid-template-columns: 1fr; }
}
