/* Ackerman Legion — shared layer: fonts, colours and the building blocks used by both
   the public console and the admin panel (panes, key-value lists, buttons, document,
   dossier cards, channel rows). */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url(fonts/jbmono-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url(fonts/jbmono-latin.woff2) format('woff2');
  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: 'Tektur';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(fonts/tektur-cyrillic.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Tektur';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url(fonts/tektur-latin.woff2) format('woff2');
  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;
}

:root {
  color-scheme: dark;
  --bg: #000;
  --pane: rgba(9, 3, 16, .86);
  --g: #c084fc;                       /* cult violet: the one voice of the interface */
  --g-mid: #9257e6;
  --g-dim: #4b2687;
  --line: rgba(192, 132, 252, .3);
  --line-soft: rgba(192, 132, 252, .13);
  --ink: #e4daf5;                     /* running text */
  --mute: #9b88ba;
  --white: #f8f3ff;
  --red: #ff3d5e;
  --amber: #ffc94d;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, Menlo, 'DejaVu Sans Mono', monospace;
  --display: 'Tektur', 'JetBrains Mono', sans-serif;
  --pad: clamp(10px, 1.5vw, 20px);
  --gap: clamp(8px, 1vw, 12px);
  --bar: 34px;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

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

html {
  background: var(--bg);
  scrollbar-color: var(--g-dim) #000;
  scrollbar-width: thin;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: .875rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--g); color: #000; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--g); outline-offset: 2px; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }

/* ---------- pane: a bordered window with a title bar ---------- */

.pane {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--pane);
}
.pane::before, .pane::after {
  content: '';
  position: absolute;
  width: 9px;
  height: 9px;
  border: 2px solid var(--g);
  pointer-events: none;
}
.pane::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.pane::after { right: -1px; bottom: -1px; border-left: 0; border-top: 0; }
.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 27px;
  padding: 3px 10px;
  border-bottom: 1px solid var(--line-soft);
  font-size: .75rem;
  color: var(--mute);
  white-space: nowrap;
  overflow: hidden;
}
.pane-name { color: var(--g); overflow: hidden; text-overflow: ellipsis; }
.pane-name::before { content: ':: '; color: var(--g-dim); }
.pane-tags { flex: none; }
.pane-body { flex: 1 1 auto; min-height: 0; padding: 14px 16px; }

/* ---------- small pieces ---------- */

.ps1 { color: var(--g); font-weight: 700; }
.ok { color: var(--g); }
.warn { color: var(--amber); }
.bad { color: var(--red); }
.dim { color: var(--mute); }

