/* GT America's default arrow glyphs are weak at table sizes; stylistic set 3
   swaps in the better-drawn ones. Set on the block wrapper, on the table itself
   and on the caption that follows it, all unprefixed, so it inherits to every
   descendant — headers, category rows, values, row subtitles carrying
   "Brier Index ↑" — and keeps working on surfaces that are not
   `#main.post article.content` (the model card) or that do not exist yet.
   Harmless when GT America has not loaded: an unsupported feature tag is
   ignored.

   `.benchmark-results-table` is listed separately on purpose: not every table
   using these classes comes from the shortcode. The Introducing Inkling post
   hand-writes two six-model tables that reuse the same `benchmark-*` classes
   without the `.inkling-eval-table-block` wrapper, and they carry arrows too.
   Targeting the table element is what actually reaches all of them.

   If a descendant ever needs `font-variant-numeric: tabular-nums`, set it on
   the same element as any local font-feature-settings rather than relying on
   the two cascading from different elements — engines disagree about how the
   low-level and high-level properties compose. */
.inkling-eval-table-block,
.benchmark-results-table,
.benchmark-results-note {
  font-feature-settings: "ss03";
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] {
  clip-path: none;
  container-type: inline-size;
  display: block;
  margin: 1.8rem 0 1.8rem 50%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-block: var(--post-block-padding-y);
  transform: translateX(-50%);
  width: clamp(100%, calc(100vw - 2.6rem), 55rem);
  -webkit-clip-path: none;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table]::before,
