/* Управляется ansible (roles/camo_site). Не редактировать на узле.
 *
 * Осознанные ограничения:
 *  - никаких внешних ресурсов (шрифтов, CDN, аналитики): одинаковый сторонний
 *    запрос на трёх узлах в разных странах — готовая связь в графе;
 *  - тёмная база «синий+зелёный» общая, но пара красок accent/accent2,
 *    радиусы, шаг сетки и вариант вёрстки выводятся из camo_accent /
 *    camo_accent2 / camo_seed / camo_layout, поэтому узлы не совпадают
 *    ни побайтово, ни на скриншоте.
 */

:root {
  --accent: #2dd4bf;
  --accent2: #60a5fa;
  --bg: #060b13;
  --surface: #0b1420;
  --surface-2: #0f1b2a;
  --fg: #d9e6f2;
  --fg-muted: #8ea3b8;
  --fg-faint: #5c7186;
  --border: #16283c;
  --border-strong: #23405e;
  --ok: #34d399;
  --warn: #f5b83d;
  --code: #7ee2b8;
  --grid: 37px;
  --radius: 12px;
  --radius-lg: 12px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 10px 30px rgba(2, 6, 12, 0.45);
  --measure: 72rem;
}

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

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

body {
  margin: 0;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(1100px 380px at 85% -80px, rgba(56, 189, 248, 0.10), transparent 70%),
    radial-gradient(900px 340px at -10% -40px, rgba(52, 211, 153, 0.08), transparent 70%),
    linear-gradient(rgba(148, 190, 233, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 226, 184, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, var(--grid) var(--grid), var(--grid) var(--grid), auto;
}

@supports (color: color-mix(in srgb, red, blue)) {
  body {
    background:
      radial-gradient(1100px 380px at 85% -80px, color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%),
      radial-gradient(900px 340px at -10% -40px, color-mix(in srgb, var(--accent2) 10%, transparent), transparent 70%),
      linear-gradient(color-mix(in srgb, var(--accent) 5%, transparent) 1px, transparent 1px),
      linear-gradient(90deg, color-mix(in srgb, var(--accent2) 4%, transparent) 1px, transparent 1px),
      var(--bg);
    background-size: auto, auto, var(--grid) var(--grid), var(--grid) var(--grid), auto;
  }
}

::selection { background: rgba(56, 189, 248, 0.28); }
@supports (color: color-mix(in srgb, red, blue)) {
  ::selection { background: color-mix(in srgb, var(--accent2) 32%, transparent); }
}

* { scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

a { color: var(--accent2); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent2);
  outline-offset: 2px;
  border-radius: 3px;
}

h1, h2, h3 {
  line-height: 1.2;
  letter-spacing: -0.018em;
  font-weight: 640;
  margin: 0 0 0.5rem;
  color: var(--fg);
}
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.15rem); }
h2 { font-size: 1.15rem; }
h3 { font-size: 0.98rem; }

/* Заголовок-«вывеска»: градиент между двумя красками узла. */
@supports (background-clip: text) {
  h1 {
    background: linear-gradient(92deg, var(--fg) 8%, color-mix(in srgb, var(--accent) 72%, var(--fg)) 58%, var(--accent2) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

p { margin: 0 0 0.9rem; }
p:last-child { margin-bottom: 0; }

code, pre, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
code {
  font-size: 0.86em;
  color: var(--code);
  background: rgba(126, 226, 184, 0.08);
  border: 1px solid rgba(126, 226, 184, 0.16);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
@supports (color: color-mix(in srgb, red, blue)) {
  code {
    background: color-mix(in srgb, var(--accent2) 9%, var(--surface-2));
    border-color: color-mix(in srgb, var(--accent2) 20%, transparent);
  }
}

/* ── Шапка ─────────────────────────────────────────────────────────── */

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  padding: 0.5rem 0.9rem;
  border-radius: 0 0 var(--radius) 0;
}
.skip:focus { left: 0; }

.site-head {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem clamp(1rem, 4vw, 2rem);
  background: rgba(6, 11, 19, 0.82);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}

@supports (color: color-mix(in srgb, red, blue)) {
  .site-head { background: color-mix(in srgb, var(--bg) 80%, transparent); }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--mono);
  font-weight: 620;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
}
.brand:hover { color: var(--fg); }
.brand svg, .brand img.mark { display: block; flex: none; width: 22px; height: 22px; }

.site-head nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.site-head nav a {
  color: var(--fg-muted);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.86rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius);
}
.site-head nav a:hover { color: var(--fg); background: var(--surface-2); }
.site-head nav a[aria-current="page"] {
  color: var(--accent2);
  background: rgba(56, 189, 248, 0.12);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.25);
}
@supports (color: color-mix(in srgb, red, blue)) {
  .site-head nav a[aria-current="page"] {
    background: color-mix(in srgb, var(--accent2) 13%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent2) 30%, transparent);
  }
}

