/*
 * Documentação pública do Throne (/docs/*).
 * Leve de propósito: sem fundo fixo, sem desfoque, sem animação de entrada.
 * O cabeçalho (.tdh) também é usado na página da referência OpenAPI.
 */
@font-face {
    font-family: 'KnightWish';
    src: url('/fonts/knightwish/KnightWish-Regular.otf') format('opentype');
    font-display: swap;
}

:root {
    --d-bg: #0b0814;
    --d-bg-2: #100c1c;
    --d-panel: #151027;
    --d-panel-2: #1b1531;
    --d-border: #2a2144;
    --d-border-2: #3a2e5c;
    --d-text: #ece9f5;
    --d-muted: #a99fc4;
    --d-faint: #7d7499;
    --d-accent: #b591f2;
    --d-accent-2: #8a48f5;
    --d-brand: #5b2fcb;
    --d-ok: #34d399;
    --d-warn: #f5b84b;
    --d-code-bg: #0e0a19;
    --d-radius: 10px;
    --d-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --d-sans: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    --d-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- Cabeçalho ---------- */
.tdh {
    background: linear-gradient(180deg, #120b24 0%, var(--d-bg) 100%);
    border-bottom: 1px solid var(--d-border);
    font-family: var(--d-sans);
}
.tdh__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 12px 28px 4px;
}
.tdh__brand { display: inline-flex; align-items: center; flex-shrink: 0; }
.tdh__brand img { display: block; height: 110px; width: auto; max-width: 300px; object-fit: contain; }
.tdh__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.tdh__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 14px;
    border: 1px solid var(--d-border-2);
    border-radius: 8px;
    background: var(--d-panel);
    color: var(--d-text);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s var(--d-ease), border-color 0.2s var(--d-ease);
}
.tdh__btn:hover { background: var(--d-panel-2); border-color: var(--d-accent); }
.tdh__btn--primary { background: var(--d-brand); border-color: var(--d-brand); color: #fff; font-weight: 600; }
.tdh__btn--primary:hover { background: var(--d-accent-2); border-color: var(--d-accent-2); }
.tdh__nav {
    display: flex;
    gap: 4px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 6px 28px 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.tdh__nav::-webkit-scrollbar { display: none; }
.tdh__link {
    position: relative;
    padding: 12px 14px 14px;
    color: var(--d-muted);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color 0.2s var(--d-ease), border-color 0.2s var(--d-ease);
}
.tdh__link:hover { color: var(--d-text); }
.tdh__link.is-active { color: #fff; border-bottom-color: var(--d-accent); }
.tdh a:focus-visible, .docs-page a:focus-visible, .docs-page button:focus-visible, .docs-page summary:focus-visible {
    outline: 2px solid var(--d-accent);
    outline-offset: 2px;
    border-radius: 6px;
}

@media (max-width: 900px) {
    .tdh__top { flex-wrap: wrap; padding: 10px 16px 0; gap: 10px; }
    .tdh__brand img { height: 72px; }
    .tdh__actions { justify-content: flex-start; }
    .tdh__btn { padding: 8px 11px; font-size: 13px; }
    .tdh__nav { padding: 4px 16px 0; }
    .tdh__link { padding: 11px 11px 12px; font-size: 14px; }
}
@media (max-width: 520px) {
    .tdh__brand img { height: 56px; }
}

/* Status ao vivo e listas de verificação */
.health { display: inline-flex; align-items: center; gap: 10px; padding: 12px 16px; border: 1px solid var(--d-border); border-radius: var(--d-radius); background: var(--d-bg-2); color: var(--d-muted); }
.health::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--d-faint); flex-shrink: 0; }
.health--ok { color: var(--d-text); border-color: rgba(52, 211, 153, 0.4); }
.health--ok::before { background: var(--d-ok); }
.health--bad { color: var(--d-text); border-color: rgba(245, 184, 75, 0.5); }
.health--bad::before { background: var(--d-warn); }
.prose li:has(> input[type="checkbox"]) { list-style: none; margin-left: -22px; }
.prose input[type="checkbox"] { width: 15px; height: 15px; margin: 0 8px 0 0; vertical-align: -2px; accent-color: var(--d-accent); }

/* ---------- Página de guia ---------- */
body.docs-page {
    margin: 0;
    background: var(--d-bg);
    color: var(--d-text);
    font-family: var(--d-sans);
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
.docs-page *, .docs-page *::before, .docs-page *::after { box-sizing: border-box; }
.skip { position: absolute; left: -9999px; top: 8px; }
.skip:focus { left: 16px; z-index: 50; padding: 8px 12px; background: var(--d-brand); color: #fff; border-radius: 6px; }

.docs-shell {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr) 220px;
    gap: 48px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 32px 28px 64px;
}
.docs-main { min-width: 0; max-width: 820px; }

/* Menu lateral */
.docs-side__box { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; padding-right: 6px; }
.docs-side__toggle {
    display: none;
    cursor: pointer;
    padding: 12px 14px;
    border: 1px solid var(--d-border-2);
    border-radius: var(--d-radius);
    background: var(--d-panel);
    font-weight: 600;
    list-style: none;
}
.docs-side__toggle::-webkit-details-marker { display: none; }
.docs-side__group {
    margin: 22px 0 6px;
    color: var(--d-faint);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.docs-side__group:first-child { margin-top: 0; }
.docs-side ul { list-style: none; margin: 0; padding: 0; }
.docs-side li a {
    display: block;
    padding: 6px 10px;
    border-radius: 7px;
    color: var(--d-muted);
    font-size: 15px;
    line-height: 1.45;
    text-decoration: none;
    transition: background-color 0.2s var(--d-ease), color 0.2s var(--d-ease);
}
.docs-side li a:hover { background: var(--d-panel); color: var(--d-text); }
.docs-side li a.is-active { background: var(--d-panel-2); color: #fff; box-shadow: inset 2px 0 0 var(--d-accent); }

/* Cabeça do guia */
.docs-eyebrow { margin: 0 0 6px; color: var(--d-accent); font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.docs-title {
    margin: 0 0 10px;
    font-family: 'KnightWish', Georgia, serif;
    font-size: clamp(34px, 4.4vw, 52px);
    font-weight: 400;
    line-height: 1.05;
    letter-spacing: -0.01em;
    color: #fff;
}
.docs-lead { margin: 0 0 18px; color: var(--d-muted); font-size: 18px; line-height: 1.6; max-width: 70ch; }
.docs-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 30px; }
.docs-tool {
    padding: 7px 12px;
    border: 1px solid var(--d-border);
    border-radius: 7px;
    background: transparent;
    color: var(--d-muted);
    font: 500 13px/1 var(--d-sans);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s var(--d-ease), border-color 0.2s var(--d-ease);
}
.docs-tool:hover { color: var(--d-text); border-color: var(--d-border-2); }

/* Cartões da página inicial */
.docs-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 6px 0 40px; }
.docs-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px;
    border: 1px solid var(--d-border);
    border-radius: 12px;
    background: var(--d-bg-2);
    color: var(--d-muted);
    font-size: 14px;
    line-height: 1.5;
    text-decoration: none;
    transition: border-color 0.2s var(--d-ease), background-color 0.2s var(--d-ease);
}
.docs-card strong { color: #fff; font-size: 17px; font-weight: 600; }
.docs-card__kicker { color: var(--d-accent); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.docs-card:hover { border-color: var(--d-accent); background: var(--d-panel); }

/* Texto do guia */
.prose { color: var(--d-text); }
.prose > :first-child { margin-top: 0; }
.prose h2 {
    margin: 52px 0 14px;
    padding-top: 6px;
    font-size: 27px;
    line-height: 1.25;
    font-weight: 650;
    letter-spacing: -0.01em;
    color: #fff;
    scroll-margin-top: 20px;
}
.prose h3 { margin: 34px 0 10px; font-size: 20px; line-height: 1.35; font-weight: 600; color: #fff; scroll-margin-top: 20px; }
.prose h4 { margin: 24px 0 8px; font-size: 16px; font-weight: 600; color: #fff; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose li > ul, .prose li > ol { margin: 4px 0; }
.prose a { color: var(--d-accent); text-decoration: underline; text-decoration-color: rgba(181, 145, 242, 0.4); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--d-accent); }
.prose strong { color: #fff; font-weight: 600; }
.prose hr { margin: 40px 0; border: 0; border-top: 1px solid var(--d-border); }
.prose :not(pre) > code {
    padding: 2px 6px;
    border: 1px solid var(--d-border);
    border-radius: 5px;
    background: var(--d-panel);
    color: #e2d5ff;
    font: 0.88em/1.4 var(--d-mono);
    word-break: break-word;
}
.anchor { margin-left: 8px; color: var(--d-faint); font-weight: 400; text-decoration: none; opacity: 0; transition: opacity 0.2s var(--d-ease); }
.prose h2:hover .anchor, .prose h3:hover .anchor, .anchor:focus { opacity: 1; }

/* Tabelas */
.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--d-border); border-radius: var(--d-radius); }
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.5; }
.prose th, .prose td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--d-border); }
.prose th { background: var(--d-panel); color: #fff; font-weight: 600; white-space: nowrap; }
.prose tr:last-child td { border-bottom: 0; }
.prose td code { white-space: nowrap; }

/* Avisos */
.prose blockquote { margin: 0 0 20px; padding: 14px 18px; border: 1px solid var(--d-border); border-left: 3px solid var(--d-accent); border-radius: var(--d-radius); background: var(--d-bg-2); color: var(--d-text); }
.prose blockquote p:last-child { margin-bottom: 0; }
.callout__label { display: inline-block; margin-right: 6px; color: var(--d-accent); }
.callout--warning { border-left-color: var(--d-warn); }
.callout--warning .callout__label { color: var(--d-warn); }
.callout--tip { border-left-color: var(--d-ok); }
.callout--tip .callout__label { color: var(--d-ok); }

/* Código */
.code { margin: 0 0 22px; border: 1px solid var(--d-border); border-radius: var(--d-radius); background: var(--d-code-bg); overflow: hidden; }
.code__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 42px;
    padding: 0 8px 0 14px;
    border-bottom: 1px solid var(--d-border);
    background: var(--d-bg-2);
}
.code__label { color: var(--d-muted); font: 500 13px/1 var(--d-sans); }
.code__tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-left: -6px; }
.code__tabs::-webkit-scrollbar { display: none; }
.code__tab {
    padding: 12px 10px 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--d-muted);
    font: 500 13px/1 var(--d-sans);
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.2s var(--d-ease), border-color 0.2s var(--d-ease);
}
.code__tab:hover { color: var(--d-text); }
.code__tab[aria-selected="true"] { color: #fff; border-bottom-color: var(--d-accent); }
.code__copy {
    flex-shrink: 0;
    padding: 7px 11px;
    border: 1px solid var(--d-border-2);
    border-radius: 6px;
    background: var(--d-panel);
    color: var(--d-muted);
    font: 500 12.5px/1 var(--d-sans);
    cursor: pointer;
    transition: color 0.2s var(--d-ease), border-color 0.2s var(--d-ease);
}
.code__copy:hover { color: var(--d-text); border-color: var(--d-accent); }
.code__copy.is-done { color: var(--d-ok); border-color: var(--d-ok); }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; font: 13.5px/1.65 var(--d-mono); color: #e7e2f5; tab-size: 4; }
.code pre[hidden] { display: none; }
.code code { font: inherit; white-space: pre; }

/* Rodapé do guia */
.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--d-border); }
.docs-pager__link {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 16px;
    border: 1px solid var(--d-border);
    border-radius: var(--d-radius);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.2s var(--d-ease);
}
.docs-pager__link span { color: var(--d-faint); font-size: 13px; font-weight: 500; }
.docs-pager__link:hover { border-color: var(--d-accent); }
.docs-pager__link--next { text-align: right; grid-column: 2; }

