/* ==========================================================================
   Epub.pl — redesign 2026
   Wszystkie nowe klasy mają prefiks `rd-`. Plik budowany etapami zgodnie
   z Plan.md; kolejność sekcji jest obowiązująca.
   ========================================================================== */

/* ---------------------------------------------------------------------- */
/* 1. tokens                                                              */
/* ---------------------------------------------------------------------- */
:root {
  /* kolory */
  --rd-bg: #fdfcfa;            /* tło strony (krem) */
  --rd-bg-alt: #f8f4ea;        /* tło sekcji wyróżnionych */
  --rd-ink: #2b2620;           /* tekst podstawowy */
  --rd-ink-soft: #8a8377;      /* tekst pomocniczy jasny */
  --rd-ink-mid: #5c574c;       /* tekst pomocniczy ciemniejszy */
  --rd-hairline: rgba(43,38,32,.1);      /* obramowania delikatne */
  --rd-hairline-strong: rgba(43,38,32,.18);
  --rd-green: #2f4a3c;         /* akcje, linki, akcenty */
  --rd-green-hover: #243b30;
  --rd-green-tint: rgba(47,74,60,.1);    /* chipy, stany aktywne */
  --rd-green-tint-strong: rgba(47,74,60,.18);
  --rd-brick: #a8402f;         /* WYŁĄCZNIE logo/wordmark */
  --rd-gold: #c9a34e;          /* gwiazdki wypełnione */
  --rd-star-empty: rgba(0,0,0,.15);
  --rd-footer-bg: #2b2620;
  --rd-footer-text: #e8e3d8;
  --rd-footer-muted: #b7b1a2;
  --rd-footer-accent: #e5a598;
  /* typografia */
  --rd-font-serif: 'Newsreader', Georgia, serif;
  --rd-font-sans: 'Public Sans', system-ui, -apple-system, sans-serif;
  /* layout */
  --rd-max: 1180px;            /* home, listy, szukaj */
  --rd-max-narrow: 1000px;     /* karta książki, autor */
  --rd-max-auth: 420px;        /* karty logowania/rejestracji */
  /* promienie */
  --rd-r-pill: 22px;           /* przyciski */
  --rd-r-card: 10px;
  --rd-r-input: 9px;
  /* cienie */
  --rd-shadow-cover: 0 2px 8px rgba(43,38,32,.12);
  --rd-shadow-cover-lg: 0 8px 24px rgba(0,0,0,.14);
  --rd-shadow-auth: 0 8px 28px rgba(43,38,32,.06);
}

/* ---------------------------------------------------------------------- */
/* 2. base                                                                */
/* ---------------------------------------------------------------------- */
body.rd-body {
  margin: 0;
  background: var(--rd-bg);
  color: var(--rd-ink);
  font-family: var(--rd-font-sans);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--rd-green);
  color: var(--rd-bg);
}

@keyframes rd-slideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes rd-fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rd-sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ---------------------------------------------------------------------- */
/* 3. utilities                                                           */
/* ---------------------------------------------------------------------- */
.rd-container {
  max-width: var(--rd-max);
  margin: 0 auto;
  padding-inline: 20px;
}

.rd-container--narrow {
  max-width: var(--rd-max-narrow);
}

.rd-grid-books {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px 16px;
}

@media (max-width: 899.98px) {
  .rd-grid-books--home > :nth-child(n+9) {
    display: none;
  }
  .rd-grid-books--category > :nth-child(n+13) {
    display: none;
  }
  .rd-grid-books--related > :nth-child(n+5) {
    display: none;
  }
}

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

/* ---------------------------------------------------------------------- */
/* 4. buttons                                                             */
/* ---------------------------------------------------------------------- */
.rd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  border-radius: var(--rd-r-pill);
  border: none;
  background: none;
  font-family: var(--rd-font-sans);
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.rd-btn--primary {
  background: var(--rd-green);
  color: var(--rd-bg);
  font-weight: 700;
}

.rd-btn--primary:hover {
  background: var(--rd-green-hover);
}

.rd-btn--outline {
  border: 1.5px solid var(--rd-green);
  color: var(--rd-green);
  font-weight: 600;
}