#main.post article.content .inkling-eval-table[data-inkling-eval-table]::after {
  display: none;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] table {
  display: table !important;
  font-size: 13px;
  max-width: 100%;
  /* Size to the column count so tables with fewer models (e.g. multimodal)
     don't stretch each column unnecessarily wide. Falls back to ~9 models. */
  min-width: calc(var(--benchmark-name-column-width, 10.5rem) + var(--benchmark-model-count, 9) * 6rem);
  table-layout: fixed;
  width: 100%;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table {
  --benchmark-feature-border: color-mix(in srgb, var(--fg) 16%, var(--bg) 84%);
  --benchmark-group-column-width: 0px;
  --benchmark-name-column-width: clamp(10rem, 20vw, 10.5rem);
  --benchmark-rule-color: color-mix(in srgb, var(--fg) 12%, var(--bg) 88%);
  --benchmark-rule-color-highlight: color-mix(in srgb, var(--fg) 7%, var(--bg) 93%);
  --benchmark-sticky-left-width: var(--benchmark-name-column-width);
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table tbody tr,
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table tbody td {
  height: 3.03125rem;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-model {
  color: var(--fg);
  vertical-align: top;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-model-name,
#main.post article.content .inkling-eval-sticky-header .benchmark-model-name {
  display: block;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-model-name-line,
#main.post article.content .inkling-eval-sticky-header .benchmark-model-name-line {
  display: block;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-model.benchmark-instant-start {
  font-weight: 500;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-model.benchmark-instant-start .benchmark-subtitle {
  font-weight: 400;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-subtitle {
  font-size: 11px;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-model-group-row,
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-model-group-row > * {
  height: 1.75rem;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-model-group {
  color: var(--fg3);
  font-size: 13px;
  padding-bottom: 0.35rem;
  vertical-align: bottom;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-model-group-anchor {
  display: block;
  margin-inline: auto;
  position: static;
  width: auto;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-model-group-label {
  display: inline-block;
  transform: none;
  white-space: nowrap;
  width: auto;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-model-header-row {
  position: relative;
  z-index: 12;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-model-header-row > * {
  background-color: var(--bg);
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-model-header-row .benchmark-heading-spacer {
  z-index: 13;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-model-header-row .benchmark-model.benchmark-instant-start {
  z-index: 14;
}

#main.post article.content .inkling-eval-sticky-header {
  --benchmark-feature-border: color-mix(in srgb, var(--fg) 16%, var(--bg) 84%);
  --benchmark-group-column-width: 0px;
  --benchmark-name-column-width: clamp(10rem, 20vw, 10.5rem);
  --benchmark-right-fade-size: 0px;
  --benchmark-rule-color: color-mix(in srgb, var(--fg) 12%, var(--bg) 88%);
  --benchmark-scroll-fade-size: clamp(1.6rem, 3vw, 3rem);
  --benchmark-sticky-left-width: var(--benchmark-name-column-width);
  background-color: var(--bg);
  box-sizing: border-box;
  left: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  position: fixed;
  scroll-behavior: auto;
  top: var(--site-header-height);
  visibility: hidden;
  will-change: transform;
  z-index: 100;
  -webkit-mask-image: linear-gradient(
    to right,
    rgb(0 0 0 / 1) 0,
    rgb(0 0 0 / 1) calc(100% - var(--benchmark-right-fade-size)),
    rgb(0 0 0 / 0) 100%
  );
  mask-image: linear-gradient(
    to right,
    rgb(0 0 0 / 1) 0,
    rgb(0 0 0 / 1) calc(100% - var(--benchmark-right-fade-size)),
    rgb(0 0 0 / 0) 100%
  );
}

#main.post article.content .inkling-eval-sticky-header.is-active {
  opacity: 1;
  visibility: visible;
}

#main.post article.content .inkling-eval-sticky-header.is-scrollable-right {
  --benchmark-right-fade-size: var(--benchmark-scroll-fade-size);
}

#main.post article.content .inkling-eval-sticky-header .benchmark-results-sticky-table {
  --benchmark-feature-border: color-mix(in srgb, var(--fg) 16%, var(--bg) 84%);
  --benchmark-group-column-width: 0px;
  --benchmark-name-column-width: clamp(10rem, 20vw, 10.5rem);
  --benchmark-rule-color: color-mix(in srgb, var(--fg) 12%, var(--bg) 88%);
  --benchmark-sticky-left-width: var(--benchmark-name-column-width);
  border-collapse: separate;
  border-spacing: 0;
  display: table !important;
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
  max-width: none;
  /* Must mirror the body table's width so the sticky header columns stay aligned. */
  min-width: calc(var(--benchmark-name-column-width, 10.5rem) + var(--benchmark-model-count, 9) * 6rem);
  table-layout: fixed;
  width: 100%;
}

#main.post article.content .inkling-eval-sticky-header--content .benchmark-results-sticky-table {
  min-width: 0;
  width: 100%;
}

#main.post article.content .inkling-eval-sticky-header .benchmark-name-column {
  width: var(--benchmark-name-column-width);
}

#main.post article.content .inkling-eval-sticky-header .benchmark-model-header-row {
  position: relative;
  transform: none;
  z-index: 12;
}

#main.post article.content .inkling-eval-sticky-header .benchmark-model-header-row > * {
  background-color: var(--bg);
}

#main.post article.content .inkling-eval-sticky-header .benchmark-model {
  color: var(--fg);
  vertical-align: top;
}

#main.post article.content .inkling-eval-sticky-header .benchmark-model.benchmark-instant-start {
  font-weight: 500;
  z-index: 14;
}

#main.post article.content .inkling-eval-sticky-header .benchmark-model.benchmark-instant-start .benchmark-subtitle {
  font-weight: 400;
}

#main.post article.content .inkling-eval-sticky-header .benchmark-heading-spacer {
  z-index: 13;
}

#main.post article.content .inkling-eval-sticky-header .benchmark-subtitle {
  font-size: 11px;
}

#main.post article.content .inkling-eval-sticky-header th,
#main.post article.content .inkling-eval-sticky-header td {
  padding: 0.5rem;
}

#main.post article.content .inkling-eval-sticky-header::-webkit-scrollbar {
  display: none;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-name-column {
  width: var(--benchmark-name-column-width);
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] td.benchmark-name {
  padding-left: 1.25rem;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] td.benchmark-name::before,
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-heading-spacer::before,
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-category-label::before {
  left: 0.75rem;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] tbody tr.benchmark-category-row,
