/* ================================================
   BIRKAT HAMAZÓN SEFARDÍ — ecosistema Shlomo Peretz
   Mismas variables y base que tehilimsefardi.com
   ================================================ */

:root {
  --bg:          #fefcf8;
  --bg2:         #ffffff;
  --fg:          #111111;
  --muted:       #6b6560;
  --gold:        #c9a227;
  --gold-light:  rgba(201, 162, 39, 0.12);
  --border:      rgba(180, 155, 90, 0.20);
  --maxw:        680px;
  --pad:         24px;
  --font:        22px;
  --line:        2.0;
  --he-font:     "Noto Serif Hebrew", serif;
  --ui-font:     "Assistant", system-ui, sans-serif;
  --radius:      8px;
  --shadow:      0 1px 4px rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #0e0d0b;
    --bg2:        #161410;
    --fg:         #e8e4dc;
    --muted:      #9a9186;
    --gold:       #d4af37;
    --gold-light: rgba(212, 175, 55, 0.10);
    --border:     rgba(180, 155, 90, 0.16);
    --shadow:     0 1px 4px rgba(0, 0, 0, 0.30);
  }
}

/* ——— Reset ——— */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background:   var(--bg);
  color:        var(--fg);
  font-family:  var(--he-font);
  font-size:    var(--font);
  line-height:  var(--line);
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
}

/* Tamaños de texto (aplicados al body por JS) */
body.size-small  { font-size: 18px; }
body.size-medium { font-size: 22px; }
body.size-large  { font-size: 27px; }

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

/* ——— Topbar — idéntico a tehilimsefardi.com ——— */
header.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 52px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--pad);
}

.site-title {
  font-family:    var(--he-font);
  font-size:      0.88rem;
  font-weight:    600;
  color:          var(--gold);
  letter-spacing: 0.01em;
}

.site-author {
  font-family:    var(--ui-font);
  font-size:      0.68rem;
  font-weight:    500;
  color:          var(--muted);
  letter-spacing: 0.06em;
  opacity:        0.8;
}

/* ——— Barra de controles — mismo tratamiento que topbar ——— */
.controls-bar {
  position: sticky;
  top: 52px;
  z-index: 190;
  height: 44px;
  background: color-mix(in srgb, var(--bg2) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 var(--pad);
  overflow-x: auto;
  scrollbar-width: none;
}
.controls-bar::-webkit-scrollbar { display: none; }

.ctrl-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ctrl-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}

.ctrl-label {
  font-family:    var(--ui-font);
  font-size:      0.60rem;
  color:          var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.75;
}

.ctrl-select {
  font-family:    var(--ui-font);
  font-size:      0.72rem;
  font-weight:    500;
  color:          var(--fg);
  background:     transparent;
  border:         1px solid var(--border);
  border-radius:  var(--radius);
  padding:        3px 22px 3px 8px;
  cursor:         pointer;
  appearance:     none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23999'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  outline: none;
  transition: border-color 0.15s, color 0.15s;
}
.ctrl-select:focus,
.ctrl-select:hover { border-color: var(--gold); color: var(--gold); }

/* ——— Contenedor principal ——— */
.page {
  max-width: var(--maxw);
  margin:    0 auto;
  padding:   0 var(--pad) 80px;
}

/* ——— Intro — mismo patrón que .home-intro de tehilim ——— */
.site-intro {
  direction:     rtl;
  text-align:    center;
  padding:       3rem 0 2.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.site-intro-title {
  font-size:      3.2rem;
  font-weight:    700;
  color:          var(--gold);
  line-height:    1.15;
  letter-spacing: 0.04em;
  margin-bottom:  0.6rem;
}

.site-intro-sub {
  font-family:    var(--ui-font);
  font-size:      0.7rem;
  color:          var(--muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  direction:      ltr;
}

/* ——— Secciones ——— */
.birkat-section {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.birkat-section:last-child { border-bottom: none; }

/* Etiqueta de sección — idéntica a .psalm-label de tehilim */
.section-label {
  display:        inline-block;
  font-family:    var(--ui-font);
  font-size:      0.65rem;
  color:          var(--muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  direction:      ltr;
  background:     var(--gold-light);
  padding:        0.2rem 0.7rem;
  border-radius:  20px;
  margin-bottom:  1.6rem;
}

/* ——— Texto hebreo — idéntico a .verse-he de tehilim ——— */
.he {
  font-family:     var(--he-font);
  font-size:       1em;
  line-height:     2.1;
  text-align:      justify;
  text-align-last: right;
  direction:       rtl;
  color:           var(--fg);
  margin:          0.2em 0;
}

/* ——— Transliteración — idéntica a .verse-translit ——— */
.translit {
  font-family: var(--ui-font);
  font-size:   0.68rem;
  color:       var(--muted);
  font-style:  italic;
  direction:   ltr;
  text-align:  left;
  margin:      0.05em 0 0.15em;
  line-height: 1.55;
  opacity:     0.85;
}

/* ——— Traducción — idéntica a .verse-es ——— */
.traduccion {
  font-family:    var(--ui-font);
  font-size:      0.73rem;
  color:          var(--muted);
  direction:      ltr;
  text-align:     left;
  margin:         0 0 1.2em;
  line-height:    1.65;
  padding-bottom: 0.8em;
  border-bottom:  1px solid var(--border);
}
.traduccion:last-child { border-bottom: none; }

/* ——— Zimún: líder / respuesta ——— */
.zimun-leader  { margin-bottom: 0.3em; }
.zimun-respuesta {
  padding-right: 1.2em;
  opacity: 0.82;
  border-right: 2px solid var(--border);
  margin: 0.2em 0 0.6em;
}

/* ——— Inserciones Shabbat / Yom Tov ——— */
.shabbat-insert {
  border-right:   3px solid var(--gold);
  padding:        0.9rem 1rem 0.9rem 0.8rem;
  margin:         1.4rem 0;
  background:     var(--gold-light);
  border-radius:  0 var(--radius) var(--radius) 0;
}

.shabbat-badge {
  display:        inline-block;
  font-family:    var(--ui-font);
  font-size:      0.56rem;
  color:          var(--gold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border:         1px solid var(--gold);
  padding:        0.12rem 0.5rem;
  border-radius:  20px;
  margin-bottom:  0.8rem;
  opacity:        0.9;
  direction:      ltr;
}

/* ——— Vista: clases aplicadas al body por JS ——— */
body.vista-he       .translit,
body.vista-he       .traduccion   { display: none; }

body.vista-translit .he,
body.vista-translit .traduccion   { display: none; }

body.vista-es       .he,
body.vista-es       .translit     { display: none; }

body.vista-he-translit .traduccion { display: none; }

body.vista-he-es       .translit  { display: none; }
/* vista-todo: todo visible (por defecto) */

/* ——— Footer — idéntico a tehilimsefardi.com ——— */
footer {
  border-top:  1px solid var(--border);
  padding:     1.5rem var(--pad);
  text-align:  center;
  font-family: var(--ui-font);
  font-size:   0.68rem;
  color:       var(--muted);
  direction:   ltr;
  opacity:     0.7;
}
footer a { color: var(--muted); }
footer a:hover { color: var(--gold); opacity: 1; }

/* ——— Mobile ——— */
@media (max-width: 520px) {
  :root { --pad: 16px; --font: 20px; }
  .site-intro-title { font-size: 2.6rem; }
  .site-author      { display: none; }
  .ctrl-label       { display: none; }
  .he               { text-align: right; text-align-last: right; }
}