.rd-btn--outline:hover {
  background: rgba(47,74,60,.08);
}

.rd-btn--sm {
  padding: 9px 18px;
  font-size: 13.5px;
}

.rd-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ---------------------------------------------------------------------- */
/* 5. forms                                                               */
/* ---------------------------------------------------------------------- */
.rd-input {
  padding: 11px 13px;
  border-radius: var(--rd-r-input);
  border: 1.5px solid var(--rd-hairline-strong);
  font-family: var(--rd-font-sans);
  font-size: 14px;
  color: var(--rd-ink);
  background: #fff;
  outline: none;
  transition: border-color .15s ease;
}

.rd-input:focus {
  border-color: var(--rd-green);
}

.rd-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--rd-ink);
}

.rd-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rd-checkbox {
  accent-color: var(--rd-green);
}

.rd-form-error {
  color: var(--rd-brick);
  font-size: 12.5px;
}

.rd-search-header {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f4f0e6;
  border-radius: 10px;
  padding: 9px 12px;
}

.rd-search-header__icon {
  color: var(--rd-ink-soft);
  flex-shrink: 0;
}

.rd-search-header input {
  flex: 1;
  width: 100%;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font-family: var(--rd-font-sans);
  font-size: 13.5px;
  color: var(--rd-ink);
}

.rd-search-hero {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 620px;
  background: #fff;
  border: 1.5px solid var(--rd-green);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 20px;
}

.rd-search-hero__icon {
  color: var(--rd-green);
  flex-shrink: 0;
}

.rd-search-hero input {
  flex: 1;
  width: 100%;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font-family: var(--rd-font-sans);
  font-size: 15px;
  color: var(--rd-ink);
}

.rd-select {
  padding: 9px 12px;
  border-radius: 20px;
  border: 1px solid rgba(43,38,32,.2);
  background: #fff;
  font-family: var(--rd-font-sans);
  font-size: 13px;
  color: var(--rd-ink);
}

/* ---------------------------------------------------------------------- */
/* 6. components                                                         */
/* ---------------------------------------------------------------------- */

/* --- header (etap 2) --------------------------------------------------- */
.rd-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--rd-bg);
  border-bottom: 1px solid var(--rd-hairline);
}

.rd-header__inner {
  max-width: var(--rd-max);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.rd-header__burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--rd-ink);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.rd-logo {
  font-family: var(--rd-font-serif);
  font-weight: 700;
  font-size: 22px;
  color: var(--rd-brick);
  text-decoration: none;
  flex-shrink: 0;
}

.rd-header__nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.rd-header__nav a {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--rd-ink);
  text-decoration: none;
  white-space: nowrap;
}

.rd-header__nav a:hover {
  color: var(--rd-green);
}

.rd-header__search {
  flex: 1;
  min-width: 0;
}

.rd-header__auth {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.rd-header__msearch,
.rd-header__muser {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--rd-ink);
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  flex-shrink: 0;
}

.rd-mobile-search {
  display: none;
  padding: 0 20px 14px;
}

.rd-mobile-search.is-open {
  display: block;
}

@media (min-width: 900px) {
  .rd-mobile-search {
    display: none !important;
  }
}

@media (max-width: 899.98px) {
  .rd-header__burger,
  .rd-header__msearch,
  .rd-header__muser {
    display: inline-flex;
  }
  .rd-header__nav,
  .rd-header__search,
  .rd-header__auth {
    display: none;
  }
}

/* --- drawer mobilny (etap 2) -------------------------------------------- */
.rd-scrim {
  position: fixed;
  inset: 0;
  background: rgba(43,38,32,.4);
  z-index: 49;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease;
}

.rd-scrim.is-open {
  opacity: 1;
  visibility: visible;
  animation: rd-fadeIn .2s ease;
}

.rd-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 82%;
  max-width: 320px;
  background: var(--rd-bg);
  z-index: 50;
  padding: 20px;
  overflow-y: auto;
  box-shadow: 8px 0 24px rgba(0,0,0,.15);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform .25s ease, visibility 0s linear .25s;
}

.rd-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform .25s ease;
  animation: rd-slideIn .25s ease;
}

