/* Hebrew Books slice — scoped, distinct from the main app's Tailwind design. */

:root {
  --hb-paper: #f7f1e5;
  --hb-paper-dark: #ece1c6;
  --hb-ink: #1c150c;
  --hb-ink-soft: #4a3a24;
  --hb-burgundy: #7a1f2b;
  --hb-burgundy-dark: #571520;
  --hb-gold: #b78a33;
  --hb-gold-soft: #e0c47d;
  --hb-rule: #c9b48a;
  --hb-serif: "Frank Ruhl Libre", "David Libre", "Noto Serif Hebrew", Georgia, serif;
  --hb-sans: "Miriam Libre", "Alef", system-ui, sans-serif;
}

.hb-body {
  margin: 0;
  background-color: var(--hb-paper);
  background-image:
    radial-gradient(circle at 12% 20%, rgba(183, 138, 51, 0.06) 0, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(122, 31, 43, 0.05) 0, transparent 45%);
  color: var(--hb-ink);
  font-family: var(--hb-serif);
  font-size: 18px;
  line-height: 1.7;
  font-feature-settings: "kern" 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hb-main {
  flex: 1;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
  box-sizing: border-box;
}

/* ====== Header ====== */
.hb-header {
  background: linear-gradient(180deg, #2a1008 0%, #3b1810 100%);
  color: var(--hb-gold-soft);
  border-bottom: 3px double var(--hb-gold);
}

.hb-header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hb-brand {
  display: flex;
  align-items: baseline;
  gap: 14px;
  color: var(--hb-gold-soft);
  text-decoration: none;
}

.hb-brand-mark {
  font-family: var(--hb-serif);
  font-weight: 900;
  font-size: 30px;
  letter-spacing: 0.5px;
  color: #f3dfa8;
}

.hb-brand-tag {
  font-family: var(--hb-sans);
  font-size: 12px;
  letter-spacing: 2px;
  opacity: 0.8;
  text-transform: uppercase;
}

.hb-searchbar {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fff8ea;
  border: 1px solid var(--hb-gold);
  border-radius: 999px;
  padding: 6px 14px;
  max-width: 640px;
  margin-inline: auto;
  width: 100%;
  box-sizing: border-box;
}

.hb-searchbar input {
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--hb-serif);
  font-size: 17px;
  color: var(--hb-ink);
  flex: 1;
  padding: 6px 2px;
}

.hb-searchbar button {
  background: var(--hb-burgundy);
  color: #fff8ea;
  border: none;
  padding: 8px 18px;
  border-radius: 999px;
  font-family: var(--hb-sans);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
}

.hb-searchbar button:hover { background: var(--hb-burgundy-dark); }

.hb-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hb-nav a {
  display: inline-block;
  padding: 8px 18px;
  font-family: var(--hb-sans);
  font-size: 14px;
  color: var(--hb-gold-soft);
  text-decoration: none;
  border-radius: 4px 4px 0 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}

.hb-nav a:hover { color: #fff8ea; }
.hb-nav a.active { color: #fff8ea; border-bottom-color: var(--hb-gold); }

/* ====== Footer ====== */
.hb-footer {
  background: #1c150c;
  color: #c9b48a;
  text-align: center;
  padding: 14px 24px;
  font-family: var(--hb-sans);
  font-size: 12px;
  letter-spacing: 0.5px;
}

.hb-footer a { color: var(--hb-gold-soft); text-decoration: none; }
.hb-footer a:hover { color: #fff8ea; text-decoration: underline; }

/* ====== Flash ====== */
.hb-flash {
  max-width: 1180px;
  margin: 12px auto 0;
  padding: 10px 18px;
  border-radius: 6px;
  font-family: var(--hb-sans);
  font-size: 14px;
}

.hb-flash-alert { background: #fce8ea; color: #571520; border: 1px solid #d8a3a9; }
.hb-flash-notice { background: #f3e9cd; color: #4a3a24; border: 1px solid var(--hb-rule); }

/* ====== Typography utilities ====== */
.hb-page-title {
  font-family: var(--hb-serif);
  font-weight: 700;
  font-size: 34px;
  color: var(--hb-burgundy);
  margin: 0 0 4px;
}

.hb-page-sub {
  font-family: var(--hb-sans);
  font-size: 13px;
  color: var(--hb-ink-soft);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0 0 24px;
}

.hb-section-title {
  font-family: var(--hb-serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--hb-ink);
  border-bottom: 2px solid var(--hb-rule);
  padding-bottom: 6px;
  margin: 0 0 16px;
}

/* ====== Book card (skeuomorphic paper) ====== */
.hb-card {
  background: #fffcf2;
  border: 1px solid var(--hb-rule);
  border-radius: 4px;
  padding: 14px 16px;
  box-shadow: 2px 2px 0 rgba(28, 21, 12, 0.05), 4px 6px 14px rgba(28, 21, 12, 0.08);
  position: relative;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  color: var(--hb-ink);
}

.hb-card:hover {
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 rgba(28, 21, 12, 0.06), 6px 10px 20px rgba(28, 21, 12, 0.12);
}

.hb-card-title {
  font-weight: 700;
  font-size: 19px;
  line-height: 1.35;
  color: var(--hb-burgundy);
}

.hb-card-author {
  font-size: 14px;
  color: var(--hb-ink-soft);
  font-style: italic;
}

.hb-card-meta {
  margin-top: auto;
  font-family: var(--hb-sans);
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--hb-gold);
  text-transform: uppercase;
}

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

/* ====== Tickers (index page) ====== */
.hb-ticker-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 32px;
}

@media (max-width: 780px) {
  .hb-ticker-layout { grid-template-columns: 1fr; }
}

.hb-ticker-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hb-ticker-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 252, 242, 0.6);
  border: 1px solid rgba(201, 180, 138, 0.5);
  border-radius: 4px;
  text-decoration: none;
  color: var(--hb-ink);
}

.hb-ticker-item:hover { background: #fffcf2; border-color: var(--hb-rule); }
.hb-ticker-item .t { font-weight: 700; }
.hb-ticker-item .a { font-size: 13px; color: var(--hb-ink-soft); font-style: italic; }
.hb-ticker-item .v { font-family: var(--hb-sans); font-size: 11px; color: var(--hb-gold); align-self: flex-start; white-space: nowrap; }

/* ====== Search ====== */
.hb-search-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
  margin-bottom: 24px;
  align-items: end;
}

@media (max-width: 780px) {
  .hb-search-form { grid-template-columns: 1fr; }
}

.hb-field label {
  display: block;
  font-family: var(--hb-sans);
  font-size: 12px;
  color: var(--hb-ink-soft);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.hb-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--hb-rule);
  border-radius: 3px;
  background: #fffcf2;
  font-family: var(--hb-serif);
  font-size: 17px;
  box-sizing: border-box;
}

.hb-field input:focus {
  outline: none;
  border-color: var(--hb-burgundy);
  box-shadow: 0 0 0 3px rgba(122, 31, 43, 0.15);
}

.hb-btn {
  background: var(--hb-burgundy);
  color: #fff8ea;
  border: none;
  padding: 10px 22px;
  border-radius: 3px;
  font-family: var(--hb-sans);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.hb-btn:hover { background: var(--hb-burgundy-dark); }
.hb-btn-ghost { background: transparent; color: var(--hb-burgundy); border: 1px solid var(--hb-burgundy); }
.hb-btn-ghost:hover { background: var(--hb-burgundy); color: #fff8ea; }

/* ====== Sefer detail ====== */
.hb-detail-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 32px;
}

@media (max-width: 780px) {
  .hb-detail-layout { grid-template-columns: 1fr; }
}

.hb-detail-cover {
  background: #fffcf2;
  padding: 14px;
  border: 1px solid var(--hb-rule);
  box-shadow: 3px 3px 0 rgba(28, 21, 12, 0.05), 6px 10px 18px rgba(28, 21, 12, 0.1);
}

.hb-detail-cover img { width: 100%; height: auto; display: block; }

.hb-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }

.hb-meta-table { width: 100%; border-collapse: collapse; }
.hb-meta-table td {
  padding: 8px 4px;
  border-bottom: 1px dotted var(--hb-rule);
  vertical-align: top;
}

.hb-meta-table td.label {
  width: 140px;
  font-family: var(--hb-sans);
  font-size: 12px;
  color: var(--hb-ink-soft);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.hb-desc { font-size: 17px; line-height: 1.7; color: var(--hb-ink-soft); white-space: pre-wrap; }

/* ====== Rambam reader ====== */
.hb-rambam-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
}

@media (max-width: 780px) {
  .hb-rambam-layout { grid-template-columns: 1fr; }
}

.hb-rambam-nav { display: flex; flex-direction: column; gap: 12px; }

.hb-rambam-nav select {
  width: 100%;
  padding: 10px 12px;
  background: #fffcf2;
  border: 1px solid var(--hb-rule);
  border-radius: 3px;
  font-family: var(--hb-serif);
  font-size: 16px;
}

.hb-halocha {
  background: #fffcf2;
  border: 1px solid var(--hb-rule);
  padding: 28px 32px;
  font-size: 22px;
  line-height: 2;
  text-align: justify;
  color: var(--hb-ink);
  box-shadow: 3px 3px 0 rgba(28, 21, 12, 0.05);
}

.hb-halocha-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  font-family: var(--hb-sans);
  font-size: 14px;
}

