@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #f5f0e6;
  --ink: #2a2622;
  --muted: #8b8276;
  --line: rgba(42, 38, 34, 0.12);
  --accent: #8a3b2c;
  --ease: cubic-bezier(0.22, 0.7, 0.2, 1);
  --serif: "Newsreader", "Iowan Old Style", "Palatino", Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16140f;
    --ink: #ebe4d4;
    --muted: #8f877a;
    --line: rgba(235, 228, 212, 0.14);
    --accent: #d08a72;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

#app { position: fixed; inset: 0; }

/* ——— Vistas y transición ——— */
.view {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(env(safe-area-inset-top) + 20px) 28px calc(env(safe-area-inset-bottom) + 64px);
  opacity: 1;
  transform: none;
  transition: opacity 420ms var(--ease), transform 520ms var(--ease);
}
.view.pre { opacity: 0; transform: translateY(10px); }
.view.out { opacity: 0; transform: translateY(-6px); transition-duration: 220ms; pointer-events: none; }
.wrap { max-width: 34rem; margin: 0 auto; }

.back {
  display: inline-flex;
  align-items: center;
  height: 44px;
  margin-left: -6px;
  padding: 0 6px;
  color: var(--muted);
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  transition: color 200ms;
}
.back:active { color: var(--ink); }

/* ——— Inicio ——— */
.home .date {
  margin: 8vh 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}
.home .date::first-letter { text-transform: uppercase; }
.home h1 {
  margin: 14px 0 0;
  font-weight: 300;
  font-size: clamp(2.3rem, 10vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
}
.home h1 em { display: block; color: var(--muted); font-weight: 300; }

.resume {
  display: block;
  width: 100%;
  margin-top: 9vh;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  transition: opacity 200ms;
}
.resume:active { opacity: 0.6; }
.resume small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.resume span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 1.7rem;
  font-weight: 400;
}
.resume i { font-style: normal; color: var(--accent); font-size: 1.2rem; }

.menu { margin-top: 6vh; }
.menu a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 15px 0;
  font-size: 1.25rem;
  color: var(--ink);
  transition: opacity 200ms, padding-left 300ms var(--ease);
}
.menu a:active { opacity: 0.55; padding-left: 6px; }
.menu a span { color: var(--muted); font-size: 0.95rem; font-style: italic; }

/* ——— Libros ——— */
.titulo {
  margin: 4px 0 28px;
  font-weight: 300;
  font-size: 2.2rem;
  letter-spacing: -0.01em;
}
.grupo {
  margin: 36px 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.libros { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; }
.libros a {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 1.15rem;
  transition: color 200ms;
}
.libros a:active { color: var(--accent); }

.caps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 8px; }
.caps a {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 1.15rem;
  font-variant-numeric: lining-nums;
  transition: background 200ms, color 200ms, border-color 200ms;
}
.caps a:active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.caps a.here { border-color: var(--accent); color: var(--accent); }

/* ——— Lectura ——— */
.reader .head { margin: 2px 0 34px; }
.reader .head small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.reader .head h1 { margin: 6px 0 0; font-weight: 300; font-size: 2.4rem; letter-spacing: -0.015em; }

.texto {
  font-size: 1.28rem;
  line-height: 1.72;
  font-weight: 380;
  hyphens: auto;
  -webkit-hyphens: auto;
  text-wrap: pretty;
}
.texto .v { transition: opacity 300ms; }
.texto sup {
  margin-right: 0.28em;
  color: var(--muted);
  font-size: 0.6em;
  font-weight: 500;
  vertical-align: 0.5em;
  letter-spacing: 0.02em;
  user-select: none;
}
.texto .v.mark sup { color: var(--accent); }

.pie {
  display: flex;
  justify-content: space-between;
  margin-top: 56px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 1.05rem;
}
.pie a:active { color: var(--ink); }
.pie .sig { color: var(--ink); }

/* Marcapáginas: cinta que cae al guardar */
.cinta {
  position: fixed;
  top: 0;
  right: calc(24px + env(safe-area-inset-right));
  width: 20px;
  height: calc(env(safe-area-inset-top) + 34px);
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 700ms var(--ease), opacity 400ms;
  pointer-events: none;
  z-index: 5;
}
.cinta.on { transform: translateY(0); opacity: 0.9; }

/* ——— Historia ——— */
.historia .quien {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.historia h1 { margin: 10px 0 0; font-weight: 300; font-size: 2.6rem; letter-spacing: -0.015em; }
.historia h2 { margin: 6px 0 30px; font-weight: 400; font-style: italic; font-size: 1.3rem; color: var(--muted); }
.historia .ref { margin-top: 28px; color: var(--muted); font-size: 0.95rem; font-style: italic; }

/* ——— Versículo ——— */
.versiculo {
  padding: 0;
  display: flex;
  flex-direction: column;
  background: var(--fondo, #2f4a3a);
  color: var(--tinta, #fbf7ee);
  transition: background-color 800ms var(--ease), color 800ms var(--ease), opacity 420ms var(--ease), transform 520ms var(--ease);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.versiculo .top { padding: calc(env(safe-area-inset-top) + 20px) 28px 0; }
.versiculo .back { color: inherit; opacity: 0.6; }
.versiculo .centro {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 34px;
  max-width: 36rem;
  margin: 0 auto;
  width: 100%;
  transition: opacity 380ms var(--ease), transform 520ms var(--ease);
}
.versiculo .centro.cambia { opacity: 0; transform: translateY(8px); }
.versiculo blockquote {
  margin: 0;
  font-weight: 340;
  line-height: 1.38;
  letter-spacing: -0.005em;
  text-wrap: balance;
}
.versiculo cite {
  display: block;
  margin-top: 28px;
  font-style: italic;
  font-size: 1.1rem;
  opacity: 0.7;
}
.versiculo .toca {
  padding: 0 0 calc(env(safe-area-inset-bottom) + 28px);
  text-align: center;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.45;
}

@media (prefers-reduced-motion: reduce) {
  .view, .cinta, .versiculo, .versiculo .centro { transition-duration: 1ms !important; }
}
