/* APFEL EXPERT — Auto-Synced YouTube Shorts & Video Insights Rail */

.yt-section {
  scroll-margin-top: var(--header-h);
  border-top: 1px solid var(--line);
}

.yt-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.yt-section__head > div:first-child {
  flex: 1 1 320px;
  min-width: 0;
}

.yt-section__sub {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--ink-muted);
}

.yt-section__controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.yt-channel-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  height: 36px;
  padding: 0 14px;
  font-size: 12.5px;
}

.yt-nav-arrows {
  display: flex;
  align-items: center;
  gap: 6px;
}

.yt-nav-arrows .slider-nav-btn {
  width: 36px;
  height: 36px;
}

.yt-rail {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.yt-rail::-webkit-scrollbar {
  display: none;
}

.yt-card {
  flex: 0 0 calc((100% - 48px) / 4);
  scroll-snap-align: start;
  cursor: pointer;
  position: relative;
  border: 1px solid var(--line);
  background: var(--graphite);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.yt-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
  z-index: 4;
}

.yt-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand-deep);
  box-shadow: 0 16px 32px -18px rgba(16, 20, 22, 0.45);
}

.yt-card:hover::before {
  transform: scaleX(1);
}

@media (max-width: 1060px) {
  .yt-card {
    flex: 0 0 calc((100% - 32px) / 3);
  }
}

@media (max-width: 720px) {
  .yt-section__head {
    gap: 10px;
  }
  .yt-section__sub {
    margin-top: 4px;
    font-size: 12.5px;
    line-height: 1.4;
  }
  .yt-channel-btn {
    height: 32px;
    padding: 0 12px;
    font-size: 12px;
  }
  .yt-rail {
    gap: 10px;
  }
  .yt-card {
    flex: 0 0 60%;
  }
  .yt-card__play {
    width: 44px;
    height: 44px;
  }
  .yt-card__bottom {
    left: 10px;
    right: 10px;
    bottom: 10px;
    gap: 4px;
  }
  .yt-card__title {
    font-size: 12.5px;
    line-height: 1.28;
  }
  .yt-nav-arrows {
    display: none;
  }
}

.yt-card__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: var(--graphite-deep);
}

.yt-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.yt-card:hover .yt-card__img {
  transform: scale(1.04);
}

.yt-card__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(16, 20, 22, 0.42) 0%, rgba(16, 20, 22, 0.05) 38%, rgba(16, 20, 22, 0.9) 100%);
  pointer-events: none;
}

.yt-card__top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 2;
}

.yt-card__badge {
  padding: 4px 8px;
  background: rgba(16, 20, 22, 0.85);
  border: 1px solid rgba(99, 175, 56, 0.55);
  color: var(--brand);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
}

.yt-card__views {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(16, 20, 22, 0.72);
  padding: 3px 7px;
}

.yt-card__play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 20, 22, 0.82);
  border: 1px solid rgba(99, 175, 56, 0.65);
  color: #ffffff;
  z-index: 2;
  transition: background 0.2s ease, transform 0.2s ease;
}

.yt-card:hover .yt-card__play {
  background: var(--brand-deep);
  transform: translate(-50%, -50%) scale(1.06);
}

.yt-card__date {
  padding: 4px 8px;
  background: rgba(16, 20, 22, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink-light);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.yt-card__bottom {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 2;
}

.yt-card__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.32;
  color: #ffffff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Modal Player Dialog (unified frame on all viewports) */
.yt-modal__dialog {
  position: relative;
  z-index: 2;
  width: min(400px, calc(100vw - 24px), calc((100dvh - 150px) * 9 / 16));
  background: var(--graphite);
  border: 1px solid var(--graphite-line);
  display: flex;
  flex-direction: column;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.55);
}

.yt-modal__dialog.is-landscape {
  width: min(880px, calc(100vw - 24px));
}

.yt-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 14px;
  border-bottom: 1px solid var(--graphite-line);
  background: var(--graphite-deep);
}

.yt-modal__head-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.yt-modal__head-sep {
  color: var(--graphite-line);
  flex-shrink: 0;
}

.yt-modal__counter {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.yt-modal__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-light-muted);
  letter-spacing: 0.02em;
  word-spacing: 0.08em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.yt-modal__tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.yt-modal__ext-btn,
.yt-modal__close {
  width: 32px;
  height: 32px;
}

.yt-modal__ext-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--graphite-soft);
  border: 1px solid var(--graphite-line);
  color: var(--brand);
  transition: background-color var(--transition), color var(--transition), border-color var(--transition);
}

.yt-modal__ext-btn:hover {
  background: var(--brand-deep);
  border-color: var(--brand);
  color: #ffffff;
}

.yt-modal__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #000000;
  overflow: hidden;
}

.yt-modal__dialog.is-landscape .yt-modal__stage {
  aspect-ratio: 16 / 9;
}

.yt-modal__stage iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.yt-modal__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: var(--graphite-deep);
  border-top: 1px solid var(--graphite-line);
}

.yt-modal__foot-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--graphite-soft);
  border: 1px solid var(--graphite-line);
  color: #ffffff;
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 500;
  transition: background-color var(--transition), border-color var(--transition);
}

.yt-modal__foot-btn:hover {
  background: var(--brand-deep);
  border-color: var(--brand);
}

.yt-modal__foot-idx {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-light-muted);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 720px) {
  .yt-modal__dialog {
    width: min(390px, calc(100vw - 24px), calc((100dvh - 160px) * 9 / 16));
  }
}
