/* ============================================================
   Księgarnia Ezoterium — layout spójny z encyklopedią.
   Nagłówki: Cormorant Garamond, tekst: Manrope.
   Kolor książki wjeżdża zmienną --c ustawianą inline na <body>/kartach.
   ============================================================ */

:root {
  --bg: #07061a;
  --panel: rgba(255, 255, 255, .028);
  --panel-2: rgba(255, 255, 255, .05);
  --ink: #f2edfb;
  --ink-soft: rgba(238, 233, 252, .9);
  --ink-mute: rgba(224, 218, 246, .76);
  --line: rgba(200, 188, 235, .14);
  --display: 'Cormorant Garamond', Georgia, serif;
  --text: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  --radius: 18px;
  --maxw: 1120px;
  --violet: #9a7ce8;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.ksg {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-size: 16.5px;
  line-height: 1.75;
  font-weight: 400;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

.ksg-aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 45% at 78% -8%, var(--c-14, rgba(154, 124, 232, .14)) 0%, transparent 70%),
    radial-gradient(45% 38% at 8% 18%, rgba(90, 160, 232, .07) 0%, transparent 70%),
    radial-gradient(120% 80% at 50% 115%, #0d0930 0%, transparent 60%);
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--c-light, #cdbaf6);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--c-35, rgba(154, 124, 232, .35)); }

/* ---------- górna belka ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(7, 6, 26, .82);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

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

.topbar__home {
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: .04em;
  text-decoration: none;
  color: #f3e6c4;
  white-space: nowrap;
}
.topbar__home span { color: var(--ink); }
.topbar__home:hover span { color: #f3e6c4; }

.topbar__sep { color: var(--ink-mute); }

.topbar__store {
  font-weight: 600;
  font-size: .82rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  white-space: nowrap;
}
.topbar__store:hover { color: var(--ink); }

.topbar__nav {
  display: flex;
  gap: 4px;
  margin-left: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar__nav::-webkit-scrollbar { display: none; }
/* przewijany pasek działów — wygaszona prawa krawędź sygnalizuje, że jest ich więcej
   (bez tego ucięte „Numerolo…” wyglądało na błąd); pusty margines pod maską,
   gdy wszystko się mieści, więc na szerokim ekranie nic nie blednie */
.topbar__nav {
  padding-right: 28px;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}

.topbar__link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
}
.topbar__link .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot, var(--violet));
  box-shadow: 0 0 8px var(--dot, var(--violet));
}
.topbar__link:hover { color: var(--ink); background: var(--panel-2); }
.topbar__link.is-active {
  color: var(--ink);
  background: var(--panel-2);
  border-color: var(--line);
}

/* ---------- okruszki ---------- */

.crumbs {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 20px 0;
  font-size: .8rem;
  color: var(--ink-mute);
}
.crumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
}
.crumbs li + li::before { content: '›'; margin: 0 6px; opacity: .6; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- układ ---------- */

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 20px 70px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--c-90, var(--ink-mute));
}

.section__title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.25;
  margin: 0 0 18px;
}

/* ---------- hero księgarni ---------- */

.hero { padding: 34px 0 20px; max-width: 780px; }
.hero--slim { padding-bottom: 0; }

.hero__title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.2rem, 5.4vw, 3.4rem);
  line-height: 1.12;
  margin: 0 0 14px;
}
.hero__title em { font-style: italic; color: #f3e6c4; }

.hero__lead {
  font-size: 1.06rem;
  color: var(--ink-soft);
  margin: 0;
  max-width: 640px;
}
.hero__lead a { color: var(--c-light, #cdbaf6); }

.hero__stats {
  display: flex;
  gap: 34px;
  margin: 26px 0 0;
  padding: 0;
}
.hero__stats div { display: flex; flex-direction: column; }
.hero__stats dt {
  font-family: var(--display);
  font-size: 1.7rem;
  color: #f3e6c4;
  line-height: 1.1;
}
.hero__stats dd { margin: 0; font-size: .82rem; color: var(--ink-mute); }

/* ---------- półka z książkami ---------- */

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  margin-top: 26px;
}

.bookcard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .25s, transform .25s, background .25s;
}
.bookcard:hover {
  border-color: var(--c-35, var(--line));
  background: var(--c-08, var(--panel-2));
  transform: translateY(-3px);
}

.bookcard__link {
  display: flex;
  gap: 18px;
  padding: 18px;
  text-decoration: none;
  height: 100%;
}

.bookcard__coverbox { flex: 0 0 118px; }
.bookcard__cover {
  width: 118px;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .45);
}

.bookcard__body { display: flex; flex-direction: column; gap: 7px; min-width: 0; }

