/* ============================================================
   mobile.css — Estilos para celular e tablet (≤ 768px)
   Visual de aplicativo nativo
   ============================================================ */

@media (max-width: 768px) {
  /* ── RESET ANTI-OVERFLOW ─────────────────────────────────── */
  html,
  body {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }

  body {
    /* Espaço para bottom nav */
    padding-bottom: 72px;
  }

  /* Nenhum elemento estoura a tela */
  * {
    box-sizing: border-box;
  }

  /* Seções e wrappers: travados na largura da tela */
  section,
  .hero,
  footer,
  nav#main-nav,
  .tools-grid,
  .how-grid,
  .stats-row,
  .hero-badges {
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  /* Glow: remover largura fixa de 900px que causa overflow */
  .glow {
    width: min(600px, 100vw) !important;
    height: min(600px, 100vw) !important;
  }

  /* ── NAV MOBILE (topo compacto) ─────────────────────────── */
  nav#main-nav {
    height: 56px;
    padding: 0 1rem;
    background: rgba(13, 15, 20, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  /* Ocultar itens desktop */
  .nav-tools-trigger,
  .btn-login,
  .btn-register,
  .nav-dropdown {
    display: none !important;
  }

  /* Mostrar botão hambúrguer */
  .menu-btn {
    display: flex;
  }

  /* ── BOTTOM NAVIGATION BAR (estilo app) ─────────────────── */
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 350;
    height: 64px;
    background: rgba(13, 15, 20, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(240, 243, 248, 0.08);
    display: flex;
    align-items: stretch;
    padding: 0 0.25rem;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: rgba(240, 243, 248, 0.45);
    transition: color 0.2s;
    padding: 0.5rem 0.25rem;
    border-radius: 8px;
    position: relative;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-item.active,
  .mobile-nav-item:active {
    color: var(--accent);
  }

  .mobile-nav-item svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .mobile-nav-item span {
    font-family: "DM Sans", sans-serif;
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.02em;
  }

  .mobile-nav-item.active svg {
    stroke: var(--accent);
  }

  /* Indicador ativo */
  .mobile-nav-item.active::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
  }

  /* ── DRAWER (bottom sheet no mobile) ────────────────────── */
  .drawer {
    width: 100vw;
    max-width: 100vw;
    border-left: none;
    border-top: 1px solid rgba(42, 109, 217, 0.15);
    top: auto;
    bottom: 64px;
    right: 0;
    height: calc(100dvh - 56px - 64px);
    transform: translateX(0) translateY(100%);
    transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 16px 16px 0 0;
  }

  .drawer.open {
    transform: translateX(0) translateY(0);
  }

  .drawer-header {
    border-radius: 16px 16px 0 0;
  }

  /* Handle visual no topo do drawer */
  .drawer-header::before {
    content: "";
    display: block;
    width: 36px;
    height: 4px;
    background: rgba(240, 243, 248, 0.2);
    border-radius: 2px;
    margin: 0 auto 0.75rem;
  }

  /* ── HERO MOBILE ─────────────────────────────────────────── */
  .hero {
    min-height: auto;
    padding: 5rem 1.25rem 2.5rem;
    text-align: left;
    align-items: flex-start;
    gap: 0;
    width: 100%;
  }

  .mono-tag {
    font-size: 0.6rem;
    letter-spacing: 0.18em;
    margin-bottom: 1rem;
  }

  .hero h1 {
    font-size: clamp(2rem, 9vw, 3rem);
    line-height: 1.05;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
    word-break: break-word;
  }

  .hero-sub {
    font-size: 0.9rem;
    line-height: 1.65;
    margin-bottom: 1.5rem;
    max-width: 100%;
    text-align: left;
  }

  /* Badges em scroll horizontal */
  .hero-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 2rem;
    padding-bottom: 0.25rem;
    /* Negativo para sangrar até as bordas */
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    justify-content: flex-start;
    /* Limitar ao viewport para não causar overflow na página */
    max-width: calc(100vw);
    width: calc(100vw);
  }

  .hero-badges::-webkit-scrollbar {
    display: none;
  }

  .badge {
    flex-shrink: 0;
    font-size: 0.6rem;
    padding: 0.3rem 0.7rem;
    white-space: nowrap;
  }

  /* Stats: 2x2 grid no mobile (sem scroll horizontal) */
  .stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex-wrap: unset;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    max-width: 100%;
    margin-bottom: 0;
  }

  .stat-item {
    min-width: 0;
    padding: 1.1rem 0.75rem;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    text-align: center;
    flex: unset;
  }

  /* Tirar borda da coluna direita e última linha */
  .stat-item:nth-child(2n) {
    border-right: none;
  }
  .stat-item:nth-last-child(-n + 2) {
    border-bottom: none;
  }

  .stat-num {
    font-size: 1.5rem;
  }
  .stat-label {
    font-size: 0.52rem;
  }

  /* Ocultar scroll hint */
  .hero-scroll {
    display: none;
  }

  /* ── SECTIONS MOBILE ────────────────────────────────────── */
  section {
    padding: 2.5rem 1.25rem;
    max-width: 100vw;
  }

  .section-label {
    font-size: 0.6rem;
    letter-spacing: 0.18em;
  }

  .section-title {
    font-size: clamp(1.4rem, 6vw, 2rem);
    margin-bottom: 0.5rem;
    word-break: break-word;
  }

  .section-sub {
    font-size: 0.85rem;
    max-width: 100%;
  }

  /* ── TOOLS GRID (lista estilo app) ──────────────────────── */
  .tools-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--border);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    margin-top: 1.75rem;
  }

  .tool-card {
    padding: 1rem;
    gap: 0.75rem;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    background: var(--ink);
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
    /* Limitar largura ao container */
    width: 100%;
    overflow: hidden;
  }

  .tool-card:active {
    background: rgba(42, 109, 217, 0.07);
  }

  /* Remover pseudo-elemento do desktop */
  .tool-card::after {
    display: none;
  }

  .tool-card-header {
    flex-shrink: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
  }

  /* Ícone estilo iOS */
  .tool-icon-wrap {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    border: none;
    background: rgba(42, 109, 217, 0.12);
    flex-shrink: 0;
  }

  .tool-icon-wrap svg {
    width: 22px;
    height: 22px;
  }

  .tool-arrow {
    display: none;
  }

  /* Conteúdo textual */
  .tool-card-body {
    flex: 1;
    min-width: 0; /* essencial para texto não vazar */
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow: hidden;
  }

  .tool-name {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tool-desc {
    font-size: 0.78rem;
    line-height: 1.4;
    color: rgba(240, 243, 248, 0.55);
    display: -webkit-box;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .tool-tags {
    gap: 0.3rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tool-tags::-webkit-scrollbar {
    display: none;
  }

  .tool-tag {
    font-size: 0.55rem;
    padding: 0.15rem 0.45rem;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Chevron direita estilo iOS */
  .tool-card::before {
    content: "";
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 7px;
    height: 7px;
    border-right: 1.5px solid rgba(240, 243, 248, 0.25);
    border-top: 1.5px solid rgba(240, 243, 248, 0.25);
    pointer-events: none;
    flex-shrink: 0;
  }

  .tool-card[style*="opacity:0.4"]::before {
    display: none;
  }

  /* ── HOW IT WORKS MOBILE ────────────────────────────────── */
  .how-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 1.75rem;
  }

  .how-card {
    border-radius: 0;
    border: none;
    padding: 1.1rem 1rem;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 1rem;
  }

  .how-num {
    font-size: 1.3rem;
    margin-bottom: 0;
    flex-shrink: 0;
    width: 2rem;
    text-align: center;
    line-height: 1.3;
  }

  .how-body {
    flex: 1;
    min-width: 0;
  }

  .how-title {
    font-size: 0.88rem;
    margin-bottom: 0.3rem;
  }

  .how-desc {
    font-size: 0.78rem;
    line-height: 1.55;
  }

  /* ── DIVIDER ────────────────────────────────────────────── */
  .divider {
    margin: 0 1.25rem;
  }

  /* ── FOOTER MOBILE ──────────────────────────────────────── */
  footer {
    padding: 2rem 1.25rem;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 100vw;
  }

  .footer-links {
    gap: 1rem;
    flex-wrap: wrap;
  }

  .footer-copy {
    font-size: 0.58rem;
  }

  /* ── COOKIE BANNER MOBILE ───────────────────────────────── */
  #cookie-banner {
    bottom: calc(64px + 0.75rem);
    flex-direction: column;
    gap: 1rem;
    padding: 1.1rem;
    width: calc(100vw - 1.5rem);
    border-radius: 10px;
  }

  .cookie-actions {
    width: 100%;
    gap: 0.5rem;
  }

  .btn-cookie {
    flex: 1;
    text-align: center;
    padding: 0.6rem 0.75rem;
  }

  /* ── GLOW E GRID BG (performance) ──────────────────────── */
  .glow {
    width: min(500px, 100vw) !important;
    height: min(500px, 100vw) !important;
    left: 50%;
    transform: translate(-50%, -50%);
  }

  .grid-bg {
    background-size: 40px 40px;
    opacity: 0.6;
  }
}

/* ── HEBRAICO: ocultar nav do site, mostrar nav da ferramenta ── */
/* A classe .page-hebraico é adicionada ao <body> pelo index.php  */
@media (max-width: 700px) {
  body.page-hebraico .mobile-bottom-nav {
    display: none !important;
  }
}

/* ── TABLET (769px — 1024px) ────────────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
  nav#main-nav {
    padding: 0 1.5rem;
  }

  .hero {
    padding: 7rem 2rem 4rem;
  }

  .hero h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
  }

  .hero-sub {
    font-size: 1rem;
  }

  section {
    padding: 5rem 2rem;
  }

  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .how-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-row {
    flex-wrap: wrap;
  }

  .stat-item {
    min-width: 120px;
  }
}
