/* CKG Bookshop storefront — warm paper + ink, Bookazine-inspired editorial retail */
:root {
  --bg: #f7f4ef;
  --card: #fffcf8;
  --ink: #1a1714;
  --muted: #6b6560;
  --line: #e4ddd4;
  --accent: #8b1e2d;
  --accent-ink: #ffffff;
  --accent-soft: #f3e6e8;
  --r: 8px;
  --font: "Noto Sans TC", "PingFang HK", "Microsoft JhengHei", sans-serif;
  --serif: "Source Serif 4", "Noto Serif TC", Georgia, serif;
  --gutter: 16px;
  --touch: 44px;
  --wrap: 1120px;
  --header-max: 80px;
  --shadow-soft: 0 1px 2px rgba(26, 23, 20, 0.04);
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap {
  width: min(var(--wrap), calc(100% - (var(--gutter) * 2)));
  margin-inline: auto;
}

/* Promo */
.promo-bar {
  background: var(--ink);
  color: #f7f4ef;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-align: center;
  padding: 7px 12px;
}

/* Header */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-soft);
}
.header-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "toggle logo actions"
    "search search search";
  gap: 8px 10px;
  align-items: center;
  padding: 8px 0;
  min-height: 0;
}
.nav-toggle {
  grid-area: toggle;
  width: var(--touch);
  height: var(--touch);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
}
.nav-toggle[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.logo {
  grid-area: logo;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.1;
  min-height: var(--touch);
  align-items: center;
}
.logo:hover { text-decoration: none; color: var(--accent); }
.logo__mark {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.logo__text {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.01em;
}
.search {
  grid-area: search;
  display: flex;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg);
  min-height: var(--touch);
}
.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 10px 14px;
  outline: none;
  font-size: 15px;
}
.search button {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: var(--touch);
  min-width: var(--touch);
  cursor: pointer;
  flex-shrink: 0;
  font-size: 15px;
}
.search button:hover { color: var(--accent); }
.lang-switch {
  display: inline-flex;
  align-items: center;
  height: var(--touch);
  margin-right: 2px;
}
.lang-switch button {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  min-width: 32px;
  min-height: var(--touch);
  padding: 0 4px;
  cursor: pointer;
}
.lang-switch button.is-on {
  color: var(--ink);
  font-weight: 600;
}
.lang-switch button:hover { color: var(--accent); }
.lang-switch__sep {
  color: var(--muted);
  font-size: 12px;
}
.header-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  flex-wrap: nowrap;
}
.header-actions > a,
.header-actions > .btn {
  height: var(--touch);
  min-height: var(--touch);
  box-sizing: border-box;
}
.header-register {
  display: none;
  padding: 0 14px;
  font-size: 13px;
  line-height: 1;
}
.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: var(--touch);
  min-height: var(--touch);
  height: var(--touch);
  padding: 0 10px;
  color: var(--ink);
  border-radius: var(--r);
  line-height: 1;
}
.icon-link:hover {
  text-decoration: none;
  color: var(--accent);
  background: var(--accent-soft);
}
.icon-link__text {
  display: none;
  line-height: 1;
}
.text-link {
  color: var(--muted);
  font-size: 13px;
  padding: 0 8px;
  min-height: var(--touch);
  height: var(--touch);
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.cart-badge {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--line);
}
.cart-badge:hover { border-color: var(--accent); }
.cart-badge.is-bump {
  animation: cart-bump 0.4s ease;
}
.cart-count {
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0 5px;
  line-height: 1;
}
.cart-label { display: none; }