.bookcard__title {
  font-family: var(--display);
  font-size: 1.22rem;
  font-weight: 500;
  line-height: 1.3;
}
.bookcard__author { font-size: .8rem; color: var(--c-90, var(--ink-mute)); font-weight: 600; }
.bookcard__desc {
  font-size: .84rem;
  color: var(--ink-mute);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bookcard__meta { font-size: .78rem; color: var(--ink-mute); margin-top: auto; }
.bookcard__cta {
  font-size: .84rem;
  font-weight: 600;
  color: var(--c-light, #cdbaf6);
}

/* Baner zgody cookies przeniesiony do wspólnego assets/js/consent.js
   (wstrzykuje własne style ezo-consent). */

/* ---------- preloader zakupu ---------- */

.buyloader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 6, 26, .88);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.buyloader__box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 34px 42px;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 1px solid var(--c-22, var(--line));
}

.buyloader__ring {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid var(--c-22, rgba(154, 124, 232, .22));
  border-top-color: var(--c-light, #cdbaf6);
  animation: buyloader-spin .8s linear infinite;
}

.buyloader__text {
  margin: 0;
  font-size: .92rem;
  color: var(--ink-soft);
}

@keyframes buyloader-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .buyloader__ring { animation-duration: 2.4s; }
}

/* ---------- panel po płatności ---------- */

.paybox {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin: 20px 0 6px;
  padding: 22px 26px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel-2);
}
.paybox--ok { border-color: rgba(94, 210, 160, .45); background: rgba(94, 210, 160, .07); }
.paybox--warn { border-color: rgba(232, 184, 75, .4); background: rgba(232, 184, 75, .06); }

.paybox__icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
}
.paybox--ok .paybox__icon { background: rgba(94, 210, 160, .16); color: #5ed2a0; }
.paybox--warn .paybox__icon { background: rgba(232, 184, 75, .16); color: #e8b84b; }

.paybox__title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.4rem;
  margin: 2px 0 8px;
}
.paybox__text { margin: 0 0 14px; color: var(--ink-soft); font-size: .95rem; }

/* ---------- hero książki (landing) ---------- */

.wrap--book { padding-top: 20px; }

.bhero {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: clamp(24px, 4vw, 52px);
  align-items: start;
  padding: 26px 0 34px;
}

.bhero__coverbox { position: sticky; top: 76px; }
.bhero__cover {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, .55),
    0 0 60px var(--c-14, transparent);
}

.bhero__title {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.9rem, 4.4vw, 2.9rem);
  line-height: 1.15;
  margin: 0 0 14px;
}

.bhero__lead {
  font-size: 1.04rem;
  color: var(--ink-soft);
  margin: 0 0 18px;
}

.bhero__facts {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 22px;
  padding: 0;
}
.bhero__facts li {
  font-size: .78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--c-22, var(--line));
  background: var(--c-08, var(--panel));
  color: var(--ink-soft);
}

/* ---------- blok zakupu ---------- */

.buy {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  scroll-margin-top: 90px;
}

