/* SELVAPI — mundo visual: catálogo técnico de ferramentas. Aço frio como superfície,
   vermelho como único acento, tipografia condensada. Ver docs/DESIGN.md. */

@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-latin-wdth-normal.woff2") format("woff2");
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-latin-ext-wdth-normal.woff2") format("woff2");
  font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800; font-display: swap;
}

:root {
  --bg: #eef0f2; --surface: #ffffff; --surface-2: #e3e6ea; --line: #cfd4da;
  --ink: #15171a; --ink-2: #3d434b; --ink-3: #565d67;
  --red: #c4251c; --red-ink: #a81f17; --on-red: #ffffff; --steel: #8b95a1;
  --get: #1d4ed8; --post: #166534; --err: #b42318; --ok: #166534;
  --sans: "Archivo", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111315; --surface: #181b1e; --surface-2: #22262a; --line: #2f343a;
    --ink: #eceef0; --ink-2: #c2c8ce; --ink-3: #a0a8b1;
    --red: #e5483c; --red-ink: #ff7a6e; --on-red: #120a09; --steel: #9aa4af;
    --get: #8fb0ff; --post: #6fd99a; --err: #ff8a80; --ok: #6fd99a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111315; --surface: #181b1e; --surface-2: #22262a; --line: #2f343a;
  --ink: #eceef0; --ink-2: #c2c8ce; --ink-3: #a0a8b1;
  --red: #e5483c; --red-ink: #ff7a6e; --on-red: #120a09; --steel: #9aa4af;
  --get: #8fb0ff; --post: #6fd99a; --err: #ff8a80; --ok: #6fd99a;
  color-scheme: dark;
}