/* ── Каркас ────────────────────────────────────────────────────────── */

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 2.75rem) clamp(1rem, 4vw, 2rem) 3.5rem;
}

.layout-a .grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 62rem) {
  .layout-a .grid { grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); align-items: start; }
  .layout-a .grid > .side { position: sticky; top: 4.5rem; }
}

.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface) 26%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.1rem, 2.4vw, 1.6rem);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.card > :last-child { margin-bottom: 0; }

.hero {
  border-color: var(--border-strong);
  border-left: 3px solid var(--accent);
  background:
    linear-gradient(135deg, rgba(56, 189, 248, 0.10), transparent 58%),
    linear-gradient(180deg, var(--surface-2), var(--surface) 40%);
  box-shadow: 0 0 34px rgba(56, 189, 248, 0.10), var(--shadow);
}

@supports (color: color-mix(in srgb, red, blue)) {
  .card { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 5%, transparent), var(--shadow); }
  .hero {
    border-left-color: var(--accent);
    background:
      linear-gradient(135deg, color-mix(in srgb, var(--accent) 11%, transparent), transparent 58%),
      linear-gradient(180deg, var(--surface-2), var(--surface) 40%);
    box-shadow: 0 0 34px color-mix(in srgb, var(--accent) 12%, transparent), var(--shadow);
  }
}

.lead { color: var(--fg-muted); font-size: 1.02rem; max-width: 60ch; }

.section-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 0.6rem;
}
.section-label::before { content: "// "; color: var(--accent2); }

/* ── Компоненты ────────────────────────────────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 550;
  padding: 0.2rem 0.65rem 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.10);
  color: var(--ok);
  white-space: nowrap;
}
.pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  flex: none;
}
.pill[data-live="1"] .dot { animation: pulse 2.4s ease-in-out infinite; }
.pill[data-state="off"] { color: var(--warn); border-color: currentColor; background: rgba(245, 184, 61, 0.10); }

@supports (color: color-mix(in srgb, red, blue)) {
  .pill {
    border-color: color-mix(in srgb, var(--accent) 40%, transparent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: color-mix(in srgb, var(--accent) 78%, #ffffff);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

.tiles {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  margin: 1.1rem 0;
}
.tile {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  background: var(--surface-2);
}
.tile .k {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 0.25rem;
}
.tile .v {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: color-mix(in srgb, var(--accent2) 55%, var(--fg));
  text-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
}
@supports (color: color-mix(in srgb, red, blue)) {
  .tile { background: color-mix(in srgb, var(--surface-2) 90%, var(--accent2)); }
  .tile .v { text-shadow: 0 0 16px color-mix(in srgb, var(--accent2) 35%, transparent); }
}
.tile .u { font-size: 0.78rem; color: var(--fg-muted); font-weight: 450; margin-left: 0.2rem; }

.chart { width: 100%; height: 150px; display: block; color: var(--accent); }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .area { fill: var(--accent); opacity: 0.16; }
.chart .line { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; filter: drop-shadow(0 0 4px currentColor); }
.chart .axis { fill: var(--fg-faint); font-size: 9px; font-family: var(--mono); }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: rgba(4, 9, 16, 0.35);
}
table.data { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 0.84rem; }
table.data caption {
  caption-side: top; text-align: left; padding: 0.6rem 0.8rem;
  color: var(--fg-muted); font-size: 0.82rem; font-family: var(--sans);
  border-bottom: 1px solid var(--border);
}
table.data th, table.data td { padding: 0.5rem 0.8rem; text-align: left; border-bottom: 1px solid var(--border); }
table.data thead th {
  position: sticky; top: 0;
  background: var(--surface-2);
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent2); font-weight: 600; white-space: nowrap;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: rgba(56, 189, 248, 0.06); }
@supports (color: color-mix(in srgb, red, blue)) {
  table.data tbody tr:hover { background: color-mix(in srgb, var(--accent2) 7%, transparent); }
}
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data th[aria-sort] { cursor: pointer; color: var(--accent); }

table.info { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.info th, table.info td { padding: 0.45rem 0.2rem; border-bottom: 1px solid var(--border); text-align: left; font-weight: 400; vertical-align: top; }
table.info tr:last-child th, table.info tr:last-child td { border-bottom: 0; }
table.info th { color: var(--fg-muted); width: 42%; font-weight: 500; }

pre {
  background: #08101c;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.55;
  margin: 0 0 0.9rem;
  color: var(--code);
  box-shadow: inset 0 0 24px rgba(2, 6, 12, 0.6);
}
pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: #04121c;
  border: 1px solid transparent;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(52, 211, 153, 0.25);
}
@supports (color: color-mix(in srgb, red, blue)) {
  .btn { box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 30%, transparent); }
}
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--border-strong); box-shadow: none; }
.btn.ghost:hover { border-color: var(--accent2); color: var(--accent2); }

audio { width: 100%; margin: 0.9rem 0; }

/* Полоса-«волна»: во всю ширину карточки, чтобы читалась как элемент
 * оформления, а не как случайный гребень над кнопкой. */
.bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 46px;
  margin: 1.15rem 0 1rem;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border);
}
.bars span {
  flex: 1 1 auto;
  min-width: 2px;
  max-width: 16px;
  background: linear-gradient(180deg, var(--accent2), var(--accent));
  border-radius: 2px 2px 0 0;
  height: 26%;
  opacity: 0.85;
  transform-origin: bottom;
}
/* В паузе полоса должна читаться как застывшая волна, а не как линейка:
 * базовые высоты неровные. При воспроизведении их перебивает анимация. */
.bars span:nth-child(3n) { height: 46%; }
.bars span:nth-child(4n) { height: 62%; }
.bars span:nth-child(5n) { height: 34%; }
.bars span:nth-child(7n) { height: 54%; }
.bars span:nth-child(11n) { height: 40%; }
.bars[data-playing="1"] span { animation: eq 1.1s ease-in-out infinite; }
.bars span:nth-child(2n) { animation-delay: 0.18s; }
.bars span:nth-child(3n) { animation-delay: 0.36s; }
.bars span:nth-child(5n) { animation-delay: 0.54s; }
.bars span:nth-child(7n) { animation-delay: 0.72s; }
@keyframes eq { 0%, 100% { height: 22%; } 50% { height: 92%; } }

.note {
  border-left: 3px solid var(--accent2);
  background: var(--surface-2);
  padding: 0.7rem 0.95rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--fg-muted);
  font-size: 0.92rem;
  margin-bottom: 0.9rem;
}
.note strong { color: var(--fg); }

.hint { color: var(--fg-muted); font-size: 0.85rem; }
.muted { color: var(--fg-muted); }

/* ── Галерея шаблонов и дайджест (modelcards) ──────────────────────── */

details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.8rem;
  margin-bottom: 0.6rem;
  background: var(--surface-2);
}
summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.88rem;
}
details[open] summary { margin-bottom: 0.5rem; color: var(--accent2); }
details pre { margin-bottom: 0.5rem; }
details .hint { margin-bottom: 0; }

.news-list { list-style: none; margin: 0 0 0.4rem; padding: 0; }
.news-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.news-list li:last-child { border-bottom: 0; }
.news-list .hint { margin: 0.2rem 0 0; }

/* ── Подвал ────────────────────────────────────────────────────────── */

.site-foot {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.6rem clamp(1rem, 4vw, 2rem) 2rem;
}
.foot-inner {
  max-width: var(--measure);
  margin: 0 auto;
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  font-size: 0.86rem;
  color: var(--fg-muted);
}
.foot-inner h3 {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.09em;
  font-family: var(--mono);
  color: var(--fg-faint); margin-bottom: 0.5rem; font-weight: 600;
}
.foot-inner ul { list-style: none; margin: 0; padding: 0; }
.foot-inner li { margin-bottom: 0.28rem; }
.foot-inner a { color: var(--fg-muted); }
.foot-inner a:hover { color: var(--accent2); }
.foot-meta { font-family: var(--mono); font-size: 0.78rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .site-head { position: static; backdrop-filter: none; }
}

@media print {
  .site-head, .site-foot, .btn, audio, .bars { display: none; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; background: #fff; }
  h1 { color: #000; background: none; }
  a { color: #000; }
}
