/* =========================================================
   UniSST V240 — PADRÃO GLOBAL ÚNICO DOS CARDS ACADÊMICOS
   Autorização explícita do proprietário em 08/09/2026.

   Padrão obrigatório antes e depois do login:
   - horizontal: baseline V215/V220, 16:9, 4 por fileira no desktop;
     em 1366px = ~319,19 x 179,53px; hover/foco = scale(1.025)
     (~327,17 x 184,02px), sem exceção de 120%;
   - vertical/poster: baseline V215/V220, 2:3;
     em 1366px = ~319,19 x 478,78px; super-preview cresce somente
     na largura e mantém exatamente a altura da fileira;
   - Home pública, Home autenticada, Cursos, Assinaturas, Playlist,
     Aprendizado, relacionados, catálogo e novas vitrines acadêmicas
     herdam a mesma geometria/efeito.
   - mobile/touch preserva a responsividade existente e não cria hover.
   ========================================================= */

:root{
  --v240-hover-scale:1.025;
  --v240-gap:var(--v225-rail-gap,24px);
}

@media (min-width:900px){
  /* Reverte definitivamente as exceções V237/V238/V239 da Home/Assinaturas. */
  html body.streaming-system-v220 [data-v239-home-card-contract] .v217-landscape-section{
    --v239-card-w:var(--pv-card-w)!important;
    --v239-card-h:var(--pv-card-h)!important;
    min-height:auto!important;
  }
  html body.streaming-system-v220 [data-v239-home-card-contract] .v217-poster-section{
    --v239-poster-w:var(--pv-poster-w)!important;
    --v239-poster-h:var(--pv-poster-h)!important;
    min-height:auto!important;
  }

  html body.streaming-system-v220 [data-v239-home-card-contract] .v217-course-rail,
  html body.streaming-system-v220.public-home-v198.public-guest .uv198-public-rails .v217-course-rail,
  html body.streaming-system-v220.public-home-v198.public-guest .pv-public-rails .v217-course-rail{
    display:flex!important;
    flex-flow:row nowrap!important;
    align-items:flex-start!important;
    gap:var(--v240-gap)!important;
    column-gap:var(--v240-gap)!important;
    padding:0 0 4px!important;
    overflow-x:auto!important;
    overflow-y:visible!important;
  }

  html body.streaming-system-v220 [data-v239-home-card-contract] .v217-landscape-section .v217-course-rail,
  html body.streaming-system-v220.public-home-v198.public-guest .v217-landscape-section .v217-course-rail{
    grid-auto-columns:var(--pv-card-w)!important;
  }
  html body.streaming-system-v220 [data-v239-home-card-contract] .v217-poster-section .v217-course-rail,
  html body.streaming-system-v220.public-home-v198.public-guest .v217-poster-section .v217-course-rail{
    grid-auto-columns:var(--pv-poster-w)!important;
  }

  /* Horizontal único: mesma baseline da página Cursos autenticada. */
  html body.streaming-system-v220 a[data-course-preview="1"].v220-reference-card.v220-landscape-card:not(.v220-grid-card){
    flex:0 0 var(--pv-card-w)!important;
    flex-basis:var(--pv-card-w)!important;
    width:var(--pv-card-w)!important;
    min-width:var(--pv-card-w)!important;
    max-width:var(--pv-card-w)!important;
    height:var(--pv-card-h)!important;
    min-height:var(--pv-card-h)!important;
    max-height:var(--pv-card-h)!important;
    aspect-ratio:16/9!important;
    transform-origin:center center!important;
  }

  /* Vertical único: tamanho cheio 2:3 em todas as páginas. */
  html body.streaming-system-v220 a[data-course-preview="1"].v220-reference-card.v220-poster-card:not(.v220-grid-card){
    flex:0 0 var(--pv-poster-w)!important;
    flex-basis:var(--pv-poster-w)!important;
    width:var(--pv-poster-w)!important;
    min-width:var(--pv-poster-w)!important;
    max-width:var(--pv-poster-w)!important;
    height:var(--pv-poster-h)!important;
    min-height:var(--pv-poster-h)!important;
    max-height:var(--pv-poster-h)!important;
    aspect-ratio:2/3!important;
    transform-origin:left center!important;
  }

  /* Setas sempre seguem o tamanho NORMAL, nunca hover/super-preview. */
  html body.streaming-system-v220 .v217-landscape-section .v217-rail-shell>.rail-arrow,
  html body.streaming-system-v220 [data-v239-home-card-contract] .v217-landscape-section .v217-rail-shell>.rail-arrow{
    top:0!important;
    bottom:auto!important;
    height:var(--pv-card-h)!important;
    min-height:var(--pv-card-h)!important;
    max-height:var(--pv-card-h)!important;
    transform:none!important;
  }
  html body.streaming-system-v220 .v217-poster-section .v217-rail-shell>.rail-arrow,
  html body.streaming-system-v220 [data-v239-home-card-contract] .v217-poster-section .v217-rail-shell>.rail-arrow{
    top:0!important;
    bottom:auto!important;
    height:var(--pv-poster-h)!important;
    min-height:var(--pv-poster-h)!important;
    max-height:var(--pv-poster-h)!important;
    transform:none!important;
  }
}

