﻿/* Instagram reel */
.insta-reel {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, #101214 0%, #171a1e 56%, #0b0c0d 100%);
  color: var(--c-white);
}

.insta-reel::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.45;
  pointer-events: none;
}

.insta-reel.is-hidden {
  display: none;
}

.insta-reel .container {
  position: relative;
  z-index: 1;
}

.insta-reel__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 430px);
  align-items: end;
  gap: var(--s-10);
  margin-bottom: var(--s-12);
}

.insta-reel__header .display-md {
  color: var(--c-white);
}

.insta-reel__header em {
  font-style: italic;
  color: var(--c-accent-pale);
}

.insta-reel__intro {
  margin: 0;
}

.insta-reel__shell {
  position: relative;
}

.insta-reel__status {
  min-height: 24rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-8);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  color: rgba(253,252,250,0.62);
  text-align: center;
}

.insta-reel__status[hidden] {
  display: none;
}

.insta-reel__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 272px);
  gap: var(--s-5);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 2px;
  padding: 2px 2px var(--s-5);
  scrollbar-color: rgba(217,119,6,0.65) rgba(255,255,255,0.08);
  scrollbar-width: thin;
}

.insta-reel__track:empty {
  display: none;
}

.insta-reel__track::-webkit-scrollbar {
  height: 8px;
}

.insta-reel__track::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
}

.insta-reel__track::-webkit-scrollbar-thumb {
  background: rgba(217,119,6,0.75);
  border-radius: 999px;
}

.insta-reel__card {
  min-width: 0;
  scroll-snap-align: start;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255,255,255,0.055);
  box-shadow: 0 24px 70px rgba(0,0,0,0.22);
  transition: border-color var(--t-base), transform var(--t-base), background var(--t-base);
}

.insta-reel__card.is-expanded {
  display: none;
}

.insta-reel__card:hover {
  transform: translateY(-3px);
  border-color: rgba(251,191,36,0.42);
  background: rgba(255,255,255,0.08);
}

.insta-reel__media-button {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: #060708;
  color: var(--c-dark);
}

.insta-reel__media-button img,
.insta-reel__media-button video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.insta-reel__media-button img {
  transition: transform var(--t-slow), filter var(--t-base);
}

.insta-reel__card:hover .insta-reel__media-button img {
  transform: scale(1.05);
  filter: brightness(0.82);
}

.insta-reel__media-button video {
  background: #000;
}

.insta-reel__fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(253,252,250,0.36);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.insta-reel__play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(253,252,250,0.92);
  color: #111213;
  box-shadow: 0 14px 34px rgba(0,0,0,0.28);
  transition: transform var(--t-base), background var(--t-base);
}

.insta-reel__play i {
  margin-left: 3px;
  font-size: 1.25rem;
}

.insta-reel__media-button:hover .insta-reel__play {
  transform: translate(-50%, -50%) scale(1.06);
  background: var(--c-accent-pale);
}

.insta-reel__card.is-playing .insta-reel__play,
.insta-reel__card.is-playing .insta-reel__badge {
  display: none;
}

