/* =====================================================================
   Shorts — YouTube-style vertical grid + fullscreen swipe player
   ===================================================================== */

/* ---------------------------------------------------------------- Grid --- */
.shorts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-6) var(--sp-5);
}

@media (max-width: 520px) {
  .shorts-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-4) var(--sp-3);
  }
}

.short-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--color-text);
}

.short-card__media {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: var(--radius-lg, 14px);
  overflow: hidden;
  background: var(--color-surface-muted, #e9e9e6);
  transition: transform var(--dur-fast, .15s) var(--ease-out, ease);
}

.short-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.short-card:hover .short-card__media {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md, 0 10px 30px rgba(0, 0, 0, .18));
}

.short-card__play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(0, 0, 0, .55);
  border-radius: 50%;
  opacity: 0;
  transform: scale(.8);
  transition: opacity var(--dur-fast, .15s) var(--ease-out, ease),
    transform var(--dur-fast, .15s) var(--ease-out, ease);
  pointer-events: none;
}

.short-card__play svg {
  margin-left: 3px;
}

.short-card:hover .short-card__play,
.short-card:focus-visible .short-card__play {
  opacity: 1;
  transform: scale(1);
}

.short-card__body {
  padding: var(--sp-2) 2px 0;
}

.short-card__title {
  font-size: var(--fs-sm, .92rem);
  font-weight: var(--fw-semibold, 600);
  line-height: 1.3;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.short-card__date {
  margin: 4px 0 0;
  font-size: var(--fs-xs, .78rem);
  color: var(--color-text-subtle, #6b6b6b);
}

/* Vertical embed on the deep-link / no-JS article fallback page */
.short-embed {
  aspect-ratio: 9 / 16 !important;
  max-width: min(420px, 92vw);
  margin-inline: auto;
}

/* ------------------------------------------------------------- Player --- */
.shorts-player {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vw, 28px);
  background: rgba(8, 8, 8, .92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease;
}

.shorts-player.is-open {
  opacity: 1;
  visibility: visible;
}

.shorts-no-scroll {
  overflow: hidden !important;
}

.shorts-player__stage {
  position: relative;
  aspect-ratio: 9 / 16;
  height: min(92dvh, 950px);
  max-width: 96vw;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
  flex: 0 0 auto;
}

.shorts-player__stage::before {
  /* poster shown during the brief iframe load, killed once .is-playing */
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--poster, none);
  background-size: cover;
  background-position: center;
  filter: brightness(.7);
}

.shorts-player__stage.is-playing::before {
  display: none;
}

.shorts-player__stage iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* fade between shorts on navigate */
.shorts-player__stage.is-switching {
  opacity: 0;
  transition: opacity .12s ease;
}

/* Right-hand action rail (desktop beside the video, mobile overlaid) */
.shorts-player__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-4);
  color: #fff;
  z-index: 2;
}

.shorts-player__action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: .72rem;
  text-decoration: none;
}

.shorts-player__action .icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  transition: background .15s ease;
}

.shorts-player__action:hover .icon {
  background: rgba(255, 255, 255, .28);
}

/* Up / down navigation chevrons (desktop) */
.shorts-player__nav {
  position: fixed;
  right: clamp(12px, 3vw, 40px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 3;
}

.shorts-player__chev {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, opacity .15s ease;
}

.shorts-player__chev:hover {
  background: rgba(255, 255, 255, .3);
}

.shorts-player__chev[disabled] {
  opacity: .25;
  cursor: default;
}

.shorts-player__close {
  position: fixed;
  top: clamp(10px, 2vw, 22px);
  left: clamp(10px, 2vw, 22px);
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
  transition: background .15s ease;
}

.shorts-player__close:hover {
  background: rgba(255, 255, 255, .3);
}

.shorts-player__copied {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #fff;
  color: #111;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 5;
}

.shorts-player__copied.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ----------------------------------------------------------- Mobile --- */
@media (max-width: 700px) {
  .shorts-player {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: #000;
  }

  .shorts-player__stage {
    height: auto;
    width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }

  /* The native YouTube iframe already shows share and "watch on YouTube" —
     so on phones we drop our duplicate action rail to avoid overlapping the
     embed's own controls. */
  .shorts-player__actions {
    display: none;
  }

  /* Hide desktop chevrons; navigation is by swipe */
  .shorts-player__nav {
    display: none;
  }
}

@media (hover: none) and (pointer: coarse) {
  .short-card__play {
    opacity: 1;
    transform: scale(1);
    width: 46px;
    height: 46px;
  }
}
