/* ============================================================
 * AI usage survey — page + chart styles
 * Shared by /ai-survey and the single-chart embed view.
 * Builds on the site's theme tokens (styles.css) with local
 * accent tokens and safe fallbacks for the standalone embed.
 * ============================================================ */

:root {
  --ais-accent: #2F8765;
  --ais-accent-weak: rgba(47, 135, 101, 0.10);
  --ais-radius: 18px;
  --ais-stroke: rgba(44, 58, 51, 0.09);
}
[data-theme="dark"] {
  --ais-accent: #6FC09A;
  --ais-accent-weak: rgba(111, 192, 154, 0.12);
  --ais-stroke: rgba(156, 172, 166, 0.14);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ais-accent: #6FC09A;
    --ais-accent-weak: rgba(111, 192, 154, 0.12);
    --ais-stroke: rgba(156, 172, 166, 0.14);
  }
}

/* Give the data page more room than the 640px reading column. */
.ais-page.container { max-width: 860px; }

/* Intro / lede ------------------------------------------------------ */
.ais-intro {
  color: var(--primary-color, #2C3A33);
  font-size: 14.5pt;
  line-height: 1.62;
  margin: 0 0 10px;
}
.ais-intro strong { font-weight: 700; }
.ais-meta-line {
  color: var(--secondary-color, #5A6E65);
  font-size: 10.5pt;
  line-height: 1.65;
  border-left: 2px solid var(--ais-accent);
  padding-left: 16px;
  margin: 20px 0 40px;
  max-width: 62ch;
}

/* Section headers (eyebrow + hairline) ------------------------------ */
.ais-section-h {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 10pt;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ais-accent);
  margin: 52px 2px 18px;
}
.ais-section-h::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ais-stroke);
}

