/* ===== Media gallery — dark theme (mirrors media/example.html) ===== */
.scd-media-wrapper {
  --scd-bg: #1a2430;
  --scd-card-bg: #1f2937;
  --scd-outline: #374151;
  --scd-text: #ffffff;
  --scd-text-dim: #9ca3af;
  --scd-orange: #f97316;

  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* background: var(--scd-bg); */
  color: var(--scd-text);
  /* padding: 32px; */
  border-radius: 16px;
  box-sizing: border-box;
}

.scd-media-wrapper * {
  box-sizing: border-box;
}

.scd-media-empty {
  color: var(--scd-text-dim);
  text-align: center;
  padding: 40px 0;
}

/* ----- Sections ----- */
.scd-media-section {
  max-width: 1400px;
  margin: 0 auto 48px;
}

.scd-media-section:last-of-type {
  margin-bottom: 0;
}

.scd-media-section-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.scd-media-section-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  color: var(--scd-text);
}

.scd-media-playall {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--scd-orange);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.scd-media-playall:hover {
  color: #fb923c;
}

.scd-media-playall-icon {
  width: 16px;
  height: 16px;
}

/* Category description, shown between the section header and its grid. */
.scd-media-section-desc {
  max-width: 720px;
  margin: 0 0 24px;
  color: var(--scd-text-dim);
  font-size: 15px;
  line-height: 1.6;
}

.scd-media-section-desc p {
  margin: 0 0 12px;
}

.scd-media-section-desc p:last-child {
  margin-bottom: 0;
}

.scd-media-section-desc a {
  color: var(--scd-orange);
}

/* ----- Grid + cards ----- */
.scd-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px;
}

/* Slider: manual horizontal scroll driven by the arrow buttons (and by
   swipe / trackpad). No auto-scroll — it was distracting while reading. */
.scd-media-grid--slider {
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  /* No scroll-snap: a row whose overflow is narrower than one card can't reach
     a snap point at the end, and mandatory snapping would bounce it back. */
  /* Native scrollbar hidden — the arrows are the visible affordance. */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.scd-media-grid--slider::-webkit-scrollbar {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .scd-media-grid--slider {
    scroll-behavior: auto;
  }
}

.scd-media-slider-track {
  display: flex;
  width: max-content;
}

.scd-media-slider-group {
  display: flex;
  flex-shrink: 0;
  gap: 24px;
  padding-right: 24px;
  padding-bottom: 24px;
}

.scd-media-grid--slider .scd-media-card {
  flex: 0 0 280px;
  width: 280px;
}

/* Arrow controls, in the section header next to "Play all" */
.scd-media-slider-nav {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.scd-media-slider-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--scd-outline);
  background: var(--scd-card-bg);
  color: var(--scd-text);
  font-family: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.scd-media-slider-arrow:hover:not(:disabled) {
  border-color: var(--scd-orange);
  color: var(--scd-orange);
}

.scd-media-slider-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.scd-media-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  background: var(--scd-card-bg);
  border: 1px solid var(--scd-outline);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.scd-media-card:hover {
  transform: translateY(-4px);
  border-color: var(--scd-orange);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.scd-media-card-thumb {
  position: relative;
  display: block;
  width: 100%;
  height: 176px;
  background: #111827;
}

.scd-media-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scd-media-card-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.scd-media-card:hover .scd-media-card-play {
  background: var(--scd-orange);
}

.scd-media-card-play svg {
  width: 26px;
  height: 26px;
  color: #ffffff;
  margin-left: 2px;
}

.scd-media-card-body {
  display: block;
  padding: 16px;
  flex-grow: 1;
}

.scd-media-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--scd-text);
}

/* ----- Lightbox modal ----- */
.scd-media-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  background: rgba(0, 0, 0, 0.85);
}

.scd-media-modal[hidden] {
  display: none;
}

.scd-media-modal__overlay {
  position: absolute;
  inset: 0;
}

.scd-media-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(1000px, 100%);
}

.scd-media-modal__video {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}

.scd-media-modal__video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.scd-media-modal__title {
  margin: 16px 0 0;
  text-align: center;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
}

.scd-media-modal__close {
  position: absolute;
  top: -14px;
  right: -14px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #1f2937;
  color: #ffffff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.scd-media-modal__close:hover {
  background: #f97316;
}

.scd-media-modal__nav {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(31, 41, 55, 0.9);
  color: #ffffff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.scd-media-modal__nav:hover {
  background: #f97316;
}

@media (max-width: 640px) {
  .scd-media-wrapper {
    padding: 20px 16px;
  }

  .scd-media-modal {
    padding: 12px;
    gap: 4px;
  }

  .scd-media-modal__nav {
    width: 38px;
    height: 38px;
    font-size: 24px;
  }

  .scd-media-modal__close {
    top: -12px;
    right: -6px;
  }
}