/* Sumário */
.docs-toc { position: relative; }
.docs-toc ul { position: sticky; top: 52px; list-style: none; margin: 0; padding: 0 0 0 12px; border-left: 1px solid var(--d-border); max-height: calc(100vh - 80px); overflow-y: auto; }
.docs-toc__title { position: sticky; top: 20px; margin: 0 0 10px; color: var(--d-faint); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.docs-toc li a { display: block; padding: 4px 0; color: var(--d-faint); font-size: 13.5px; line-height: 1.45; text-decoration: none; transition: color 0.2s var(--d-ease); }
.docs-toc li a:hover, .docs-toc li a.is-active { color: var(--d-text); }
.docs-toc li a.is-active { color: var(--d-accent); }
.docs-toc__l3 a { padding-left: 12px !important; }

.docs-foot { max-width: 1440px; margin: 0 auto; padding: 26px 28px 40px; border-top: 1px solid var(--d-border); color: var(--d-faint); font-size: 14px; }
.docs-foot p { margin: 4px 0; }
.docs-foot a { margin-right: 14px; color: var(--d-muted); }
.docs-foot code { font-family: var(--d-mono); color: var(--d-muted); }

@media (max-width: 1240px) {
    .docs-shell { grid-template-columns: 230px minmax(0, 1fr); gap: 40px; }
    .docs-toc { display: none; }
}
@media (max-width: 900px) {
    .docs-shell { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 18px 16px 48px; }
    .docs-side__box { position: static; max-height: none; overflow: visible; padding: 0; }
    .docs-side__toggle { display: block; }
    .docs-side__box[open] nav { margin-top: 10px; padding: 6px 4px 10px; }
    .docs-lead { font-size: 16.5px; }
    .prose h2 { font-size: 23px; margin-top: 42px; }
    .docs-pager { grid-template-columns: 1fr; }
    .docs-pager__link--next { grid-column: 1; }
    .docs-foot { padding: 22px 16px 36px; }
}

@media (prefers-reduced-motion: reduce) {
    .tdh *, .docs-page * { transition: none !important; }
}
