/*
 Theme Name:  Mediumish Child
 Theme URI:   https://your-site.example
 Description: Child theme that injects a video player at the top of posts in the "Videos" category.
 Author:      You
 Template:    mediumish
 Version:     1.0.0
*/

/* Player wrapper (works with Presto, iframes, or native <video>) */
.apvg-player-wrap{
  max-width: 1100px;         /* change to match your page width if you want */
  margin: 0 auto 24px;       /* center + space under the player */
}
.apvg-player-wrap iframe,
.apvg-player-wrap video,
.apvg-player-wrap .presto-player,
.apvg-player-wrap .wp-block-video,
.apvg-player-wrap .presto-player__wrapper{
  width: 100%;
  display: block;
}
.apvg-player-wrap iframe,
.apvg-player-wrap video{
  height: auto;
  aspect-ratio: 16/9;        /* always nice 16:9 */
  background: #000;          /* avoids white flashes/letterbox */
  border-radius: 6px;        /* optional */
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}

/* Simple related grid */
.apvg-related-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:16px;
  margin-top: 8px;
}
@media (max-width: 900px){
  .apvg-related-grid{ grid-template-columns:repeat(2,1fr); }
}
@media (max-width: 600px){
  .apvg-related-grid{ grid-template-columns:1fr; }
}
.apvg-card{
  border:1px solid rgba(0,0,0,.08);
  border-radius:8px;
  overflow:hidden;
  text-decoration:none;
  background:#fff;
}
.apvg-thumb{
  position:relative;
  padding-top:56.25%;
  background:#111 center/cover no-repeat;
}
.apvg-title{
  padding:10px 12px;
  font-weight:600;
  line-height:1.35;
  display:-webkit-box;
  -webkit-line-clamp:3;
  -webkit-box-orient:vertical;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* ---------- Videos archive grid ---------- */
.mc-video-archive-grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:24px;
}
@media (max-width: 1024px){ .mc-video-archive-grid{ grid-template-columns:repeat(2,1fr) } }
@media (max-width: 640px){  .mc-video-archive-grid{ grid-template-columns:1fr } }

.mc-card{ display:block; border:1px solid rgba(0,0,0,.08); border-radius:2px; overflow:hidden; background:#fff; text-decoration:none }
.mc-thumb{ position:relative; padding-top:56.25%; background:#111 center/cover no-repeat }
.mc-play{ position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); pointer-events:none }
.mc-body{ padding:12px 14px }
.mc-title{ font-size:18px; font-weight:700; line-height:1.3; margin:0 0 6px }
.mc-meta{ color:#666; font-size:.9em }

/* ---------- Collapsed description on single video ---------- */
.mc-desc{
  position:relative;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  text-overflow:ellipsis;
}
.mc-desc.is-open{
  display:block;
  -webkit-line-clamp:unset;
  overflow:visible;
}

/* =========== Player on single video =========== */
.mc-player-wrap{
  max-width: 1100px;     /* match your site width if needed */
  margin: 0 auto 24px;   /* center + spacing */
}
.mc-player-wrap iframe,
.mc-player-wrap video,
.mc-player-wrap .presto-player,
.mc-player-wrap .wp-block-video,
.mc-player-wrap .presto-player__wrapper{
  width: 100%;
  display: block;
}
.mc-player-wrap iframe,
.mc-player-wrap video{
  height: auto;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.wp-block-video{ margin:0 }       /* kill extra WP figure spacing on theme */

/* =========== Videos archive grid (with hover preview) =========== */
.mc-video-archive-grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:24px;
}
@media (max-width: 1024px){ .mc-video-archive-grid{ grid-template-columns:repeat(2,1fr) } }
@media (max-width: 640px){  .mc-video-archive-grid{ grid-template-columns:1fr } }

.mc-card{
  display:block; border:1px solid rgba(0,0,0,.08);
  border-radius:2px; overflow:hidden; background:#fff; text-decoration:none;
}
.mc-thumb{
  position:relative; padding-top:56.25%;
  background:#111 center/cover no-repeat;
}
.mc-thumb video{
  position:absolute; inset:0; width:100%; height:100%;
  object-fit:cover; opacity:0; transition:opacity .18s ease;
}
.mc-thumb.is-playing video{ opacity:1 }

.mc-play{
  position:absolute; top:50%; left:50%; transform:translate(-50%,-50%);
  pointer-events:none;
}
.mc-body{ padding:12px 14px }
.mc-title{ font-size:18px; font-weight:700; line-height:1.3; margin:0 0 6px }
.mc-meta{ color:#666; font-size:.9em }

/* =========== Single video description (collapsed) =========== */
.mc-desc{
  position:relative; display:-webkit-box;
  -webkit-line-clamp:2; -webkit-box-orient:vertical;
  overflow:hidden; text-overflow:ellipsis;
}
.mc-desc.is-open{ display:block; -webkit-line-clamp:unset; overflow:visible }
/* ========== Kill Mediumish "hero/featured" wrappers on single video posts ========== */
.mc-video .entry-header,
.mc-video .post-cover,
.mc-video .post-media,
.mc-video .featured,
.mc-video .featured-image,
.mc-video .single-post-header,
.mc-video .post-top,
.mc-video .article-post > .post-media,
.mc-video .article-post > .featured,
.mc-video .article-post > .featured-image {
  display: none !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* If the theme prints a first title block, hide it (we render our own under the player) */
.mc-video h1.entry-title:first-of-type,
.mc-video .post-title {
  display: none !important;
}

/* Kill any pseudo top padding some themes add around video blocks */
.wp-block-video::before { content: none !important; }

/* ========== Player sizing ========== */
/* General wrapper: center and cap max width so portrait videos aren't oversized */
.mc-player-wrap{
  max-width: 900px;       /* adjust to taste (700–900px looks great on Mediumish) */
  margin: 0 auto 24px;
}

/* Native <video> and Presto iframe inside the wrapper */
.mc-player-wrap iframe,
.mc-player-wrap video{
  width: 100%;
  height: auto;
  max-height: 70vh;       /* don't exceed viewport height on desktops */
  aspect-ratio: 16 / 9;   /* a sensible default */
  object-fit: contain;    /* so portrait videos aren't cropped */
  background: #000;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
}

/* Slightly narrower cap for very wide screens */
@media (min-width: 1400px){
  .mc-player-wrap{ max-width: 820px; }
}

/* Tablets/phones: let it go full width */
@media (max-width: 992px){
  .mc-player-wrap{ max-width: 100%; }
}

/* YouTube-like collapsed description */
.mc-desc{
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  text-overflow:ellipsis;
}
.mc-desc.is-open{
  display:block;
  -webkit-line-clamp:unset;
  overflow:visible;
}

/* Increase height of related video cards */
.apvg-related-grid .apvg-thumb {
  padding-top: 75%; /* was 56.25%, increase for taller thumbs */
}

.apvg-related-grid .apvg-card {
  min-height: 240px; /* increase overall card height */
}

.apvg-related-grid .apvg-title {
  font-size: 14px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;   /* was 2 */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: calc(1.4em * 3); /* ensure height for 3 lines */
}


