/* Interactive and embeddable charts for Abelian Partners articles. */
.ap-chart{
  margin:2.25rem 0;
  width:100%;
  background:#fff;
  border:1px solid var(--border,#e1e5e8);
  border-radius:var(--radius,0.3rem);
  padding:1.15rem 1.15rem 1rem;
  box-sizing:border-box;
}
.ap-chart-head{
  display:flex;align-items:flex-start;justify-content:space-between;
  gap:1rem;margin-bottom:.85rem;
}
.ap-chart-head h3,.ap-chart-head .ap-chart-title{
  font-family:var(--sans,Catamaran,system-ui,sans-serif);
  font-size:1.05rem;font-weight:700;line-height:1.35;
  color:var(--heading,#303640);margin:0;flex:1;
  text-wrap:balance;
}
.ap-chart-sub{
  display:block;font-size:.88rem;font-weight:600;color:var(--heading,#303640);
  margin-top:.2rem;
}
.ap-embed-btn,.ap-copy-btn,.ap-dialog-close{
  appearance:none;font-family:var(--sans,Catamaran,system-ui,sans-serif);
  font-size:12px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;
  border:1px solid var(--primary,#2663bd);color:var(--primary,#2663bd);
  background:#fff;border-radius:var(--radius,0.3rem);
  padding:.4rem .7rem;cursor:pointer;line-height:1;white-space:nowrap;
}
.ap-embed-btn:hover,.ap-copy-btn:hover{
  background:var(--primary,#2663bd);color:#fff;
}
.ap-embed-btn:focus-visible,.ap-copy-btn:focus-visible,.ap-dialog-close:focus-visible{
  outline:3px solid var(--secondary,#4997fb);outline-offset:2px;
}
.ap-chart-canvas-wrap{
  position:relative;width:100%;height:420px;
}
.ap-chart-canvas-wrap.pie{height:480px}
.ap-chart-image-wrap{width:100%}
.ap-chart-image-wrap img{
  width:100%;height:auto;display:block;margin:0;border-radius:0;max-height:none;
}
.ap-chart figcaption,.ap-chart .ap-chart-source{
  margin:.7rem 0 0;font-size:13px;color:var(--faded,#686f7c);text-align:center;
}
.ap-chart-data{
  width:100%;border-collapse:collapse;margin:1rem 0 0;font-size:14px;
}
.ap-chart-data th,.ap-chart-data td{
  text-align:left;padding:.35rem .5rem;border-bottom:1px solid var(--border,#e1e5e8);
}
.ap-chart-data th{font-weight:700}
.ap-sr-only,.ap-chart-data.ap-sr-only{
  position:absolute;width:1px;height:1px;padding:0;margin:-1px;
  overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;
}
.ap-chart details.ap-chart-table{
  margin-top:.75rem;font-size:14px;
}
.ap-chart details.ap-chart-table summary{
  cursor:pointer;color:var(--primary,#2663bd);font-weight:600;
}
.ap-embed-dialog{
  border:1px solid var(--border,#e1e5e8);border-radius:var(--radius,0.3rem);
  padding:1.25rem 1.35rem;max-width:min(560px,calc(100vw - 2rem));
  box-shadow:0 18px 44px rgba(48,54,64,.16);
}
.ap-embed-dialog::backdrop{background:rgba(36,41,50,.45)}
.ap-embed-dialog h3{margin:0 0 .6rem;font-size:1.05rem}
.ap-embed-dialog p{margin:0 0 .7rem;font-size:14.5px;line-height:1.5;color:var(--text,#303640)}
.ap-embed-dialog textarea{
  width:100%;min-height:9.5rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:12px;line-height:1.45;padding:.65rem;border:1px solid var(--border,#e1e5e8);
  border-radius:var(--radius,0.3rem);resize:vertical;box-sizing:border-box;
}
.ap-embed-actions{display:flex;gap:.6rem;margin-top:.75rem;flex-wrap:wrap}

/* Full-width content figures that were previously capped as logos (66px). */
.prose .content-fig{margin:2rem 0}
.prose .content-fig img{
  max-height:none;width:100%;height:auto;margin:0;border-radius:var(--radius,0.3rem);
}

@media(max-width:600px){
  .ap-chart{padding:.85rem .75rem .8rem}
  .ap-chart-canvas-wrap{height:320px}
  .ap-chart-canvas-wrap.pie{height:380px}
  .ap-chart-head{flex-direction:column;align-items:stretch;gap:.55rem}
  .ap-embed-btn{align-self:flex-start}
}
@media print{
  .ap-embed-btn,.ap-embed-dialog,.ap-chart details.ap-chart-table{display:none!important}
  .ap-chart{border:0;padding:0;break-inside:avoid}
  .ap-chart-canvas-wrap{height:320px}
}
@media(prefers-reduced-motion:reduce){
  .ap-embed-btn,.ap-copy-btn{transition:none}
}

/* Standalone embed page */
body.ap-embed{
  margin:0;padding:12px 14px 16px;background:#fff;
  font-family:Catamaran,system-ui,-apple-system,sans-serif;color:#303640;
}
body.ap-embed .ap-chart{margin:0;border:0;padding:0;box-shadow:none}
body.ap-embed .ap-embed-btn{display:none}
body.ap-embed .ap-embed-credit{
  margin-top:.65rem;font-size:12px;color:#686f7c;text-align:right;
}
body.ap-embed .ap-embed-credit a{color:#2663bd;text-decoration:none}


/* Newsprint article styles uppercase every h3 and paint a rule above it.
   Chart titles and the embed dialog must stay in Title Case. */
.prose.newsprint .ap-chart h3,
.prose.newsprint .ap-chart .ap-chart-title,
.prose.newsprint .ap-chart .ap-chart-sub,
.prose.newsprint .ap-embed-dialog h3,
.prose .ap-chart h3,
.prose .ap-chart .ap-chart-title,
.ap-embed-dialog h3{
  text-transform:none !important;
  letter-spacing:normal !important;
  border-top:0 !important;
  padding-top:0 !important;
  margin:0;
  font-size:1.05rem !important;
  line-height:1.35 !important;
  font-family:var(--sans,Catamaran,system-ui,sans-serif) !important;
  font-style:normal !important;
  font-weight:700 !important;
  color:var(--heading,#303640) !important;
}
.prose.newsprint .ap-chart .ap-chart-sub,
.prose .ap-chart .ap-chart-sub{
  display:block;
  font-size:.88rem !important;
  font-weight:600 !important;
  margin-top:.2rem !important;
}

/* Image charts already carry a title and source in the figure itself. */
.ap-chart-image .ap-chart-title,
.ap-chart-image .ap-chart-source{display:none}
.ap-chart-image .ap-chart-head{
  justify-content:flex-end;margin-bottom:.5rem;min-height:0;
}
.ap-chart-image-wrap img{min-height:180px}
