/* =============================================
   BROCHURE VIEWER — دورتك
   Mobile-first, RTL. Sits under the shared v2
   app-header + breadcrumb, which stay untouched.
============================================= */

.brc-main {
  background: var(--bg);
  padding-bottom: calc(var(--bnav-h) + 18px);
}
.brc-main:has(.app-footer-custom) { padding-bottom: 0; }

/* ── Breadcrumb ───────────────────────────── */
.brc-crumb {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
}
.brc-crumb .breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  max-width: var(--max-w);
  margin: 0 auto;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.brc-crumb .breadcrumb-item { display: flex; align-items: center; gap: 6px; }
.brc-crumb .breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  color: var(--text-light);
}
.brc-crumb a { color: var(--text-muted); font-weight: 600; transition: color 0.2s ease; }
.brc-crumb a:hover { color: var(--green); }
.brc-crumb .breadcrumb-item.active { color: var(--text); font-weight: 700; }
.brc-crumb .breadcrumb-home-icon { font-size: 0.85rem; color: var(--green); }

/* ═══════════════════════════════════════════
   TOOLBAR
═══════════════════════════════════════════ */
.brc-toolbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.brc-toolbar-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brc-tb-id {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brc-tb-logo {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  overflow: hidden;
}
.brc-tb-logo img { max-width: 100%; max-height: 100%; width: auto; object-fit: contain; }

.brc-tb-text { min-width: 0; }
.brc-tb-titleline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.brc-tb-title {
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brc-tb-badge {
  flex: none;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 0.66rem;
  font-weight: 800;
  white-space: nowrap;
}
.brc-tb-badge.is-live    { background: var(--yellow); color: #4a3b00; }
.brc-tb-badge.is-soon    { background: var(--green-bg); color: var(--green); }
.brc-tb-badge.is-expired { background: #fdecec; color: var(--red); }

.brc-tb-date {
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.brc-tb-date i { color: var(--green); font-size: 0.72rem; }

/* Tools */
.brc-tb-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.brc-tb-tools > :not(.brc-lang) { display: none; }
.brc-tb-group { display: flex; align-items: center; gap: 4px; }
.brc-tb-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 2px;
}

.brc-counter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  /* Latin digits must not reorder inside the RTL run. */
  direction: ltr;
  unicode-bidi: isolate;
}
.brc-counter strong { font-size: 0.88rem; color: var(--text); }
.brc-counter-sep { color: var(--text-light); }

.brc-tool {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.brc-tool:hover { background: var(--green-bg); color: var(--green); }

.brc-lang {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--green);
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  transition: background 0.2s ease, color 0.2s ease;
}
.brc-lang:hover { background: var(--green); color: #fff; }
.brc-lang-long { display: none; }

/* ═══════════════════════════════════════════
   THUMBNAIL RAIL
═══════════════════════════════════════════ */
/* Page bar: one card under the image holding the thumbnail rail and,
   on mobile, the page controls that used to float in a separate bar. */
.brc-rail-wrap {
  margin-top: 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.brc-rail-row {
  position: relative;
  padding: 12px 0 10px;
}
.brc-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: 0 44px;
}
.brc-rail::-webkit-scrollbar { display: none; }

.brc-rail-item {
  flex: none;
  width: 52px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.brc-rail-img {
  display: block;
  width: 100%;
  height: 62px;
  border-radius: 6px;
  border: 2px solid transparent;
  background: var(--bg);
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.brc-rail-img img { width: 100%; height: 100%; object-fit: cover; }
.brc-rail-item:hover .brc-rail-img { transform: translateY(-2px); }
.brc-rail-item.active .brc-rail-img {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(17, 147, 74, 0.18);
}
.brc-rail-num {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--text-light);
}
.brc-rail-item.active .brc-rail-num { color: var(--green); }

.brc-rail-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.brc-rail-arrow:hover { background: var(--green); color: #fff; border-color: var(--green); }
.brc-rail-prev { right: 8px; }
.brc-rail-next { left: 8px; }

/* ═══════════════════════════════════════════
   ACTIVE TAG BAR
   Appears after a tag is chosen, so a tag spanning
   several pages can be stepped through.
═══════════════════════════════════════════ */
.brc-tagbar {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 9px 14px;
  background: var(--yellow-bg);
  border-bottom: 1px solid #f6e7a8;
}
.brc-tagbar[hidden] { display: none; }

.brc-tagbar-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--yellow);
  color: #4a3b00;
  font-size: 0.78rem;
  font-weight: 800;
  max-width: 55%;
}
.brc-tagbar-chip span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brc-tagbar-chip i { font-size: 0.7rem; }

.brc-tagbar-pos {
  font-size: 0.76rem;
  font-weight: 700;
  color: #7a6420;
  direction: ltr;
  unicode-bidi: isolate;
}
.brc-tagbar-pos strong { color: #4a3b00; }

.brc-tagbar-btn {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  border: none;
  color: #6b5614;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.brc-tagbar-btn:hover { background: #fff; color: #3d3109; }
.brc-tagbar-btn:disabled { opacity: 0.35; pointer-events: none; }
.brc-tagbar-clear { margin-inline-start: auto; }
.brc-tagbar-clear:hover { background: var(--red); color: #fff; }

/* ═══════════════════════════════════════════
   BODY — stage + sections
═══════════════════════════════════════════ */
.brc-body {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.brc-stage-col { flex: 1 1 auto; min-width: 0; }

.brc-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 340px;
}

/* The track shows the active page centred, with its neighbours peeking
   in dimmed at the edges — the "spread" feel of the reference. */
.brc-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}
.brc-slide {
  display: none;
  flex: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.brc-slide.active {
  display: flex;
  justify-content: center;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  animation: brcFade 0.28s ease;
}
.brc-slide.peek { display: none; }

@keyframes brcFade {
  from { opacity: 0; transform: scale(0.985); }
  to   { opacity: 1; transform: scale(1); }
}

.brc-page-img {
  display: block;
  /* Height-capped so the page fits the screen and the thumbnail rail
     below it stays within reach instead of a full page-length scroll. */
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 58vh;
  margin: 0 auto;
  object-fit: contain;
  border-radius: var(--r-md);
  background: var(--white);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  cursor: zoom-in;
}

.brc-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.brc-nav:hover { background: var(--green); color: #fff; }
.brc-nav:disabled { opacity: 0.35; pointer-events: none; }
.brc-nav-prev { right: 2px; }
.brc-nav-next { left: 2px; }

/* ═══════════════════════════════════════════
   SECTIONS PANEL
   Mobile: bottom sheet. Desktop: sidebar card.
═══════════════════════════════════════════ */
/* Centred modal — it belongs to the sections button, not to the screen edge. */
.brc-sections {
  position: fixed;
  inset: 0;
  margin: auto;
  z-index: 320;
  width: min(440px, calc(100vw - 32px));
  height: fit-content;
  max-height: min(68vh, 560px);
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-radius: var(--r-xl);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.95) translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s linear 0.22s;
}
.brc-sections.open {
  opacity: 1;
  visibility: visible;
  transform: scale(1) translateY(0);
  transition-delay: 0s;
}

.brc-sections-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px 4px;
}
.brc-sections-title {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--text);
  padding-bottom: 8px;
}
.brc-sections-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  inset-inline-start: 0;
  width: 44px;
  height: 3px;
  border-radius: var(--r-pill);
  background: var(--green);
}
.brc-sections-count {
  padding: 2px 10px;
  border-radius: var(--r-pill);
  background: var(--green-bg);
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 800;
}
.brc-sections-close {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  border: none;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.brc-sections-close:hover { background: var(--red); color: #fff; }

.brc-sections-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 18px 6px;
  padding: 0 14px;
  height: 44px;
  border-radius: var(--r-lg);
  background: var(--bg);
  border: 1px solid transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.brc-sections-search:focus-within { border-color: var(--green-mid); background: var(--white); }
.brc-sections-search i { color: var(--text-light); font-size: 0.85rem; }
.brc-sections-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font);
  font-size: 0.85rem;
  color: var(--text);
}
.brc-sections-search input::-webkit-search-cancel-button { display: none; }

.brc-sections-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 4px 12px 16px;
}
.brc-sections-list,
.brc-tags-list { list-style: none; }

.brc-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 14px 6px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--text-light);
}
.brc-group-head:first-child { margin-top: 4px; }
.brc-group-head[hidden] { display: none; }
.brc-group-count {
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.66rem;
}

/* ── Page results (surfaced by a tag match) ── */
.brc-pageres-list { list-style: none; }
.brc-pageres {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border: none;
  border-radius: var(--r-md);
  background: transparent;
  cursor: pointer;
  text-align: start;
  transition: background 0.18s ease;
}
.brc-pageres:hover { background: var(--bg); }
.brc-pageres.is-current { background: var(--green-bg); }

.brc-pageres-thumb {
  flex: none;
  width: 38px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
}
.brc-pageres-thumb img { width: 100%; height: 100%; object-fit: cover; }

.brc-pageres-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.brc-pageres-page { font-size: 0.84rem; font-weight: 800; color: var(--text); }
.brc-pageres-tags {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brc-pageres-go { flex: none; font-size: 0.7rem; color: var(--text-light); }
.brc-pageres:hover .brc-pageres-go { color: var(--green); }

/* ── Section rows ─────────────────────────── */
.brc-section-item {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: none;
  border-radius: var(--r-md);
  background: transparent;
  cursor: pointer;
  text-align: start;
  transition: background 0.18s ease;
}
.brc-section-item + .brc-section-item { margin-top: 2px; }
.brc-section-item:hover { background: var(--bg); }

.brc-section-item.active { background: var(--green-bg); }
/* Accent on the inline-start edge, so it flips correctly in LTR. */
.brc-section-item.active::before {
  content: "";
  position: absolute;
  inset-block: 9px;
  inset-inline-start: 0;
  width: 3px;
  border-radius: var(--r-pill);
  background: var(--green);
}

/* Colour swatch, ringed so pale category colours still read on white. */
.brc-section-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

.brc-section-name {
  flex: 1;
  min-width: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brc-section-item.active .brc-section-name { color: var(--green); font-weight: 800; }

/* The range is metadata: a quiet pill keeps it from running into the name. */
.brc-section-pages {
  flex: none;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--bg);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.brc-section-item:hover .brc-section-pages { background: var(--white); }
.brc-section-item.active .brc-section-pages { background: var(--white); color: var(--green); }

.brc-sections-empty {
  padding: 18px;
  text-align: center;
  font-size: 0.84rem;
  color: var(--text-muted);
}

/* Scrim behind the mobile sheet */
.brc-scrim {
  position: fixed;
  inset: 0;
  z-index: 310;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.brc-scrim.open { opacity: 1; }

/* ═══════════════════════════════════════════
   PAGE CONTROLS (inside the page bar)
═══════════════════════════════════════════ */
.brc-railbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, #fbfdfc 0%, var(--white) 100%);
}
.brc-railbar-spacer { flex: 1; }

/* Sections trigger: a single control that shows the current section and
   opens the picker. Reads as a dropdown rather than a floating button. */
.brc-sec-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--white);
  cursor: pointer;
  text-align: start;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.brc-sec-trigger:hover,
.brc-sec-trigger[aria-expanded="true"] {
  border-color: var(--green-mid);
  background: var(--green-bg);
  box-shadow: var(--shadow-xs);
}
.brc-sec-trigger-icon {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--green-bg);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.86rem;
}
.brc-sec-trigger:hover .brc-sec-trigger-icon { background: var(--white); }

.brc-sec-trigger-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.28;
  min-width: 0;
}
.brc-sec-trigger-label { font-size: 0.64rem; font-weight: 600; color: var(--text-light); }
.brc-sec-trigger-name {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text);
  max-width: 128px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brc-sec-trigger-caret {
  flex: none;
  font-size: 0.68rem;
  color: var(--text-light);
  transition: transform 0.22s ease;
}
.brc-sec-trigger[aria-expanded="true"] .brc-sec-trigger-caret { transform: rotate(180deg); }

