/* Linkin1 digital book viewer. Everything is scoped under .l1db so user templates are not affected. */
.l1db {
  --l1db-accent: #2f6fed;
  --l1db-paper: #ffffff;
  position: relative;
  width: 100%;
  /* Same width as the page buttons (set by the script), centred. */
  max-width: var(--l1db-width, 520px);
  margin-left: auto;
  margin-right: auto;
  /* In one-page view the page-turn library keeps the hidden facing page
     beside the visible one. It is cut off visually, but it still widened the
     page: on a phone the whole page scrolled sideways and fixed controls
     like the share button moved off screen. clip, not hidden: hidden would
     turn the vertical axis into a scroll box and cut the page-turn shadows. */
  overflow-x: hidden;
  overflow-x: clip;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
/* A little breathing room above and below the book on the page. */
.l1db:not(.is-full) { margin-top: 10px; margin-bottom: 10px; }
.l1db *,
.l1db *::before,
.l1db *::after { box-sizing: border-box; }
.l1db:focus-visible { outline: 2px solid var(--l1db-accent); outline-offset: 4px; border-radius: 6px; }

.l1db-stage {
  position: relative;
  /* A turning page can reach past the book onto the bar: it must pass OVER the
     bar. Without this, the mirrored (transformed) RTL book sat level with the
     bar and the arrows + page count were painted on top of the paper. */
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Vertical swipes scroll the page; horizontal swipes and pinches are ours. */
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.l1db-book {
  position: relative;
  direction: ltr; /* StPageFlip lays pages out left to right */
  max-width: 100%;
}
/* Page-curl layer: drawn only while a paper page turns, the flat pages hide meanwhile. */
.l1db-curl {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  visibility: hidden;
}
.l1db-book.is-curling .stf__block { opacity: 0; }
/* RTL book = the LTR book mirrored (spine on the right, pages lift from the left
   edge). The page images are mirrored back so they read normally. */
.l1db[dir="rtl"] .l1db-book,
.l1db[dir="rtl"] .l1db-page img { transform: scaleX(-1); }
/* One-page view: the half beside the spine is not part of the book, so a page
   turning past the spine disappears there instead of floating off the book. */
.l1db-book.is-single { clip-path: inset(-2000px -2000px -2000px 0); }
.l1db-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  font-size: 14px;
  color: inherit;
  opacity: 0.7;
}
.l1db-status[hidden] { display: none; }

/* loading skeleton (before the first page is ready) */
.l1db-status.is-loading { opacity: 1; padding: 0; }
.l1db-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.l1db-skel-page {
  display: block;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 1 / 1.414;
  border-radius: 4px;
}
/* Neutral grey that reads on light and dark templates alike. */
.l1db-skel-page,
.l1db-skel-pill,
.l1db-page.is-loading {
  background-color: rgba(127, 127, 127, 0.14);
  background-image: linear-gradient(100deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.38) 50%, rgba(255, 255, 255, 0) 70%);
  background-size: 220% 100%;
  background-repeat: no-repeat;
  animation: l1db-shimmer 1.3s ease-in-out infinite;
}
@keyframes l1db-shimmer {
  from { background-position: 130% 0; }
  to { background-position: -30% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .l1db-skel-page,
  .l1db-skel-pill,
  .l1db-page.is-loading { animation: none; }
}
.l1db-status.is-error { opacity: 1; color: #d64545; }

/* pages */
.l1db-page {
  background: var(--l1db-paper);
  overflow: hidden;
}
.l1db-page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain; /* mixed page sizes never stretch */
  -webkit-user-drag: none;
  pointer-events: none;
}
.l1db-page.is-loading { background-color: #ececec; }
.l1db-page.is-error::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--l1db-accent);
  animation: l1db-spin 0.8s linear infinite;
}
.l1db-page.is-error::after { animation: none; border-color: rgba(214, 69, 69, 0.5); border-top-color: rgba(214, 69, 69, 0.5); }
@keyframes l1db-spin { to { transform: rotate(360deg); } }

/* paper feel: shading toward the spine (--left / --right are set by StPageFlip) */
.l1db-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.l1db-page.--left::before  { background: linear-gradient(to left,  rgba(0,0,0,0.16), rgba(0,0,0,0) 7%); }
.l1db-page.--right::before { background: linear-gradient(to right, rgba(0,0,0,0.16), rgba(0,0,0,0) 7%); }
.stf__wrapper.--portrait .l1db-page::before { background: linear-gradient(to right, rgba(0,0,0,0.1), rgba(0,0,0,0) 4%); }