.rd-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.rd-drawer__wordmark {
  font-family: var(--rd-font-serif);
  font-weight: 700;
  font-size: 20px;
  color: var(--rd-brick);
  text-decoration: none;
}

.rd-drawer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--rd-ink);
  cursor: pointer;
  padding: 4px;
}

.rd-drawer__auth {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.rd-drawer__auth .rd-btn {
  flex: 1;
}

.rd-drawer__link {
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid var(--rd-hairline);
  text-decoration: none;
  color: var(--rd-ink-mid);
  font-size: 14.5px;
}

.rd-drawer__link--main {
  font-size: 15px;
  font-weight: 600;
  color: var(--rd-ink);
}

@media (min-width: 900px) {
  .rd-drawer,
  #rd-drawer-scrim {
    display: none;
  }
}

/* --- footer (etap 2) ---------------------------------------------------- */
.rd-footer {
  background: var(--rd-footer-bg);
  color: var(--rd-footer-text);
}

.rd-footer__cols {
  max-width: var(--rd-max);
  margin: 0 auto;
  padding: 40px 20px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
}

.rd-footer__brand {
  flex: 1 1 240px;
  max-width: 320px;
}

.rd-footer__logo {
  font-family: var(--rd-font-serif);
  font-weight: 700;
  font-size: 20px;
  color: var(--rd-footer-accent);
  margin-bottom: 10px;
}

.rd-footer__brand p {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--rd-footer-muted);
  margin: 0;
}

.rd-footer__col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 140px;
}

.rd-footer__heading {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--rd-ink-soft);
  margin-bottom: 4px;
}

.rd-footer__col a {
  font-size: 13.5px;
  color: var(--rd-footer-text);
  text-decoration: none;
}

.rd-footer__col a:hover {
  color: var(--rd-footer-accent);
}

.rd-footer__bottom {
  max-width: var(--rd-max);
  margin: 0 auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 12px;
  color: var(--rd-ink-soft);
}

/* --- breadcrumb (etap 2) ------------------------------------------------ */
.rd-breadcrumb {
  padding-block: 14px;
  font-size: 12.5px;
  color: var(--rd-ink-soft);
}

.rd-breadcrumb a {
  color: var(--rd-ink-soft);
  text-decoration: none;
}

.rd-breadcrumb a:hover {
  color: var(--rd-green);
}

.rd-breadcrumb > a:last-child,
.rd-breadcrumb > span:last-child {
  color: var(--rd-ink);
}

/* --- ad slot oprawa (pulled forward from etap 3.4, used from etap 2) --- */
.rd-adslot {
  margin: 24px 0;
}

.rd-adslot__rule {
  border: none;
  border-top: 1px solid rgba(43,38,32,.12);
  margin: 16px 0;
}

.rd-adslot__labelrow {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.rd-adslot__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-family: monospace;
  color: var(--rd-ink-soft);
  background: rgba(43,38,32,.06);
  padding: 3px 10px;
  border-radius: 20px;
}

/* book card */
.rd-book-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rd-book-card__cover-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: inherit;
}

.rd-book-card__cover {
  position: relative;
  display: block;
}

.rd-book-card__cover img {
  width: 100%;
  display: block;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--rd-shadow-cover);
  background: #eee;
}

.rd-book-card__title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.32;
  color: var(--rd-ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rd-book-card__authors {
  font-size: 11.5px;
  color: var(--rd-ink-soft);
}

.rd-book-card__authors a {
  color: inherit;
  text-decoration: none;
}

.rd-book-card__authors a:hover {
  color: var(--rd-green);
}

/* stars */
.rd-stars {
  display: inline-flex;
  align-items: center;
}

.rd-star {
  fill: var(--rd-star-empty);
}

.rd-star.is-filled {
  fill: var(--rd-gold);
}

.rd-stars--sm {
  gap: 1px;
}

.rd-stars--sm .rd-star {
  width: 11px;
  height: 11px;
}

.rd-stars--md {
  gap: 2px;
}

.rd-stars--md .rd-star {
  width: 14px;
  height: 14px;
}

/* pagination */
.rd-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 36px;
}

.rd-page {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: #fff;
  border: 1px solid rgba(43,38,32,.15);
  color: var(--rd-ink);
  text-decoration: none;
}

