/* =====================================================================
   NexusForge AI — User Documentation
   Brand: red #F9112F on dark. Blacksmith-hammer identity.
   ===================================================================== */

:root {
  --red:        #F9112F;
  --red-2:      #FF3B4E;
  --red-soft:   #FF6B78;
  --bg:         #0D0D0D;
  --bg-2:       #121212;
  --panel:      #1C1C1C;
  --panel-2:    #222222;
  --card:       #181818;
  --card-hover: #1F1F1F;
  --border:     #2E2E2E;
  --border-2:   #3A3A3A;
  --text:       #FFFFFF;
  --muted:      #B8B8B8;
  --muted-2:    #8A8A8A;

  --green:      #3FB950;
  --amber:      #E3A008;
  --blue:       #4A9EFF;

  --radius:     14px;
  --radius-sm:  10px;
  --maxw:       1180px;
  --nav-h:      64px;

  --shadow:     0 18px 50px rgba(0,0,0,.55);
  --shadow-sm:  0 6px 20px rgba(0,0,0,.35);
  --glow:       0 0 0 1px rgba(249,17,47,.35), 0 12px 40px rgba(249,17,47,.22);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 18px); }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
code, pre { font-family: var(--mono); }

/* ---------- Scrollbar ---------- */
html { scrollbar-width: thin; scrollbar-color: var(--red) var(--bg-2); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--red-2), #b00c22);
  border: 3px solid var(--bg-2);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, var(--red-soft), var(--red)); }
::-webkit-scrollbar-corner { background: var(--bg-2); }
/* slim variant for the sidebar */
.toc { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
.toc::-webkit-scrollbar { width: 8px; }
.toc::-webkit-scrollbar-track { background: transparent; }
.toc::-webkit-scrollbar-thumb { background: var(--border-2); border: 2px solid var(--bg); border-radius: 999px; }
.toc::-webkit-scrollbar-thumb:hover { background: var(--red); }

/* ---------- i18n toggle ---------- */
html[data-lang="en"] .l-pt { display: none !important; }
html[data-lang="pt"] .l-en { display: none !important; }

/* ---------- Background glow ---------- */
.bg-grid {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(900px 500px at 78% -8%, rgba(249,17,47,.16), transparent 60%),
    radial-gradient(700px 500px at 8% 4%, rgba(255,59,78,.08), transparent 55%);
  pointer-events: none;
}
.bg-grid::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(1000px 700px at 60% 0%, #000 30%, transparent 75%);
}

/* ====================================================================
   NAVBAR
   ==================================================================== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-h); z-index: 100;
  display: flex; align-items: center; gap: 20px;
  padding: 0 22px;
  background: rgba(13,13,13,.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.nav-brand { display: flex; align-items: center; gap: 11px; font-weight: 800; letter-spacing: -.2px; }
.nav-brand img { width: 30px; height: 30px; border-radius: 8px; padding: 4px; background: linear-gradient(160deg, #262626, #141414); border: 1px solid var(--border); }
.nav-brand b { color: var(--red); }
.nav-brand span { font-size: 16px; }
.nav-links { display: flex; gap: 4px; margin-left: 8px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  padding: 8px 13px; border-radius: 9px; font-size: 13.5px; color: var(--muted);
  white-space: nowrap; transition: all .15s;
}
.nav-links a:hover { color: var(--text); background: var(--panel); }
.nav-links a.active { color: var(--text); background: rgba(249,17,47,.14); box-shadow: inset 0 0 0 1px rgba(249,17,47,.3); }
.nav-right { display: flex; align-items: center; gap: 10px; }

.lang-switch { display: flex; background: var(--panel); border: 1px solid var(--border); border-radius: 9px; padding: 3px; }
.lang-switch button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 700; padding: 5px 11px; border-radius: 6px; transition: all .15s;
}
.lang-switch button.on { background: var(--red); color: #fff; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 17px; border-radius: 10px; font-weight: 700; font-size: 14px;
  border: 1px solid var(--border-2); color: var(--text); background: var(--panel);
  cursor: pointer; transition: all .18s; white-space: nowrap;
}
.btn:hover { border-color: var(--border-2); background: var(--panel-2); transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--red-2), var(--red)); border-color: transparent; box-shadow: 0 8px 24px rgba(249,17,47,.32); }
.btn-primary:hover { box-shadow: 0 12px 30px rgba(249,17,47,.45); }
.btn-ghost { background: transparent; }

.nav-burger { display: none; background: var(--panel); border: 1px solid var(--border); color: var(--text);
  width: 40px; height: 40px; border-radius: 9px; cursor: pointer; font-size: 18px; }

/* ====================================================================
   HERO
   ==================================================================== */
.hero {
  position: relative; padding: calc(var(--nav-h) + 80px) 22px 90px;
  text-align: center; overflow: hidden;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 26px;
  padding: 7px 15px; border-radius: 100px; font-size: 13px; font-weight: 600; color: var(--muted);
  background: var(--panel); border: 1px solid var(--border);
}
.hero-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px var(--red); animation: pulse 2.2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }

