/* ============================================================
   Atlas Bookshop — site styles (reads tokens from themes.css)
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root { color-scheme: light dark; }
html { scroll-behavior: smooth; }
html.booting *, html.booting *::before, html.booting *::after { transition: none !important; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  transition: background-color .35s ease, color .35s ease;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
::selection { background: var(--accent); color: var(--accent-ink); }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 56px); }
.serif { font-family: Fraunces, Georgia, serif; }

/* ---------- buttons & chips ---------- */
.btn {
  border: 0; border-radius: 999px; padding: 0 24px; min-height: 48px;
  font: 600 15px "Plus Jakarta Sans", sans-serif; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ink); color: var(--bg);
  transition: translate .2s ease, box-shadow .2s ease, background-color .35s ease, color .35s ease;
}
.btn:hover { translate: 0 -2px; box-shadow: var(--lift); }
.btn:active { translate: 0 0; }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn.ghost.on-hero { border-color: var(--hero-chip-line); color: var(--on-hero); }
.btn.glass { background: var(--hero-chip); color: var(--on-hero); border: 1px solid var(--hero-chip-line); backdrop-filter: blur(14px); }
.btn.sm { min-height: 40px; padding: 0 18px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; translate: none !important; box-shadow: none !important; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px; font-size: 12.5px; font-weight: 600; color: var(--muted);
  background: var(--surface);
  transition: background-color .35s ease, color .35s ease;
}
.chip.accent { border-color: transparent; background: var(--accent); color: var(--accent-ink); }
.chip.soft { background: var(--alt); }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.chip.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  transition: background-color .35s ease, box-shadow .3s ease, border-color .3s ease;
}
.site-header.scrolled {
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(20px) saturate(1.2); -webkit-backdrop-filter: blur(20px) saturate(1.2);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .1);
}
.site-header .wrap { display: flex; align-items: center; gap: 18px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 11px; font: 700 20px "Plus Jakarta Sans", sans-serif; flex-shrink: 0; }
.brand img { width: 44px; height: 37px; object-fit: contain; }
.brand .sub { font-weight: 500; color: var(--muted); }
.main-nav { display: flex; gap: 4px; margin: 0 auto; flex-wrap: wrap; }
.main-nav a {
  font-size: 14px; font-weight: 500; padding: 8px 14px; border-radius: 999px;
  color: var(--muted); transition: color .15s ease, background-color .15s ease;
}
.main-nav a:hover { color: var(--ink); background: var(--alt); }
.main-nav a.active { color: var(--ink); background: var(--alt); font-weight: 600; }
.head-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.icon-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); display: grid; place-items: center;
  transition: translate .15s ease, background-color .2s ease, border-color .2s ease;
}
.icon-btn:hover { translate: 0 -2px; border-color: var(--accent); color: var(--accent-deep); }
.cart-btn { position: relative; background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.cart-btn b {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px;
  border-radius: 10px; background: var(--ink); color: var(--bg);
  font: 700 12px "Plus Jakarta Sans", sans-serif; display: grid; place-items: center; padding: 0 5px;
}
.theme-btn img { width: 20px; height: 20px; border-radius: 50%; object-fit: contain; }

/* hero-embedded header variant */
.on-dark { --ink: var(--on-hero); --muted: var(--on-hero-muted); --line: var(--hero-chip-line); --surface: transparent; --alt: var(--hero-chip); }
.hero-header { position: relative; z-index: 5; background: transparent; border-bottom: 1px solid var(--hero-chip-line); backdrop-filter: blur(6px); }
.hero-header .main-nav a { color: var(--on-hero-muted); }
.hero-header .main-nav a:hover, .hero-header .main-nav a.active { color: var(--on-hero); background: var(--hero-chip); }
.hero-header .icon-btn { background: var(--hero-chip); color: var(--on-hero); border-color: var(--hero-chip-line); }
.hero-header .brand, .hero-header .brand .sub { color: var(--on-hero); }
.hero-header .brand .sub { color: var(--on-hero-muted); }
.hero-header .cart-btn { background: var(--accent); color: var(--accent-ink); }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; color: var(--on-hero);
  background: var(--hero-grad);
  min-height: 720px; display: flex; flex-direction: column;
  transition: background .35s ease;
}
.hero-waves { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.wave-g { animation: wave-slide var(--dur, 24s) linear infinite; will-change: transform; }
@keyframes wave-slide { to { transform: translateX(-1200px); } }

.hero-body {
  position: relative; z-index: 2; flex: 1;
  display: flex; flex-wrap: wrap; gap: 32px; padding: clamp(28px, 5vw, 56px) 0 0;
  justify-content: space-between; align-items: flex-start;
}
.hero-copy { max-width: 660px; }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; padding: 8px 16px; font-size: 13px; font-weight: 600;
  background: var(--hero-chip); border: 1px solid var(--hero-chip-line); color: var(--on-hero);
  backdrop-filter: blur(14px);
}
.hero h1 {
  font: 700 clamp(38px, 5.4vw, 70px)/1.02 "Plus Jakarta Sans", sans-serif;
  letter-spacing: -.03em; margin: 22px 0;
}
.hero h1 .grad {
  background: linear-gradient(90deg, var(--wave-2), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lede { font-size: 17px; line-height: 1.6; color: var(--on-hero-muted); max-width: 540px; margin: 0 0 28px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-card {
  width: 320px; border-radius: 22px; padding: 18px 20px;
  background: var(--hero-chip); border: 1px solid var(--hero-chip-line);
  backdrop-filter: blur(14px); color: var(--on-hero);
  display: flex; align-items: center; gap: 14px;
  transition: translate .25s ease, background-color .2s ease;
}
.hero-card:hover { translate: 0 -5px; background: color-mix(in srgb, var(--hero-chip) 80%, white 6%); }
.hero-card b { display: block; font-size: 15px; }
.hero-card span { font-size: 13px; color: var(--on-hero-muted); }
.hero-card .go {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--hero-chip); border: 1px solid var(--hero-chip-line);
}
.hero-quick {
  position: relative; z-index: 2;
  margin: clamp(28px, 4vw, 48px) 0 30px; border-radius: 24px; padding: 14px 24px;
  display: flex; flex-wrap: wrap; gap: 14px 30px; align-items: center;
  background: var(--hero-bar); border: 1px solid var(--hero-chip-line); backdrop-filter: blur(12px);
}
.hero-quick a { display: flex; gap: 12px; align-items: center; border-radius: 14px; padding: 6px 8px; transition: background-color .2s ease; }
.hero-quick a:hover { background: var(--hero-chip); }
.hero-quick .ico {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--hero-chip); border: 1px solid var(--hero-chip-line); color: var(--on-hero);
}
.hero-quick b { display: block; font-size: 14px; color: var(--on-hero); }
.hero-quick span { font-size: 12px; color: var(--on-hero-muted); }
.hero-quick .pager { margin-left: auto; font-size: 13px; color: var(--on-hero-muted); }

/* ---------- entrance motion ---------- */
.in { opacity: 0; animation: rise-in .8s cubic-bezier(.2,.7,.3,1) both; }
@keyframes rise-in { from { opacity: 0; translate: 0 26px; } to { opacity: 1; translate: 0 0; } }
.reveal { opacity: 0; translate: 0 30px; transition: opacity .7s ease, translate .7s cubic-bezier(.2,.7,.3,1); }
.reveal.show { opacity: 1; translate: 0 0; }

/* ---------- sections ---------- */
.section { padding: clamp(48px, 7vw, 84px) 0; }
.section.alt { background: var(--alt); transition: background-color .35s ease; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.sec-title { font: 600 clamp(26px, 3.4vw, 38px)/1.15 Fraunces, Georgia, serif; letter-spacing: -.01em; }
.underline { display: block; width: 46px; height: 3px; background: var(--accent); border-radius: 2px; margin: 14px 0 32px; }
.sec-link { font-weight: 600; color: var(--accent-deep); display: inline-flex; gap: 6px; align-items: center; }
.sec-link:hover { gap: 10px; transition: gap .2s ease; }

/* ---------- category cards ---------- */
.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.cat-card {
  display: flex; flex-direction: column; gap: 8px; min-height: 176px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  transition: translate .25s ease, box-shadow .25s ease, background-color .35s ease, border-color .35s ease;
}
.cat-card:hover { translate: 0 -6px; box-shadow: var(--lift); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.cat-card small { color: var(--accent-deep); font-weight: 700; font-size: 12px; letter-spacing: .08em; }
.cat-card b { font: 600 21px/1.18 Fraunces, Georgia, serif; }
.cat-card p { color: var(--muted); font-size: 14px; line-height: 1.5; }
.cat-card em { margin-top: auto; font-style: normal; font-weight: 700; color: var(--accent-deep); font-size: 14px; display: flex; align-items: center; gap: 6px; }
.cat-card:hover em { gap: 10px; }

/* ---------- product cards ---------- */
.grid-books { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 20px 18px; }
.book-card { display: flex; flex-direction: column; gap: 10px; }
.book-card .cover {
  position: relative; border-radius: 4px 12px 12px 4px; overflow: hidden;
  aspect-ratio: 2/3; background: var(--alt);
  box-shadow: var(--shadow); transition: translate .25s ease, box-shadow .25s ease;
  display: block;
}
.book-card:hover .cover { translate: 0 -6px; box-shadow: var(--lift); }
.book-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.book-card .cover .fmt-tag {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  border-radius: 999px; padding: 4px 10px; font-size: 11px; font-weight: 700; letter-spacing: .06em;
}
.fmt-soft { background: var(--cv-4); color: var(--cv-4-ink); }
.fmt-hard { background: var(--cv-2); color: var(--cv-2-ink); }
.fmt-stat { background: var(--cv-3); color: var(--cv-3-ink); }
.book-card h3 { font: 600 17px/1.3 Fraunces, Georgia, serif; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.book-card .meta { color: var(--muted); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.book-card .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.price { font-weight: 700; font-size: 15px; }
.price small { font-weight: 600; color: var(--muted); font-size: 12px; }
.add-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 0; flex-shrink: 0;
  background: var(--ink); color: var(--bg); font-size: 20px; line-height: 1;
  transition: translate .2s ease, background-color .2s ease, color .2s ease;
}
.add-btn:hover { translate: 0 -2px; background: var(--accent); color: var(--accent-ink); }
.add-btn.added { background: var(--ok); color: #fff; }

/* ---------- search overlay ---------- */
.search-pop {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 18px 48px rgba(0,0,0,.18); overflow: hidden;
  display: none;
}
.search-pop.open { display: block; animation: pop .18s ease both; }
@keyframes pop { from { opacity: 0; translate: 0 -6px; } }
.search-pop .s-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  transition: background-color .12s ease;
}
.search-pop .s-item:hover { background: var(--alt); }
.search-pop .s-item img { width: 40px; height: 54px; object-fit: cover; border-radius: 3px 7px 7px 3px; background: var(--alt); }
.search-pop .s-item b { font-size: 14px; font-weight: 600; }
.search-pop .s-item b mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.search-pop .s-item span { display: block; font-size: 12.5px; color: var(--muted); }
.search-pop .s-item .sp { margin-left: auto; font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.search-pop .s-all { display: block; width: 100%; text-align: left; padding: 14px 16px; border: 0; background: var(--alt); font-weight: 700; color: var(--accent-deep); }

/* ---------- shop layout ---------- */
.shop-head { padding: 28px 0 8px; }
.shop-layout { display: grid; grid-template-columns: 1fr; gap: 0; align-items: start; padding-bottom: 80px; }

/* floating filter panel (opens from the FAB) */
.filter-fab {
  display: inline-flex; align-items: center; gap: 9px;
  border: 1px solid var(--line); border-radius: 999px; padding: 10px 18px;
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px;
  transition: translate .15s ease, border-color .15s ease, background-color .2s ease;
}
.filter-fab:hover { translate: 0 -2px; border-color: var(--accent); color: var(--accent-deep); }
.filter-fab .fab-badge {
  min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px;
  background: var(--accent); color: var(--accent-ink);
  font: 700 12px "Plus Jakarta Sans", sans-serif; display: grid; place-items: center;
}
.filter-fab .fab-badge.zero { display: none; }
.shop-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.results-count { color: var(--muted); font-size: 14px; }
.sort-select {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--surface);
  font-weight: 600; font-size: 14px; cursor: pointer;
}
.active-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.active-filters .chip { cursor: pointer; }
.active-filters .chip:hover { background: var(--alt); }
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 36px; flex-wrap: wrap; }
.pagination button {
  min-width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 600; font-size: 14px;
}
.pagination button.cur { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pagination button:hover:not(.cur):not([disabled]) { border-color: var(--accent); color: var(--accent-deep); }
.pagination button[disabled] { opacity: .4; cursor: default; }

/* ---------- book page ---------- */
.book-layout { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: clamp(28px, 5vw, 72px); padding: 44px 0 84px; align-items: start; }
.spine-wrap { position: sticky; top: 96px; }
.spine {
  position: relative; aspect-ratio: 2/3; border-radius: 4px 16px 16px 4px; overflow: hidden;
  box-shadow: var(--lift); background: var(--alt);
  display: flex; flex-direction: column; justify-content: flex-end; padding: 22px;
  transition: background-color .35s ease;
}
.spine::before {
  content: ""; position: absolute; inset: 0 0 0 10px;
  box-shadow: inset 1px 0 0 color-mix(in srgb, white 18%, transparent), inset 6px 0 10px -6px rgba(0,0,0,.35);
  pointer-events: none;
}
.spine img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.spine .sp-label { position: relative; z-index: 2; font: 600 clamp(24px, 2.6vw, 34px)/1.12 Fraunces, Georgia, serif; }
.spine .sp-tag { position: relative; z-index: 2; font: 700 10px "Plus Jakarta Sans", sans-serif; letter-spacing: .14em; margin-bottom: 8px; opacity: .85; }
.spine .sp-shine {
  position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.16) 45%, transparent 60%);
}
.breadcrumbs { color: var(--muted); font-size: 13px; margin-bottom: 18px; display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumbs a:hover { color: var(--accent-deep); }
.book-info h1 { font: 600 clamp(30px, 3.6vw, 46px)/1.1 Fraunces, Georgia, serif; letter-spacing: -.01em; margin-bottom: 16px; }
.spec-list { display: grid; gap: 7px; margin: 18px 0; }
.spec-list .row2 { display: flex; gap: 10px; font-size: 14.5px; }
.spec-list .k { color: var(--muted); min-width: 110px; }
.book-price-row { display: flex; align-items: baseline; gap: 14px; margin: 20px 0 6px; }
.big-price { font: 700 34px/1 "Plus Jakarta Sans", sans-serif; }
.stock-line { color: var(--ok); font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 7px; margin-bottom: 22px; }
.stock-line.out { color: var(--bad); }
.buy-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 26px; }
.alt-format-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 26px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.book-desc { color: var(--ink); line-height: 1.75; max-width: 640px; white-space: pre-line; }
.book-desc h3 { font: 600 20px Fraunces, Georgia, serif; margin: 26px 0 10px; }

/* ---------- floating panels (cart popover, filter panel) ---------- */
.drawer-veil {
  position: fixed; inset: 0; background: rgba(15, 10, 6, .28); z-index: 90;
  opacity: 0; pointer-events: none; transition: opacity .25s ease; backdrop-filter: blur(2px);
}
.drawer-veil.open { opacity: 1; pointer-events: auto; }
.pop-panel {
  position: fixed; z-index: 95;
  width: min(430px, calc(100vw - 20px));
  max-height: min(680px, calc(100vh - 110px));
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(24px) saturate(1.3); -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 26px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .3), 0 4px 18px rgba(0, 0, 0, .12);
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateY(-12px) scale(.96); pointer-events: none;
  transition: opacity .22s ease, transform .3s cubic-bezier(.2, .7, .3, 1);
}
.pop-panel.open { opacity: 1; transform: none; pointer-events: auto; }
.pop-panel.cart { transform-origin: top right; }
.pop-panel.filters {
  transform-origin: top left;
  width: min(370px, calc(100vw - 20px));
}

.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 14px; border-bottom: 1px solid var(--line); }
.cart-head h2 { font: 600 24px Fraunces, Georgia, serif; }
.cart-items { flex: 1 1 auto; overflow-y: auto; padding: 4px 22px; min-height: 0; }
.cart-item { display: flex; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.cart-item:last-child { border-bottom: 0; }
.cart-item .fmt-tag, .s-item .fmt-tag { display: none; }
.cart-item img { width: 52px; height: 72px; object-fit: cover; border-radius: 3px 8px 8px 3px; background: var(--alt); }
.cart-item .ci-body { flex: 1; min-width: 0; }
.cart-item b { font-size: 14px; font-weight: 600; display: block; line-height: 1.35; }
.cart-item span { font-size: 12.5px; color: var(--muted); }
.qty { display: inline-flex; align-items: center; gap: 10px; margin-top: 8px; }
.qty button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 15px; color: var(--ink); }
.qty button:hover { border-color: var(--accent); color: var(--accent-deep); }
.cart-foot { border-top: 1px solid var(--line); padding: 16px 22px 20px; display: flex; flex-direction: column; gap: 11px; background: color-mix(in srgb, var(--bg) 45%, transparent); }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; font-size: 18px; }
.cart-empty { text-align: center; color: var(--muted); padding: 54px 20px; }
.cart-empty .big { font-size: 44px; margin-bottom: 12px; }