.rd-page.is-active {
  background: var(--rd-green);
  color: var(--rd-bg);
  font-weight: 600;
  border: none;
}

.rd-page--gap {
  background: none;
  border: none;
  color: var(--rd-ink-soft);
}

/* comment card */
.rd-comment {
  display: flex;
  gap: 14px;
  border-bottom: 1px solid var(--rd-hairline);
  padding: 18px 0;
}

.rd-comment__avatar {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--rd-bg-alt);
  color: var(--rd-green);
  font-family: var(--rd-font-serif);
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rd-comment__body {
  flex: 1;
  min-width: 0;
}

.rd-comment__meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.rd-comment__author {
  font-size: 14px;
  font-weight: 700;
  color: var(--rd-ink);
}

.rd-comment__date {
  font-size: 12px;
  color: var(--rd-ink-soft);
}

.rd-comment__edition {
  font-size: 12px;
  color: var(--rd-ink-soft);
}

.rd-comment__stars {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.rd-comment__score {
  font-size: 12px;
  color: var(--rd-ink-soft);
}

.rd-comment__text {
  font-size: 14px;
  line-height: 1.6;
  color: #3a352d;
  margin: 6px 0 0;
}

.rd-spoiler__warn {
  font-size: 13px;
  color: var(--rd-ink-mid);
  margin: 6px 0 8px;
}

.rd-spoiler__content {
  display: none;
}

.rd-spoiler.is-open .rd-spoiler__content {
  display: block;
}

/* --- chips (etap 4) ----------------------------------------------------- */
.rd-chip {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 8px 15px;
  border-radius: 20px;
  background: var(--rd-green-tint);
  color: var(--rd-green);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.rd-chip:hover {
  background: var(--rd-green-tint-strong);
}

/* --- bottom sheet (etap 5) ----------------------------------------------- */
.rd-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 78vh;
  overflow-y: auto;
  background: var(--rd-bg);
  z-index: 50;
  border-radius: 18px 18px 0 0;
  padding: 18px 20px 28px;
  box-shadow: 0 -8px 24px rgba(0,0,0,.15);
  transform: translateY(100%);
  visibility: hidden;
  transition: transform .25s ease, visibility 0s linear .25s;
}

.rd-sheet.is-open {
  transform: translateY(0);
  visibility: visible;
  transition: transform .25s ease;
  animation: rd-sheetUp .25s ease;
}

.rd-sheet__handle {
  width: 36px;
  height: 4px;
  background: rgba(43,38,32,.2);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.rd-sheet__title {
  font-family: var(--rd-font-serif);
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 14px;
}

@media (min-width: 900px) {
  .rd-sheet,
  #rd-cat-sheet-scrim {
    display: none;
  }
}

/* --- category tree (etap 5) ----------------------------------------------- */
.rd-cat-tree,
.rd-cat-tree__children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rd-cat-tree__children {
  padding-left: 12px;
  margin-top: 2px;
}

.rd-cat-tree__row {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.rd-cat-tree__toggle {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin-right: 4px;
  color: var(--rd-ink-soft);
  transform: rotate(-90deg);
  transition: transform .15s ease;
}

.rd-cat-tree__toggle.is-open {
  transform: rotate(0deg);
}

.rd-cat-tree__spacer {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 4px;
  flex-shrink: 0;
}

.rd-cat-link {
  display: block;
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 400;
  color: var(--rd-ink-mid);
  text-decoration: none;
}

.rd-cat-link:hover {
  color: var(--rd-green);
}

.rd-cat-link.is-active {
  font-weight: 700;
  background: var(--rd-green-tint);
  color: var(--rd-green);
}

/* alerts/messages — etap 6 */
.rd-alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 12px;
}

.rd-alert--success {
  background: var(--rd-green-tint);
  color: var(--rd-green);
}

.rd-alert--error {
  background: rgba(168,64,47,.1);
  color: var(--rd-brick);
}

/* rating picker (etap 6, review form) */
.rd-rate-picker {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}

.rd-rate-picker button {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--rd-star-empty);
}

.rd-rate-picker button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.rd-rate-picker button.is-filled {
  color: var(--rd-gold);
}

