/* ============================================================
   MEDIA.CSS — JEUNES SCOLARISÉS
   Page: Media & Gallery
   Aesthetic: Visual feast · editorial magazine · vivid frames
   Fonts: Cormorant Garamond (display) + Outfit (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400;1,600&family=Outfit:wght@300;400;500;600;700&display=swap');

/* ────────────────────────────────────────────
   ROOT TOKENS
──────────────────────────────────────────── */
:root {
  --green-deep:   #1b4d30;
  --green-mid:    #276140;
  --green-vivid:  #34a058;
  --gold:         #c8860a;
  --gold-warm:    #e9a825;
  --amber:        #f5c842;
  --cream:        #faf6ef;
  --parchment:    #f0e9d8;
  --ink:          #161c18;
  --text-dark:    #1a1a1a;
  --text-body:    #2e2e2e;
  --text-muted:   #5a5a5a;
  --white:        #ffffff;
  --border:       rgba(27, 77, 48, 0.11);
  --border-gold:  rgba(200, 134, 10, 0.18);

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Outfit', sans-serif;

  --radius:       16px;
  --radius-sm:    10px;
  --radius-pill:  50px;
  --shadow:       0 4px 28px rgba(27, 77, 48, 0.08);
  --shadow-hover: 0 18px 56px rgba(27, 77, 48, 0.18);
  --transition:   all 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ────────────────────────────────────────────
   BASE
──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { font-family: var(--font-body); color: var(--text-body); background: var(--cream); margin: 0; }

/* ════════════════════════════════════════════
   SECTION WRAPPER
════════════════════════════════════════════ */
.section {
  position: relative;
  padding: 100px 24px 130px;
  max-width: 1280px;
  margin: 0 auto;
}

/* ── Film-strip perforation pattern ── */
.section::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 24px;
  height: 100vh;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 18px,
    rgba(27, 77, 48, 0.07) 18px,
    rgba(27, 77, 48, 0.07) 28px
  );
  pointer-events: none;
  z-index: 0;
}

/* ── Gold bloom top right ── */
.section::after {
  content: '';
  position: absolute;
  top: -100px; right: -160px;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 200, 66, 0.10) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

.section > * { position: relative; z-index: 1; }

/* ════════════════════════════════════════════
   PAGE HEADER
════════════════════════════════════════════ */
.section > h1::before {
  content: 'STORIES IN PICTURES & SOUND';
  display: block;
  font-family: var(--font-body);
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 16px;
}

.section > h1 {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 7vw, 5.5rem);
  font-weight: 700; line-height: 1.05;
  color: var(--green-deep); letter-spacing: -0.01em;
  margin: 0 0 10px;
  animation: titleIn 0.88s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes titleIn {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section > p:first-of-type {
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  color: var(--text-muted); font-weight: 300; line-height: 1.85;
  max-width: 560px; margin: 0 0 64px;
  padding-left: 22px; border-left: 4px solid var(--gold-warm);
  animation: paraIn 0.88s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
}
@keyframes paraIn {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════════════════
   CATEGORY NAV CARDS  (.card-grid)
════════════════════════════════════════════ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 52px;
  animation: gridIn 0.88s cubic-bezier(0.22, 1, 0.36, 1) 0.20s both;
}
@keyframes gridIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Category link card */
.card.card-link {
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
  text-decoration: none;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 30px 28px 26px;
  transition: var(--transition);
}

/* Icon injected per card */
.card.card-link:nth-child(1)::before { content: '🖼'; }
.card.card-link:nth-child(2)::before { content: '▶'; }
.card.card-link:nth-child(3)::before { content: '📡'; }

.card.card-link::before {
  display: block;
  font-size: 1.6rem;
  margin-bottom: 14px;
  line-height: 1;
}

/* Top sweep bar */
.card.card-link::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(to right, var(--green-vivid), var(--gold-warm));
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.card.card-link:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-gold);
  text-decoration: none;
}

.card.card-link:hover::after { transform: scaleX(1); }

.card.card-link h4 {
  font-family: var(--font-display);
  font-size: 1.4rem; font-weight: 700;
  color: var(--green-deep); margin: 0 0 6px;
  transition: color 0.3s ease;
}
.card.card-link:hover h4 { color: var(--green-mid); }

.card.card-link p {
  font-size: 0.85rem; color: var(--text-muted);
  font-weight: 400; margin: 0;
}

