/* Mobile performance & UX — LCP/INP/CLS, menu, blog reading (pt-BR BR) */
:root {
  --gn-h: 48px;
  --tap: 48px;
  --read: 42rem;
}

/* System fonts only — no synthesis jitter on mobile */
body {
  font-synthesis: none;
}

/* Reading progress — blog */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 10001;
  background: linear-gradient(90deg, var(--blue), var(--green));
  pointer-events: none;
  transform: translateZ(0);
  will-change: width;
}

/* Hamburger — mobile nav */
.gn-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.gn-toggle-ic {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  box-shadow: 0 -6px 0 var(--ink), 0 6px 0 var(--ink);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.gn-toggle[aria-expanded="true"] .gn-toggle-ic {
  background: transparent;
  box-shadow: none;
  transform: rotate(45deg);
}
.gn-toggle[aria-expanded="true"] .gn-toggle-ic::after {
  content: "";
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transform: rotate(-90deg);
}

/* INP — fast tap on interactive controls */
.btn,
.btn-android,
.ghost,
.more,
.hub-card,
.card,
.acard,
.tpl-nav a,
.ft a,
.gn-brand {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Blog — reading comfort */
article[itemscope] [itemprop="articleBody"] {
  max-width: var(--read);
  font-size: clamp(16px, 4.1vw, 18px);
  line-height: 1.75;
  letter-spacing: -0.011em;
}
article[itemscope] [itemprop="articleBody"] p,
article[itemscope] [itemprop="articleBody"] li {
  text-wrap: pretty;
}
article[itemscope] [itemprop="articleBody"] h2 {
  margin-top: 2rem;
  padding-top: 0.25rem;
  scroll-margin-top: calc(var(--gn-h) + 12px);
}
article[itemscope] [itemprop="articleBody"] h3 {
  margin-top: 1.35rem;
  scroll-margin-top: calc(var(--gn-h) + 12px);
}
article[itemscope] [itemprop="articleBody"] li {
  margin-bottom: 0.55rem;
}
article[itemscope] [itemprop="articleBody"] li::marker {
  color: var(--blue);
}
article[itemscope] .download-hero .btn {
  min-height: var(--tap);
  width: 100%;
  max-width: none;
}
article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 0 0 1rem;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
article thead,
article tbody,
article tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}
article th,
article td {
  padding: 10px 12px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}
article th {
  background: var(--soft-hover);
  font-weight: 600;
  color: var(--ink);
}

/* CLS — reserve image boxes */
.cover {
  width: 100%;
  max-height: min(56vw, 420px);
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.card img,
.acard img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--soft-hover);
}

@media (max-width: 734px) {
  .gn-in {
    position: relative;
    flex-wrap: nowrap;
    gap: 10px;
  }
  .gn-toggle {
    display: inline-flex;
    margin-left: auto;
  }
  .gn-links {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    left: calc(var(--g) * -1);
    right: calc(var(--g) * -1);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px var(--g) calc(12px + var(--sb));
    background: var(--nav-bg);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    z-index: 1000;
  }
  .gn-links.is-open {
    display: flex;
  }
  .gn-links a {
    width: 100%;
    padding: 12px 10px;
    min-height: var(--tap);
    font-size: 15px;
    border-radius: 10px;
  }
  .gn-links a:hover,
  .gn-links a[aria-current="page"] {
    background: var(--soft-hover);
  }
  body.gn-open {
    overflow: hidden;
    touch-action: none;
  }
  body.gn-open .gn {
    z-index: 1002;
  }

  .wrap {
    padding-bottom: calc(56px + var(--sb));
  }

  /* Blog — sticky CTA + author on small screens */
  article .cta {
    position: sticky;
    bottom: calc(8px + var(--sb));
    z-index: 40;
    box-shadow: var(--shadow-md);
  }
  article .cta .btn {
    width: 100%;
    max-width: none;
    min-height: var(--tap);
  }
  article[itemscope] .meta {
    font-size: 13px;
    line-height: 1.5;
  }
  .article-related a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 4px 0;
  }
  .article-author {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .cards {
    gap: 12px;
  }
  .card {
    min-height: 72px;
  }
  .hub-card {
    min-height: var(--tap);
  }

  /* Home — full-width download buttons */
  .get .btn,
  .get .btn-android {
    width: 100%;
    max-width: 280px;
    min-height: var(--tap);
  }
  .cta-row .btn.lg,
  .cta-row .ghost,
  .bar-fix .btn {
    min-height: var(--tap);
  }

  /* Defer off-screen paint */
  .ft {
    content-visibility: auto;
    contain-intrinsic-size: auto 180px;
  }
  .sec:nth-of-type(n + 3) {
    content-visibility: auto;
    contain-intrinsic-size: 1px 380px;
  }
}

@media (max-width: 480px) {
  article h1 {
    font-size: clamp(22px, 6.5vw, 28px);
  }
  .gn-brand {
    font-size: 15px;
    max-width: calc(100% - 100px);
  }
  .gn-brand img {
    width: 26px;
    height: 26px;
  }
}

/* Override home.css ≤380px nav leak (must stay hamburger) */
@media (max-width: 380px) {
  .gn-links:not(.is-open) {
    display: none !important;
  }
  .gn-links.is-open {
    display: flex !important;
    flex-direction: column;
    gap: 2px;
    font-size: 15px;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gn-toggle-ic,
  .read-progress {
    transition: none;
  }
  .read-progress {
    will-change: auto;
  }
}
