/* =============================================================
   audience.css : Nysterys Media
   The Audience Insights cards on a creator page, one card per metric, built by
   site/page-creator.js from what site/audience.js measures. Loaded by every
   creator page after site/global.css and site/page-creator.css.
   ============================================================= */

/* ─── Audience section ────────────────────────────────── */
.audience {
  padding: 6rem 3rem 7rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: 0.04em;
}

/* ─── Charts grid ─────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2rem;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2rem;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s ease, transform 0.6s ease, border-color 0.3s;
}

.chart-card:hover {
  border-color: rgba(255, 92, 0, 0.4);
}

/* Orange top bar on hover */
.chart-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right, var(--orange), var(--orange2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.chart-card:hover::before {
  transform: scaleX(1);
}

.chart-title {
  font-size: var(--font-size-11);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 1.75rem;
}

/* ─── Gender donut chart ──────────────────────────────── */
.donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
}

.donut-svg {
  width: 140px;
  height: 140px;
  /* rotate so the first segment starts at the top */
  transform: rotate(-90deg);
}

.donut-legend {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}

.legend-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-label {
  color: #aaaaaa;
}

.legend-val {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  color: var(--orange);
}

/* ─── Distribution bars (shared by any label + value + bar list) ─ */
.dist-bars {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.dist-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.dist-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
}

.dist-meta-label {
  color: var(--muted);
}

/* Sample size sits with its band so a percentage is never read without it:
   "1M+ 4%" means something different at 20 posts than at 900. */
.dist-count {
  color: var(--dim);
  font-size: var(--font-size-11);
  margin-left: 0.55rem;
}

.dist-meta-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.95rem;
  color: var(--white);
}

.bar-track {
  height: 4px;
  background: var(--border);
  position: relative;
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(to right, var(--orange), var(--orange2));
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Per-platform card rows ──────────────────────────── */

/* Provenance sits on the CARD now, not the section: each one covers a
   different set of platforms, so one header note would be wrong for six of
   the seven. */
.chart-note {
  margin-left: 0.6rem;
  color: var(--dim);
}

/* Mark, name, bar, figure. The bar absorbs the slack, so every figure on the
   card lands on one right edge and the column can be read straight down. */
/* The item owns the padding and the rule; the row inside it is only the line
   of mark, name, bar and figure. A secondary line sits under that row and
   still inside the item, so the rule lands between platforms, never
   through one. */
.pf-item + .pf-item {
  border-top: 1px solid var(--border);
  margin-top: 0.7rem;
  padding-top: 0.7rem;
}

.pf-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* The mix, under the total it adds up to. Dim, because the total is the
   comparison and this is the texture behind it. */
.pf-sub {
  margin: 0.35rem 0 0 calc(14px + 0.75rem);
  /* A line of reading, not a label, so a step above the 11px label floor. */
  font-size: var(--font-size-12);
  color: var(--dim);
}

.pf-icon, .pf-icon svg { width: 14px; height: 14px; }
.pf-icon { display: flex; flex: none; color: #8a8a8a; }

.pf-name { flex: none; width: 4.75rem; font-size: 0.75rem; color: var(--dim); }

.pf-bar { flex: 1 1 auto; min-width: 1.5rem; }

/* Bebas on the figure, so the number outranks the label beside it. */
.pf-val {
  flex: none;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

/* The strongest platform on this metric, and nothing else, gets the orange.
   An accent on every row is decoration; on one row it is information. */
.pf-val-lead { color: var(--orange); }

/* An absence is stated, never blank: a platform she is on that this metric
   cannot measure must not read as an audience of zero. The row says so in words and draws
   no bar; its name keeps full contrast, since fading it below AA hides which platform it is. */

.pf-absent {
  margin-left: auto;
  font-size: var(--font-size-11);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--dim);
}

/* Where the categories differ per platform (For You against Shorts Feed),
   each platform keeps its own labelled panel rather than sharing a scale
   that would imply the two axes are the same thing. */
.chart-card { grid-column: span 2; }
.chart-card-wide { grid-column: span 3; }

.pf-panel + .pf-panel { margin-top: 1.75rem; }

.pf-panel-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ─── Country bars ────────────────────────────────────── */
.country-bars {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.country-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.country-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
}

.country-name {
  color: var(--white);
}

.country-pct {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.95rem;
  color: var(--white);
}

/* One accent per panel, on the row that leads it. @see site/page-creator.js
   buildCountryBars for why every row in orange is worse than one. */
.country-pct-lead { color: var(--orange); }

/* ─── Responsive ──────────────────────────────────────── */

/* Between the phone stack and the full three-up, two cards across. Three at
   this width leaves each bar about 60px and wraps every secondary line, so
   the comparison the card exists to make stops being readable. */
@media (min-width: 901px) and (max-width: 1150px) {
  .chart-card { grid-column: span 3; }
}

@media (max-width: 900px) {

  .charts-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .chart-card, .chart-card-wide { grid-column: auto; }

  .audience {
    padding: 4rem 1.5rem 5rem;
  }

}
