/*
 * Postal: documentação (postal.so/docs). Carregado depois de site.css, só nas páginas da documentação.
 * Usa os mesmos tokens de cor (temas claro e escuro), pílulas e cards de 24px do site.
 */

.docs-page {
  --method-get: var(--ok-bg);
  --method-get-ink: var(--ok);
  --method-post: var(--t3);
  --method-post-ink: var(--t3i);
  --method-patch: var(--t2);
  --method-patch-ink: var(--t2i);
  --method-delete: var(--bad-bg);
  --method-delete-ink: var(--bad);
  --docs-header: 68px;
}

html {
  scroll-padding-top: 140px;
}

@media (min-width: 1000px) {
  html {
    scroll-padding-top: 96px;
  }
}

/* Shell: sidebar + content */

.docs-shell {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

@media (min-width: 1000px) {
  .docs-shell {
    display: grid;
    grid-template-columns: 268px minmax(0, 1fr);
    gap: 48px;
    padding: 0 32px;
  }
}

.docs-main {
  min-width: 0;
  padding: 24px 0 96px;
}

@media (min-width: 1000px) {
  .docs-main {
    padding-top: 40px;
  }
}

/* Sidebar */

.docs-sidebar {
  position: sticky;
  top: var(--docs-header);
  z-index: 40;
  margin: 0 calc(var(--gutter) * -1);
  padding: 10px var(--gutter);
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.docs-nav-toggle {
  display: none;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 6px 16px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.docs-nav-toggle > svg:first-child {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  padding: 10px;
  border-radius: 50%;
  background: var(--t3);
  color: var(--t3i);
}

.docs-nav-toggle-label {
  display: grid;
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.docs-nav-toggle-label small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.docs-nav-toggle-label b {
  overflow: hidden;
  font-size: 0.95rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.docs-nav-chevron {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.docs-sidebar.is-open .docs-nav-chevron {
  transform: rotate(180deg);
}

.js .docs-nav-toggle {
  display: flex;
}

.js .docs-nav-panel {
  display: none;
}

.js .docs-sidebar.is-open .docs-nav-panel {
  display: block;
  max-height: calc(100vh - var(--docs-header) - 96px);
  max-height: calc(100dvh - var(--docs-header) - 96px);
  margin-top: 10px;
  padding: 14px 10px 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--rc);
  background: var(--card);
  box-shadow: var(--shadow-lg);
}

/* Without JavaScript the sidebar is a plain block above the content. */
html:not(.js) .docs-sidebar {
  position: static;
  margin: 16px 0 0;
  padding: 0;
  background: none;
  border: 0;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

@media (min-width: 1000px) {
  .docs-sidebar,
  html:not(.js) .docs-sidebar {
    position: sticky;
    top: var(--docs-header);
    align-self: start;
    max-height: calc(100vh - var(--docs-header));
    margin: 0;
    padding: 32px 4px 40px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
    background: none;
    border: 0;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .js .docs-nav-toggle {
    display: none;
  }

  .js .docs-nav-panel,
  .js .docs-sidebar.is-open .docs-nav-panel {
    display: block;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    background: none;
    box-shadow: none;
  }
}

/* Search */

.docs-search {
  position: relative;
  margin: 0 0 18px;
}

.docs-search > svg {
  position: absolute;
  top: 50%;
  left: 15px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.docs-search input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--ink);
  font: inherit;
  font-size: 0.93rem;
  -webkit-appearance: none;
  appearance: none;
}

.docs-search input::placeholder {
  color: var(--muted);
}

.docs-search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.docs-search input:focus-visible {
  outline-offset: 0;
  border-color: var(--focus);
}

.docs-search-key {
  position: absolute;
  top: 50%;
  right: 12px;
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  transform: translateY(-50%);
  pointer-events: none;
}

@media (min-width: 1000px) {
  .js .docs-search-key {
    display: inline-flex;
  }

  .docs-search input:focus + .docs-search-key,
  .docs-search input:not(:placeholder-shown) + .docs-search-key {
    display: none;
  }
}

/* Navigation */

.docs-nav-group + .docs-nav-group {
  margin-top: 22px;
}

.docs-nav-title {
  margin: 0 0 6px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.docs-nav-list,
.docs-nav-sub {
  margin: 0;
  padding: 0;
  list-style: none;
}

.docs-nav-item > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.93rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}

.docs-nav-item > a:hover {
  background: var(--soft);
}

.docs-nav-item > a[aria-current="page"] {
  background: var(--pill);
  color: var(--pill-ink);
}

.docs-nav-item .chip-soon {
  flex-shrink: 0;
}

.docs-nav-sub {
  display: none;
  margin: 6px 0 10px 18px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.docs-nav-item.is-current > .docs-nav-sub {
  display: block;
}

.docs-nav-sub a {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.35;
  text-decoration: none;
}

.docs-nav-sub a:hover {
  background: var(--soft);
  color: var(--ink);
}

.docs-nav-sub a.is-active {
  color: var(--acc-text);
  font-weight: 700;
}

.docs-nav-sub .method {
  flex-shrink: 0;
  min-width: 46px;
  padding: 1px 0;
  font-size: 0.62rem;
}

/* Search results: every matching page and endpoint, nested lists open. */

.docs-nav.is-searching .docs-nav-sub {
  display: block;
}

.docs-nav.is-searching [data-hidden] {
  display: none;
}

.docs-nav-empty {
  margin: 8px 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.docs-nav-empty code {
  white-space: nowrap;
}

/* Page head */

.docs-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.docs-crumbs a {
  color: var(--muted);
  text-decoration: none;
}

.docs-crumbs a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.docs-head {
  max-width: 50rem;
  margin: 0 0 32px;
}

.docs-head .chip {
  margin-bottom: 14px;
}

.docs-head h1 {
  margin: 0 0 14px;
  font-size: clamp(2rem, 4.4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.035em;
}

.docs-lead {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.03rem, 1.6vw, 1.15rem);
}

/* Prose */

.docs-body {
  font-size: 1rem;
}

.docs-body > p,
.doc-section > p,
.doc-section > ul,
.doc-section > ol,
.doc-section > h3,
.docs-body > .callout {
  max-width: 50rem;
}

.docs-body p {
  margin: 0 0 16px;
}

.docs-body ul,
.docs-body ol {
  margin: 0 0 16px;
  padding-left: 22px;
}

.docs-body li {
  margin-bottom: 8px;
}

.docs-body li::marker {
  color: var(--acc-text);
}

.docs-body strong {
  color: var(--ink);
}

.docs-body :not(pre) > code {
  white-space: normal;
  overflow-wrap: anywhere;
  border-radius: 8px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.docs-body a code {
  color: var(--acc-text);
}

.doc-section {
  max-width: 56rem;
  padding-top: 8px;
}

.doc-section + .doc-section,
.endpoint + .doc-section {
  margin-top: 48px;
}

.doc-section > h2,
.endpoint h2 {
  position: relative;
  margin: 0 0 16px;
  font-size: clamp(1.45rem, 2.6vw, 1.75rem);
  scroll-margin-top: 140px;
}

.doc-section h3,
.endpoint-sub {
  margin: 32px 0 12px;
  font-size: 1.2rem;
}

.anchor {
  position: absolute;
  top: 0;
  left: -1.1em;
  width: 1em;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

h2:hover > .anchor,
.anchor:focus-visible {
  opacity: 1;
}

@media (max-width: 1099px) {
  .anchor {
    position: static;
    display: none;
  }
}

/* Cards on the landing page */

.docs-body .docs-cards {
  display: grid;
  gap: 14px;
  max-width: none;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.docs-body .docs-cards li {
  margin: 0;
}

@media (min-width: 640px) {
  .docs-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .docs-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.docs-card {
  display: grid;
  align-content: start;
  gap: 6px;
  height: 100%;
  padding: 22px 24px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.docs-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.docs-card-title {
  font-family: var(--font-head);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.docs-card-title::after {
  content: " →";
  color: var(--acc-text);
}

.docs-card-text {
  color: var(--muted);
  font-size: 0.93rem;
}

.docs-columns {
  columns: 2 14rem;
  column-gap: 24px;
}

.docs-columns li {
  break-inside: avoid;
}

/* Callouts */

.callout {
  margin: 20px 0;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--rt);
  background: var(--card);
}

.callout-info {
  border-left-color: var(--t2i);
}

.callout-warn {
  border-left-color: var(--warn);
}

.callout-soon {
  border-left-color: var(--acc);
}

.callout-title {
  margin: 0 0 4px !important;
  color: var(--ink);
  font-weight: 700;
}

.callout p:last-child {
  margin-bottom: 0;
}

/* Tables */

.table-wrap {
  max-width: 100%;
  margin: 16px 0 20px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--rt);
  background: var(--card);
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.5;
}

.docs-table th {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--card-2);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

.docs-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.docs-table tr:last-child td {
  border-bottom: 0;
}

.docs-table td:first-child {
  white-space: nowrap;
}

.docs-table td:first-child code {
  white-space: nowrap;
}

/* Inside tables, code keeps whole words: the table scrolls sideways instead. */
.docs-body .docs-table code {
  overflow-wrap: normal;
}

.docs-table-wide {
  min-width: 620px;
}

.docs-table-errors td:nth-child(2) code {
  white-space: nowrap;
}

/* Endpoints */

.endpoint {
  display: grid;
  gap: 24px;
  margin-top: 40px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}

.docs-body > p + .endpoint {
  margin-top: 32px;
}

.endpoint-text,
.endpoint-code {
  min-width: 0;
}

.endpoint-code {
  display: grid;
  gap: 16px;
  align-content: start;
}

@media (min-width: 1280px) {
  .endpoint {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 40px;
  }

  .endpoint-code {
    position: sticky;
    top: 96px;
    align-self: start;
  }

  .endpoint-code .code pre {
    max-height: 520px;
  }
}

.endpoint-line {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  margin: 0 0 14px;
  padding: 6px 16px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  width: fit-content;
}

.endpoint-path {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
}

.docs-body .endpoint-path {
  padding: 0;
  background: none;
  border-radius: 0;
  white-space: normal;
}

.path-param {
  color: var(--acc-text);
}

.endpoint-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px !important;
}

.endpoint-meta .chip {
  padding: 4px 12px;
  font-size: 0.78rem;
}

.endpoint-meta .chip a {
  color: inherit;
}

.method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 58px;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.method-get {
  background: var(--method-get);
  color: var(--method-get-ink);
}

.method-post {
  background: var(--method-post);
  color: var(--method-post-ink);
}

.method-patch {
  background: var(--method-patch);
  color: var(--method-patch-ink);
}

.method-delete {
  background: var(--method-delete);
  color: var(--method-delete-ink);
}

/* Parameters */

.params {
  margin: 24px 0 0;
}

.params-title {
  margin: 0 0 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.param-list {
  margin: 0 !important;
  padding: 0 !important;
  list-style: none;
}

.param {
  margin: 0 !important;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.param:last-child {
  border-bottom: 0;
}

.param-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 4px;
}

.docs-body .param-name {
  padding: 0;
  background: none;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.param-type {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.param-req {
  color: var(--warn);
  font-size: 0.76rem;
  font-weight: 700;
}

.param-desc {
  color: var(--muted);
  font-size: 0.93rem;
}

.param-desc p {
  margin: 0;
}

.param-children {
  margin: 10px 0 0;
  padding: 2px 16px;
  border: 1px solid var(--line);
  border-radius: var(--rt);
  background: var(--card-2);
}

.params .table-wrap {
  margin-top: 0;
}

/* Code blocks: site.css .code + a single-panel variant with a label */

.docs-body .code {
  margin: 16px 0;
  box-shadow: none;
}

.endpoint-code .code {
  margin: 0;
}

.code-single .code-bar {
  gap: 10px;
  min-height: 55px;
  padding-left: 18px;
}

.code-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--code-mut);
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.code-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 2px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
}

.code-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.code .code-status-ok {
  background: rgba(126, 224, 191, 0.14);
  color: var(--tok-str);
}

.code .code-status-bad {
  background: rgba(255, 138, 128, 0.14);
  color: #ff9a8f;
}

.param-head .code-status-bad,
.docs-table .code-status-bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.docs-body .code pre,
.js .docs-body .code pre {
  min-height: 0;
  font-size: 0.82rem;
  line-height: 1.7;
}

.code-single .code-copy {
  margin-left: auto;
}

@media (max-width: 560px) {
  .code-single .code-bar {
    align-items: center;
  }

  .docs-body .code pre {
    padding: 16px 16px 20px;
    font-size: 0.78rem;
  }
}

/* Pager */

.docs-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 72px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.docs-pager-link {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 14px 22px;
  border: 1px solid var(--line);
  border-radius: var(--rc);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
}

.docs-pager-link:hover {
  border-color: var(--line-strong);
}

.docs-pager-link small {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.docs-pager-link b {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.docs-pager-link small::before {
  content: "← ";
}

.docs-pager-next {
  text-align: right;
}

.docs-pager-next small::before {
  content: "";
}

.docs-pager-next small::after {
  content: " →";
}

/* The footer sits under the whole docs grid. */

.docs-page .site-footer {
  margin-top: 0;
}

/* Small screens: each table row becomes a stacked card, labelled by its column names. */

@media (max-width: 640px) {
  .docs-table,
  .docs-table tbody,
  .docs-table tr,
  .docs-table td {
    display: block;
    width: 100%;
  }

  .docs-table-wide {
    min-width: 0;
  }

  .docs-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .docs-table tr {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
  }

  .docs-table tr:last-child {
    border-bottom: 0;
  }

  .docs-table td,
  .docs-table td:first-child {
    padding: 0;
    border: 0;
    white-space: normal;
  }

  .docs-table td:first-child {
    font-weight: 700;
  }

  .docs-table td + td {
    margin-top: 6px;
  }

  .docs-table td + td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .docs-body .docs-table code {
    overflow-wrap: anywhere;
  }
}