.buy__option {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.buy__label {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.buy__price {
  font-family: var(--display);
  font-size: 1.75rem;
  color: #f3e6c4;
  line-height: 1;
}

.buy__hint { font-size: .76rem; color: var(--ink-mute); }

/* formularz zakupu ebooka: zgoda na natychmiastowe dostarczenie + przycisk */
.buyform {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
}
.buyform__zgoda {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: 460px;
  font-size: .74rem;
  line-height: 1.5;
  color: var(--ink-mute);
  cursor: pointer;
}
.buyform__zgoda input {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  accent-color: var(--c, var(--violet));
  cursor: pointer;
}
.buyform__zgoda a { color: var(--c-light, #cdbaf6); }
.buy__option .buyform .btn { align-self: stretch; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  font-family: var(--text);
  font-size: .9rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .2s, box-shadow .2s, background .2s;
}

.btn--primary {
  background: linear-gradient(135deg, var(--c, var(--violet)), var(--c-light, #cdbaf6));
  color: #0a0820;
  box-shadow: 0 8px 26px var(--c-35, rgba(154, 124, 232, .35));
}
.btn--primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 32px var(--c-35, rgba(154, 124, 232, .4)); }

.btn--ghost {
  background: transparent;
  border-color: var(--c-35, var(--line));
  color: var(--ink);
}
.btn--ghost:hover:not(:disabled) { background: var(--c-08, var(--panel-2)); }

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

.btnrow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* ---------- sekcje treści ---------- */

.learn, .toc, .author, .excerpt, .tags, .also { margin: 44px 0 0; }

.learn__grid { max-width: 820px; }
.learn__item { margin: 0 0 16px; color: var(--ink-soft); }
.learn__item:first-of-type::first-letter {
  font-family: var(--display);
  font-size: 3.1em;
  float: left;
  line-height: .85;
  padding-right: 10px;
  color: var(--c-light, #cdbaf6);
}

/* spis treści */

.toc__list {
  list-style: none;
  margin: 0;
  padding: 22px 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  columns: 2;
  column-gap: 44px;
}
.toc__main {
  font-weight: 600;
  padding: 7px 0 3px;
  border-bottom: 1px solid var(--line);
  break-inside: avoid;
}
.toc__sub {
  font-size: .86rem;
  color: var(--ink-mute);
  padding: 3px 0 3px 18px;
  break-inside: avoid;
}

/* od autorki */

.author {
  max-width: 820px;
  padding: 26px 30px;
  background: var(--c-08, var(--panel));
  border-left: 3px solid var(--c-60, var(--violet));
  border-radius: 0 var(--radius) var(--radius) 0;
}
.author p { margin: 0 0 14px; color: var(--ink-soft); font-style: italic; }
.author p:last-child { margin-bottom: 0; }

/* fragment książki */

.excerpt__note { color: var(--ink-mute); font-size: .92rem; margin: -6px 0 22px; }

.excerpt__body {
  max-width: 760px;
  padding: 34px clamp(22px, 5vw, 54px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 1.02rem;
  line-height: 1.85;
  color: var(--ink-soft);
}
.excerpt__body h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.6rem;
  color: var(--ink);
  margin: 34px 0 14px;
}
.excerpt__body h3:first-child { margin-top: 0; }
.excerpt__body h4 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--ink);
  margin: 26px 0 10px;
}
.excerpt__body p { margin: 0 0 16px; }
.excerpt__body ul, .excerpt__body ol { margin: 0 0 16px; padding-left: 24px; }
.excerpt__body li { margin-bottom: 6px; }
.excerpt__body em { color: var(--c-light, #cdbaf6); }

/* paginacja fragmentu (dokłada ją JS; bez JS fragment jest w całości) */

.fragpager {
  max-width: 760px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0;
  scroll-margin-top: 84px;
}

.fragpager__btn {
  font-family: var(--text);
  font-size: .84rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--c-35, var(--line));
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.fragpager__btn:hover:not(:disabled) { background: var(--c-08, var(--panel-2)); }
.fragpager__btn:disabled { opacity: .35; cursor: default; }

.fragpager__info {
  font-size: .8rem;
  color: var(--ink-mute);
  white-space: nowrap;
}

.excerpt__body [hidden] { display: none; }

.excerpt__end {
  max-width: 760px;
  margin-top: 20px;
  padding: 20px 26px;
  border-radius: var(--radius);
  background: var(--c-08, var(--panel));
  border: 1px solid var(--c-22, var(--line));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.excerpt__end p { margin: 0; color: var(--ink-soft); }

/* tagi */

.tags__cloud { display: flex; flex-wrap: wrap; gap: 8px; }

.tag {
  font-size: .8rem;
  font-weight: 500;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  text-decoration: none;
}
.tag--toc {
  border-color: var(--c-22, var(--line));
  background: var(--c-08, var(--panel));
  color: var(--ink);
}

/* ---------- CTA ---------- */

.cta {
  margin: 44px 0 0;
  padding: 26px 30px;
  border-radius: var(--radius);
  background:
    radial-gradient(80% 130% at 90% 0%, var(--c-14, rgba(154, 124, 232, .14)) 0%, transparent 60%),
    var(--panel-2);
  border: 1px solid var(--c-22, var(--line));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.cta__title {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.5rem;
  margin: 0 0 4px;
}
.cta__lead { margin: 0; color: var(--ink-soft); font-size: .94rem; }

/* ---------- pozostałe książki ---------- */

.also__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.mini {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: border-color .25s, background .25s, transform .25s;
}
.mini:hover {
  border-color: var(--c-35, var(--line));
  background: var(--c-08, var(--panel-2));
  transform: translateY(-2px);
}
.mini__cover {
  width: 62px;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.mini__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mini__title {
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 500;
  line-height: 1.3;
}
.mini__more { font-size: .8rem; font-weight: 600; color: var(--c-light, #cdbaf6); }

/* ---------- stopka ---------- */

.ksg-footer {
  border-top: 1px solid var(--line);
  background: rgba(7, 6, 26, .7);
}
.ksg-footer__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 20px 34px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ksg-footer__brand {
  font-family: var(--display);
  font-size: 1.05rem;
  color: #f3e6c4;
}
.ksg-footer__nav { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: .84rem; }
.ksg-footer__nav a { color: var(--ink-mute); text-decoration: none; }
.ksg-footer__nav a:hover { color: var(--ink); text-decoration: underline; }
.ksg-footer__note { font-size: .76rem; color: var(--ink-mute); }

/* ---------- responsywność ---------- */

@media (max-width: 860px) {
  .bhero { grid-template-columns: 1fr; }
  .bhero__coverbox {
    position: static;
    max-width: 240px;
    margin: 0 auto;
  }
  .toc__list { columns: 1; }
}

@media (max-width: 560px) {
  .bookcard__link { flex-direction: column; }
  .bookcard__coverbox { flex-basis: auto; max-width: 150px; }
  .bookcard__cover { width: 150px; }
  .hero__stats { gap: 22px; }
  .excerpt__end, .cta { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bookcard, .mini, .btn { transition: none; }
}
