/* Portal Viventia — ajustes de celular compartilhados (carregado pelo cabeçalho comum).
   Mesmos princípios da área pública /ansiedade/: nada estoura a largura, alvos de toque
   de pelo menos 40 px e texto legível. */

html, body { max-width: 100%; }
body { overflow-x: clip; }
img, video, iframe { max-width: 100%; }

@media (max-width: 640px) {
  /* cabeçalho: botões de ícone e links com área de toque confortável */
  .btn-icon, .nav-toggle, .nav-btn, .notif-btn { min-width: 40px; min-height: 40px; }
  .avatar { width: 40px; height: 40px; }
  .nav-links .nav-link { min-height: 44px; display: flex; align-items: center; }
  .nav-logo { display: inline-flex; align-items: center; min-height: 40px; }

  /* abas e botões de resposta */
  .gtab { min-height: 40px; }
  .nps-btn { min-width: 40px; min-height: 40px; }
  .btn-skip, .btn-fb-enviar { min-height: 44px; }

  /* links soltos (rodapé etc.): área de toque maior sem mexer no visual */
  footer a { display: inline-block; padding: .55rem .35rem; }

  /* campos: 16px evita o zoom automático do iPhone ao focar */
  input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea { font-size: 16px; }
}

@media (max-width: 640px) {
  .filter-chip { min-height: 40px; display: inline-flex; align-items: center; }
}

@media (max-width: 640px) {
  .btn-explorar, .filtro-btn { min-height: 44px; }
  .nav-link { min-height: 40px; }
}

/* ───────── Experiência de app ───────── */
html { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
html.is-standalone, html.is-standalone body { overscroll-behavior-y: contain; }
#site-nav, .app-tabbar, .app-sheet, button, .btn { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button:active, .btn:active, .app-tab:active, .app-sheet-item:active { transform: scale(.97); }

/* transição suave entre páginas (navegadores com View Transitions) */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }
#site-nav { view-transition-name: app-topbar; }
.app-tabbar { view-transition-name: app-tabbar; }

/* app instalado: respeita o entalhe/status bar */
html.is-standalone #site-nav { padding-top: calc(.7rem + env(safe-area-inset-top)); }
html.is-standalone #site-nav-spacer { height: calc(58px + env(safe-area-inset-top)); }

/* barra de abas */
.app-tabbar, .app-sheet { display: none; }
@media (max-width: 760px) {
  body.has-tabbar { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .app-tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 300;
    background: rgba(255,255,255,.96); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    border-top: 1px solid rgba(194,200,194,.5);
    padding: .3rem .4rem calc(.3rem + env(safe-area-inset-bottom));
  }
  .app-tab {
    flex: 1; min-width: 0; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem;
    border: 0; background: none; border-radius: 14px; color: #737874; text-decoration: none; cursor: pointer;
    font: 600 .75rem/1 "Plus Jakarta Sans", system-ui, sans-serif;
  }
  .app-tab svg { width: 24px; height: 24px; fill: currentColor; }
  .app-tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-tab.active { color: #384b41; background: rgba(77,96,85,.12); }
  .app-tab { position: relative; }

  /* com as abas, o menu do topo vira redundante */
  body.has-tabbar #site-nav .nav-toggle { display: none !important; }
  body.has-tabbar #site-nav .nav-actions .nav-link { display: none; }
  body.has-tabbar .nav-toggle { display: none !important; }

  /* botão de ajuda flutuante sobe para não ficar atrás das abas */
  body.has-tabbar .crise-fab { bottom: calc(84px + env(safe-area-inset-bottom)) !important; }

  /* folha inferior "Mais" */
  .app-sheet:not([hidden]) { display: flex; position: fixed; inset: 0; z-index: 700; align-items: flex-end; background: rgba(20,24,22,.45); }
  .app-sheet-painel {
    width: 100%; max-height: 82vh; overflow-y: auto; background: #fff; border-radius: 22px 22px 0 0;
    padding: .5rem 1rem calc(1rem + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px rgba(0,0,0,.18);
    animation: appSheetUp .22s ease-out;
  }
  .app-sheet-alca { width: 40px; height: 4px; border-radius: 4px; background: #c2c8c2; margin: .3rem auto .6rem; }
  .app-sheet-item {
    display: flex; align-items: center; width: 100%; min-height: 52px; padding: .6rem .9rem; margin: .15rem 0;
    border: 0; border-radius: 14px; background: none; color: #1f1b18; text-decoration: none; text-align: left; cursor: pointer;
    font: 600 1rem "Plus Jakarta Sans", system-ui, sans-serif;
  }
  .app-sheet-item.active { background: rgba(77,96,85,.1); color: #384b41; }
  .app-sheet-ajuda { background: #fdf0ee; color: #a93226; }
  .app-sheet-fechar { justify-content: center; color: #737874; border-top: 1px solid #efe6e2; border-radius: 0; margin-top: .4rem; }
  .app-sheet-dica { margin: .2rem .9rem .6rem; font-size: .9rem; color: #424844; }
  html.app-sheet-aberto, html.app-sheet-aberto body { overflow: hidden; }
}
@keyframes appSheetUp { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .app-sheet-painel { animation: none; } * { scroll-behavior: auto !important; } }

/* círculos decorativos do hero ficam atrás do texto (cobriam o título no celular) */
.hero-circle { z-index: 0; pointer-events: none; }
.hero > *:not(.hero-circle) { position: relative; z-index: 1; }

/* avisos flutuantes nunca capturam toque (o toast invisível da Biblioteca cobria as abas) */
.toast-breve { pointer-events: none; }
@media (max-width: 760px) {
  body.has-tabbar .toast-breve { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