.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .28em 1.1em; margin: 0; font-size: .8125rem; }
.kv dt { color: var(--mute); white-space: nowrap; }
.kv dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.kv dd b, .kv dd strong { color: var(--g); font-weight: 700; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55em;
  min-height: 40px;
  padding: 0 .95rem;
  border: 1px solid var(--g);
  border-radius: 0;
  background: transparent;
  color: var(--g);
  font: 700 .8125rem/1 var(--mono);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .12s linear, color .12s linear, box-shadow .2s ease;
}
.btn::before { content: '['; color: var(--g-mid); }
.btn::after { content: ']'; color: var(--g-mid); }
.btn:hover, .btn:focus-visible {
  background: var(--g);
  color: #000;
  box-shadow: 0 0 22px rgba(192, 132, 252, .35);
}
.btn:hover::before, .btn:hover::after, .btn:focus-visible::before, .btn:focus-visible::after { color: #000; }
.btn-primary { background: var(--g); color: #000; }
.btn-primary::before, .btn-primary::after { color: #000; }
.btn-primary:hover { background: var(--white); border-color: var(--white); }
.btn:disabled { opacity: .45; cursor: default; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.chips li { padding: 2px 8px; border: 1px solid var(--line); color: var(--g); font-size: .78rem; }
.empty { color: var(--mute); }

/* ---------- document (the manifest) ---------- */

.doc {
  counter-reset: line;
  padding-left: 3.1em;
  font-size: .9375rem;
  line-height: 1.75;
  color: var(--ink);
}
.doc > * { position: relative; margin: 0 0 1.05em; }
.doc > *:last-child { margin-bottom: 0; }
.doc > *::before {
  counter-increment: line;
  content: counter(line, decimal-leading-zero);
  position: absolute;
  left: -3.1em;
  top: 0;
  width: 2em;
  text-align: right;
  font: 400 .78rem/2.1 var(--mono);
  letter-spacing: 0;
  text-transform: none;
  color: var(--g-dim);
}
.doc .lead { font-size: 1.0625rem; line-height: 1.65; color: var(--white); }
.doc strong { color: var(--g); font-weight: 700; }
.doc em { font-style: italic; color: var(--white); }
.doc a { color: var(--g); text-underline-offset: .2em; }
.doc h3, .doc h4 { font-family: var(--display); font-weight: 700; line-height: 1.2; color: var(--g); text-transform: uppercase; }
.doc h3 { font-size: 1.3rem; margin-top: 1.6em; }
.doc h4 { font-size: 1.05rem; margin-top: 1.4em; }
.doc .doc-title { margin-top: 0; font-size: 1.5rem; }
.doc ul { list-style: none; padding: 0; }
.doc li { position: relative; padding-left: 1.6em; margin-bottom: .3em; }
.doc li::before { content: '->'; position: absolute; left: 0; color: var(--g-mid); }
.doc hr { height: 0; border: 0; border-top: 1px dashed var(--line); }
.doc hr::before { top: -1em; }
.doc blockquote {
  margin-top: 1.5em;
  padding: .85em 1em .8em 1.15em;
  border: 1px solid var(--line);
  border-left: 3px solid var(--g);
  background: rgba(192, 132, 252, .06);
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.2rem, 1rem + 1vw, 1.75rem);
  line-height: 1.16;
  text-transform: uppercase;
  color: var(--g);
  text-shadow: 0 0 18px rgba(192, 132, 252, .35);
}
.doc blockquote::before { top: .85em; }

/* ---------- dossier cards ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17.5rem), 1fr)); gap: var(--gap); align-content: start; }
.card { transition: border-color .15s linear, box-shadow .25s ease, transform .25s var(--ease); }
.card:hover, .card:focus-within { border-color: var(--g); box-shadow: 0 0 0 1px var(--g), 0 0 34px rgba(192, 132, 252, .16); }
.card-body { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 16px; flex: 1; }
.card-top { display: flex; gap: 14px; align-items: flex-start; }
.identicon {
  flex: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  width: 74px;
  height: 74px;
  padding: 6px;
  border: 1px solid var(--line);
  background: #000;
}
.identicon i { background: var(--g-dim); opacity: .22; }
.identicon i.on { background: var(--g); opacity: 1; box-shadow: 0 0 6px rgba(192, 132, 252, .6); }
.card-name {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.55rem, 1.2rem + 1.1vw, 2.1rem);
  line-height: 1;
  letter-spacing: .01em;
  color: var(--white);
  overflow-wrap: anywhere;
}
.card-role {
  align-self: flex-start;
  margin: 0;
  padding: 2px 8px;
  background: var(--g);
  color: #000;
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
}
.card.is-root .card-role { background: var(--white); }
.card-text { margin: 0; color: var(--ink); font-size: .875rem; line-height: 1.65; }
.card-link {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  color: var(--g);
  font-size: .8125rem;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: background-color .12s linear, color .12s linear;
}
.card-link::after { content: 'открыть'; flex: none; color: var(--mute); }
.card-link:hover, .card-link:focus-visible { background: var(--g); color: #000; }
.card-link:hover::after, .card-link:focus-visible::after { color: #000; }

/* ---------- channel rows (contacts) ---------- */

.ch-title { margin: 0 0 .35em; font-family: var(--display); font-weight: 800; font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); line-height: 1.1; text-transform: uppercase; color: var(--white); }
.ch-sub { margin: 0 0 .4em; color: var(--g); font-weight: 700; }
.ch-intro { margin: 0 0 .6em; max-width: 46em; color: var(--ink); }
.channels { list-style: none; margin: 1.2em 0 0; padding: 0; border-top: 1px solid var(--line-soft); }
.channels li { border-bottom: 1px solid var(--line-soft); }
.ch {
  display: grid;
  grid-template-columns: 2.4em minmax(0, 1.25fr) minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 12px;
  padding: 11px 10px;
  color: var(--ink);
  text-decoration: none;
  transition: background-color .1s linear, color .1s linear, padding .25s var(--ease);
}
.ch-n { color: var(--g-mid); font-size: .78rem; }
.ch-name { font-family: var(--display); font-weight: 700; font-size: clamp(1.1rem, 1rem + .6vw, 1.45rem); line-height: 1.1; text-transform: uppercase; color: var(--white); overflow-wrap: anywhere; }
.ch-meta { color: var(--mute); font-size: .8125rem; overflow-wrap: anywhere; }
.ch-state { justify-self: end; padding: 1px 7px; border: 1px solid currentColor; color: var(--g); font-size: .72rem; text-transform: uppercase; }
a.ch:hover, a.ch:focus-visible { background: var(--g); color: #000; padding-left: 18px; outline: none; }
a.ch:hover .ch-n, a.ch:hover .ch-name, a.ch:hover .ch-meta, a.ch:hover .ch-state,
a.ch:focus-visible .ch-n, a.ch:focus-visible .ch-name, a.ch:focus-visible .ch-meta, a.ch:focus-visible .ch-state { color: #000; }
.ch.is-locked .ch-name { color: var(--mute); }
.ch.is-locked .ch-state { color: var(--amber); }

@media (max-width: 560px) {
  .ch { grid-template-columns: 2.2em minmax(0, 1fr) auto; }
  .ch-meta { grid-column: 2 / -1; grid-row: 2; }
  .doc { padding-left: 2.5em; font-size: .9rem; }
  .doc > *::before { left: -2.5em; width: 1.7em; }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .card, .card-link, .ch { transition: none; }
}
