/* Telas do meio: iPhone Duo (aberto, fechado e deitado), tablet em pé e celular deitado. Decide só pelo tamanho da tela,
   nunca pelo modelo. Medidas do Safari no Duo (largura x altura visível):
   fechado 382x580, fechado deitado 594x368, aberto em pé 669x867, aberto deitado 951x585, duas janelas lado a lado 385x571.
   De 960px pra cima quem manda é o web.css. Com o Duo deitado a dobra fica no meio: por isso as colunas são em número par. */

/* Tela baixa em pé (Duo fechado e iPhone SE): menos texto e foto maior no Vídeo, aviso e ficha que cabem. */
@media (max-width:560px) and (max-height:640px){
  .vc .info h2{font-size:25px}
  .vc .info p{-webkit-line-clamp:2;font-size:14px}
  .vc[id^="v-"]>img{max-height:calc(100dvh - 330px)}
  .ent header{min-height:216px}
  .ent header img{height:66px}
}

@media (min-width:561px) and (max-width:959.98px){
  /* ocupa a tela inteira, com folga nos dois lados para câmera e botões do sistema */
  #app,.m-video #app,.vtop,.story,.cad,.baixo{max-width:none}
  body{padding-left:env(safe-area-inset-left);padding-right:env(safe-area-inset-right)}
  .vtop,.baixo{padding-left:max(12px,env(safe-area-inset-left));padding-right:max(12px,env(safe-area-inset-right))}
  .story{left:env(safe-area-inset-left);right:env(safe-area-inset-right)}
  .baixo button{max-width:170px;width:100%;margin-inline:auto}
  .cad>*{max-width:560px;margin-left:auto;margin-right:auto}

  /* início: 2 banners por linha, categorias em 2 colunas mais altas */
  .bn{width:calc((100% - 10px)/2)}
  .cat{height:160px}.cat:first-child{height:200px}
  .fcard{width:240px}.fcard img{width:240px;height:156px}
  .fcard.wide,.fcard.wide img{width:100%}.fcard.wide img{height:240px}
  .moment{min-height:210px}

  /* Fotos: mais folga entre as colunas */
  .cards{gap:16px}
  .ent form{max-width:520px;margin-left:auto;margin-right:auto}
  .sheet .in{max-width:640px}
  .sheet .ft img{aspect-ratio:auto;height:min(52vh,520px)}
}
/* Duo aberto em pé e tablet em pé: 3 fotos por linha (aqui a dobra corta na horizontal, não atrapalha) */
@media (min-width:640px) and (max-width:819.98px){.cards{grid-template-columns:repeat(3,1fr)}}
/* Duo aberto deitado, tablet e celular grande deitado: lista em 2 colunas, fotos e categorias em 4 */
@media (min-width:820px) and (max-width:959.98px){
  .sec{display:grid;grid-template-columns:1fr 1fr;column-gap:36px;align-content:start}
  .sec>:not(.it){grid-column:1/-1}
  .cards{grid-template-columns:repeat(4,1fr)}
  .cats{grid-template-columns:repeat(4,1fr)}
  .cat:first-child{grid-column:span 2;height:160px}
  .cat:last-child:nth-child(even){grid-column:auto;height:160px}
}

/* Tela larga e baixa (Duo deitado, celular deitado): foto de um lado, texto do outro, um em cada metade da dobra. */
@media (min-width:561px) and (max-width:959.98px) and (max-height:700px) and (orientation:landscape){
  /* topo mais baixo, com loja e avaliação na mesma linha */
  .mhead{padding-top:calc(10px + env(safe-area-inset-top));padding-bottom:8px;gap:4px}
  .mhead img{height:34px}
  .mhead .dir{grid-auto-flow:column;align-items:center;gap:14px}
  .avalb small{display:none}
  .qx{margin-top:10px}
  /* ficha do prato */
  .sheet{align-items:center;padding:12px max(16px,env(safe-area-inset-right)) 12px max(16px,env(safe-area-inset-left))}
  .sheet .in{max-width:880px;border-radius:22px;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr);height:min(100%,520px);max-height:none;overflow:hidden}
  .sheet .ft{min-height:0}
  .sheet .ft img,.sheet .ft video{height:100%!important;max-height:none;aspect-ratio:auto}
  .sheet .bd{overflow:auto;align-content:start;padding-top:20px}
  .sheet .in:not(:has(.ft img)):not(:has(.ft video)){grid-template-columns:1fr;grid-template-rows:auto;height:auto;max-height:100%;max-width:560px;overflow:auto}
  .sheet .in:not(:has(.ft img)):not(:has(.ft video)) .ft{min-height:52px}
  /* aviso */
  .pop{padding:12px}
  .pop .in{max-height:100%;overflow:auto}
  .pop img,.pop video{height:min(170px,34vh)}
  /* Vídeo: topo numa linha só, foto à esquerda e texto à direita */
  .vtop{grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:12px}
  .vtop .l1{display:contents}
  .vtop .l1>img{order:1}.vtop .vchips{order:2}.vtop .l1>.vd{order:3}
  .vc>img,.vc>video,.vc[id^="v-"]>img{inset:calc(76px + env(safe-area-inset-top)) 50% 12px max(12px,env(safe-area-inset-left));width:calc(50% - 12px - max(12px,env(safe-area-inset-left)));height:calc(100% - 88px - env(safe-area-inset-top));max-height:none;aspect-ratio:auto;object-fit:contain;-webkit-mask-image:none;mask-image:none}
  .vc .shade{background:none}
  .vc .info{left:calc(50% + 12px);right:max(18px,env(safe-area-inset-right));top:calc(76px + env(safe-area-inset-top));bottom:calc(22px + env(safe-area-inset-bottom));align-content:center}
  .vc .info h2{font-size:26px}
  .vdica{left:50%}
  /* história das fotos: mesma divisão */
  .story img.bg,.story video.bg{width:50%!important;height:100%;object-fit:contain!important}
  .story .shade{background:linear-gradient(180deg,rgba(0,0,0,.55),rgba(0,0,0,0) 30%)}
  .story .sfoot{left:calc(50% + 12px);top:84px;align-content:center}
  .story .tap{bottom:0}.story .tap.r{right:0;left:35%;width:auto}
  .story .sfoot{pointer-events:none}.story .sfoot .btn{pointer-events:auto}
}
/* Bem baixa (Duo fechado deitado, celular deitado): economiza altura */
@media (min-width:561px) and (max-width:959.98px) and (max-height:450px) and (orientation:landscape){
  .ent header{min-height:170px;padding-top:calc(14px + env(safe-area-inset-top));padding-bottom:14px}
  .ent header img{height:52px}
  .bn{height:190px}
  .qx{padding-block:9px}
  .baixo{padding-top:0}
  .baixo svg{width:20px;height:20px}
  .vc .info h2{font-size:22px}
  .vc .info p{-webkit-line-clamp:2;font-size:14px}
  .baixo button{min-height:46px}
  .story .sfoot h2{font-size:24px}
}