.brc-railbar-icon {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.brc-railbar-icon:hover { background: var(--green-bg); color: var(--green); }

.brc-counter-mo { padding: 5px 12px; font-size: 0.76rem; }

/* ═══════════════════════════════════════════
   ZOOM VIEWER
═══════════════════════════════════════════ */
.brc-zoom {
  position: fixed;
  inset: 0;
  z-index: 430;
  display: flex;
  flex-direction: column;
  background: rgba(8, 15, 11, 0.97);
  overscroll-behavior: contain;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.brc-zoom.is-open { opacity: 1; }
.brc-zoom[hidden] { display: none; }

.brc-zoom-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
}
.brc-zoom-counter {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.72);
}
.brc-zoom-counter strong { color: #fff; }

.brc-zoom-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.1);
}
.brc-zoom-tool {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.brc-zoom-tool:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.brc-zoom-tool:disabled { opacity: 0.35; pointer-events: none; }

.brc-zoom-level {
  min-width: 54px;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 800;
  color: #fff;
  direction: ltr;
  unicode-bidi: isolate;
}

.brc-zoom-close {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s ease;
}
.brc-zoom-close:hover { background: var(--red); }

/* touch-action:none so pinch and drag reach the handlers instead of
   being swallowed by the browser's own scroll/zoom. */
.brc-zoom-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  cursor: zoom-in;
}
.brc-zoom-stage.is-zoomed { cursor: grab; }
.brc-zoom-stage.is-panning { cursor: grabbing; }

