/* ABOUTME: Visual system for Курячий Центр — inherits the saas-re palette and type scale.
   ABOUTME: Slate neutrals, violet accents, egg-yolk amber; Inter throughout. */

:root {
  --ink: #0f172a;
  --body: #334155;
  --muted: #475569;
  --dim: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --wash: #f1f5f9;
  --page: #f8fafc;
  --card: #ffffff;

  --violet: #8b5cf6;
  --violet-deep: #7c3aed;
  --violet-ink: #5b21b6;
  --violet-wash: #faf5ff;
  --violet-line: #c4b5fd;

  --yolk-a: #fef3c7;
  --yolk-b: #fde68a;
  --yolk-line: #f59e0b;
  --yolk-ink: #92400e;
  --yolk-body: #78350f;

  --up: #16a34a;
  --down: #dc2626;
  --live: #dc2626;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--page);
  color: var(--body);
  line-height: 1.65;
  padding: 32px 24px 64px;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1180px; margin: 0 auto; }

/* ---------- Chicken imagery (inline sprite, no external assets) ---------- */

.sprite { display: none; }

.ico, .h-ico { width: 1em; height: 1em; fill: currentColor; flex-shrink: 0; }
.hen-legs path, .track-lines path { stroke: currentColor; stroke-width: 7; stroke-linecap: round; fill: none; }
.hen-legs path { stroke-width: 3.4; }
.hen-eye { fill: var(--page); }

.h-ico {
  width: 20px; height: 20px;
  color: var(--yolk-line);
  vertical-align: -3px;
  margin-right: 9px;
}

h2 { display: flex; align-items: center; }

.brand-mark .ico { width: 26px; height: 26px; color: var(--yolk-ink); }

/* Watermarks — present but never competing with the text */
.glance-egg, .panel-egg {
  position: absolute;
  fill: currentColor;
  pointer-events: none;
}

.glance-egg {
  width: 132px; height: 132px;
  right: 18px; top: -14px;
  color: rgba(146, 64, 14, 0.09);
  transform: rotate(14deg);
}

.panel-egg {
  width: 104px; height: 104px;
  right: -14px; top: 6px;
  color: rgba(245, 158, 11, 0.08);
  transform: rotate(-10deg);
}

.footer-tracks {
  display: flex; gap: 16px; align-items: center;
  margin-bottom: 18px;
  color: var(--line);
}

.footer-tracks .ico { width: 15px; height: 15px; }
.footer-tracks .ico:nth-child(even) { transform: rotate(18deg) translateY(4px); }

/* ---------- Masthead ---------- */

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-mark {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  font-size: 24px;
  background: linear-gradient(135deg, var(--yolk-a) 0%, var(--yolk-b) 100%);
  border: 1px solid var(--yolk-line);
  border-radius: 10px;
  flex-shrink: 0;
}

h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-sub {
  font-size: 12px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.live-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  font-size: 12px; font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  white-space: nowrap;
}

.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--live);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ---------- Nav ---------- */

.nav-toc {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 20px 0 28px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.nav-toc a {
  font-size: 12px;
  color: var(--dim);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--wash);
  transition: all 0.15s;
}

.nav-toc a:hover { background: var(--line); color: var(--body); }

/* ---------- Stats strip ---------- */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 20px;
  padding: 20px 0;
  margin-bottom: 28px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat { text-align: center; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------- At a glance (yolk) ---------- */

.at-a-glance {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--yolk-a) 0%, var(--yolk-b) 100%);
  border: 1px solid var(--yolk-line);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 36px;
}

.at-a-glance .glance-title, .at-a-glance .glance-body { position: relative; }

.glance-title { font-size: 16px; font-weight: 700; color: var(--yolk-ink); margin-bottom: 10px; }
.glance-body { font-size: 14px; color: var(--yolk-body); line-height: 1.6; }
.glance-body strong { color: var(--yolk-ink); }

/* ---------- Sections ---------- */

h2 {
  font-size: 20px; font-weight: 600; color: var(--ink);
  margin-top: 48px; margin-bottom: 6px;
  scroll-margin-top: 24px;
}

.section-intro { font-size: 14px; color: var(--dim); margin-bottom: 18px; }

/* ---------- Streams ---------- */

.stream-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.stream-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex; flex-direction: column;
}

.stream-card.featured { border-color: var(--yolk-line); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12); }

.stream-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--ink);
  width: 100%;
  display: block;
  overflow: hidden;
}

.stream-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.stream-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }

button.stream-frame { cursor: pointer; border: 0; padding: 0; }

.stream-play {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(15, 23, 42, 0.34);
  transition: background 0.15s;
}

button.stream-frame:hover .stream-play { background: rgba(15, 23, 42, 0.16); }

.stream-play span {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  display: grid; place-items: center;
  font-size: 19px; color: var(--ink);
  padding-left: 4px;
}

/* Shown until the stream is in view and its iframe swaps in. */
.stream-standby {
  position: absolute; inset: 0;
  display: grid; place-items: center; gap: 8px;
  align-content: center;
  color: rgba(255, 255, 255, 0.5);
}

.stream-standby .ico { width: 34px; height: 34px; }
.stream-standby .hen-eye { fill: var(--ink); }
.stream-standby span { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }

.stream-meta { padding: 14px 16px; }

.stream-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.stream-title { font-weight: 600; font-size: 15px; color: var(--ink); }

.stream-tag {
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--violet-ink);
  background: var(--violet-wash);
  border: 1px solid var(--violet-line);
  padding: 2px 7px; border-radius: 4px;
}

.stream-desc { font-size: 13px; color: var(--muted); line-height: 1.5; }

.external-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 18px; }

.external-link {
  flex: 1 1 220px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  text-decoration: none;
  display: block;
  transition: all 0.15s;
}

