/* ספרים / Books – book gallery + single book page (Hebrew RTL and English LTR). Uses the site's Elementor kit tokens and fonts. */
.siach-books, .siach-book {
  --sb-ink: var(--e-global-color-primary, #474848);
  --sb-paper: var(--e-global-color-secondary, #FDFAF3);
  --sb-cream: var(--e-global-color-text, #F8F7EE);
  --sb-gold: var(--e-global-color-accent, #DC9E35);
  --sb-gold-dark: #c4861f;
  --sb-line: rgba(71, 72, 72, .14);
  --sb-head: "תל אביב", sans-serif;
  --sb-body: "פולין", sans-serif;
  box-sizing: border-box;
  width: 96%;
  max-width: 1320px;
  margin: clamp(2rem, 4vw, 4rem) auto clamp(3rem, 5vw, 5rem);
  color: var(--sb-ink);
  font-family: var(--sb-body);
  font-weight: 200;
}
.siach-books *, .siach-book * { box-sizing: border-box; }
.siach-books-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- gallery ---------- */
.siach-books__grid {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(190px, 42vw), 1fr));
  gap: clamp(2rem, 3.5vw, 3.25rem) clamp(1rem, 2.5vw, 2.5rem);
}
.siach-books__item { margin: 0; padding: 0; scroll-margin-top: 120px; }
.siach-books__card {
  display: flex; flex-direction: column; align-items: center; height: 100%;
  color: var(--sb-ink) !important; text-decoration: none !important;
  border-radius: 1em; outline-offset: 6px;
}
.siach-books__cover {
  position: relative; width: 100%; aspect-ratio: 2 / 3;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0 6%;
}
/* soft "shelf" shadow under each cover */
.siach-books__cover::after {
  content: ""; position: absolute; left: 12%; right: 12%; bottom: -10px; height: 14px;
  background: radial-gradient(ellipse at center, rgba(71, 72, 72, .22), rgba(71, 72, 72, 0) 70%);
  z-index: 0; transition: opacity .3s ease;
}
.siach-books__cover img {
  position: relative; z-index: 1; display: block;
  width: auto !important; height: auto !important; max-width: 100% !important; max-height: 100% !important;
  border-radius: 6px 2px 2px 6px; /* Hebrew books: spine on the right */
  box-shadow: 0 1px 2px rgba(71, 72, 72, .18), 0 14px 26px -12px rgba(71, 72, 72, .55);
  transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease;
}
/* size known before the image loads (see siach_books_cover_fit) – same final size as before */
.siach-books__cover img.siach-fit-w { width: 100% !important; height: auto !important; }
.siach-books__cover img.siach-fit-h { height: 100% !important; width: auto !important; }
.siach-books__title {
  display: block; margin-top: 1.25em; padding: 0 .25em;
  font-family: var(--sb-head); font-weight: 800;
  font-size: clamp(1rem, .85rem + .45vw, 1.2rem); line-height: 1.3; text-align: center;
  transition: color .2s ease;
}
.siach-books__title::after {
  content: ""; display: block; width: 28px; height: 2px; margin: .6em auto 0;
  background: var(--sb-gold); border-radius: 2px; transform: scaleX(.4); opacity: .0;
  transition: transform .3s ease, opacity .3s ease;
}
.siach-books__card:hover .siach-books__cover img,
.siach-books__card:focus-visible .siach-books__cover img {
  transform: translateY(-8px);
  box-shadow: 0 1px 2px rgba(71, 72, 72, .18), 0 24px 34px -14px rgba(71, 72, 72, .6);
}
.siach-books__card:hover .siach-books__cover::after { opacity: .6; }
.siach-books__card:hover .siach-books__title,
.siach-books__card:focus-visible .siach-books__title { color: var(--sb-gold-dark); }
.siach-books__card:hover .siach-books__title::after,
.siach-books__card:focus-visible .siach-books__title::after { transform: scaleX(1); opacity: 1; }
.siach-books__card:focus-visible { outline: 2px solid var(--sb-gold); }

/* ---------- purchase link: small, quiet, still obvious ---------- */
.siach-books__buy {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-start; gap: .6rem 1rem; /* RTL: starts at the right edge */
  margin: 0 0 clamp(2.25rem, 4.5vw, 3.75rem); padding: 0;
  font-size: 1rem; line-height: 1.3;
}
.siach-books__buy-q { color: var(--sb-ink); opacity: .85; font-size: clamp(1.15rem, 1rem + .45vw, 1.4rem); }
.siach-books-shop {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .5em 1.15em; border: 1px solid var(--sb-gold); border-radius: 999px;
  background: rgba(220, 158, 53, .08); color: var(--sb-gold-dark) !important; text-decoration: none !important;
  font-family: var(--sb-body); font-weight: 800; font-size: .95rem; line-height: 1.2; white-space: nowrap;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.siach-books-cart { flex: none; width: 1.15em; height: 1.15em; }
.siach-books-shop:hover, .siach-books-shop:focus-visible {
  background: var(--sb-gold); border-color: var(--sb-gold); color: #fff !important;
}
.siach-books-shop:focus-visible { outline: 2px solid var(--sb-gold); outline-offset: 3px; }
/* "shop opening soon" notice (while SIACH_BOOKS_SHOP_READY is false) */
.siach-books-shopwrap { position: relative; display: inline-block; }
.siach-books-shopwrap > summary { list-style: none; cursor: pointer; user-select: none; }
.siach-books-shopwrap > summary::-webkit-details-marker { display: none; }
.siach-books-shopwrap[open] > summary { background: var(--sb-gold); border-color: var(--sb-gold); color: #fff !important; }
.siach-books-notice {
  position: absolute; z-index: 20; top: calc(100% + 10px); right: 0;
  width: max-content; max-width: min(340px, 86vw);
  padding: .85em 1.1em; border-radius: 1em; border: 1px solid rgba(220, 158, 53, .45);
  background: #fff; color: var(--sb-ink); box-shadow: 0 14px 30px -14px rgba(71, 72, 72, .45);
  font-family: var(--sb-body); font-weight: 200; font-size: 1rem; line-height: 1.55; text-align: right;
  animation: siach-books-pop .18s ease-out;
}
.siach-books-notice::before { /* small pointer towards the button */
  content: ""; position: absolute; top: -7px; right: 1.6em; width: 12px; height: 12px;
  background: #fff; border-top: 1px solid rgba(220, 158, 53, .45); border-left: 1px solid rgba(220, 158, 53, .45);
  transform: rotate(45deg);
}
.siach-books-notice p { margin: 0; }
.siach-books-notice a {
  font-weight: 800; color: var(--sb-gold-dark) !important; white-space: nowrap;
  text-decoration: underline !important; text-underline-offset: 3px;
}
@keyframes siach-books-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.siach-books-arrow { flex: none; width: 1.6em; height: auto; }

/* ---------- single book ---------- */
.siach-book__back {
  display: inline-flex; align-items: center; gap: .6em;
  padding: .55em 1.3em; border: 1px solid var(--sb-line); border-radius: 999px;
  color: var(--sb-ink) !important; text-decoration: none !important; font-size: 1rem; font-weight: 200;
  background: rgba(255, 255, 255, .45);
  transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}
.siach-book__back .siach-books-arrow { width: 1.35em; transform: scaleX(-1); color: var(--sb-gold); }
.siach-book__back:hover, .siach-book__back:focus-visible { border-color: var(--sb-gold); color: var(--sb-gold-dark) !important; background: #fff; }

.siach-book__layout {
  display: grid; grid-template-columns: minmax(220px, 380px) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem); align-items: start;
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
}
.siach-book__cover { margin: 0; position: sticky; top: 110px; }
.siach-book__cover img {
  display: block; width: 100% !important; height: auto !important;
  border-radius: 8px 3px 3px 8px;
  box-shadow: 0 1px 3px rgba(71, 72, 72, .2), 0 30px 50px -24px rgba(71, 72, 72, .65);
}
.siach-book__title {
  margin: 0 0 .75em; padding-bottom: .55em; border-bottom: 2px solid var(--sb-gold);
  display: inline-block;
  font-family: var(--sb-head) !important; font-weight: 800 !important; color: var(--sb-ink) !important;
  font-size: clamp(1.6rem, 1.1rem + 1.8vw, 2.75rem) !important; line-height: 1.15 !important;
}
.siach-book__text {
  max-width: 68ch;
  font-size: clamp(1.05rem, .95rem + .4vw, 1.3rem); line-height: 1.8; font-weight: 200;
}
.siach-book__text p { margin: 0 0 1.1em; }
.siach-book__text p:last-child { margin-bottom: 0; }
.siach-book__text[dir="ltr"] { text-align: left; }
.siach-book__title[dir="ltr"] { direction: ltr; }
/* the heading font's Latin glyphs are capitals only – English titles use the body font */
.siach-books__title[lang="en"], .siach-book__title[lang="en"], .siach-book__nav-title[lang="en"] { font-family: var(--sb-body) !important; }
.siach-book__actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.75rem;
  margin-top: clamp(2rem, 3.5vw, 3rem); padding-top: clamp(1.5rem, 2.5vw, 2rem); border-top: 1px solid var(--sb-line);
}
.siach-book__to-gallery {
  color: var(--sb-ink) !important; text-decoration: underline !important; text-decoration-color: var(--sb-gold) !important;
  text-underline-offset: 5px; font-size: 1.05rem;
}
.siach-book__to-gallery:hover { color: var(--sb-gold-dark) !important; }

.siach-book__nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
  margin-top: clamp(3rem, 6vw, 5rem); padding-top: 1.5rem; border-top: 1px solid var(--sb-line);
}
.siach-book__nav-link {
  display: flex; flex-direction: column; gap: .25em; padding: 1em 1.25em; border-radius: 1em;
  color: var(--sb-ink) !important; text-decoration: none !important;
  transition: background-color .2s ease;
}
.siach-book__nav-link:hover, .siach-book__nav-link:focus-visible { background: rgba(220, 158, 53, .1); }
.siach-book__nav-link--next { text-align: left; align-items: flex-end; grid-column: 2; }
.siach-book__nav-label { font-size: .9rem; color: var(--sb-gold-dark); }
.siach-book__nav-label::before { content: "→ "; }
.siach-book__nav-link--next .siach-book__nav-label::before { content: ""; }
.siach-book__nav-link--next .siach-book__nav-label::after { content: " ←"; }
.siach-book__nav-title { font-family: var(--sb-head); font-weight: 800; font-size: clamp(1rem, .9rem + .4vw, 1.25rem); line-height: 1.3; }

/* ---------- English page (LTR) ---------- */
.siach-books[dir="ltr"], .siach-book[dir="ltr"] { text-align: left; }
/* the heading font's Latin glyphs are capitals only – English interface text uses the body font */
.siach-books[dir="ltr"] .siach-books__title, .siach-book[dir="ltr"] .siach-book__nav-title { font-family: var(--sb-body); font-weight: 400; }
.siach-books__orig {
  display: block; margin-top: .35em; padding: 0 .25em; text-align: center;
  font-family: var(--sb-body); font-weight: 200; font-size: .95rem; line-height: 1.3; opacity: .7;
}
.siach-book[dir="ltr"] .siach-book__title { font-weight: 400 !important; }
.siach-book__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5em 1em;
  margin: -.25em 0 1.5em; font-size: 1rem; line-height: 1.5; opacity: .9;
}
.siach-book__tag {
  display: inline-block; padding: .15em .75em; border-radius: 999px; border: 1px solid var(--sb-gold);
  color: var(--sb-gold-dark); font-size: .85rem; font-weight: 400; letter-spacing: .02em;
}
.siach-book__he { font-weight: 400; }
.siach-book__translit { font-style: italic; opacity: .8; }
.siach-book__translit::before { content: "·"; font-style: normal; margin: 0 .5em 0 .1em; opacity: .6; }
.siach-book__note { max-width: 68ch; margin: 1.5em 0 0; font-size: .95rem; font-style: italic; opacity: .7; }
.siach-book[dir="ltr"] .siach-book__back .siach-books-arrow { transform: none; }
.siach-books[dir="ltr"] .siach-books-notice, .siach-book[dir="ltr"] .siach-books-notice { right: auto; left: 0; text-align: left; }
.siach-books[dir="ltr"] .siach-books-notice::before, .siach-book[dir="ltr"] .siach-books-notice::before {
  right: auto; left: 1.6em; border-left: 0; border-right: 1px solid rgba(220, 158, 53, .45); transform: rotate(-45deg);
}
.siach-book[dir="ltr"] .siach-book__nav-link--next { text-align: right; }
.siach-book[dir="ltr"] .siach-book__nav-label::before { content: "← "; }
.siach-book[dir="ltr"] .siach-book__nav-link--next .siach-book__nav-label::before { content: ""; }
.siach-book[dir="ltr"] .siach-book__nav-link--next .siach-book__nav-label::after { content: " →"; }

@media (max-width: 767px) {
  .siach-books__grid { row-gap: 1.75rem; }
  .siach-books__title { margin-top: 1em; }
  .siach-book__layout { grid-template-columns: 1fr; }
  .siach-book__cover { position: static; width: min(280px, 72%); margin: 0 auto; }
  .siach-book__title { display: block; text-align: center; }
  .siach-book__title[dir="ltr"] { text-align: center; }
  .siach-book__actions { justify-content: center; }
  .siach-book__nav { grid-template-columns: 1fr; }
  .siach-book__nav-link--next { grid-column: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .siach-books *, .siach-book * { transition: none !important; }
}
