@import "tokens.css";

/* NodeLens — instrument panel.
 * Everything structural is a machined panel; video and graph canvases are the
 * only black surfaces, and the only place light or saturated colour appears.
 */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--panel);
  color: var(--engrave);
  font: 400 16px/1.5 var(--ui);
  overflow-x: hidden;

}

img, svg, video, canvas { max-width: 100%; display: block; }
/* author styles outrank the UA's [hidden]{display:none} no matter the
   specificity, so the attribute has to be re-asserted here or it does nothing */
[hidden] { display: none !important; }
::selection { background: var(--phosphor); color: var(--signal); }
a { color: inherit; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 50;
  background: var(--signal); color: var(--phosphor);
  padding: 10px 14px; font: 400 12px var(--data);
}
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

/* ── panel legends ───────────────────────────────────────────────
   Terse uppercase labels are authentic here: they are silkscreened
   panel legends carrying real abbreviations, not decorative eyebrows. */
.eyebrow, .rig-tag, .rig-tag-sub, .live-badge, .step-n {
  font-family: var(--ui);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
}
.eyebrow { display: block; color: var(--engrave-2); margin: 0 0 10px; }

/* ── layout ──────────────────────────────────────────────────── */
.wrap { max-width: calc(var(--hp) * 56); margin-inline: auto; }
.hero { padding: calc(var(--hp) * 2) calc(var(--hp) * 1.2) calc(var(--hp) * 2.4); }

.band {
  padding: calc(var(--hp) * 2.4) calc(var(--hp) * 1.2);
  border-bottom: var(--rule);
  position: relative;
  /* A jump to a section (#android, /download) stops below the sticky top bar,
     not under it. */
  scroll-margin-top: 52px;
}
.band > * { max-width: calc(var(--hp) * 56); margin-inline: auto; }



h1, .h2, .h3 { margin: 0 0 12px; }
h1 {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(24px, 5.6vw, 44px); line-height: 1.14;
}
.h2 {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(18px, 3.4vw, 25px); line-height: 1.2;
}
.h3 { font-family: var(--ui); font-weight: 600; font-size: 17px; }
.lede { font-size: clamp(16px, 2.3vw, 19px); max-width: 62ch; }
.p { max-width: 68ch; }
.sub { color: var(--engrave-2); font-size: 14px; }
.fine { color: var(--engrave-2); font-family: var(--data); font-size: 12px; line-height: 1.7; }

/* ── top rail ────────────────────────────────────────────────── */
.topbar {
  border-bottom: var(--rule);
  background: linear-gradient(var(--panel-hi), var(--panel));
  position: sticky; top: 0; z-index: 20;
}
.topbar-in {
  max-width: calc(var(--hp) * 56); margin-inline: auto;
  display: flex; align-items: center; gap: 14px;
  padding: 10px calc(var(--hp) * 1.2);
}
.mark { display: flex; align-items: center; gap: 9px; margin-right: auto; }
.mark-glyph {
  width: 22px; height: 22px; flex: none;
  border-radius: var(--r-jack); border: 2px solid var(--engrave);
  position: relative;
}
.mark-glyph::after {
  content: ""; position: absolute; inset: 4px;
  border-radius: var(--r-jack); background: var(--signal);
}
.mark-name { font-family: var(--display); font-size: 15px; }
.topbar-link {
  font-family: var(--data); font-size: 11px;
  text-transform: uppercase; letter-spacing: .12em;
  text-decoration: none; padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.topbar-link:hover, .topbar-link:focus-visible { border-bottom-color: var(--engrave); }

/* ── the rig: a panel holding a signal window ────────────────── */
.rig { display: grid; gap: calc(var(--hp) * 1.2); align-items: start; }
@media (min-width: 900px) { .rig { grid-template-columns: 1.3fr .95fr; } }

.rig-view { position: relative; }

/* the signal window overhangs its chassis — the one broken alignment */
.rig-window {
  position: relative; overflow: hidden;
  background: var(--signal);
  border: 2px solid var(--engrave);
  border-radius: var(--r-panel);
  aspect-ratio: 5 / 4;
  /* the overhang only reads as deliberate if the panel still shows on the
     other side, so it eats the gutter on the left and nothing on the right */
  margin-left: calc(var(--hp) * -1.2);
  box-shadow: 0 0 0 1px rgba(255,255,255,.35);
}
@media (min-width: 900px) {
  .rig-window { aspect-ratio: 4 / 3; margin-left: calc(var(--hp) * -2); }
}

/* */
.rig-window::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;

}
/* viewfinder corner ticks */
.rig-window::after {
  content: ""; position: absolute; inset: 12px; pointer-events: none; z-index: 3;
  border: 1px solid rgba(180,180,180,.55);
  clip-path: polygon(
    0 0, 20px 0, 20px 1px, 1px 1px, 1px 20px, 0 20px,
    0 100%, 20px 100%, 20px calc(100% - 1px), 1px calc(100% - 1px), 1px calc(100% - 20px), 0 calc(100% - 20px),
    100% 100%, calc(100% - 20px) 100%, calc(100% - 20px) calc(100% - 1px), calc(100% - 1px) calc(100% - 1px), calc(100% - 1px) calc(100% - 20px), 100% calc(100% - 20px),
    100% 0, calc(100% - 20px) 0, calc(100% - 20px) 1px, calc(100% - 1px) 1px, calc(100% - 1px) 20px, 100% 20px);
}

