/* Paleta tomada de iglesiatierranueva.org */
:root {
  --verde: #3aaa35;
  --verde-osc: #2d8a29;
  --lima: #95c11f;
  --teal: #208f80;
  --marino: #1b1f2e;
  --azul: #042551;
  --gris: #838694;
  --fondo: #f3f7f0;
  --papel: #ffffff;
  --linea: #e1e8dc;
  --suave: #eaf3e4;
  --radio: 14px;
  --sombra: 0 6px 24px rgba(27, 31, 46, .10);
  --titulo: "Open Sans", system-ui, sans-serif;
  --texto: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--texto);
  color: var(--marino);
  line-height: 1.65;
  background: var(--fondo);
}

.wrap { width: min(920px, 100% - 32px); margin-inline: auto; }

/* ---------- Barra superior ---------- */
.topbar { background: var(--papel); border-bottom: 4px solid var(--verde); }
.topbar__in { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px 0; }
.topbar__title {
  margin: 0;
  font: 800 clamp(1.3rem, 4.5vw, 2rem)/1.1 var(--titulo);
  color: var(--marino);
}
.topbar__title span { color: var(--verde); }
.brush {
  font-family: "Permanent Marker", "Brush Script MT", cursive;
  font-size: clamp(1.4rem, 4.5vw, 2.1rem);
  color: var(--marino);
  transform: rotate(-3deg);
  border-bottom: 4px solid var(--lima);
  line-height: 1.1;
}

/* ---------- Pestañas de días ---------- */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 18px 2px 14px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto;
  min-width: 76px;
  border: 2px solid var(--linea);
  border-radius: 12px;
  background: var(--papel);
  color: var(--marino);
  font: 800 1.35rem/1.1 var(--titulo);
  padding: 8px 14px;
  cursor: pointer;
  position: relative;
  transition: border-color .15s, background .15s, color .15s, transform .15s;
}
.tab small { display: block; font: 600 .6rem/1.2 var(--texto); letter-spacing: .1em; text-transform: uppercase; color: var(--gris); }
.tab:hover { border-color: var(--verde); }
.tab[aria-current="true"] { background: var(--verde); border-color: var(--verde); color: #fff; box-shadow: 0 6px 14px rgba(58, 170, 53, .35); }
.tab[aria-current="true"] small { color: rgba(255, 255, 255, .85); }
.tab.hecho::after {
  content: "✓";
  position: absolute; top: -7px; right: -5px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--teal); color: #fff; font: 700 .8rem/22px var(--texto); text-align: center;
  box-shadow: 0 0 0 2px var(--fondo);
}

/* ---------- Tarjeta del día ---------- */
.dia { background: var(--papel); border-radius: var(--radio); box-shadow: var(--sombra); }