.insta-reel__badge {
  position: absolute;
  top: var(--s-4);
  left: var(--s-4);
  z-index: 1;
  padding: 0.28rem 0.55rem;
  border: 1px solid rgba(253,252,250,0.28);
  border-radius: 6px;
  background: rgba(10,10,10,0.5);
  color: rgba(253,252,250,0.9);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.insta-reel__body {
  padding: var(--s-5);
}

.insta-reel__caption {
  min-height: 4.35em;
  margin-bottom: var(--s-4);
  color: rgba(253,252,250,0.76);
  font-size: 0.88rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.insta-reel__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: var(--s-4);
}

.insta-reel__date,
.insta-reel__link {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.insta-reel__date {
  color: rgba(253,252,250,0.42);
}

.insta-reel__link {
  color: var(--c-accent-pale);
  transition: color var(--t-fast);
}

.insta-reel__link:hover {
  color: var(--c-white);
}

.insta-reel__controls {
  display: none !important;
  margin-top: var(--s-4);
}

.insta-reel__controls[hidden] {
  display: none;
}

.insta-reel__nav-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  color: var(--c-white);
  transition: border-color var(--t-fast), background var(--t-fast), color var(--t-fast), opacity var(--t-fast);
}

.insta-reel__nav-btn:hover {
  border-color: rgba(251,191,36,0.45);
  background: rgba(217,119,6,0.18);
  color: var(--c-accent-pale);
}

.insta-reel__nav-btn:disabled {
  opacity: 0.36;
  cursor: default;
}

@media (max-width: 768px) {
  /* Header: single column, centred */
  .insta-reel__header {
    grid-template-columns: 1fr;
    gap: var(--s-4);
    margin-bottom: var(--s-8);
    text-align: center;
  }
  .insta-reel__intro {
    margin-inline: auto;
    max-width: 360px;
  }

  /* Track: full-bleed, one card + peek of next */
  .insta-reel__track {
    grid-auto-columns: minmax(0, 82vw);
    gap: var(--s-3);
    margin-inline: calc(var(--s-5) * -1);
    padding-inline: var(--s-5);
    scroll-padding-inline: var(--s-5);
    padding-bottom: var(--s-4);
    scrollbar-width: none;
  }
  .insta-reel__track::-webkit-scrollbar {
    display: none;
  }

  /* Larger, easier-to-tap play button */
  .insta-reel__play {
    width: 68px;
    height: 68px;
  }
  .insta-reel__play i {
    font-size: 1.5rem;
    margin-left: 4px;
  }

  /* More modern card corners */
  .insta-reel__card {
    border-radius: 14px;
  }

  /* Tighter body, 2-line caption to keep cards compact */
  .insta-reel__body {
    padding: var(--s-4);
  }
  .insta-reel__caption {
    font-size: 0.82rem;
    -webkit-line-clamp: 2;
    min-height: 0;
    margin-bottom: var(--s-3);
  }

  .insta-reel__status {
    min-height: 16rem;
  }

  /* Swipe is the native mobile gesture — no arrow buttons */
  .insta-reel__controls {
    display: none !important;
  }

  /* Load more: comfortable full-width tap target */
  .insta-reel__load-more button {
    padding: 0.875rem 2rem;
    font-size: 0.9rem;
    width: 100%;
    max-width: 288px;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .insta-reel__track {
    grid-auto-columns: minmax(0, 88vw);
    gap: var(--s-3);
  }
}


.insta-reel--page { overflow: visible; }

.insta-reel--page .insta-reel__track {
  grid-auto-flow: row;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-columns: unset;
  overflow-x: visible;
  scroll-snap-type: none;
}

/* â”€â”€ Expanded video panel â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.insta-reel__expanded {
  display: flex;
  gap: var(--s-8);
  align-items: stretch;
  margin-bottom: var(--s-8);
  padding: var(--s-6);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
}

.insta-reel__expanded[hidden] {
  display: none;
}

.insta-reel__expanded-player {
  position: relative;
  flex-shrink: 0;
  width: 220px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

.insta-reel__expanded-player video {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: contain;
}

.insta-reel__expanded-fullscreen {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  border: 1.5px solid rgba(255,255,255,0.3);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  z-index: 3;
  transition: background 0.15s;
}

.insta-reel__expanded-fullscreen:hover {
  background: rgba(0,0,0,0.8);
}

/* Desktop: hide fullscreen button (native controls handle it) */
@media (min-width: 768px) {
  .insta-reel__expanded-fullscreen {
    display: none;
  }
}

.insta-reel__expanded-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  font-size: 0.875rem;
  transition: background 0.15s;
}

.insta-reel__expanded-close:hover {
  background: rgba(0,0,0,0.9);
}

.insta-reel__expanded-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.insta-reel__expanded-caption {
  flex: 1;
  min-height: 0;
  color: rgba(253,252,250,0.88);
  font-size: 0.875rem;
  line-height: 1.75;
  white-space: pre-line;
  max-height: 300px;
  overflow-y: scroll;
  margin-bottom: var(--s-5);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.35) rgba(255,255,255,0.08);
}

.insta-reel__expanded-caption::-webkit-scrollbar {
  width: 4px;
}
.insta-reel__expanded-caption::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
}
.insta-reel__expanded-caption::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.32);
  border-radius: 999px;
}

.insta-reel__expanded-meta {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex-wrap: wrap;
  margin-top: auto;
}

.insta-reel__expanded-meta .insta-reel__link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* Smaller cards when expanded (horizontal scroll context) */
.insta-reel__shell.has-expanded .insta-reel__track {
  grid-auto-columns: minmax(160px, 196px);
}

/* Mobile main page: hide other videos when one is expanded */
@media (max-width: 767px) {
  .insta-reel:not(.insta-reel--page) .insta-reel__shell.has-expanded .insta-reel__track {
    display: none;
  }
}

