/* BALKORA — galerija "Tour": listanje kao stranice albuma + Ken Burns + automatsko prebacivanje.
   Isti motor za galeriju na stranici (.bt-inline) i preko cijelog ekrana (.bt-full). Vidi assets/js/gallery.js */

.bt { --bt-dur: 5600ms; --bt-turn: 1100ms; position: relative; color: #fff; user-select: none; -webkit-user-select: none; }

/* ---------- Pozornica i slajdovi ---------- */
.bt-stage { position: absolute; inset: 0; overflow: hidden; perspective: 2200px; perspective-origin: 0% 50%; background: #061D2D; touch-action: pan-y; }
.bt-slide { position: absolute; inset: 0; overflow: hidden; transform-origin: 0% 50%; backface-visibility: hidden; will-change: transform; background: #061D2D; }
.bt-slide__bg { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); object-fit: cover; filter: blur(34px) saturate(1.15) brightness(.55); transform: scale(1.1); }
.bt-kb { position: absolute; inset: 0; animation: btKenBurns calc(var(--bt-dur) + 2400ms) linear both; }
.bt-kb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bt-slide.is-fit .bt-kb img { object-fit: contain; }
.bt-slide.is-fit .bt-kb { animation-name: btKenBurnsSoft; }
/* sjena preko lista koji se okreće */
.bt-slide::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; background: linear-gradient(90deg, rgba(3,14,22,.0) 0%, rgba(3,14,22,.55) 70%, rgba(3,14,22,.85) 100%); }

@keyframes btKenBurns {
  from { transform: scale(1.04) translate3d(0, 0, 0); }
  to   { transform: scale(var(--kb-s, 1.16)) translate3d(var(--kb-x, 2%), var(--kb-y, -1.5%), 0); }
}
@keyframes btKenBurnsSoft {
  from { transform: scale(1); }
  to   { transform: scale(1.05); }
}

/* Naprijed: gornji list se okreće ulijevo kao stranica, ispod se "budi" sljedeća slika */
.bt-slide.is-leaf-out { z-index: 3; animation: btLeafOut var(--bt-turn) cubic-bezier(.6,.02,.3,1) forwards; }
.bt-slide.is-leaf-out::after { animation: btShade var(--bt-turn) ease-in forwards; }
.bt-slide.is-rise { z-index: 2; animation: btRise var(--bt-turn) cubic-bezier(.22,.8,.2,1) both; }
/* Nazad: list se vraća sa lijeve strane i prekriva trenutnu */
.bt-slide.is-leaf-in { z-index: 3; animation: btLeafIn var(--bt-turn) cubic-bezier(.3,.0,.2,1) both; }
.bt-slide.is-leaf-in::after { animation: btShade var(--bt-turn) ease-out reverse both; }
.bt-slide.is-sink { z-index: 2; animation: btSink var(--bt-turn) ease forwards; }
/* Prvi slajd pri otvaranju */
.bt-slide.is-intro { animation: btIntro 1.2s cubic-bezier(.22,.8,.2,1) both; }

@keyframes btLeafOut {
  0%   { transform: rotateY(0deg); border-radius: 0; }
  100% { transform: rotateY(-108deg); border-radius: 0 40px 40px 0; }
}
@keyframes btLeafIn {
  0%   { transform: rotateY(-108deg); border-radius: 0 40px 40px 0; }
  100% { transform: rotateY(0deg); border-radius: 0; }
}
@keyframes btShade { from { opacity: 0; } to { opacity: 1; } }
@keyframes btRise {
  from { transform: scale(1.07); filter: brightness(.45) saturate(.8); }
  to   { transform: scale(1); filter: none; }
}
@keyframes btSink { to { transform: scale(.97); filter: brightness(.5); } }
@keyframes btIntro {
  from { clip-path: inset(10% 14% round 28px); transform: scale(1.06); opacity: 0; }
  to   { clip-path: inset(0 0 round 0); transform: none; opacity: 1; }
}

/* Pauza: sve animacije (Ken Burns, traka napretka) stoje */
.bt.is-paused .bt-kb, .bt.is-holding .bt-kb,
.bt.is-paused .bt-seg.is-active i, .bt.is-holding .bt-seg.is-active i { animation-play-state: paused; }

/* ---------- Traka napretka (kao "stories") ---------- */
.bt-progress { position: absolute; z-index: 6; top: 18px; left: 22px; right: 22px; display: flex; gap: 6px; pointer-events: none; }
.bt-seg { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.28); overflow: hidden; }
.bt-seg i { display: block; height: 100%; width: 100%; background: #fff; transform: scaleX(0); transform-origin: 0 50%; }
.bt-seg.is-done i { transform: scaleX(1); }
.bt-seg.is-active i { animation: btFill var(--bt-dur) linear forwards; }
.bt.is-manual .bt-seg.is-active i { animation: none; transform: scaleX(1); opacity: .75; }
@keyframes btFill { to { transform: scaleX(1); } }

/* ---------- Opis ---------- */
.bt-cap { position: absolute; z-index: 6; left: 0; right: 0; bottom: 0; padding: 90px 32px 28px; background: linear-gradient(0deg, rgba(3,14,22,.78), rgba(3,14,22,0)); pointer-events: none; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.bt-cap__text { min-width: 0; max-width: 720px; }
.bt-count { display: inline-flex; align-items: baseline; gap: 6px; font-size: 13px; letter-spacing: .16em; color: rgba(255,255,255,.75); margin-bottom: 10px; }
.bt-count b { font-family: var(--font-serif); font-style: italic; font-weight: 500; font-size: 26px; letter-spacing: 0; color: var(--gold); }
.bt-title { margin: 0; font-family: var(--font-serif); font-style: italic; font-weight: 500; font-size: clamp(22px, 2.6vw, 36px); line-height: 1.15; color: #fff; }
.bt-alt { margin: 6px 0 0; font-size: 15px; color: rgba(255,255,255,.82); }
.bt-cap .bt-count, .bt-cap .bt-title, .bt-cap .bt-alt { opacity: 0; transform: translateY(18px); }
.bt-cap.is-in .bt-count, .bt-cap.is-in .bt-title, .bt-cap.is-in .bt-alt { animation: btCapIn .9s cubic-bezier(.22,.8,.2,1) forwards; }
.bt-cap.is-in .bt-title { animation-delay: .12s; }
.bt-cap.is-in .bt-alt { animation-delay: .22s; }
@keyframes btCapIn { to { opacity: 1; transform: none; } }

/* ---------- Kontrole ---------- */
.bt-controls { position: relative; z-index: 7; display: flex; gap: 10px; pointer-events: auto; flex: 0 0 auto; }
.bt-btn { width: 48px; height: 48px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; border: 1.5px solid rgba(255,255,255,.45); background: rgba(6,29,45,.28); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: background .35s var(--ease), border-color .35s, transform .3s var(--ease); cursor: pointer; }
.bt-btn:hover { background: var(--gold); border-color: var(--gold); transform: translateY(-2px); }
.bt-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.bt-btn svg { width: 20px; height: 20px; }
.bt-btn .ic-play { display: none; }
.bt.is-paused .bt-btn[data-bt="play"] .ic-play { display: block; }
.bt.is-paused .bt-btn[data-bt="play"] .ic-pause { display: none; }

/* strelice sa strane pozornice (samo desktop, pojave se na hover) */
.bt-side { position: absolute; z-index: 6; top: 50%; margin-top: -28px; width: 56px; height: 56px; opacity: 0; transition: opacity .4s, transform .4s var(--ease), background .35s, border-color .35s; }
.bt-side--prev { left: 22px; transform: translateX(-10px); }
.bt-side--next { right: 22px; transform: translateX(10px); }
.bt:hover .bt-side, .bt-side:focus-visible { opacity: 1; transform: none; }

/* ---------- Filmska traka sa sličicama ---------- */
.bt-strip { display: flex; gap: 12px; overflow-x: auto; scroll-behavior: smooth; scrollbar-width: none; padding: 4px 2px 8px; }
.bt-strip::-webkit-scrollbar { display: none; }
.bt-thumb { position: relative; flex: 0 0 auto; width: 112px; height: 76px; border-radius: 12px; overflow: hidden; padding: 0; border: 0; cursor: pointer; background: var(--stone); opacity: .55; transform: scale(.94); transition: opacity .45s, transform .45s var(--ease); }
.bt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bt-thumb::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .35s; }
.bt-thumb:hover { opacity: .9; transform: none; }
.bt-thumb.is-active { opacity: 1; transform: none; }
.bt-thumb.is-active::after { box-shadow: inset 0 0 0 2px var(--gold); }

/* ================= Na stranici ================= */
.bt-inline { margin-top: 40px; }
.bt-inline .bt-frame { position: relative; aspect-ratio: 16 / 8.2; border-radius: var(--radius-lg); overflow: hidden; background: #061D2D; box-shadow: 0 30px 80px -40px rgba(6,29,45,.55); cursor: zoom-in; isolation: isolate; }
.bt-inline .bt-strip { margin-top: 18px; }
.bt-inline .bt-thumb { width: 124px; height: 84px; }
.bt-inline .bt-btn[data-bt="close"], .bt-inline .bt-btn[data-bt="fs"] { display: none; }
.bt-inline .bt-hint { position: absolute; z-index: 6; top: 36px; right: 26px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.85); display: inline-flex; align-items: center; gap: 8px; opacity: 0; transform: translateY(-6px); transition: opacity .4s, transform .4s var(--ease); pointer-events: none; }
.bt-inline .bt-frame:hover .bt-hint { opacity: 1; transform: none; }
.bt-inline .bt-hint svg { width: 16px; height: 16px; }
.bt-noscript img { width: 100%; height: 100%; object-fit: cover; }

/* ================= Preko cijelog ekrana ================= */
.bt-full { position: fixed; inset: 0; z-index: 200; background: #030e16; display: flex; flex-direction: column; opacity: 0; transition: opacity .5s var(--ease); }
.bt-full.is-open { opacity: 1; }
.bt-full .bt-frame { position: relative; flex: 1; min-height: 0; }
.bt-full .bt-strip { flex: 0 0 auto; justify-content: safe center; padding: 14px 24px 18px; background: #030e16; }
.bt-full .bt-btn[data-bt="expand"] { display: none; }
.bt-full .bt-hint { display: none; }
.bt-full .bt-cap { padding-bottom: 30px; }
.bt-full .bt-top { position: absolute; z-index: 7; top: 34px; right: 22px; display: flex; gap: 10px; }
.bt-full .bt-progress { right: 150px; }
body.bt-lock { overflow: hidden; }

/* ---------- Mobilni ---------- */
@media (max-width: 760px) {
  .bt-inline .bt-frame { aspect-ratio: 4 / 5; border-radius: var(--radius); }
  .bt-cap { padding: 70px 18px 18px; flex-direction: column; align-items: stretch; }
  .bt-controls { justify-content: flex-end; }
  .bt-btn { width: 42px; height: 42px; }
  .bt-side { display: none; }
  .bt-progress { left: 14px; right: 14px; top: 12px; }
  .bt-full .bt-progress { right: 110px; }
  .bt-full .bt-top { top: 24px; right: 12px; }
  .bt-inline .bt-thumb, .bt-thumb { width: 84px; height: 58px; }
  .bt-inline .bt-hint { display: none; }
}

/* ---------- Bez animacija (sistemska postavka) ---------- */
@media (prefers-reduced-motion: reduce) {
  .bt { --bt-turn: 350ms; }
  .bt-kb { animation: none !important; }
  .bt-slide.is-leaf-out { animation: btFadeOut .35s ease forwards; }
  .bt-slide.is-leaf-in, .bt-slide.is-intro { animation: btFadeIn .35s ease both; }
  .bt-slide.is-rise, .bt-slide.is-sink { animation: none; }
  .bt-slide::after { display: none; }
}
@keyframes btFadeOut { to { opacity: 0; } }
@keyframes btFadeIn { from { opacity: 0; } }