.hero { position: relative; min-height: 240px; height: clamp(240px, 42vw, 380px); background: var(--marino); overflow: hidden; border-radius: var(--radio) var(--radio) 0 0; }
.hero__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(27,31,46,.88) 0%, rgba(27,31,46,.4) 45%, transparent 75%); }
.hero__txt { position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; padding: 20px clamp(16px, 4vw, 32px); color: #fff; }
.hero__dia { font: 700 .75rem/1 var(--texto); letter-spacing: .16em; background: var(--verde); display: inline-block; padding: 7px 14px; border-radius: 999px; margin-bottom: 10px; }
.hero__titulo { margin: 0; font: 800 clamp(1.7rem, 6vw, 3rem)/1.1 var(--titulo); text-shadow: 0 2px 12px rgba(0,0,0,.5); }
.hero__ref { margin: 6px 0 0; font-weight: 500; opacity: .95; }

.cuerpo { padding: clamp(16px, 4vw, 32px); }

.meta { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 24px; padding: 0; list-style: none; }
.meta li { background: var(--suave); border-radius: 999px; padding: 6px 14px; font-size: .85rem; font-weight: 500; }
.meta b { color: var(--verde-osc); font-weight: 700; }

.titulo-seccion {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 14px;
  font: 800 1.35rem/1.2 var(--titulo);
  color: var(--marino);
}
.titulo-seccion::before { content: ""; width: 6px; height: 1.4em; background: var(--verde); border-radius: 3px; }
.titulo-seccion::after { content: ""; flex: 1; height: 2px; background: var(--linea); }

section.bloque { margin-top: 34px; }
section.bloque:first-of-type { margin-top: 0; }

/* lectura */
.lectura {
  font-size: 1.02rem;
  background: var(--suave);
  border-left: 6px solid var(--verde);
  border-radius: 16px;
  padding: 24px clamp(18px, 4vw, 32px);
}
.lectura p { margin: 0 0 1em; }
.lectura p:last-child { margin-bottom: 0; }
.lectura h3 { margin: 1.6em 0 .6em; font: 800 1.2rem/1.25 var(--titulo); color: var(--marino); }
.lectura h3:first-child { margin-top: 0; }
.lectura > h3:first-child + p::first-letter {
  float: left; font: 800 3.6rem/.85 var(--titulo); color: var(--verde); padding: 6px 10px 0 0;
}
.lectura .poema { margin: 1em 0; padding: .2em 0 .2em 1.1em; border-left: 3px solid var(--lima); font-style: italic; }
.lectura .poema p { margin: 0; }

/* avisos */
.aviso { padding: 10px 14px; border-radius: 10px; font-size: .88rem; margin-bottom: 16px; border: 1px solid transparent; }
.aviso--info { background: #eaf3fb; border-color: #bcd6ee; color: #1d4466; }
.aviso--error { background: #fdecea; border-color: #f2b8b2; color: #7a1f17; }
.aviso--ok { background: var(--suave); border-color: #bfdcb8; color: #1e5a1b; }
.cargando { color: var(--gris); }

/* tarjetas y formularios */
.tarjeta { background: var(--papel); border-radius: var(--radio); box-shadow: var(--sombra); padding: clamp(16px, 4vw, 32px); }
.tarjeta--centrada { max-width: 460px; margin: 28px auto; }
.formulario { display: grid; gap: 14px; }
.formulario label { display: grid; gap: 6px; font-size: .85rem; font-weight: 600; }
.formulario input, .formulario select {
  font: inherit; padding: 12px 14px; border: 2px solid var(--linea); border-radius: 10px; background: #fff; color: var(--marino); width: 100%;
}
.formulario input:focus, .formulario select:focus { outline: none; border-color: var(--verde); box-shadow: 0 0 0 4px rgba(58, 170, 53, .18); }

/* barra de usuario y selectores */
.barra-usuario { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 0 0 12px; font-size: .85rem; }
.barra-usuario__acc { display: flex; gap: 14px; flex-wrap: wrap; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--teal); cursor: pointer; text-decoration: underline; }
.btn-link:hover { color: var(--verde-osc); }
.pastillas { display: flex; gap: 8px; flex-wrap: wrap; padding: 16px 0 0; }
.pastillas--semanas { padding-top: 10px; }
.pastilla { border: 2px solid var(--linea); background: var(--papel); color: var(--marino); font: 700 .85rem/1.2 var(--texto); border-radius: 999px; padding: 8px 16px; cursor: pointer; text-align: left; }
.pastilla small { display: block; font-weight: 500; font-size: .68rem; color: var(--gris); }
.pastilla--chica { padding: 6px 14px; font-size: .8rem; }
.pastilla:hover { border-color: var(--verde); }
.pastilla.activa { background: var(--marino); border-color: var(--marino); color: #fff; }
.pastilla.activa small { color: #c9ccd8; }
.guardado--error { color: #b03a2e; }
textarea[readonly] { background-color: #f7f8f5; color: #4a4f60; }
.btn[disabled] { opacity: .6; cursor: wait; }
a.btn { display: inline-block; text-decoration: none; text-align: center; }
.enlace { display: inline-block; margin-top: 14px; font-weight: 600; color: var(--teal); }
.enlace:hover { color: var(--verde-osc); }

/* notas y preguntas */
textarea {
  width: 100%; min-height: 130px; resize: vertical;
  font: inherit; color: inherit;
  padding: 12px 14px;
  background: #fff;
  border: 2px solid var(--linea);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
textarea:focus { outline: none; border-color: var(--verde); box-shadow: 0 0 0 4px rgba(58, 170, 53, .18); }
.notas textarea {
  min-height: 170px;
  background-image: repeating-linear-gradient(transparent 0 27px, var(--linea) 27px 28px);
  background-color: #fcfefb;
  line-height: 28px;
  padding-top: 4px;
}

.pregunta { margin-bottom: 10px; background: #fff; border: 2px solid var(--linea); border-radius: 12px; overflow: hidden; }
.pregunta[open] { border-color: var(--verde); }
.pregunta summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px 10px 0;
  font-weight: 600;
}
.pregunta summary::-webkit-details-marker { display: none; }
.pregunta summary::after { content: "＋"; margin-left: auto; color: var(--verde); font-size: 1.3rem; line-height: 1; }
.pregunta[open] summary::after { content: "−"; }
.num {
  flex: none; width: 46px; align-self: stretch; display: grid; place-items: center;
  background: var(--marino); color: #fff; font: 800 1.4rem/1 var(--titulo);
  border-radius: 0 40px 0 0;
  margin: -10px 0;
}
.pregunta summary em { color: var(--verde-osc); font-style: normal; font-weight: 700; }
.pregunta.con-resp .num { background: var(--verde); }
.pregunta .resp { padding: 0 14px 14px; }
.ayuda { font-size: .85rem; color: var(--gris); margin: -6px 0 14px; }

/* estado + botones */
.guardado { font-size: .8rem; color: var(--verde-osc); font-weight: 600; min-height: 1.2em; text-align: right; margin-top: 4px; }

.acciones { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.btn {
  font: 600 .88rem/1 var(--texto);
  border: 2px solid var(--verde); background: var(--verde); color: #fff;
  padding: 12px 20px; border-radius: 999px; cursor: pointer;
  transition: transform .1s, background .15s, color .15s;
}
.btn:hover { background: var(--verde-osc); border-color: var(--verde-osc); }
.btn:active { transform: scale(.97); }
.btn--ghost { background: transparent; color: var(--verde-osc); }
.btn--ghost:hover { background: var(--verde); border-color: var(--verde); color: #fff; }
.btn--ok { background: var(--lima); border-color: var(--lima); color: var(--marino); }
.btn--ok:hover { background: var(--verde); border-color: var(--verde); color: #fff; }

.acciones--extra { margin-top: 10px; }
.acciones--extra .btn { font-size: .78rem; padding: 10px 16px; }

.nav-dias { display: flex; justify-content: space-between; gap: 10px; padding: 0 clamp(16px, 4vw, 32px) clamp(16px, 4vw, 28px); }

.footer { text-align: center; background: var(--marino); color: #c9ccd8; font-size: .8rem; padding: 26px 16px; margin-top: 44px; border-top: 4px solid var(--verde); }
.footer p { margin: 0; }
.footer strong { color: #fff; }

/* móvil */
@media (max-width: 640px) {
  .tab { min-width: 64px; padding-inline: 10px; }
}

/* imprimir */
@media print {
  body { background: #fff; }
  .topbar, .tabs, .acciones, .nav-dias, .footer, .enlace { display: none !important; }
  .dia { box-shadow: none; }
  .hero { height: 160px; min-height: 0; }
  .pregunta, details { break-inside: avoid; }
  details:not([open]) > .resp { display: block; }
  textarea { border: 1px solid #ccc; min-height: 80px; }
}

.tarjeta .ayuda { margin: 16px 0 0; }
.formulario + .ayuda { margin-top: 16px; }

/* =========================================================
   Panel de notas y preguntas
   - celular: hoja que sube desde abajo (+ botones flotantes)
   - tableta: cajón lateral
   - escritorio: panel fijo a la derecha de la lectura
   ========================================================= */
body.sin-scroll { overflow: hidden; }
body.pagina-lector main { padding-bottom: 120px; }

.panel {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: 85vh; height: 85dvh;
  z-index: 60; display: flex; flex-direction: column;
  background: var(--papel); border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 30px rgba(27, 31, 46, .28);
  transform: translateY(105%); visibility: hidden;
  transition: transform .26s ease, visibility 0s linear .26s;
}
.lector--abierto .panel { transform: none; visibility: visible; transition: transform .26s ease; }

.panel-fondo {
  position: fixed; inset: 0; z-index: 55; background: rgba(27, 31, 46, .5);
  opacity: 0; pointer-events: none; transition: opacity .26s ease;
}
.lector--abierto .panel-fondo { opacity: 1; pointer-events: auto; }

.panel__cab { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 20px 12px 10px 14px; border-bottom: 1px solid var(--linea); }
.panel__asa { position: absolute; top: 8px; left: 50%; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: #cfd6c9; }
.panel__tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.panel__tab { border: 2px solid var(--linea); background: #fff; color: var(--marino); font: 700 .82rem/1 var(--texto); padding: 9px 14px; border-radius: 999px; cursor: pointer; }
.panel__tab[aria-selected="true"] { background: var(--verde); border-color: var(--verde); color: #fff; }
.panel__tab.con-datos::after { content: " •"; }
.panel__cuenta { font-weight: 600; opacity: .85; }
.panel__cerrar { flex: none; border: 0; background: #eef2ea; width: 36px; height: 36px; border-radius: 50%; font-size: 1rem; line-height: 1; cursor: pointer; color: var(--marino); }
.panel__cerrar:hover { background: #dfe7d9; }

.panel__cuerpo { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; -webkit-overflow-scrolling: touch; }
.panel__ref { margin: 0 0 10px; font-size: .78rem; font-weight: 600; color: var(--gris); }
.panel__sec--notas { flex: 1; display: flex; flex-direction: column; }
.panel__sec--notas textarea { flex: 1; min-height: 180px; }
.lector[data-tab="notas"] .panel__sec--preg { display: none; }
.lector[data-tab="preguntas"] .panel__sec--notas { display: none; }
.panel .guardado { margin: 0; padding: 4px 16px 12px; min-height: 1.7em; }
.panel .pregunta summary { font-size: .88rem; }

.fabs { position: fixed; right: 14px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.lector--abierto + .fabs { display: none; }
.fab {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 11px 16px;
  font: 700 .85rem/1 var(--texto); color: #fff; background: var(--verde);
  box-shadow: 0 6px 18px rgba(27, 31, 46, .32); cursor: pointer;
}
.fab:active { transform: scale(.97); }
#fabPreguntas { background: var(--marino); }
.fab__punto { position: absolute; top: -3px; right: -3px; width: 14px; height: 14px; border-radius: 50%; background: var(--lima); border: 2px solid #fff; }
.fab__punto[hidden] { display: none; }
.fab__cuenta { background: rgba(255, 255, 255, .25); border-radius: 999px; padding: 2px 8px; font-size: .72rem; }
.fab__cuenta:empty { display: none; }

.panel-borde { display: none; }

/* tableta: cajón lateral */
@media (min-width: 700px) and (max-width: 1099.98px) {
  .panel { left: auto; top: 0; bottom: 0; right: 0; width: min(430px, 92vw); height: 100vh; height: 100dvh; border-radius: 20px 0 0 20px; transform: translateX(105%); }
  .lector--abierto .panel { transform: none; }
  .panel__asa { display: none; }
  .panel__cab { padding-top: 14px; }
}

/* escritorio: panel fijo al lado de la lectura */
@media (min-width: 1100px) {
  body.pagina-lector .wrap { width: min(1360px, 100% - 32px); }
  body.pagina-lector main { padding-bottom: 0; }
  .lector { display: grid; grid-template-columns: minmax(0, 960px); gap: 22px; align-items: start; }
  .lector--abierto { grid-template-columns: minmax(0, 1fr) 390px; }
  .panel {
    position: sticky; top: 14px; left: auto; right: auto; bottom: auto;
    height: calc(100vh - 28px); z-index: 1;
    transform: none; visibility: visible; transition: none;
    border-radius: var(--radio); box-shadow: var(--sombra); display: none;
  }
  .lector--abierto .panel { display: flex; }
  .panel__asa, .panel-fondo, .fabs { display: none; }
  .lector:not(.lector--abierto) .panel-borde {
    display: block; position: fixed; right: 0; top: 38%; z-index: 40;
    writing-mode: vertical-rl; padding: 18px 10px;
    background: var(--verde); color: #fff; border: 0; border-radius: 12px 0 0 12px;
    font: 700 .85rem/1 var(--texto); cursor: pointer; box-shadow: var(--sombra);
  }
  .lector:not(.lector--abierto) .panel-borde:hover { background: var(--verde-osc); }
}

@media (prefers-reduced-motion: reduce) {
  .panel, .panel-fondo { transition: none; }
}

@media print {
  .lector { display: block; }
  .panel { position: static; display: block !important; visibility: visible; transform: none; height: auto !important; box-shadow: none; border-radius: 0; }
  .panel__cab, .panel-fondo, .panel-borde, .fabs, .panel .guardado, .panel__ref { display: none !important; }
  .lector .panel__sec--preg, .lector .panel__sec--notas { display: block !important; }
  .panel__cuerpo { overflow: visible; padding: 14px 0 0; }
  body.sin-scroll { overflow: visible; }
}

/* =========================================================
   Lectura en voz alta y citas
   ========================================================= */
.voz {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  margin: 0 0 12px; padding: 8px 10px;
  background: #fff; border: 2px solid var(--linea); border-radius: 12px;
  z-index: 30;
}
.voz[hidden] { display: none; }
.voz.activa { border-color: var(--verde); box-shadow: var(--sombra); position: sticky; top: 8px; }
.voz__btn { border: 0; border-radius: 999px; padding: 10px 16px; font: 700 .82rem/1 var(--texto); cursor: pointer; background: var(--suave); color: var(--verde-osc); }
.voz__btn--main { background: var(--verde); color: #fff; }
.voz__btn:hover { filter: brightness(.95); }
.voz__lbl { display: flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 600; color: var(--gris); }
.voz select { font: inherit; font-size: .8rem; padding: 6px 8px; border: 2px solid var(--linea); border-radius: 8px; background: #fff; color: var(--marino); max-width: 190px; }
.lectura .leyendo { background: rgba(149, 193, 31, .28); border-radius: 6px; box-shadow: 0 0 0 6px rgba(149, 193, 31, .28); }

.cita-btn {
  position: fixed; z-index: 70; top: 0; left: 0;
  border: 0; border-radius: 999px; padding: 11px 16px;
  background: var(--marino); color: #fff; font: 700 .82rem/1 var(--texto);
  box-shadow: 0 8px 22px rgba(27, 31, 46, .4); cursor: pointer; white-space: nowrap;
}
.cita-btn[hidden] { display: none; }

.toast {
  position: fixed; z-index: 80; left: 50%; bottom: 92px; transform: translateX(-50%);
  background: var(--marino); color: #fff; padding: 12px 18px; border-radius: 999px;
  font-size: .85rem; font-weight: 600; box-shadow: 0 8px 22px rgba(27, 31, 46, .4);
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
}
.toast[hidden] { display: none; }
.toast button { background: none; border: 0; padding: 0; color: var(--lima); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
@media (min-width: 1100px) { .toast { bottom: 28px; } }

@media print { .voz, .cita-btn, .toast { display: none !important; } .lectura .leyendo { background: none; box-shadow: none; } }