/* Smaller cards when expanded (page grid context) */
.insta-reel--page .insta-reel__shell.has-expanded .insta-reel__track {
  grid-template-columns: repeat(4, 1fr);
}

/* Desktop page-grid: expanded player spans one grid column, info fills the rest */
@media (min-width: 641px) {
  .insta-reel--page .insta-reel__expanded {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--s-5);
    position: relative;
    isolation: isolate;
    padding-block: var(--s-4);
    background: transparent;
    border: none;
    border-radius: 0;
    align-items: start;
  }
  /* full-width bg via out-of-flow pseudo — doesn't affect grid sizing */
  .insta-reel--page .insta-reel__expanded::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    left: calc(-1 * var(--reel-offset, var(--s-8)));
    right: calc(-1 * var(--reel-offset, var(--s-8)));
    background: rgba(255,255,255,0.05);
    border-top: 1px solid rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    z-index: -1;
    pointer-events: none;
  }
  .insta-reel--page .insta-reel__expanded-player {
    width: 100%;
    height: var(--reel-expanded-h, 500px);
  }
  .insta-reel--page .insta-reel__expanded-player video {
    width: 100%;
    height: 100%;
    aspect-ratio: unset;
    object-fit: cover;
  }
  .insta-reel--page .insta-reel__expanded-info {
    grid-column: 2 / -1;
    min-width: 0;
    height: var(--reel-expanded-h, 500px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: var(--s-4) var(--s-5) var(--s-4) var(--s-5);
    scrollbar-width: thin;
    scrollbar-color: rgba(160,160,160,0.45) transparent;
  }
  .insta-reel--page .insta-reel__expanded-info::-webkit-scrollbar { width: 4px; }
  .insta-reel--page .insta-reel__expanded-info::-webkit-scrollbar-track { background: transparent; }
  .insta-reel--page .insta-reel__expanded-info::-webkit-scrollbar-thumb {
    background: rgba(160,160,160,0.45);
    border-radius: 999px;
  }
  .insta-reel--page .insta-reel__expanded-caption {
    position: static;
    flex: 0 0 auto;
    overflow: visible;
    max-height: none;
  }
  .insta-reel--page .insta-reel__expanded-meta {
    position: static;
    margin-top: var(--s-5);
    flex: 0 0 auto;
  }
}

/* â”€â”€ Load more button â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.insta-reel__load-more {
  text-align: center;
  margin-top: var(--s-8);
  padding-bottom: var(--s-2);
}

.insta-reel__load-more button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(253,252,250,0.78);
  padding: 0.65rem 1.75rem;
  border-radius: 2rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-family: inherit;
  letter-spacing: 0.01em;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.insta-reel__load-more button:hover:not(:disabled) {
  background: rgba(255,255,255,0.13);
  color: var(--c-white);
  border-color: rgba(255,255,255,0.25);
}

.insta-reel__load-more button:disabled {
  opacity: 0.5;
  cursor: wait;
}

@media (max-width: 640px) {
  /* Keep row layout — column makes the 9:16 video viewport-tall */
  .insta-reel__expanded {
    flex-direction: row;
    gap: var(--s-3);
    padding: var(--s-4);
  }

  /* Narrow player: 130px × 231px — visible without overflowing */
  .insta-reel__expanded-player {
    width: 130px;
    flex-shrink: 0;
    max-width: none;
    margin-inline: 0;
  }

  .insta-reel__expanded-caption {
    font-size: 0.8rem;
    line-height: 1.6;
    max-height: 195px;
    margin-bottom: var(--s-3);
  }

  .insta-reel__expanded-meta {
    gap: var(--s-2);
    font-size: 0.68rem;
    margin-top: 0;
  }

  /* Track cards behind expanded player stay full swipe-card width on mobile */
  .insta-reel__shell.has-expanded .insta-reel__track {
    grid-auto-columns: minmax(0, 82vw);
  }

  /* Hide date on mobile — saves space, Instagram link is sufficient */
  .insta-reel__date {
    display: none;
  }

  /* Video-skola: 2 columns on mobile */
  .insta-reel--page .insta-reel__track {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-columns: unset;
    gap: var(--s-3);
  }
  .insta-reel--page .insta-reel__shell.has-expanded .insta-reel__track {
    grid-template-columns: repeat(2, 1fr);
  }

}