#brcZoomImg {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}
/* Applied for button, double-tap and wheel zooming; deliberately absent while
   pinching or panning, where the image must track the fingers 1:1. */
#brcZoomImg.is-smooth {
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Solid and ringed: these sit over the page itself, which is usually white,
   so a translucent light fill would disappear against it. */
.brc-zoom-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(14, 22, 18, 0.78);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}
.brc-zoom-nav:hover {
  background: var(--green);
  border-color: var(--green-light);
  transform: translateY(-50%) scale(1.06);
}
.brc-zoom-nav:disabled { opacity: 0.3; pointer-events: none; }
.brc-zoom-prev { right: 12px; }
.brc-zoom-next { left: 12px; }

.brc-zoom-hint {
  position: absolute;
  inset-inline: 0;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  margin: 0 auto;
  width: fit-content;
  max-width: calc(100% - 32px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.74rem;
  font-weight: 600;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.brc-zoom-hint.is-hidden { opacity: 0; }

@media (min-width: 1024px) {
  .brc-zoom-bar { padding: 14px 20px; }
  .brc-zoom-nav { width: 52px; height: 52px; }
  .brc-zoom-prev { right: 20px; }
  .brc-zoom-next { left: 20px; }
}

/* ═══════════════════════════════════════════
   ALL-PAGES GRID
═══════════════════════════════════════════ */
.brc-grid-overlay {
  position: fixed;
  inset: 0;
  z-index: 420;
  background: rgba(10, 18, 14, 0.96);
  display: flex;
  flex-direction: column;
}
/* A class-level `display` outranks the UA rule for [hidden]. */
.brc-grid-overlay[hidden] { display: none; }
.brc-grid-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.brc-grid-head h2 { font-size: 1rem; font-weight: 800; }
.brc-grid-head h2 span {
  margin-inline-start: 8px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.14);
  font-size: 0.74rem;
}
.brc-grid-close {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s ease;
}
.brc-grid-close:hover { background: var(--red); }

.brc-grid-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
  padding: 16px 18px calc(24px + env(safe-area-inset-bottom, 0px));
}
.brc-grid-item {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.brc-grid-item img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid transparent;
  background: #fff;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.brc-grid-item:hover img { transform: translateY(-3px); border-color: var(--green-light); }
.brc-grid-item.active img { border-color: var(--green); }
.brc-grid-item span { font-size: 0.72rem; font-weight: 700; color: rgba(255, 255, 255, 0.75); }

/* ═══════════════════════════════════════════
   SECTIONS (offers + related) — unchanged
═══════════════════════════════════════════ */
/* A rounded white card, same treatment as the viewer's page bar above it —
   `width: min()` gives side gutters on narrow screens and centres on wide ones,
   which plain `max-width + margin auto` cannot do on its own. */
.brc-section {
  width: min(var(--max-w), calc(100% - 28px));
  margin: 12px auto 0;
  padding: 16px 14px 18px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xs);
}
/* Keep a sliver of page showing before the footer. */
.brc-main > .brc-section:last-of-type { margin-bottom: 14px; }

