/* ==========================================================================
   Аналітика — "🔬 Дослідження проєкту" cards + premium redesign of the
   "👥 Аудиторія з коментарів" block. Scoped additions only — reuses
   .panel/.chip/.badge/.tile/.btn/.empty-state/.md-body from style.css.
   Owned by: frontend/templates/analytics.html + frontend/js/analytics.js.
   ========================================================================== */

/* ── "🔬 Дослідження проєкту" ─────────────────────────────────────────────── */
.ana-rs-subhead{
  font: 700 var(--fs-12)/1 var(--sans); color: var(--text-mute);
letter-spacing: .04em; margin: 4px 0 10px;
}

.ana-rs-grid{
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--sp-14); margin-bottom: 8px;
}

.ana-rs-card{
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  display: flex; flex-direction: column;
}
.ana-rs-card:hover{ border-color: var(--border-hover); transform: translateY(-3px); box-shadow: var(--shadow-2); }
.ana-rs-card-open{ border-color: var(--accent); box-shadow: var(--shadow-2); }

.ana-rs-thumb{
  position: relative; aspect-ratio: 16/9; background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.ana-rs-thumb img{ width: 100%; height: 100%; object-fit: cover; display: block; }
.ana-rs-thumb-ph{ font-size: 34px; opacity: .5; }

.ana-rs-body{ padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; }
.ana-rs-top{ display: flex; align-items: center; justify-content: space-between; gap: var(--sp-8); flex-wrap: wrap; }
.ana-rs-chip{
  height: 26px; padding: 0 10px; font-size:  var(--fs-11); cursor: default; pointer-events: none;
  background: var(--grad-brand-soft); border-color: transparent; color: var(--text);
}
.ana-rs-card-project .ana-rs-chip{ background: var(--panel-2); color: var(--text-dim); border-color: var(--border); }

.ana-rs-name{
  font: 700 var(--fs-13)/1.3 var(--sans); color: var(--text);
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.ana-rs-date{ font: 600 var(--fs-11)/1 var(--mono); color: var(--text-mute); }
.ana-rs-excerpt{
  font: 500 var(--fs-12)/1.5 var(--sans); color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  min-height: 1.5em;
}
.ana-rs-card:hover .ana-rs-excerpt{ color: var(--text); }

.ana-rs-expand{
  border-top: 1px solid var(--border-soft); padding: 12px 14px 14px; cursor: default;
  animation: anaRsExpandIn 180ms var(--ease-out-back, ease);
}
.ana-rs-expand[hidden]{ display: none; }
.ana-rs-expand-body{ max-height: 320px; overflow-y: auto; font-size:  var(--fs-12); line-height: 1.7; }
.ana-rs-expand-body :is(h1,h2,h3){ font-size:  var(--fs-13); margin: 10px 0 4px; }
.ana-rs-open-btn{ margin-top: 10px; }
@keyframes anaRsExpandIn{ from{ opacity: 0; transform: translateY(-4px); } to{ opacity: 1; transform: translateY(0); } }

@media (max-width: 640px){
  .ana-rs-grid{ grid-template-columns: 1fr; }
}

/* ── Premium "👥 Аудиторія з коментарів" ─────────────────────────────────── */
.ana-aud-block{ position: relative; }

/* Summary tiles: give each of the 3 a distinct accent icon tint, matching the
   overview KPI tiles' visual language but a touch more colorful here since
   this block is otherwise text-heavy. */
#audSummaryTiles.tile,
#audSummaryTiles .tile{ position: relative; }
#audSummaryTiles .tile:nth-child(1) .tl-ic{ background: linear-gradient(135deg, var(--accent-t-edge), var(--accent-t-wash-1)); }
#audSummaryTiles .tile:nth-child(2) .tl-ic{ background: linear-gradient(135deg, var(--accent-t-edge), var(--accent-t-wash-1)); }
#audSummaryTiles .tile:nth-child(3) .tl-ic{ background: linear-gradient(135deg, var(--accent-t-edge-hi), var(--accent-t-wash-2)); color: #171717; }

/* Top-commenters / topics / questions columns — lift from bare list to a
   ranked mini-card list. */
.aud-col{ position: relative; overflow: hidden; }
.aud-col::before{
  content: ""; position: absolute; top: 0; right: 0; bottom: auto; left: 0; height: 3px;
  background: var(--grad-brand); opacity: .8;
}
.aud-col-title{
  font: 700 var(--fs-12)/1 var(--sans); color: var(--text);  margin-bottom: 10px; padding-top: 2px;
}
.aud-list-simple{ list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-4); }
.aud-mini-row{
  display: flex; align-items: flex-start; gap: var(--sp-8);
  padding: 7px 8px; border-radius: var(--radius-sm);
  transition: background var(--t-fast) var(--ease);
}
.aud-mini-row:hover{ background: var(--panel-2); }
.aud-mini-rank{
  flex: none; width: 18px; height: 18px; border-radius: 50%; margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  font: 700 var(--fs-10)/1 var(--mono); color: var(--text-mute); background: var(--panel-2); border: 1px solid var(--border);
}
.aud-mini-row:nth-child(1) .aud-mini-rank{ background: var(--grad-brand); color: #fff; border-color: transparent; }
.aud-mini-row:nth-child(2) .aud-mini-rank{ background: var(--grad-brand-soft); color: var(--text); border-color: transparent; }
.aud-mini-text{ font: 500 var(--fs-12)/1.5 var(--sans); color: var(--text-dim); overflow-wrap: anywhere; }
.aud-list-empty{ font: 500 var(--fs-12)/1.5 var(--sans); color: var(--text-mute); font-style: italic; padding: 4px 8px; }

/* People list rows — add an avatar-initials circle, tighten spacing, keep the
   existing .aud-person-row hover from style.css and layer on top of it. */
.aud-person-row{ display: flex; align-items: center; gap: var(--sp-12); }
.aud-person-avatar{
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font: 700 var(--fs-12)/1 var(--sans); color: #fff; background: var(--grad-brand);
}
.aud-people-list{ display: flex; flex-direction: column; gap: var(--sp-8); }

.aud-search-row{ margin: 4px 0 10px; }
.aud-search-input{
  width: 100%; box-sizing: border-box; height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  font: 500 var(--fs-13)/1 var(--sans); transition: border-color var(--t-fast) var(--ease);
}
.aud-search-input:focus{ outline: none; border-color: var(--accent); }
.aud-search-input::placeholder{ color: var(--text-mute); }

@media (max-width: 860px){
  .aud-person-row{ gap: var(--sp-10); }
  .aud-person-avatar{ width: 32px; height: 32px; font-size:  var(--fs-11); }
}

/* Фолбек aspect-ratio для WebKit < 15 — див. пояснення в style.css. */
@supports not (aspect-ratio: 1 / 1) {
  .ana-rs-thumb::before{ content: ""; display: block; padding-top: 56.25%; }  /* 16:9 */
  .ana-rs-thumb > *{ position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
}
