/* Look Inside (lookinside.js). Everything is scoped to .li / .li-* and
   picks up the store's colours and fonts from css/style.css, with
   fallbacks so it also works on its own. */
.li {
  --li-accent: var(--color-primary, #4d7d78);
  --li-accent-hover: var(--color-primary-hover, #3d6d68);
  --li-ink: var(--color-text, #333);
  --li-ink-soft: var(--color-text-light, #666);
  --li-rule: var(--color-border, #ddd);
  --li-ui: var(--font-ui, system-ui, sans-serif);
  margin: 2.5rem 0;
}
.li-intro { color: var(--li-ink-soft); margin-bottom: 0.5rem; }

.li-stage { margin: 1.25rem 0 1rem; }
.li-book {
  margin: 0 auto;
  visibility: hidden;          /* until StPageFlip has laid out the pages */
}
.li-book.ready { visibility: visible; }

/* A light shadow on every page, so white pages don't melt into the page
   background. On the pages, not the book frame, because the frame is a
   full spread wide even when the cover sits alone. */
.li-page {
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.12);
}
.li-page.blank { background: #fbfaf6; }
.li-page img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  -webkit-user-drag: none;
  user-select: none;
}
/* Enlarged, pages should look bitmapped, not blurred. */
.li-stage.enlarged .li-page img { image-rendering: pixelated; }

/* A faint gutter shadow so spreads read as a bound book. */
.li-page.verso::after,
.li-page.recto::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 6%;
  pointer-events: none;
}
.li-page.verso::after { right: 0; background: linear-gradient(to left, rgba(0,0,0,0.12), transparent); }
.li-page.recto::after { left: 0;  background: linear-gradient(to right, rgba(0,0,0,0.12), transparent); }

.li-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 26rem;
  margin: 1.25rem auto 0;
}
.li-scrub { flex: 1; min-width: 0; accent-color: var(--li-accent); }
.li-btn {
  font: inherit;
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--li-rule);
  border-radius: 3px;
  background: #fff;
  color: var(--li-ink);
  cursor: pointer;
}
.li-btn:hover:not(:disabled) { border-color: var(--li-accent); color: var(--li-accent); }
.li-btn:disabled { opacity: 0.35; cursor: default; }
.li-label {
  margin: 0.5rem 0 0;
  text-align: center;
  font-family: var(--li-ui);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--li-ink-soft);
}

/* "Read" tab on pages that are excerpted below the book. */
.li-read,
.li-read-sample {
  font-family: var(--li-ui);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  color: #fff;
  background: var(--li-accent);
  border-radius: 2px;
}
.li-read {
  position: absolute;
  bottom: 0.35rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 0.3rem 0.4rem 0.25rem;
  font-size: 0.6rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.li-read:hover { background: var(--li-ink); color: #fff; text-decoration: none; }
.li-read-sample {
  display: inline-block;
  padding: 0.2rem 0.35rem 0.15rem;
  font-size: 0.7em;
  vertical-align: 0.15em;
}

/* Excerpts: legible pages below the book. */
.li-excerpts { margin-top: 2rem; }
.li-excerpt-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 1.5rem 1.25rem;
  margin-top: 1rem;
}
.li-excerpt { margin: 0; scroll-margin-top: 1.5rem; }
.li-excerpt.spread { grid-column: span 2; }
@media (max-width: 22rem) { .li-excerpt.spread { grid-column: auto; } }
.li-excerpt-open {
  display: flex;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.li-excerpt-open img {
  display: block;
  width: 100%;
  min-width: 0;
  height: auto;
}
.li-excerpt.spread .li-excerpt-open img { width: 50%; }
.li-excerpt-open:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.3); }
.li-excerpt-open:focus-visible { outline: 2px solid var(--li-accent); outline-offset: 3px; }
.li-excerpt:target .li-excerpt-open { outline: 3px solid var(--li-accent); outline-offset: 4px; }
.li-excerpt figcaption { margin-top: 0.5rem; font-size: 0.9rem; line-height: 1.35; }
.li-excerpt figcaption strong { display: block; color: var(--li-ink); font-weight: 600; }
.li-by, .li-folio { display: block; color: var(--li-ink-soft); }

/* Full-size reader (appended to <body>, so not inside .li). */
.li-reader {
  width: min(100vw, 90rem);
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: #2b2b2b;
  overflow: auto;
}
.li-reader::backdrop { background: rgba(0,0,0,0.75); }
.li-reader-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: rgba(26,26,26,0.92);
  color: #fff;
}
.li-reader-title { margin: 0; font-weight: 600; }
.li-reader-close {
  font: inherit;
  font-size: 1.8rem;
  line-height: 1;
  padding: 0 0.4rem;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
}
.li-reader-close:hover { color: #ccc; }
.li-reader-pages {
  display: flex;
  justify-content: center;
  padding: 1rem;
}
.li-reader-pages img {
  display: block;
  width: min(100%, 40rem);
  max-width: none;
  height: auto;
  background: #fff;
}
.li-reader-pages.spread img { width: min(50%, 40rem); }
@media (max-width: 40rem) {
  /* Phones: stack a spread, each page full width. */
  .li-reader-pages.spread { flex-direction: column; align-items: center; }
  .li-reader-pages.spread img { width: 100%; }
}
