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

   Objetivo:
   - uma única geometria em TODAS as vitrines, antes/depois do login;
   - referência desktop 1366px: horizontal ~319,19x179,53 (16:9),
     vertical ~319,19x478,78 (2:3);
   - responsividade preservada: a largura é recalculada pela viewport;
   - nenhuma camada legada (V115/V221/V237/V238/V239) pode manter 276px,
     reduzir pôster a 80% ou criar outra escala por página;
   - hover horizontal +2,5%; vertical abre somente na largura, mantendo altura.
   ========================================================= */

:root{
  --v241-hover-scale:1.025;
  --v241-gap:clamp(14px,1.25vw,20px);
}

/* -------------------------------------------------------------------------
   1) FONTE ÚNICA DE VERDADE — DESKTOP
   Reutiliza a matemática responsiva 4-up da baseline V215, mas em variáveis
   próprias e depois replica o resultado para TODOS os aliases históricos.
   ------------------------------------------------------------------------- */
@media (min-width:900px){
  html body:is(.prime-v086,.prime-public-v086){
    --v241-card-w:calc((100vw - var(--pv-gutter) - var(--pv-right-pad) - var(--v241-gap) - var(--v241-gap) - var(--v241-gap))/4);
    --v241-card-h:calc(var(--v241-card-w) * .5625);
    --v241-poster-w:var(--v241-card-w);
    --v241-poster-h:calc(var(--v241-poster-w) * 1.5);
    --v241-super-w:min(calc(var(--v241-poster-h) * 1.60),calc(100vw - 56px));

    /* aliases atuais */
    --pv-rail-gap:var(--v241-gap)!important;
    --pv-card-w:var(--v241-card-w)!important;
    --pv-card-h:var(--v241-card-h)!important;
    --pv-poster-w:var(--v241-poster-w)!important;
    --pv-poster-h:var(--v241-poster-h)!important;

    /* aliases V115/V112 */
    --u112-card-w:var(--v241-card-w)!important;
    --u112-card-h:var(--v241-card-h)!important;
    --u112-poster-w:var(--v241-poster-w)!important;
    --u112-poster-h:var(--v241-poster-h)!important;
    --pv-super-focus-w:var(--v241-super-w)!important;

    /* aliases V205/V215 */
    --v215-pv205-card-w:var(--v241-card-w)!important;

    /* aliases de exceções posteriores que não podem mais divergir */
    --v221-poster-w:var(--v241-poster-w)!important;
    --v221-poster-h:var(--v241-poster-h)!important;
    --v221-card-gap:var(--v241-gap)!important;
    --uv237-card-w:var(--v241-card-w)!important;
    --uv237-card-h:var(--v241-card-h)!important;
    --uv237-poster-w:var(--v241-poster-w)!important;
    --uv237-poster-h:var(--v241-poster-h)!important;
    --uv238-card-w:var(--v241-card-w)!important;
    --uv238-card-h:var(--v241-card-h)!important;
    --v239-card-w:var(--v241-card-w)!important;
    --v239-card-h:var(--v241-card-h)!important;
    --v239-poster-w:var(--v241-poster-w)!important;
    --v239-poster-h:var(--v241-poster-h)!important;
    --v225-focus-h:var(--v241-poster-h)!important;
    --v225-focus-w:var(--v241-super-w)!important;
    --v240-focus-h:var(--v241-poster-h)!important;
    --v240-focus-w:var(--v241-super-w)!important;
  }

  /* V115 redefine variáveis dentro destes containers; V241 sobrescreve no
     MESMO escopo para impedir que Home logada/pública volte a 276x155. */
  html body.prime-v086.authenticated-home-page .v078-reference-home,
  html body.prime-public-v086 .pv-public-showcase,
  html body.streaming-system-v220 [data-v239-home-card-contract]{
    --u112-card-w:var(--v241-card-w)!important;
    --u112-card-h:var(--v241-card-h)!important;
    --u112-poster-w:var(--v241-poster-w)!important;
    --u112-poster-h:var(--v241-poster-h)!important;
    --pv-card-w:var(--v241-card-w)!important;
    --pv-card-h:var(--v241-card-h)!important;
    --pv-poster-w:var(--v241-poster-w)!important;
    --pv-poster-h:var(--v241-poster-h)!important;
    --pv-super-focus-w:var(--v241-super-w)!important;
    --uv237-card-w:var(--v241-card-w)!important;
    --uv237-card-h:var(--v241-card-h)!important;
    --uv237-poster-w:var(--v241-poster-w)!important;
    --uv237-poster-h:var(--v241-poster-h)!important;
    --uv238-card-w:var(--v241-card-w)!important;
    --uv238-card-h:var(--v241-card-h)!important;
    --v239-card-w:var(--v241-card-w)!important;
    --v239-card-h:var(--v241-card-h)!important;
    --v239-poster-w:var(--v241-poster-w)!important;
    --v239-poster-h:var(--v241-poster-h)!important;
  }

  /* Trilhos acadêmicos usam um único gap. Não importa se vieram da Home,
     Cursos, Assinaturas, Playlist, Aprendizado ou componentes V203/V205. */
  html body.streaming-system-v220 :is(
    .course-rail,.public-course-rail,.v217-course-rail,
    .pv205-card-rail,.pv203-card-rail,.learning-course-rail,.related-courses
  ){
    gap:var(--v241-gap)!important;
    column-gap:var(--v241-gap)!important;
    align-items:flex-start!important;
  }

  /* Horizontal: tamanho global responsivo. O seletor v220 é a regra moderna;
     os seletores legados abaixo garantem o mesmo antes mesmo do JS normalizar. */
  html body.streaming-system-v220 a[data-course-preview="1"].v220-reference-card.v220-landscape-card:not(.v220-grid-card),
  html body.prime-v086.authenticated-home-page .v078-reference-home a.reference-landscape-card,
  html body.prime-v086.authenticated-home-page .v078-reference-home .reference-standard-rail a.course-card,
  html body.prime-public-v086 .pv-public-landscape-rail .pv-public-course-card,
  html body.prime-experience-v205 .pv205-card-rail>a.pv205-title-card,
  html body.prime-experience-v205 .pv203-card-rail>a.pv203-title-card{
    flex:0 0 var(--v241-card-w)!important;
    flex-basis:var(--v241-card-w)!important;
    width:var(--v241-card-w)!important;
    min-width:var(--v241-card-w)!important;
    max-width:var(--v241-card-w)!important;
    height:var(--v241-card-h)!important;
    min-height:var(--v241-card-h)!important;
    max-height:var(--v241-card-h)!important;
    aspect-ratio:16/9!important;
    box-sizing:border-box!important;
  }

  /* V205 guarda a mídia em um span; ele precisa ocupar todo o box padrão. */
  html body.prime-experience-v205 :is(.pv205-card-rail,.pv203-card-rail)>a[data-course-preview="1"] :is(.pv205-card-media,.pv203-title-card-media){
    position:absolute!important;
    inset:0!important;
    width:100%!important;
    height:100%!important;
    min-height:0!important;
    max-height:none!important;
    aspect-ratio:auto!important;
    border-radius:inherit!important;
    overflow:hidden!important;
  }

  /* Vertical: mesma largura base do horizontal e altura 2:3. */
  html body.streaming-system-v220 a[data-course-preview="1"].v220-reference-card.v220-poster-card:not(.v220-grid-card),
  html body.prime-v086.authenticated-home-page .v078-reference-home .reference-poster-rail>a,
  html body.prime-v086.authenticated-home-page .v078-reference-home a.prime-poster-card,
  html body.prime-v086.authenticated-home-page .v078-reference-home a.featured-preview-card,
  html body.prime-public-v086 .pv-public-poster-rail .pv-public-course-card{
    flex:0 0 var(--v241-poster-w)!important;
    flex-basis:var(--v241-poster-w)!important;
    width:var(--v241-poster-w)!important;
    min-width:var(--v241-poster-w)!important;
    max-width:var(--v241-poster-w)!important;
    height:var(--v241-poster-h)!important;
    min-height:var(--v241-poster-h)!important;
    max-height:var(--v241-poster-h)!important;
    aspect-ratio:2/3!important;
    box-sizing:border-box!important;
  }

  /* Altura das fileiras/setas sempre usa o tamanho normal, nunca o preview. */
  html body.streaming-system-v220 .v217-landscape-section{min-height:calc(var(--v241-card-h) + 62px)!important}
  html body.streaming-system-v220 .v217-poster-section{min-height:calc(var(--v241-poster-h) + 62px)!important}
  html body.streaming-system-v220 .v217-landscape-section .v217-rail-shell>.rail-arrow,
  html body.streaming-system-v220 .rail-shell>.rail-arrow{
    height:var(--v241-card-h)!important;
    min-height:var(--v241-card-h)!important;
    max-height:var(--v241-card-h)!important;
  }
  html body.streaming-system-v220 .v217-poster-section .v217-rail-shell>.rail-arrow,
  html body.streaming-system-v220 .rail-shell:has([data-v220-rail-orientation="poster"])>.rail-arrow,
  html body.streaming-system-v220 .rail-shell:has(.reference-poster-rail)>.rail-arrow{
    height:var(--v241-poster-h)!important;
    min-height:var(--v241-poster-h)!important;
    max-height:var(--v241-poster-h)!important;
  }

  /* Grade acadêmica: quatro colunas no desktop, mantendo 16:9/2:3.
     A largura da coluna continua responsiva ao container, mas a geometria
     visual nunca muda de proporção. */
  html body.streaming-system-v220 :is(.catalog-grid,.prime-catalog-grid,.catalog-20-grid,.catalog-24-grid,.library-page .catalog-grid){
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    gap:var(--v241-gap)!important;
    align-items:start!important;
  }
  html body.streaming-system-v220 a.v220-reference-card.v220-grid-card.v220-landscape-card{
    width:100%!important;min-width:0!important;max-width:none!important;
    height:auto!important;min-height:0!important;max-height:none!important;
    aspect-ratio:16/9!important;
  }
  html body.streaming-system-v220 a.v220-reference-card.v220-grid-card.v220-poster-card{
    width:100%!important;min-width:0!important;max-width:none!important;
    height:auto!important;min-height:0!important;max-height:none!important;
    aspect-ratio:2/3!important;
  }

  /* Playlist pessoal: quatro itens responsivos e mídia 16:9, sem voltar ao
     layout horizontal antigo de texto. */
  html body.streaming-system-v220 .course-playlist-grid{
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    gap:var(--v241-gap)!important;
    align-items:start!important;
  }
}