/* Headline stat cards ----------------------------------------------- */
.ais-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 12px;
  margin: 6px 0 8px;
}
.ais-stat {
  position: relative;
  background: var(--card-bg, #fff);
  border: 1px solid var(--card-border, rgba(44,58,51,0.08));
  border-radius: 14px;
  padding: 18px 18px 16px;
  box-shadow: var(--card-shadow, 0 4px 12px rgba(44,58,51,0.08));
  overflow: hidden;
}
.ais-stat::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--ais-accent);
  opacity: 0.85;
}
.ais-stat__num {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.8px;
  color: var(--ais-accent);
}
.ais-stat__num .u { font-size: 18px; font-weight: 700; margin-left: 1px; }
.ais-stat__label {
  margin-top: 9px;
  font-size: 10.5pt;
  line-height: 1.42;
  color: var(--secondary-color, #5A6E65);
}

/* Chart cards ------------------------------------------------------- */
.ais-charts { display: grid; gap: 18px; }

.ais-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--card-border, rgba(44,58,51,0.08));
  border-radius: var(--ais-radius);
  padding: 26px 26px 18px;
  box-shadow: var(--card-shadow, 0 4px 12px rgba(44,58,51,0.08));
  scroll-margin-top: 80px;
}
.ais-card__head { margin-bottom: 18px; }
.ais-card__title {
  font-size: 17pt;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--primary-color, #2C3A33);
  margin: 0 0 5px;
  line-height: 1.22;
}
.ais-card__sub {
  font-size: 11pt;
  color: var(--secondary-color, #5A6E65);
  margin: 0;
  line-height: 1.5;
  max-width: 58ch;
}

.ais-figure { width: 100%; overflow: visible; }
.ais-figure svg.ais-svg { width: 100%; height: auto; display: block; }

.ais-note {
  font-size: 9.5pt;
  color: var(--secondary-color, #5A6E65);
  opacity: 0.9;
  line-height: 1.55;
  margin: 14px 2px 0;
  max-width: 64ch;
}

/* hover affordance on series elements */
.ais-svg .ais-bar, .ais-svg .ais-seg { transition: opacity 0.12s ease; cursor: default; }
.ais-svg .ais-row:hover .ais-bar { opacity: 0.78; }
.ais-svg .ais-row:hover .ais-seg, .ais-svg .ais-seg:hover { opacity: 0.82; }

/* Action bar -------------------------------------------------------- */
.ais-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--ais-stroke);
}
.ais-actions::before {
  content: "Reuse:";
  font-size: 9pt;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--secondary-color, #5A6E65);
  opacity: 0.65;
  margin-right: 2px;
}
.ais-btn {
  font: inherit;
  font-size: 9.5pt;
  font-weight: 700;
  color: var(--secondary-color, #5A6E65);
  background: transparent;
  border: 1px solid var(--card-border, rgba(44,58,51,0.18));
  border-radius: 999px;
  padding: 5px 13px;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.ais-btn:hover { color: var(--primary-color, #2C3A33); border-color: var(--secondary-color, #5A6E65); background: var(--ais-accent-weak); }
.ais-btn.is-ok { color: var(--ais-accent); border-color: var(--ais-accent); background: var(--ais-accent-weak); }

/* Tooltip ----------------------------------------------------------- */
.ais-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
  background: var(--primary-color, #2C3A33);
  color: var(--bg-color, #F5F5F5);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  padding: 7px 11px;
  border-radius: 9px;
  max-width: 280px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.24);
}

/* Pull quotes ------------------------------------------------------- */
.ais-quotes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(248px, 1fr));
  gap: 14px;
  margin: 4px 0 8px;
}
.ais-quote {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card-bg, #fff);
  border: 1px solid var(--card-border, rgba(44,58,51,0.08));
  border-radius: var(--ais-radius);
  padding: 30px 22px 20px;
  box-shadow: var(--card-shadow, 0 4px 12px rgba(44,58,51,0.08));
}
.ais-quote::before {
  content: "\201C";
  position: absolute;
  top: 8px; left: 18px;
  font-size: 46px;
  line-height: 1;
  font-weight: 700;
  color: var(--ais-accent);
  opacity: 0.32;
}
.ais-quote p {
  margin: 0 0 12px;
  font-size: 11.5pt;
  line-height: 1.55;
  color: var(--primary-color, #2C3A33);
}
.ais-quote cite {
  margin-top: auto;
  font-style: normal;
  font-size: 9pt;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ais-accent);
}

/* Appendix table ---------------------------------------------------- */
.ais-tablewrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--card-border, rgba(44,58,51,0.08));
  border-radius: var(--ais-radius);
  background: var(--card-bg, #fff);
  box-shadow: var(--card-shadow, 0 4px 12px rgba(44,58,51,0.08));
}
.ais-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5pt;
  min-width: 660px;
}
.ais-table th, .ais-table td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--ais-stroke);
  white-space: nowrap;
}
.ais-table tbody tr:last-child td { border-bottom: 0; }
.ais-table tbody tr:hover td { background: var(--ais-accent-weak); }
.ais-table th {
  font-size: 8.5pt;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--secondary-color, #5A6E65);
  position: sticky; top: 0;
  background: var(--card-bg, #fff);
}
.ais-table td { color: var(--primary-color, #2C3A33); }
.ais-table td:first-child { color: var(--secondary-color, #5A6E65); font-variant-numeric: tabular-nums; }
.ais-pill {
  display: inline-block;
  font-size: 8.5pt;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--toggle-hover-bg, rgba(44,58,51,0.06));
  color: var(--secondary-color, #5A6E65);
}
.ais-pill--yes { background: rgba(47,135,101,0.16); color: #2F8765; }
.ais-pill--no  { background: rgba(194,96,122,0.16); color: #B24E6C; }
.ais-pill--mid { background: rgba(224,164,88,0.20); color: #B07A2E; }
[data-theme="dark"] .ais-pill--yes { color: #7FCBA6; }
[data-theme="dark"] .ais-pill--no { color: #E08BA3; }
[data-theme="dark"] .ais-pill--mid { color: #E7B777; }

/* Embed-only view --------------------------------------------------- */
.ais-embed {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 18px;
}
.ais-embed__title {
  font-size: 16pt;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--primary-color, #2C3A33);
  margin: 0 0 5px;
  line-height: 1.2;
}
.ais-embed__sub {
  font-size: 10.5pt;
  color: var(--secondary-color, #5A6E65);
  margin: 0 0 16px;
  line-height: 1.45;
}
.ais-embed__src {
  display: inline-block;
  margin-top: 14px;
  font-size: 9.5pt;
  font-weight: 700;
  color: var(--ais-accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
.ais-embed__src:hover { opacity: 0.8; }

@media (max-width: 600px) {
  .ais-card { padding: 20px 16px 14px; }
  .ais-card__title { font-size: 15.5pt; }
  .ais-stat__num { font-size: 27px; }
  .ais-intro { font-size: 13pt; }
}
