/* ==========================================================================
   Documentação, Status e Infraestrutura
   Depende de /css/legal.css (tokens, header, footer, botões)
   ========================================================================== */

/* ------------------------------- hero curto ----------------------------- */
.page-hero {
  padding: clamp(40px, 6vw, 76px) 0 clamp(26px, 4vw, 40px);
}
.page-hero h1 {
  margin: 20px 0 0;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1;
  letter-spacing: -0.045em;
  font-weight: 550;
  text-wrap: balance;
}
.page-hero__lede {
  margin: 22px 0 0;
  max-width: 64ch;
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  line-height: 1.62;
  color: var(--text-muted);
  text-wrap: pretty;
}
.page-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

/* ------------------------------- layout docs ---------------------------- */
.docs {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 28px 0 64px;
}
.docs__side {
  display: none;
}
.docs__main {
  min-width: 0;
  max-width: 820px;
}

.side {
  position: sticky;
  top: calc(var(--header-h) + 26px);
  align-self: start;
  display: grid;
  gap: 26px;
}
.side__group h2 {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 500;
}
.side__group ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1px;
  border-left: 1px solid var(--line-soft);
}
.side__link {
  display: block;
  padding: 7px 0 7px 14px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  font-size: 13.5px;
  color: var(--text-faint);
  transition: color 0.2s, border-color 0.2s;
}
.side__link:hover {
  color: var(--text-muted);
}
.side__link[aria-current="true"],
.side__link.is-active {
  color: var(--text);
  border-left-color: var(--primary);
}
.side__cta {
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.side__cta p {
  margin: 0 0 12px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-muted);
}

/* ------------------------------- prosa ---------------------------------- */
.prose {
  display: grid;
  gap: 34px;
}
.prose section {
  scroll-margin-top: calc(var(--header-h) + 26px);
}
.prose h2 {
  margin: 0 0 10px;
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  letter-spacing: -0.035em;
  font-weight: 550;
  line-height: 1.15;
  display: flex;
  align-items: baseline;
  gap: 10px;
  text-wrap: balance;
}
.prose h2 .anchor {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  opacity: 0;
  transition: opacity 0.2s;
}
.prose h2:hover .anchor {
  opacity: 1;
}
.prose h3 {
  margin: 26px 0 8px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
}
.prose p {
  margin: 0 0 14px;
  font-size: 15.5px;
  line-height: 1.72;
  color: var(--text-muted);
  text-wrap: pretty;
}
.prose p:last-child {
  margin-bottom: 0;
}
.prose ul,
.prose ol {
  margin: 0 0 16px;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-muted);
}
.prose li::marker {
  color: var(--primary);
}
.prose a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--primary) 55%, transparent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.prose a:hover {
  color: var(--primary);
  text-decoration-color: var(--primary);
}
.prose code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--line-soft);
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--line-soft);
  margin: 0;
}

/* ------------------------------- código --------------------------------- */
.code {
  position: relative;
  margin: 0 0 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: #08080c;
  overflow: hidden;
}
html[data-theme="light"] .code {
  background: #12101c;
}
.code__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(247, 247, 251, 0.45);
}
.code__copy {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: rgba(247, 247, 251, 0.6);
  border-radius: 6px;
  padding: 4px 9px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.code__copy:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
}
.code pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: #e7e5f2;
  tab-size: 2;
}
.code pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: inherit;
}
.tok-key {
  color: #c4b5fd;
}
.tok-str {
  color: #86efac;
}
.tok-num {
  color: #fdba74;
}
.tok-com {
  color: rgba(247, 247, 251, 0.35);
  font-style: italic;
}
.tok-cmd {
  color: #93c5fd;
}

/* ------------------------------- pills / badges ------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--text-muted);
  background: var(--surface);
  white-space: nowrap;
}
.pill--get {
  color: #86efac;
  border-color: rgba(134, 239, 172, 0.32);
  background: rgba(52, 211, 153, 0.1);
}
.pill--post {
  color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.32);
  background: rgba(59, 130, 246, 0.1);
}
.pill--delete {
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.3);
  background: rgba(239, 68, 68, 0.1);
}
.pill--patch {
  color: #fcd34d;
  border-color: rgba(252, 211, 77, 0.3);
  background: rgba(245, 158, 11, 0.1);
}

/* ------------------------------- callout -------------------------------- */
.callout {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  padding: 16px 18px;
  margin: 0 0 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
}
.callout strong {
  color: var(--text);
  font-weight: 550;
}
.callout__icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--primary) 45%, transparent);
  color: var(--primary);
  margin-top: 1px;
}
.callout__icon svg {
  width: 12px;
  height: 12px;
}
.callout--warn {
  border-color: rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.07);
}
.callout--warn .callout__icon {
  border-color: rgba(245, 158, 11, 0.45);
  color: #fbbf24;
}

