/* A aba da Nixie segue a lei visual dela: docs/VISUAL_LANGUAGE.md.
   Papel, pontos pretos quadrados, casco cinza de 1 px, etiquetas pretas, mono. Sem cor, sem canto redondo, sem sombra. */
@font-face { font-family: "JBM"; src: url("fontes/jbm-400.woff2?v=caf0dfde4e") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JBM"; src: url("fontes/jbm-500.woff2?v=a21e038a03") format("woff2"); font-weight: 500 700; font-display: swap; }

:root {
  --paper: #e9e5db; --ink: #0e0e0c; --hull: #8c887f; --paper-ink: #f4f1ea; --ghost: rgba(14, 14, 12, 0.55);
  --m: clamp(16px, 4vw, 56px); --bar: 64px;
  --col: min(36vw, 30rem);
}
* { box-sizing: border-box; }
html { background: var(--paper); scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.6 "JBM", ui-monospace, Consolas, monospace; overflow-x: clip; -webkit-font-smoothing: none; }
::selection { background: var(--ink); color: var(--paper-ink); }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2 { font-weight: 500; letter-spacing: -0.03em; line-height: 1; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(4rem, 9vw, 7.5rem); letter-spacing: -0.06em; }
h2 { font-size: clamp(1.7rem, 2.8vw, 2.5rem); }
p { margin: 0; max-width: 46ch; }
.muted { color: var(--ghost); }
.skip { position: fixed; left: var(--m); top: -60px; z-index: 60; background: var(--ink); color: var(--paper-ink); padding: 8px 12px; }
.skip:focus { top: 12px; }

canvas#gl, canvas#ov { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
canvas#gl { z-index: 0; } canvas#ov { z-index: 1; pointer-events: none; }

/* etiquetas: caixa preta com texto claro (#1) ou cinza translúcida (sub-entidades) */
.tag { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; text-decoration: none; white-space: nowrap; }
.tag-ink { background: var(--ink); color: var(--paper-ink); }
.tag-ghost { background: rgba(140, 136, 127, 0.7); color: var(--paper-ink); margin: 0; }
.tag.inline { height: 20px; padding: 0 5px; vertical-align: 1px; }
a.tag-ink:hover { background: #2a2a26; }

.bar { position: fixed; z-index: 20; top: 0; left: 0; right: 0; height: var(--bar); padding: 0 var(--m); padding-top: env(safe-area-inset-top); display: flex; align-items: center; justify-content: space-between; }

/* índice: as seções como etiquetas rastreadas */
.index { position: fixed; z-index: 15; left: var(--m); top: calc(var(--bar) + 8px); }
.index ol { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex-wrap: wrap; max-width: 60vw; }
.index button { white-space: nowrap; height: 24px; padding: 0 7px; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; border: 1px solid var(--hull); color: var(--ghost); transition: background 0.2s, color 0.2s; }
.index button:hover { color: var(--ink); border-color: var(--ink); }
.index button[aria-current="step"] { background: var(--ink); color: var(--paper-ink); border-color: var(--ink); }

/* cartões (modo B): papel, borda fina, sem canto, sem sombra */
.cards { position: fixed; inset: 0; z-index: 10; pointer-events: none; display: grid; align-items: center; justify-items: start; padding: calc(var(--bar) + 48px) var(--m) 84px; }
.card { grid-area: 1 / 1; width: var(--col); display: grid; gap: 14px; padding: 24px; background: rgba(233, 229, 219, 0.86); border: 1px solid var(--hull); opacity: 0; visibility: hidden; max-height: 100%; overflow: auto; scrollbar-width: thin; }
.card.on { visibility: visible; pointer-events: auto; }
.k { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ghost); }
.acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.btn { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; background: var(--ink); color: var(--paper-ink); font-size: 13px; letter-spacing: 0.03em; text-decoration: none; border: 1px solid var(--ink); transition: background 0.2s, color 0.2s; }
.btn:hover { background: #2a2a26; }
.btn-line { background: transparent; color: var(--ink); }
.btn-line:hover { background: var(--ink); color: var(--paper-ink); }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--paper-ink); }
.forms .btn, .levels .btn { background: transparent; color: var(--ink); min-height: 34px; padding: 0 10px; font-size: 12px; }
.forms .btn:hover, .levels .btn:hover, .forms .btn[aria-pressed="true"], .levels .btn[aria-pressed="true"] { background: var(--ink); color: var(--paper-ink); }
.log { list-style: none; margin: 4px 0 0; padding: 0; border-top: 1px solid var(--hull); font-size: 13px; }
.log li { display: grid; grid-template-columns: 4.5rem 1fr; gap: 10px; padding: 6px 0; border-bottom: 1px solid rgba(140, 136, 127, 0.5); }
.log time { color: var(--ghost); }

/* sub-entidades em órbita (agentes): etiquetas clicáveis presas ao corpo */
.trackers { position: fixed; inset: 0; z-index: 12; pointer-events: none; }
.trk { position: absolute; left: 0; top: 0; pointer-events: auto; opacity: 0; transition: opacity 0.5s; }
.trk.on { opacity: 1; }
.trk[aria-pressed="true"] { background: var(--ink); }

