/* ==========================================================================
   Video Carousel & Modal Component
   Tailored for dumitru.ca design tokens and dark/light mode
   ========================================================================== */

.carousel-section {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.carousel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.carousel-nav-buttons {
  display: flex;
  gap: 0.5rem;
}

.carousel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease-out;
}

.carousel-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.carousel-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.carousel-btn svg {
  width: 1rem;
  height: 1rem;
}

/* Constrain block body so grid items never blow out on mobile */
.block__body {
  min-width: 0;
  max-width: 100%;
}

/* Track / Scroll Container */
.carousel-track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: none; /* Firefox */
  padding-bottom: 0.5rem;
  margin: 0 -0.25rem;
  padding: 0.25rem;
  min-width: 0;
  cursor: grab;
}

.carousel-track.is-dragging {
  scroll-snap-type: none;
  cursor: grabbing;
}

.carousel-track::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

/* Slide Cards */
.carousel-card {
  flex: 0 0 16.5rem; /* ~264px */
  max-width: 80%;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 0.75rem;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1),
              box-shadow 0.2s cubic-bezier(0.2, 0.7, 0.2, 1),
              border-color 0.2s ease-out;
  position: relative;
  text-align: left;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.carousel-card:hover,
.carousel-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 12px hsl(28 25% 20% / 0.1);
  outline: none;
}

/* Media Thumbnail Container */
.carousel-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  pointer-events: none;
  -webkit-user-drag: none;
}

.carousel-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.3s ease;
}

.carousel-content,
.carousel-play-badge {
  pointer-events: none;
}

.carousel-card:hover .carousel-media img {
  transform: scale(1.03);
}

/* Custom Styled Media (for non-YouTube / external items like RE•WORK) */
.carousel-media--rework {
  background: linear-gradient(135deg, hsl(222 25% 18%) 0%, hsl(222 30% 9%) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.rework-logo {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #ffffff;
  text-transform: uppercase;
}

.rework-tag {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: hsl(195 90% 78%);
  background: hsl(195 72% 40% / 0.25);
  border: 1px solid hsl(195 72% 70% / 0.35);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}

/* Play Badge Overlay */
.carousel-play-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(0 0% 0% / 0.25);
  transition: background 0.2s ease;
}

.carousel-play-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: hsl(0 0% 0% / 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1.5px solid hsl(0 0% 100% / 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1), background 0.2s ease;
}

.carousel-play-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  margin-left: 2px; /* optical center */
  fill: currentColor;
}

.carousel-card:hover .carousel-play-badge {
  background: hsl(0 0% 0% / 0.15);
}

.carousel-card:hover .carousel-play-icon {
  transform: scale(1.12);
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

/* Card Content / Caption */
.carousel-content {
  padding: 0.875rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.carousel-title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.carousel-meta {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Pagination Dots */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.carousel-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  border: none;
  background: var(--rule);
  padding: 0;
  cursor: pointer;
  transition: all 0.2s ease;
}

.carousel-dot.is-active {
  background: var(--accent);
  width: 1.25rem;
  border-radius: 1rem;
}

/* ==========================================================================
   Modal Dialog
   ========================================================================== */

dialog.video-modal {
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 0.875rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 45px -10px hsl(0 0% 0% / 0.5);
  max-width: min(54rem, calc(100vw - 2rem));
  width: 100%;
  overflow: hidden;
}

dialog.video-modal::backdrop {
  background: hsl(0 0% 0% / 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--rule);
  gap: 1rem;
}

.modal-title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: none;
  background: var(--chip);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: var(--rule);
  color: var(--accent);
}

.modal-body {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.modal-body iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--rule);
  background: var(--surface);
}