.stage-media, .stage-blank {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.stage-blank {
  display: grid; place-items: center; padding-bottom: 11%;
  color: #6f6f68;
  font-family: var(--data); font-size: 11px;
  letter-spacing: .14em; text-transform: uppercase;
}
/* 75% bars, sized like the reference strip they are: a calibration detail
   along the bottom of the window, not the picture itself */
.stage-blank::before {
  content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 11%;
  background: linear-gradient(90deg,
    var(--bar-white) 0 14.28%, var(--bar-yellow) 14.28% 28.56%,
    var(--bar-cyan) 28.56% 42.84%, var(--bar-green) 42.84% 57.12%,
    var(--bar-magenta) 57.12% 71.4%, var(--bar-red) 71.4% 85.68%,
    var(--bar-blue) 85.68% 100%);
  opacity: .82;
}

.live-badge {
  position: absolute; z-index: 4; left: 20px; top: 20px;
  color: var(--phosphor); display: inline-flex; align-items: center; gap: 7px;
  background: rgba(0,0,0,.72); padding: 5px 9px; border-radius: var(--r-well);
}
.live-badge .dot {
  width: 7px; height: 7px; border-radius: var(--r-jack);
  background: var(--phosphor); box-shadow: 0 0 8px var(--phosphor);
  animation: pulse 1.6s steps(2, end) infinite;
}
@keyframes pulse { 50% { opacity: .25; } }

.rig-tag { color: var(--engrave); display: block; }
.rig-tag-sub { color: var(--engrave-2); display: block; margin-top: 4px; }
/* The effect's name arrives with the library. Its line is held from the start
   and never wraps, so the page below does not move when it comes. */
.rig-view .rig-tag-sub { min-height: 1.5em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── patch: the signature. A real graph, drawn as SVG, so every rule
   here is fill/stroke — geometry ignores background and padding. ─── */
.rig-patch {
  background: var(--signal);
  border: 2px solid var(--engrave);
  padding: 12px 14px 14px; position: relative;
}
.rig-patch .rig-tag { color: var(--bar-white); margin: 0 0 8px; }
.rig-patch .rig-tag-sub { color: var(--engrave-2); }
.patch { width: 100%; height: auto; }

.node rect {
  fill: var(--pluge);
  stroke: rgba(180,180,180,.42);
  stroke-width: 1;
}
.node text {
  fill: var(--bar-white);
  font-family: var(--data); font-size: 10px; letter-spacing: .04em;
}
.node-out rect { stroke: var(--bar-blue); stroke-width: 1.5; }

/* the family stripe on a node's input edge — colour as taxonomy */
.fam { stroke-width: 3; stroke-linecap: round; }
.fam-in { stroke: var(--bar-cyan); }
.fam-fx { stroke: var(--bar-magenta); }

/* patch cables: a dim run plus a phosphor pulse travelling along it */
.wires .w { stroke: rgba(180,180,180,.3); stroke-width: 1.5; }
.wires-live .w-live {
  stroke: var(--phosphor); stroke-width: 1.5;
  stroke-dasharray: 14 150; stroke-dashoffset: 164;
  animation: flow 3.2s linear infinite;
}
.wires-live .w-live:nth-child(2) { animation-delay: .5s; }
.wires-live .w-live:nth-child(3) { animation-delay: 1.1s; }
.wires-live .w-live:nth-child(4) { animation-delay: 1.6s; }
@keyframes flow { to { stroke-dashoffset: 0; } }

.ports use { fill: #2b2b2b; stroke: rgba(180,180,180,.55); stroke-width: 1; }

/* ── controls ───────────────────────────────────────────────── */
.cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn {
  font-family: var(--ui); font-weight: 600; font-size: 15px;
  padding: 13px 20px; min-height: 48px;
  border-radius: var(--r-well);
  border: 1px solid var(--engrave);
  background: linear-gradient(var(--panel-hi), var(--panel-lo));
  color: var(--engrave); box-shadow: var(--inset);
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 9px;
}
.btn:active { background: linear-gradient(var(--panel-lo), var(--panel-well)); }
.btn-primary {
  background: var(--signal); color: var(--phosphor);
  border-color: var(--signal); box-shadow: none;
}
.btn-primary:active { background: #101010; }
.btn-ghost { background: transparent; box-shadow: none; }
.cta-note { font-family: var(--data); font-size: 11px; color: var(--engrave-2); }

.status { font-family: var(--data); font-size: 12px; color: var(--engrave-2); }
.err {
  font-family: var(--data); font-size: 12px; color: var(--bar-red);
  border-left: 3px solid var(--bar-red); padding-left: 10px; margin-top: 10px;
}

/* ── gallery ────────────────────────────────────────────────── */
.grid {
  display: grid; gap: calc(var(--hp) * .8); padding: 0; margin: 0; list-style: none;
  grid-template-columns: repeat(auto-fill, minmax(calc(var(--hp) * 8), 1fr));
}
.grid > li { margin: 0; }
/* A card is not a link: an effect opens in the app, not on the site. */
.grid .card {
  display: block;
  border: 1px solid var(--engrave); background: var(--panel-hi);
  padding: 6px 6px 10px;
}
/* Thumbnails are camera frames, upright. height:auto lets aspect-ratio win over
   the height attribute the script sets to reserve space. */
.grid img, .grid .card-blank {
  width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover;
  background: var(--signal); border-radius: var(--r-panel);
}
.card-name { font-weight: 600; font-size: 14px; margin: 8px 2px 2px; overflow-wrap: anywhere; }
.card-meta { font-size: 12px; color: var(--engrave-2); margin: 0 2px; overflow-wrap: anywhere; }

/* ── features: one line per thing the app does ──────────────── */
.features { margin: 0; padding: 0 0 0 1.1em; max-width: 68ch; }
.features li { margin: 0 0 10px; }
.features li::marker { color: var(--engrave-2); }

/* ── steps: a real pipeline, so the numbering is earned ─────── */
.steps { display: grid; gap: calc(var(--hp) * 1.1); padding: 0; margin: 0; list-style: none; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { border-top: 2px solid var(--engrave); padding-top: 10px; }
.step-n { color: var(--engrave-2); margin: 0 0 6px; }
.step-h { margin: 0 0 6px; }
.step-t { margin: 0; color: var(--engrave-2); }

/* ── APK ────────────────────────────────────────────────────── */
.band-apk { background: var(--panel-lo); }
.apk-get { margin: 20px 0 0; }
.band-apk .h3 { margin-top: 32px; }
.specs { margin: 18px 0 0; }
.spec {
  display: grid; grid-template-columns: minmax(130px, 15ch) 1fr; gap: 12px;
  padding: 9px 0; border-bottom: var(--rule-2);
}
.spec dt {
  font-family: var(--data); font-size: 11px;
  text-transform: uppercase; letter-spacing: .1em; color: var(--engrave-2);
}
.spec dd { margin: 0; font-family: var(--data); font-size: 13px; }
.specs-hash dd { overflow-wrap: anywhere; }
.hash, .cmd {
  font-family: var(--data); font-size: 12px;
  background: var(--signal); color: var(--phosphor);
  padding: 8px 10px; border-radius: var(--r-well);
  display: block; overflow-wrap: anywhere;
}
.cmd { white-space: pre-wrap; }
.hash.todo { color: var(--bar-yellow); }

/* ── footer ─────────────────────────────────────────────────── */
.foot { padding: calc(var(--hp) * 1.6) calc(var(--hp) * 1.2); }
.foot-nav { display: flex; flex-wrap: wrap; gap: 18px; padding: 0; margin: 0 0 12px; list-style: none; }
.link { text-decoration: none; border-bottom: 1px solid rgba(36,36,31,.3); }
.link:hover { border-bottom-color: var(--engrave); }
/* Inside the landing's text the near-black line above is invisible on the dark
   surface, and a link there has to look like one. */
.band .link { border-bottom-color: var(--ink-faint); }
.band .link:hover { border-bottom-color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* ---- surface pass: dark, soft, camera-first ---- */
body { background: var(--surface); color: var(--ink); }
.topbar { background: rgba(11,11,13,.82); backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px); border-bottom: 1px solid var(--hairline); }
h1, .h2, .h3 { letter-spacing: -.01em; }
h1 { font-weight: 600; }
.h2 { font-weight: 600; }

.rig-window { border: 1px solid var(--hairline); border-radius: var(--r-sheet);
  margin-left: 0; box-shadow: 0 24px 60px rgba(0,0,0,.6); }
@media (min-width: 900px) { .rig-window { margin-left: 0; } }
.rig-window::after { content: none; }
.stage-blank { color: var(--ink-faint); font-family: var(--ui);
  letter-spacing: 0; text-transform: none; font-size: 13px; }
.stage-blank::before { content: none; }

.rig-patch { background: var(--surface-2); border: 1px solid var(--hairline);
  border-radius: var(--r-sheet); }
.rig-tag { font-family: var(--ui); letter-spacing: .04em; font-size: 11px;
  text-transform: uppercase; color: var(--ink-faint); }
.node rect { fill: var(--surface-3); stroke: var(--hairline); }
.node text { fill: var(--ink); font-family: var(--ui); }
.node-out rect { stroke: var(--fam-output); }

.btn { border: 0; border-radius: var(--r-pill); background: var(--control);
  color: var(--ink); box-shadow: none; font-weight: 500; }
.btn:active { background: var(--control-2); }
.btn-primary { background: #fff; color: #111; }
.btn-ghost { background: var(--control); }

.grid .card { border: 1px solid var(--hairline); background: var(--surface-2);
  border-radius: var(--r-tile); padding: 8px 8px 12px; }
.grid img, .grid .card-blank { border-radius: var(--r-tile); }

.step { border-top: 1px solid var(--hairline); }
.band-apk { background: var(--surface-2); }
.hash, .cmd { background: var(--surface-3); color: var(--ink);
  border-radius: var(--r-tile); border: 1px solid var(--hairline); }
.live-badge { background: rgba(0,0,0,.6); border-radius: var(--r-pill);
  color: var(--ink); font-family: var(--ui); letter-spacing: 0; text-transform: none; }
.live-badge .dot { background: var(--record); box-shadow: none; }
.warn { border-radius: var(--r-tile); background: var(--surface-3);
  border: 1px solid var(--hairline); padding: 14px; }
.spec { border-bottom: 1px solid var(--hairline); }
.mark-glyph { border-color: var(--ink); }
/* The landing keeps its EN/RU toggle (legal.css) in the top bar. */
.topbar .lang-toggle { margin: 0; }
.warn-h { font-weight: 600; margin: 0 0 6px; }
.warn .p { margin: 0; }
.mark-glyph::after { background: var(--ink); }
::selection { background: #fff; color: #000; }
:focus-visible { outline: 2px solid #fff; }
