:root {
  color-scheme: light;
  --fb-ink: #113d3a;
  --fb-teal: #07534f;
  --fb-mint: #d4f5f2;
  --fb-coral: #e76160;
  --fb-paper: #f9fbf7;
  --fb-violet: #825bc4;
  --fb-focus: #a33251;
  --fb-border: #cbded8;
  --fb-shadow: 0 18px 50px rgb(17 61 58 / 16%);
  --fb-ease: cubic-bezier(.16, 1, .3, 1);
  --fb-glass: rgb(255 255 255 / 58%);
  --fb-glass-border: rgb(255 255 255 / 78%);
  --fb-safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 22%, rgb(212 245 242 / 92%), transparent 48%),
    linear-gradient(145deg, #f9fbf7 0%, #eef7f2 55%, #e3f2ed 100%);
  color: var(--fb-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.flipbook-shell { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; min-height: 100dvh; }
.flipbook-skip { position: fixed; z-index: 100; top: -5rem; left: 1rem; padding: .75rem 1rem; border-radius: 999px; background: var(--fb-ink); color: #fff; }
.flipbook-skip:focus { top: 1rem; }

.flipbook-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  padding: .7rem clamp(.75rem, 3vw, 2rem);
  border-bottom: 1px solid var(--fb-border);
  background: rgb(249 251 247 / 92%);
  box-shadow: 0 8px 28px rgb(17 61 58 / 7%);
  backdrop-filter: blur(14px);
}
.flipbook-back { justify-self: start; color: var(--fb-teal); font-weight: 800; text-decoration: none; }
.flipbook-identity { display: flex; min-width: 0; align-items: center; gap: .75rem; text-align: left; }
.flipbook-identity img { border: 2px solid #fff; border-radius: 50%; background: #fff; box-shadow: 0 3px 10px rgb(17 61 58 / 16%); }
.flipbook-identity p, .flipbook-identity h1 { margin: 0; }
.flipbook-identity p { color: var(--fb-violet); font-size: .7rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.flipbook-identity h1 { max-width: 42vw; overflow: hidden; color: var(--fb-ink); font-size: clamp(.9rem, 2vw, 1.15rem); text-overflow: ellipsis; white-space: nowrap; }
.flipbook-header > button { justify-self: end; }

.flipbook-back,
.flipbook-header button,
.flipbook-controls button,
.flipbook-controls a,
.flipbook-error button,
.flipbook-error a {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--fb-glass-border);
  border-radius: 999px;
  padding: .62rem 1rem;
  background:
    radial-gradient(circle at 18% -30%, rgb(255 255 255 / 92%), transparent 46%),
    linear-gradient(135deg, rgb(255 255 255 / 72%), rgb(212 245 242 / 42%));
  color: var(--fb-teal);
  box-shadow:
    inset 0 1px 1px rgb(255 255 255 / 96%),
    inset 0 -8px 18px rgb(7 83 79 / 7%),
    0 8px 22px rgb(17 61 58 / 12%),
    0 1px 2px rgb(17 61 58 / 18%);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  font: inherit;
  font-weight: 800;
  line-height: 1.1;
  text-decoration: none;
  text-shadow: 0 1px 0 rgb(255 255 255 / 72%);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .24s var(--fb-ease), box-shadow .24s var(--fb-ease), color .24s var(--fb-ease), filter .24s var(--fb-ease), transform .24s var(--fb-ease);
}
.flipbook-back::before,
.flipbook-header button::before,
.flipbook-controls button::before,
.flipbook-controls a::before,
.flipbook-error button::before,
.flipbook-error a::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 2px;
  border-radius: inherit;
  background: linear-gradient(165deg, rgb(255 255 255 / 48%), transparent 38%, transparent 68%, rgb(255 255 255 / 16%));
  pointer-events: none;
}
.flipbook-back:hover,
.flipbook-header button:hover,
.flipbook-controls button:hover,
.flipbook-controls a:hover,
.flipbook-error button:hover,
.flipbook-error a:hover {
  border-color: rgb(130 91 196 / 48%);
  box-shadow: inset 0 1px 2px #fff, inset 0 -8px 18px rgb(130 91 196 / 9%), 0 13px 28px rgb(17 61 58 / 17%);
  color: var(--fb-violet);
  filter: saturate(1.08);
  transform: translateY(-2px);
}
.flipbook-back:active,
.flipbook-header button:active,
.flipbook-controls button:active,
.flipbook-controls a:active,
.flipbook-error button:active,
.flipbook-error a:active {
  transform: translateY(1px) scale(.98);
  box-shadow: inset 0 3px 9px rgb(7 83 79 / 18%), 0 3px 8px rgb(17 61 58 / 10%);
}
.flipbook-controls [data-previous], .flipbook-controls [data-next], .flipbook-error button {
  border-color: rgb(255 255 255 / 54%);
  background: radial-gradient(circle at 18% -45%,rgb(255 255 255 / 50%),transparent 42%),linear-gradient(125deg,var(--fb-teal),#168279 52%,var(--fb-violet));
  color: #fff;
  box-shadow: inset 0 2px 2px rgb(255 255 255 / 48%), inset 0 -9px 18px rgb(6 46 43 / 34%), 0 10px 24px rgb(7 83 79 / 22%);
  text-shadow: 0 1px 2px rgb(6 46 43 / 72%);
}
.flipbook-controls [data-effects][aria-pressed="true"] { border-color: rgb(255 255 255 / 62%); background: radial-gradient(circle at 18% -35%,rgb(255 255 255 / 62%),transparent 45%),linear-gradient(135deg,rgb(130 91 196 / 88%),rgb(163 50 81 / 78%)); color:#fff; text-shadow:0 1px 2px rgb(69 31 102 / 66%); }
.flipbook-controls button:disabled { opacity: .42; cursor: not-allowed; filter: grayscale(.3); transform: none; box-shadow: inset 0 1px 1px rgb(255 255 255 / 70%); }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--fb-focus); outline-offset: 3px; }

.flipbook-main { position: relative; display: flex; min-height: 0; overflow: hidden; }
.flipbook-stage { position: relative; display: grid; flex: 1; min-width: 0; place-items: center; overflow: auto; padding: clamp(.6rem, 2vw, 1.5rem); }
.flipbook-stage > .flipbook-status,
.flipbook-stage > .flipbook-book,
.flipbook-stage > .flipbook-error { grid-area: 1 / 1; }
.flipbook-book { width: 100%; height: 100%; max-width: 1300px; max-height: 900px; box-shadow: var(--fb-shadow); transform-origin: top center; transition: transform .2s var(--fb-ease); }
.flipbook-stage.is-magnified { place-items: start center; }
.flipbook-stage.is-magnified .flipbook-book { transform-origin: top left; }
.flipbook-stage.is-reduced .flipbook-book { transform-origin: center; }

/* StPageFlip normally injects these rules inline. The viewer CSP blocks inline
   styles, so its structural stylesheet must live in this trusted asset. */
.stf__parent { position: relative; display: block; box-sizing: border-box; transform: translateZ(0) scale(var(--flipbook-zoom, 1)); touch-action: pan-y; }
.stf__wrapper { position: relative; width: 100%; box-sizing: border-box; }
.stf__parent canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.stf__block { position: absolute; width: 100%; height: 100%; box-sizing: border-box; perspective: 2000px; }
.stf__item { position: absolute; display: none; transform-style: preserve-3d; }
.stf__outerShadow,
.stf__innerShadow,
.stf__hardShadow,
.stf__hardInnerShadow { position: absolute; top: 0; left: 0; pointer-events: none; }

.flipbook-page { display: grid; place-items: center; overflow: hidden; border: 1px solid #dce7e2; background: #fff; color: var(--fb-ink); }
.flipbook-page::before { content: "Cargando página…"; font-size: .8rem; }
.flipbook-page img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.flipbook-page img:not([src]) { display: none; }

.flipbook-status { z-index: 3; display: grid; place-items: center; padding: 1.4rem 1.75rem; border: 1px solid rgb(7 83 79 / 12%); border-radius: 1.2rem; background: rgb(249 251 247 / 88%); box-shadow: 0 14px 40px rgb(17 61 58 / 10%); color: var(--fb-ink); backdrop-filter: blur(10px); }
.flipbook-status span { width: 52px; height: 52px; border: 4px solid rgb(7 83 79 / 14%); border-top-color: var(--fb-coral); border-right-color: var(--fb-violet); border-radius: 50%; animation: fb-spin .9s linear infinite; }
.flipbook-status p { margin: 1rem 0 0; font-weight: 750; }
.flipbook-error { z-index: 4; max-width: 560px; padding: 2rem; border: 1px solid var(--fb-border); border-radius: 1.2rem; background: rgb(249 251 247 / 96%); box-shadow: var(--fb-shadow); color: var(--fb-ink); text-align: center; }
.flipbook-error h2 { color: var(--fb-focus); }
.flipbook-error div { display: flex; justify-content: center; gap: .75rem; flex-wrap: wrap; }

.flipbook-thumbnails { z-index: 20; width: min(280px, 82vw); overflow: auto; border-right: 1px solid var(--fb-border); background: var(--fb-paper); box-shadow: 12px 0 30px rgb(17 61 58 / 12%); padding: 1rem; }
.flipbook-thumbnails__header { position: sticky; z-index: 2; top: -1rem; display: flex; align-items: center; justify-content: space-between; padding: .5rem 0 1rem; background: var(--fb-paper); color: var(--fb-ink); }
.flipbook-thumbnails__header button { border: 0; background: transparent; color: var(--fb-teal); font-size: 1.6rem; }
.flipbook-thumbnails [data-thumbnail-list] { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; }
.flipbook-thumbnail { display: grid; gap: .35rem; border: 2px solid transparent; border-radius: .75rem; padding: .35rem; background: #edf7f3; color: var(--fb-ink); cursor: pointer; }
.flipbook-thumbnail img { width: 100%; aspect-ratio: 3 / 4; object-fit: contain; background: #fff; }
.flipbook-thumbnail[aria-current="page"] { border-color: var(--fb-violet); background: #f2ecfb; }

.flipbook-controls { position: relative; display: grid; grid-template-columns: max-content minmax(0, max-content); align-items: center; justify-content: center; gap: .65rem; min-width: 0; padding: .65rem max(.75rem, env(safe-area-inset-left)) calc(.65rem + var(--fb-safe-bottom)) max(.75rem, env(safe-area-inset-right)); border-top: 1px solid rgb(255 255 255 / 72%); background: linear-gradient(135deg,rgb(249 251 247 / 72%),rgb(212 245 242 / 46%)); box-shadow: 0 -10px 34px rgb(17 61 58 / 10%); backdrop-filter:blur(22px) saturate(150%); -webkit-backdrop-filter:blur(22px) saturate(150%); }
.flipbook-navigation,
.flipbook-secondary-controls,
.flipbook-controls form,
.flipbook-zoom-controls { display: flex; min-width: 0; align-items: center; gap: .4rem; }
.flipbook-navigation,
.flipbook-secondary-controls { padding: .12rem; }
.flipbook-navigation > *,
.flipbook-secondary-controls > * { flex: 0 0 auto; }
.flipbook-secondary-controls { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-color: rgb(7 83 79 / 36%) transparent; scrollbar-width: thin; }
.flipbook-controls form { color: var(--fb-ink); white-space: nowrap; }
.flipbook-controls input { width: 4.2rem; min-height: 46px; border: 1px solid var(--fb-glass-border); border-radius: 999px; background:linear-gradient(135deg,rgb(255 255 255 / 82%),rgb(212 245 242 / 45%)); color: var(--fb-ink); box-shadow:inset 0 1px 2px #fff,0 7px 18px rgb(17 61 58 / 10%); backdrop-filter:blur(16px); -webkit-backdrop-filter:blur(16px); text-align: center; font: inherit; font-weight: 800; }
.flipbook-controls label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.flipbook-zoom-controls { white-space: nowrap; }
.flipbook-zoom-controls output { min-width: 3.25rem; color: var(--fb-ink); font-size: .78rem; font-weight: 850; text-align: center; }
.flipbook-share-status { position: absolute; bottom: calc(4.5rem + var(--fb-safe-bottom)); left: 50%; transform: translateX(-50%); padding: .45rem .8rem; border-radius: 999px; background: var(--fb-ink); color: #fff; box-shadow: var(--fb-shadow); }
.flipbook-share-status:empty { display: none; }
.flipbook-progress { height: 4px; background: #d9e9e3; }
.flipbook-progress span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--fb-coral), var(--fb-violet)); transition: width .2s ease; }

.flipbook-noscript { position: fixed; z-index: 200; inset: 0; display: grid; place-content: center; background: var(--fb-paper); color: var(--fb-ink); text-align: center; }
.flipbook-noscript a { color: var(--fb-violet); }
.flipbook-page-error { padding: 1rem; color: var(--fb-focus); text-align: center; }

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

@media (max-width: 1180px) {
  .flipbook-controls { grid-template-columns: minmax(0, 1fr); }
  .flipbook-navigation { justify-self: center; }
  .flipbook-secondary-controls { width: 100%; justify-self: stretch; padding-bottom: .3rem; }
  .flipbook-zoom-controls button span { display: none; }
}

@media (max-width: 800px) {
  .flipbook-header { grid-template-columns: 1fr auto; }
  .flipbook-identity { display: none; }
  .flipbook-back span { display: none; }
  .flipbook-main { min-height: 0; }
  .flipbook-controls { gap: .4rem; padding-top: .45rem; padding-bottom: calc(.45rem + var(--fb-safe-bottom)); }
  .flipbook-navigation { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); width: 100%; justify-self: stretch; }
  .flipbook-navigation > button { min-width: 0; padding-inline: .65rem; }
  .flipbook-navigation [data-previous] { justify-self: stretch; }
  .flipbook-navigation [data-next] { justify-self: stretch; }
  .flipbook-controls input { width: 3.45rem; }
  .flipbook-secondary-controls { gap: .35rem; margin-inline: -.15rem; padding-inline: .15rem; }
  .flipbook-secondary-controls::after { content: ""; flex: 0 0 .1rem; }
  .flipbook-secondary-controls button,
  .flipbook-secondary-controls a { min-height: 44px; padding: .55rem .75rem; font-size: .86rem; }
  .flipbook-zoom-controls output { min-width: 2.9rem; }
  .flipbook-stage { padding: .25rem; overscroll-behavior: contain; }
  .flipbook-book { max-height: none; }
  .flipbook-thumbnails { position: absolute; inset: 0 auto 0 0; }
}

@media (max-width: 430px) {
  .flipbook-header { gap: .5rem; padding: .45rem .55rem; }
  .flipbook-header > button { min-height: 44px; padding-inline: .75rem; font-size: .82rem; }
  .flipbook-navigation { gap: .3rem; }
  .flipbook-navigation > button { font-size: .86rem; }
  .flipbook-controls form { gap: .25rem; font-size: .84rem; }
  .flipbook-controls input { width: 3.15rem; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
  .flipbook-status span { animation: none; border-top-color: var(--fb-coral); }
  .flipbook-back:hover,
  .flipbook-header button:hover,
  .flipbook-controls button:hover,
  .flipbook-controls a:hover,
  .flipbook-error button:hover,
  .flipbook-error a:hover { transform: none; }
}