.brc-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.brc-section-title {
  position: relative;
  padding-inline-start: 12px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.brc-section-title::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 18px;
  border-radius: var(--r-pill);
  background: var(--green);
}

.brc-section-hint { font-size: 0.75rem; color: var(--text-muted); }

/* ── Page offers ──────────────────────────── */
.brc-offers { display: none; }

.brc-offers.active {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.brc-offer-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.brc-offer-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.brc-offer-img {
  position: relative;
  height: 118px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 1.6rem;
}

.brc-offer-img img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }

.brc-offer-badge {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--red);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
}

.brc-offer-body { padding: 10px; }

.brc-offer-title {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
}

.brc-offer-prices {
  margin-top: 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.brc-price-now { font-size: 0.9rem; font-weight: 900; color: var(--green); }

.brc-price-was {
  font-size: 0.75rem;
  color: var(--text-light);
  text-decoration: line-through;
}

.brc-offers-empty {
  grid-column: 1 / -1;
  padding: 24px 16px;
  text-align: center;
  background: var(--white);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  color: var(--text-muted);
}

.brc-offers-empty i { font-size: 1.4rem; color: var(--text-light); }
.brc-offers-empty p { margin-top: 8px; font-size: 0.82rem; }

.brc-offers-more {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--green-bg);
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 700;
}