.hero-logo {
  width: 104px; height: 104px; margin: 0 auto 26px; border-radius: 26px;
  padding: 20px; background: linear-gradient(160deg, #262626, #141414);
  border: 1px solid var(--border);
  box-shadow: var(--glow); animation: float 6s ease-in-out infinite;
}
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }

.hero h1 {
  font-size: clamp(38px, 7vw, 76px); line-height: 1.02; letter-spacing: -2px; font-weight: 900;
}
.hero h1 .grad {
  background: linear-gradient(120deg, #fff 10%, var(--red-soft) 55%, var(--red) 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { max-width: 720px; margin: 22px auto 0; font-size: clamp(16px,2.2vw,20px); color: var(--muted); }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 38px; }
.hero-cta .btn { padding: 13px 24px; font-size: 15px; }

.hero-pills { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 42px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px; border-radius: 100px;
  font-size: 13px; color: var(--muted); background: rgba(255,255,255,.03); border: 1px solid var(--border);
}
.pill svg { width: 15px; height: 15px; color: var(--red); }

/* ====================================================================
   DOCS LAYOUT
   ==================================================================== */
.layout { max-width: var(--maxw); margin: 0 auto; padding: 0 22px 120px; display: grid; grid-template-columns: 246px 1fr; gap: 48px; }

.toc { position: sticky; top: calc(var(--nav-h) + 24px); align-self: start; max-height: calc(100vh - var(--nav-h) - 48px); overflow-y: auto; scrollbar-width: thin; padding-right: 6px; }
.toc h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 1.4px; color: var(--muted-2); margin: 22px 0 8px; padding-left: 12px; }
.toc h4:first-child { margin-top: 4px; }
.toc a { display: block; padding: 7px 12px; border-radius: 8px; font-size: 13.5px; color: var(--muted); border-left: 2px solid transparent; transition: all .15s; }
.toc a:hover { color: var(--text); background: var(--panel); }
.toc a.active { color: var(--red-soft); border-left-color: var(--red); background: rgba(249,17,47,.08); }

.content { min-width: 0; }

/* ---------- Section ---------- */
.sec { padding-top: 8px; margin-bottom: 64px; scroll-margin-top: calc(var(--nav-h) + 18px); }
.sec-tag { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--red); margin-bottom: 10px; }
.sec h2 { font-size: clamp(26px, 4vw, 38px); letter-spacing: -1px; line-height: 1.1; }
.sec h3 { font-size: 21px; margin: 34px 0 12px; letter-spacing: -.4px; }
.sec h4.mini { font-size: 16px; margin: 22px 0 8px; color: var(--text); }
.sec p { color: var(--muted); margin: 12px 0; }
.sec p strong, .sec li strong { color: var(--text); font-weight: 700; }
.sec a.link { color: var(--red-soft); border-bottom: 1px dashed rgba(255,107,120,.4); }
.sec ul.bullets { margin: 14px 0; display: grid; gap: 9px; }
.sec ul.bullets li { color: var(--muted); padding-left: 26px; position: relative; }
.sec ul.bullets li::before { content: ""; position: absolute; left: 6px; top: 11px; width: 7px; height: 7px; border-radius: 2px; background: var(--red); transform: rotate(45deg); }
.lead { font-size: 18px !important; color: var(--muted) !important; }

kbd {
  font-family: var(--mono); font-size: 12px; background: var(--panel-2); border: 1px solid var(--border-2);
  border-bottom-width: 2px; border-radius: 6px; padding: 2px 7px; color: var(--text); white-space: nowrap;
}
.ic { color: var(--text); background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; font-family: var(--mono); font-size: 13px; }
.path { color: var(--red-soft); font-family: var(--mono); font-size: 13.5px; }

/* ---------- Steps ---------- */
.steps { counter-reset: step; display: grid; gap: 14px; margin: 22px 0; }
.step { position: relative; padding: 18px 20px 18px 64px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 18px; top: 18px; width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff;
  background: linear-gradient(135deg, var(--red-2), var(--red)); box-shadow: 0 4px 14px rgba(249,17,47,.4);
}
.step b { display: block; margin-bottom: 3px; font-size: 15.5px; }
.step p { margin: 4px 0 0; font-size: 14px; }