/* filter panel internals */
.filter-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--line);
}
.filter-panel-head h3 { font: 600 20px Fraunces, Georgia, serif; display: flex; align-items: center; gap: 10px; }
.filter-panel-body { flex: 1 1 auto; overflow-y: auto; padding: 20px 20px 26px; display: flex; flex-direction: column; gap: 22px; min-height: 0; }
.filter-panel-foot { border-top: 1px solid var(--line); padding: 14px 20px 18px; display: flex; gap: 10px; }
.filter-panel-foot .btn { flex: 1; }
.filter-group h4 { font: 600 17px Fraunces, Georgia, serif; margin-bottom: 10px; }
.f-check { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 14px; color: var(--muted); cursor: pointer; }
.f-check input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.f-check:hover { color: var(--ink); }
.f-count { margin-left: auto; font-size: 11.5px; color: var(--muted); opacity: .8; }
.price-slider { width: 100%; accent-color: var(--accent); }

/* ---------- checkout ---------- */
.checkout-layout { display: grid; grid-template-columns: 1fr 380px; gap: 32px; align-items: start; padding: 36px 0 90px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 26px; transition: background-color .35s ease, border-color .35s ease; }
.panel h2 { font: 600 22px Fraunces, Georgia, serif; margin-bottom: 16px; }
.panel + .panel { margin-top: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field textarea, .field select {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  background: var(--bg); min-height: 46px; width: 100%;
  transition: border-color .15s ease, background-color .35s ease;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.field .err { color: var(--bad); font-size: 12.5px; font-weight: 600; display: none; }
.field.invalid input { border-color: var(--bad); }
.field.invalid .err { display: block; }
.f-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.pay-methods { display: grid; gap: 12px; }
.pay-method {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 16px;
  border: 1.5px solid var(--line); background: var(--bg); cursor: pointer;
  transition: border-color .15s ease, background-color .35s ease;
}
.pay-method:hover { border-color: var(--accent); }
.pay-method.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--bg)); }
.pay-method input { accent-color: var(--accent); margin-top: 3px; }
.pay-method b { font-size: 15px; }
.pay-method p { font-size: 13px; color: var(--muted); margin-top: 3px; }
.pay-method .pm-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--alt); flex-shrink: 0; }
.summary-line { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; font-size: 14.5px; padding: 7px 0; }
.summary-line .sl-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-line b { white-space: nowrap; flex-shrink: 0; }
.summary-line.total { font-weight: 700; font-size: 17px; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; }
.summary-line.total .sl-name { white-space: normal; }
.order-code-box {
  background: var(--alt); border: 1px dashed var(--accent-deep); border-radius: 16px;
  padding: 18px; text-align: center; margin: 14px 0;
}
.order-code-box .code { font: 700 26px ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .12em; color: var(--accent-deep); }
.order-code-box p { font-size: 13px; color: var(--muted); margin-top: 8px; }
.proof-drop {
  border: 2px dashed var(--line); border-radius: 16px; padding: 22px; text-align: center;
  cursor: pointer; transition: border-color .15s ease, background-color .2s ease;
}
.proof-drop:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, transparent); }
.proof-drop img { max-height: 220px; margin: 10px auto 0; border-radius: 10px; }
.steps { display: flex; gap: 6px; align-items: center; margin-bottom: 22px; color: var(--muted); font-size: 13.5px; flex-wrap: wrap; }
.steps .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line); font-weight: 700; font-size: 12px; }
.steps .dot.done { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps .sep { width: 26px; height: 1.5px; background: var(--line); }

/* ---------- toast ---------- */
.toast-zone { position: fixed; bottom: 22px; left: 50%; translate: -50% 0; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: var(--bg); border-radius: 999px; padding: 11px 20px;
  font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  animation: toast-in .3s ease both; display: flex; gap: 9px; align-items: center; max-width: 90vw;
}
.toast.ok { background: var(--ok); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
@keyframes toast-in { from { opacity: 0; translate: 0 12px; } }
.toast.hide { opacity: 0; transition: opacity .3s ease; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 56px 0 30px; margin-top: 40px; transition: border-color .35s ease; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1.3fr 1fr; gap: 32px; }
.site-footer h3 { font: 600 20px Fraunces, Georgia, serif; margin-bottom: 14px; }
.site-footer .about-blurb { color: var(--muted); font-size: 14px; line-height: 1.65; max-width: 300px; }
.f-link { display: block; padding: 5px 0; font-size: 14px; color: var(--muted); }
.f-link:hover { color: var(--accent-deep); }
.f-note { color: var(--muted); font-size: 14px; line-height: 1.7; }
.footer-base { border-top: 1px solid var(--line); margin-top: 40px; padding-top: 18px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.social-row { display: flex; gap: 10px; margin-top: 14px; }
.social-row a {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--muted);
  transition: color .15s ease, border-color .15s ease, translate .15s ease;
}
.social-row a:hover { color: var(--accent-deep); border-color: var(--accent); translate: 0 -2px; }

/* ---------- admin ---------- */
.admin-shell { min-height: 100vh; display: flex; flex-direction: column; }
.login-wrap { flex: 1; display: grid; place-items: center; padding: 40px 16px; }
.login-card { width: min(420px, 100%); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; }
.stat-card .n { font: 700 30px/1 "Plus Jakarta Sans", sans-serif; }
.stat-card .l { color: var(--muted); font-size: 13px; margin-top: 6px; }
.stat-card.warn .n { color: var(--accent-deep); }
.order-row { display: grid; grid-template-columns: 130px 1fr 110px 110px 120px; gap: 12px; align-items: center; padding: 13px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); margin-bottom: 10px; transition: translate .15s ease; cursor: pointer; }
.order-row:hover { translate: 0 -2px; border-color: var(--accent); }
.order-row .ocode { font: 700 14px ui-monospace, Menlo, monospace; letter-spacing: .04em; }
.order-row .ocust b { display: block; font-size: 14px; }
.order-row .ocust span { color: var(--muted); font-size: 12.5px; }
.order-row .oamt { font-weight: 700; text-align: right; }
.order-row .oact { display: flex; gap: 6px; justify-content: flex-end; }
.status-chip { font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 4px 10px; letter-spacing: .04em; text-transform: uppercase; }
.st-awaiting { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-deep); }
.st-submitted { background: color-mix(in srgb, #C77E00 16%, transparent); color: #9A6200; }
.st-confirmed { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.st-pending { background: color-mix(in srgb, #8862C8 16%, transparent); color: #6A44A8; }
.st-delivered { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.st-rejected { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.admin-tabs { display: flex; gap: 6px; margin-bottom: 22px; flex-wrap: wrap; }
.admin-tabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 9px 18px; font-weight: 600; font-size: 14px; color: var(--muted); }
.admin-tabs button.cur { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.modal-veil { position: fixed; inset: 0; z-index: 120; background: rgba(15, 9, 6, .5); display: none; place-items: center; padding: 18px; backdrop-filter: blur(3px); }
.modal-veil.open { display: grid; }
.modal { background: var(--bg); border-radius: 22px; width: min(640px, 100%); max-height: 88vh; overflow-y: auto; padding: 26px; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.modal h2 { font: 600 24px Fraunces, Georgia, serif; }
.proof-view { border-radius: 14px; max-height: 320px; margin: 12px 0; }

/* ---------- page transitions ---------- */
body { animation: page-in .4s cubic-bezier(.2,.7,.3,1) both; }
body.page-leave { animation: page-out .28s ease both; }
@keyframes page-in { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }
@keyframes page-out { to { opacity: 0; translate: 0 -10px; } }

.step-in { animation: rise-in .45s cubic-bezier(.2,.7,.3,1) both; }

/* ---------- account / auth ---------- */
.auth-tabs { display: flex; gap: 6px; background: var(--alt); border-radius: 999px; padding: 4px; margin-bottom: 20px; }
.auth-tabs button { flex: 1; border: 0; background: transparent; border-radius: 999px; padding: 10px 0; font-weight: 600; font-size: 14px; color: var(--muted); }
.auth-tabs button.cur { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.ts-box { display: flex; justify-content: center; min-height: 62px; align-items: center; margin-top: 4px; }
.ts-box .ts-loading { color: var(--muted); font-size: 13px; }
.ts-box.fallback { justify-content: flex-start; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font: 700 22px "Plus Jakarta Sans", sans-serif;
  flex-shrink: 0;
}
.order-mini { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.order-mini:last-child { border-bottom: 0; }
.order-mini .ocode { font: 700 14px ui-monospace, Menlo, monospace; letter-spacing: .04em; }
.order-mini .oamt { font-weight: 700; font-size: 14.5px; }
.account-btn.logged {
  background: var(--accent); color: var(--accent-ink); border-color: transparent;
  font: 700 16px "Plus Jakarta Sans", sans-serif;
}

/* ---------- misc ---------- */
.empty-note { color: var(--muted); text-align: center; padding: 50px 0; }
.notice { background: color-mix(in srgb, var(--accent) 10%, var(--bg)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: 14px; padding: 12px 16px; font-size: 13.5px; color: var(--ink); }
.skeleton { background: linear-gradient(90deg, var(--alt) 25%, color-mix(in srgb, var(--alt) 60%, var(--surface)) 50%, var(--alt) 75%); background-size: 200% 100%; animation: sk 1.2s ease infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .book-layout { grid-template-columns: 1fr; }
  .spine-wrap { position: static; max-width: 380px; width: 100%; margin: 0 auto; }
  .checkout-layout { grid-template-columns: 1fr; }
  .order-row { grid-template-columns: 1fr auto; }
  .order-row .ocust { grid-column: 1; }
}
@media (max-width: 760px) {
  .main-nav { display: none; }
  .main-nav.open {
    display: flex; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 12px 18px 18px; gap: 2px; box-shadow: 0 18px 40px rgba(0,0,0,.14);
  }
  .nav-burger { display: grid !important; }
  .hero-card { width: 100%; }
  .footer-grid { grid-template-columns: 1fr; }
  .f-grid { grid-template-columns: 1fr; }
  .hero { min-height: 640px; }
}
.nav-burger { display: none; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); place-items: center; }

/* mobile bottom tab bar (from the mockup's mobile layout) */
.tabbar { display: none; }
@media (max-width: 760px) {
  .tabbar {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: 10px; z-index: 80;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--line); border-radius: 999px; padding: 6px;
    box-shadow: 0 12px 30px rgba(0,0,0,.18);
  }
  .tabbar a {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
    padding: 11px 0; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--muted);
    transition: background-color .2s ease, color .2s ease;
  }
  .tabbar a.active { background: var(--accent); color: var(--accent-ink); }
  .tabbar a .tb-badge {
    min-width: 17px; height: 17px; border-radius: 9px; padding: 0 4px;
    background: var(--ink); color: var(--bg); font-size: 10.5px; font-weight: 700;
    display: grid; place-items: center;
  }
  body { padding-bottom: 76px; }
  .toast-zone { bottom: 86px; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .wave-g { animation: none !important; }
  .in, .reveal { opacity: 1 !important; translate: 0 0 !important; }
}