/* ── Related brochures ────────────────────── */
.brc-section-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--green-mid);
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.brc-section-link:hover { background: var(--green-bg); border-color: var(--green); }
.brc-section-link i { font-size: 0.68rem; }

.brc-related {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 14px;
}

.brc-related-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: transform 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
}
.brc-related-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.14);
  border-color: var(--green-mid);
}

/* A fixed ratio keeps a row of covers aligned whatever their source size. */
.brc-related-img {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--bg);
  overflow: hidden;
}
.brc-related-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.brc-related-card:hover .brc-related-img img { transform: scale(1.05); }

/* Scrim under the badges so they stay legible on a busy cover. */
.brc-related-img::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 58%;
  background: linear-gradient(180deg, rgba(10, 16, 13, 0.42) 0%, rgba(10, 16, 13, 0) 100%);
  pointer-events: none;
}

.brc-related-pages,
.brc-related-urgent {
  position: absolute;
  top: 8px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  font-size: 0.68rem;
  font-weight: 800;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.brc-related-pages {
  inset-inline-end: 8px;
  background: rgba(10, 16, 13, 0.55);
  color: #fff;
}
.brc-related-urgent {
  inset-inline-start: 8px;
  background: rgba(229, 57, 53, 0.92);
  color: #fff;
}

/* Reveals on hover — a clear affordance that the cover opens the viewer. */
.brc-related-open {
  position: absolute;
  inset-inline: 10px;
  bottom: 10px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.95);
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}
.brc-related-card:hover .brc-related-open { opacity: 1; transform: translateY(0); }

.brc-related-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 11px 12px 12px;
}

.brc-related-store {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--green);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brc-related-store i { font-size: 0.64rem; opacity: 0.8; }