/* ---------- Callouts ---------- */
.note { display: grid; grid-template-columns: 26px 1fr; gap: 12px; padding: 15px 18px; border-radius: var(--radius-sm); margin: 18px 0; font-size: 14.5px; border: 1px solid var(--border); background: var(--card); }
.note .ni { font-size: 18px; line-height: 1.4; }
.note p { margin: 0; }
.note.tip    { border-color: rgba(63,185,80,.35);  background: rgba(63,185,80,.07); }
.note.warn   { border-color: rgba(227,160,8,.35);  background: rgba(227,160,8,.07); }
.note.danger { border-color: rgba(249,17,47,.4);   background: rgba(249,17,47,.08); }
.note.info   { border-color: rgba(74,158,255,.35); background: rgba(74,158,255,.07); }

/* ---------- Code block ---------- */
.code { position: relative; margin: 18px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #0B0B0B; overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; background: var(--panel); border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted-2); }
.code-head .dots { display: flex; gap: 6px; }
.code-head .dots i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.code-head .dots i:nth-child(1){ background:#ff5f57 } .code-head .dots i:nth-child(2){ background:#febc2e } .code-head .dots i:nth-child(3){ background:#28c840 }
.code pre { padding: 16px 18px; overflow-x: auto; font-size: 13.5px; line-height: 1.7; color: #E6E6E6; }
.code .c-key { color: var(--red-soft); } .code .c-str { color: #9ad29a; } .code .c-cmt { color: var(--muted-2); font-style: italic; } .code .c-fn { color: #d2a8ff; }
.copy-btn { background: var(--panel-2); border: 1px solid var(--border-2); color: var(--muted); border-radius: 7px; padding: 4px 10px; font-size: 11.5px; cursor: pointer; font-family: var(--font); font-weight: 600; }
.copy-btn:hover { color: var(--text); }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 16px; margin: 22px 0; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; transition: all .2s; }
.card:hover { border-color: var(--border-2); background: var(--card-hover); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.card .emoji { font-size: 26px; display: block; margin-bottom: 10px; }
.card h4 { font-size: 16px; margin-bottom: 6px; }
.card p { font-size: 13.5px; margin: 0; color: var(--muted); }

/* agent cards */
.agent { display: flex; gap: 14px; align-items: flex-start; }
.agent .ava { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--panel-2); border: 1px solid var(--border); }
.agent .meta b { font-size: 15px; } .agent .meta p { font-size: 13px; margin-top: 2px; }

/* ---------- Tool entry ---------- */
.tool { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0; margin: 16px 0; overflow: hidden; }
.tool-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); background: linear-gradient(90deg, rgba(249,17,47,.05), transparent); }
.tool-head .tico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 20px; background: var(--panel-2); border: 1px solid var(--border); }
.tool-head .tname { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--text); }
.tool-head .tsub { font-size: 12.5px; color: var(--muted-2); }
.tool-body { padding: 16px 20px; }
.tool-body p { margin: 0 0 10px; font-size: 14px; }
.tool-body .ex { font-size: 13px; color: var(--muted); background: var(--bg-2); border: 1px dashed var(--border-2); border-radius: 9px; padding: 10px 13px; margin-top: 6px; }
.tool-body .ex .q { color: var(--red-soft); font-weight: 600; }

.risk { font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; padding: 4px 9px; border-radius: 100px; white-space: nowrap; margin-left: auto; }
.risk.read   { color: var(--green); background: rgba(63,185,80,.12);  border: 1px solid rgba(63,185,80,.35); }
.risk.mut    { color: var(--amber); background: rgba(227,160,8,.12);  border: 1px solid rgba(227,160,8,.35); }
.risk.destr  { color: var(--red);   background: rgba(249,17,47,.12);  border: 1px solid rgba(249,17,47,.4); }
.risk.sys    { color: var(--blue);  background: rgba(74,158,255,.12); border: 1px solid rgba(74,158,255,.35); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; margin: 20px 0; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 520px; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--border); }
th { background: var(--panel); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted-2); font-weight: 700; }
td { color: var(--muted); } td strong { color: var(--text); }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(255,255,255,.015); }