/* Fly-to-cart animation */
.cart-flyer {
  position: fixed;
  z-index: 1000;
  width: 52px;
  height: 68px;
  margin-left: -26px;
  margin-top: -34px;
  border-radius: 6px;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(160deg, #ebe4da, #ddd4c8);
  color: var(--muted);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 28px rgba(26, 23, 20, 0.22);
  font-size: 22px;
  will-change: transform, opacity;
}
.cart-flyer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cart-flyer.is-flying {
  animation: cart-fly 0.78s cubic-bezier(0.22, 0.82, 0.2, 1) forwards;
}
@keyframes cart-fly {
  0% {
    transform: translate(0, 0) scale(1) rotate(0deg);
    opacity: 1;
  }
  55% {
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx), var(--dy)) scale(0.18) rotate(-12deg);
    opacity: 0.1;
  }
}
@keyframes cart-bump {
  0%, 100% { transform: scale(1); }
  35% { transform: scale(1.16); }
  65% { transform: scale(0.94); }
}
@media (prefers-reduced-motion: reduce) {
  .cart-flyer { display: none !important; }
  .cart-badge.is-bump { animation: none; }
}

/* Category nav */
.nav-cats {
  display: none;
  gap: 4px 14px;
  flex-wrap: wrap;
  font-size: 13px;
  padding: 0 0 10px;
  font-weight: 500;
}
.nav-cats a {
  color: var(--muted);
  padding: 8px 2px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border-bottom: 2px solid transparent;
}
.nav-cats a:hover,
.nav-cats a.is-on {
  color: var(--ink);
  text-decoration: none;
  border-bottom-color: var(--accent);
}
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 23, 20, 0.35);
  z-index: 35;
}
body.nav-open { overflow: hidden; }
body.nav-open .nav-backdrop { display: block; }
body.nav-open .nav-cats {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 86vw);
  background: var(--card);
  z-index: 45;
  padding: 72px 20px 24px;
  overflow-y: auto;
  box-shadow: 4px 0 24px rgba(26, 23, 20, 0.12);
  gap: 0;
}
body.nav-open .nav-cats a {
  padding: 12px 4px;
  min-height: var(--touch);
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  color: var(--ink);
}
body.nav-open .nav-cats a:hover {
  color: var(--accent);
  border-bottom-color: var(--line);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 0 18px;
  border-radius: var(--r);
  border: 0;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: #731828; color: #fff; }
.btn-ink { background: var(--ink); color: #f7f4ef; }
.btn-ink:hover { background: #2c2622; color: #fff; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.btn-sm {
  min-height: 36px;
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
}
.btn-block { width: 100%; }
.btn.secondary,
.btn-secondary { background: #57534e; color: #fff; }

/* Flash / main */
.flash {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--r);
  background: #edf7f0;
  color: #1f5c38;
  font-size: 14px;
  border: 1px solid #cfe8d8;
}
.flash.is-err {
  background: #fbf0f1;
  color: #8b1e2d;
  border-color: #efd0d4;
}
.main {
  flex: 1;
  --main-pad-y: 18px;
  padding: 18px 0 48px;
}
.muted { color: var(--muted); }
.page-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(24px, 4vw, 32px);
  margin: 0 0 18px;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

/* Hero banner — full-bleed atmospheric plane under sticky header */
.hero-banner {
  position: relative;
  width: 100vw;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  margin-top: calc(-1 * var(--main-pad-y, 18px));
  margin-bottom: 28px;
  min-height: min(72dvh, 640px);
  display: grid;
  align-items: end;
  overflow: hidden;
  isolation: isolate;
  color: #f7f4ef;
}
.hero-banner__media {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-banner__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  transform: scale(1.06);
  transform-origin: center center;
  transition: transform 1.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.hero-banner.is-ready .hero-banner__media img {
  transform: scale(1);
}
.hero-banner__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(26, 23, 20, 0.72) 0%, rgba(26, 23, 20, 0.42) 46%, rgba(26, 23, 20, 0.18) 100%),
    linear-gradient(0deg, rgba(26, 23, 20, 0.58) 0%, rgba(26, 23, 20, 0.12) 52%, rgba(26, 23, 20, 0.28) 100%);
  pointer-events: none;
}
.hero-banner__content {
  position: relative;
  z-index: 2;
  width: min(var(--wrap), calc(100% - (var(--gutter) * 2)));
  margin-inline: auto;
  padding: 48px 0 40px;
}
.hero-banner__brand {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(32px, 7vw, 56px);
  letter-spacing: 0.02em;
  line-height: 1.05;
  text-wrap: balance;
  color: #fffcf8;
}
.hero-banner__title {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(20px, 3.4vw, 28px);
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: #f3e6e8;
  max-width: 18ch;
}
.hero-banner__lede {
  margin: 0 0 22px;
  max-width: 36ch;
  font-size: 15px;
  line-height: 1.55;
  color: rgba(247, 244, 239, 0.88);
}
.hero-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.btn-on-dark {
  background: transparent;
  color: #fffcf8;
  border: 1px solid rgba(255, 252, 248, 0.45);
}
.btn-on-dark:hover {
  background: rgba(255, 252, 248, 0.1);
  border-color: #fffcf8;
  text-decoration: none;
  color: #fffcf8;
}
.hero-banner__brand,
.hero-banner__title,
.hero-banner__lede,
.hero-banner__actions {
  opacity: 1;
  transform: none;
}
.hero-banner.js-motion .hero-banner__brand,
.hero-banner.js-motion .hero-banner__title,
.hero-banner.js-motion .hero-banner__lede,
.hero-banner.js-motion .hero-banner__actions {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.hero-banner.js-motion.is-ready .hero-banner__brand {
  opacity: 1;
  transform: none;
  transition-delay: 0.08s;
}
.hero-banner.js-motion.is-ready .hero-banner__title {
  opacity: 1;
  transform: none;
  transition-delay: 0.18s;
}
.hero-banner.js-motion.is-ready .hero-banner__lede {
  opacity: 1;
  transform: none;
  transition-delay: 0.28s;
}
.hero-banner.js-motion.is-ready .hero-banner__actions {
  opacity: 1;
  transform: none;
  transition-delay: 0.38s;
}
@media (prefers-reduced-motion: reduce) {
  .hero-banner__media img,
  .hero-banner.js-motion .hero-banner__brand,
  .hero-banner.js-motion .hero-banner__title,
  .hero-banner.js-motion .hero-banner__lede,
  .hero-banner.js-motion .hero-banner__actions {
    transition: none;
    opacity: 1;
    transform: none;
  }
  .hero-banner__media img { transform: none; }
}

/* Sections */
.section { margin-bottom: 32px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
}
.section-head a {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.section-head a:hover { color: var(--accent); text-decoration: none; }
.section-head a i { margin-left: 4px; font-size: 11px; }

.cat-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow: visible;
  padding-bottom: 4px;
}
.cat-chip {
  flex: 0 1 auto;
  padding: 10px 14px;
  border-radius: var(--r);
  background: var(--card);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.cat-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
  background: var(--accent-soft);
}

/* Book grid / cards */
.book-grid,
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.book-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  container-type: inline-size;
}
.book-card:hover {
  border-color: #d4c8bc;
  box-shadow: var(--shadow-soft);
}
.book-card__cover {
  aspect-ratio: 3 / 4;
  background: linear-gradient(160deg, #ebe4da, #ddd4c8);
  display: grid;
  place-items: center;
  color: var(--muted);
  overflow: hidden;
  container-type: size;
}
.book-card__cover:hover { text-decoration: none; }
.cover-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: inherit;
}
.cover-placeholder i {
  font-size: 48cqmin;
  line-height: 1;
  opacity: 0.38;
}
.book-card__body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.book-card__title {
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-card__title:hover { color: var(--accent); text-decoration: none; }
.book-card__author {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.book-card__price {
  font-weight: 700;
  font-size: 14px;
  margin-top: auto;
  padding-top: 6px;
  font-variant-numeric: tabular-nums;
}
.book-card__actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  align-items: stretch;
}
.book-card__actions > .btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 36px;
  height: 36px;
  font-size: 12px;
  padding: 0 8px;
  white-space: nowrap;
}
.book-card__actions form {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
}
.book-card__actions form .btn {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  height: 36px;
  font-size: 12px;
  padding: 0 8px;
  gap: 4px;
  white-space: nowrap;
}
.book-card__add-label {
  overflow: hidden;
  text-overflow: ellipsis;
}
@container (max-width: 160px) {
  .book-card__actions form {
    flex: 0 0 36px;
  }
  .book-card__actions form .btn {
    width: 36px;
    padding: 0;
    gap: 0;
  }
  .book-card__add-label { display: none; }
}
.cover-img { width: 100%; height: 100%; object-fit: cover; }

/* List layout */
.layout-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
.filters {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
}
.filters label,
.stack label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin: 10px 0 6px;
  font-weight: 500;
}
.filters label:first-child,
.stack label:first-of-type { margin-top: 0; }
.filters input,
.filters select,
.stack input,
.stack select,
.stack textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px;
  font: inherit;
  background: #fff;
  min-height: var(--touch);
}
/* Keep radios/checkboxes native — do not inherit text-field box styles */
.filters input[type="checkbox"],
.filters input[type="radio"],
.stack input[type="checkbox"],
.stack input[type="radio"] {
  display: inline-block;
  width: auto;
  max-width: none;
  height: auto;
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  vertical-align: middle;
  flex: none;
}
.filters input:focus,
.filters select:focus,
.stack input:focus,
.stack select:focus,
.stack textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.filters .select2-container { display: block; font: inherit; }
.filters .select2-container--default .select2-selection--single {
  height: var(--touch);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: #fff;
  display: flex;
  align-items: center;
}
.filters .select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--ink);
  line-height: 1.3;
  padding-left: 12px;
  padding-right: 32px;
}
.filters .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
  right: 8px;
}
.filters .select2-container--default.select2-container--focus .select2-selection--single,
.filters .select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
  outline: none;
}
.filter-cat-dropdown {
  border-color: var(--line);
  border-radius: var(--r);
  font-family: inherit;
  overflow: hidden;
  z-index: 50;
}
.filter-cat-dropdown .select2-search--dropdown { padding: 8px; }
.filter-cat-dropdown .select2-search__field {
  border: 1px solid var(--line);
  border-radius: var(--r);
  min-height: 40px;
  padding: 8px 10px;
  font: inherit;
  color: var(--ink);
}
.filter-cat-dropdown .select2-search__field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.filter-cat-dropdown .select2-results__option {
  white-space: normal;
  line-height: 1.35;
  padding: 8px 12px;
}
.filter-cat-dropdown .select2-results__option--highlighted[aria-selected] {
  background: var(--accent);
  color: var(--accent-ink);
}
.filters input[type="checkbox"]:focus,
.filters input[type="radio"]:focus,
.stack input[type="checkbox"]:focus,
.stack input[type="radio"]:focus {
  border-color: transparent;
  box-shadow: none;
}
.stack textarea { min-height: 88px; resize: vertical; }