/* Autocomplete (jQuery UI) override — markup generuje jQuery UI
   (initAutocomplete w base.html), nie zmieniaj struktury, tylko wygląd.
   Menu widget dopisuje "ui-menu-item" do <li> i "ui-menu-item-wrapper" do
   jego dziecka automatycznie w refresh() — niezależnie od własnego
   _renderItem (który generuje wewnątrz <div><img>+.autocomplete-text). */
.ui-autocomplete {
  background: #fff;
  border: 1px solid var(--rd-hairline);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(43,38,32,.1);
  font-family: var(--rd-font-sans);
  font-size: 13.5px;
  padding: 4px;
  z-index: 60;
  list-style: none;
  margin: 4px 0 0;
}

.ui-autocomplete .ui-menu-item {
  list-style: none;
}

.ui-autocomplete .ui-menu-item-wrapper {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--rd-ink);
  cursor: pointer;
}

.ui-autocomplete .ui-menu-item-wrapper.ui-state-active {
  background: var(--rd-green-tint);
  border: none;
  color: var(--rd-ink);
}

.ui-autocomplete .autocomplete-text {
  display: inline-block;
}

.ui-autocomplete img {
  max-width: 32px;
  max-height: 44px;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 8px;
  border-radius: 4px;
}

/* ---------------------------------------------------------------------- */
/* 7. pages                                                               */
/* ---------------------------------------------------------------------- */
/* styl specyficzny dla poszczególnych stron — etapy 4–10 */

/* --- home (etap 4) ------------------------------------------------------- */
.rd-hero {
  background: linear-gradient(180deg, #f8f4ea, #fdfcfa);
  padding: 36px 20px 28px;
}

.rd-hero__eyebrow {
  font-family: var(--rd-font-serif);
  font-style: italic;
  font-size: 15px;
  color: #5c6f5f;
  margin: 0 0 8px;
}

.rd-hero__title {
  font-family: var(--rd-font-serif);
  font-weight: 600;
  font-size: clamp(28px, 5vw, 42px);
  color: var(--rd-ink);
  max-width: 640px;
  margin: 0;
}

.rd-hero__chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-top: 16px;
}

.rd-section {
  padding: 32px 20px;
}

.rd-section__title {
  font-family: var(--rd-font-serif);
  font-weight: 600;
  font-size: 20px;
  color: var(--rd-ink);
  margin: 0 0 16px;
}

.rd-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.rd-section__head .rd-section__title {
  margin: 0;
}

.rd-section__more {
  font-size: 13px;
  font-weight: 600;
  color: var(--rd-green);
  text-decoration: none;
  white-space: nowrap;
}

.rd-section__more:hover {
  text-decoration: underline;
}

.rd-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.rd-cat-card {
  display: block;
  background: #fff;
  border: 1px solid var(--rd-hairline);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--rd-ink);
  text-decoration: none;
}

.rd-cat-card:hover {
  border-color: var(--rd-green);
  color: var(--rd-green);
}

.rd-cta-account {
  background: var(--rd-bg-alt);
  padding: 36px 20px;
}

.rd-cta-account__inner {
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
}

.rd-cta-account__title {
  font-family: var(--rd-font-serif);
  font-weight: 600;
  font-size: 23px;
  color: var(--rd-ink);
  margin: 0 0 10px;
}

.rd-cta-account__text {
  font-size: 14.5px;
  color: var(--rd-ink-mid);
  margin: 0 0 20px;
}

.rd-cta-account__actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* --- list (etap 5) -------------------------------------------------------- */
.rd-shop {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  padding-block: 16px 48px;
}

.rd-shop__sidebar {
  width: 230px;
  flex-shrink: 0;
  position: sticky;
  top: 78px;
}

.rd-shop__sidebar-title {
  font-family: var(--rd-font-serif);
  font-weight: 600;
  font-size: 16px;
  margin: 0 0 12px;
}

.rd-shop__main {
  flex: 1;
  min-width: 0;
}

.rd-shop__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.rd-shop__title {
  font-family: var(--rd-font-serif);
  font-weight: 600;
  font-size: 26px;
  margin: 0;
}

