/* Reels row (Instagram-reels style) + full-screen viewer. Markup: includes/reels-wall.php, script: assets/js/reels.js */
.rl { position: relative; padding: clamp(56px, 7vw, 110px) 0; background: #fff; overflow-x: clip; }
.rl__head { text-align: center; max-width: 720px; margin: 0 auto clamp(26px, 3vw, 48px); }
.rl__head p { color: #5b6677; margin: 10px 0 0; }
.rl__stage { position: relative; }

/* ---- single scrolling row ---- */
.rl__track {
  display: flex; gap: clamp(12px, 1.4vw, 22px);
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scroll-padding-inline: max(16px, calc((100vw - 1320px) / 2 + 12px));
  padding: 8px max(16px, calc((100vw - 1320px) / 2 + 12px)) 24px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; cursor: grab; outline: none;
}
.rl__track::-webkit-scrollbar { display: none; }
.rl__track.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.rl__track.is-loop { scroll-snap-type: none; }   /* more than 10 reels: endless loop, no snapping */
.rl__track.is-dragging .rl-card { pointer-events: none; }

.rl-card {
  position: relative; flex: 0 0 auto; width: clamp(180px, 19vw, 280px); aspect-ratio: 9 / 16;
  padding: 0; border: 0; border-radius: 20px; overflow: hidden; background: #0f1623; color: #fff;
  scroll-snap-align: start; cursor: pointer; text-align: left; font: inherit;
  box-shadow: 0 12px 30px rgba(15, 22, 35, .18); transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s;
  -webkit-tap-highlight-color: transparent;
}
.rl-card:hover, .rl-card:focus-visible { transform: translateY(-6px); box-shadow: 0 18px 40px rgba(15, 22, 35, .28); }
.rl-card:focus-visible { outline: 3px solid #169ef5; outline-offset: 3px; }
.rl-card__media, .rl-card__media img, .rl-card__media video { position: absolute; inset: 0; width: 100%; height: 100%; }
.rl-card__media img, .rl-card__media video { object-fit: cover; }
.rl-card__media video { opacity: 0; transition: opacity .4s; }
.rl-card.is-playing .rl-card__media video { opacity: 1; }
.rl-card__shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .72) 0, rgba(0, 0, 0, 0) 46%, rgba(0, 0, 0, .28) 100%); pointer-events: none; }
.rl-card__badge { position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5)); }
.rl-card__badge svg { width: 100%; height: 100%; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rl-card__info { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px; display: grid; gap: 6px; }
.rl-card__views { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: 15.5px; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.rl-card__views svg { width: 15px; height: 15px; fill: #fff; }
.rl-card__title { font-size: 15.5px; line-height: 1.3; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }

.rl__arrow {
  position: absolute; top: 50%; z-index: 3; transform: translateY(-50%);
  width: 48px; height: 48px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: #fff; color: #10192b; box-shadow: 0 8px 24px rgba(15, 22, 35, .25); cursor: pointer; transition: transform .2s, opacity .2s;
}
.rl__arrow[hidden] { display: none; }
.rl__arrow:hover { transform: translateY(-50%) scale(1.08); }
.rl__arrow svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.rl__arrow--prev { left: max(10px, calc((100vw - 1320px) / 2 - 20px)); }
.rl__arrow--next { right: max(10px, calc((100vw - 1320px) / 2 - 20px)); }
@media (hover: none) { .rl__arrow { display: none !important; } }

.rl__more { display: flex; justify-content: center; margin-top: 8px; }
.rl__follow { display: inline-flex; align-items: center; gap: 9px; padding: 12px 22px; border-radius: 999px; background: linear-gradient(45deg, #f9a03f, #e1306c 55%, #7a3fe0); color: #fff; font-weight: 700; text-decoration: none; box-shadow: 0 10px 24px rgba(225, 48, 108, .3); transition: transform .2s; }
.rl__follow:hover { transform: translateY(-2px); color: #fff; }
.rl__follow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ---- 3D auto-scrolling row (home page): centre reel highlighted ---- */
.rl--3d .rl__track { padding-top: 58px; padding-bottom: 66px; gap: 10px; scroll-behavior: auto; }
.rl--3d .rl-card { width: clamp(155px, 14vw, 215px);transition: box-shadow .35s; will-change: transform; }   /* transform is set every frame by reels.js */
/* side reels are dimmed (--rl-dim: 0 in the centre) */
.rl--3d .rl-card::after { content: ""; position: absolute; inset: 0; background: #0a0f1a; opacity: calc(var(--rl-dim, .5) * .7); pointer-events: none; }   /* light dim: side reels are playing too */
/* fixed highlight frame in the middle: it never moves, the reels pass through it */
.rl--3d .rl__stage { isolation: isolate; }
.rl--3d .rl__frame {
  position: absolute; z-index: 110; transform: translate(-50%, -50%); border-radius: 24px; pointer-events: none;
  box-shadow: 0 0 0 3px #169ef5, 0 0 34px rgba(22, 158, 245, .6), 0 24px 46px rgba(15, 22, 35, .25);
}
.rl--3d .rl__frame { transition: opacity .22s ease; }
.rl--3d .rl__frame.is-moving { opacity: 0; transition-duration: .12s; }   /* hidden while reels pass between positions */
.rl--3d .rl__arrow { z-index: 120; }
/* extra slow zoom into the picture while a reel sits in the frame */
.rl--3d .rl-card__media { transition: transform .6s ease; }
.rl--3d .rl-card.is-center .rl-card__media { transform: scale(1.14); transition: transform 2.1s ease-out; }   /* about DWELL + SLIDE in reels.js */
.rl--3d .rl-card__info { opacity: 0; transition: opacity .35s; }
.rl--3d .rl-card.is-center .rl-card__info { opacity: 1; }
/* soft fade at both edges of the row */
.rl--3d .rl__stage::before, .rl--3d .rl__stage::after { content: ""; position: absolute; top: 0; bottom: 0; width: 8vw; z-index: 2; pointer-events: none; }
.rl--3d .rl__stage::before { left: 0; background: linear-gradient(to right, #fff, rgba(255, 255, 255, 0)); }
.rl--3d .rl__stage::after { right: 0; background: linear-gradient(to left, #fff, rgba(255, 255, 255, 0)); }

/* ---- full-screen viewer ---- */
body.rl-lock { overflow: hidden; }
.rl-viewer { position: fixed; inset: 0; z-index: 100000; background: rgba(8, 10, 16, .94); opacity: 0; transition: opacity .25s; }
.rl-viewer[hidden] { display: none; }
.rl-viewer.is-open { opacity: 1; }
.rl-scroll { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; scroll-snap-type: y mandatory; scrollbar-width: none; }
.rl-scroll::-webkit-scrollbar { display: none; }
.rl-slide { height: 100vh; height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always; display: grid; place-items: center; }
.rl-frame { position: relative; width: 100vw; height: 100vh; height: 100dvh; background: #000; overflow: hidden; }
@media (min-width: 700px) {
  .rl-frame { width: auto; height: min(94dvh, 900px); aspect-ratio: 9 / 16; border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
}
.rl-frame video, .rl-frame .rl-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rl-frame .rl-poster { z-index: 0; }
.rl-frame video { z-index: 1; }
.rl-frame::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: linear-gradient(to top, rgba(0, 0, 0, .75) 0, rgba(0, 0, 0, 0) 38%), linear-gradient(to bottom, rgba(0, 0, 0, .45) 0, rgba(0, 0, 0, 0) 18%); }
.rl-tap { position: absolute; inset: 0; z-index: 3; border: 0; background: transparent; cursor: pointer; }
.rl-pause { position: absolute; z-index: 4; top: 50%; left: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, .5); opacity: 0; transform: scale(.7); transition: opacity .2s, transform .2s; pointer-events: none; }
.rl-pause svg { width: 34px; height: 34px; fill: #fff; }
.rl-frame.is-paused .rl-pause { opacity: 1; transform: scale(1); }
.rl-cap { position: absolute; z-index: 4; left: 0; right: 76px; bottom: 0; padding: 0 16px 28px; color: #fff; pointer-events: none; }
.rl-cap__user { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16.5px; margin-bottom: 8px; }
.rl-cap__avatar { width: 34px; height: 34px; border-radius: 50%; background: #fff url('../img/logo/favicon.png') center / 70% no-repeat; border: 2px solid #e1306c; }
.rl-cap__title { font-size: 16.5px; line-height: 1.4; text-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.rl-rail { position: absolute; z-index: 5; right: 12px; bottom: 28px; display: grid; gap: 18px; justify-items: center; color: #fff; }
.rl-rail__item { display: grid; justify-items: center; gap: 4px; font-size: 14px; font-weight: 700; text-decoration: none; color: #fff; border: 0; background: transparent; cursor: pointer; padding: 0; }
.rl-rail__item svg { width: 30px; height: 30px; fill: none; stroke: #fff; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5)); }
.rl-rail__item svg.is-fill { fill: #fff; stroke: none; }
.rl-bar { position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .28); }
.rl-bar i { display: block; height: 100%; width: 0; background: #fff; }
.rl-close, .rl-sound { position: fixed; z-index: 6; top: 14px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .5); color: #fff; cursor: pointer; backdrop-filter: blur(6px); }
.rl-close { left: 14px; }
.rl-sound { right: 14px; }
@media (min-width: 700px) { .rl-close { left: auto; right: 20px; } .rl-sound { right: auto; left: calc(50% + min(94dvh, 900px) * 9 / 32 - 56px); top: calc(50% - min(94dvh, 900px) / 2 + 14px); } }
.rl-close svg, .rl-sound svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.rl-sound .rl-on { display: none; }
.rl-sound.is-on .rl-on { display: block; }
.rl-sound.is-on .rl-off { display: none; }
.rl-nav { position: fixed; z-index: 6; right: 24px; top: 50%; transform: translateY(-50%); display: none; gap: 12px; }
.rl-nav button { width: 48px; height: 48px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer; backdrop-filter: blur(6px); }
.rl-nav button:hover { background: rgba(255, 255, 255, .3); }
.rl-nav button:disabled { opacity: .3; cursor: default; }
.rl-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 700px) { .rl-nav { display: grid; } }

@media (prefers-reduced-motion: reduce) {
  .rl-card, .rl-viewer, .rl-pause { transition: none; }
  .rl--3d .rl-card .rl-card__media { transform: none; transition: none; }
}