/* ---------- Prompt gallery ---------- */
.prompts { display: grid; gap: 12px; grid-template-columns: repeat(2,1fr); margin: 20px 0; }
.prompt { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; font-size: 14px; color: var(--muted); position: relative; transition: all .18s; }
.prompt:hover { border-color: rgba(249,17,47,.4); transform: translateY(-2px); }
.prompt::before { content: "❝"; color: var(--red); font-size: 26px; font-weight: 900; line-height: 0; position: relative; top: 8px; margin-right: 6px; }
.prompt .tag { display: inline-block; margin-top: 10px; font-size: 11px; color: var(--red-soft); background: rgba(249,17,47,.08); padding: 3px 9px; border-radius: 6px; }

/* ---------- Videos ---------- */
.videos { display: grid; gap: 18px; grid-template-columns: repeat(2, 1fr); margin: 24px 0; }
.video { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: all .2s; }
.video:hover { border-color: var(--border-2); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.video-frame { position: relative; aspect-ratio: 16/9; background: linear-gradient(160deg, var(--panel), var(--bg-2)); display: grid; place-items: center; overflow: hidden; }
.video-frame iframe, .video-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-ph { text-align: center; color: var(--muted-2); display: grid; gap: 10px; justify-items: center; padding: 20px; }
.video-ph .play { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: rgba(249,17,47,.14); border: 1px solid rgba(249,17,47,.35); }
.video-ph .play svg { width: 24px; height: 24px; color: var(--red); margin-left: 3px; }
.video-ph code { font-size: 12px; color: var(--red-soft); }
.video-meta { padding: 15px 18px; }
.video-meta b { font-size: 15px; } .video-meta p { font-size: 13px; margin-top: 3px; color: var(--muted); }

/* Custom fullscreen / maximize button */
.video-fs {
  position: absolute; top: 11px; right: 11px; z-index: 4;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 12px;
  font: 600 12px/1 var(--font); letter-spacing: .2px; color: #fff;
  background: rgba(13,13,13,.5);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 10px; cursor: pointer;
  -webkit-backdrop-filter: blur(10px) saturate(140%); backdrop-filter: blur(10px) saturate(140%);
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  opacity: .55; transform: translateY(-3px);
  transition: opacity .22s ease, transform .22s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.video-frame:hover .video-fs { opacity: 1; transform: none; }
.video-fs:focus-visible { opacity: 1; transform: none; outline: none; }
.video-fs:hover {
  background: linear-gradient(160deg, var(--red), #c00d24);
  border-color: rgba(255,255,255,.3);
  box-shadow: var(--glow);
}
.video-fs:active { transform: scale(.96); }
.video-fs svg { width: 15px; height: 15px; flex: none; }
.video-fs.is-fs svg { transform: rotate(0); }
@media (max-width: 720px) { .video-fs { opacity: .92; } .video-fs .video-fs-txt { display: none; } }

/* ---------- FAQ ---------- */
.faq { margin: 20px 0; display: grid; gap: 10px; }
details.qa { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
details.qa summary { padding: 16px 20px; cursor: pointer; font-weight: 700; font-size: 15px; list-style: none; display: flex; justify-content: space-between; gap: 14px; align-items: center; }
details.qa summary::-webkit-details-marker { display: none; }
details.qa summary::after { content: "+"; color: var(--red); font-size: 22px; font-weight: 400; transition: transform .2s; }
details.qa[open] summary::after { transform: rotate(45deg); }
details.qa .qa-body { padding: 0 20px 18px; color: var(--muted); font-size: 14px; }
details.qa .qa-body p { margin: 0; }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--border); padding: 46px 22px; text-align: center; color: var(--muted-2); font-size: 13px; background: var(--bg-2); }
footer .f-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); margin-bottom: 14px; }
footer .f-brand img { width: 26px; height: 26px; border-radius: 7px; padding: 3px; background: linear-gradient(160deg, #262626, #141414); border: 1px solid var(--border); }
footer a { color: var(--red-soft); }
footer .disc { max-width: 640px; margin: 12px auto 0; line-height: 1.6; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Mobile sidebar ---------- */
.toc-backdrop { display: none; }

/* ====================================================================
   RESPONSIVE
   ==================================================================== */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .toc {
    position: fixed; top: 0; left: 0; bottom: 0; width: 280px; max-height: none; z-index: 120;
    background: var(--bg-2); border-right: 1px solid var(--border); padding: calc(var(--nav-h) + 14px) 16px 24px;
    transform: translateX(-105%); transition: transform .25s ease;
  }
  .toc.open { transform: none; }
  .toc-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 110; }
  .nav-burger { display: grid; place-items: center; }
  .nav-links { display: none; }
}
@media (max-width: 720px) {
  .grid.cols-2, .grid.cols-3, .prompts, .videos { grid-template-columns: 1fr; }
  .nav-brand span { display: none; }
  .hero-cta .btn { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
