/* RentaNube - folleto online
   Brand: #1A4871 (navy) - #00B9F0 (cyan) - Inter */

@font-face {
  font-family: "Inter";
  src: url("/folleto/fonts/inter-latin.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

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

:root {
  --navy-deep: #071c2e;
  --navy: #0d2a45;
  --navy-mid: #12395c;
  --brand-navy: #1a4871;
  --cyan: #00b9f0;
  --cyan-soft: #6fd8f7;
  --whatsapp: #25d366;
  --text: #f2f8fc;
  --text-muted: rgba(242, 248, 252, 0.56);
  --sheet-shadow:
    0 26px 60px rgba(0, 0, 0, 0.5),
    0 8px 22px rgba(0, 185, 240, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.07);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --topbar-h: 3.25rem;
  --toolbar-h: 5.25rem;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--navy-deep);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#app {
  width: 100%;
  height: 100%;
  height: 100dvh;
}

.hidden {
  display: none !important;
}

/* Brand logo */

.brand-logo {
  display: block;
  width: auto;
  object-fit: contain;
}

.brand-logo--loader { height: 2.75rem; }
.brand-logo--header { height: 1.85rem; }
.brand-logo--spinner { height: 3.25rem; }

.brand-logo--pulse {
  animation: brand-pulse 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes brand-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* Initial loader */

.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(0, 185, 240, 0.2), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(26, 72, 113, 0.55), transparent 55%),
    var(--navy-deep);
}

.loader__caption {
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.loader__error {
  font-size: 0.92rem;
  color: var(--text-muted);
  padding: 0 1.5rem;
  text-align: center;
}

/* Viewer shell */

.viewer {
  position: relative;
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr var(--toolbar-h);
  width: 100%;
  height: 100%;
  height: 100dvh;
  background:
    radial-gradient(ellipse 90% 70% at 50% -10%, rgba(0, 185, 240, 0.16), transparent 55%),
    radial-gradient(ellipse 70% 55% at 100% 100%, rgba(0, 185, 240, 0.07), transparent 50%),
    linear-gradient(180deg, var(--navy-mid) 0%, var(--navy) 45%, var(--navy-deep) 100%);
  animation: viewer-in 0.5s var(--ease-out) both;
}

@keyframes viewer-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Top bar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding:
    max(0.5rem, env(safe-area-inset-top))
    max(0.85rem, env(safe-area-inset-right))
    0
    max(1rem, env(safe-area-inset-left));
  z-index: 20;
}

.topbar__brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}

.topbar__meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.topbar__page {
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.topbar__badge {
  font-size: 0.66rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid rgba(0, 185, 240, 0.3);
  background: rgba(0, 185, 240, 0.12);
  color: var(--cyan-soft);
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.topbar__badge.is-done {
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
}

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

.icon-btn:hover {
  background: rgba(0, 185, 240, 0.16);
  border-color: rgba(0, 185, 240, 0.4);
}

.icon-btn:active { transform: scale(0.94); }

/* Stage */

.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  flex: 1;
  padding: 0.5rem max(0.75rem, env(safe-area-inset-right)) 0.25rem max(0.75rem, env(safe-area-inset-left));
}

.stage__glow {
  position: absolute;
  inset: 8% 12% 12%;
  background: radial-gradient(ellipse at center, rgba(0, 185, 240, 0.14), transparent 70%);
  pointer-events: none;
  filter: blur(18px);
}

.page-loader {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 28, 46, 0.66);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.book-wrap {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: min(920px, 100%);
  height: 100%;
  max-height: calc(100dvh - var(--topbar-h) - var(--toolbar-h) - 1rem);
  display: flex;
  align-items: center;
  justify-content: center;
}

.book {
  width: 100%;
  height: 100%;
}

/* page-flip puts .stf__parent on the #book element itself. */
.book.stf__parent {
  margin: 0 auto;
  transition: transform 0.45s var(--ease-out);
}

/* In spread mode the cover and back cover render alone on one half of the
   book. Nudge the sheet over so a lone page still sits centred on screen. */
.book.is-single-right { transform: translateX(-25%); }
.book.is-single-left { transform: translateX(25%); }

.bf-page {
  background-color: #fff;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  overflow: hidden;
  box-shadow: var(--sheet-shadow);
}

.bf-page img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  opacity: 0;
  transition: opacity 0.32s var(--ease-out);
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.bf-page img.is-ready { opacity: 1; }

/* Toolbar */

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding:
    0
    max(1rem, env(safe-area-inset-right))
    max(0.65rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
  z-index: 20;
}

.toolbar__track {
  height: 3px;
  background: rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  overflow: hidden;
}

.toolbar__fill {
  height: 100%;
  width: 6%;
  background: linear-gradient(90deg, var(--brand-navy), var(--cyan));
  border-radius: inherit;
  transition: width 0.35s var(--ease-out);
}

.toolbar__nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
}

.toolbar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  min-width: 48px;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease;
}

.toolbar__btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

.toolbar__btn:active:not(:disabled) { transform: scale(0.96); }

.toolbar__btn:disabled {
  opacity: 0.26;
  cursor: default;
}

.toolbar__btn--primary {
  border-color: rgba(0, 185, 240, 0.5);
  background: linear-gradient(145deg, rgba(0, 185, 240, 0.4), rgba(26, 72, 113, 0.5));
}

.toolbar__btn--primary:hover:not(:disabled) {
  background: linear-gradient(145deg, rgba(0, 185, 240, 0.55), rgba(26, 72, 113, 0.6));
  border-color: rgba(0, 185, 240, 0.75);
}

.toolbar__hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  user-select: none;
}

.toolbar__hint--short { display: none; }

/* WhatsApp CTA */

.wa-cta {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.75rem;
  border-radius: 999px;
  background: var(--whatsapp);
  color: #06301a;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.wa-cta:hover { filter: brightness(1.08); }
.wa-cta:active { transform: scale(0.96); }

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--toolbar-h) + 1.5rem);
  transform: translate(-50%, 12px);
  z-index: 60;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: rgba(7, 28, 46, 0.94);
  border: 1px solid rgba(0, 185, 240, 0.35);
  color: var(--text);
  font-size: 0.8rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s var(--ease-out);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Responsive */

@media (max-width: 640px) {
  :root { --toolbar-h: 4.75rem; }

  .toolbar__hint { font-size: 0.7rem; }
  .toolbar__hint--long { display: none; }
  .toolbar__hint--short { display: inline; }
  .brand-logo--header { height: 1.6rem; }
}

@media (max-width: 480px) {
  /* Icon-only, but keep both controls at a comfortable touch size. */
  .wa-cta__label { display: none; }
  .wa-cta {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    justify-content: center;
  }
  .icon-btn { width: 2.5rem; height: 2.5rem; }
  .topbar__meta { gap: 0.45rem; }
}

@media (max-width: 380px) {
  .topbar__page { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .viewer,
  .toolbar__fill,
  .topbar__badge,
  .bf-page img,
  .toast,
  .brand-logo--pulse {
    animation: none !important;
    transition: none !important;
  }
  .bf-page img { opacity: 1; }
}