.rd-shop__controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rd-shop__catbtn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 20px;
  border: 1px solid rgba(43,38,32,.2);
  background: #fff;
  font-family: var(--rd-font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--rd-ink);
  cursor: pointer;
}

.rd-empty {
  font-size: 14px;
  color: var(--rd-ink-soft);
  padding: 24px 0;
}

@media (max-width: 899.98px) {
  .rd-shop__sidebar {
    display: none;
  }
  .rd-shop__catbtn {
    display: inline-flex;
  }
}

/* --- detail (etap 6) ------------------------------------------------------ */
.rd-detail-page {
  padding-block: 16px 48px;
}

.rd-detail {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.rd-detail__cover {
  width: 360px;
  flex-shrink: 0;
}

.rd-detail__cover-img {
  width: 100%;
  display: block;
  border-radius: var(--rd-r-card);
  box-shadow: var(--rd-shadow-cover-lg);
}

.rd-cover-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-top: 10px;
}

.rd-cover-thumb {
  flex-shrink: 0;
  width: 64px;
  height: 96px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  background: none;
  cursor: pointer;
  overflow: hidden;
}

.rd-cover-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 4px;
}

.rd-cover-thumb.is-active {
  border-color: var(--rd-green);
}

@media (max-width: 559.98px) {
  .rd-detail__cover {
    width: 100%;
  }
}

.rd-detail__body {
  flex: 1;
  min-width: 260px;
}

.rd-detail__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.rd-detail__title {
  font-family: var(--rd-font-serif);
  font-weight: 600;
  font-size: clamp(24px, 3.4vw, 32px);
  line-height: 1.2;
  margin: 0;
}

.rd-detail__authors {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}

.rd-detail__authors a {
  color: var(--rd-green);
  text-decoration: none;
}

.rd-detail__authors a:hover {
  text-decoration: underline;
}

.rd-detail__rating {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.rd-detail__rating-label {
  font-size: 13px;
  color: var(--rd-ink-soft);
}

.rd-detail__publisher {
  font-size: 14px;
  margin: 0 0 10px;
}

.rd-detail__publisher a {
  color: var(--rd-green);
  text-decoration: none;
}

.rd-detail__publisher a:hover {
  text-decoration: underline;
}

.rd-detail__short-desc {
  font-size: 15px;
  line-height: 1.65;
  color: #3a352d;
  font-weight: 600;
  max-width: 600px;
  margin: 0 0 18px;
}

.rd-detail__offers-title {
  font-family: var(--rd-font-serif);
  font-weight: 600;
  font-size: 16px;
  margin: 0 0 10px;
}

.rd-detail__offers-sub {
  font-family: var(--rd-font-sans);
  font-weight: 400;
  font-size: 13px;
  color: var(--rd-ink-soft);
}

.rd-offers {
  width: 100%;
}

.rd-detail__description {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--rd-ink-mid);
  max-width: 640px;
  margin: 0 0 30px;
}

.rd-detail__infogrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px 24px;
  font-size: 13.5px;
  background: var(--rd-bg-alt);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 30px;
}

.rd-detail__info-label {
  color: var(--rd-ink-soft);
}

.rd-detail__editions-list {
  margin: 4px 0 0;
  padding-left: 18px;
}

.rd-review-form,
.rd-review-cta {
  background: var(--rd-bg-alt);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 40px;
}

.rd-review-form h3 {
  font-family: var(--rd-font-serif);
  font-weight: 600;
  font-size: 16px;
  margin: 0 0 12px;
}

.rd-review-form .rd-field {
  margin-bottom: 16px;
}

.rd-review-form textarea.rd-input {
  width: 100%;
  resize: vertical;
  box-sizing: border-box;
}

.rd-detail__form-hint {
  font-size: 12.5px;
  color: var(--rd-ink-soft);
}

.rd-field--row {
  flex-direction: row;
  align-items: center;
}

.rd-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--rd-ink-mid);
  cursor: pointer;
}

.rd-review-cta {
  text-align: center;
}

.rd-review-cta p {
  font-size: 14px;
  color: var(--rd-ink-mid);
  margin: 0 0 14px;
}