.external-link:hover { border-color: var(--violet-line); background: var(--violet-wash); }
.external-title { font-weight: 600; font-size: 14px; color: var(--ink); margin-bottom: 4px; }
.external-title::after { content: ' ↗'; color: var(--faint); font-weight: 400; }
.external-desc { font-size: 12px; color: var(--dim); line-height: 1.45; }

/* ---------- Eggs ---------- */

.egg-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
}

.panel-index { position: relative; overflow: hidden; }
.panel-index > *:not(.panel-egg) { position: relative; }

.panel-title {
  font-size: 12px; font-weight: 600; color: var(--dim);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 14px;
}

.index-hero { display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.index-value { font-size: 44px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.index-unit { font-size: 13px; color: var(--dim); }
.index-name { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

.wobble-note {
  font-size: 12px; color: var(--yolk-ink);
  background: var(--yolk-a);
  border: 1px solid var(--yolk-b);
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 14px;
}

.market-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--wash);
  font-size: 13px;
}

.market-row:last-child { border-bottom: none; }
.market-code { width: 46px; font-size: 11px; font-weight: 600; color: var(--faint); letter-spacing: 0.04em; flex-shrink: 0; }
.market-name { flex: 1; color: var(--body); }
.market-price { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
.market-unit { font-size: 11px; color: var(--faint); width: 54px; text-align: right; }
.market-change { width: 62px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12px; }
.market-change.up { color: var(--up); }
.market-change.down { color: var(--down); }

.bar-row { display: flex; align-items: center; margin-bottom: 8px; }
.bar-label { width: 42px; font-size: 11px; color: var(--muted); flex-shrink: 0; }
.bar-track { display: block; flex: 1; height: 8px; background: var(--wash); border-radius: 4px; margin: 0 10px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--yolk-b), var(--yolk-line)); transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
.bar-value { width: 34px; font-size: 11px; font-weight: 500; color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; }

.demo-flag {
  font-size: 11px; color: var(--dim);
  margin-top: 16px; padding-top: 12px;
  border-top: 1px dashed var(--line);
  line-height: 1.5;
}

/* ---------- Affairs ---------- */

.affairs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

.affair-card {
  background: linear-gradient(135deg, var(--violet-wash) 0%, #f5f3ff 100%);
  border: 1px solid var(--violet-line);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex; flex-direction: column;
}

.affair-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.affair-title { font-weight: 600; font-size: 15px; color: var(--violet-ink); }

.affair-status {
  font-size: 10px; font-weight: 600; letter-spacing: 0.05em;
  color: var(--violet-ink);
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--violet-line);
  padding: 3px 8px; border-radius: 4px;
  white-space: nowrap; flex-shrink: 0;
}

.affair-body { font-size: 13px; color: var(--body); line-height: 1.55; flex: 1; }

.affair-metric {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid rgba(196, 181, 253, 0.6);
}

.affair-metric-label { font-size: 11px; color: #6b21a8; text-transform: uppercase; letter-spacing: 0.04em; }
.affair-metric-value { font-size: 20px; font-weight: 700; color: var(--violet-ink); font-variant-numeric: tabular-nums; }

/* Expandable detail — native <details> keeps keyboard and screen-reader behaviour free */
.affair-more { margin-top: 12px; }
.affair-more > summary {
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  color: #6b21a8;
  display: flex; align-items: center; gap: 6px;
  padding: 6px 0 0;
  user-select: none;
}
.affair-more > summary::-webkit-details-marker { display: none; }
.affair-more > summary::after {
  content: '▸';
  font-size: 10px;
  transition: transform 0.15s;
}
.affair-more[open] > summary::after { transform: rotate(90deg); }
.affair-more > summary:hover { color: var(--violet-ink); }

.affair-details {
  margin-top: 10px;
  border-top: 1px solid rgba(196, 181, 253, 0.6);
  padding-top: 10px;
}

.affair-detail-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 12px;
  padding: 5px 0;
  border-bottom: 1px dashed rgba(196, 181, 253, 0.45);
}
.affair-detail-row:last-child { border-bottom: none; }
.affair-detail-label { color: #6b21a8; }
.affair-detail-value { color: var(--violet-ink); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

.affair-note {
  margin-top: 10px;
  font-size: 12px;
  color: #5b21b6;
  background: rgba(255, 255, 255, 0.62);
  border-radius: 6px;
  padding: 9px 11px;
  line-height: 1.55;
}

/* ---------- News ---------- */

.news-list { display: flex; flex-direction: column; gap: 12px; }

.news-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 8px;
  padding: 14px 18px;
}

.news-item.official { border-left-color: #2563eb; }
.news-item.market   { border-left-color: var(--yolk-line); }
.news-item.research { border-left-color: var(--violet); }

.news-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.news-time { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }

.news-tag {
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--dim); background: var(--wash);
  padding: 2px 7px; border-radius: 4px;
}

.news-title { font-weight: 600; font-size: 15px; color: var(--ink); margin-bottom: 4px; }
.news-body { font-size: 13px; color: var(--muted); line-height: 1.55; }

/* ---------- States ---------- */

.loading, .error {
  font-size: 13px; color: var(--faint);
  padding: 20px; text-align: center;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.error { color: #991b1b; background: #fef2f2; border-color: #fca5a5; }

/* ---------- Footer ---------- */

.footer {
  margin-top: 56px; padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--faint);
  line-height: 1.7;
}

.footer-support {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--muted);
}

.footer-support a { color: var(--muted); font-weight: 600; }

@media (max-width: 860px) {
  .egg-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { padding: 20px 16px 48px; }
  h1 { font-size: 21px; }
  .index-value { font-size: 36px; }
  .market-unit { display: none; }
}

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