/* ═══════════════════════════════════════════════════
   EDITORIAL SEFARDÍ — site.css
   Ecosistema Shlomo Peretz / mismo sistema de diseño
   ═══════════════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --bg:           #ffffff;
  --fg:           #111111;
  --muted:        #6b6560;
  --link:         #d4af37;
  --gold:         #d4af37;
  --gold-light:   rgba(212, 175, 55, 0.10);
  --border:       rgba(180, 155, 90, 0.20);
  --btn-group-bg: rgba(0, 0, 0, 0.05);
  --maxw:         860px;
  --pad:          24px;
  --font:         18px;
  --he-font:      "Noto Serif Hebrew", Georgia, serif;
  --ui-font:      "Assistant", system-ui, sans-serif;
  --topbar-h:     52px;
  --bottombar-h:  56px;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light-mode) {
    --bg:           #0e0d0b;
    --fg:           #e8e4dc;
    --muted:        #9a9186;
    --border:       rgba(180, 155, 90, 0.16);
    --btn-group-bg: rgba(255, 255, 255, 0.07);
  }
}

:root.dark-mode {
  --bg:           #0e0d0b;
  --fg:           #e8e4dc;
  --muted:        #9a9186;
  --border:       rgba(180, 155, 90, 0.16);
  --btn-group-bg: rgba(255, 255, 255, 0.07);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: var(--font); scroll-behavior: smooth; }
body {
  background:  var(--bg);
  color:       var(--fg);
  font-family: var(--ui-font);
  line-height: 1.75;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; }
a:hover { opacity: .75; }

/* ── Page container ── */
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: calc(var(--pad) + 12px) var(--pad);
  padding-bottom: calc(var(--bottombar-h) + 56px + env(safe-area-inset-bottom));
}

/* ── Topbar ── */
header.topbar {
  position:   sticky;
  top:        0;
  z-index:    200;
  height:     var(--topbar-h);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
  direction:  ltr;
}

.topbar-inner {
  max-width:   var(--maxw);
  margin:      0 auto;
  height:      100%;
  padding:     0 var(--pad);
  display:     flex;
  align-items: center;
  gap:         16px;
  box-sizing:  border-box;
  direction:   ltr;
}

.brand {
  display:        flex;
  flex-direction: column;
  gap:            4px;
  line-height:    1;
  flex-shrink:    0;
}
.brand-title {
  font-family:    var(--ui-font);
  font-size:      17px;
  font-weight:    600;
  color:          var(--gold);
  letter-spacing: 0.01em;
  text-decoration: none;
}
.brand-byline {
  font-family:    var(--ui-font);
  font-size:      11px;
  color:          var(--muted);
  opacity:        0.85;
  text-decoration: none;
  display:        block;
}
.brand-byline:hover { color: var(--gold); opacity: 1; }

.topbar-nav {
  margin-left: auto;
  display:     flex;
  align-items: center;
  gap:         8px;
}

.tnav-group {
  display:       flex;
  align-items:   center;
  background:    var(--btn-group-bg);
  border-radius: 9px;
  padding:       0 4px;
  height:        36px;
  gap:           0;
}

.tnav-btn {
  appearance:  none;
  border:      none;
  background:  transparent;
  min-width:   32px;
  height:      32px;
  padding:     0 11px;
  display:     flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ui-font);
  font-size:   13px;
  font-weight: 500;
  color:       var(--muted);
  cursor:      pointer;
  border-radius: 6px;
  text-decoration: none;
  transition:  background .12s, color .12s;
  -webkit-tap-highlight-color: transparent;
}
.tnav-btn:hover { background: rgba(128,128,128,.12); color: var(--fg); }

.tnav-sep {
  width:       1px;
  height:      14px;
  background:  var(--border);
  margin:      0 3px;
  flex-shrink: 0;
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding:    1.5rem var(--pad);
  padding-bottom: calc(var(--bottombar-h) + 1.5rem + env(safe-area-inset-bottom));
  text-align: center;
  max-width:  var(--maxw);
  margin:     0 auto;
}
.footer-author {
  font-family:    var(--ui-font);
  font-size:      13px;
  font-weight:    600;
  color:          var(--gold);
  text-decoration: none;
  letter-spacing: 0.02em;
  opacity:        0.9;
}
.footer-author:hover { opacity: 1; }
.footer-links {
  display:     flex;
  justify-content: center;
  gap:         1.2rem;
  flex-wrap:   wrap;
  font-family: var(--ui-font);
  font-size:   12px;
  color:       var(--muted);
  margin-top:  0.6rem;
  opacity:     0.6;
}
.footer-links a { color: inherit; }
.footer-links a:hover { color: var(--gold); opacity: 1; }

/* ── Bottom navigation ── */
nav.bottombar {
  position: fixed;
  left:     0;
  right:    0;
  bottom:   0;
  z-index:  215;
  height:   var(--bottombar-h);
  padding-top:    12px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
  padding-inline: max(var(--pad), calc((100vw - var(--maxw)) / 2));
  background:     rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-sizing: border-box;
  display:    flex;
  align-items: center;
  justify-content: center;
  gap:        0;
}

.dark-mode nav.bottombar { background: rgba(14, 13, 11, .96); }

nav.bottombar a.bbtn {
  flex:       1;
  position:   relative;
  height:     var(--bottombar-h);
  display:    flex;
  align-items: center;
  justify-content: center;
  font-family:    var(--ui-font);
  font-size:      13px;
  font-weight:    500;
  letter-spacing: 0.02em;
  color:          var(--muted);
  text-decoration: none;
  transition:     color .15s ease;
  white-space:    nowrap;
}
nav.bottombar a.bbtn.active { color: #d4af37; font-weight: 700; }
nav.bottombar a.bbtn.active::before {
  content:  "";
  position: absolute;
  top:      0;
  left:     20%;
  width:    60%;
  height:   2px;
  background:   #d4af37;
  border-radius: 0 0 2px 2px;
  opacity:  .85;
}

/* ── Search panel ── */
#searchOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.38);
  z-index: 400;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
#searchPanel {
  position: fixed;
  top: calc(var(--topbar-h) + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: min(540px, calc(100vw - 32px));
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  z-index: 401;
  overflow: hidden;
  max-height: calc(100vh - var(--topbar-h) - 30px);
  display: flex;
  flex-direction: column;
}
.search-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.search-header input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--ui-font);
  font-size: 15px;
  color: var(--fg);
  outline: none;
}
.search-header input::placeholder { color: var(--muted); opacity: .6; }
.search-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  flex-shrink: 0;
}
#searchResults {
  overflow-y: auto;
  max-height: 420px;
}

/* Resultados */
.search-result-item {
  display:     flex;
  align-items: center;
  gap:         12px;
  padding:     12px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color:       var(--fg);
  transition:  background .12s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--gold-light); }

.sri-icon {
  flex-shrink: 0;
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .65;
}
.sri-icon img { display: block; }

.sri-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sri-title {
  font-family: var(--he-font);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sri-author {
  font-family: var(--ui-font);
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sri-price {
  font-family: var(--ui-font);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
  flex-shrink: 0;
}
.search-empty {
  font-family: var(--ui-font);
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  padding: 1.5rem 1rem;
  opacity: .7;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  :root { --pad: 16px; }
  .page { padding-top: calc(var(--pad) + 8px); }
}