.brc-related-title {
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.5;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* The date is reference information, so it sits quietly in its own chip. */
.brc-related-date {
  align-self: flex-start;
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  background: var(--bg);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.brc-related-date i { font-size: 0.65rem; color: var(--text-light); }

/* ── Brochures listing grid ───────────────── */
.brochures-count {
  padding: 4px 11px;
  border-radius: var(--r-pill);
  background: var(--green-bg);
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

/* The category page slides these cards sideways; the listing shows them all. */
.brochures-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  padding: 0 14px 4px;
}
.brochures-grid .brochure-card {
  min-width: 0;
  max-width: none;
  width: 100%;
}
.brochures-grid .brochure-cover { position: relative; }
.brochure-pages {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
}
.brochures-grid .brochure-date {
  display: flex;
  align-items: center;
  gap: 6px;
}

@media (min-width: 768px) {
  .brochures-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; padding: 0 20px 4px; }
}

/* ── Related brochures: empty state ───────── */
.brc-related-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 30px 20px 32px;
  background: linear-gradient(180deg, #fbfdfc 0%, var(--green-bg) 160%);
  border: 1px dashed var(--green-mid);
  border-radius: var(--r-xl);
}
.brc-related-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--green-bg);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  margin-bottom: 14px;
}
.brc-related-empty h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}
.brc-related-empty p {
  max-width: 420px;
  font-size: 0.83rem;
  line-height: 1.85;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.brc-related-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.brc-btn-soft {
  background: var(--white);
  color: var(--green);
  border: 1.5px solid var(--green-mid);
}
.brc-btn-soft:hover { background: var(--green-bg); border-color: var(--green); }

/* ── Empty state ──────────────────────────── */
.brc-empty {
  max-width: var(--max-w);
  margin: 22px auto;
  padding: 40px 20px;
  text-align: center;
  background: var(--white);
  border: 1px dashed var(--border);
  border-radius: var(--r-lg);
}

.brc-empty i { font-size: 2.2rem; color: var(--text-light); }
.brc-empty h3 { margin-top: 12px; font-size: 1rem; font-weight: 800; }
.brc-empty p { margin: 6px 0 16px; font-size: 0.85rem; color: var(--text-muted); }

.brc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--r-pill);
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}
.brc-btn:hover { transform: translateY(-2px); }
.brc-btn-primary { background: var(--green); color: #fff; }

/* ═══════════════════════════════════════════
   TABLET
═══════════════════════════════════════════ */
@media (min-width: 600px) {
  .brc-rail-item { width: 62px; }
  .brc-rail-img { height: 76px; }
  .brc-offers.active { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
  .brc-related { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .brc-grid-body { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ═══════════════════════════════════════════
   DESKTOP — sidebar instead of bottom sheet
═══════════════════════════════════════════ */
@media (min-width: 1024px) {
  .brc-toolbar-inner { padding: 12px 20px; }
  .brc-tb-logo { width: 44px; height: 44px; }
  .brc-tb-title { font-size: 1.12rem; }
  .brc-tb-date { font-size: 0.78rem; }
  .brc-tb-tools > :not(.brc-lang) { display: flex; }
  .brc-tool { width: 38px; height: 38px; font-size: 0.95rem; }
  .brc-tb-sep { display: block; }
  .brc-lang-long { display: inline; }
  .brc-lang-short { display: none; }

  .brc-rail-wrap { margin-top: 18px; }
  .brc-rail-row { padding: 14px 0 12px; }
  .brc-rail { padding: 0 52px; gap: 10px; }
  .brc-rail-item { width: 74px; }
  .brc-rail-img { height: 92px; }
  .brc-rail-arrow { width: 38px; height: 38px; }

  .brc-body { padding: 18px 20px 26px; gap: 20px; }
  .brc-stage { min-height: 560px; }
  .brc-page-img { width: auto; height: auto; max-height: 76vh; max-width: 100%; margin: 0 auto; }
  /* Source order keeps the pages first; visually the panel leads. */
  .brc-sections { order: -1; }
  .brc-nav { width: 52px; height: 52px; font-size: 1rem; }
  .brc-nav-prev { right: -8px; }
  .brc-nav-next { left: -8px; }

  /* Neighbouring pages peek in, dimmed, either side of the active one. */
  .brc-slide.peek {
    display: block;
    width: 150px;
    opacity: 0.45;
    filter: grayscale(0.35);
    cursor: pointer;
  }
  .brc-slide.peek:hover { opacity: 0.7; }
  .brc-slide.peek .brc-page-img {
    max-height: 420px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.1);
    transform: none;
  }

  /* Panel becomes a static sidebar card. */
  .brc-sections {
    position: sticky;
    inset: auto;
    top: calc(var(--header-h) + 14px);
    margin: 0;
    z-index: 1;
    flex: none;
    width: 320px;
    height: auto;
    max-height: calc(100vh - var(--header-h) - 40px);
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
    border-radius: var(--r-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding-bottom: 6px;
  }
  .brc-sections-close { display: none; }
  .brc-sections-head { padding: 16px 18px 4px; }

  /* Mobile-only chrome: these controls are already in the top toolbar,
     and the sections panel is a permanent sidebar here. */
  .brc-railbar,
  .brc-scrim { display: none !important; }

  .brc-section {
    width: min(var(--max-w), calc(100% - 40px));
    margin-top: 16px;
    padding: 22px 22px 24px;
  }
  .brc-main > .brc-section:last-of-type { margin-bottom: 20px; }

  /* No sections and no tags: the stage takes the whole row. */
  .brc-body:not(:has(.brc-sections)) .brc-stage-col { width: 100%; }
}

/* ═══════════════════════════════════════════
   FULLSCREEN
═══════════════════════════════════════════ */
.brc-viewer:fullscreen { background: var(--bg); overflow-y: auto; }
.brc-viewer:fullscreen .brc-page-img { max-height: 84vh; }

/* ═══════════════════════════════════════════
   MOTION
═══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .brc-sections { transition: none; }
  .brc-slide.active { animation: none; }
  .brc-btn:hover,
  .brc-offer-card:hover,
  .brc-related-card:hover,
  .brc-grid-item:hover img { transform: none; }
  .brc-related-card:hover .brc-related-img img { transform: none; }
  .brc-related-open { opacity: 1; transform: none; }
  .brc-sections,
  .brc-sections.open { transition: opacity 0.2s ease, visibility 0s linear 0.2s; transform: none; }
  #brcZoomImg.is-smooth { transition: none; }
  .brc-zoom-nav:hover { transform: translateY(-50%); }
  .brc-sec-trigger-caret { transition: none; }
}