/* -------------------------------------------------------------------------
   2) INTERAÇÃO DESKTOP — UMA ÚNICA REGRA
   ------------------------------------------------------------------------- */
@media (min-width:900px) and (hover:hover) and (pointer:fine){
  html body.streaming-system-v220 a[data-course-preview="1"].v220-reference-card.v220-landscape-card:is(:hover,:focus-visible,.preview-pending,.preview-active),
  html body.prime-v086.authenticated-home-page .v078-reference-home a.reference-landscape-card:is(:hover,:focus-visible),
  html body.prime-public-v086 .pv-public-landscape-rail .pv-public-course-card:is(:hover,:focus-visible),
  html body.prime-experience-v205 :is(.pv205-card-rail,.pv203-card-rail)>a[data-course-preview="1"]:is(:hover,:focus-visible){
    transform:scale(var(--v241-hover-scale))!important;
    z-index:70!important;
    filter:brightness(1.04)!important;
    box-shadow:0 12px 26px rgba(0,0,0,.48)!important;
  }

  /* Pôster: repouso nunca ganha scale. Super-preview cresce só na largura. */
  html body.streaming-system-v220 a[data-course-preview="1"].v220-reference-card.v220-poster-card:is(:hover,:focus-visible,.preview-pending){
    transform:none!important;
  }
  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{
    --v241-focus-h:var(--v241-poster-h);
    --v241-focus-w:var(--v241-super-w);
    flex:0 0 var(--v241-focus-w)!important;
    flex-basis:var(--v241-focus-w)!important;
    width:var(--v241-focus-w)!important;
    min-width:var(--v241-focus-w)!important;
    max-width:var(--v241-focus-w)!important;
    height:var(--v241-focus-h)!important;
    min-height:var(--v241-focus-h)!important;
    max-height:var(--v241-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;
  }
}

/* -------------------------------------------------------------------------
   3) TABLET/MOBILE — RESPONSIVIDADE PRESERVADA E IDÊNTICA EM TODAS AS ABAS
   ------------------------------------------------------------------------- */
@media (max-width:899px){
  html body:is(.prime-v086,.prime-public-v086){
    --v241-card-w:min(70vw,420px);
    --v241-card-h:calc(var(--v241-card-w) * .5625);
    --v241-poster-w:min(42vw,270px);
    --v241-poster-h:calc(var(--v241-poster-w) * 1.5);
    --pv-card-w:var(--v241-card-w)!important;
    --pv-card-h:var(--v241-card-h)!important;
    --pv-poster-w:var(--v241-poster-w)!important;
    --pv-poster-h:var(--v241-poster-h)!important;
    --u112-card-w:var(--v241-card-w)!important;
    --u112-card-h:var(--v241-card-h)!important;
    --u112-poster-w:var(--v241-poster-w)!important;
    --u112-poster-h:var(--v241-poster-h)!important;
    --v215-pv205-card-w:var(--v241-card-w)!important;
  }

  html body.prime-v086.authenticated-home-page .v078-reference-home,
  html body.prime-public-v086 .pv-public-showcase,
  html body.streaming-system-v220 [data-v239-home-card-contract]{
    --u112-card-w:var(--v241-card-w)!important;
    --u112-card-h:var(--v241-card-h)!important;
    --u112-poster-w:var(--v241-poster-w)!important;
    --u112-poster-h:var(--v241-poster-h)!important;
    --pv-card-w:var(--v241-card-w)!important;
    --pv-card-h:var(--v241-card-h)!important;
    --pv-poster-w:var(--v241-poster-w)!important;
    --pv-poster-h:var(--v241-poster-h)!important;
  }

  html body.streaming-system-v220 a[data-course-preview="1"].v220-reference-card.v220-landscape-card:not(.v220-grid-card),
  html body.prime-v086.authenticated-home-page .v078-reference-home a.reference-landscape-card,
  html body.prime-v086.authenticated-home-page .v078-reference-home .reference-standard-rail a.course-card,
  html body.prime-public-v086 .pv-public-landscape-rail .pv-public-course-card,
  html body.prime-experience-v205 :is(.pv205-card-rail,.pv203-card-rail)>a[data-course-preview="1"]{
    flex:0 0 var(--v241-card-w)!important;
    flex-basis:var(--v241-card-w)!important;
    width:var(--v241-card-w)!important;
    min-width:var(--v241-card-w)!important;
    max-width:var(--v241-card-w)!important;
    height:var(--v241-card-h)!important;
    min-height:var(--v241-card-h)!important;
    max-height:var(--v241-card-h)!important;
    aspect-ratio:16/9!important;
    transform:none!important;
    box-shadow:none!important;
  }

  html body.streaming-system-v220 a[data-course-preview="1"].v220-reference-card.v220-poster-card:not(.v220-grid-card),
  html body.prime-v086.authenticated-home-page .v078-reference-home .reference-poster-rail>a,
  html body.prime-v086.authenticated-home-page .v078-reference-home a.prime-poster-card,
  html body.prime-public-v086 .pv-public-poster-rail .pv-public-course-card{
    flex:0 0 var(--v241-poster-w)!important;
    flex-basis:var(--v241-poster-w)!important;
    width:var(--v241-poster-w)!important;
    min-width:var(--v241-poster-w)!important;
    max-width:var(--v241-poster-w)!important;
    height:var(--v241-poster-h)!important;
    min-height:var(--v241-poster-h)!important;
    max-height:var(--v241-poster-h)!important;
    aspect-ratio:2/3!important;
    transform:none!important;
    box-shadow:none!important;
  }

  html body.streaming-system-v220 :is(.catalog-grid,.prime-catalog-grid,.catalog-20-grid,.catalog-24-grid,.library-page .catalog-grid){
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  html body.streaming-system-v220 .course-playlist-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  html body.streaming-system-v220 .rail-shell>.rail-arrow,
  html body.prime-experience-v205 .pv205-rail-shell>.rail-arrow{display:none!important}
}

@media (max-width:520px){
  html body.streaming-system-v220 :is(.catalog-grid,.prime-catalog-grid,.catalog-20-grid,.catalog-24-grid,.library-page .catalog-grid){
    grid-template-columns:1fr!important;
  }
  html body.streaming-system-v220 .course-playlist-grid{grid-template-columns:1fr!important}
}