.rd-review-cta__actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.rd-comments {
  margin-bottom: 24px;
}

/* --- author (etap 7) ------------------------------------------------------ */
.rd-author-page {
  padding-block: 16px 48px;
}

.rd-author-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 14px;
}

.rd-author-head__avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--rd-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--rd-font-serif);
  font-weight: 600;
  font-size: 28px;
  color: var(--rd-green);
}

.rd-author-head__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rd-author-head__photo-source {
  font-size: 11px;
  font-style: italic;
  color: var(--rd-ink-soft);
  text-align: center;
  max-width: 76px;
  margin: 6px 0 0;
}

.rd-author-head__title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.rd-author-head__name {
  font-family: var(--rd-font-serif);
  font-weight: 600;
  font-size: 26px;
  margin: 0;
}

.rd-author-head__count {
  font-size: 13.5px;
  color: var(--rd-ink-soft);
  margin: 4px 0 0;
}

.rd-author-description {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--rd-ink-mid);
  max-width: 640px;
  margin: 0 0 28px;
}

/* --- search (etap 8) ------------------------------------------------------ */
.rd-search-page {
  padding-block: 22px 48px;
}

.rd-search-page__title {
  font-family: var(--rd-font-serif);
  font-weight: 600;
  font-size: 26px;
  margin: 0 0 16px;
}

.rd-search-hero--page {
  margin-top: 0;
  margin-bottom: 14px;
}

.rd-search-hero--page button[type="submit"] {
  flex-shrink: 0;
}

.rd-search-page__stats {
  font-size: 14px;
  color: var(--rd-ink-mid);
  margin: 0 0 18px;
}

.rd-search-page__anchors {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 30px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rd-hairline);
}

.rd-search-page__section {
  margin-bottom: 38px;
  scroll-margin-top: 80px;
}

.rd-person-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 420px;
}

.rd-person-list__item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--rd-hairline);
  text-decoration: none;
  color: inherit;
}

.rd-person-list__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--rd-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--rd-font-serif);
  font-weight: 600;
  color: var(--rd-green);
}

.rd-person-list__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rd-person-list__name {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--rd-ink);
}

.rd-person-list__role {
  display: block;
  font-size: 12px;
  color: var(--rd-ink-soft);
}

/* --- auth: login/register/account pages (etap 9) ------------------------- */
.rd-auth {
  max-width: var(--rd-max-auth);
  margin: 48px auto 64px;
  padding: 0 20px;
}

.rd-auth--wide {
  max-width: var(--rd-max-narrow);
}

.rd-auth__card {
  background: #fff;
  border: 1px solid var(--rd-hairline);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: var(--rd-shadow-auth);
}

.rd-auth__title {
  font-family: var(--rd-font-serif);
  font-weight: 600;
  font-size: 25px;
  color: var(--rd-ink);
  margin: 0 0 6px;
}

.rd-auth__subtitle {
  font-size: 13.5px;
  color: var(--rd-ink-soft);
  margin: 0 0 24px;
}

.rd-auth__social {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.rd-auth__social .rd-btn {
  width: 100%;
}

.rd-auth__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  color: var(--rd-ink-soft);
  margin-bottom: 20px;
}

.rd-auth__divider::before,
.rd-auth__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rd-hairline);
}

.rd-auth__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rd-auth__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.rd-auth__remember {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--rd-ink-mid);
  cursor: pointer;
}

.rd-auth__forgot {
  color: var(--rd-green);
  text-decoration: none;
  font-weight: 600;
}

.rd-auth__forgot:hover {
  text-decoration: underline;
}

.rd-auth__terms {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--rd-ink-mid);
  cursor: pointer;
}

.rd-auth__terms .rd-checkbox {
  margin-top: 2px;
  flex-shrink: 0;
}

.rd-auth__terms a {
  color: var(--rd-green);
  font-weight: 600;
  text-decoration: none;
}

.rd-auth__terms a:hover {
  text-decoration: underline;
}

.rd-auth__submit {
  margin-top: 4px;
  width: 100%;
}

.rd-auth__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.rd-auth__actions .rd-btn {
  flex: 1;
}

.rd-auth__footer {
  text-align: center;
  font-size: 13.5px;
  color: var(--rd-ink-mid);
  margin: 22px 0 0;
}