/* ------------------------------- endpoint ------------------------------- */
.endpoint {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
  margin: 0 0 16px;
}
.endpoint__head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.endpoint__path {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}
.endpoint__desc {
  margin: 0;
  padding: 12px 16px 14px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-muted);
}
.endpoint__body {
  padding: 0 16px 16px;
}

/* tabela de parâmetros */
.params {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
}
.params th {
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 500;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-strong);
  white-space: nowrap;
}
.params td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text-muted);
  vertical-align: top;
  line-height: 1.5;
}
.params tr:last-child td {
  border-bottom: 0;
}
.params code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text);
}
.params .req {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

/* ------------------------------- status --------------------------------- */
.status-hero {
  padding: clamp(40px, 6vw, 72px) 0 0;
}
.status-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding: 18px 22px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(52, 211, 153, 0.24);
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.1), rgba(52, 211, 153, 0.03));
}
.status-banner__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18);
  flex: none;
}
.status-banner__text {
  font-size: 15px;
  font-weight: 550;
  color: var(--text);
}
.status-banner__meta {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}

.components {
  margin-top: 28px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}
.component {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 18px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.component:last-child {
  border-bottom: 0;
}
.component__name {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
}
.component__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.14);
  flex: none;
}
.component__note {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 3px;
  padding-left: 15px;
}
.component__uptime {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}
.bars {
  grid-column: 1 / -1;
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 26px;
}
.bars span {
  flex: 1;
  height: 100%;
  border-radius: 1px;
  background: rgba(52, 211, 153, 0.55);
}
.bars span.is-down {
  background: rgba(248, 113, 113, 0.75);
}
.bars span.is-partial {
  background: rgba(251, 191, 36, 0.75);
}
.bars__legend {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.incidents {
  margin-top: 20px;
  display: grid;
  gap: 10px;
}
.incident {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.incident__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.incident__title {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
}
.incident__date {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
}
.incident p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ------------------------------- infra ---------------------------------- */
.infra-grid {
  display: grid;
  gap: 12px;
  margin: 0 0 8px;
}
.infra-card {
  padding: 20px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 0.25s, background-color 0.25s, transform 0.25s var(--ease);
}
.infra-card:hover {
  border-color: color-mix(in srgb, var(--primary) 32%, transparent);
  background: var(--surface-strong);
  transform: translateY(-2px);
}
.infra-card__icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--primary-soft);
  color: var(--primary);
  margin-bottom: 14px;
}
.infra-card__icon svg {
  width: 16px;
  height: 16px;
}
.infra-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
}
.infra-card p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.62;
  color: var(--text-muted);
}

.spec-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line-soft);
  margin: 0 0 18px;
}
.spec {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
  align-items: baseline;
}
.spec dt {
  color: var(--text-muted);
}
.spec dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
  text-align: right;
}

/* ------------------------------- responsivo ----------------------------- */
@media (min-width: 620px) {
  .infra-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 980px) {
  .docs {
    grid-template-columns: 232px minmax(0, 1fr);
    gap: 56px;
    padding: 34px 0 72px;
  }
  .docs__side {
    display: block;
  }
  .infra-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media print {
  .docs__side,
  .code__copy,
  .page-hero__actions {
    display: none !important;
  }
  .docs {
    display: block;
  }
}

/* ------------------------- correções de largura (mobile) ---------------- */
.prose,
.prose section,
.docs__main {
  min-width: 0;
}
.spec-list {
  max-width: 100%;
}
.spec {
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
}
.spec dt,
.spec dd {
  overflow-wrap: anywhere;
}
.prose code {
  overflow-wrap: anywhere;
}
@media (max-width: 620px) {
  .spec {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
  .spec dd {
    text-align: left;
  }
}