/* ---------- base e superfícies do navegador ---------- */
* { box-sizing: border-box; }
html { scrollbar-color: var(--line) transparent; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.55 var(--sans); font-stretch: 100%; caret-color: var(--red); accent-color: var(--red); }
::selection { background: color-mix(in srgb, var(--red) 28%, transparent); color: var(--ink); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }
a { color: var(--red-ink); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
code, pre, .out, .mono { font-family: var(--mono); font-size: 0.8125rem; }
code { background: var(--surface-2); padding: 0.1em 0.4em; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3 { font-stretch: 78%; font-weight: 800; letter-spacing: -0.02em; line-height: 1.05; text-wrap: balance; margin: 0; }
h2 { font-size: 1.5rem; }
b { font-weight: 650; }
.i { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 20; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* ---------- barra superior ---------- */
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; padding: 10px clamp(16px, 4vw, 40px);
  background: var(--bg); border-bottom: 1px solid var(--line); }
.mark { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-stretch: 80%; font-weight: 800; font-size: 1.25rem; letter-spacing: -0.01em; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1; }
.tabs a { color: var(--ink-2); text-decoration: none; padding: 8px 12px; border-radius: 6px; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--ink); background: var(--surface-2); }
.tabs a.active { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-weight: 650; }
.doclink { color: var(--ink-2); font-weight: 500; white-space: nowrap; text-decoration: none; padding: 7px 12px; border: 1px solid var(--line); border-radius: 6px; transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease); }
.doclink:hover { color: var(--ink); border-color: var(--ink-3); background: var(--surface-2); }
.doclink.kofi-open { color: var(--red-ink); border-color: color-mix(in srgb, var(--red) 55%, var(--line)); }
.doclink.kofi-open:hover { color: var(--red-ink); border-color: var(--red); }
.kofi { position: fixed; inset: auto clamp(16px, 4vw, 40px) 16px auto; margin: 0; width: min(380px, calc(100vw - 32px)); height: min(640px, calc(100dvh - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); display: none; flex-direction: column; }
.kofi:popover-open { display: flex; }
.kofi-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.kofi iframe { flex: 1; width: 100%; border: 0; background: #fff; }
@media (max-width: 760px) { .doclink { display: none; } .bar { gap: 12px; } .mark { font-size: 1.125rem; gap: 6px; } .mark svg { width: 32px; } .tabs a { padding: 12px 12px; } .rail-select select { min-height: 44px; } }

main { max-width: 1320px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }

/* ---------- abertura ---------- */
.intro { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr); gap: clamp(24px, 5vw, 72px); align-items: end; padding: clamp(40px, 7vw, 88px) 0 clamp(32px, 5vw, 56px); }
.intro h1 { font-size: clamp(2.25rem, 5.2vw, 4.25rem); max-width: 17ch; }
.lede, .note, p { text-wrap: pretty; }
.lede { font-size: 1.125rem; color: var(--ink-2); max-width: 60ch; margin: 20px 0 0; }
.lede b { color: var(--ink); }
.try { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: grid; gap: 14px; }
.try > label { font-weight: 650; font-size: 0.9375rem; color: var(--ink); }
.try-line { display: flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); overflow: hidden; }
.try-line .verb { font: 600 0.75rem var(--mono); color: var(--get); padding: 0 8px 0 12px; }
.try-line code { background: none; padding: 0; color: var(--ink-3); white-space: nowrap; }
.try-line input { border: 0; background: transparent; flex: 1; min-width: 0; padding: 10px 12px 10px 2px; font: 500 0.8125rem var(--mono); }
.try-line input:focus-visible { outline: none; }
.try-line:focus-within { outline: 2px solid var(--red); outline-offset: 2px; }
.try-out { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.try-actions .ghost { white-space: nowrap; }
.try-out img { width: 168px; height: 168px; border-radius: 6px; background: #fff; flex: none; }
.try-actions { display: grid; gap: 8px; }
@media (max-width: 900px) { .intro { grid-template-columns: 1fr; align-items: start; } }

/* ---------- catálogo ---------- */
.catalog { display: grid; grid-template-columns: 196px minmax(0, 1fr) minmax(340px, 440px); gap: 32px; align-items: start; padding-bottom: 72px; border-top: 1px solid var(--line); padding-top: 28px; }
.rail { position: sticky; top: 76px; }
.rail ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.rail button { width: 100%; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; text-align: left; background: none; border: 0; color: var(--ink-2); padding: 7px 10px; border-radius: 6px; cursor: pointer; font: 500 0.9375rem var(--sans); }
.rail button:hover { background: var(--surface-2); color: var(--ink); }
.rail button[aria-current="true"] { background: var(--surface); color: var(--ink); font-weight: 650; box-shadow: inset 0 0 0 1px var(--line); }
.rail button span:last-child { font-size: 0.8125rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rail-select { display: none; }

.search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; margin-bottom: 20px; color: var(--ink-3); }
.search input { border: 0; background: transparent; flex: 1; padding: 11px 0; font-size: 1rem; min-width: 0; }
.search input:focus-visible { outline: none; }
.search:focus-within { outline: 2px solid var(--red); outline-offset: 2px; }
.search .num { font-size: 0.8125rem; white-space: nowrap; }

.cat-title { font-size: 1.125rem; margin: 28px 0 8px; color: var(--ink); }
.cat-title:first-child { margin-top: 0; }
.ep { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; column-gap: 12px; row-gap: 2px; align-items: baseline; padding: 10px 10px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 0; transition: background-color 160ms var(--ease); }
.ep:hover { background: var(--surface-2); }
.ep[aria-current="true"] { background: var(--surface); }
.ep[aria-current="true"] .path { font-weight: 700; }
.ep .path { font: 500 0.8125rem var(--mono); overflow-wrap: anywhere; color: var(--ink); }
.ep .sum { grid-column: 2 / 4; color: var(--ink-2); font-size: 0.9375rem; }
.ep .meta { display: flex; gap: 6px; font-size: 0.75rem; color: var(--ink-3); white-space: nowrap; }
.ep .meta .warn { color: var(--err); }
.method { font: 700 0.6875rem var(--mono); letter-spacing: 0.02em; color: var(--get); border: 1px solid currentColor; border-radius: 4px; padding: 1px 0; text-align: center; }
.method.POST { color: var(--post); }

.detail { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; overscroll-behavior: contain; }
.detail-empty p { color: var(--ink-2); margin: 10px 0 0; }
.detail .back { display: none; }
.detail h2 { font: 600 1rem var(--mono); letter-spacing: 0; overflow-wrap: anywhere; display: flex; gap: 10px; align-items: baseline; }
.detail .summary { font-size: 1.0625rem; margin: 12px 0 4px; }
.detail .desc { color: var(--ink-2); font-size: 0.9375rem; margin: 0 0 4px; }
.detail .needs { color: var(--err); font-size: 0.875rem; margin: 8px 0 0; }
.detail form { display: grid; gap: 14px; margin: 20px 0; }
.detail .lab { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.detail .lab .mono { font-weight: 600; }
.detail .lab .req { color: var(--red-ink); margin-left: -6px; }
.detail .lab small { color: var(--ink-3); font-size: 0.8125rem; font-weight: 400; }
.detail-empty h2 { font: 800 1.5rem var(--sans); font-stretch: 78%; letter-spacing: -0.02em; }
.detail details { margin-top: 16px; }
.detail summary { cursor: pointer; color: var(--ink-2); font-weight: 500; }
.result-meta { color: var(--ink-3); font-size: 0.8125rem; }

@media (max-width: 1180px) {
  .catalog { grid-template-columns: 180px minmax(0, 1fr); }
  .detail { display: none; position: static; max-height: none; grid-column: 2; }
  .catalog.open .list { display: none; }
  .catalog.open .detail { display: block; }
  .detail .back { display: inline-flex; margin-bottom: 16px; }
}
@media (max-width: 760px) {
  .catalog { grid-template-columns: 1fr; gap: 16px; }
  .rail { position: static; }
  .rail ul { display: none; }
  .rail-select { display: flex; }
  .detail { grid-column: 1; padding: 18px; }
  .ep { grid-template-columns: 48px minmax(0, 1fr); }
  .ep .meta { grid-column: 2; }
}

/* ---------- ferramentas ---------- */
.tool-head { padding: clamp(36px, 6vw, 72px) 0 28px; }
.tool-head h1 { font-size: clamp(2rem, 4.5vw, 3.25rem); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: clamp(18px, 3vw, 28px); display: grid; gap: 16px; margin-bottom: 72px; align-content: start; }
.panel h2 { margin-bottom: 4px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 72px; }
.split .panel { margin-bottom: 0; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.note { color: var(--ink-2); font-size: 0.9375rem; margin: 0; }
.fields { display: grid; gap: 12px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > input[type="url"], .row > input:not([type]) { flex: 1; min-width: 200px; }
label { display: grid; gap: 6px; font-size: 0.875rem; font-weight: 600; color: var(--ink); min-width: 0; }
input, select, textarea, button { font: inherit; color: var(--ink); }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; max-width: 100%; font-weight: 400; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
textarea { width: 100%; resize: vertical; font: 400 0.8125rem/1.6 var(--mono); }
input[type="color"] { padding: 3px; width: 56px; height: 40px; }
button, .ghost { display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; border-radius: 8px; padding: 9px 16px; font-weight: 600; text-decoration: none; transition: background-color 160ms var(--ease), transform 160ms var(--ease); }
button:active { transform: translateY(1px); }
.primary { background: var(--red); color: var(--on-red); border: 1px solid var(--red); }
.primary:hover { background: color-mix(in srgb, var(--red) 88%, var(--ink)); }
.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.ghost:hover { background: var(--surface-2); }
button:disabled { opacity: 0.6; cursor: progress; }

.drop { position: relative; display: flex; gap: 10px; align-items: center; justify-content: center; text-align: center; border: 1.5px dashed var(--line); border-radius: 10px; padding: 22px; color: var(--ink-2); font-weight: 500; cursor: pointer; transition: border-color 160ms var(--ease), background-color 160ms var(--ease); }
.drop:hover, .drop.over { border-color: var(--red); background: color-mix(in srgb, var(--red) 5%, transparent); color: var(--ink); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.status { margin: 0; color: var(--ink-2); font-size: 0.9375rem; min-height: 1.5em; }
.err { color: var(--err); }
.out { background: var(--bg); border: 1px solid var(--line); padding: 12px 14px; border-radius: 8px; overflow: auto; max-height: 440px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.out.err { color: var(--err); }
.result:empty { display: none; }
.result img, .result video, .preview { max-width: 100%; max-height: 440px; border-radius: 8px; background: var(--surface-2); display: block; }
#px-out img { image-rendering: pixelated; }
#qr-video { width: 100%; border-radius: 10px; background: #000; }
.swatches { display: flex; gap: 4px; flex-wrap: wrap; }
.swatches span { width: 20px; height: 20px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12); }
.media-meta { display: flex; gap: 14px; align-items: center; }
.media-meta img { width: 160px; border-radius: 8px; }

.foot { border-top: 1px solid var(--line); color: var(--ink-2); font-size: 0.875rem; padding: 24px clamp(16px, 4vw, 40px) 40px; max-width: 1320px; margin: 0 auto; }
.foot p { margin: 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Código e URLs sempre literais: sem ligaduras (ex.: "://" da JetBrains Mono). O atalho `font:` recoloca, por isso !important. */
code, pre, .out, .mono, .path, .method, input, textarea { font-variant-ligatures: none !important; font-feature-settings: "liga" 0, "calt" 0 !important; }

/* ---------- status ---------- */
.st-h { font-size: 1.125rem; margin: 20px 0 10px; }
.st-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 24px; }
.st-grid li { display: flex; align-items: baseline; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.st-grid li small { display: block; color: var(--ink-3); font-size: 0.8125rem; }
.st-details { margin: 20px 0 16px; }
.st-details summary { cursor: pointer; color: var(--ink-2); font-weight: 600; padding: 6px 0; }
.st-list h3 { font-size: 1rem; margin: 16px 0 6px; }
.st-list ul { list-style: none; margin: 0; padding: 0; }
.st-list li { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.st-list li small { grid-column: 2 / -1; color: var(--ink-3); font-size: 0.8125rem; }
.st-list li > span:last-of-type { color: var(--ink-2); font-size: 0.875rem; }
.st-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--steel); }
.st-ok > .st-dot, .st-dot.st-ok { background: var(--ok); }
.st-parcial > .st-dot, .st-dot.st-parcial { background: linear-gradient(90deg, var(--ok) 50%, var(--err) 50%); }
.st-fora > .st-dot, .st-dot.st-fora { background: var(--err); }
.st-link { display: inline-flex; align-items: center; gap: 8px; }
.theme-btn { display: inline-flex; align-items: center; gap: 8px; background: transparent; font: inherit; font-weight: 500; cursor: pointer; }
.theme-btn .i { width: 18px; height: 18px; }
html { transition: background-color .3s var(--ease); }
body, .bar, .panel { transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease); }
@media (max-width: 760px) { .doclink.theme-btn { display: inline-flex; padding: 10px; min-width: 44px; min-height: 44px; justify-content: center; } .theme-btn span { display: none; } }
.st-top { list-style: none; margin: 0 0 8px; padding: 0; }
.st-top li { display: grid; grid-template-columns: minmax(0, 260px) 1fr auto; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.st-top code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.st-bar i { display: block; height: 100%; background: var(--red); border-radius: 4px; }
.st-top .num { color: var(--ink-2); font-size: 0.875rem; font-variant-numeric: tabular-nums; }

/* ---------- menu do celular ---------- */
.menu-btn { display: none; align-items: center; gap: 8px; background: transparent; font: inherit; font-weight: 500; cursor: pointer; }
@media (max-width: 1180px) {
  .bar { flex-wrap: wrap; row-gap: 0; }
  .mark { margin-right: auto; }
  .bar .tabs, .bar .doclink:not(.theme-btn):not(.menu-btn) { display: none; }
  .doclink.menu-btn { display: inline-flex; min-height: 44px; }
  .bar.menu-open { padding-bottom: 16px; }
  .bar.menu-open .tabs { display: flex; flex-direction: column; flex: 1 0 100%; order: 10; gap: 0; margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
  .bar.menu-open .tabs a { padding: 12px; min-height: 44px; display: flex; align-items: center; }
  .bar.menu-open .doclink:not(.theme-btn):not(.menu-btn) { display: inline-flex; align-items: center; order: 11; min-height: 44px; margin-top: 12px; }
  .bar.menu-open .st-link { margin-right: 8px; }
}