#main.post article.content .inkling-eval-table[data-inkling-eval-table] tbody tr.benchmark-category-row > * {
  height: 1.75rem;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] tbody tr.benchmark-category-row {
  position: relative;
  top: auto;
  transform: none;
  will-change: auto;
  z-index: 10;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-category-group {
  position: relative;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-category-group:not(:last-of-type) tr:last-child td::before {
  display: block;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-category-group:not(:last-of-type) tr:last-child .benchmark-value.benchmark-instant-start,
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-category-group:not(:last-of-type) tr:last-child .benchmark-value.benchmark-instant-start::after {
  border-radius: 0;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-category-group:not(:last-of-type) tr:last-child .benchmark-value.benchmark-instant-start::after {
  border-bottom: 0;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-category-row > * {
  --benchmark-category-bg: color-mix(in srgb, var(--fg4) 8%, var(--bg) 92%);
  --benchmark-cell-bg: var(--benchmark-category-bg);
  background-color: var(--benchmark-category-bg);
  pointer-events: none;
  position: relative;
  z-index: 1;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-category-label {
  background-color: transparent;
  background-image: linear-gradient(to right, transparent 0.75rem, var(--benchmark-category-bg) 0.75rem);
  box-sizing: border-box;
  color: var(--fg3);
  font-size: 13px;
  font-weight: 400;
  left: 0;
  min-width: var(--benchmark-name-column-width);
  padding: 0.3rem 0.75rem 0.3rem 1.25rem;
  position: sticky;
  text-align: left;
  vertical-align: middle;
  width: var(--benchmark-name-column-width);
  z-index: 8;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table].is-scrollable-left .benchmark-category-label {
  background-color: var(--benchmark-category-bg);
  background-image: none;
}

/* A long band label overflows its fixed-width column and crosses the featured
   column's box edge. The label already paints above that edge (z-index 8 vs 7),
   so the rule was only showing through the gaps in the glyphs — it needed a
   backdrop, not a shorter label or a wrap.

   The backdrop is a pseudo-element rather than a background on the text, so the
   text is never masked. It is the band's own colour, so it is invisible as a
   shape; it fades out horizontally past the last glyph so the rule returns
   gradually rather than at a hard edge, and is softened top and bottom so it
   never reads as a rectangle against the band. */
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-category-label-text {
  position: relative;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-category-label-text::before {
  background-image: linear-gradient(
    to right,
    var(--benchmark-category-bg) calc(100% - 0.85rem),
    rgb(0 0 0 / 0) 100%
  );
  content: "";
  inset: -0.2rem -0.85rem -0.2rem -0.15rem;
  pointer-events: none;
  position: absolute;
  z-index: -1;
  -webkit-mask-image: linear-gradient(to bottom, rgb(0 0 0 / 0) 0, rgb(0 0 0 / 1) 22%, rgb(0 0 0 / 1) 78%, rgb(0 0 0 / 0) 100%);
  mask-image: linear-gradient(to bottom, rgb(0 0 0 / 0) 0, rgb(0 0 0 / 1) 22%, rgb(0 0 0 / 1) 78%, rgb(0 0 0 / 0) 100%);
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-category-cell {
  padding-block: 0.3rem;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] th,
#main.post article.content .inkling-eval-table[data-inkling-eval-table] td {
  padding: 0.5rem;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-title {
  white-space: normal;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] tbody tr:hover .benchmark-value.benchmark-instant-start {
  background-color: var(--benchmark-hover-bg);
}

@media (min-width: 1280px) {
  #main.post article.content .inkling-eval-table-controls {
    display: none;
  }

  #main.post article.content .inkling-eval-table[data-inkling-eval-table] {
    width: 64rem;
  }
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table:has(.benchmark-model:nth-child(2):hover, tbody .benchmark-value:nth-child(2):hover) .benchmark-model:nth-child(2),
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table:has(.benchmark-model:nth-child(2):hover, tbody .benchmark-value:nth-child(2):hover) tbody .benchmark-value:nth-child(2),
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table:has(.benchmark-model:nth-child(3):hover, tbody .benchmark-value:nth-child(3):hover) .benchmark-model:nth-child(3),
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table:has(.benchmark-model:nth-child(3):hover, tbody .benchmark-value:nth-child(3):hover) tbody .benchmark-value:nth-child(3),
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table:has(.benchmark-model:nth-child(4):hover, tbody .benchmark-value:nth-child(4):hover) .benchmark-model:nth-child(4),
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table:has(.benchmark-model:nth-child(4):hover, tbody .benchmark-value:nth-child(4):hover) tbody .benchmark-value:nth-child(4),
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table:has(.benchmark-model:nth-child(5):hover, tbody .benchmark-value:nth-child(5):hover) .benchmark-model:nth-child(5),
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table:has(.benchmark-model:nth-child(5):hover, tbody .benchmark-value:nth-child(5):hover) tbody .benchmark-value:nth-child(5),
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table:has(.benchmark-model:nth-child(6):hover, tbody .benchmark-value:nth-child(6):hover) .benchmark-model:nth-child(6),
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table:has(.benchmark-model:nth-child(6):hover, tbody .benchmark-value:nth-child(6):hover) tbody .benchmark-value:nth-child(6),
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table:has(.benchmark-model:nth-child(7):hover, tbody .benchmark-value:nth-child(7):hover) .benchmark-model:nth-child(7),
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table:has(.benchmark-model:nth-child(7):hover, tbody .benchmark-value:nth-child(7):hover) tbody .benchmark-value:nth-child(7),
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table:has(.benchmark-model:nth-child(8):hover, tbody .benchmark-value:nth-child(8):hover) .benchmark-model:nth-child(8),
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table:has(.benchmark-model:nth-child(8):hover, tbody .benchmark-value:nth-child(8):hover) tbody .benchmark-value:nth-child(8),
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table:has(.benchmark-model:nth-child(9):hover, tbody .benchmark-value:nth-child(9):hover) .benchmark-model:nth-child(9),
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table:has(.benchmark-model:nth-child(9):hover, tbody .benchmark-value:nth-child(9):hover) tbody .benchmark-value:nth-child(9),
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table:has(.benchmark-model:nth-child(10):hover, tbody .benchmark-value:nth-child(10):hover) .benchmark-model:nth-child(10),
#main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-results-table:has(.benchmark-model:nth-child(10):hover, tbody .benchmark-value:nth-child(10):hover) tbody .benchmark-value:nth-child(10) {
  background-color: color-mix(in srgb, var(--benchmark-cell-bg, var(--bg)) 97%, var(--fg4) 3%);
}

@media (max-width: 1279px) {
  #main.post article.content .inkling-eval-table[data-inkling-eval-table] {
    margin-left: 0;
    margin-right: 0;
    overflow-x: auto;
    transform: none;
    width: 100%;
  }

  #main.post article.content .inkling-eval-table[data-inkling-eval-table] td.benchmark-name {
    padding-left: 0.5rem;
  }

  #main.post article.content .inkling-eval-table[data-inkling-eval-table] td.benchmark-name::before,
  #main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-heading-spacer::before,
  #main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-category-label::before {
    left: 0;
  }

  #main.post article.content .inkling-eval-table[data-inkling-eval-table] .benchmark-category-label {
    background-color: var(--benchmark-category-bg);
    background-image: none;
    padding-left: 0.5rem;
  }
}

/* On a phone, a content-width table with more than two columns cannot fit:
   at 390px the three safety columns fell to 73px, too narrow for a header like
   "Nemotron 3", so it clipped the text and overflowed anyway. Below the mobile
   breakpoint, give those tables the same treatment as the wide ones — the
   standard min-width, so they scroll with comfortable 6rem columns instead of
   squeezing. Scoped to three or more model columns — the header row is a
   spacer cell plus one <th> per model, so a 4th child means 3+ models. The
   two-model comparison is excluded: it fits at 390px, and forcing a scrollbar
   there would regress the published Inkling post. */
@media (max-width: 640px) {
  #main.post article.content .inkling-eval-table[data-inkling-eval-table].inkling-eval-table--content table:has(.benchmark-model-header-row > :nth-child(4)) {
    min-width: calc(var(--benchmark-name-column-width, 10.5rem) + var(--benchmark-model-count, 9) * 6rem);
  }
}

/* The two-model comparison reuses the full eval-table component but fits
   within the article column instead of reserving the wide nine-model canvas. */
#main.post article.content .inkling-eval-table[data-inkling-eval-table].inkling-eval-table--content {
  margin-left: 0;
  margin-right: 0;
  transform: none;
  width: 100%;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table].inkling-eval-table--content table {
  min-width: 0;
  width: 100%;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table].inkling-eval-table--content .benchmark-model-name,
