/* Cada página tiene su bloque de color (clase en <body>) */
:root {
  --bg: #ebb8d0;
  --card: rgba(255,255,255,.35);
  --ink: #2a1416;
  --ink-soft: rgba(42,20,22,.68);
  --ink-faint: rgba(42,20,22,.4);
  --line: rgba(42,20,22,.22);
  --accent: #8b2c2a;
  --shelf: #2a1416;
  --shadow: 0 18px 40px -16px rgba(42,20,22,.45);
  --display: 'Jost', system-ui, sans-serif;
  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --script: 'Mrs Saint Delafield', cursive;
  --sans: 'Jost', system-ui, sans-serif;
  --radius: 20px;
}

body.t-wine {
  --bg: #8b2c2a;
  --card: rgba(0,0,0,.14);
  --ink: #f6d6e3;
  --ink-soft: rgba(246,214,227,.75);
  --ink-faint: rgba(246,214,227,.45);
  --line: rgba(246,214,227,.3);
  --accent: #f2c14e;
  --shelf: #f6d6e3;
}
body.t-pink { --bg: #ebb8d0; }
body.t-mustard {
  --bg: #f2c14e;
  --card: rgba(255,255,255,.3);
  --accent: #8b2c2a;
}
body.t-cream {
  --bg: #f7ebd8;
  --card: rgba(255,255,255,.55);
  --accent: #c23a4b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }

.wrap {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 20px;
}

.label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* titular grande en mayúsculas finas + acento manuscrito */
.display {
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: -.01em;
  line-height: .95;
  position: relative;
}
.script {
  font-family: var(--script);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--accent);
  display: inline-block;
  transform: rotate(-7deg);
  line-height: 1;
}

.serif { font-family: var(--serif); font-weight: 400; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
}

.wordmark {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  text-decoration: none;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  transition: transform .15s, background .15s;
}
.icon-btn:hover { background: var(--card); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 18px; height: 18px; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 28px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  transition: transform .15s, opacity .15s;
}
.pill:active { transform: scale(.97); }
.pill:disabled { opacity: .4; cursor: default; }
.pill.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }

.chip {
  height: 34px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: all .15s;
}
.chip:hover { color: var(--ink); border-color: var(--ink); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.field {
  width: 100%;
  height: 50px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  outline: none;
  transition: border-color .15s;
}
.field::placeholder { color: var(--ink-faint); }
.field:focus { border-color: var(--ink); }

.toast {
  position: fixed;
  left: 50%;
  top: max(16px, env(safe-area-inset-top));
  transform: translate(-50%, -20px);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all .25s;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.fade-in { animation: fadeIn .5s ease backwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } }

/* puntuación en puntos (no estrellas) */
.dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.dots i { width: 6px; height: 6px; border-radius: 50%; border: 1px solid currentColor; opacity: .55; }
.dots i.on { background: currentColor; opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* portada sencilla cuando el libro no tiene imagen: color del lomo, título y un filo claro */
.cover-plain {
  display: flex; align-items: flex-end; padding: 10% 10% 14%; overflow: hidden;
  background: linear-gradient(90deg, rgba(0,0,0,.16) 0 6%, rgba(255,255,255,.08) 6% 8%, transparent 8%), var(--c);
  color: var(--t); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.28);
}
.cover-plain span {
  font-family: var(--display); text-transform: uppercase; font-weight: 400; font-size: 11px; line-height: 1.05;
  letter-spacing: .02em; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- cartita de novedades (js/novedades.js) ---------- */
.news-envelope {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; width: 100%; margin-top: 22px;
  padding: 14px 18px; border-radius: 22px; background: #f7ebd8; color: #2a1416; text-align: left; box-shadow: var(--shadow);
}
.news-env { position: relative; width: 52px; height: 36px; border-radius: 4px; background: #fffaf2; box-shadow: inset 0 0 0 1.5px #c9a27a; overflow: hidden; animation: newsWiggle 2.4s ease-in-out infinite; }
.news-env::before { content: ''; position: absolute; left: -2px; right: -2px; top: -18px; height: 36px; background: #ebb8d0; transform: rotate(45deg) scale(.72); transform-origin: center; box-shadow: inset 0 0 0 1.5px #c9a27a; }
.news-env i { position: absolute; left: 50%; top: 52%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #8b2c2a; box-shadow: 0 0 0 2px rgba(139,44,42,.25); }
.news-envtxt small { display: block; font-size: 10px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase; color: #8b2c2a; }
.news-envtxt b { display: block; font-family: var(--display); font-weight: 400; font-size: 18px; text-transform: uppercase; line-height: 1.15; }
.news-open { font-size: 12px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; padding: 8px 14px; border-radius: 99px; background: #2a1416; color: #f7ebd8; }
@keyframes newsWiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-6deg); } 90% { transform: rotate(5deg); } 95% { transform: rotate(-3deg); } }

.news-bg { position: fixed; inset: 0; z-index: 60; background: rgba(42,20,22,.5); display: grid; place-items: center; padding: 16px; animation: fadeIn .25s ease; }
.news-letter {
  position: relative; width: 100%; max-width: 480px; max-height: 92dvh; overflow: auto; padding: 34px 28px 30px; border-radius: 6px;
  color: #2a1416; background: #fffaf2;
  background-image: repeating-linear-gradient(180deg, transparent 0 31px, rgba(139,44,42,.09) 31px 32px);
  box-shadow: 0 40px 90px -30px rgba(0,0,0,.55); transform: rotate(-.6deg); animation: newsIn .45s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes newsIn { from { opacity: 0; transform: translateY(40px) rotate(3deg) scale(.96); } to { opacity: 1; transform: rotate(-.6deg); } }
.news-close { position: absolute; top: 12px; left: 14px; width: 32px; height: 32px; border-radius: 50%; color: #7a5a55; font-size: 14px; }
.news-stamp { position: absolute; top: 16px; right: 18px; width: 58px; height: 68px; padding: 5px; background: #ebb8d0; transform: rotate(6deg); outline: 4px dotted #fffaf2; outline-offset: -2px; }
.news-stamp span { display: grid; place-items: center; width: 100%; height: 100%; border: 1.5px solid #8b2c2a; color: #8b2c2a; font-size: 22px; }
.news-date { margin-top: 16px; font-size: 11px; font-weight: 500; letter-spacing: .18em; text-transform: uppercase; color: #8b2c2a; }
.news-title { font-family: var(--display); font-weight: 300; font-size: 32px; line-height: 1; text-transform: uppercase; margin: 6px 0 10px; padding-right: 60px; }
.news-dear { font-size: 40px; color: #8b2c2a; line-height: 1; margin: 6px 0 4px; }
.news-intro { font-size: 15px; font-weight: 300; line-height: 1.6; }
.news-items { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 12px; }
.news-items li { display: grid; grid-template-columns: 14px 1fr; column-gap: 8px; font-size: 14px; font-weight: 300; line-height: 1.5; }
.news-items li::before { content: '✦'; color: #8b2c2a; font-size: 11px; line-height: 1.9; grid-row: span 2; }
.news-items b { font-weight: 500; }
.news-sign { text-align: right; font-size: 38px; color: #8b2c2a; margin-top: 10px; }
