/* ============================================================
   AZ Docs — sidebar.css
   O casco das páginas de documentação: navegação lateral fixa à
   esquerda e a coluna de conteúdo à direita. A página ativa se
   identifica com aria-current="page" — o CSS pinta a partir daí,
   sem classe extra para manter em sincronia.
   Em telas estreitas a lateral vira uma barra horizontal no topo.
   ============================================================ */

.docs {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  min-height: 100vh;
}

/* ── A lateral ───────────────────────────────────────────── */

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.75rem 1.25rem 2.5rem;
  background: var(--surface);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ── Marca ───────────────────────────────────────────────── */

.brand {
  display: grid;
  gap: .15rem;
  text-decoration: none;
  color: var(--ink);
  padding: 0 .55rem;
}
.brand__mark {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.4rem;
  line-height: 1.1;
  letter-spacing: -.015em;
}
.brand__sub {
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ── Navegação ───────────────────────────────────────────── */

.nav__group {
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 .6rem;
  padding: 0 .55rem;
  max-width: none;
}

.nav {
  list-style: none;
  margin: 0 0 1.75rem;
  padding: 0;
  display: grid;
  gap: .1rem;
}
.nav:last-child { margin-bottom: 0; }
.nav li { margin: 0; max-width: none; }

.nav a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .55rem;
  border-radius: 5px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: .92rem;
  line-height: 1.35;
  border-left: 2px solid transparent;
  transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}
.nav a:hover,
.nav a:focus-visible {
  color: var(--ink);
  background: var(--surface-alt);
}
.nav a[aria-current="page"] {
  color: var(--accent-ink);
  background: var(--accent-wash);
  border-left-color: var(--accent);
  border-radius: 0 5px 5px 0;
  font-weight: 600;
}

.nav__count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--ink-muted);
  background: var(--surface-alt);
  border: 1px solid var(--rule-soft);
  border-radius: 999px;
  padding: .05rem .42rem;
  font-variant-numeric: tabular-nums;
}
.nav a[aria-current="page"] .nav__count {
  color: var(--accent-ink);
  background: var(--surface);
  border-color: transparent;
}

/* ── Grupo recolhível ────────────────────────────────────────
   <details>/<summary> nativos: abre e fecha sem JavaScript, e o
   teclado já navega neles de graça. */

.nav__drop { margin: 0; }

.nav__drop > summary {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .55rem;
  border-radius: 5px;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: .92rem;
  line-height: 1.35;
  border-left: 2px solid transparent;
  list-style: none;
  transition: color .15s ease, background-color .15s ease;
}
.nav__drop > summary::-webkit-details-marker { display: none; }

.nav__drop > summary:hover,
.nav__drop > summary:focus-visible {
  color: var(--ink);
  background: var(--surface-alt);
}

/* Seta que acompanha o estado do grupo */
.nav__drop > summary::after {
  content: "";
  margin-left: auto;
  width: .42rem;
  height: .42rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  opacity: .55;
  transition: transform .18s ease;
}
.nav__drop[open] > summary::after { transform: rotate(45deg); }

/* Quando a página aberta está dentro do grupo */
.nav__drop--ativo > summary { color: var(--ink); font-weight: 500; }

/* Sub-itens */
.nav--sub {
  margin: .15rem 0 .35rem;
  padding-left: .8rem;
  border-left: 1px solid var(--rule);
  gap: .1rem;
}
.nav--sub a { font-size: .88rem; padding-left: .7rem; }

@media (prefers-reduced-motion: reduce) {
  .nav__drop > summary,
  .nav__drop > summary::after { transition: none; }
}

/* Rodapé da lateral */
.sidebar__foot {
  margin-top: auto;
  padding: 1rem .55rem 0;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .06em;
  color: var(--ink-muted);
  line-height: 1.6;
}
.sidebar__foot p { margin: 0; max-width: none; }

/* ── Coluna de conteúdo ──────────────────────────────────── */

.docs__main { min-width: 0; }
.docs__main .wrap { max-width: 64rem; }

/* ── Atalho de teclado ───────────────────────────────────── */

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 50;
  background: var(--surface);
  color: var(--ink);
  padding: .7rem 1rem;
  border: 1px solid var(--rule);
  font-size: .85rem;
}
.skip:focus { left: .5rem; top: .5rem; }

@media (prefers-reduced-motion: reduce) {
  .nav a { transition: none; }
}

/* ── Estreito: a lateral vira barra no topo ──────────────── */

@media (max-width: 56rem) {
  .docs { grid-template-columns: 1fr; }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 1.5rem;
    padding: .75rem 1.1rem;
    border-right: none;
    border-bottom: 1px solid var(--rule);
    overflow-x: auto;
    overflow-y: visible;
  }

  .brand { flex: none; padding: 0; }
  .brand__mark { font-size: 1.1rem; }
  .brand__sub { display: none; }

  .sidebar nav { display: flex; align-items: center; }
  .nav__group { display: none; }

  .nav {
    display: flex;
    gap: .3rem;
    margin: 0;
    white-space: nowrap;
  }
  .nav a { border-left: none; border-bottom: 2px solid transparent; border-radius: 4px; }
  .nav a[aria-current="page"] {
    border-left: none;
    border-bottom-color: var(--accent);
    border-radius: 4px 4px 0 0;
  }

  .sidebar__foot { display: none; }

  .nav__drop > summary { display: none; }
  .nav--sub {
    display: flex;
    margin: 0;
    padding-left: 0;
    border-left: none;
    gap: .3rem;
  }
  .nav--sub a { font-size: .7rem; padding-left: .6rem; }
  .nav__drop:not([open]) > .nav--sub { display: flex; }
}