#main.post article.content .inkling-eval-sticky-header--content .benchmark-model-name {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 2.7em;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table].inkling-eval-table--content td.benchmark-name,
#main.post article.content .inkling-eval-table[data-inkling-eval-table].inkling-eval-table--content .benchmark-category-label {
  padding-left: 0.5rem;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table].inkling-eval-table--content :is(.benchmark-model, .benchmark-value, .benchmark-category-cell),
#main.post article.content .inkling-eval-sticky-header--content .benchmark-model {
  border-left: 1px solid var(--benchmark-rule-color);
}

/* Align the compact comparison's visible rules and labels with the article
   measure; the wide table keeps its inset gutter for horizontal scrolling. */
#main.post article.content .inkling-eval-table[data-inkling-eval-table].inkling-eval-table--content .benchmark-category-label {
  background-color: var(--benchmark-category-bg);
  background-image: none;
}

#main.post article.content .inkling-eval-table[data-inkling-eval-table].inkling-eval-table--content td.benchmark-name::before,
#main.post article.content .inkling-eval-table[data-inkling-eval-table].inkling-eval-table--content .benchmark-heading-spacer::before,
#main.post article.content .inkling-eval-table[data-inkling-eval-table].inkling-eval-table--content .benchmark-category-label::before {
  left: 0;
}
