/* Figures for /research/senocr-vi.
   Built on the editorial variables declared in /research/template.css
   (--ink, --graphite, --stone, --bone, --manilla, --crail, --sage, --wheat,
   --wax, --olive, --slate-blue, --serif, --sans, --mono). */

/* ── Frame ──────────────────────────────────────────────── */

.fig {
  margin: 44px 0;
}

/* Break out of the 700px reading column without touching .container. */
.fig--wide {
  width: min(100vw - 32px, 940px);
  margin-left: 50%;
  transform: translateX(-50%);
}

/* Title card between the dateline and the lede. */
.article-hero {
  margin-top: 0;
  margin-bottom: 40px;
}

.article-hero img {
  display: block;
  width: 100%;
  height: auto;
}

.fig-card {
  background: var(--manilla);
  border: 1px solid var(--bone);
  padding: 26px 28px 22px;
}

.fig-head {
  margin: 0 0 24px;
}

.fig-eyebrow {
  margin: 0 0 8px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--crail);
}

.fig-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.fig-sub {
  margin: 6px 0 0;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--stone);
}

/* Charts keep their proportions on small screens by scrolling sideways
   inside their own card rather than compressing to illegibility. */
.fig-scroll {
  overflow-x: auto;
  padding-top: 10px;
}

.fig-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  margin: 0 0 20px;
}

.fig-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.fig-legend i {
  width: 13px;
  height: 13px;
  flex: none;
  display: inline-block;
}

.fig-note {
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--stone);
  margin: 14px 0 0;
}

/* ── Column charts (figures 1, 2, 4) ────────────────────── */

.col-chart {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.col-chart__axis-title {
  width: 20px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: var(--axis-title-offset, 56px);
}

.col-chart__axis-title span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stone);
}

.col-chart__ticks {
  width: 40px;
  flex: none;
  position: relative;
  height: var(--plot-h);
}

.col-chart__ticks span {
  position: absolute;
  right: 8px;
  transform: translateY(50%);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--stone);
}

.col-chart__ticks::after {
  content: "";
  position: absolute;
  right: 0;
  top: -1px;
  bottom: -1px;
  width: 1px;
  background: var(--graphite);
}

.col-chart__plot {
  flex: 1;
  min-width: 0;
}

.col-chart__grid {
  position: relative;
  height: var(--plot-h);
}

.col-chart__grid hr {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0;
  border: 0;
  border-top: 1px solid var(--bone);
}

.col-chart__bars {
  position: absolute;
  inset: 0;
  display: grid;
  align-items: end;
}

.col-chart__baseline {
  height: 1px;
  background: var(--graphite);
}

.col-chart__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}

.col-chart__logo {
  height: 28px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 7px;
}

.col-chart__logo img {
  max-height: 100%;
  max-width: 82%;
  object-fit: contain;
  display: block;
}

.col-chart__value {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--graphite);
  margin-bottom: 7px;
}

.col-chart__col.is-subject .col-chart__value {
  color: var(--crail);
  font-weight: 500;
}

.col-chart__bar {
  width: 62%;
  background: var(--wax);
}

.col-chart__labels {
  display: grid;
  padding-top: 11px;
}

.col-chart__labels > div {
  text-align: center;
  padding: 0 6px;
}

.col-chart__name {
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* Reserve two lines so a wrapped name does not push its sub-label out of line. */
.col-chart__labels.has-meta .col-chart__name {
  min-height: 2.7em;
}

.col-chart__labels .is-subject .col-chart__name {
  color: var(--crail);
  font-weight: 600;
}

.col-chart__meta {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--stone);
  margin-top: 3px;
}

.col-chart__x-title {
  text-align: center;
  margin-top: 14px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stone);
}

/* Grouped columns (figure 2): two bars share one category slot. */
.col-chart__pair {
  align-self: stretch;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  height: 100%;
}

.col-chart__pair .col-chart__col {
  width: 68px;
}

/* ── Figure 3: corpus composition ───────────────────────── */

.cc-panel + .cc-panel {
  margin-top: 30px;
}

.cc-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.cc-panel__head h4 {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.cc-key {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--stone);
  margin-right: 10px;
}

.cc-panel__n {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--stone);
  white-space: nowrap;
}

.cc-bar {
  display: flex;
  height: 82px;
  width: 100%;
}

.cc-seg {
  border-right: 1.5px solid var(--paper-cream);
  padding: 0 13px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-family: var(--sans);
  overflow: hidden;
}

.cc-seg:last-child {
  border-right: 0;
}

.cc-seg b {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.cc-seg--narrow {
  padding: 0;
}

/* ── Figure 4: two-panel comparison ─────────────────────── */

.panels {
  display: flex;
  gap: 22px;
}

.panel {
  background: var(--pure-white);
  border: 1px solid var(--bone);
  padding: 20px 22px 18px;
  display: flex;
  flex-direction: column;
}

.panel--a { flex: 38; }
.panel--b { flex: 62; }

.panel__head {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 18px;
}

.panel__key {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--stone);
}

.panel__head h4 {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}

.panel__note {
  margin: 16px 0 0;
  border-left: 2px solid var(--bone);
  padding-left: 12px;
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.5;
  color: var(--graphite);
}

.panel .col-chart__bar {
  border-top: 2px solid var(--stone);
}

.panel .col-chart__col.is-subject .col-chart__bar {
  background: var(--crail);
  border-top: 0;
}

.panel .col-chart__value {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.panel .col-chart__name {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
}

/* ── Figure 5: SVG comparison ───────────────────────────── */

.fig-svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ── Narrow screens ─────────────────────────────────────── */

@media (max-width: 860px) {
  .panels { flex-direction: column; }
  .panel--a, .panel--b { flex: none; }
}

@media (max-width: 640px) {
  .fig-card { padding: 20px 18px 18px; }
  .fig-title { font-size: 19px; }
  .fig-scroll > * { min-width: 560px; }
  .cc-bar { height: 72px; }
}