@media (min-width:900px) and (hover:hover) and (pointer:fine){
  /* Hover horizontal global: exatamente +2,5%. */
  html body.streaming-system-v220 a[data-course-preview="1"].v220-reference-card.v220-landscape-card:is(:hover,:focus-visible,.preview-pending,.preview-active){
    transform:scale(var(--v240-hover-scale))!important;
    z-index:70!important;
    filter:brightness(1.04)!important;
    box-shadow:0 12px 26px rgba(0,0,0,.48)!important;
  }

  /* Remove a exceção V239 que congelava a mídia no hover a 120%; volta ao
     mesmo tratamento audiovisual já usado pelos cards de Cursos. */
  html body.streaming-system-v220 [data-v239-home-card-contract]
  a[data-course-preview="1"].v220-reference-card.v220-landscape-card:is(:hover,:focus-visible,.preview-pending,.preview-active)
  :is(.card-img,.featured-preview-art,.ranked-course-art,.course-playlist-art,.pv205-card-media,.pv203-title-card-media,.v220-reference-art){
    transform:scale(1.022)!important;
  }

  /* Super-preview vertical: cresce apenas para a direita; altura fica fixa. */
  html body.streaming-system-v220:is(.prime-v086,.prime-public-v086)
  a[data-course-preview="1"].v220-reference-card.v220-poster-card.prime-poster-card.pv-super-focus-active{
    --v240-focus-h:var(--pv-poster-h);
    --v240-focus-w:min(calc(var(--v240-focus-h) * 1.60),calc(100vw - 56px));
    flex:0 0 var(--v240-focus-w)!important;
    flex-basis:var(--v240-focus-w)!important;
    width:var(--v240-focus-w)!important;
    min-width:var(--v240-focus-w)!important;
    max-width:var(--v240-focus-w)!important;
    height:var(--v240-focus-h)!important;
    min-height:var(--v240-focus-h)!important;
    max-height:var(--v240-focus-h)!important;
    aspect-ratio:auto!important;
    margin:0!important;
    transform:none!important;
    transform-origin:left center!important;
    z-index:75!important;
    box-shadow:0 12px 26px rgba(0,0,0,.48)!important;
  }
}

/* Grades mantêm a largura fluida da coluna, mas sempre com as proporções globais. */
html body.streaming-system-v220 a.v220-reference-card.v220-grid-card.v220-landscape-card{aspect-ratio:16/9!important}
html body.streaming-system-v220 a.v220-reference-card.v220-grid-card.v220-poster-card{aspect-ratio:2/3!important}

@media (max-width:899px), (hover:none), (pointer:coarse){
  html body.streaming-system-v220 a[data-course-preview="1"].v220-reference-card{
    transform:none!important;
    box-shadow:none!important;
  }
}

/* =========================================================
   V240 — reforço de especificidade contra exceções históricas V237/V238/V239.
   Estas regras ficam no final propositalmente: a V240 é a camada autoritativa.
   ========================================================= */
