/* ==========================================================================
   The Bible in a Year — styles
   Zen mode: no sidebars, restricted reading width, dark mode.
   ========================================================================== */

:root,
:root[data-theme="light"] {
  --bg: #faf9f6;
  --text: #24221f;
  --text-soft: #6b6357;
  --border: #e6e1d6;
  --surface: #ffffff;
  --accent: #a8763e;
}

:root[data-theme="dark"] {
  --bg: #121212;
  --text: #e0e0e0;
  --text-soft: #a3a3a3;
  --border: #2b2b2b;
  --surface: #1a1a1a;
  --accent: #d9a15c;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212;
    --text: #e0e0e0;
    --text-soft: #a3a3a3;
    --border: #2b2b2b;
    --surface: #1a1a1a;
    --accent: #d9a15c;
  }
}

* {
  box-sizing: border-box;
}

/* Guarantees the hidden attribute always wins, regardless of any
   display:flex/inline-flex utility class also applied to the element. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, Segoe UI, sans-serif;
  transition: background-color 0.2s ease, color 0.2s ease;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ---------- Barra superior (mínima) ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 700px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 0;
}

.topbar__brand {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  text-transform: uppercase;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.icon-btn:hover {
  transform: scale(1.05);
}

/* Lucide icons (inline SVG, MIT license: https://lucide.dev) */
.icon {
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
}

/* ---------- Contenedor de lectura ---------- */

.reader {
  flex: 1;
  width: 100%;
  max-width: 700px;
  margin: 2rem auto 3rem;
  padding: 2.5rem 2rem;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 20px 60px -20px rgba(42, 38, 32, 0.25);
}

:root[data-theme="dark"] .reader {
  box-shadow: none;
  border: 1px solid var(--border);
}

.reader__day {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.reader__reference {
  margin: 0 0 2rem;
  font-family: "Lora", Georgia, serif;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 600;
  line-height: 1.3;
}

/* :not([hidden]) keeps this display:flex from beating hidden in the cascade */
.reader__status:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.spinner {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.reader__content {
  font-family: "Lora", Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--text);
}

.reader__content p {
  margin: 0 0 1.4rem;
  text-align: justify;
}

.reader__chapter-heading {
  margin: 2.25rem 0 1rem;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.reader__verse-num {
  margin-right: 0.15rem;
  font-size: 0.7em;
  font-weight: 600;
  color: var(--accent);
  vertical-align: super;
  line-height: 0;
}

.reader__error {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.6;
}

.reader__error-reference {
  margin: 0.5rem 0 0;
  font-family: "Lora", Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

/* ---------- Email subscription ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.65rem 1.2rem;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: #a8763e;
  color: #ffffff;
}

.btn--primary:hover {
  background: #96692f;
}

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-soft);
}

.btn--ghost:hover {
  background: var(--surface);
}

.subscribe-dialog {
  position: relative;
  width: calc(100% - 2.5rem);
  max-width: 380px;
  margin: auto;
  border: none;
  border-radius: 18px;
  padding: 2rem 1.75rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px -20px rgba(42, 38, 32, 0.35);
  text-align: left;
}

:root[data-theme="dark"] .subscribe-dialog {
  box-shadow: none;
  border: 1px solid var(--border);
}

.subscribe-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.subscribe-dialog__close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.subscribe-dialog__close:hover {
  background: var(--bg);
  color: var(--text);
}

.subscribe-dialog__title {
  margin: 0 1.5rem 1.25rem 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.subscribe__row {
  display: flex;
  gap: 0.5rem;
}

.subscribe__input {
  flex: 1;
  min-width: 0;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.9rem;
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.subscribe__input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.subscribe__consent {
  margin: 0.6rem 0 0;
  font-size: 0.72rem;
  color: var(--text-soft);
  line-height: 1.4;
}

.subscribe__feedback {
  min-height: 1.2em;
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--accent);
}

@media (max-width: 380px) {
  .subscribe__row {
    flex-direction: column;
  }
}

/* ---------- Footer ---------- */

.footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.footer__donate {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-soft);
  text-decoration: none;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease,
    transform 0.15s ease;
}

.footer__donate:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}