/* ===== controls =====
   Same look as the e-menu cart (styles/menu.css .cart-*, menu-checkout.css):
   light #f8f9fa surfaces, #2C3E50 text and primary buttons, #dde1e5 / #e9ecef
   lines, 40px round icon buttons, 10px button corners, white sheets with 20px
   top corners. Logical properties: this file is not mirrored. */
.l1db,
.l1db-ext {
  --l1db-ink: #2C3E50;          /* text, primary buttons, current item */
  --l1db-ink-2: #6c757d;        /* secondary text (4.6:1 on white) */
  --l1db-soft: #f8f9fa;         /* bars, icon wells */
  --l1db-hover: #e9ecef;
  --l1db-rule: #e9ecef;
  --l1db-line: #dde1e5;
}
/* The bar: frosted glass over the page (light on light pages, dark on dark
   pages - .on-dark is set from the colour behind the book). Light controls:
   no boxes around the arrows, no shadows on buttons, the counter is text. */
.l1db-bar {
  --l1db-glass: rgba(255, 255, 255, 0.58);
  --l1db-glass-line: rgba(255, 255, 255, 0.75);
  --l1db-tint: rgba(44, 62, 80, 0.08);
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  min-height: 48px;
  margin: 12px auto 6px;
  padding: 5px 6px;
  /* the page button border when it has one (applyTheme), else a glass edge */
  border: var(--l1db-bar-line, 1px solid var(--l1db-glass-line));
  /* the page button corners (applyTheme), else a pill */
  border-radius: var(--l1db-bar-radius, 999px);
  background: var(--l1db-glass);
  -webkit-backdrop-filter: blur(16px) saturate(170%);
  backdrop-filter: blur(16px) saturate(170%);
  /* the page button colour when it reads on the glass (applyTheme), else ink */
  color: var(--l1db-ctl, var(--l1db-ink));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.l1db.on-dark .l1db-bar {
  --l1db-glass: rgba(18, 18, 24, 0.42);
  --l1db-glass-line: rgba(255, 255, 255, 0.14);
  --l1db-tint: rgba(255, 255, 255, 0.12);
  color: var(--l1db-ctl, #fff);
}
/* No backdrop blur (old browsers): a solid enough tint keeps it readable. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .l1db-bar { --l1db-glass: rgba(255, 255, 255, 0.92); }
  .l1db.on-dark .l1db-bar { --l1db-glass: rgba(18, 18, 24, 0.85); }
}
.l1db-bar[hidden] { display: none; }
.l1db-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation; /* no double-tap delay */
  -webkit-appearance: none;
  appearance: none;
  transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}
.l1db-btn svg,
.l1db-chip-btn svg,
.l1db-count svg,
.l1db-row-ico svg,
.l1db-toast svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.l1db svg .l1db-fill,
.l1db-ext svg .l1db-fill { fill: currentColor; stroke: none; }
.l1db-btn:disabled { opacity: 0.3; cursor: default; }
.l1db-btn:focus-visible,
.l1db-count:focus-visible,
.l1db-slider:focus-visible,
.l1db-chip-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
/* Buttons inside the bar share its corners, so a square-cornered template
   gets square hover tints and a round one round tints. */
.l1db-bar .l1db-btn { border-radius: var(--l1db-bar-radius-in, 999px); }
/* A smaller hover box than the 36px tap area: a clear 2px edge that the
   tint does not paint (the button stays 36px for fingers). */
.l1db-bar .l1db-btn {
  border: 2px solid transparent;
  background-clip: padding-box;
}
@media (hover: hover) {
  .l1db-bar .l1db-btn:not(:disabled):hover { background-color: var(--l1db-tint); }
}
.l1db-bar .l1db-btn.is-on { background-color: var(--l1db-tint); }
/* Hover tint in the template own colour: a light wash of the control colour
   (--l1db-ctl, taken from the page buttons), so a blue template gets a blue
   hover and a black one a grey hover. Old browsers keep the neutral tint. */
@supports (background: color-mix(in srgb, red 10%, transparent)) {
  .l1db .l1db-bar,
  .l1db.on-dark .l1db-bar { --l1db-tint: color-mix(in srgb, currentColor 14%, transparent); }
  .l1db .l1db-top .l1db-chip-btn,
  .l1db.is-full.is-wide .l1db-side { --l1db-tint: color-mix(in srgb, currentColor 14%, transparent); }
}
.l1db[dir="rtl"] .l1db-prev svg,
.l1db[dir="rtl"] .l1db-next svg { transform: scaleX(-1); }
/* Pages: plain like the arrows (icon + word, tint on hover). */
.l1db .l1db-pages-btn { padding: 0 8px; }
.l1db-pages-btn svg { width: 16px; height: 16px; }
.l1db-bar .l1db-prev svg,
.l1db-bar .l1db-next svg { width: 18px; height: 18px; }
/* Share / download in the top bar: the same glass as the navigation bar -
   same fill, blur, edge, corners and control colour (all set by applyTheme). */
.l1db .l1db-top .l1db-chip-btn {
  height: 36px;
  min-width: 36px;
  border: var(--l1db-bar-line, 1px solid rgba(255, 255, 255, 0.75));
  border-radius: var(--l1db-bar-radius, 999px);
  background: rgba(255, 255, 255, 0.58);
  -webkit-backdrop-filter: blur(16px) saturate(170%);
  backdrop-filter: blur(16px) saturate(170%);
  color: var(--l1db-ctl, var(--l1db-ink));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  position: relative;
  isolation: isolate; /* the tint layer below sits over the glass, under the icon */
}
/* The hover tint is its own layer over the glass, faded exactly like Pages in
   the bar: background-color from transparent to --l1db-tint, 0.2s ease. A
   background-image gradient (and then an inset shadow) did not ease, so the
   share button snapped to its hover while Pages faded in. */
.l1db .l1db-top .l1db-chip-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-color: transparent;
  transition: background-color 0.2s ease;
  pointer-events: none;
  z-index: -1;
}
.l1db.on-dark .l1db-top .l1db-chip-btn {
  border: var(--l1db-bar-line, 1px solid rgba(255, 255, 255, 0.14));
  background: rgba(18, 18, 24, 0.42);
  color: var(--l1db-ctl, #fff);
}
@media (hover: hover) {
  .l1db .l1db-top .l1db-chip-btn:hover::after { background-color: var(--l1db-tint, rgba(44, 62, 80, 0.08)); }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .l1db .l1db-top .l1db-chip-btn { background: rgba(255, 255, 255, 0.92); }
  .l1db.on-dark .l1db-top .l1db-chip-btn { background: rgba(18, 18, 24, 0.85); }
}
.l1db-sep {
  flex: none;
  width: 1px;
  height: 20px;
  margin: 0 6px;
  background: currentColor;
  opacity: 0.15;
}
/* Page counter: plain text (no box, no hover); a click opens "go to page". */
.l1db-count {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 64px;
  height: 36px;
  padding: 0 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}
.l1db-count-text {
  font-variant-numeric: tabular-nums;
  /* "3–4 / 58" always reads left to right, Arabic digits included */
  direction: ltr;
  unicode-bidi: isolate;
}
.l1db-count svg { width: 12px; height: 12px; opacity: 0.6; }
.l1db-count.is-on { background: var(--l1db-tint); }
.l1db-slider {
  flex: none;
  width: 200px;
  height: 36px;
  margin: 0 6px;
  accent-color: currentColor;
  cursor: pointer;
  background: transparent;
}
.l1db-zoom-pct {
  flex: none;
  min-width: 44px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.l1db .l1db-text-btn { padding: 0 10px; height: 32px; font-size: 13px; font-weight: 600; }

/* Which controls show where. Default (wide inside a page): no ⋯.
   Compact (phone / the book inside a page): Pages, Prev, count, Next, ⋯. */
.l1db-more,
.l1db-side { display: none; }
.l1db.is-compact .l1db-bar { width: 100%; justify-content: space-between; gap: 0; }
.l1db.is-compact .l1db-slider,
.l1db.is-compact .l1db-sep,
.l1db.is-compact .l1db-zoom-out,
.l1db.is-compact .l1db-zoom-pct,
.l1db.is-compact .l1db-zoom-in,
.l1db.is-compact .l1db-fit,
.l1db.is-compact .l1db-sound,
.l1db.is-compact .l1db-full,
.l1db.is-compact .l1db-count svg { display: none; }
.l1db.is-compact .l1db-more { display: inline-flex; }
.l1db.is-compact .l1db-count { min-width: 0; padding: 0 2px; }
.l1db.is-compact .l1db-pages-btn { padding: 0 10px; font-size: 13px; }
.l1db.is-tiny .l1db-btn-text { display: none; }
.l1db.is-tiny .l1db-pages-btn { padding: 0; width: 34px; }
.l1db.is-compact .l1db-prev { margin-inline-start: auto; }
.l1db.is-compact .l1db-next { margin-inline-end: auto; }
/* Inside a page on a wider screen the slider takes the spare width. */
.l1db:not(.is-full):not(.is-compact) .l1db-slider { flex: 1 1 80px; width: auto; min-width: 80px; }
.l1db:not(.is-full):not(.is-compact) .l1db-bar { width: 100%; }

/* top bar: title, dates, share / download */
.l1db-top {
  display: none;
  align-items: flex-start; /* share stays level with the title, not the description */
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.l1db.has-top .l1db-top { display: flex; }
.l1db-top-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; text-align: start; } /* title, dates and description share one edge */
.l1db-title { font-size: 17px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.l1db-dates { font-size: 13px; opacity: 0.85; }
/* The owner description, under the title and dates. Line breaks kept; in
   full screen two lines at most, so the page keeps its room. */
.l1db-desc { margin-block-start: 4px; font-size: 14px; line-height: 1.5; opacity: 0.9; white-space: pre-line; overflow-wrap: anywhere; }
.l1db.is-full .l1db-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.l1db-top-act { display: flex; gap: 8px; flex: none; margin-inline-start: auto; }
/* No title or dates: only the buttons, at the inline end (full screen keeps
   its title, the book name). */
.l1db.no-title:not(.is-full) .l1db-top-text { display: none; }
.l1db-chip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 34px;
  height: 34px;
  padding: 0 12px;
  border: var(--l1db-bar-line, 0 solid transparent);
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.14);
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
@media (hover: hover) {
  .l1db-chip-btn:hover { background: rgba(127, 127, 127, 0.22); }
}
.l1db-chip-btn svg { width: 16px; height: 16px; }
/* Inside a page the top bar is small: icon-only buttons. */
.l1db:not(.is-full) .l1db-chip-btn { padding: 0; width: 36px; }
.l1db:not(.is-full) .l1db-chip-btn span { display: none; }
.l1db:not(.is-full) .l1db-dl { display: none; } /* download lives in the ⋯ menu */

/* section chips */
.l1db-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scrollbar-width: none;
}
.l1db-chips::-webkit-scrollbar { display: none; }
.l1db-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--l1db-line);
  border-radius: 10px;
  background: #fff;
  color: var(--l1db-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.3s ease;
}
.l1db-chip-num { font-size: 12px; font-weight: 400; opacity: 0.75; font-variant-numeric: tabular-nums; }
@media (hover: hover) {
  .l1db-chip:not([aria-current="true"]):hover { background: var(--l1db-soft); }
}
.l1db-chip[aria-current="true"] { background: var(--l1db-ink); color: #fff; border-color: var(--l1db-ink); }
.l1db-chip:focus-visible { outline: 2px solid var(--l1db-ink); outline-offset: 2px; }

/* pages panel (wide): spreads in a row, sections above */
.l1db { --l1db-thumb-h: 84px; }
@media (max-width: 480px) { .l1db { --l1db-thumb-h: 64px; } }
.l1db-thumbs {
  margin: 10px 0 0;
  padding: 14px 14px 6px;
  border: 1px solid var(--l1db-rule);
  border-radius: 20px;
  background: #fff;
  color: var(--l1db-ink);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
.l1db-thumbs[hidden] { display: none; }
/* Scroll arrows at the ends of a sideways row (page strip, section chips -
   P.scroller), over the row; each hidden while there is nothing more that way.
   .l1db-ext: the pages sheet lives outside the book. */
.l1db-scroller { position: relative; }
.l1db .l1db-strip-btn,
.l1db-ext .l1db-strip-btn {
  position: absolute;
  z-index: 2;
  top: calc(50% - 16px);
  width: 32px;
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--l1db-rule);
  background: #fff;
  color: var(--l1db-ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
/* page strip: centred on the thumbnails (their numbers sit below) */
.l1db .l1db-strip .l1db-strip-btn { top: calc(var(--l1db-thumb-h) / 2 - 12px); }
/* chips: centred on the 40px chips (the row pads 2px above, 10px below) */
.l1db-scroller.is-chips .l1db-strip-btn { top: 6px; }
.l1db .l1db-strip-btn[hidden],
.l1db-ext .l1db-strip-btn[hidden] { display: none; }
.l1db .l1db-strip-btn svg,
.l1db-ext .l1db-strip-btn svg { width: 16px; height: 16px; }
.l1db-strip-prev { inset-inline-start: 2px; }
.l1db-strip-next { inset-inline-end: 2px; }
.l1db[dir="rtl"] .l1db-strip-btn svg,
.l1db-ext[dir="rtl"] .l1db-strip-btn svg { transform: scaleX(-1); }
@media (hover: hover) {
  .l1db .l1db-strip-btn:hover,
  .l1db-ext .l1db-strip-btn:hover { background: var(--l1db-soft); }
}
.l1db-thumbs-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 6px 10px;
  scrollbar-width: thin;
  scrollbar-color: #c5c5c5 #f1f1f1;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.l1db-thumb {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
}
.l1db-thumb-pages {
  display: flex;
  height: var(--l1db-thumb-h);
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: outline-color 0.15s;
}
.l1db-thumb-page { display: block; height: 100%; overflow: hidden; background: var(--l1db-paper); }
.l1db-thumb-page img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.l1db-thumb-num {
  font-size: 11px;
  line-height: 1;
  color: var(--l1db-ink-2);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
}
.l1db-thumb:focus-visible { outline: none; }
.l1db-thumb[aria-current="true"] .l1db-thumb-pages,
.l1db-thumb:focus-visible .l1db-thumb-pages { outline-color: var(--l1db-ink); }
.l1db-thumb[aria-current="true"] .l1db-thumb-num { color: var(--l1db-ink); font-weight: 700; }
@media (hover: hover) {
  .l1db-thumb:not([aria-current="true"]):hover .l1db-thumb-pages { outline-color: var(--l1db-line); }
}

/* popovers: go to page, slider preview, tooltip */
.l1db-pop {
  position: absolute;
  z-index: 70;
  border: 1px solid var(--l1db-rule);
  border-radius: 12px;
  background: #fff;
  color: var(--l1db-ink);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
.l1db-pop[hidden],
.l1db-tip[hidden] { display: none; }
.l1db-goto { width: 240px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.l1db-goto-label { font-size: 14px; font-weight: 700; color: #333; }
.l1db-goto-row { display: flex; gap: 8px; }
/* Same field as the checkout form. */
.l1db-goto-input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--l1db-line);
  border-radius: 7px;
  background: #fff;
  color: #212529;
  font: inherit;
  font-size: 16px; /* 16px: no zoom-on-focus on iPhone */
  text-align: center;
}
.l1db-goto-input:focus { outline: none; border-color: var(--l1db-ink); box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.12); }
.l1db-goto-input.is-bad { border-color: #dc3545; box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.12); }
/* The cart primary button. */
.l1db-goto-go {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--l1db-ink);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.l1db-goto-go:focus-visible { outline: 2px solid var(--l1db-ink); outline-offset: 2px; }
.l1db-goto-hint { font-size: 12px; color: var(--l1db-ink-2); }
.l1db-preview { padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.l1db-preview-pages { display: flex; gap: 3px; padding: 4px; border-radius: 6px; background: var(--l1db-soft); }
.l1db-preview-pages img { display: block; height: 104px; width: auto; background: #fff; }
.l1db-preview-cap { font-size: 13px; font-weight: 700; white-space: nowrap; }
.l1db-tip {
  position: absolute;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 7px;
  background: var(--l1db-ink);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
}
.l1db-tip kbd {
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 5px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 12px;
}

/* full screen, controls hidden: thin progress line + page chip */
.l1db-idle { display: none; }

/* skeleton of the pill while the book loads */
.l1db-skel-bar { display: flex; justify-content: center; padding: 12px 0 6px; }
.l1db-skel-bar[hidden] { display: none; }
.l1db-skel-pill { width: 100%; max-width: 420px; height: 54px; border-radius: 20px; }

/* ===== full screen (native or CSS fallback) =====
   The own background of the page and text colour (applyTheme), top bar, the book
   with large arrows on both sides, a floating bar at the bottom. */
.l1db.is-full {
  max-width: none;
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  width: auto;
  margin: 0;
  background-color: var(--l1db-page-bg, #f8f9fa);
  background-image: var(--l1db-page-bgi, none);
  background-size: cover;
  color: var(--l1db-page-fg, #2C3E50);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.l1db.is-full .l1db-top {
  display: flex;
  margin: 0;
  padding: 16px 24px 8px;
  position: relative;
  z-index: 60;
  transition: opacity 0.3s ease;
}
.l1db.is-full .l1db-title { font-size: 20px; }
.l1db.is-full .l1db-stage {
  flex: 1;
  min-height: 0;
  gap: 20px;
  padding: 8px 16px 96px;
}
.l1db.is-full .l1db-bar {
  position: absolute;
  z-index: 60;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%;
  margin: 0;
  transform: translateX(-50%);
}
.l1db.is-full.is-compact .l1db-bar { left: 16px; right: 16px; width: auto; transform: none; }
.l1db.is-full .l1db-thumbs {
  position: absolute;
  z-index: 60;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  width: min(820px, calc(100% - 32px));
  margin: 0;
  transform: translateX(-50%);
}
/* Large previous / next beside the book. */
.l1db.is-full.is-wide .l1db-side {
  display: inline-flex;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border: var(--l1db-bar-line, 1px solid rgba(255, 255, 255, 0.75));
  border-radius: var(--l1db-bar-radius, 50%);
  background: rgba(255, 255, 255, 0.58);
  -webkit-backdrop-filter: blur(16px) saturate(170%);
  backdrop-filter: blur(16px) saturate(170%);
  color: var(--l1db-ctl, var(--l1db-ink));
  transition: opacity 0.3s ease, background-color 0.2s ease;
}
.l1db.on-dark.is-full.is-wide .l1db-side { background: rgba(18, 18, 24, 0.42); border: var(--l1db-bar-line, 1px solid rgba(255, 255, 255, 0.14)); color: var(--l1db-ctl, #fff); }
@media (hover: hover) {
  .l1db.is-full.is-wide .l1db-side:not(:disabled):hover { background-image: linear-gradient(var(--l1db-tint, rgba(44, 62, 80, 0.08)), var(--l1db-tint, rgba(44, 62, 80, 0.08))); }
}
.l1db.is-full.is-wide .l1db-side svg { width: 18px; height: 18px; }
.l1db[dir="rtl"] .l1db-side-prev svg,
.l1db[dir="rtl"] .l1db-side-next svg { transform: scaleX(-1); }

/* Auto-hide: everything fades, the line and the chip stay. */
.l1db.is-full.is-idle .l1db-bar,
.l1db.is-full.is-idle .l1db-top,
.l1db.is-full.is-idle .l1db-side { opacity: 0; pointer-events: none; }
.l1db.is-full.is-idle .l1db-bar { transform: translateX(-50%) translateY(12px); }
.l1db.is-full.is-idle { cursor: none; }
.l1db.is-full.is-idle .l1db-idle { display: block; }
.l1db-idle-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  z-index: 60;
  background: var(--l1db-rule);
}
.l1db-idle-line span {
  position: absolute;
  top: 0;
  bottom: 0;
  inset-inline-start: 0;
  background: var(--l1db-ink);
}
.l1db-idle-chip {
  position: absolute;
  z-index: 60;
  left: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  height: 28px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  border: 1px solid var(--l1db-rule);
  border-radius: 10px;
  background: var(--l1db-soft);
  color: var(--l1db-ink);
  font-size: 12px;
  font-weight: 700;
  direction: ltr;
  unicode-bidi: isolate;
}

/* Phone turned sideways: two pages fitted to the height, controls in a
   compact vertical bar on the left edge, no top bar. */
.l1db.is-full.is-land .l1db-top { display: none; }
.l1db.is-full.is-land .l1db-stage { padding: 8px 12px 8px 84px; }
.l1db.is-full.is-land .l1db-bar {
  left: 12px;
  right: auto;
  top: 50%;
  bottom: auto;
  width: auto;
  flex-direction: column;
  justify-content: center;
  transform: translateY(-50%);
}
.l1db.is-full.is-land .l1db-pages-btn { display: none; }
.l1db.is-full.is-land .l1db-prev,
.l1db.is-full.is-land .l1db-next { margin: 0; }
.l1db.is-full.is-land .l1db-count { min-width: 0; height: auto; padding: 4px 0; }
.l1db.is-full.is-land .l1db-count-text { height: auto; padding: 6px 8px; flex-direction: column; font-size: 12px; }
/* Vertical bar: previous points up, next points down, in both directions. */
.l1db.is-full.is-land .l1db-prev svg,
.l1db.is-full.is-land[dir="rtl"] .l1db-prev svg,
.l1db.is-full.is-land .l1db-next svg,
.l1db.is-full.is-land[dir="rtl"] .l1db-next svg { transform: rotate(90deg); }
/* Phone full screen: the top bar keeps the title room, share is an icon,
   download lives in the ⋯ menu. */
.l1db.is-full.is-compact .l1db-chip-btn { padding: 0; width: 36px; }
.l1db.is-full.is-compact .l1db-chip-btn span,
.l1db.is-full.is-compact .l1db-dl { display: none; }
.l1db.is-full.is-compact .l1db-top { padding: 14px 16px 6px; }
.l1db.is-full.is-compact .l1db-title { font-size: 17px; }
.l1db.is-zoomed .l1db-book { visibility: hidden; }

/* ===== sheets, toast (on <body>, or inside the book in full screen) =====
   The cart sheet: white, 20px top corners, a grey handle, a header with a
   bottom line and a round grey close button. */
.l1db-ext {
  position: fixed;
  inset: 0;
  z-index: 2147483002;
  pointer-events: none;
  color: var(--l1db-ink);
  -webkit-tap-highlight-color: transparent;
}
.l1db-ext *,
.l1db-ext *::before,
.l1db-ext *::after { box-sizing: border-box; }
.l1db-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: auto;
}
.l1db-backdrop.is-open { opacity: 1; }
.l1db-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 600px;
  max-height: 93vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 0 0 env(safe-area-inset-bottom);
  border-radius: 20px 20px 0 0;
  background: #fff;
  color: var(--l1db-ink);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  transform: translateY(100%);
  transition: transform 0.3s ease;
  pointer-events: auto;
  outline: none;
}
.l1db-sheet.is-open { transform: none; }
.l1db-sheet-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--l1db-rule);
}
.l1db-sheet-grip {
  position: absolute;
  top: 8px;
  left: 50%;
  width: 40px;
  height: 4px;
  margin-left: -20px;
  border-radius: 2px;
  background: #cdcdcd;
}
.l1db-sheet-title { margin: 0; font-size: 18px; font-weight: 700; color: #333; }
.l1db-ext .l1db-sheet-close {
  width: 32px;
  min-width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--l1db-soft);
  color: var(--l1db-ink-2);
  transition: all 0.3s ease;
}
.l1db-ext .l1db-sheet-close svg { width: 16px; height: 16px; }
@media (hover: hover) {
  .l1db-ext .l1db-sheet-close:hover { background: var(--l1db-hover); color: #495057; }
}
.l1db-sheet-close:focus-visible { outline: 2px solid var(--l1db-ink); outline-offset: 2px; }
.l1db-sheet-body {
  overflow-y: auto;
  min-height: 0;
  padding: 12px 20px 20px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #c5c5c5 #f1f1f1;
}
.l1db-sheet-chips { padding-top: 0; }
.l1db-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 12px;
  padding: 4px 2px 8px;
}
.l1db-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--l1db-ink-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.l1db-cell-page {
  display: block;
  width: 100%;
  overflow: hidden;
  border: 2px solid var(--l1db-rule);
  border-radius: 8px;
  background: var(--l1db-paper, #fff);
}
.l1db-cell-page img { display: block; width: 100%; height: 100%; object-fit: contain; }
.l1db-cell-num { font-variant-numeric: tabular-nums; }
.l1db-cell[aria-current="true"] .l1db-cell-page { border-color: var(--l1db-ink); }
.l1db-cell[aria-current="true"] { color: var(--l1db-ink); font-weight: 700; }
.l1db-cell:focus-visible { outline: 2px solid var(--l1db-ink); outline-offset: 2px; border-radius: 8px; }
/* ⋯ rows: the cart summary rows (thin #e9ecef lines, #2C3E50 text). */
.l1db-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  margin: 0;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--l1db-rule);
  background: transparent;
  color: var(--l1db-ink);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.l1db-row:last-child { border-bottom: 0; }
div.l1db-row { cursor: default; }
.l1db-row:focus-visible { outline: 2px solid var(--l1db-ink); outline-offset: 2px; border-radius: 8px; }
.l1db-row-ico {
  flex: none;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--l1db-soft);
  color: var(--l1db-ink);
}
.l1db-row-ico svg { width: 16px; height: 16px; }
.l1db-row-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.l1db-row-title { font-size: 14px; font-weight: 600; }
.l1db-row-sub { font-size: 12px; color: var(--l1db-ink-2); }
/* Zoom stepper: the cart quantity controls (28px round, #f8f9fa, #dee2e6). */
.l1db-stepper { flex: none; display: flex; align-items: center; gap: 8px; }
.l1db-ext .l1db-step {
  width: 28px;
  min-width: 28px;
  height: 28px;
  border: 1px solid #dee2e6;
  border-radius: 50%;
  background: var(--l1db-soft);
  color: #495057;
  transition: all 0.3s ease;
}
.l1db-ext .l1db-step svg { width: 14px; height: 14px; }
@media (hover: hover) {
  .l1db-ext .l1db-step:not(:disabled):hover { background: var(--l1db-hover); border-color: #adb5bd; }
}
.l1db-ext .l1db-step:disabled { opacity: 0.5; }
.l1db-step:focus-visible { outline: 2px solid var(--l1db-ink); outline-offset: 1px; }
.l1db-step-pct { min-width: 44px; text-align: center; font-size: 14px; font-weight: 600; color: #333; font-variant-numeric: tabular-nums; }
.l1db-switch {
  flex: none;
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #dee2e6;
  transition: background 0.3s ease;
}
.l1db-switch span {
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: inset-inline-start 0.3s ease;
}
.l1db-row[aria-checked="true"] .l1db-switch { background: var(--l1db-ink); }
.l1db-row[aria-checked="true"] .l1db-switch span { inset-inline-start: 22px; }
.l1db-toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(96px + env(safe-area-inset-bottom));
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--l1db-ink);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.l1db-toast.is-on { opacity: 1; transform: none; }
.l1db-toast svg { color: #8ce99a; }

@media (prefers-reduced-motion: reduce) {
  .l1db-bar,
  .l1db-top,
  .l1db-side,
  .l1db-backdrop,
  .l1db-sheet,
  .l1db-toast { transition: none; }
}

/* zoom layer (lives on <body>) */
.l1db-zoom {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  overflow: hidden;
  background: rgba(15, 15, 17, 0);
  touch-action: none;
  cursor: grab;
  outline: none;
  transition: background 0.2s;
}
.l1db-zoom.is-open { background: rgba(15, 15, 17, 0.92); }
.l1db-zoom:active { cursor: grabbing; }
.l1db-zoom-inner {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.l1db-zoom-inner.is-animating { transition: transform 0.2s ease-out; }
.l1db-zoom-page {
  position: absolute;
  background: #fff;
}
.l1db-zoom-page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}
.l1db-zoom .l1db-zoom-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s;
}
.l1db-zoom.is-open .l1db-zoom-close { opacity: 1; }
/* Full screen: the zoom layer is inside the book, under its pill (which keeps
   − % + and fit on screen); the top bar steps aside. */
.l1db.is-full > .l1db-zoom { z-index: 40; }
.l1db.is-full.is-zoomed .l1db-top { opacity: 0; pointer-events: none; }
/* Inside a page: the own − % + bar of the layer. */
.l1db-zoom-bar {
  position: absolute;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border: 1px solid #e9ecef;
  border-radius: 20px;
  background: #f8f9fa;
  color: #2C3E50;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transform: translateX(-50%);
}
@media (hover: hover) {
  .l1db-zoom-bar .l1db-btn:not(:disabled):hover { background: #e9ecef; }
}
.l1db-zoom-bar .l1db-btn:focus-visible { outline: 2px solid #2C3E50; outline-offset: 1px; }
.l1db-zoom-bar-pct { min-width: 52px; text-align: center; font-size: 14px; font-weight: 600; color: #333; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .l1db-zoom-inner.is-animating,
  .l1db-zoom,
  .l1db-zoom-close { transition: none; }
}