/* Fixed-count track (main page 5-video preview) â€” all cards visible, no scroll */
/* Fixed-count layout is desktop-only — mobile falls through to the 82vw swipe track */
@media (min-width: 768px) {
  .insta-reel__shell.is-fixed-count .insta-reel__track {
    grid-auto-columns: minmax(0, 1fr);
    overflow-x: hidden;
    scrollbar-width: none;
  }
  .insta-reel__shell.is-fixed-count .insta-reel__track::-webkit-scrollbar {
    display: none;
  }
  .insta-reel__shell.is-fixed-count .insta-reel__controls {
    display: none;
  }
}

/* ── CTA banners inside the video grid ────────────────────── */
.insta-reel__cta {
  position: relative;
  /* Break out of the centered container to span the full viewport width */
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: 0;
  padding: var(--s-12) var(--s-10);
  background: linear-gradient(135deg, rgba(217,119,6,0.09) 0%, rgba(255,255,255,0.04) 100%);
  border-top: 1px solid rgba(217,119,6,0.24);
  border-bottom: 1px solid rgba(217,119,6,0.24);
  border-radius: 0;
  text-align: center;
  overflow: hidden;
}

.insta-reel__cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% -20%, rgba(217,119,6,0.18) 0%, transparent 65%);
  pointer-events: none;
}

.insta-reel__cta-eyebrow {
  position: relative;
  font-family: var(--f-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: var(--s-4);
}

.insta-reel__cta-title {
  position: relative;
  font-family: var(--f-display);
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  font-weight: 400;
  color: var(--c-white);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: var(--s-5);
}

.insta-reel__cta-sub {
  position: relative;
  font-size: 0.95rem;
  color: rgba(253,252,250,0.6);
  line-height: 1.75;
  max-width: 460px;
  margin-inline: auto;
  margin-bottom: var(--s-8);
}

@media (max-width: 640px) {
  .insta-reel__cta {
    padding: var(--s-5) var(--s-4);
    margin-block: 0;
  }
  .insta-reel__cta-eyebrow {
    font-size: 0.65rem;
    margin-bottom: var(--s-2);
  }
  .insta-reel__cta-title {
    font-size: 1.2rem;
    margin-bottom: var(--s-3);
  }
  .insta-reel__cta-sub {
    font-size: 0.8rem;
    margin-bottom: var(--s-5);
  }
  .insta-reel__cta .btn--primary,
  .insta-reel__fill-cta .btn--primary {
    padding-block: 0.4rem;
    font-size: 0.78rem;
  }
}

/* ── Card-sized fill CTA (fills the empty slot in an incomplete last row) ── */
.insta-reel__fill-cta {
  min-width: 0;        /* prevent the card from blowing out its grid column */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--s-6) var(--s-4);
  gap: var(--s-4);
  background: linear-gradient(135deg, rgba(217,119,6,0.1) 0%, rgba(255,255,255,0.04) 100%);
  border: 1px dashed rgba(217,119,6,0.4);
  border-radius: 8px;
  min-height: 200px;
}

.insta-reel__fill-cta-title {
  font-family: var(--f-display);
  font-size: clamp(1rem, 2vw, 1.4rem);
  font-weight: 400;
  color: var(--c-white);
  line-height: 1.2;
}

.insta-reel__fill-cta-sub {
  font-size: 0.82rem;
  color: rgba(253,252,250,0.6);
  line-height: 1.6;
  max-width: 240px;
  margin-inline: auto;
}

.insta-reel__fill-cta-btn {
  font-size: 0.62rem;
  padding: 0.4rem 0.75rem;
  white-space: normal;   /* allow text to wrap instead of forcing column wider */
  text-align: center;
  max-width: 100%;
}

/* ── Load-more appear animation ────────────────────────────── */
@keyframes reel-appear {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.insta-reel__card.is-new,
.insta-reel__cta.is-new {
  animation: reel-appear 0.45s ease forwards;
}

/* ── LOWER DESKTOP (≤1440px) ─────────────────────────────── */
@media (min-width: 769px) and (max-width: 1440px) {
  /* 5 columns so cards are smaller */
  .insta-reel--page .insta-reel__track,
  .insta-reel--page .insta-reel__shell.has-expanded .insta-reel__track {
    grid-template-columns: repeat(5, 1fr);
  }
  /* expanded panel: also 5-column grid, smaller height */
  .insta-reel--page .insta-reel__expanded {
    grid-template-columns: repeat(5, 1fr);
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .insta-reel--page .insta-reel__expanded-player,
  .insta-reel--page .insta-reel__expanded-info {
    height: 380px;
  }
}