.rd-auth__footer a {
  color: var(--rd-green);
  font-weight: 700;
  text-decoration: none;
}

.rd-auth__footer a:hover {
  text-decoration: underline;
}

.rd-auth__text {
  font-size: 14px;
  color: var(--rd-ink);
  line-height: 1.6;
}

/* re-used by profile.html's card sections, on a 1000px container */
.rd-card {
  background: #fff;
  border: 1px solid var(--rd-hairline);
  border-radius: 12px;
  padding: 20px 28px;
  margin-bottom: 24px;
}

.rd-card__title {
  font-family: var(--rd-font-serif);
  font-weight: 600;
  font-size: 19px;
  color: var(--rd-ink);
  margin: 0 0 18px;
}

.rd-card__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rd-card__nav a {
  display: block;
  padding: 11px 4px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--rd-ink-mid);
  text-decoration: none;
  border-bottom: 1px solid var(--rd-hairline);
}

.rd-card__nav a:hover {
  color: var(--rd-green);
}

.rd-card__nav a.is-active {
  color: var(--rd-green);
  font-weight: 600;
}

.rd-card__nav a.is-danger {
  color: var(--rd-brick);
}

.rd-profile-layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
}

.rd-profile-layout__side {
  flex: 0 0 220px;
}

.rd-profile-layout__main {
  flex: 1;
  min-width: 0;
}

@media (max-width: 899.98px) {
  .rd-profile-layout {
    flex-direction: column;
  }

  .rd-profile-layout__side {
    flex: 1;
    width: 100%;
  }
}

/* --- author/publisher lists (etap 10) ------------------------------------ */
.rd-person-page {
  padding-block: 16px 48px;
}

.rd-person-page__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0 20px;
}

.rd-person-page__search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rd-person-page__search-box {
  width: 320px;
  max-width: 100%;
}

.rd-person-page__sort {
  flex-shrink: 0;
}

/* --- tags (etap 10) -------------------------------------------------------- */
.rd-tag-page {
  padding-block: 16px 48px;
}

.rd-tag-page__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* --- static/CMS pages: contact, page_detail (etap 10) ---------------------- */
.rd-page-narrow {
  padding-block: 24px 48px;
}

.rd-page-narrow__title {
  margin-bottom: 20px;
}

.rd-contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rd-article {
  padding-block: 24px 48px;
}

.rd-article__title {
  font-family: var(--rd-font-serif);
  font-weight: 600;
  font-size: 26px;
  margin: 0 0 20px;
}

.rd-article__body {
  font-size: 15px;
  line-height: 1.7;
  color: var(--rd-ink-mid);
}

.rd-article__body h2,
.rd-article__body h3 {
  font-family: var(--rd-font-serif);
  font-weight: 600;
  color: var(--rd-ink);
  margin: 28px 0 12px;
}

.rd-article__body p {
  margin: 0 0 16px;
}

.rd-article__body a {
  color: var(--rd-green);
}

/* --- 404 (etap 10; 500 is a fully standalone document, see templates/500.html) --- */
.rd-error-page {
  padding-block: 60px 80px;
}

.rd-error-card {
  background: #fff;
  border: 1px solid var(--rd-hairline);
  border-radius: 16px;
  box-shadow: var(--rd-shadow-auth);
  padding: 40px 32px;
  text-align: center;
}

.rd-error-card__code {
  font-family: var(--rd-font-serif);
  font-weight: 600;
  font-size: 64px;
  color: var(--rd-ink-soft);
  margin: 0 0 8px;
}

.rd-error-card__title {
  font-family: var(--rd-font-serif);
  font-weight: 600;
  font-size: 22px;
  margin: 0 0 12px;
}

.rd-error-card__text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--rd-ink-mid);
  margin: 0 0 24px;
}

.rd-error-card__search {
  max-width: 420px;
  margin: 0 auto 24px;
}

.rd-error-card__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------------------------------------------------------------------- */
/* 8. legacy bridge                                                       */
/* ---------------------------------------------------------------------- */
/* nadpisania dla treści jeszcze niezmigrowanych — etap 9 */
