/* ─────────────────────────────────────────────────────────────
   Brochure viewer: page-image reader inside the project modal
   Gold #C5A059 · Cormorant Garamond (numbers) · Montserrat (labels)
   ───────────────────────────────────────────────────────────── */

/* Modal while a brochure is showing: wider box, bigger media column */
.modal-media-col.is-brochure,
.modal-media-col.has-film { display: block; }
.modal-media-col.is-brochure { aspect-ratio: auto; }
.modal-media-col.is-brochure > .bg-gradient-to-r,
.modal-media-col.is-brochure > .bg-gradient-to-t { display: none; }
@media (min-width: 768px) {
  #modal-container.has-brochure { width: min(90vw, 1400px); max-width: 1400px; }
  #modal-container.has-brochure .modal-media-col.is-brochure { width: 64%; min-height: 540px; }
}

.bv {
  --r: 1.7778;          /* page ratio (width / height); set per page */
  --r-stage: 1.7778;    /* phone stage shape, from the first page */
  --r-film: 1.7778;
  --padx: 24px;
  --pady: 4px;
  --thumb-h: 50px;
  position: absolute; inset: 0; z-index: 15;
  display: flex; flex-direction: column;
  background: #0b0b0b;
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* Top bar */
.bv-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px 10px 24px;
  flex: none; position: relative; z-index: 4;
}
.bv-meta { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.bv-label {
  font-size: 9px; letter-spacing: .32em; text-transform: uppercase;
  color: rgba(255,255,255,.45); white-space: nowrap;
}
.bv-count {
  font-family: 'Cormorant Garamond', serif; font-size: 22px; line-height: 1;
  color: #C5A059; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.bv-count i { font-style: normal; color: rgba(255,255,255,.25); margin: 0 6px; font-size: 18px; }
.bv-count .bv-total { color: rgba(255,255,255,.45); font-size: 17px; }
.bv-hint { display: none; font-size: 9px; letter-spacing: .2em; text-transform: uppercase; color: rgba(255,255,255,.32); white-space: nowrap; }
.bv-hint--always { display: inline; }

/* Film | Brochure switch */
.bv-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; border: 1px solid rgba(255,255,255,.12); background: rgba(0,0,0,.45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); align-self: center; }
.bv-tab {
  border: 0; background: transparent; cursor: pointer;
  padding: 7px 14px; border-radius: 999px;
  font: 500 9px 'Montserrat', sans-serif; letter-spacing: .26em; text-transform: uppercase;
  color: rgba(255,255,255,.55); transition: color .3s, background .3s;
}
.bv-tab:hover { color: #fff; }
.bv-tab.is-active { background: #C5A059; color: #0a0a0a; }

.bv-btn {
  width: 34px; height: 34px; border-radius: 999px; flex: none;
  display: inline-grid; place-items: center;
  border: 1px solid rgba(255,255,255,.14); background: rgba(0,0,0,.35);
  color: rgba(255,255,255,.75); cursor: pointer;
  transition: border-color .3s, color .3s, background .3s, box-shadow .3s;
}
.bv-btn:hover { border-color: #C5A059; color: #C5A059; box-shadow: 0 0 18px rgba(197,160,89,.18); }
.bv-btn:focus-visible, .bv-nav:focus-visible, .bv-thumb:focus-visible, .bv-tab:focus-visible { outline: 1px solid #C5A059; outline-offset: 2px; }

/* Stage + horizontally snapping track */
.bv-stage { position: relative; flex: 1; min-height: 0; }
.bv-track {
  position: absolute; inset: 0;
  display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; outline: none;
}
.bv-track::-webkit-scrollbar { display: none; }
.bv-slide {
  position: relative; flex: 0 0 100%; height: 100%;
  scroll-snap-align: center; scroll-snap-stop: always;
  display: flex; align-items: center; justify-content: center;
  container-type: size;
}
.bv-page {
  position: relative; overflow: hidden; border-radius: 3px;
  width:  min(100cqw - var(--padx) * 2, (100cqh - var(--pady) * 2) * var(--r));
  height: min(100cqh - var(--pady) * 2, (100cqw - var(--padx) * 2) / var(--r));
  background: #151515;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.8), 0 0 0 1px rgba(255,255,255,.04);
  cursor: zoom-in;
}
.bv.is-full .bv-page { cursor: default; }
.bv-page img, .bv-scroll-page img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; user-select: none; -webkit-user-drag: none;
}
.bv-ph { filter: blur(14px) saturate(1.1); transform: scale(1.06); opacity: .9; transition: opacity .5s ease; }
.bv-img { opacity: 0; transition: opacity .55s ease; }
.bv-img.is-loaded { opacity: 1; }
.bv-img.is-loaded + .bv-ph { opacity: 0; }

/* Single very tall page: read by scrolling down */
.bv-scroll {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 4px 24px 24px; outline: none; scrollbar-width: thin; scrollbar-color: rgba(197,160,89,.5) transparent;
}
.bv-scroll-page {
  position: relative; width: 100%; max-width: 720px; margin: 0 auto;
  aspect-ratio: var(--r); overflow: hidden; border-radius: 3px; background: #151515; cursor: zoom-in;
}
.bv.is-full .bv-scroll-page { max-width: 960px; cursor: default; }
.bv-scroll-page .bv-ph { filter: blur(10px); transform: none; }

/* Side arrows (float over the page edge) */
.bv-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 40px; height: 40px; border-radius: 999px;
  display: grid; place-items: center; cursor: pointer;
  border: 1px solid rgba(255,255,255,.16); background: rgba(10,10,10,.6);
  color: rgba(255,255,255,.85); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: border-color .3s, color .3s, opacity .3s, box-shadow .3s;
}
.bv-nav:hover { border-color: #C5A059; color: #C5A059; box-shadow: 0 0 20px rgba(197,160,89,.22); }
.bv-nav[disabled] { opacity: 0; pointer-events: none; }
.bv-prev { left: 12px; }
.bv-next { right: 12px; }

/* Progress line */
.bv-progress { position: relative; height: 1px; background: rgba(255,255,255,.08); margin: 10px 24px 0; flex: none; }
.bv-progress span {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0;
  background: #C5A059; box-shadow: 0 0 10px rgba(197,160,89,.6);
  transition: width .45s cubic-bezier(.22,1,.36,1);
}

/* Thumbnail strip */
.bv-strip {
  display: flex; align-items: center; gap: 6px; flex: none;
  overflow-x: auto; scrollbar-width: none;
  padding: 12px 24px 16px;
}
.bv-strip::-webkit-scrollbar { display: none; }
.bv-thumb {
  position: relative; flex: none; height: var(--thumb-h); aspect-ratio: var(--r);
  border-radius: 2px; overflow: hidden; padding: 0; cursor: pointer;
  border: 0; background: #161616;
  opacity: .38; transition: opacity .3s ease;
}
.bv-thumb::after {
  content: ''; position: absolute; inset: 0; border-radius: 2px;
  box-shadow: inset 0 0 0 1px transparent; transition: box-shadow .3s ease;
}
.bv-thumb:hover { opacity: .75; }
.bv-thumb.is-active { opacity: 1; }
.bv-thumb.is-active::after { box-shadow: inset 0 0 0 1px #C5A059; }
.bv-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* "Rotate your phone" hint: only in portrait full screen on phones */
.bv-rotate {
  display: none; align-items: center; justify-content: center; gap: 10px; flex: none;
  padding: 4px 16px 0; font-size: 9px; letter-spacing: .22em; text-transform: uppercase;
  color: rgba(255,255,255,.4);
}
.bv-rotate iconify-icon { color: #C5A059; }

/* Film tab: the video plays underneath; only the switch stays on top */
.bv.is-film { background: transparent; pointer-events: none; }
.bv.is-film .bv-top { pointer-events: auto; background: linear-gradient(rgba(0,0,0,.55), transparent); padding-bottom: 28px; }
.bv.is-film .bv-count, .bv.is-film .bv-hint, .bv.is-film .bv-full-btn { visibility: hidden; }
.bv.is-film .bv-stage, .bv.is-film .bv-progress, .bv.is-film .bv-scroll, .bv.is-film .bv-rotate { visibility: hidden; }
.bv.is-film .bv-strip { display: none; }

/* Full screen (moved to <body> so it escapes the modal's transform) */
.bv.is-full {
  position: fixed; inset: 0; z-index: 100;
  --padx: 72px; --pady: 16px; --thumb-h: 62px;
  background: #060606;
  animation: bvIn .35s ease both;
}
.bv.is-full .bv-top { padding: 18px 22px 8px 28px; }
.bv.is-full .bv-prev { left: 18px; }
.bv.is-full .bv-next { right: 18px; }
@keyframes bvIn { from { opacity: 0; } to { opacity: 1; } }

/* Phones */
@media (max-width: 767px) {
  .bv { position: relative; inset: auto; --padx: 0px; --pady: 0px; }
  .bv-top { padding: 12px 14px 10px 16px; }
  .bv-count { font-size: 19px; }
  .bv-btn { width: 32px; height: 32px; }
  .bv-hint { display: inline; }
  .bv-tab { padding: 6px 11px; }
  .bv-stage { flex: none; aspect-ratio: var(--r-stage); max-height: 46vh; }
  .bv.is-film .bv-stage { aspect-ratio: var(--r-film); max-height: 52vh; }
  .bv.is-film .bv-top { position: absolute; left: 0; right: 0; top: 0; }
  .bv-track { padding-inline: 16px; scroll-padding-inline: 16px; gap: 8px; }
  .bv-slide { flex-basis: calc(100% - 4px); }
  .bv-nav, .bv-strip { display: none; }
  .bv-progress { margin: 12px 16px 14px; }
  .bv-scroll { flex: none; height: 52vh; padding: 0 16px 16px; }

  .bv.is-full { --padx: 12px; --pady: 8px; --thumb-h: 46px; }
  .bv.is-full .bv-hint { display: none; }
  .bv.is-full .bv-hint--always { display: inline; }
  .bv.is-full .bv-stage { flex: 1; aspect-ratio: auto; max-height: none; }
  .bv.is-full .bv-track { padding-inline: 0; gap: 0; }
  .bv.is-full .bv-slide { flex-basis: 100%; }
  .bv.is-full .bv-progress { margin: 8px 16px 0; }
  .bv.is-full .bv-strip { display: flex; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
  .bv.is-full .bv-scroll { flex: 1; height: auto; padding: 0 0 calc(16px + env(safe-area-inset-bottom)); }
}
@media (max-width: 767px) and (orientation: portrait) {
  .bv.is-full.is-wide .bv-rotate { display: flex; }
}

/* Phones held sideways, full screen: page uses the whole height, controls float on top */
@media (max-height: 520px) and (orientation: landscape) {
  .bv.is-full { --padx: 0px; --pady: 0px; }
  .bv.is-full .bv-top {
    position: absolute; top: 0; left: 0; right: 0; z-index: 3;
    padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
    pointer-events: none;
  }
  .bv.is-full .bv-top > * { pointer-events: auto; }
  .bv.is-full .bv-label, .bv.is-full .bv-strip, .bv.is-full .bv-rotate { display: none; }
  .bv.is-full .bv-count { font-size: 17px; text-shadow: 0 1px 8px rgba(0,0,0,.9); }
  .bv.is-full .bv-progress { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; z-index: 3; }
  .bv.is-full .bv-page { border-radius: 0; }
}

@media (hover: none) { .bv-nav { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .bv *, .bv { transition: none !important; animation: none !important; }
}

/* Share link under the download button */
.nep-share { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; background: none; border: 0; padding: 2px 0; cursor: pointer; font: 500 9px 'Montserrat', sans-serif; letter-spacing: .24em; text-transform: uppercase; color: rgba(255,255,255,.45); transition: color .3s; }
.nep-share:hover { color: #C5A059; }
.nep-share iconify-icon { color: #C5A059; }
.bv-meta:has(.bv-tabs) { align-items: center; }
