/* Lesewurm Club — styles. Mobile first: base = phone, then 640 / 768 / 1024 / 1280. */

:root {
  --bg: #FCF8EA;
  --header-bg: #FBF6E7;
  --hero-bg: #F7F0DC;
  --surface: #FBF8EC;
  --footer-bg: #EDEAD6;
  --green: #1E4224;
  --green-hover: #163219;
  --nav-text: #1E3A22;
  --text: #1F2620;
  --text-soft: #283229;
  --muted: #5F665D;
  --line: #E1E0CE;
  --line-soft: #E5E3D1;
  --input-line: #CCCEBB;
  --pill-bg: #EDE9D6;
  --age-bg: #E3E9D2;
  --age-text: #3C5A34;
  --check-line: #8D978B;
  --icon-muted: #3E5A40;
  --serif: "Merriweather", Georgia, "Times New Roman", serif;
  /* System font first: SF Pro on Apple devices (as in iOS apps), Golos Text elsewhere. */
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Golos Text", system-ui, "Segoe UI", sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Golos Text", system-ui, "Segoe UI", sans-serif;

  /* iOS-style surfaces: tinted fills instead of borders, hairline separators. */
  --fill: rgba(120, 112, 80, 0.10);
  --fill-strong: rgba(120, 112, 80, 0.17);
  --tint: rgba(30, 66, 36, 0.09);
  --tint-strong: rgba(30, 66, 36, 0.15);
  --card-bg: #FFFDF7;
  --separator: rgba(70, 64, 40, 0.14);
  --hairline: 0 0 0 0.5px rgba(70, 64, 40, 0.16);
  --ease-ios: cubic-bezier(.32, .72, 0, 1);
}

/* One side gutter for header, hero and catalogue, so the logo, heading, filters and
   books all start on the same left edge. Changes per breakpoint below. */
:root { --gutter: 20px; }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
/* The covers' soft shadows reach past the screen edge on the rightmost card and the big
   book-page cover: they're cut at the page's edge instead of making it scroll sideways.
   clip, unlike hidden, makes no scroll area of its own, so nothing can scroll sideways at all;
   the header sits outside #main and stays sticky. */
