/* Página da API MikWeb. Reaproveita os tokens e o sistema de vidro de style.css. */

:root {
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --code-bg: #040b19;
  --c-get: #4ade80;
  --c-post: #7aa7ff;
  --c-put: #fbbf24;
  --c-delete: #ff8b8b;
}
html:has(.page-api) { scroll-padding-top: 6rem; }

/* ---------- Hero ---------- */
.api-hero {
  position: relative; overflow: clip; isolation: isolate;
  background:
    radial-gradient(55% 70% at 15% 0%, rgb(0 95 250 / .38), transparent 70%),
    radial-gradient(45% 55% at 95% 60%, rgb(91 148 255 / .22), transparent 70%),
    var(--bg);
}
.api-hero-in { display: grid; gap: 2.5rem; align-items: center; padding-block: clamp(3rem, 8vw, 5.5rem) clamp(2rem, 5vw, 3.5rem); }
@media (min-width: 62rem) { .api-hero-in { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 4rem; } }
.api-tag { display: inline-flex; align-items: center; gap: .6rem; margin: 0 0 1.25rem; padding: .35rem .9rem; border-radius: 999px; font-size: var(--step--1); font-weight: 500; color: #cfe0ff; background: rgb(255 255 255 / .06); border: 1px solid var(--line); }
.api-tag .dot { width: .5rem; height: .5rem; border-radius: 50%; background: #4ade80; box-shadow: 0 0 10px #4ade80; }
.api-hero h1 { font-size: var(--step-3); max-width: 16ch; }
.api-hero .lede { margin: 1.25rem 0 0; font-size: var(--step-1); line-height: 1.5; color: #c6d3ea; max-width: 44ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }

.endpoint-pill { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin-top: 1.75rem; padding: .7rem .8rem .7rem 1.1rem; border-radius: 14px; max-width: 34rem; }
.endpoint-pill .lbl { font-size: .75rem; font-weight: 600; color: #9fb4d8; text-transform: uppercase; letter-spacing: .06em; }
.endpoint-pill code { font-family: var(--mono); font-size: .92rem; color: #fff; overflow-wrap: anywhere; flex: 1 1 14rem; }

/* terminal */
.term { border-radius: var(--radius); overflow: hidden; background: linear-gradient(160deg, rgb(8 18 40 / .85), rgb(4 11 25 / .9)); }
.term:hover { translate: none; }
.term-bar { display: flex; align-items: center; gap: .4rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: .78rem; color: #9fb4d8; }
.term-bar i { width: .65rem; height: .65rem; border-radius: 50%; background: rgb(255 255 255 / .18); }
.term-bar i:nth-child(1) { background: #ff6b6b; } .term-bar i:nth-child(2) { background: #fbbf24; } .term-bar i:nth-child(3) { background: #4ade80; }
.term-bar span { margin-left: .6rem; }
.page-api .term-code code { padding: 0; background: none; font-size: inherit; color: inherit; overflow-wrap: normal; white-space: pre; }
.page-api .steps code { white-space: nowrap; overflow-wrap: normal; font-size: .8em; }
.term-code { margin: 0; padding: 1.2rem 1.3rem 1.4rem; overflow-x: auto; font-family: var(--mono); font-size: clamp(.74rem, .7rem + .2vw, .86rem); line-height: 1.7; color: #d6e2f7; }

/* realce de sintaxe (classes do Pygments usadas na documentação) */
.c { color: #7d8fb0; font-style: italic; }
.s2, .s1, .s { color: #9be8b4; }
.nt { color: #8fb6ff; }
.nl { color: #8fb6ff; }
.mi, .mf { color: #ffbf7a; }
.kc { color: #ff97ab; }
.se { color: #f0c674; }
.p, .w { color: #aab8d4; }

/* ---------- Passos ---------- */
.api-steps { background: var(--bg); padding-block: clamp(2rem, 5vw, 3.5rem); }
.steps { display: grid; gap: .9rem; grid-template-columns: 1fr; }
@media (min-width: 62rem) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: start; padding: 1.3rem 1.4rem; border-radius: var(--radius); }
.steps .n { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; font-weight: 600; color: #fff; background: var(--blue); }
.steps h2 { font-size: var(--step-0); margin: .15rem 0 .35rem; max-width: none; }
.steps p { margin: 0; color: var(--muted); font-size: var(--step--1); }
.page-api code { font-family: var(--mono); font-size: .88em; padding: .1em .4em; border-radius: 6px; background: rgb(255 255 255 / .08); color: #d3e1ff; overflow-wrap: anywhere; }
.doc a:not(.anchor), .steps a { color: var(--blue-bright); }

/* ---------- Recursos ---------- */
.api-resources { position: relative; isolation: isolate; overflow: clip; background: var(--bg); padding-block: clamp(3rem, 7vw, 5.5rem); }
.api-resources::before { content: ""; position: absolute; z-index: -1; width: 34rem; height: 34rem; left: 50%; top: 10%; translate: -50% 0; border-radius: 50%; filter: blur(80px); background: rgb(0 95 250 / .28); pointer-events: none; }
.res-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.res { display: grid; align-content: start; gap: .6rem; padding: 1.5rem; border-radius: var(--radius); text-decoration: none; color: inherit; }
.res h3 { font-size: var(--step-1); }
.res p { margin: 0; color: var(--muted); font-size: var(--step--1); }
.res-meta { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .6rem; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.res .count { font-size: .78rem; color: #9fb4d8; white-space: nowrap; }

/* ---------- Métodos HTTP ---------- */
.method { display: inline-block; flex: none; padding: .18rem .5rem; border-radius: 6px; font-family: var(--mono); font-size: .7rem; font-weight: 700; letter-spacing: .03em; line-height: 1.4; border: 1px solid transparent; }
.m-get { color: var(--c-get); background: rgb(74 222 128 / .12); border-color: rgb(74 222 128 / .3); }
.m-post { color: var(--c-post); background: rgb(122 167 255 / .13); border-color: rgb(122 167 255 / .32); }
.m-put { color: var(--c-put); background: rgb(251 191 36 / .12); border-color: rgb(251 191 36 / .3); }
.m-base { color: #b9c8e2; background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .2); }
.m-delete { color: var(--c-delete); background: rgb(255 139 139 / .12); border-color: rgb(255 139 139 / .3); }

/* ---------- Referência ---------- */
.api-ref { background: var(--bg-2); padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.api-layout { display: grid; gap: 1.5rem 3rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 62rem) { .api-layout { grid-template-columns: 17.5rem minmax(0, 1fr); } }

/* índice lateral */
.toc { min-width: 0; }
@media (min-width: 62rem) { .toc { position: sticky; top: 5.5rem; max-height: calc(100vh - 6.5rem); display: flex; flex-direction: column; } }
.toc-toggle { display: none; width: 100%; align-items: center; justify-content: space-between; padding: .85rem 1.1rem; font: 600 var(--step--1) var(--font); color: #fff; background: var(--glass-strong); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.toc-body { display: flex; flex-direction: column; min-height: 0; }
.toc-search input { width: 100%; font: inherit; font-size: var(--step--1); color: #fff; background: rgb(255 255 255 / .06); border: 1.5px solid rgb(255 255 255 / .22); border-radius: 10px; padding: .6rem .8rem; margin-bottom: .75rem; }
.toc-search input::placeholder { color: #8ea3c7; }
.toc-search input:focus { outline: none; border-color: var(--blue-bright); box-shadow: 0 0 0 3px rgb(91 148 255 / .28); }
.toc-list { overflow-y: auto; min-height: 0; padding-right: .25rem; scrollbar-width: thin; scrollbar-color: rgb(255 255 255 / .2) transparent; }
.toc-list ul { margin: 0; padding: 0; list-style: none; }
.toc a { display: flex; align-items: center; gap: .5rem; color: #b7c6e0; text-decoration: none; font-size: .84rem; line-height: 1.35; padding: .38rem .6rem; border-radius: 8px; transition: color .25s var(--ease), background-color .25s var(--ease); }
.toc a:hover { color: #fff; background: rgb(255 255 255 / .06); }
.toc a .method { font-size: .6rem; padding: .08rem .35rem; min-width: 2.6rem; text-align: center; }
.toc .grp > .grp-link { font-weight: 600; color: #fff; font-size: .9rem; margin-top: .5rem; }
.toc a.active { color: #fff; background: rgb(0 95 250 / .28); }
.toc .grp ul { margin: .1rem 0 .4rem .5rem; }
.js .toc .grp ul { display: none; }
.js .toc .grp.open ul, .js .toc.filtering .grp ul { display: block; }
.toc li[hidden], .toc .grp[hidden] { display: none; }
.toc-empty { color: var(--muted); font-size: var(--step--1); margin: .5rem .6rem; }

@media (max-width: 61.99rem) {
  .toc-toggle { display: flex; }
  .toc-body { display: none; margin-top: .6rem; padding: .9rem; background: var(--glass); border: 1px solid var(--line); border-radius: 12px; max-height: 70vh; }
  .toc.open .toc-body { display: flex; }
}

/* ---------- Documentação ---------- */
.doc { min-width: 0; max-width: 58rem; }
.doc > p, .doc li { color: #d3deef; }
.doc p { max-width: 70ch; }
.doc em { color: #fff; font-style: normal; font-weight: 500; }
.doc-h1 { position: relative; font-size: var(--step-2); margin: clamp(3.5rem, 8vw, 5rem) 0 1.25rem; padding-top: clamp(2rem, 5vw, 3rem); border-top: 1px solid var(--line); max-width: none; }
.doc > .doc-h1:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.doc-h2 { font-size: var(--step-1); margin: clamp(2.5rem, 5vw, 3.25rem) 0 1rem; max-width: none; letter-spacing: -0.01em; }
.doc h3 { font-size: 1rem; font-weight: 600; margin: 2rem 0 .8rem; color: #c3d3f0; }
.doc h3:has(+ p code:only-child) { margin-bottom: .5rem; }
.anchor { margin-left: .5rem; font-weight: 400; text-decoration: none; color: #6f86ad; opacity: 0; transition: opacity .25s; }
.doc-h1:hover .anchor, .doc-h2:hover .anchor, .anchor:focus-visible { opacity: 1; }
.hint { margin: 1.25rem 0 .4rem; font-size: var(--step--1); color: var(--muted); }

.endpoint { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .9rem; margin: 1.25rem 0; padding: .7rem .8rem .7rem 1rem; border-radius: 12px; background: rgb(255 255 255 / .05); border: 1px solid var(--line); }
.endpoint code { flex: 1 1 14rem; background: none; padding: 0; font-size: .88rem; color: #fff; overflow-wrap: anywhere; }

.copy { flex: none; font: 500 .75rem var(--font); color: #cfe0ff; background: rgb(255 255 255 / .07); border: 1px solid rgb(255 255 255 / .18); border-radius: 8px; padding: .3rem .7rem; cursor: pointer; transition: background-color .2s, color .2s, border-color .2s; }
.copy:hover { background: rgb(255 255 255 / .14); color: #fff; }
.copy.done { color: #4ade80; border-color: rgb(74 222 128 / .5); }

figure.code { margin: 1.1rem 0 1.4rem; border-radius: 14px; background: var(--code-bg); border: 1px solid rgb(255 255 255 / .1); overflow: hidden; }
figure.code figcaption { display: flex; align-items: center; gap: .75rem; padding: .55rem .6rem .55rem 1rem; border-bottom: 1px solid rgb(255 255 255 / .08); background: rgb(255 255 255 / .03); }
figure.code .cap { flex: 1; min-width: 0; font-size: .8rem; font-weight: 500; color: #b7c6e0; }
figure.code .lang { font-family: var(--mono); font-size: .7rem; color: #8ea3c7; text-transform: uppercase; letter-spacing: .06em; }
figure.code pre { margin: 0; padding: 1rem 1.2rem 1.15rem; overflow: auto; max-height: 26rem; font-family: var(--mono); font-size: .84rem; line-height: 1.65; color: #d6e2f7; tab-size: 2; scrollbar-width: thin; scrollbar-color: rgb(255 255 255 / .2) transparent; }
figure.code code { padding: 0; background: none; font-size: inherit; color: inherit; overflow-wrap: normal; white-space: pre; }

/* Caixas de destaque: o vidro da home, leve (sem desfoque, são muitas na página), com tinta e borda lateral discretas por tipo */
.callout {
  --lit: 0; --tint: 91 148 255; --tint-a: .13;
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; gap: .25rem; margin: 1.1rem 0; padding: .95rem 1.15rem; border-radius: 14px; font-size: var(--step--1); line-height: 1.55;
  background:
    linear-gradient(rgb(var(--tint) / calc(var(--tint-a) + var(--lit) * .04)), rgb(var(--tint) / calc(var(--tint-a) * .4))),
    linear-gradient(150deg, rgb(255 255 255 / calc(.11 + var(--lit) * .09)), rgb(255 255 255 / calc(.04 + var(--lit) * .04)) 65%);
  border: 1px solid rgb(255 255 255 / calc(.10 + var(--lit) * .05)); border-left: 3px solid rgb(var(--tint) / .75);
  box-shadow: 0 calc(8px + var(--lit) * 10px) calc(26px + var(--lit) * 14px) -16px rgb(0 20 80 / calc(.5 + var(--lit) * .25)), 0 0 30px -16px rgb(var(--tint) / calc(var(--lit) * .45)),
    inset 0 1px 0 rgb(255 255 255 / calc(.2 + var(--lit) * .16)), inset 0 -1px 0 rgb(0 0 0 / .16);
  translate: 0 calc(var(--lit) * -2px);
  transition: --lit 1.8s cubic-bezier(.5, 0, .35, 1);
}
.callout::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit; padding: 1px;
  background: linear-gradient(135deg, rgb(255 255 255 / .5), rgb(255 255 255 / 0) 40%, rgb(255 255 255 / 0) 60%, rgb(255 255 255 / .2));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: calc(.55 + var(--lit) * .4);
}
.callout:hover { --lit: 1; transition-duration: 1.3s; }
@media (hover: none), (prefers-reduced-motion: reduce) { .callout { translate: none; } }
.callout strong { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.callout div { color: #dbe6f8; }
.callout p { margin: 0; }
.c-notice { --tint: 91 148 255; --tint-a: .14; } .c-notice strong { color: #8fb6ff; }
.c-warning { --tint: 251 191 36; --tint-a: .13; } .c-warning strong { color: #fbbf24; }
.c-success { --tint: 74 222 128; --tint-a: .11; } .c-success strong { color: #4ade80; }

.table-wrap { margin: 1.1rem 0 1.6rem; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: rgb(255 255 255 / .025); }
.doc table { width: 100%; border-collapse: collapse; font-size: .86rem; line-height: 1.5; }
.doc th { text-align: left; padding: .7rem 1rem; font-size: .74rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: #9fb4d8; background: rgb(255 255 255 / .05); white-space: nowrap; }
.doc td { padding: .7rem 1rem; vertical-align: top; color: #d3deef; border-top: 1px solid var(--line); }
.doc td:first-child { white-space: nowrap; }
.doc td em { color: inherit; font-weight: 400; }
.doc tbody tr:hover td { background: rgb(255 255 255 / .03); }

@media (prefers-reduced-motion: no-preference) {
  .api-hero-copy > * { animation: rise .8s var(--ease) both; }
  .api-hero-copy > :nth-child(2) { animation-delay: .08s; } .api-hero-copy > :nth-child(3) { animation-delay: .16s; }
  .api-hero-copy > :nth-child(4) { animation-delay: .24s; } .api-hero-copy > :nth-child(5) { animation-delay: .32s; }
  .term { animation: rise .9s var(--ease) .2s both; }
}
