/* Berk: same look as the old berk.al (Rubik, mint #adcdc4, grey menu bar, dark footer), cleaned up. */

/* Fonts never swap after the page has rendered (font-display: optional), so they cannot shift the layout.
   They are preloaded, so in practice they are always ready; if one is ever late, the page keeps the
   fallback below, which is sized to Rubik's metrics so it takes the same space.
   The files are trimmed to the characters the site uses (scripts/subset-fonts.sh; keep the ranges in step with it);
   the Cyrillic part is a separate file the browser only fetches when a page shows Cyrillic text. */
@font-face { font-family: "Rubik"; src: url("/fonts/Rubik-Regular.woff2") format("woff2"); font-weight: 400; font-display: optional; unicode-range: U+0000-00FF, U+0100-017F, U+0218-021B, U+02BC, U+02C6, U+02DA, U+02DC, U+0300-036F, U+2000-206F, U+20AC, U+2116, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Rubik"; src: url("/fonts/Rubik-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: optional; unicode-range: U+0000-00FF, U+0100-017F, U+0218-021B, U+02BC, U+02C6, U+02DA, U+02DC, U+0300-036F, U+2000-206F, U+20AC, U+2116, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Rubik"; src: url("/fonts/Rubik-Medium.woff2") format("woff2"); font-weight: 500; font-display: optional; unicode-range: U+0000-00FF, U+0100-017F, U+0218-021B, U+02BC, U+02C6, U+02DA, U+02DC, U+0300-036F, U+2000-206F, U+20AC, U+2116, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Rubik"; src: url("/fonts/Rubik-Bold.woff2") format("woff2"); font-weight: 700; font-display: optional; unicode-range: U+0000-00FF, U+0100-017F, U+0218-021B, U+02BC, U+02C6, U+02DA, U+02DC, U+0300-036F, U+2000-206F, U+20AC, U+2116, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Rubik"; src: url("/fonts/Rubik-Regular-cyrillic.woff2") format("woff2"); font-weight: 400; font-display: optional; unicode-range: U+0400-045F; }
@font-face { font-family: "Rubik"; src: url("/fonts/Rubik-Italic-cyrillic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: optional; unicode-range: U+0400-045F; }
@font-face { font-family: "Rubik"; src: url("/fonts/Rubik-Medium-cyrillic.woff2") format("woff2"); font-weight: 500; font-display: optional; unicode-range: U+0400-045F; }
@font-face { font-family: "Rubik"; src: url("/fonts/Rubik-Bold-cyrillic.woff2") format("woff2"); font-weight: 700; font-display: optional; unicode-range: U+0400-045F; }
@font-face { font-family: "Rubik Fallback"; src: local("Arial"), local("ArialMT"), local("Liberation Sans"); size-adjust: 105.73%; ascent-override: 88.43%; descent-override: 23.64%; line-gap-override: 0%; }

:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);          /* strong ease-out: entrances, lifts */
  --ease-out-quad: cubic-bezier(0.25, 0.46, 0.45, 0.94); /* button press */
  --ink: #030303;
  --text: #1d1d1d;
  --muted: #5f5f5f;
  --mint: #adcdc4;
  --mint-dark: #5d8f81;     /* mint dark enough for text on white */
  --purple: #9e94c9;        /* the purple logo on the Rreth nesh section */
  --grey: #ededed;
  --line: #dcdcdc;
  --panel: #f4f4f4;
  --footer: #171717;
  --radius: 4px;
  --wrap: 1200px;
  --font: "Rubik", "Rubik Fallback", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 20px; scrollbar-gutter: stable; } /* no sideways jump between short and long pages */
body { margin: 0; font: 400 16px/1.65 var(--font); color: var(--text); background: #fff; display: flex; flex-direction: column; min-height: 100vh; }
body { overflow-x: clip; } /* safety net: nothing may make the page scroll sideways (clip keeps position: sticky working) */
main { flex: 1 0 auto; padding-bottom: 72px; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: var(--mint); text-underline-offset: 3px; }
a:hover { color: var(--mint-dark); }
h1, h2, h3 { color: var(--ink); line-height: 1.2; font-weight: 700; }
:focus-visible { outline: 2px solid var(--mint-dark); outline-offset: 2px; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.wrap.narrow { max-width: 820px; }
.center { text-align: center; }
.sr-only, .hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 50; background: #fff; padding: 8px 12px; }

/* ---------- logo (mask of the large logo file: sharp at every size) ---------- */
.logo { display: inline-block; background: var(--mint); -webkit-mask: url("/img/logo-mask.png") center / contain no-repeat; mask: url("/img/logo-mask.png") center / contain no-repeat; aspect-ratio: 956 / 863; }
.logo-top { height: 124px; }
.logo-footer { height: 124px; }
.logo-purple { width: min(100%, 460px); background: var(--purple); }

/* ---------- header ---------- */
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding-top: 20px; padding-bottom: 20px; }
.social { display: flex; gap: 4px; }
.social a { display: inline-flex; width: 40px; height: 40px; align-items: center; justify-content: center; border-radius: 50%; transition: background 150ms ease-out, transform 150ms ease-out; }
.social a:hover { background: var(--grey); }
.social svg { width: 24px; height: 24px; }
.social-round { justify-content: center; gap: 20px; margin-top: 20px; }
.social-round a { width: 52px; height: 52px; }
.social-round svg { width: 40px; height: 40px; }
.social-round a:hover { background: none; transform: translateY(-2px); }
.logo-link { display: block; line-height: 0; }
.account { justify-self: end; display: flex; align-items: center; gap: 6px; font-size: 0.95rem; font-weight: 500; }
.account a { text-decoration: none; }
.account form { display: inline; margin: 0; }
.account .sep { color: #b5b5b5; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.linklike:hover { color: var(--mint-dark); }

.menubar { background: var(--grey); }
.menubar-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 60px; }
.wordmark { font-size: 1.75rem; font-weight: 500; letter-spacing: 0.02em; text-decoration: none; color: var(--ink); }
.menu-links { list-style: none; display: flex; gap: 8px; margin: 0; padding: 0; }
.menu-links a { position: relative; display: block; padding: 17px 22px; font-size: 1.2rem; font-weight: 500; color: var(--ink); text-decoration: none; }
.menu-links a::before { content: ""; position: absolute; left: 22px; right: 22px; top: 0; height: 4px; border-radius: 0 0 50px 50px; background: var(--mint); transform: scaleX(0); transition: transform 180ms ease-out; }
.menu-links a:hover::before, .menu-links a.active::before { transform: scaleX(1); }
.menu-links a.active { font-weight: 700; }
/* Reserve the bold width up front: an invisible, zero-height copy of the label in the selected weight,
   so selecting an item (or the font loading) never changes its width and the neighbours never move. */
.menu-links a, .shelf-tabs label { display: inline-flex; flex-direction: column; align-items: center; }
.menu-links a::after, .shelf-tabs label::after { content: attr(data-text); content: attr(data-text) / ""; height: 0; overflow: hidden; visibility: hidden; pointer-events: none; user-select: none; }
.menu-links a::after { font-weight: 700; }
.shelf-tabs label::after { font-weight: 500; }
.mobile-menu { display: none; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 22px; border: 1px solid var(--ink); border-radius: var(--radius);
  background: var(--ink); color: #fff; font: 500 1rem/1.2 var(--font); text-decoration: none; cursor: pointer; transition: background 150ms ease, color 150ms ease, transform 160ms var(--ease-out-quad); }
.btn:hover { background: #2b2b2b; color: #fff; }
.btn:active { transform: scale(0.97); }
.btn-sm { padding: 7px 14px; font-size: 0.92rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; padding: 14px; font-size: 1.1rem; }
.btn-outline { background: #fff; color: var(--ink); }
.btn-outline:hover { background: var(--grey); color: var(--ink); }
.btn-mint { background: var(--mint); border-color: var(--mint); color: var(--ink); }
.btn-mint:hover { background: #9bc0b5; color: var(--ink); }

label { display: grid; gap: 6px; font-weight: 500; font-size: 0.95rem; color: var(--ink); }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea { width: 100%; font: 400 1rem/1.4 var(--font); color: var(--ink); padding: 11px 13px; border: 1px solid #cfcfcf; border-radius: var(--radius); background: #fff; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--mint-dark); box-shadow: 0 0 0 3px #adcdc466; }
.stack { display: grid; gap: 18px; }
.note { color: var(--muted); font-size: 0.95rem; }
.error { background: #fbeaea; color: #8a1f1f; border-left: 4px solid #c64545; padding: 12px 16px; }
.flash { background: #eef6f3; color: #2a5a4c; border-left: 4px solid var(--mint-dark); padding: 12px 16px; margin: 24px 0; }
.empty { padding: 40px 0; color: var(--muted); }

/* ---------- headings ---------- */
.page-title { font-size: clamp(1.7rem, 3vw, 2.2rem); margin: 48px 0 24px; }
.section-title { display: inline-block; font-size: 1.75rem; font-weight: 500; margin: 0 0 32px; padding-bottom: 18px; border-bottom: 1px solid var(--ink); }
.section-title.center { display: table; margin-left: auto; margin-right: auto; }
.block { margin-top: 72px; }

/* ---------- home ---------- */
.hero { margin-top: 40px; }
.hero img { width: 100%; max-width: 960px; margin: 0 auto; }
.category-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px; }
.category-tiles a { display: grid; justify-items: center; text-decoration: none; color: var(--ink); }
.category-tiles img { width: 124px; height: 124px; transition: transform 240ms var(--ease-out); }
.category-tiles span { width: 100%; text-align: center; border-top: 1px solid var(--ink); margin-top: 30px; padding-top: 36px; font-size: 1.05rem; }


.shelf-radio { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; opacity: 0; pointer-events: none; }
.shelf-tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-bottom: 36px; }
.shelf-tabs label { cursor: pointer; padding: 8px 16px; font-size: 1.1rem; font-weight: 400; border-radius: var(--radius); }
.shelf-tabs label:hover { background: var(--grey); }
.shelf { display: none; }
#shelf-rinj:checked ~ .shelf-rinj, #shelf-shitur:checked ~ .shelf-shitur, #shelf-rekomanduar:checked ~ .shelf-rekomanduar { display: block; }
#shelf-rinj:checked ~ .shelf-tabs label[for="shelf-rinj"],
#shelf-shitur:checked ~ .shelf-tabs label[for="shelf-shitur"],
#shelf-rekomanduar:checked ~ .shelf-tabs label[for="shelf-rekomanduar"] { background: var(--mint); color: var(--ink); font-weight: 500; }
#shelf-rinj:focus-visible ~ .shelf-tabs label[for="shelf-rinj"],
#shelf-shitur:focus-visible ~ .shelf-tabs label[for="shelf-shitur"],
#shelf-rekomanduar:focus-visible ~ .shelf-tabs label[for="shelf-rekomanduar"] { outline: 2px solid var(--mint-dark); }
.shelves > .center { margin-top: 40px; }

.home-contact { display: grid; grid-template-columns: 2fr 1fr; gap: 64px; align-items: start; }
.home-contact .section-title { font-size: 2.2rem; font-weight: 700; text-transform: uppercase; border: 0; padding: 0; }
.follow { text-align: center; padding-top: 12px; }
.follow .section-title { font-size: 1.75rem; }

.contact-form .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; margin-bottom: 20px; }
.contact-form .full { grid-column: 1 / -1; }

/* ---------- book cards (catalog, shelves, related) ---------- */
.book-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 48px 32px; }
.book-grid.four { grid-template-columns: repeat(4, 1fr); }
.book-card { display: flex; flex-direction: column; align-items: center; text-align: center; height: 100%; }
.book-link { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--ink); width: 100%; }
.cover-frame { position: relative; width: 100%; aspect-ratio: 3 / 4; margin-bottom: 14px; }
/* Covers come in different proportions: fit each inside the same box, sitting on a common baseline. */
.cover-frame img { position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; width: 100%; height: 100%; object-fit: contain; object-position: bottom; box-shadow: 0 1px 3px #0002, 0 10px 24px -14px #0007; transition: transform 240ms var(--ease-out), box-shadow 240ms var(--ease-out); }
.cover-frame .cover-blank { position: absolute; left: 14%; right: 14%; bottom: 0; width: auto; }
.cover-blank { width: 72%; aspect-ratio: 2 / 3; display: flex; align-items: flex-end; padding: 14px; text-align: left; background: var(--mint); color: var(--ink); font-weight: 500; }
.book-title { font-size: 1.12rem; line-height: 1.35; min-height: 2.7em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.book-price { font-weight: 700; font-size: 1.1rem; margin: auto 0 12px; padding-top: 6px; color: var(--ink); }

/* ---------- catalog ---------- */
.catalog { display: grid; grid-template-columns: 240px 1fr; gap: 48px; margin-top: 48px; align-items: start; }
.sidebar { position: sticky; top: 24px; }
.sidebar .section-title { display: block; font-size: 1.5rem; margin-bottom: 20px; }
.cat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cat-list a { display: block; padding: 7px 12px; margin-left: -12px; border-left: 3px solid transparent; text-decoration: none; }
.cat-list a:hover { background: var(--panel); color: var(--ink); }
.cat-list a.active { border-left-color: var(--mint); background: #adcdc433; font-weight: 500; color: var(--ink); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; }
.toolbar input[type="search"] { flex: 1 1 260px; width: auto; }
.toolbar select { flex: 0 1 230px; width: auto; }
.result-count { color: var(--muted); margin: 14px 0 32px; font-size: 0.95rem; }

/* ---------- book detail ---------- */
.crumbs { margin: 32px 0 24px; font-size: 0.92rem; color: var(--muted); }
.crumbs a { text-decoration: none; } .crumbs span { margin: 0 6px; color: #b5b5b5; }
.book-detail { display: grid; grid-template-columns: minmax(240px, 420px) 1fr; gap: 56px; align-items: start; }
.detail-cover { background: var(--panel); padding: 40px; display: flex; justify-content: center; }
.detail-cover img { width: min(100%, calc(520px * var(--r, 0.75))); height: auto; aspect-ratio: var(--ar, 3 / 4); object-fit: contain; box-shadow: 0 2px 4px #0002, 0 18px 40px -18px #0009; }
.detail-cover .cover-blank { width: 260px; }
.detail-info h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); margin: 0 0 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.detail-price { font-size: 1.5rem; font-weight: 700; color: var(--ink); margin: 0 0 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.detail-actions form { margin: 0; }
.detail-actions .note { flex-basis: 100%; margin: 4px 0 0; }
.facts { margin: 32px 0 0; display: grid; gap: 8px; font-size: 0.95rem; }
.facts div { display: grid; grid-template-columns: 110px 1fr; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }
.description { background: var(--panel); padding: 36px 40px; margin-top: 48px; }
.description h2 { font-size: 1.2rem; text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 16px; }
.prose { font-size: 1.05rem; line-height: 1.85; max-width: 75ch; }
.prose p { margin: 0 0 1em; }
.prose h2 { font-size: 1.3rem; margin: 2em 0 0.6em; }
.prose h3 { font-size: 1.1rem; margin: 1.6em 0 0.5em; }
.prose li { margin-bottom: 0.4em; }

/* ---------- tour & gallery ---------- */
.tour { aspect-ratio: 16 / 9; background: var(--panel); margin-bottom: 24px; }
.tour iframe { width: 100%; height: 100%; border: 0; display: block; }
.gallery { list-style: none; margin: 0; padding: 0; columns: 4 260px; column-gap: 24px; }
.gallery li { break-inside: avoid; margin-bottom: 24px; }
.gallery img { width: 100%; height: auto; transition: opacity 150ms ease-out; }
.gallery a:hover img { opacity: 0.88; }

/* ---------- kontakt ---------- */
.about { background: var(--grey); padding: 56px 0; }
.about-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.about h1 { font-size: 2rem; margin: 0 0 16px; }
.about-logo { display: flex; justify-content: center; }
.split { display: grid; grid-template-columns: 1fr 1fr; margin-top: 64px; background: var(--grey); }
.split img { width: 100%; height: 100%; object-fit: cover; min-height: 420px; }
.split.reverse img { order: 2; }
.split-text { padding: 56px; align-self: center; }
.split-text h2 { font-size: 1.9rem; margin: 0 0 16px; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; }
.contact-list { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 10px; font-size: 1.05rem; }
.contact-list span { display: inline-block; min-width: 80px; color: var(--muted); }
.map { width: 100%; aspect-ratio: 4 / 3; border: 0; }

/* ---------- account ---------- */
.auth { max-width: 520px; }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 18px; font-size: 0.92rem; }
/* ---------- flipbook reader (public/js/reader.js) ---------- */
.rd { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 420px; background: var(--grey); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.rd:fullscreen { height: 100vh; }
.rd-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.rd-left { display: flex; align-items: baseline; gap: 16px; min-width: 0; }
.rd-left a { white-space: nowrap; font-size: .95rem; }
.rd-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-controls { display: flex; align-items: center; gap: 4px; }
.rd-controls[hidden] { visibility: hidden; } /* keeps the toolbar's height while the book loads */
.rd-btn { min-width: 40px; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; font: inherit; font-size: 1.25rem; line-height: 1; cursor: pointer; color: var(--ink); }
.rd-btn:hover { background: var(--grey); }
.rd-btn[hidden] { display: none; }
.rd-pages { display: inline-flex; align-items: center; gap: 6px; padding: 0 6px; font-size: .95rem; color: var(--muted); }
.rd-jump { width: 4.6em; height: 40px; padding: 0 6px; text-align: center; font: inherit; color: var(--ink); -webkit-user-select: text; user-select: text; }
.rd-sep { width: 1px; height: 24px; background: var(--line); margin: 0 6px; }
.rd-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 12px; }
.rd-stage.rd-zoomed { overflow: auto; align-items: flex-start; justify-content: flex-start; }
.rd-host { margin: auto; flex: none; }
.rd-book { margin: 0 auto; }
.rd-page { background: #fff; overflow: hidden; }
.rd-page:not(.ready) { background: #fafafa linear-gradient(90deg, #fafafa 0, #f0f0f0 50%, #fafafa 100%); }
.rd-page img { display: block; width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; }
.rd-status { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; padding: 24px; text-align: center; color: var(--muted); }
.rd-status[hidden] { display: none; }
.rd-lockmsg { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; margin: 0; padding: 24px; text-align: center; font-weight: 500; background: var(--grey); }
.rd-locked .rd-lockmsg { display: flex; }
.rd-locked .rd-host { visibility: hidden; }
.rd-note { margin: 0; padding: 10px 16px; background: #fff; border-top: 1px solid var(--line); text-align: center; font-size: .95rem; }
.rd-print { display: none; }
@media (max-width: 560px) {
  .rd-bar { padding: 6px 8px; }
  .rd-left { width: 100%; }
  .rd-controls { width: 100%; justify-content: space-between; }
  .rd-sep { display: none; }
}
@media (max-width: 380px) {
  .rd-controls { gap: 2px; }
  .rd-btn { min-width: 34px; padding: 0 6px; }
}
/* No printing of books: the page prints a notice only. */
@media print {
  body:has(.rd) > * { display: none !important; }
  body:has(.rd) > main, body:has(.rd) main > * { display: block !important; }
  body:has(.rd) .rd > :not(.rd-print) { display: none !important; }
  body:has(.rd) .rd-print { display: block !important; padding: 40px; font-size: 18px; }
}

/* ---------- admin ---------- */
.admin .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 0 0 32px; }
.admin .stats div { background: var(--panel); padding: 14px 16px; }
.admin dt { font-size: 0.82rem; color: var(--muted); } .admin dd { margin: 4px 0 0; font-size: 1.7rem; font-weight: 700; }
.panel { border: 1px solid var(--line); padding: 24px; margin-bottom: 28px; overflow-x: auto; }
.panel h2 { font-size: 1.25rem; margin: 0 0 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row input { flex: 1 1 220px; width: auto; } .row select { flex: 2 1 260px; width: auto; }
.pills { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.pills a { padding: 4px 12px; border: 1px solid var(--line); text-decoration: none; font-size: 0.9rem; }
.pills a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
td.msg { white-space: pre-wrap; max-width: 520px; }
.tag { font-size: 0.78rem; padding: 2px 8px; background: var(--panel); }
.tag.paid { background: #adcdc455; } .tag.pending { background: #fbd44455; } .tag.failed, .tag.cancelled { background: #f3c7c7; }

/* ---------- footer ---------- */
.site-footer { background: var(--footer); color: #fff; }
.footer-cols { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 32px; align-items: start; padding-top: 28px; padding-bottom: 28px; }
.footer-cols > a { justify-self: center; line-height: 0; }
.footer-cols ul { list-style: none; margin: 0; padding: 22px 0 0; display: grid; gap: 8px; font-size: 0.95rem; }
.footer-cols a { color: #fff; text-decoration: none; }
.footer-cols a:hover { color: var(--mint); }
.copyright { background: #000; color: #a2a2a2; text-align: center; font-size: 0.9rem; padding: 16px 24px; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .book-grid, .book-grid.four { grid-template-columns: repeat(3, 1fr); }
  .catalog { grid-template-columns: 1fr; gap: 24px; }
  .sidebar { position: static; }
  .sidebar .section-title { display: none; }
  .cat-list { display: flex; flex-wrap: wrap; gap: 8px; }
  .cat-list a { margin: 0; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; }
  .cat-list a.active { border-color: var(--mint); }
  .home-contact, .contact-grid { grid-template-columns: 1fr; gap: 48px; }
}
@media (max-width: 820px) {
  .topbar { grid-template-columns: auto 1fr auto; padding-top: 12px; padding-bottom: 12px; }
  .topbar .social, .topbar .account { display: none; }
  .topbar .logo-link { grid-column: 2; justify-self: center; }
  .logo-top { height: 72px; }
  .menubar-inner { grid-template-columns: 1fr auto; min-height: 54px; }
  .menubar-inner > .menu-links { display: none; }
  .mobile-menu { display: block; }
  .mobile-menu summary { list-style: none; cursor: pointer; padding: 10px; margin-right: -10px; line-height: 0; }
  .mobile-menu summary::-webkit-details-marker { display: none; }
  .mobile-menu summary svg { width: 28px; height: 28px; fill: var(--ink); }
  .mobile-panel { position: absolute; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 12px 24px -12px #0004; padding: 8px 24px 24px; z-index: 20; }
  .mobile-panel .menu-links { flex-direction: column; gap: 0; }
  .mobile-panel .menu-links a { display: flex; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--grey); }
  .mobile-panel .menu-links a::before { left: -24px; right: auto; top: 0; bottom: 0; width: 4px; height: auto; border-radius: 0 50px 50px 0; }
  .mobile-account { display: flex; gap: 8px; align-items: center; padding: 16px 0; font-weight: 500; }
  .mobile-account form { margin: 0; }
  .menubar { position: relative; }
  .category-tiles { grid-template-columns: repeat(2, 1fr); gap: 36px 20px; }
  .category-tiles img { width: 96px; height: 96px; }
  .category-tiles span { margin-top: 18px; padding-top: 18px; }
  .book-detail { grid-template-columns: 1fr; gap: 28px; }
  .detail-cover { padding: 28px; }
  .detail-cover img { width: min(100%, calc(380px * var(--r, 0.75))); }
  .description { padding: 24px; margin-left: -24px; margin-right: -24px; }
  .about-inner, .split { grid-template-columns: 1fr; }
  .split img { height: auto; min-height: 0; aspect-ratio: 4 / 3; }
  .about-logo { order: -1; } .about-logo .logo { width: 200px; }
  .split.reverse img { order: 0; }
  .split img { min-height: 0; aspect-ratio: 4 / 3; }
  .split-text { padding: 32px 24px; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
  .footer-cols > a { grid-column: 1 / -1; }
  .logo-footer { height: 90px; }
}
@media (max-width: 560px) {
  .book-grid, .book-grid.four { grid-template-columns: repeat(2, 1fr); gap: 36px 16px; }
  .book-title { font-size: 1rem; }
  .contact-form .form-grid { grid-template-columns: 1fr; }
  .home-contact .section-title { font-size: 1.8rem; }
  .toolbar select { flex: 1 1 100%; }
}

/* Page-to-page navigation: the browser shows the next page only once it is ready and cross-fades the content,
   while the header stays still. Supported in current Chrome, Edge and Safari; others navigate as before. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .site-header { view-transition-name: site-header; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 140ms; }
}

/* ---------- motion ----------
   Small and quick: strong ease-out, only transform and opacity (no layout work, so no layout shift),
   nothing on actions that repeat all day. Lists come in one item after another, 40 ms apart, capped so
   the last item never waits more than ~0.4 s. With reduced motion: a plain fade, no movement. */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes drop { from { opacity: 0; transform: translateY(-6px) scale(0.98); } }
.book-grid > li, .category-tiles > li, .gallery > li, .cat-list > li { --i: 10; }
:is(.book-grid, .category-tiles, .gallery, .cat-list) > li:nth-child(1) { --i: 0; }
:is(.book-grid, .category-tiles, .gallery, .cat-list) > li:nth-child(2) { --i: 1; }
:is(.book-grid, .category-tiles, .gallery, .cat-list) > li:nth-child(3) { --i: 2; }
:is(.book-grid, .category-tiles, .gallery, .cat-list) > li:nth-child(4) { --i: 3; }
:is(.book-grid, .category-tiles, .gallery, .cat-list) > li:nth-child(5) { --i: 4; }
:is(.book-grid, .category-tiles, .gallery, .cat-list) > li:nth-child(6) { --i: 5; }
:is(.book-grid, .category-tiles, .gallery, .cat-list) > li:nth-child(7) { --i: 6; }
:is(.book-grid, .category-tiles, .gallery, .cat-list) > li:nth-child(8) { --i: 7; }
:is(.book-grid, .category-tiles, .gallery, .cat-list) > li:nth-child(9) { --i: 8; }
:is(.book-grid, .category-tiles, .gallery, .cat-list) > li:nth-child(10) { --i: 9; }

@media (prefers-reduced-motion: no-preference) {
  .book-grid > li, .category-tiles > li, .gallery > li { animation: rise 460ms var(--ease-out) backwards; animation-delay: calc(var(--i) * 40ms); }
  .cat-list > li { animation: fade 360ms ease backwards; animation-delay: calc(var(--i) * 25ms); } /* secondary: fades only */
  .flash { animation: rise 360ms var(--ease-out) backwards; }
  .mobile-menu[open] .mobile-panel { transform-origin: top center; animation: drop 220ms var(--ease-out); }
  .menu-links a::before { transition-timing-function: var(--ease-out); transition-duration: 240ms; }
}
@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
  .book-link:hover .cover-frame img { transform: translateY(-4px); box-shadow: 0 2px 4px #0002, 0 16px 30px -14px #0008; }
  .category-tiles a:hover img { transform: translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-property: opacity, background-color, color, border-color, box-shadow !important; }
  .btn:active { transform: none; }
  .book-grid > li, .category-tiles > li, .gallery > li, .flash { animation: fade 240ms ease backwards; }
}