/* PDP — BookCom layout × CKG brand */
.pdp-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
}
.pdp-crumb a { color: var(--muted); text-decoration: none; }
.pdp-crumb a:hover { color: var(--accent); text-decoration: underline; }
.pdp-crumb .sep { opacity: 0.45; }
.pdp-crumb .current {
  color: var(--ink);
  max-width: min(100%, 28rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pdp-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-soft);
}
.pdp-hero__cover,
.detail__cover {
  aspect-ratio: 3 / 4;
  max-width: 280px;
  margin-inline: auto;
  width: 100%;
  background: linear-gradient(160deg, #ebe4da, #ddd4c8);
  border-radius: var(--r);
  display: grid;
  place-items: center;
  color: var(--muted);
  overflow: hidden;
  border: 1px solid var(--line);
  container-type: size;
}
.pdp-hero__cover .cover-img,
.detail__cover .cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pdp-title {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: clamp(22px, 4vw, 30px);
  line-height: 1.25;
  font-weight: 700;
}
.pdp-author {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--muted);
}
.pdp-blurb {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  max-width: 42rem;
}
.pdp-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 14px;
}
.pdp-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}
.pdp-chip:hover { filter: brightness(0.97); text-decoration: none; }
.pdp-isbn { font-size: 13px; color: var(--muted); }
.pdp-price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.price-was {
  font-size: 15px;
  color: var(--muted);
  text-decoration: line-through;
  font-variant-numeric: tabular-nums;
}
.detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
}
.detail h1 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: clamp(22px, 4vw, 30px);
  line-height: 1.25;
  font-weight: 700;
}
.detail-meta {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 4px;
}
.detail-desc {
  margin: 16px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 15px;
  color: var(--ink);
}
.price-lg {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.stock-ok { color: #1f5c38; font-size: 14px; font-weight: 500; }
.stock-out { color: var(--accent); font-size: 14px; font-weight: 600; }
.book-card__actions .stock-out {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  font-size: 12px;
  text-align: center;
}
.buy-box { margin-top: 18px; }
.buy-box .qty-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 14px;
}
.qty-stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: #fff;
}
.qty-stepper button {
  width: var(--touch);
  min-width: var(--touch);
  min-height: var(--touch);
  border: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.qty-stepper button:hover { color: var(--accent); }
.qty-stepper button:active { background: var(--line); }
.qty-stepper button:disabled { opacity: 0.4; cursor: not-allowed; }
.qty-stepper input[type="number"] {
  width: 3.5rem;
  min-height: var(--touch);
  border: 0;
  border-inline: 1px solid var(--line);
  text-align: center;
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  -moz-appearance: textfield;
  appearance: textfield;
  padding: 0;
  border-radius: 0;
  background: #fff;
}
.qty-stepper input[type="number"]::-webkit-outer-spin-button,
.qty-stepper input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.buy-box .btn-accent { width: 100%; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  font-size: 14px;
  color: var(--muted);
}
.back-link:hover { color: var(--accent); text-decoration: none; }

.pdp-tabs {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0 0 18px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-soft);
}
.pdp-tabs__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid var(--line);
  padding: 0 8px;
  margin-bottom: 16px;
}
.pdp-tabs__tab {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.pdp-tabs__tab:hover { color: var(--ink); }
.pdp-tabs__tab.is-on {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.pdp-tabs__panel { padding: 0 18px; }
.pdp-tabs__panel[hidden] { display: none !important; }
.pdp-prose {
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  max-width: 48rem;
}
.pdp-spec {
  margin: 0;
  display: grid;
  gap: 10px;
  max-width: 40rem;
}
.pdp-spec > div {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.pdp-spec dt {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}
.pdp-spec dd { margin: 0; color: var(--ink); }
.pdp-author-block {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}
.pdp-author-block__img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--bg);
}
.pdp-author-block__name {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
}
.pdp-related { margin-top: 8px; margin-bottom: 24px; }

/* Cart */
.cart-layout {
  display: grid;
  gap: 20px;
  align-items: start;
}
.cart-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cart-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.cart-item__cover {
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(160deg, #ebe4da, #ddd4c8);
  display: grid;
  place-items: center;
  color: var(--muted);
  container-type: size;
}
.cart-item__cover:hover { text-decoration: none; }
.cart-item__cover .cover-placeholder { width: 100%; height: 100%; }
.cart-item__cover .cover-placeholder i { font-size: 28cqmin; opacity: 0.4; }
.cart-item__info { min-width: 0; }
.cart-item__title {
  display: block;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  margin-bottom: 4px;
}
.cart-item__title:hover { color: var(--accent); text-decoration: none; }
.cart-item__meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.cart-item__price {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.cart-item__controls {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding-top: 4px;
}
.cart-item__subtotal {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}
.cart-item__remove {
  min-height: 36px;
  height: 36px;
  padding: 0 10px;
  color: var(--muted);
}
.cart-item__remove:hover { color: var(--accent); }
.cart-summary {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
}
.cart-summary p { margin: 8px 0; }
.cart-summary .btn { width: 100%; margin-top: 8px; }
.cart-summary .btn-ghost { width: 100%; }

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
}
.table th,
.table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}
.table th {
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0.02em;
}
.table tr:last-child td { border-bottom: 0; }
.muted { color: var(--muted); font-size: 13px; }
.qty { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Auth / account */
.auth-card,
.account-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 24px;
  max-width: 420px;
}
.auth-card h1,
.account-card h1 {
  font-family: var(--serif);
  font-weight: 700;
}
.stack .btn { margin-top: 16px; }

/* Checkout */
.checkout-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.shipping-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
/* Higher specificity than `.stack label` (display:block) so radio stays inline */
.stack label.shipping-option,
label.shipping-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.stack label.shipping-option:hover,
label.shipping-option:hover { border-color: #c4b5a5; }
.stack label.shipping-option.is-selected,
label.shipping-option.is-selected {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 1px var(--accent);
}
.stack label.shipping-option input[type="radio"],
.shipping-option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  margin: 0.25em 0 0;
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  min-height: 0;
  padding: 0;
  border: 1.5px solid #b8aea3;
  border-radius: 50%;
  background: #fff;
  box-shadow: none;
  align-self: flex-start;
  cursor: pointer;
}
.stack label.shipping-option input[type="radio"]:checked,
.shipping-option input[type="radio"]:checked {
  border-color: var(--accent);
  background:
    radial-gradient(circle, var(--accent) 0 40%, transparent 42%),
    #fff;
}
.stack label.shipping-option input[type="radio"]:focus-visible,
.shipping-option input[type="radio"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.shipping-option__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.shipping-option__title {
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.shipping-option__title i { color: var(--accent); width: 1.1em; text-align: center; }
.shipping-option__desc,
.shipping-option__hint,
.checkout-hint { font-size: 13px; }
.req-mark { color: var(--accent); font-weight: 700; }
.checkout-ship-panel { margin-top: 4px; }
.checkout-summary p { margin: 8px 0; }
.checkout-summary h2 {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 16px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--card);
  padding: 28px 0;
  margin-top: auto;
  font-size: 13px;
  color: var(--muted);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
.footer-brand {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
}
.footer-label {
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.footer-label i { color: var(--accent); font-size: 13px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

.empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
}
.empty .btn { margin-top: 8px; }
.pager {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 22px;
  flex-wrap: wrap;
}
.pager a,
.pager span {
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13px;
  color: var(--ink);
}
.pager a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pager .is-on {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

form.is-busy { opacity: 0.65; pointer-events: none; }

@media (min-width: 768px) {
  :root { --gutter: 24px; }
  .nav-toggle { display: none; }
  .header-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    max-height: var(--header-max);
    width: 100%;
  }
  .logo {
    flex: 0 0 auto;
  }
  .logo__mark { font-size: 20px; }
  .logo__text { font-size: 19px; }
  .search {
    flex: 1 1 auto;
    width: auto;
    min-width: 220px;
    max-width: none;
  }
  .header-actions {
    flex: 0 0 auto;
    margin-left: auto;
    gap: 8px;
    font-size: 14px;
  }
  .header-register { display: inline-flex; align-items: center; justify-content: center; }
  .icon-link__text { display: inline; }
  .header-actions .btn-sm {
    height: var(--touch);
    min-height: var(--touch);
  }
  .book-grid,
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
  .cart-label { display: none; }
  .nav-cats {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 4px 16px;
    font-size: 14px;
    padding: 0 0 12px;
    scrollbar-width: thin;
  }
  .nav-cats a { white-space: nowrap; }
  body.nav-open { overflow: auto; }
  body.nav-open .nav-backdrop { display: none; }
  body.nav-open .nav-cats {
    position: static;
    width: auto;
    height: auto;
    padding: 0 0 12px;
    box-shadow: none;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  body.nav-open .nav-cats a {
    padding: 8px 2px;
    min-height: 36px;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    color: var(--muted);
  }
  body.nav-open .nav-cats a:hover,
  body.nav-open .nav-cats a.is-on {
    color: var(--ink);
    border-bottom-color: var(--accent);
  }
  .main {
    --main-pad-y: 28px;
    padding: 28px 0 56px;
  }
  .hero-banner {
    min-height: min(78dvh, 680px);
    margin-bottom: 40px;
  }
  .hero-banner__content { padding: 64px 0 56px; }
  .hero-banner__lede { font-size: 16px; }
  .section-head h2 { font-size: 22px; }
  .book-grid,
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
  }
  .book-card__title { font-size: 14px; }
  .book-card__author { font-size: 12px; }
  .layout-2 { grid-template-columns: 220px 1fr; gap: 24px; }
  .detail {
    grid-template-columns: 280px 1fr;
    gap: 32px;
    padding: 28px;
  }
  .pdp-hero {
    grid-template-columns: minmax(220px, 320px) 1fr;
    gap: 32px;
    padding: 28px;
  }
  .pdp-hero__cover,
  .detail__cover { margin-inline: 0; max-width: none; }
  .buy-box .btn-accent { width: auto; min-width: 220px; }
  .pdp-author-block { grid-template-columns: 112px 1fr; gap: 20px; }
  .pdp-author-block__img { width: 112px; height: 112px; }
  .checkout-grid { grid-template-columns: 1.1fr 0.9fr; gap: 20px; }
  .shipping-options { grid-template-columns: 1fr 1fr; }
  .cart-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 24px;
  }
  .cart-item {
    grid-template-columns: 88px minmax(0, 1fr) auto;
    align-items: center;
  }
  .cart-item__controls {
    grid-column: auto;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    padding-top: 0;
  }
  .cart-item__subtotal { margin-left: 0; font-size: 15px; }
  .cart-summary {
    position: sticky;
    top: 96px;
  }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; }
  .btn { min-height: 42px; }
}

.booklist-nav__label {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.booklist-nav nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.booklist-nav a {
  display: block;
  padding: 8px 10px;
  border-radius: var(--r);
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
}
.booklist-nav a:hover {
  background: var(--bg);
  color: var(--accent);
}
.booklist-section {
  margin-top: 22px;
}
.booklist-section h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
}
.booklist-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px;
  margin-bottom: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.booklist-row__cover {
  position: relative;
  flex: 0 0 72px;
  width: 72px;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(160deg, #ebe4da, #ddd4c8);
  display: grid;
  place-items: center;
  color: var(--muted);
}
.booklist-row__cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.booklist-row__cover .cover-placeholder i { font-size: 22px; }
.booklist-row__main { min-width: 0; flex: 1; }
.booklist-row h4 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
}
.booklist-row__meta,
.booklist-row__price,
.booklist-row__notes {
  margin: 0 0 4px;
  font-size: 14px;
  color: var(--muted);
}
.booklist-row__price strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.booklist-row__notes { color: var(--accent); }
.booklist-flag {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  vertical-align: 2px;
}
.booklist-flag--ink {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
}
.booklist-row__qty { flex: 0 0 auto; }
.booklist-row .qty-stepper button i { font-size: 14px; }
@media (max-width: 720px) {
  .booklist-row { flex-wrap: wrap; }
  .booklist-row__main { flex: 1 1 160px; }
  .booklist-row__qty { margin-left: auto; }
}

@media (max-width: 380px) {
  .cart-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
}