/* Staggered */
.card.card-link:nth-child(1) { animation: cardIn 0.65s cubic-bezier(0.22,1,0.36,1) 0.28s both; }
.card.card-link:nth-child(2) { animation: cardIn 0.65s cubic-bezier(0.22,1,0.36,1) 0.38s both; }
.card.card-link:nth-child(3) { animation: cardIn 0.65s cubic-bezier(0.22,1,0.36,1) 0.48s both; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(22px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ════════════════════════════════════════════
   ACTIVE FILTER BADGE
════════════════════════════════════════════ */
.section > p.mt-24,
.mt-24 > p {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(52, 160, 88, 0.10);
  border: 1px solid rgba(52, 160, 88, 0.22);
  border-radius: var(--radius-pill);
  padding: 7px 18px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--green-mid);
  margin-bottom: 28px;
}

/* mt-24 utility */
.mt-24 { margin-top: 24px !important; }
.mt-48 { margin-top: 56px !important; }

/* ════════════════════════════════════════════
   MEDIA TILE GRID  (.logo-grid)
════════════════════════════════════════════ */
.logo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  animation: gridIn 0.88s cubic-bezier(0.22, 1, 0.36, 1) 0.35s both;
}

/* Empty state */
.logo-grid > p {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-style: italic; font-size: 1.15rem;
  color: var(--text-muted); text-align: center;
  padding: 52px 20px;
  background: var(--parchment);
  border-radius: var(--radius);
  border: 1px dashed var(--border-gold);
}

/* ════════════════════════════════════════════
   MEDIA TILE  (.logo-tile)
════════════════════════════════════════════ */
.logo-tile {
  position: relative;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
  display: flex; flex-direction: column;
}

.gallery-trigger {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--ink);
  cursor: zoom-in;
  overflow: hidden;
}

.logo-tile:hover {
  transform: translateY(-7px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-gold);
}

/* Title inside tile */
.logo-tile h5 {
  font-family: var(--font-display) !important;
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: var(--green-deep) !important;
  padding: 16px 20px 14px !important;
  margin: 0 0 8px !important;
  line-height: 1.3 !important;
  transition: color 0.3s ease;
}
.logo-tile:hover h5 { color: var(--green-mid) !important; }

/* Image inside tile — override inline styles */
.logo-tile img {
  width: 100% !important;
  display: block;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 0 !important;
  transition: transform 0.5s ease, filter 0.4s ease;
  filter: brightness(0.96) saturate(0.95);
}

.logo-tile:hover img {
  transform: scale(1.04);
  filter: brightness(1.02) saturate(1.05);
}

.gallery-img {
  cursor: pointer !important;
  transition: opacity 0.25s ease;
}

.gallery-trigger:hover .gallery-img,
.gallery-trigger:focus-visible .gallery-img {
  transform: scale(1.06);
  filter: brightness(1.04) saturate(1.08);
}

/* ════════════════════════════════════════════
   LIGHTBOX MODAL STYLES
════════════════════════════════════════════ */
.lightbox-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
  touch-action: none;
}

.lightbox-modal.active {
  display: flex;
  opacity: 1;
}

.lightbox-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(22, 28, 24, 0.92);
  backdrop-filter: blur(3px);
}

.lightbox-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  padding: 0;
  overflow: hidden;
  z-index: 10000;
}

.lightbox-image {
  position: absolute;
  inset: 16px;
  width: calc(100% - 32px);
  height: calc(100% - 32px);
  max-width: none;
  max-height: none;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
  border-radius: 0;
  box-shadow: 0 25px 80px rgba(27, 77, 48, 0.35);
  animation: imageZoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes imageZoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.lightbox-info {
  display: none;
  color: var(--white);
  font-size: 0.95rem;
  margin-top: 16px;
  text-align: center;
  font-weight: 500;
  letter-spacing: 0.3px;
  max-width: 90vw;
  word-wrap: break-word;
}

/* Close button */
.lightbox-btn-close {
  display: none;
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--white);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10001;
}

.lightbox-btn-close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Navigation button */
.lightbox-btn-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  background: linear-gradient(135deg, var(--gold-warm), var(--gold));
  color: #161c18;
  border: none;
  border-radius: 50%;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10001;
  box-shadow: 0 10px 30px rgba(200, 134, 10, 0.3);
}

.lightbox-btn-nav:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(200, 134, 10, 0.4);
}

.lightbox-btn-nav:focus-visible,
.lightbox-btn-close:focus-visible,
.gallery-trigger:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

.lightbox-btn-prev {
  position: absolute;
  top: 50%;
  left: 28px;
  transform: translateY(-50%);
}

.lightbox-btn-next {
  position: absolute;
  top: 50%;
  right: 28px;
  transform: translateY(-50%);
}

.lightbox-btn-nav svg {
  width: 18px;
  height: 18px;
}

/* Navigation controls container */
.lightbox-controls {
  position: absolute;
  inset: 0;
  z-index: 10001;
  pointer-events: none;
}

.lightbox-controls .lightbox-btn-nav {
  pointer-events: auto;
}

.lightbox-btn-prev:hover,
.lightbox-btn-next:hover {
  transform: translateY(-50%) scale(1.06);
}