.ctrl { position: fixed; z-index: 15; left: var(--m); bottom: calc(22px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 12px; }
.ctrl-b { width: 40px; height: 40px; border: 1px solid var(--ink); font-size: 16px; }
.ctrl-b:hover { background: var(--ink); color: var(--paper-ink); }
.ctrl-b:disabled { opacity: 0.3; cursor: default; background: none; color: var(--ink); }
.ctrl-t { margin: 0; font-size: 12px; letter-spacing: 0.06em; color: var(--ghost); min-width: 5rem; text-align: center; }
.ctrl-t span { color: var(--ink); }

.wipe-out { position: fixed; inset: 0; z-index: 70; pointer-events: none; background: #0c0a18; clip-path: circle(0 at var(--x, 50%) var(--y, 50%)); transition: clip-path 0.8s cubic-bezier(0.7, 0, 0.3, 1); }
.wipe-out.go { clip-path: circle(150vmax at var(--x, 50%) var(--y, 50%)); pointer-events: auto; }

@media (max-aspect-ratio: 4/5) {
  :root { --bar: 56px; }
  body { font-size: 14px; }
  .index { left: 0; right: 0; padding: 0 var(--m); overflow-x: auto; scrollbar-width: none; }
  .index ol { flex-wrap: nowrap; max-width: none; }
  .cards { align-items: end; padding: 0 var(--m) calc(78px + env(safe-area-inset-bottom)); }
  .card { width: 100%; padding: 16px; gap: 10px; max-height: 46vh; }
  #status { display: none; }
  h1 { font-size: 3.2rem; }
  h2 { font-size: 1.45rem; }
  .ctrl { right: var(--m); justify-content: space-between; }
}

/* sem 3D ou com menos movimento: vira uma página comum */
html:not(.gl) canvas, html:not(.gl) .ctrl, html:not(.gl) .trackers { display: none; }
html:not(.gl) body { overflow: auto; }
html:not(.gl) .cards { position: static; padding: calc(var(--bar) + 60px) var(--m) 60px; display: grid; gap: 24px; pointer-events: auto; }
html:not(.gl) .card { grid-area: auto; position: static; opacity: 1; visibility: visible; transform: none; width: auto; max-width: 44rem; max-height: none; }
html:not(.gl) .index { position: absolute; }
html:not(.gl) .bar { background: var(--paper); }

/* ---------- linha do tempo da construção (11/11) ---------- */
.card { scrollbar-width: none; }
.card::-webkit-scrollbar { display: none; }
.bar-dir { display: flex; align-items: center; gap: 6px; }
.tag-line { border: 1px solid var(--ink); color: var(--ink); height: 26px; }
a.tag-line:hover { background: var(--ink); color: var(--paper-ink); }
.selo { display: flex; flex-wrap: wrap; gap: 4px; margin: -2px 0 2px; }
.lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--hull); font-size: 14px; }
.lista li { position: relative; padding: 8px 0 8px 18px; border-bottom: 1px solid rgba(140, 136, 127, 0.5); }
.lista li::before { content: ""; position: absolute; left: 2px; top: 16px; width: 5px; height: 5px; background: var(--ink); }
.funcoes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; font-size: 13px; border-top: 1px solid var(--hull); }
.funcoes li { padding: 7px 0 7px 16px; position: relative; border-bottom: 1px solid rgba(140, 136, 127, 0.5); }
.funcoes li::before { content: ""; position: absolute; left: 1px; top: 14px; width: 4px; height: 4px; background: var(--ink); }
.linha { position: fixed; z-index: 15; right: var(--m); bottom: calc(22px + env(safe-area-inset-bottom)); list-style: none; margin: 0; padding: 0; display: flex; gap: 0; opacity: 0.55; transition: opacity 0.4s; }
.linha.on { opacity: 1; }
.linha li { position: relative; }
.linha li + li::before { content: ""; position: absolute; left: -1px; top: 20px; width: 1px; height: 0; }
.linha button { display: grid; gap: 2px; justify-items: start; min-width: 92px; padding: 8px 10px 6px; text-align: left; border-top: 2px solid var(--hull); color: var(--ghost); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; transition: color 0.2s, border-color 0.2s, background 0.2s; }
.linha time { font-size: 10px; }
.linha button.feito { border-top-color: var(--ink); color: var(--ink); }
.linha button[aria-current="step"] { border-top-color: var(--ink); background: var(--ink); color: var(--paper-ink); }
.linha button:hover { color: var(--ink); border-top-color: var(--ink); }
.linha button[aria-current="step"]:hover { color: var(--paper-ink); }
@media (max-width: 1100px) { .linha button { min-width: 0; padding: 8px 8px 6px; } .linha span { display: none; } }
@media (max-aspect-ratio: 4/5) {
  .linha { display: none; }
  .lista { font-size: 13px; } .lista li { padding: 6px 0 6px 16px; } .lista li::before { top: 13px; }
  .funcoes { font-size: 12px; gap: 0 10px; } .funcoes li { padding: 5px 0 5px 12px; } .funcoes li::before { top: 11px; }
  .card { max-height: 58vh; }
  .bar-dir .tag-line { height: 24px; }
}
html:not(.gl) .linha { display: none; }
@media (max-aspect-ratio: 4/5) { .index { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); } }