@media (min-width:900px){
  html body.streaming-system-v220.public-home-v198.public-guest .v217-landscape-section .v217-course-rail >
  a[data-course-preview="1"].v220-reference-card.v220-landscape-card:not(.v220-grid-card),
  html body.streaming-system-v220 [data-v239-home-card-contract] .v217-landscape-section .v217-course-rail >
  a[data-course-preview="1"].v220-reference-card.v220-landscape-card:not(.v220-grid-card){
    flex:0 0 var(--pv-card-w)!important;
    flex-basis:var(--pv-card-w)!important;
    width:var(--pv-card-w)!important;
    min-width:var(--pv-card-w)!important;
    max-width:var(--pv-card-w)!important;
    height:var(--pv-card-h)!important;
    min-height:var(--pv-card-h)!important;
    max-height:var(--pv-card-h)!important;
    aspect-ratio:16/9!important;
    transform-origin:center center!important;
  }

  html body.streaming-system-v220.public-home-v198.public-guest .v217-poster-section .v217-course-rail >
  a[data-course-preview="1"].v220-reference-card.v220-poster-card:not(.v220-grid-card),
  html body.streaming-system-v220 [data-v239-home-card-contract] .v217-poster-section .v217-course-rail >
  a[data-course-preview="1"].v220-reference-card.v220-poster-card:not(.v220-grid-card){
    flex:0 0 var(--pv-poster-w)!important;
    flex-basis:var(--pv-poster-w)!important;
    width:var(--pv-poster-w)!important;
    min-width:var(--pv-poster-w)!important;
    max-width:var(--pv-poster-w)!important;
    height:var(--pv-poster-h)!important;
    min-height:var(--pv-poster-h)!important;
    max-height:var(--pv-poster-h)!important;
    aspect-ratio:2/3!important;
    transform-origin:left center!important;
  }
}

@media (min-width:900px) and (hover:hover) and (pointer:fine){
  html body.streaming-system-v220.public-home-v198.public-guest .v217-landscape-section
  a[data-course-preview="1"].v220-reference-card.v220-landscape-card:not(.v220-grid-card):is(:hover,:focus-visible,.preview-pending,.preview-active),
  html body.streaming-system-v220 [data-v239-home-card-contract] .v217-landscape-section
  a[data-course-preview="1"].v220-reference-card.v220-landscape-card:not(.v220-grid-card):is(:hover,:focus-visible,.preview-pending,.preview-active){
    transform:scale(1.025)!important;
    z-index:70!important;
    filter:brightness(1.04)!important;
    box-shadow:0 12px 26px rgba(0,0,0,.48)!important;
  }

  html body.streaming-system-v220.public-home-v198.public-guest .v217-landscape-section
  a[data-course-preview="1"].v220-reference-card.v220-landscape-card:not(.v220-grid-card):is(:hover,:focus-visible,.preview-pending,.preview-active)
  :is(.card-img,.featured-preview-art,.ranked-course-art,.course-playlist-art,.pv205-card-media,.pv203-title-card-media,.v220-reference-art),
  html body.streaming-system-v220 [data-v239-home-card-contract] .v217-landscape-section
  a[data-course-preview="1"].v220-reference-card.v220-landscape-card:not(.v220-grid-card):is(:hover,:focus-visible,.preview-pending,.preview-active)
  :is(.card-img,.featured-preview-art,.ranked-course-art,.course-playlist-art,.pv205-card-media,.pv203-title-card-media,.v220-reference-art){
    transform:scale(1.022)!important;
  }

  html body.streaming-system-v220.public-home-v198.public-guest:is(.prime-v086,.prime-public-v086)
  a[data-course-preview="1"].v220-reference-card.v220-poster-card.prime-poster-card.pv-super-focus-active,
  html body.streaming-system-v220:is(.prime-v086,.prime-public-v086) [data-v239-home-card-contract]
  a[data-course-preview="1"].v220-reference-card.v220-poster-card.prime-poster-card.pv-super-focus-active{
    --v225-focus-h:var(--pv-poster-h)!important;
    --v225-focus-w:min(calc(var(--pv-poster-h) * 1.60),calc(100vw - 56px))!important;
    --v240-focus-h:var(--pv-poster-h)!important;
    --v240-focus-w:min(calc(var(--pv-poster-h) * 1.60),calc(100vw - 56px))!important;
    flex:0 0 var(--v240-focus-w)!important;
    flex-basis:var(--v240-focus-w)!important;
    width:var(--v240-focus-w)!important;
    min-width:var(--v240-focus-w)!important;
    max-width:var(--v240-focus-w)!important;
    height:var(--pv-poster-h)!important;
    min-height:var(--pv-poster-h)!important;
    max-height:var(--pv-poster-h)!important;
    aspect-ratio:auto!important;
    transform:none!important;
    transform-origin:left center!important;
  }
}