#main { overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; }
a { color: var(--green); }
a:hover { color: var(--green-hover); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  padding: 10px 14px; border-radius: 10px; background: var(--green); color: #fff; text-decoration: none;
}
.skip-link:focus { top: 12px; color: #fff; }

#main:focus { outline: none; }
.page-loading, .page-error { padding: 48px 20px; text-align: center; color: var(--muted); }
.noscript { padding: 20px; text-align: center; }

/* ---------- Header ---------- */

/* One sticky row on every screen: logo on the left, menu on the right. On phones the
   «Lesewurm Club» text is left out (the logo link keeps it as its label). */
.site-header {
  position: sticky; top: 0; z-index: 25;
  background: rgba(252, 248, 234, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--separator);
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center; column-gap: 12px;
  padding: 8px var(--gutter);
}

.brand {
  display: flex; align-items: center; gap: 12px;
  min-width: 0; text-decoration: none; color: var(--green);
}
.brand-logo { width: 48px; height: 48px; flex: none; display: block; }   /* transparent: no square behind it */
.brand-name {
  display: none;
  /* Fraunces with its soft, slightly wonky shapes: a bookish serif, but friendly and current. */
  font-family: "Fraunces", var(--serif); font-weight: 650;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 72;
  font-size: 26px; line-height: 30px; letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Nav links as capsules; the current page gets a tinted fill. The negative margin keeps
   the text of the last link on the gutter line. */
.main-nav {
  justify-self: end;
  display: flex; gap: 4px;
  margin: 0 -9px 0 0; padding: 0;
}
.main-nav a {
  padding: 6px 9px; border-radius: 999px; white-space: nowrap;
  font-size: 15px; line-height: 22px; font-weight: 500; letter-spacing: -0.01em;
  color: var(--nav-text); text-decoration: none;
  transition: background-color .2s;
}
.main-nav a:hover { background: var(--fill); color: var(--green-hover); }
.main-nav a[aria-current="page"] { background: var(--tint); color: var(--green); font-weight: 600; }
/* The bold current item would be wider and push the others: each text link also carries an
   invisible bold copy of its label (zero height), so it's always as wide as its bold self. */
.main-nav a[data-label] { display: inline-flex; flex-direction: column; align-items: center; }
.main-nav a[data-label]::after {
  content: attr(data-label); font-weight: 600; height: 0; overflow: hidden; visibility: hidden;
  pointer-events: none; user-select: none; speak: never;
}
/* Telegram: a round tinted icon button in the site's green, sized to the nav capsules. */
.main-nav .nav-telegram {
  flex: none; width: 34px; height: 34px; padding: 0; margin: 0 4px 0 0;
  display: inline-flex; align-items: center; justify-content: center; align-self: center;
  border-radius: 50%; background: none; color: var(--green);
  transition: background-color .2s, transform .15s var(--ease-ios);
}
.main-nav .nav-telegram:hover { background: var(--fill); color: var(--green-hover); }
.main-nav .nav-telegram:active { transform: scale(.92); }
.main-nav .nav-telegram svg { margin-left: -1px; }
/* «Мой список»: a round heart button at the end of the menu, with a count badge. */
.main-nav .nav-list {
  position: relative; flex: none; width: 34px; height: 34px; padding: 0; margin: 0 12px 0 0;   /* double gap before Telegram */
  display: inline-flex; align-items: center; justify-content: center; align-self: center;
  border-radius: 50%; background: var(--tint); color: var(--green);
  transition: background-color .2s, transform .15s var(--ease-ios);
}
.main-nav .nav-list:hover { background: var(--tint-strong); color: var(--green-hover); }
.main-nav .nav-list[aria-current="page"] { background: var(--green); color: #fff; }
.nav-list-count {
  position: absolute; top: -4px; right: -6px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--green); color: #fff; box-shadow: 0 0 0 2px var(--bg);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.nav-list[aria-current="page"] .nav-list-count { background: #fff; color: var(--green); }


/* ---------- Hero / search ---------- */

.hero-inner { padding: 13px var(--gutter) 0; }

.hero-inner { padding-top: 20px; }
.hero h1 {
  margin: 0;
  font-family: var(--display); font-weight: 700; letter-spacing: -0.025em;
  font-size: 32px; line-height: 38px; color: var(--green);
}
.hero-sub, .hero-art { display: none; }

.search {
  position: relative;
  display: flex; align-items: center; gap: 13px;
  height: 44px; margin-top: 14px; padding: 0 6px 0 14px;
  background: var(--fill); border: 0; border-radius: 12px;
  transition: background-color .2s, box-shadow .2s;
}
.search:focus-within { background: var(--card-bg); box-shadow: 0 0 0 3px rgba(30, 66, 36, 0.18); }
.search svg { flex: none; color: #8A8676; width: 19px; height: 19px; }
.search input {
  flex: 1; min-width: 0; height: 100%;
  border: 0; outline: none; background: transparent; padding: 0;
  font-size: 15px; color: var(--text);
}
.search input::placeholder { color: #8A8676; opacity: 1; }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear {
  flex: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: #8A8676; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.search-clear[hidden] { display: none; }
/* The shortcut, shown while the search is empty and not in use — only with a keyboard and mouse. */
.search-kbd {
  display: none; flex: none; margin-right: 6px; padding: 2px 7px;
  border-radius: 6px; background: rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 0 0 0.5px rgba(60, 60, 40, 0.22), 0 1px 0 rgba(60, 60, 40, 0.12);
  font: 600 12px/18px var(--sans); letter-spacing: 0.02em; color: #8A8676;
  pointer-events: none; transition: opacity .15s;
}
@media (hover: hover) and (pointer: fine) {
  .search-kbd { display: block; }
  .search:focus-within .search-kbd { opacity: 0; }
  .search input:not(:placeholder-shown) ~ .search-kbd { display: none; }   /* the clear button's place */
}

/* ---------- Filters: pills (phone/tablet) ---------- */

/* Lives in the toolbar (.results-bar), which scrolls sideways when it doesn't fit. */
.filter-pills { display: flex; flex: none; gap: 8px; }

.pill {
  flex: none;
  height: 34px; padding: 0 12px 0 14px;
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; border-radius: 999px;
  background: var(--fill); color: var(--text);
  font-size: 15px; font-weight: 500; letter-spacing: -0.01em; cursor: pointer; white-space: nowrap;
  transition: background-color .2s, color .2s, transform .15s var(--ease-ios);
}
.pill:hover { background: var(--fill-strong); }
.pill:active { transform: scale(.96); }
.pill[aria-expanded="true"] { background: var(--fill-strong); }
.pill svg { flex: none; }
.pill.is-active, .pill.is-active:hover { background: var(--green); color: #fff; }
.pill-count {
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: -3px;
  border-radius: 9px; background: #fff; color: var(--green);
  font-size: 12px; font-weight: 700; line-height: 18px; text-align: center;
}

/* ---------- Catalog layout ---------- */

.catalog { padding: 0 var(--gutter); }

/* Toolbar: filters, count, size switch and sorting in one row. When it doesn't fit
   (phones, tablets) it scrolls sideways, edge to edge, starting on the gutter line. */
.results-bar {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 8px;
  overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
  margin: 16px calc(-1 * var(--gutter)) 0; padding: 3px var(--gutter);
}
.results-bar::-webkit-scrollbar { display: none; }
/* The count follows the filters; margin-right pushes the size switch and sorting to the right. */
.results-count {
  flex: none; margin: 0 auto 0 6px; white-space: nowrap;
  font-size: 15px; line-height: 20px; font-weight: 500; letter-spacing: -0.01em; color: #7D7968;
}
.results-count .count-mobile { display: none; }
/* Same look as the count around it; the link line (see «Text links») shows it's a link. */
.count-reset {
  padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; color: inherit;
}
.sort { display: block; flex: none; }
.sort select {
  height: 36px; padding: 0 36px 0 14px;
  border: 0; border-radius: 10px;
  background: var(--fill) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 1.5l3 3M3 7.5l3 3 3-3' fill='none' stroke='%231E4224' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 13px center / 11px no-repeat;
  appearance: none; -webkit-appearance: none;
  color: var(--green); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; cursor: pointer;
  transition: background-color .2s;
}
.sort select:hover { background-color: var(--fill-strong); }

/* Compact / large book size switch (desktop only, shown at ≥1024). */
/* iOS segmented control: a tinted track, the selected segment raised in white. */
.view-toggle {
  display: none; flex: none; gap: 2px; padding: 2px;
  border: 0; border-radius: 10px; background: var(--fill);
}
.view-toggle button {
  width: 40px; height: 32px; padding: 0; border: 0; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; color: #7D7968; cursor: pointer;
  transition: background-color .25s var(--ease-ios), color .2s, box-shadow .25s var(--ease-ios);
}
.view-toggle button svg { width: 16px; height: 16px; }
.view-toggle button:hover { color: var(--text); }
.view-toggle button[aria-pressed="true"] {
  background: var(--card-bg); color: var(--green);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}

.reset-link {
  border: 0; background: transparent; padding: 4px 0; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--green); text-decoration: underline; text-underline-offset: 3px;
}
.reset-link[hidden] { display: none; }

.book-grid {
  --cols: 2; --col-gap: 20px; --row-gap: 32px;
  list-style: none; margin: 11px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  column-gap: var(--col-gap); row-gap: var(--row-gap);
}

/* ---------- Book card ---------- */

/* Each card spans two rows of the grid: covers share the first row and sit on its
   bottom edge, like books on a shelf; titles and the rest share the second row. */
.card {
  position: relative;
  display: grid; grid-template-rows: auto 1fr;
  grid-row: span 2; grid-template-rows: subgrid; row-gap: 0;
  padding: 8px 0 4px;                   /* no box: room above for the hover lift */
  border-radius: 9px;                   /* shape of the keyboard focus ring */
}
/* A line between rows, drawn by the first card of every row after the first and
   stretched across the whole grid. Which card that is depends on --cols, so each
   column count below switches the line off for all cards and back on for its own
   row starts (nth-child(Nn+1)). */
.book-grid > .card::before {
  position: absolute; left: 0; pointer-events: none;
  top: calc(var(--row-gap) / -2);
  width: calc(var(--cols) * 100% + (var(--cols) - 1) * var(--col-gap));
  border-top: 0.5px solid var(--separator);
}
.book-grid > .card:nth-child(2n+1):not(:first-child)::before { content: ""; }

.card-cover { align-self: end; justify-self: start; display: block; width: 100%; margin: 0; }   /* left edge in line with the title */
.card-body { display: flex; flex-direction: column; align-items: flex-start; }

/* ---------- 3D book ----------
   A hardcover seen from the front, drawn in CSS around the cover image, so the book
   takes the cover's own proportions. Sizes are in cqw (1cqw = 1/100 of the book width).
     back board  — the rear board in the cover's own colours, curling round the pages
     page block  — the paper edges under the front board
     front cover — the cover image as a board: rounded spine, hinge groove, edge light,
                   paper grain and soft lighting from the top left
   The shadow is soft and neutral, all round the book and heaviest below it. */
.book3d {
  position: relative; display: block; width: 100%;
  container-type: inline-size;
  padding-bottom: 6.5%;                 /* room for the page block and back board */
}
/* The book is a real cover plus prerendered, half-transparent layers (assets/img/book3d,
   made by tools/book3d-layers.py from the values these rules used to compute live): the
   shadow, the page block, and the light on the cover. Nothing is blurred or re-shadowed
   while it moves, so Safari animates it smoothly; the corners are rounded on the image
   itself, which Safari keeps even during the animation. */
.book3d-shadow {
  position: absolute; top: 3cqw; left: 0; right: 1.4cqw; bottom: 0; pointer-events: none;
}
.book3d-shadow::before, .book3d-shadow::after {
  content: ""; position: absolute; top: -13.133%; right: -27.5%; bottom: -43.152%; left: -27.5%;
  background: url("../img/book3d/shadow-rest.png") 0 0 / 100% 100% no-repeat;
}
.book3d-shadow::after { background-image: url("../img/book3d/shadow-lift.png"); opacity: 0; }
.book3d-back {
  position: absolute; top: 3cqw; left: 0; right: 1.4cqw; bottom: 0;
  border-radius: 3.5cqw 2cqw 2.88cqw 3.12cqw;   /* stays inside the cover's top-left curve; wraps round the pages at the bottom */
  /* the board takes the cover's colours, darkened (no blur: only its lower edge shows) */
  background: linear-gradient(rgba(20, 22, 20, 0.5), rgba(20, 22, 20, 0.5)), var(--cover, none) left bottom / cover no-repeat, #3E4A44;
  box-shadow: inset 0 0.25cqw 0 rgba(255, 255, 255, 0.10), inset 0 -0.6cqw 0.6cqw rgba(0, 0, 0, 0.35);
}
.book3d-pages {
  position: absolute; left: 2.2cqw; right: 2.3cqw; bottom: 2.1cqw; height: 3.8cqw;
  background: url("../img/book3d/pages.png") 0 0 / 100% 100% no-repeat;
}
.book3d-front {
  position: relative; z-index: 1; display: block;
  border-radius: 3.5cqw 3.5cqw 3.5cqw 0;   /* square where the cover meets the spine */
  background: var(--pill-bg);
  box-shadow:
    0 0.25cqw 0.35cqw rgba(0, 0, 0, 0.35),        /* front board resting on the pages */
    0 0 0.25cqw rgba(0, 0, 0, 0.30),              /* tight, dark edge shadow round the top */
    0 0 1.2cqw rgba(0, 0, 0, 0.15);               /* shadow round the top, which stands above the back board */
}
.book3d-front img {
  display: block; width: 100%; height: auto; border-radius: inherit;
  aspect-ratio: auto 600 / 640;         /* placeholder shape until the image loads */
}
/* Spine, hinge groove, sheen, edge light and paper grain — one prerendered layer. */
.book3d-front::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  border-radius: inherit;
  background: url("../img/book3d/gloss.png") 0 0 / 100% 100% no-repeat, url("../img/book3d/grain.png") 0 0 / 160px 160px;
}
/* On hover the book lifts a little, as if picked up: the resting shadow fades into a
   larger, softer, lower one. Only transform and opacity change — cheap to animate.
   Transitions switch on once the card has been laid out (.is-settled, set in app.js). */
.card.is-settled .book3d { transition: transform .3s ease; will-change: transform; }
.card.is-settled .book3d-shadow::before, .card.is-settled .book3d-shadow::after { transition: opacity .3s ease; }
/* Paused while the grid is reordered or resized (see moveCards in app.js). */
.book-grid.is-moving .book3d, .book-grid.is-moving .book3d-shadow::before, .book-grid.is-moving .book3d-shadow::after { transition: none; }
.card:hover .book3d { transform: translate3d(0, -6px, 0); }
.card:hover .book3d-shadow::before { opacity: 0; }
.card:hover .book3d-shadow::after { opacity: 1; }

.card-title { margin: 12px 0 0; font-size: 15px; line-height: 20px; font-weight: 600; letter-spacing: -0.01em; }
.card-title a { color: var(--text); text-decoration: none; }
/* At most two lines in the catalogue; a longer title ends with «…». */
.card-title {
  display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.card-title a::after { content: ""; position: absolute; inset: 0; border-radius: 9px; }
.card-title a:focus-visible { outline: none; }
.card:has(.card-title a:focus-visible) { outline: 2px solid var(--green); outline-offset: 2px; }

.card-author { margin: 1px 0 0; font-size: 13px; line-height: 18px; color: var(--muted); }

.age-pill {
  display: inline-flex; align-items: center;
  height: 22px; margin-top: 6px; padding: 0 9px;
  border-radius: 999px; background: var(--tint); color: var(--age-text);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}

/* Age and price on one row: the age pill first, the price after it. */
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 7px; }
.card-meta .age-pill { margin-top: 0; }
.card-price { margin: 0; font-size: 16px; line-height: 20px; font-weight: 700; color: var(--green); }

.more-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; line-height: 20px; font-weight: 600;
  color: var(--green); text-decoration: none;
}
.card-more { margin-top: 7px; position: relative; z-index: 1; }
.card.has-price .card-more { display: none; }
.more-link svg { transition: transform .15s; }
.more-link:hover svg { transform: translateX(3px); }

.load-more {
  display: flex; justify-content: center; margin: 20px 0 8px;
}
.load-more[hidden] { display: none; }

/* iOS-style buttons: flat capsules with generous padding; a filled primary and a
   tinted secondary. Pressing dims and shrinks them slightly, as on iOS. */
.btn-outline, .btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 14px 34px; border-radius: 999px;
  font-size: 17px; font-weight: 600; letter-spacing: -0.015em; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .2s, box-shadow .2s, opacity .15s, transform .2s var(--ease-ios);
}
.btn-outline:active, .btn-primary:active { transform: scale(.96); opacity: .85; }
/* "Tinted" button: the secondary action. */
.btn-outline { border: 0; background: var(--tint); color: var(--green); }
.btn-outline:hover { background: var(--tint-strong); color: var(--green-hover); }
.btn-primary { border: 0; background: #2A5A31; color: #fff; }
.btn-primary:hover { background: var(--green); color: #fff; }

.empty-state {
  grid-column: 1 / -1;
  padding: 36px 16px; text-align: center; color: var(--muted);
  border-radius: 18px; background: var(--fill);
}
/* Nothing found: a heading and a couple of lines with links. */
.empty-state { padding: 32px 20px; }
.empty-title { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; color: var(--green); }
.empty-text { margin: 8px auto 0; max-width: 560px; font-size: 15px; line-height: 1.55; color: var(--muted); text-wrap: balance; }
.empty-link {
  padding: 0; border: 0; background: none; font: inherit; color: var(--green); cursor: pointer; text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, currentColor 35%, transparent);
  transition: color .15s, border-color .15s;
}
.empty-link:hover { color: var(--green-hover); border-bottom-color: currentColor; }


/* ---------- Filter groups (sheet / dropdown) ---------- */

.fgroup { margin: 0; padding: 0; border: 0; min-width: 0; }
.fgroup + .fgroup { margin-top: 20px; }
.fgroup legend { float: left; width: 100%; padding: 0; font-size: 19px; line-height: 26px; font-weight: 600; color: var(--text); }
/* Options as an iOS grouped list: one rounded card, hairlines between rows. */
.fopts {
  clear: both; margin-top: 6px; display: flex; flex-direction: column;
  background: var(--card-bg); border-radius: 12px; box-shadow: var(--hairline);
  overflow: hidden;
}
.price-range { clear: both; }

.check {
  position: relative;
  min-height: 46px; padding: 0 14px; display: flex; align-items: center; gap: 12px;
  font-size: 17px; line-height: 1.25; letter-spacing: -0.01em; color: var(--text); cursor: pointer;
  transition: background-color .15s;
}
.check:hover { background: var(--fill); }
.check + .check::before {            /* separator, inset to start at the text */
  content: ""; position: absolute; top: 0; right: 0; left: 48px;
  border-top: 0.5px solid var(--separator);
}
.check input {
  appearance: none; -webkit-appearance: none;
  flex: none; width: 22px; height: 22px; margin: 0;
  border: 1.5px solid rgba(70, 64, 40, 0.30); border-radius: 50%; background: transparent;
  display: grid; place-content: center; cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.check input:checked {
  border-color: var(--green); background: var(--green)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3.5 3.5L11 1.5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 12px 10px no-repeat;
}
.check-count { margin-left: auto; font-size: 15px; color: #8A8676; }
.check.is-empty { opacity: .5; }

.show-all {
  align-self: flex-start; margin: 4px 14px; padding: 6px 0;
  border: 0; background: transparent; cursor: pointer;
  font-size: 15px; font-weight: 600; color: var(--green);
}

.price-range { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.price-range input {
  width: 100%; min-width: 0; height: 42px; padding: 0 12px;
  border: 1px solid var(--input-line); border-radius: 10px; background: #FCF9EE;
  font-size: 16px;
}
.price-range input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(30, 66, 36, 0.12); }
.price-range span { color: var(--muted); }

/* ---------- Bottom sheet (phone/tablet filters) ---------- */

.sheet {
  width: 100%; max-width: 560px; max-height: 86vh;
  margin: auto auto 0; padding: 0;
  border: 0; border-radius: 22px 22px 0 0;
  background: #F6F2E4; color: var(--text); font-family: var(--sans);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.16);
}
.sheet::backdrop { background: rgba(20, 22, 15, 0.32); }
.sheet[open] { display: flex; flex-direction: column; animation: sheet-in .38s var(--ease-ios); }
/* Grabber at the top of the bottom sheet. */
.sheet:not(.is-dropdown)::before {
  content: ""; flex: none; align-self: center;
  width: 36px; height: 5px; margin-top: 7px; border-radius: 3px; background: rgba(0, 0, 0, 0.18);
}
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes dropdown-in { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }

.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 8px 20px;
}
.sheet-head h2 { margin: 0; font-family: var(--display); font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
/* Round grey close button, as in iOS sheets. */
.sheet-close {
  width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--fill-strong);
  color: #6E6A5A; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.sheet-close svg { width: 13px; height: 13px; stroke-width: 2.6; }
.sheet-body { overflow-y: auto; padding: 4px 20px 12px; }
.sheet-body .fgroup legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.sheet-foot {
  display: flex; gap: 10px; padding: 10px 20px calc(16px + env(safe-area-inset-bottom, 0px));
}
.sheet-foot .btn-outline { flex: 1; padding: 14px 20px; }
.sheet-foot .btn-primary { flex: 2; padding: 14px 20px; }

/* ---------- Book page ---------- */

.book-page { padding: 16px 20px 32px; }
/* Back button as a tinted capsule. */
.back-link {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 16px 0 12px; border-radius: 999px;
  background: var(--tint); color: var(--green);
  font-size: 15px; font-weight: 600; letter-spacing: -0.01em; text-decoration: none;
  transition: background-color .2s, transform .15s var(--ease-ios);
}
.back-link:hover { background: var(--tint-strong); color: var(--green-hover); }
.book-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.share-btn { border: 0; cursor: pointer; font: inherit; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.back-link:active { transform: scale(.96); }
.book-layout { display: grid; gap: 24px; margin-top: 24px; }
.book-media { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.book-cover-lg {
  position: relative; display: block; width: min(80vw, 340px);
  padding: 0; border: 0; background: none; color: inherit; text-align: left;
  cursor: zoom-in; border-radius: 12px;
}
/* "Expand" badge in the corner of the big image: frosted circle, as in iOS. */
.zoom-badge {
  position: absolute; top: 12px; right: 14px; z-index: 3;
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.72); color: #2B2A24;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  opacity: 0; transform: scale(.9);
  transition: opacity .2s, transform .25s var(--ease-ios);
}
.book-cover-lg:hover .zoom-badge, .book-cover-lg:focus-visible .zoom-badge { opacity: 1; transform: none; }
@media (hover: none) { .zoom-badge { opacity: .9; transform: none; } }

/* ---------- Image viewer ---------- */

html.viewer-open { overflow: hidden; }
.viewer {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: rgba(14, 14, 12, 0.97); color: #fff; font-family: var(--sans);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
}
.viewer::backdrop { background: transparent; }
.viewer[open] { display: flex; flex-direction: column; animation: viewer-in .32s var(--ease-ios); }
.viewer[open] .viewer-slide img { animation: viewer-img-in .42s var(--ease-ios); }
@keyframes viewer-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes viewer-img-in { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }

.viewer-bar {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 44px; padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 8px;
}
.viewer-count { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: rgba(255, 255, 255, 0.85); }
.viewer-btn {
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.14); color: #fff; cursor: pointer;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: background-color .2s, opacity .2s, transform .15s var(--ease-ios);
}
.viewer-btn:hover { background: rgba(255, 255, 255, 0.24); }
.viewer-btn:active { transform: scale(.92); }
.viewer-btn:disabled { opacity: .25; cursor: default; }
.viewer-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.viewer-close { position: absolute; right: 16px; bottom: 6px; }
.viewer-close svg { width: 15px; height: 15px; }

/* Slides sit side by side and snap, so swiping works natively on touch screens. */
.viewer-track {
  flex: 1; min-height: 0; display: flex;
  overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
  scrollbar-width: none; overscroll-behavior: contain;
}
.viewer-track::-webkit-scrollbar { display: none; }
.viewer.is-zoomed .viewer-track { overflow: hidden; }
.viewer-slide {
  flex: 0 0 100%; min-width: 0; scroll-snap-align: center; scroll-snap-stop: always;
  display: flex; align-items: center; justify-content: center;
  padding: 8px 16px 16px; overflow: hidden;
}
.viewer-slide img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  border-radius: 6px; cursor: zoom-in; user-select: none; -webkit-user-select: none;
}
.viewer-slide:first-child img { box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4); }   /* only the cover */
.viewer-slide:not(:first-child) img { outline: 1px solid rgba(255, 255, 255, 0.18); outline-offset: -1px; }   /* thin frame on the spreads */
.viewer-slide.is-zoomed { display: block; overflow: auto; cursor: zoom-out; scrollbar-width: none; }
.viewer-slide.is-zoomed img { max-width: none; max-height: none; height: auto; margin: auto; cursor: zoom-out; border-radius: 0; }

.viewer-nav { position: absolute; top: 50%; margin-top: -20px; z-index: 2; }
.viewer-prev { left: 20px; }
.viewer-next { right: 20px; }
.viewer.is-zoomed .viewer-nav, .viewer.is-zoomed .viewer-thumbs { opacity: 0; pointer-events: none; }
@media (hover: none) { .viewer-nav { display: none; } }   /* swipe instead */

.viewer-thumbs {
  flex: none; display: flex; gap: 6px; justify-content: safe center;
  overflow-x: auto; scrollbar-width: none;
  padding: 6px 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  transition: opacity .2s;
}
.viewer-thumb {
  flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px;
  overflow: hidden; background: none; cursor: pointer; opacity: .45;
  transition: opacity .2s, box-shadow .2s;
}
.viewer-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewer-thumb:hover { opacity: .8; }
.viewer-thumb[aria-current="true"] { opacity: 1; box-shadow: 0 0 0 2px #fff; }
/* The big image area keeps the cover's height: when a spread is shown, the 3D book
   stays in place invisibly and the spread is centred over it, scaled to fit. */
.book-spread {
  position: absolute; inset: 0; margin: auto;
  display: block; width: auto; height: auto; max-width: 100%; max-height: 100%;
  border-radius: 10px;
  border: 1px solid var(--separator);   /* thin frame instead of a shadow */
}
.book-cover-lg .book-spread[hidden] { display: none; }
.book-cover-lg .book3d[hidden] { display: block; visibility: hidden; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.thumb {
  width: 60px; height: 60px; padding: 0; border: 0; border-radius: 12px;
  background: none; cursor: pointer; overflow: hidden;
  box-shadow: var(--hairline); opacity: .7;
  transition: opacity .2s, box-shadow .2s;
}
.thumb:hover { opacity: 1; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb[aria-pressed="true"] { opacity: 1; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--green); }

.book-info h1 {
  margin: 0; font-family: var(--display); font-weight: 700; letter-spacing: -0.025em;
  font-size: 30px; line-height: 1.15; color: var(--green);
}
.book-author { margin: 6px 0 0; font-size: 17px; color: var(--muted); }
/* Author names link to the catalogue filtered to that author. */
.author-link { color: inherit; }
.book-meta-row { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.book-meta-row .age-pill { margin-top: 0; height: 28px; padding: 0 12px; font-size: 15px; border-radius: 14px; }
.book-price { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--green); }
/* «Доступно к предзаказу»: a quiet label rather than a big price. */
.book-price.is-unknown { font-size: 16px; font-weight: 500; letter-spacing: -0.01em; color: var(--muted); }
.card-price.is-unknown { font-size: 12px; font-weight: 400; line-height: 16px; color: #A8A494; }
/* "Хочу эту книгу" sits on a soft tinted card with a quiet drawing of grass and leaves
   in the bottom-right corner, in the spirit of the catalogue's hero illustration;
   the heart on the button beats on hover. */
.book-cta {
  position: relative; overflow: hidden;
  margin-top: 20px; padding: 18px; border-radius: 20px;
  background: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22260%22 height=%22130%22 viewBox=%220 0 260 130%22%3E%3Cg fill=%22none%22 stroke-linecap=%22round%22%3E%3Cg stroke=%22%238FAE74%22 stroke-width=%222.2%22 opacity=%22.55%22%3E%3Cpath d=%22M40 130c2-14 0-26-6-36%22/%3E%3Cpath d=%22M48 130c0-18 4-30 12-40%22/%3E%3Cpath d=%22M56 130c-2-10-6-18-12-24%22/%3E%3Cpath d=%22M120 130c1-12-2-22-8-30%22/%3E%3Cpath d=%22M128 130c1-16 6-27 14-34%22/%3E%3Cpath d=%22M150 130c0-10 3-18 8-24%22/%3E%3Cpath d=%22M158 130c-1-14-5-24-12-31%22/%3E%3C/g%3E%3Cg stroke=%22%236E8F58%22 stroke-width=%222%22 opacity=%22.55%22%3E%3Cpath d=%22M232 130c-6-30-4-62 10-98%22/%3E%3C/g%3E%3C/g%3E%3Cg opacity=%22.42%22%3E%3Cg fill=%22%238FAE74%22%3E%3Cellipse cx=%22222%22 cy=%22102%22 rx=%2215%22 ry=%226.5%22 transform=%22rotate%28-35 222 102%29%22/%3E%3Cellipse cx=%22248%22 cy=%2288%22 rx=%2215%22 ry=%226.5%22 transform=%22rotate%2832 248 88%29%22/%3E%3Cellipse cx=%22226%22 cy=%2270%22 rx=%2214%22 ry=%226%22 transform=%22rotate%28-40 226 70%29%22/%3E%3Cellipse cx=%22250%22 cy=%2256%22 rx=%2213%22 ry=%225.5%22 transform=%22rotate%2835 250 56%29%22/%3E%3Cellipse cx=%22234%22 cy=%2240%22 rx=%2211%22 ry=%225%22 transform=%22rotate%28-45 234 40%29%22/%3E%3C/g%3E%3Cg fill=%22%23A9C190%22%3E%3Cellipse cx=%22196%22 cy=%22118%22 rx=%2212%22 ry=%225%22 transform=%22rotate%28-20 196 118%29%22/%3E%3Cellipse cx=%2288%22 cy=%22122%22 rx=%2210%22 ry=%224.5%22 transform=%22rotate%2815 88 122%29%22/%3E%3C/g%3E%3C/g%3E%3Cg opacity=%22.5%22%3E%3Ccircle cx=%2260%22 cy=%2288%22 r=%223.2%22 fill=%22%23E8C478%22/%3E%3Ccircle cx=%22142%22 cy=%2295%22 r=%222.6%22 fill=%22%23E8C478%22/%3E%3C/g%3E%3C/svg%3E") right -6px bottom -4px / auto 112% no-repeat, var(--tint);
}
.book-cta .btn-primary { width: 100%; }
/* The price heads the «Хочу эту книгу» box. */
.book-cta .cta-price { margin: 0 2px 12px; font-size: 28px; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; color: var(--green); }
.book-cta .cta-price.is-unknown { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--age-text); }
.book-cta p { margin: 10px 2px 0; font-size: 14px; color: var(--age-text); }

/* «Вся серия»: covers fanned out, the series name, one button to add every book. */
.series-want {
  display: flex; align-items: center; gap: 14px; margin-top: 12px; padding: 12px 12px 12px 14px;
  border-radius: 18px; background: var(--card-bg); box-shadow: var(--hairline), 0 1px 3px rgba(0, 0, 0, 0.04);
}
.series-stack { flex: none; display: flex; align-items: flex-end; height: 52px; padding-right: 2px; }
.series-stack img {
  width: 36px; height: 50px; object-fit: cover; border-radius: 3px; background: #fff;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.08), 0 2px 5px rgba(0, 0, 0, 0.18);
}
.series-stack img + img { margin-left: -22px; }
.series-stack img:nth-child(1) { position: relative; z-index: 4; }
.series-stack img:nth-child(2) { position: relative; z-index: 3; transform: translateY(-1px) rotate(3deg); }
.series-stack img:nth-child(3) { position: relative; z-index: 2; transform: translateY(-2px) rotate(6deg); }
.series-stack img:nth-child(4) { position: relative; z-index: 1; transform: translateY(-3px) rotate(9deg); }
.series-want-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.series-want-name {
  align-self: flex-start; font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--text); text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, currentColor 30%, transparent); transition: color .15s, border-color .15s;
}
.series-want-name:hover { color: var(--green); border-bottom-color: currentColor; }
.series-want-text span { font-size: 13px; color: var(--muted); }
.series-want-action { flex: none; }
.series-add {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 16px 0 13px;
  border: 0; border-radius: 999px; background: var(--tint); color: var(--green);
  font: inherit; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .2s, transform .2s var(--ease-ios), opacity .15s;
}
.series-add svg { flex: none; width: 15px; height: 15px; }
.series-add:hover { background: var(--tint-strong); color: var(--green-hover); }
.series-add:active { transform: scale(.96); opacity: .85; }
.series-add.is-added { background: transparent; box-shadow: 0 0 0 1.5px var(--green) inset; }
@media (max-width: 520px) {
  .series-want { flex-wrap: wrap; padding: 12px 14px 14px; }
  .series-want-action { flex-basis: 100%; }
  .series-add { width: 100%; justify-content: center; min-height: 42px; }
}

.btn-want { position: relative; overflow: hidden; }
/* «Хочу эту книгу» (design: btn.png): a muted forest-green capsule with a soft wave at the
   bottom-left and faint leaves at the bottom-right, a heart with little rays, bold text. */
.btn-want:not(.is-added), .contact-send, .contact-tg {
  gap: 10px; padding: 14px 32px 14px 26px; min-height: 51px;
  font-size: 16px; font-weight: 700; letter-spacing: -0.01em;
  background:
    url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2280%22 height=%2260%22 viewBox=%220 0 80 60%22%3E%3Cg fill=%22%23fff%22 fill-opacity=%22.1%22%3E%3Cpath d=%22M44 60c2-14 10-26 24-34-2 14-10 26-24 34z%22/%3E%3Cpath d=%22M50 44c-8-6-20-8-30-4 8 6 20 8 30 4z%22/%3E%3Cpath d=%22M62 30c2-10 8-18 16-22 0 10-6 18-16 22z%22/%3E%3C/g%3E%3Cpath d=%22M44 60c4-12 12-24 26-32%22 stroke=%22%23fff%22 stroke-opacity=%22.12%22 stroke-width=%221.4%22 fill=%22none%22/%3E%3C/svg%3E") right 5px bottom -3px / 68px 51px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22400%22 height=%2260%22 viewBox=%220 0 400 60%22 preserveAspectRatio=%22none%22%3E%3Cpath d=%22M0 44c40-10 80-6 120 6 18 5 30 8 40 10H0z%22 fill=%22%23fff%22 fill-opacity=%22.06%22/%3E%3Cpath d=%22M240 60c30-14 70-18 110-10 20 4 36 4 50 0v10z%22 fill=%22%23fff%22 fill-opacity=%22.05%22/%3E%3C/svg%3E") left bottom / 100% 60% no-repeat,
    #47704B;
  box-shadow: 0 1px 2px rgba(30, 50, 30, 0.12), 0 6px 18px rgba(40, 70, 40, 0.16);
}
.btn-want:not(.is-added):hover, .contact-send:hover, .contact-tg:hover { background-color: #3F6643; }
.btn-want:not(.is-added) svg { width: 26px; height: 21px; margin: 0 -2px; }
.contact-send svg, .contact-tg svg { flex: none; width: 21px; height: 21px; }
.contact-send:hover svg { transform: translateX(3px); }
.contact-send svg { transition: transform .25s var(--ease-ios); }
.btn-want svg { flex: none; transition: transform .3s var(--ease-ios); }
/* Already in the list: a tinted button that opens the list. */
.btn-want.is-added { background: #fff; color: var(--green); box-shadow: 0 0 0 1.5px var(--green) inset; }
.btn-want.is-added:hover { background: #fff; color: var(--green-hover); }
.btn-want.is-added:hover svg { animation: none; }
.btn-want:hover svg { animation: heartbeat 1s ease-in-out infinite; }
@keyframes heartbeat {
  0%, 100% { transform: scale(1); } 15% { transform: scale(1.22); } 30% { transform: scale(.95); } 45% { transform: scale(1.12); }
}
.book-desc { margin-top: 22px; font-size: 17px; line-height: 1.6; }
.book-desc p { margin: 0 0 12px; }
/* Long descriptions: the first paragraphs (about 512 characters), then «Полное описание». */
.desc-rest:not([hidden]) { animation: desc-in .4s var(--ease-ios); }
@keyframes desc-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.desc-more {
  margin-top: 2px; padding: 4px 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 16px; font-weight: 600; color: var(--green);
  text-decoration: underline dashed rgba(30, 66, 36, 0.5); text-decoration-thickness: 1px; text-underline-offset: 4px;
  -webkit-tap-highlight-color: transparent; transition: text-decoration-color .2s, color .2s;
}
.desc-more[hidden] { display: none; }
.desc-more:hover { color: var(--green-hover); text-decoration-color: currentColor; }

/* Details as an iOS grouped list: label left, value right, hairlines between rows. */
.book-details {
  margin: 24px 0 0; padding: 0 16px;
  border: 0; border-radius: 14px; background: var(--card-bg); box-shadow: var(--hairline);
  display: grid; grid-template-columns: auto 1fr; column-gap: 0;
  font-size: 16px; letter-spacing: -0.01em;
}
.book-details dt, .book-details dd { padding: 12px 0; }
.book-details dd { padding-left: 18px; }
.book-details dt { color: var(--muted); }
.book-details dd { margin: 0; color: var(--text); text-align: left; }
/* Quiet credit line under the details: where the photos and description come from. */
.book-source {
  margin: 10px 16px 0; font-size: 13px; line-height: 1.45; color: #8A8676;
}
.book-source a { color: inherit; }
.book-details dt:not(:first-of-type), .book-details dt:not(:first-of-type) + dd { border-top: 0.5px solid var(--separator); }

/* ---------- Static pages ---------- */

.page { max-width: 760px; margin: 0 auto; padding: 20px 20px 40px; font-size: 17px; line-height: 1.6; }
.page h1 { margin: 0 0 12px; font-family: var(--display); font-weight: 700; letter-spacing: -0.025em; font-size: 32px; line-height: 1.15; color: var(--green); }
.page h2 { margin: 28px 0 8px; font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; font-size: 22px; color: var(--green); }
.page .lead { font-size: 19px; color: var(--text-soft); }
/* Bottom padding lives on the open card itself: with no border (only a hairline shadow)
   the last paragraph's margin would otherwise collapse out of the card. */
.page details {
  margin-top: 10px; padding: 0 18px;
  border: 0; border-radius: 14px; background: var(--card-bg); box-shadow: var(--hairline);
}
.page summary {
  padding: 14px 0; font-weight: 600; cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; gap: 12px;
}
.page summary::-webkit-details-marker { display: none; }
.page summary::after { content: "+"; font-size: 22px; line-height: 1; color: var(--green); }
.page details[open] summary::after { content: "–"; }
.page details[open] { padding-bottom: 16px; }
.page details p { margin: 0 0 12px; }
.page details p:last-child { margin-bottom: 0; }
.contact-list { margin: 20px 0 0; display: grid; gap: 12px; }
.contact-list div { padding: 14px 18px; border: 0; border-radius: 14px; background: var(--card-bg); box-shadow: var(--hairline); }
.contact-list dt { font-size: 14px; color: var(--muted); }
.contact-list dd { margin: 2px 0 0; font-size: 18px; font-weight: 600; }
.contact-list dd.contact-note { margin-top: 4px; font-size: 14px; font-weight: 400; line-height: 1.45; color: var(--muted); }
/* ISBN in the details table, with a small copy button. */
.isbn-copy { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.copy-isbn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; margin: -6px 0; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer; transition: background-color .15s, color .15s;
}
.copy-isbn svg { width: 15px; height: 15px; }
.copy-isbn:hover { background: var(--fill); color: var(--green); }
.copy-isbn.is-copied { color: var(--green); }
.copy-isbn.is-copied::after {
  content: "Скопировано"; position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  padding: 3px 8px; border-radius: 6px; background: var(--text); color: #fff;
  font-size: 12px; white-space: nowrap; pointer-events: none;
}

/* ---------- Book page: other books of the series ---------- */

.series-books { margin-top: 48px; padding-top: 32px; border-top: 0.5px solid rgba(70, 64, 40, 0.22); }
.series-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.series-head h2 { margin: 0; font-family: var(--display); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--green); }
.series-all { font-size: 15px; color: var(--muted); }
.series-grid { margin-top: 20px; }

/* ---------- «Мой список» ---------- */

.list-page { max-width: 820px; }
.list-empty { margin-top: 20px; padding: 32px 20px; border-radius: 18px; background: var(--fill); text-align: center; }
.list-empty p { margin: 0 0 18px; color: var(--muted); }
.list-rows {
  list-style: none; margin: 20px 0 0; padding: 0 16px;
  background: var(--card-bg); border-radius: 16px; box-shadow: var(--hairline);
}
.list-row { display: flex; align-items: center; gap: 16px; padding: 14px 0; }
.list-rows > li + li, .list-sub > li + li { border-top: 0.5px solid var(--separator); }
/* Books of one series: one row with the covers stacked; opens to the books themselves. */
.list-group-row { padding: 14px 0; }
.list-group-toggle {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 16px; padding: 0; border: 0;
  background: none; font: inherit; text-align: left; color: inherit; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.list-group-toggle .list-info { display: flex; flex-direction: column; }
.list-group-toggle:hover .list-title { color: var(--green); }
/* Up to four covers fanned within the 56px cover column, so titles line up with single books. */
.list-stack { width: 56px; height: auto; justify-content: flex-start; padding-right: 0; }
.list-stack img { width: 38px; height: 54px; }
.list-stack img + img { margin-left: -33px; }
.list-stack img:nth-child(2) { transform: translateY(-1px) rotate(2deg); }
.list-stack img:nth-child(3) { transform: translateY(-2px) rotate(4deg); }
.list-stack img:nth-child(4) { transform: translateY(-3px) rotate(6deg); }
.list-group-chevron { flex: none; display: flex; color: var(--muted); transition: transform .3s var(--ease-ios); }
.list-group-chevron svg { width: 12px; height: 12px; }
.list-group.is-open .list-group-chevron { transform: rotate(180deg); }
.list-sub {
  list-style: none; margin: 0 0 12px; padding: 0 12px; border-radius: 14px; background: var(--fill);
  animation: desc-in .35s var(--ease-ios);
}
.list-sub[hidden] { display: none; }
.list-sub .list-row { padding: 10px 0; }
.list-sub .list-cover { width: 44px; }
.list-sub .list-title { font-size: 15px; }
.list-cover { flex: none; width: 56px; }
.list-cover img { display: block; width: 100%; height: auto; border-radius: 4px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }
.list-info { flex: 1; min-width: 0; }
.list-title { color: var(--text); font-weight: 600; font-size: 16px; line-height: 1.3; letter-spacing: -0.01em; text-decoration: none; }
.list-title:hover { color: var(--green); }
.list-meta { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.list-price { margin: 4px 0 0; font-size: 15px; font-weight: 700; color: var(--green); }
.list-price.is-unknown { font-size: 13px; font-weight: 500; color: var(--muted); }
.list-remove {
  flex: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--fill); color: #6E6A5A; cursor: pointer; transition: background-color .2s;
}
.list-remove svg { width: 13px; height: 13px; }
.list-remove:hover { background: var(--fill-strong); color: var(--text); }
/* One sheet: the books, the total, then how to send them — the list is the message. */
.order-sheet.contact-options {
  margin-top: 20px; border-radius: 22px; overflow: hidden;
  background: var(--card-bg); box-shadow: var(--hairline), 0 1px 3px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(70, 64, 40, 0.06);
}
.order-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px 4px;
}
.order-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.015em; }
.order-tools { display: flex; align-items: center; gap: 4px; }
.order-tool {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px;
  border: 0; border-radius: 999px; background: transparent; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 500; color: var(--muted);
  transition: background-color .2s, color .2s;
}
.order-tool svg { flex: none; width: 15px; height: 15px; }
.order-tool:hover { background: var(--fill); color: var(--text); }
.order-sheet .list-rows { margin: 0; padding: 0 20px; background: none; border-radius: 0; box-shadow: none; }
.order-total {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px;
  margin: 0 20px; padding: 12px 0 16px; border-top: 0.5px solid var(--separator);
  font-size: 14px; color: var(--muted);
}
.order-total span:last-child:not(:first-child) { margin-left: auto; }
.order-total strong { margin-left: 6px; font-size: 17px; color: var(--green); }
/* Series only partly in the list: the same rows as on a book page, to add the rest. */
.order-series { display: grid; gap: 8px; padding: 4px 20px 20px; }
.order-series h3 { margin: 0 0 2px; font-size: 13px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); }
.order-series .series-want { margin: 0; background: #fff; }
@media (max-width: 520px) { .order-series { padding: 4px 16px 16px; } }
/* The sending part: a slightly tinted floor of the same sheet. */
.order-send {
  padding: 20px; border-top: 0.5px solid var(--separator);
  background: linear-gradient(180deg, rgba(120, 112, 80, 0.06), rgba(120, 112, 80, 0.03));
}
.order-send h3 { margin: 0; font-size: 17px; letter-spacing: -0.01em; color: var(--text); }
.order-send .contact-tabs { margin-top: 14px; background: rgba(120, 112, 80, 0.12); }
.order-send .contact-tabs::before {
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.10), 0 2px 8px rgba(70, 64, 40, 0.10);
}
.order-send .contact-cards { max-width: none; margin-top: 16px; }
.order-send .contact-card, .order-send .form-sent { padding: 0; border-radius: 0; background: none; box-shadow: none; }
.order-send .form-sent { padding: 16px 0 8px; }
.order-send .field-group { background: #fff; }
@media (min-width: 768px) {
  /* Heading and hint on the left, the Telegram | Заявка switch on the right, the panel below. */
  .order-send {
    display: grid; grid-template-columns: 1fr auto; column-gap: 24px; align-items: center;
    padding: 24px;
  }
  .order-send > h3 { grid-column: 1; grid-row: 1; }
  .order-send > .contact-hint { grid-column: 1; grid-row: 2; }
  .order-send .contact-tabs {
    grid-column: 2; grid-row: 1 / span 2; margin-top: 0; width: 330px;
  }
  .order-send .contact-tabs button { min-height: 36px; font-size: 14px; border-radius: 8px; }
  .order-send .contact-tabs::before { border-radius: 8px; }
  .order-send .contact-tabs button svg { width: 15px; height: 15px; }
  .order-send .contact-cards { grid-column: 1 / -1; margin-top: 20px; padding-top: 20px; border-top: 0.5px solid var(--separator); }
  /* Telegram: steps and button on the left, the QR code on the right. */
  .order-send .contact-card-tg:not([hidden]) {
    display: grid; grid-template-columns: 1fr auto; column-gap: 28px; row-gap: 14px; align-items: start;
  }
  .order-send .contact-card-tg > :not(.tg-qr) { grid-column: 1; }
  .order-send .contact-card-tg .btn-primary { max-width: 320px; margin-top: 0; }
  .order-send .tg-qr {
    grid-column: 2; grid-row: 1 / span 3; flex-direction: column; align-items: center; gap: 8px;
    padding-top: 0; border-top: 0;
  }
  .order-send .tg-qr img { width: 124px; height: 124px; }
  .order-send .tg-qr p { max-width: 150px; font-size: 12.5px; text-align: center; }
  .order-send .contact-form { max-width: 560px; }
}
@media (max-width: 520px) {
  .order-head { padding: 14px 16px 2px; }
  .order-tool span { display: none; }
  .order-tool { padding: 0 10px; }
  .order-sheet .list-rows { padding: 0 16px; }
  .order-total { margin: 0 16px; }
  .order-send { padding: 18px 16px; }
  .order-send .contact-tabs button { gap: 6px; padding: 0 6px; font-size: 14px; white-space: nowrap; }
  .order-send .contact-tabs button svg { width: 15px; height: 15px; }
}

/* ---------- Contact options: Telegram or the form ---------- */

.contact-options { margin-top: 36px; }
.contact-options h2 { margin: 0; }
.contact-hint { margin: 4px 0 0; font-size: 15px; color: var(--muted); }
.contact-cards { margin-top: 12px; }
.contact-cards [hidden] { display: none; }
/* iOS segmented control: Telegram | Заявка на сайте. The white pill is one element that slides
   to the selected side. */
.contact-tabs {
  position: relative;
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin-top: 16px; padding: 3px;
  border-radius: 12px; background: var(--fill);
}
.contact-tabs::before {
  content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 8px) / 2);
  border-radius: 9px; background: var(--card-bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  transition: transform .35s var(--ease-ios);
}
.contact-tabs:has(> [role="tab"]:last-child[aria-selected="true"])::before { transform: translateX(calc(100% + 2px)); }
.contact-tabs button {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent;
  font: inherit; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: #6E6A5A; cursor: pointer;
  transition: color .25s;
}
.contact-tabs button svg { flex: none; width: 17px; height: 17px; transition: color .25s; }
.contact-tabs button:hover { color: var(--text); }
.contact-tabs button[aria-selected="true"] { color: var(--green); }
.contact-tabs #tab-tg[aria-selected="true"] svg { color: #2AA0D8; }
.contact-card {
  display: flex; flex-direction: column; gap: 14px;
  margin: 0; padding: 20px; border-radius: 20px;
  background: var(--card-bg); box-shadow: var(--hairline), 0 1px 3px rgba(0, 0, 0, 0.04);
}
.contact-card-head { display: flex; align-items: center; gap: 12px; }
.contact-card-head h3 { margin: 0; font-size: 18px; line-height: 1.2; letter-spacing: -0.015em; color: var(--text); }
.contact-card-head p { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.contact-icon {
  flex: none; width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.contact-icon svg { width: 22px; height: 22px; }
.contact-icon.tg { background: linear-gradient(160deg, #37AEE2, #1E96C8); }
.contact-icon.form { background: linear-gradient(160deg, #5A8A5E, #2F5A33); }
.contact-steps { margin: 0; padding-left: 22px; font-size: 15px; line-height: 1.5; color: var(--text-soft); }
.contact-steps li + li { margin-top: 4px; }
.contact-card .btn-primary { width: 100%; margin-top: auto; }
.tg-handle { color: inherit; }
/* QR code to the chat: on desktop only (on a phone you'd just tap the button). */
.tg-qr { display: none; align-items: center; gap: 14px; padding-top: 14px; border-top: 0.5px solid var(--separator); }
.tg-qr img { flex: none; width: 140px; height: 140px; padding: 8px; border-radius: 12px; background: #fff; box-shadow: var(--hairline); }
.tg-qr p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.tg-channel { margin: 0; padding-top: 14px; border-top: 0.5px solid var(--separator); font-size: 14px; line-height: 1.45; color: var(--muted); }
@media (min-width: 768px) and (hover: hover) { .tg-qr { display: flex; } }

/* Form: one iOS-style grouped block — rows divided by hairlines, labels float up as you type. */
.form-intro { margin: 0; font-size: 15px; color: var(--muted); }
.field-group {
  border-radius: 16px; background: #fff; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(70, 64, 40, 0.10), 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: box-shadow .2s;
}
.field-group:focus-within { box-shadow: 0 0 0 1px rgba(30, 66, 36, 0.35), 0 0 0 4px rgba(30, 66, 36, 0.10); }
.field { position: relative; display: block; }
.field + .field { border-top: 0.5px solid var(--separator); }
.field input, .field textarea {
  display: block; width: 100%; border: 0; background: transparent; outline: none;
  padding: 26px 16px 9px; font: inherit; font-size: 17px; line-height: 1.3; color: var(--text);
}
.field textarea { resize: none; min-height: 84px; }
.field span {
  position: absolute; left: 16px; top: 18px; right: 16px; pointer-events: none;
  font-size: 17px; color: #9A9686; transform-origin: 0 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: transform .2s var(--ease-ios), color .2s;
}
/* Label floats up when the field is focused or filled. */
.field input:focus + span, .field input:not(:placeholder-shown) + span,
.field textarea:focus + span, .field textarea:not(:placeholder-shown) + span {
  transform: translateY(-11px) scale(0.72); color: var(--muted);
}
.field input:focus + span, .field textarea:focus + span { color: var(--green); }
/* A hint appears in the field once its label has floated up. */
.field input::placeholder, .field textarea::placeholder { color: transparent; transition: color .2s; }
.field input:focus::placeholder, .field textarea:focus::placeholder { color: #A8A494; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-error { margin: 0; padding: 11px 14px; border-radius: 14px; background: #FBE9E5; color: #A2382A; font-size: 14px; line-height: 1.4; }
.form-error[hidden] { display: none; }
.contact-send.is-sending { opacity: .7; cursor: progress; }

.form-sent {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 32px 20px; border-radius: 20px; text-align: center;
  background: var(--card-bg); box-shadow: var(--hairline);
  animation: dropdown-in .4s var(--ease-ios);
}
.form-sent-icon {
  width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--green); color: #fff;
}
.form-sent-icon svg { width: 28px; height: 28px; }
.form-sent h3 { margin: 6px 0 0; font-size: 20px; color: var(--text); }
.form-sent p { margin: 0; color: var(--muted); font-size: 15px; }
.other-contacts { margin-top: 0; }

@media (min-width: 768px) {
  .contact-tabs, .contact-cards { max-width: 560px; }
}

.book-request {
  margin: 0 0 20px; padding: 14px 18px; border-radius: 14px;
  background: var(--tint); color: var(--age-text); font-size: 16px;
}

/* ---------- Footer & tab bar ---------- */

.site-footer {
  margin-top: 40px; padding: 18px 20px;
  background: transparent; border-top: 0.5px solid var(--separator); color: #6E6A5A;
  font-size: 13.5px; text-align: center;
}
.footer-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 14px; }
.site-footer p { margin: 0; }
.site-footer strong { font-weight: 600; color: var(--green); }
.site-footer .leaf { display: none; }
.footer-nav { display: flex; gap: 16px; }
.footer-nav a { padding: 6px 0; font-weight: 600; text-decoration: none; }
/* The small print, under the footer row. */
.site-footer .footer-note {
  max-width: 640px; margin: 8px auto 0;
  font-size: 12px; line-height: 1.5; color: #9A9684;
}


/* ---------- Text links ----------
   No underline: a thin line under the text, half see-through; on hover the line turns
   solid and the text green. */
.count-reset, .author-link, .book-source a, .tg-handle, .series-all,
.page p a, .page li:not(.list-row):not(.list-group) a, .page dd a, .book-request a {
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, currentColor 35%, transparent);
  transition: color .15s, border-color .15s;
}
.count-reset:hover, .author-link:hover, .book-source a:hover, .tg-handle:hover, .series-all:hover,
.page p a:hover, .page li:not(.list-row):not(.list-group) a:hover, .page dd a:hover, .book-request a:hover {
  color: var(--green-hover); border-bottom-color: currentColor;
}

/* Narrow phones: keep the whole menu (with the list heart) on one line. */
@media (max-width: 389px) {
  .main-nav { gap: 0; }
  .main-nav a { padding: 6px 7px; font-size: 14px; }
  .main-nav .nav-list { margin: 0 4px 0 0; }
  .main-nav .nav-telegram { margin-right: 2px; }
}

/* ======================= Tablet ≥ 640 ======================= */

@media (min-width: 640px) {
  .book-grid { --cols: 3; --col-gap: 32px; --row-gap: 38px; }
  .book-grid > .card:nth-child(n):not(:first-child)::before { content: none; }
  .book-grid > .card:nth-child(3n+1):not(:first-child)::before { content: ""; }
  .book-layout { grid-template-columns: 300px minmax(0, 1fr); align-items: start; gap: 36px; }
  .book-cover-lg { width: 100%; }
  .book-cta .btn-primary { width: auto; }
}

/* ======================= Tablet landscape ≥ 768 ======================= */

@media (min-width: 768px) {
  :root { --gutter: 40px; }
  .header-inner {
    grid-template-columns: 1fr auto;
    max-width: 1280px; margin: 0 auto;
    padding: 10px var(--gutter);
  }
  .brand-logo { width: 52px; height: 52px; }
  .brand-name { display: block; font-size: 30px; line-height: 36px; }
  .main-nav { margin: 0 -12px 0 0; gap: 6px; }
  .main-nav .nav-list { margin: 0 14px 0 0; }
  .main-nav a { padding: 6px 12px; }

  .hero { background: var(--hero-bg); }
  .hero-inner { max-width: 1280px; margin: 0 auto; padding: 28px var(--gutter) 26px; }
  .hero h1 { font-size: 42px; line-height: 48px; }
  .hero-sub { display: block; margin: 12px 0 0; font-size: 18px; line-height: 26px; color: #3D473C; }
  .search { margin-top: 20px; height: 48px; max-width: 713px; border-radius: 14px; padding: 0 8px 0 16px; gap: 12px; background: #FFFDF7; box-shadow: var(--hairline), 0 1px 3px rgba(0, 0, 0, 0.04); }
  .search input { font-size: 17px; }

  .catalog { max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter); }
  .results-bar { margin-top: 20px; }
  .site-footer .leaf { display: block; }
  .page { padding-top: 32px; }
  .page h1 { font-size: 38px; }
}

/* ======================= Desktop ≥ 1024 ======================= */

@media (min-width: 1024px) {
  :root { --gutter: 60px; }
  .header-inner { padding: 12px var(--gutter); }
  .brand { gap: 14px; }
  .brand-logo { width: 56px; height: 56px; }
  .brand-name { font-size: 32px; line-height: 38px; }
  .main-nav a { font-size: 16px; padding: 7px 14px; }
  .main-nav { margin-right: -14px; }

  .hero-inner {
    position: relative;
    display: grid; grid-template-columns: minmax(0, 1fr) 461px; column-gap: 24px; align-items: center;
    min-height: 264px; padding: 36px 29px 28px var(--gutter);
  }
  .hero h1 { font-size: 54px; line-height: 58px; letter-spacing: -0.03em; }
  .hero-sub { margin-top: 14px; font-size: 20px; line-height: 27px; }
  .search { margin-top: 26px; height: 50px; padding: 0 8px 0 18px; gap: 14px; }
  .search input { font-size: 18px; }
  .hero-art { display: block; width: 461px; height: auto; margin-top: -26px; margin-bottom: -18px; }

  .catalog { padding: 24px var(--gutter) 0; }
  .results-bar { gap: 10px; }
  .filter-pills { gap: 10px; }
  .filter-pills .pill { height: 36px; padding: 0 13px 0 16px; }

  /* Filter options open as a dropdown under their button. */
  /* Filter options open as a popover under their button: frosted, rounded, springy. */
  .sheet.is-dropdown {
    position: absolute; inset: auto; margin: 0;
    width: 320px; max-height: min(480px, 70vh);
    border: 0; border-radius: 16px;
    background: rgba(248, 244, 230, 0.86);
    -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
    box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.08), 0 10px 40px rgba(0, 0, 0, 0.18);
    transform-origin: 30px 0;
    z-index: 30;
  }
  .sheet.is-dropdown[open] { animation: dropdown-in .3s var(--ease-ios); }
  .sheet.is-dropdown .sheet-head { padding: 12px 12px 4px 16px; }
  .sheet.is-dropdown .sheet-head h2 { font-family: var(--sans); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: #6E6A5A; }
  .sheet.is-dropdown .sheet-close { width: 26px; height: 26px; }
  .sheet.is-dropdown .sheet-close svg { width: 11px; height: 11px; }
  .sheet.is-dropdown .sheet-body { padding: 2px 10px 6px; }
  .sheet.is-dropdown .check { min-height: 40px; padding: 0 12px; gap: 10px; font-size: 15px; }
  .sheet.is-dropdown .check + .check::before { left: 44px; }
  .sheet.is-dropdown .check input { width: 20px; height: 20px; }
  .sheet.is-dropdown .check-count { font-size: 14px; }
  .sheet.is-dropdown .sheet-foot { padding: 8px 10px 10px; gap: 8px; }
  .sheet.is-dropdown .sheet-foot button { min-height: 40px; height: 40px; padding: 0 16px; font-size: 15px; }

  .results-bar { margin-top: 0; min-height: 40px; }

  /* About five books per 1000px of width. */
  .book-grid { --cols: 5; --col-gap: 40px; --row-gap: 44px; margin-top: 24px; }
  .book-grid > .card:nth-child(n):not(:first-child)::before { content: none; }
  .book-grid > .card:nth-child(5n+1):not(:first-child)::before { content: ""; }

  /* Large view: four books per row, filling the full width. */
  .book-grid.is-large { --cols: 4; }
  .book-grid.is-large > .card:nth-child(n):not(:first-child)::before { content: none; }
  .book-grid.is-large > .card:nth-child(4n+1):not(:first-child)::before { content: ""; }

  .view-toggle { display: flex; }
  .card-title { margin-top: 14px; font-size: 15px; line-height: 20px; }
  .card-author { margin-top: 2px; font-size: 14px; line-height: 19px; }
  .card-meta { margin-top: 8px; }
  .card .age-pill { margin-top: 0; height: 22px; padding: 0 9px; font-size: 12.5px; }
  .card-price { font-size: 15px; }
  .card .card-more { display: none; }

  .site-footer { margin-top: 48px; min-height: 56px; padding: 14px 20px; }
  .book-page { max-width: 1100px; margin: 0 auto; padding: 24px 40px 48px; }
  .book-layout { grid-template-columns: 380px minmax(0, 1fr); gap: 48px; }
  .book-info h1 { font-size: 40px; letter-spacing: -0.03em; }
}

/* ======================= Wide ≥ 1280 ======================= */

@media (min-width: 1280px) {
  .catalog { max-width: 1280px; }
  .book-grid { --cols: 6; }
  .book-grid > .card:nth-child(n):not(:first-child)::before { content: none; }
  .book-grid > .card:nth-child(6n+1):not(:first-child)::before { content: ""; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
