/* FB Reels Embedder v4 — Public */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@500;700&display=swap');

:root {
  --fb:              #1877F2;
  --fb-d:            #0d5fcc;
  --fbre-play-color: #1877F2;  /* overridden by inline style from settings */
  --dark:            #18191A;
  --card:            #111213;
  --border:          rgba(255,255,255,0.06);
  --r:               12px;
  --gap:             16px;     /* gap between slides */
  --ease:            cubic-bezier(0.4,0,0.2,1);
}

/* ── Section ── */
.fbre-section {
  font-family: 'DM Sans', -apple-system, sans-serif;
  width: 100%; box-sizing: border-box;
  margin-bottom: 32px;
}

/* ── Header ── */
.fbre-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.fbre-fb-dot {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--fb); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-shadow: 0 3px 10px rgba(24,119,242,.4);
}
.fbre-head-title {
  font-size: 14px; font-weight: 700;
  color: #1c1e21; flex: 1;
}

/* ── Scroll layout ── */

/* Outer: holds arrows + scroll track, no overflow clipping */
.fbre-scroll-outer {
  position: relative;
  /* push content inward so arrows don't sit over cards */
  padding: 0 48px;
  box-sizing: border-box;
}

/* Visible scrollable track — touch friendly, no scrollbar */
.fbre-track {
  display: flex;
  gap: 20px;
  overflow-x: scroll;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.2) transparent;
  /* vertical padding so hover-lift shadow isn't clipped */
  padding: 8px 4px 14px;
  cursor: grab;
}
.fbre-track:active { cursor: grabbing; }
.fbre-track::-webkit-scrollbar {
  height: 4px;
}
.fbre-track::-webkit-scrollbar-track {
  background: rgba(0,0,0,.06);
  border-radius: 2px;
}
.fbre-track::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,.2);
  border-radius: 2px;
}
.fbre-track::-webkit-scrollbar-thumb:hover {
  background: rgba(0,0,0,.35);
}

/* Each scroll card: fixed portrait size */
.fbre-layout-scroll .fbre-card {
  flex: 0 0 160px;
  height: calc(160px * 16 / 9);
  scroll-snap-align: start;
}

/* ── Arrow buttons — absolutely positioned in the 48px gutters ── */
.fbre-arr {
  position: absolute;
  top: calc(50% - 7px); /* -7px to account for scrollbar height below */
  transform: translateY(-50%);
  z-index: 20;
  width: 40px; height: 40px; border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 2px 14px rgba(0,0,0,.25), 0 0 0 1px rgba(0,0,0,.08);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
  transition: background .18s var(--ease), box-shadow .18s var(--ease),
              opacity .2s var(--ease), transform .18s var(--ease);
}
.fbre-arr svg {
  display: block;
  width: 20px; height: 20px;
  fill: #222;
  flex-shrink: 0;
  pointer-events: none;
  transition: fill .18s var(--ease);
}
.fbre-arr-l { left: 4px; }
.fbre-arr-r { right: 4px; }
.fbre-arr:hover {
  background: var(--fbre-play-color);
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  transform: translateY(-50%) scale(1.08);
}
.fbre-arr:hover svg { fill: #fff; }
.fbre-arr:active  { transform: translateY(-50%) scale(0.94); }
/* hidden when at track limits */
.fbre-arr.fbre-arr-hidden {
  opacity: 0;
  pointer-events: none;
}

/* Soft fade at track edges */
.fbre-fade-l, .fbre-fade-r {
  position: absolute; top: 0; bottom: 0;
  width: 36px; pointer-events: none; z-index: 10;
}
.fbre-fade-l { left:  48px; background: linear-gradient(to right, rgba(255,255,255,.9), transparent); }
.fbre-fade-r { right: 48px; background: linear-gradient(to left,  rgba(255,255,255,.9), transparent); }

/* ── Grid layout ── */
.fbre-grid { display: grid; gap: var(--gap); }
.fbre-cols-2 { grid-template-columns: repeat(2, 1fr); }
.fbre-cols-3 { grid-template-columns: repeat(3, 1fr); }
.fbre-cols-4 { grid-template-columns: repeat(4, 1fr); }
.fbre-layout-grid .fbre-card { aspect-ratio: 9/16; }

/* ── Card ── */
.fbre-card {
  border-radius: var(--r); overflow: hidden;
  position: relative; background: var(--card);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
  opacity: 0; transform: translateY(12px);
  animation: fbre-pop .3s var(--ease) forwards;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}
.fbre-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
@keyframes fbre-pop { to { opacity:1; transform:translateY(0); } }

/* ── Card inner ── */
.fbre-card-inner { position: relative; width: 100%; height: 100%; }

/* Video wrap – the actual fb-video sits here, fills card */
.fbre-vid-wrap {
  width: 100%; height: 100%;
  overflow: hidden; pointer-events: none; /* no interaction – shield handles clicks */
}
.fbre-vid-wrap .fb-video { width: 100% !important; height: 100% !important; }
.fbre-vid-wrap iframe    { width: 100% !important; height: 100% !important; border: none; }

/* ── Click shield – sits on top of the video, captures all clicks ── */
.fbre-shield {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0);
  transition: background .2s var(--ease);
}
.fbre-card:hover .fbre-shield { background: rgba(0,0,0,.25); }