.hb-peirushim { margin-top: 24px; border-top: 2px solid var(--hb-rule); padding-top: 16px; }
.hb-peirushim-title { font-family: var(--hb-sans); font-size: 13px; letter-spacing: 1px; text-transform: uppercase; color: var(--hb-ink-soft); margin-bottom: 10px; }
.hb-peirushim-list { display: flex; flex-wrap: wrap; gap: 8px; }
.hb-peirush-chip {
  background: transparent;
  border: 1px solid var(--hb-burgundy);
  color: var(--hb-burgundy);
  font-size: 14px;
  padding: 4px 12px;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
}
.hb-peirush-chip:hover { background: var(--hb-burgundy); color: #fff8ea; }
.hb-peirush-body { background: #fffcf2; border: 1px solid var(--hb-rule); padding: 16px 20px; margin-top: 12px; font-size: 18px; line-height: 1.8; }

/* ====== Reader ====== */
.hb-reader { display: flex; flex-direction: column; gap: 10px; }

.hb-reader-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  background: #fffcf2;
  border: 1px solid var(--hb-rule);
  padding: 8px 14px;
  border-radius: 3px;
}

.hb-reader-toolbar .spacer { flex: 1; }
.hb-reader-toolbar input[type="number"],
.hb-reader-toolbar input[type="text"] {
  width: 80px;
  padding: 6px 8px;
  border: 1px solid var(--hb-rule);
  border-radius: 3px;
  font-family: var(--hb-sans);
}
.hb-reader-toolbar input[type="text"] { width: 180px; }

.hb-reader-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.hb-reader-page {
  background: #fffcf2;
  padding: 6px;
  border: 1px solid var(--hb-rule);
  box-shadow: 3px 3px 0 rgba(28, 21, 12, 0.05), 6px 10px 16px rgba(28, 21, 12, 0.1);
  position: relative;
  max-width: 100%;
}

.hb-reader-page img { display: block; max-width: 100%; height: auto; }

.hb-reader-hit {
  position: absolute;
  background: rgba(183, 138, 51, 0.35);
  border: 1px solid rgba(183, 138, 51, 0.8);
  pointer-events: none;
}

/* ====== Placeholder / coming soon ====== */
.hb-placeholder {
  background: #fffcf2;
  border: 1px dashed var(--hb-rule);
  padding: 48px 24px;
  text-align: center;
  color: var(--hb-ink-soft);
  border-radius: 4px;
}