.modal-external-link {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.modal-external-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Selected Papers with Figure Thumbnails
   ========================================================================== */

.papers-throughline {
  margin: 0 0 0.65rem;
  font-family: var(--font-sans);
  font-size: var(--step--1);
  line-height: 1.6;
  color: var(--text-muted);
}

.papers-throughline:last-of-type {
  margin-bottom: 1.4rem;
}

.papers-throughline .throughline-label,
.papers-throughline strong {
  font-weight: 600;
  color: var(--text);
}

.paper-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.paper-item {
  display: flex;
  align-items: flex-start;
  gap: 1.15rem;
  scroll-margin-top: 2rem;
  border-radius: 6px;
  padding: 0.25rem;
  margin: -0.25rem;
  transition: background-color 0.4s ease;
}

@keyframes target-glow {
  0% { background-color: var(--selection); }
  100% { background-color: transparent; }
}

.paper-item:target {
  animation: target-glow 1.8s ease-out;
}

.paper-thumb {
  flex-shrink: 0;
  width: 124px;
  aspect-ratio: 16 / 10;
  background: #ffffff;
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  box-sizing: border-box;
  text-decoration: none;
  transition: transform 0.18s cubic-bezier(0.2, 0.7, 0.2, 1),
              border-color 0.18s ease-out,
              box-shadow 0.18s ease-out;
}

@media (prefers-color-scheme: dark) {
  .paper-thumb {
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  }
}

.paper-item:hover .paper-thumb,
.paper-thumb:hover,
.paper-thumb:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  outline: none;
}

.paper-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.paper-info {
  flex: 1;
  min-width: 0;
  line-height: 1.55;
}

.paper-info em {
  display: inline-block;
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.92em;
  line-height: 1.45;
}

@media (max-width: 480px) {
  .paper-list {
    gap: 1.1rem;
  }
  .paper-item {
    gap: 0.85rem;
  }
  .paper-thumb {
    width: 96px;
    border-radius: 5px;
    padding: 3px;
  }
}

/* ==========================================================================
   Generative Video Showcase & Autoplaying Paper Loops
   ========================================================================== */

.video-showcase {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-top: 1.25rem;
  width: 100%;
}

.video-showcase__item {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1),
              box-shadow 0.2s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.video-showcase__item:hover,
.video-showcase__item:focus-visible {
  transform: translateY(-2px);
  outline: none;
}

.video-showcase__media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--rule);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.video-showcase__item:hover .video-showcase__media {
  border-color: var(--accent);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.video-showcase__media video,
.video-showcase__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-showcase__caption {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  margin-top: 0.4rem;
  text-align: center;
  transition: color 0.15s ease;
}

.video-showcase__item:hover .video-showcase__caption {
  color: var(--accent);
}

@media (max-width: 48rem) {
  .video-showcase {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
}

.paper-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 4px;
}

/* ==========================================================================
   Mentorship List
   ========================================================================== */

.mentee-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem 1.75rem;
  margin-top: 0.65rem;
}

@media (min-width: 34rem) {
  .mentee-list {
    grid-template-columns: 1fr 1fr;
  }
}

.mentee-list li {
  margin: 0;
  line-height: 1.45;
  font-size: var(--step--1);
}

.mentee-role {
  color: var(--text-muted);
}

/* Visitor Counter */

.visitor-counter {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  vertical-align: baseline;
}

.statcounter-wrap {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  padding: 1px 3px;
  background: #ffffff;
  border: 1px solid var(--rule);
  border-radius: 3px;
  line-height: 1;
}

.statcounter-wrap .statcounter,
.statcounter-wrap img {
  display: inline-block;
  vertical-align: middle;
  image-rendering: pixelated;
  height: 13px;
  width: auto;
}

.statcounter-wrap a {
  text-decoration: none !important;
  border-bottom: none !important;
  display: inline-flex;
  align-items: center;
}

@media (prefers-color-scheme: dark) {
  .statcounter-wrap {
    background: hsl(220 16% 15%);
    border-color: var(--rule);
  }

  .statcounter-wrap img {
    filter: invert(0.92);
  }
}



