/* TWMULT — documentação */

:root {
  --bg: #ffffff;
  --bg-soft: #f5f8f6;
  --surface: #ffffff;
  --border: #dde5e0;
  --text: #13201a;
  --text-muted: #4d5d55;
  --accent: #047857;
  --accent-strong: #065f46;
  --accent-soft: #e3f8ee;
  --code-bg: #f0f4f2;
  --pre-bg: #0d1512;
  --pre-text: #d6e6de;
  --pre-border: #22332c;
  --note-bg: #ecfdf5;
  --note-border: #6ee7b7;
  --warn-bg: #fff7e6;
  --warn-border: #f2c879;
  --sidebar-w: 260px;
  --header-h: 60px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1210;
    --bg-soft: #0f1815;
    --surface: #131e1a;
    --border: #25352e;
    --text: #e6efea;
    --text-muted: #a1b2a9;
    --accent: #34d399;
    --accent-strong: #6ee7b7;
    --accent-soft: #11342a;
    --code-bg: #1a2723;
    --pre-bg: #070d0b;
    --pre-border: #22332c;
    --note-bg: #0f2a21;
    --note-border: #1f7a5a;
    --warn-bg: #2b2210;
    --warn-border: #6b5220;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.65;
  color: var(--text); background: var(--bg);
}
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--accent); color: #fff;
  padding: 8px 14px; border-radius: 6px; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 10px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 40; height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: -0.02em; }
.brand img { width: 28px; height: 28px; }
.brand span { font-weight: 500; color: var(--text-muted); }
.top-links { display: flex; align-items: center; gap: 6px; }
.top-links a { padding: 6px 10px; border-radius: 6px; color: var(--text-muted); text-decoration: none; font-weight: 500; font-size: .95rem; }
.top-links a:hover { color: var(--text); background: var(--bg-soft); }
.top-links .app { background: var(--accent); color: #fff; }
.top-links .app:hover { background: var(--accent-strong); color: #fff; }
@media (prefers-color-scheme: dark) {
  .top-links .app, .top-links .app:hover { color: #052e22; }
}
.menu-btn {
  display: none; width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); cursor: pointer; align-items: center; justify-content: center;
}

/* Layout */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); max-width: 1280px; margin: 0 auto; }
.sidebar {
  position: sticky; top: var(--header-h); align-self: start; height: calc(100vh - var(--header-h));
  overflow-y: auto; padding: 24px 16px 40px; border-right: 1px solid var(--border);
}
.sidebar h2 { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin: 20px 10px 6px; }
.sidebar h2:first-child { margin-top: 0; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: .95rem; }
.sidebar a:hover { background: var(--bg-soft); }
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }

.content { padding: 40px 48px 80px; max-width: 860px; min-width: 0; }
.content h1 { font-size: clamp(1.8rem, 4vw, 2.3rem); line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 12px; }
.content h2 { font-size: 1.45rem; letter-spacing: -0.01em; margin: 48px 0 12px; padding-top: 8px; border-top: 1px solid var(--border); padding-top: 28px; }
.content h3 { font-size: 1.12rem; margin: 32px 0 8px; }
.content h2 + h3 { margin-top: 16px; }
.lead { font-size: 1.12rem; color: var(--text-muted); }
.content li + li { margin-top: 4px; }

.anchor { color: inherit; text-decoration: none; }
.anchor:hover::after { content: " #"; color: var(--text-muted); }

@media (max-width: 900px) {
  .menu-btn { display: inline-flex; }
  .top-links .hide-sm { display: none; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: var(--header-h) 0 0 0; z-index: 30; height: auto;
    background: var(--bg); border-right: 0; display: none;
  }
  .sidebar.is-open { display: block; }
  .content { padding: 28px 20px 64px; }
}
@media (max-width: 420px) {
  .top { padding: 0 12px; }
  .brand span { display: none; }
  .content { padding: 24px 16px 56px; }
}

/* Inline code, pre */
code { font-family: var(--mono); font-size: .88em; background: var(--code-bg); padding: .12em .38em; border-radius: 5px; overflow-wrap: anywhere; }
.code-block { position: relative; margin: 16px 0 20px; }
.code-block .label {
  display: block; font-family: var(--mono); font-size: .75rem; color: var(--text-muted); margin-bottom: 4px;
}
pre {
  margin: 0; background: var(--pre-bg); color: var(--pre-text); border: 1px solid var(--pre-border);
  border-radius: 10px; padding: 16px 76px 16px 18px; overflow-x: auto; font-size: .86rem; line-height: 1.6; tab-size: 2;
}
pre code { background: none; padding: 0; font-size: inherit; color: inherit; overflow-wrap: normal; }
.copy-btn {
  position: absolute; right: 8px; top: 8px;
  font: 600 .75rem/1 var(--font); padding: 6px 10px; border-radius: 6px; cursor: pointer;
  color: #d6e6de; background: #1d2b26; border: 1px solid #33473f; opacity: .9;
}
.copy-btn:hover, .copy-btn:focus-visible { opacity: 1; background: #26372f; }
.copy-btn:focus-visible { outline-color: #6ee7b7; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 16px 0 24px; border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--bg-soft); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td:first-child code { white-space: nowrap; overflow-wrap: normal; }

/* Callouts */
.note, .warn { border-left: 4px solid; border-radius: 8px; padding: 12px 16px; margin: 20px 0; }
.note { background: var(--note-bg); border-color: var(--note-border); }
.warn { background: var(--warn-bg); border-color: var(--warn-border); }
.note p, .warn p { margin: 0; }
.note p + p, .warn p + p { margin-top: 8px; }

/* Endpoint heading */
.endpoint { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-family: var(--mono); font-size: .95rem; margin: 12px 0; }
.method {
  font-family: var(--mono); font-size: .74rem; font-weight: 700; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 5px; color: #fff;
}
.m-get { background: #2563eb; }
.m-post { background: #047857; }
.m-patch { background: #b45309; }
.m-delete { background: #b91c1c; }
.endpoint code { background: none; padding: 0; font-size: 1em; }

/* Cards grid on index */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin: 20px 0; padding: 0; list-style: none; }
.cards li + li { margin: 0; }
.cards a {
  display: block; height: 100%; padding: 16px; border: 1px solid var(--border); border-radius: 10px;
  text-decoration: none; color: var(--text); background: var(--surface);
}
.cards a:hover { border-color: var(--accent); }
.cards strong { display: block; color: var(--accent); margin-bottom: 4px; }
.cards span { color: var(--text-muted); font-size: .92rem; }

/* Pager */
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--border); }
.pager a { display: block; padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px; text-decoration: none; max-width: 48%; }
.pager a:hover { border-color: var(--accent); }
.pager small { display: block; color: var(--text-muted); }
.pager .next { margin-left: auto; text-align: right; }

.page-footer { margin-top: 40px; color: var(--text-muted); font-size: .88rem; }