/* Mobile responsive */
@media (max-width: 992px) {
  .lightbox-container {
    padding: 0;
  }

  .lightbox-btn-prev,
  .lightbox-btn-next {
    bottom: 16px;
    top: 50%;
    width: 56px;
    height: 56px;
  }

  .lightbox-btn-prev {
    left: 12px;
  }

  .lightbox-btn-next {
    right: 12px;
  }

  .lightbox-btn-nav svg {
    width: 16px;
    height: 16px;
  }

  .lightbox-btn-close {
    width: 38px;
    height: 38px;
    top: 12px;
    right: 12px;
  }

  .lightbox-info {
    font-size: 0.85rem;
    margin-top: 10px;
  }
}

@media (max-width: 640px) {
  .lightbox-modal.active {
    display: flex;
  }

  .lightbox-container {
    padding: 0;
    justify-content: center;
    overflow: hidden;
  }

  .lightbox-image {
    position: absolute;
    inset: 16px;
    width: calc(100% - 32px);
    height: calc(100% - 32px);
    max-width: none;
    max-height: none;
    border-radius: 0;
    object-fit: contain;
  }

  .lightbox-info { display: none; }

  .lightbox-btn-prev,
  .lightbox-btn-next {
    top: auto;
    bottom: 18px;
    width: 52px;
    height: 52px;
    transform: none;
  }

  .lightbox-btn-prev:hover,
  .lightbox-btn-next:hover { transform: scale(1.06); }

  .lightbox-btn-prev {
    left: 8px;
  }

  .lightbox-btn-next {
    right: 8px;
  }

  .lightbox-btn-nav svg {
    width: 16px;
    height: 16px;
  }

  .lightbox-btn-close {
    display: none;
  }

  .lightbox-info {
    font-size: 0.75rem;
    margin-top: 4px;
    max-width: calc(100vw - 112px);
    padding: 0;
  }
}

/* Image overflow clip */
.logo-tile .img-wrap {
  overflow: hidden;
}

/* Caption */
.logo-tile p:last-of-type {
  font-size: 0.82rem !important;
  color: var(--text-muted) !important;
  line-height: 1.55 !important;
  padding: 0 20px 18px !important;
  margin: 8px 0 0 !important;
  flex: 1;
}

/* Video watch link */
.logo-tile .btn.btn-link,
.logo-tile .btn-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--green-mid);
  padding: 10px 20px;
  text-decoration: none;
  border: none; background: none;
  transition: color 0.25s ease, gap 0.25s ease;
}

.logo-tile .btn.btn-link:hover,
.logo-tile .btn-link:hover {
  color: var(--gold);
  gap: 12px;
  text-decoration: none;
}

/* Play icon before watch link */
.logo-tile .btn.btn-link::before,
.logo-tile .btn-link::before {
  content: '▶';
  font-size: 0.7rem;
  color: var(--green-vivid);
  transition: color 0.25s ease;
}

.logo-tile .btn.btn-link:hover::before,
.logo-tile .btn-link:hover::before {
  color: var(--gold-warm);
}

/* ── Tile entrance stagger ── */
.logo-tile:nth-child(1)  { animation: tileIn 0.6s cubic-bezier(0.22,1,0.36,1) 0.30s both; }
.logo-tile:nth-child(2)  { animation: tileIn 0.6s cubic-bezier(0.22,1,0.36,1) 0.38s both; }
.logo-tile:nth-child(3)  { animation: tileIn 0.6s cubic-bezier(0.22,1,0.36,1) 0.46s both; }
.logo-tile:nth-child(4)  { animation: tileIn 0.6s cubic-bezier(0.22,1,0.36,1) 0.54s both; }
.logo-tile:nth-child(5)  { animation: tileIn 0.6s cubic-bezier(0.22,1,0.36,1) 0.62s both; }
.logo-tile:nth-child(6)  { animation: tileIn 0.6s cubic-bezier(0.22,1,0.36,1) 0.70s both; }
.logo-tile:nth-child(7)  { animation: tileIn 0.6s cubic-bezier(0.22,1,0.36,1) 0.78s both; }
.logo-tile:nth-child(8)  { animation: tileIn 0.6s cubic-bezier(0.22,1,0.36,1) 0.86s both; }
.logo-tile:nth-child(9)  { animation: tileIn 0.6s cubic-bezier(0.22,1,0.36,1) 0.94s both; }

@keyframes tileIn {
  from { opacity: 0; transform: scale(0.95) translateY(18px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════ */
@media (max-width: 991.98px) {
  .section { padding: 80px 24px 100px; }
  .card-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .logo-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
}

@media (max-width: 767.98px) {
  .section { padding: 64px 20px 80px; }
  .section > h1 { font-size: clamp(2.2rem, 9vw, 3rem); }
  .section > p:first-of-type { margin-bottom: 44px; padding-left: 16px; border-left-width: 3px; }
  .card-grid { grid-template-columns: 1fr; gap: 14px; }
  .card.card-link { flex-direction: row; align-items: center; padding: 20px 22px; gap: 16px; }
  .card.card-link::before { margin-bottom: 0; font-size: 1.4rem; }
  .logo-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}

@media (max-width: 480px) {
  .logo-grid { grid-template-columns: 1fr; }
}