/* play button */
.fbre-play-btn {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--fbre-play-color); display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(.75);
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  flex-shrink: 0;
}
.fbre-card:hover .fbre-play-btn { opacity: 1; transform: scale(1); }

/* ── Notice ── */
.fbre-notice {
  padding: 12px 16px; background: #fff3cd;
  border-left: 4px solid #ffc107; border-radius: 0 8px 8px 0; font-size: 14px;
}
.fbre-notice a { color: var(--fb); font-weight: 600; }

/* ─────────────────────────────────────────
   LIGHTBOX
───────────────────────────────────────── */
.fbre-lightbox {
  position: fixed; inset: 0; z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; box-sizing: border-box;
  pointer-events: none; opacity: 0;
  transition: opacity .25s ease;
}
.fbre-lightbox.fbre-open { opacity: 1; pointer-events: all; }

.fbre-lb-bg {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.92);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  cursor: pointer;
}

.fbre-lb-close {
  position: fixed; top: 14px; right: 14px; z-index: 10;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15);
  color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
  transition: background .18s, transform .25s var(--ease);
}
.fbre-lb-close:hover { background: rgba(255,255,255,.2); transform: rotate(90deg) scale(1.1); }

/* Lightbox box */
.fbre-lb-box {
  position: relative; z-index: 2;
  width: 100%; max-width: 380px;
  background: var(--dark); border-radius: 18px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.7), 0 0 0 1px var(--border);
  transform: scale(.86) translateY(22px); opacity: 0;
  transition: transform .34s cubic-bezier(.34,1.56,.64,1), opacity .26s ease;
}
.fbre-lightbox.fbre-open .fbre-lb-box { transform: scale(1) translateY(0); opacity: 1; }

/* Video area inside lightbox */
.fbre-lb-vid {
  width: 100%; aspect-ratio: 9/16;
  background: #000; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.fbre-lb-vid .fb-video { width: 100% !important; }
.fbre-lb-vid iframe    { width: 100% !important; height: 100% !important; border: none; }

/* Spinner */
.fbre-lb-spin {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.08); border-top-color: var(--fbre-play-color);
  animation: fbre-spin .75s linear infinite;
  position: absolute;
}
.fbre-lb-vid.fbre-loaded .fbre-lb-spin { display: none; }
@keyframes fbre-spin { to { transform: rotate(360deg); } }

/* Watch on FB link */
.fbre-lb-link {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  padding: 13px 16px; color: var(--fb); font-size: 13px; font-weight: 700;
  text-decoration: none; background: #242526; border-top: 1px solid var(--border);
  transition: background .18s, color .18s;
  font-family: 'DM Sans', sans-serif;
}
.fbre-lb-link:hover { background: #3a3b3c; color: #fff; }

/* ── Responsive ── */
@media (max-width: 900px) { .fbre-cols-4 { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 640px) {
  .fbre-cols-3, .fbre-cols-4 { grid-template-columns: repeat(2,1fr); }
  :root { --cw: 130px; }
}
@media (max-width: 420px) {
  .fbre-cols-2, .fbre-cols-3, .fbre-cols-4 { grid-template-columns: repeat(2,1fr); }
  .fbre-lb-box { border-radius: 14px; }
}
