/* Etude — the Compare page: a row of Macs to pick from, one table. Etude is
   picked out in the site's green throughout. */

/* Writing / Reading: a segmented pair above the Macs */
.cmp-metrics {
  display: inline-flex;
  gap: 2px;
  margin-top: clamp(32px, 6vh, 52px);
  padding: 3px;
  border-radius: 999px;
  background: var(--glass-fill);
  border: 1px solid var(--glass-rim);
}
.cmp-metric {
  padding: 7px 18px;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.cmp-metric:hover { color: var(--ink); }
.cmp-metric[aria-pressed="true"] { color: var(--ink); background: var(--card); box-shadow: 0 1px 3px rgba(11, 11, 13, 0.12); }
.cmp-metric:focus-visible { outline: 2px solid rgb(var(--net)); outline-offset: 2px; }
.cmp-metrics:empty { display: none; }

.cmp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.cmp-tabs[hidden] { display: none; }
.cmp-tab {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.cmp-tab:hover { color: var(--ink); border-color: var(--glass-rim-hover); }
.cmp-tab[aria-selected="true"] {
  color: var(--ink);
  background: var(--glass-fill);
  border-color: var(--glass-rim);
  box-shadow: var(--glass-lip);
}
.cmp-tab:focus-visible { outline: 2px solid rgb(var(--net)); outline-offset: 2px; }
.cmp-chip { font-weight: 600; }
.cmp-mem { font-size: 13px; color: var(--ink-3); }

/* the table, on a card, as on the Models page */
.cmp-card {
  margin-top: 16px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--card-shadow);
  overflow-x: auto;
}
.cmp-card table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.4;
}
.cmp-card th,
.cmp-card td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}
.cmp-card th:first-child { padding-left: 24px; }
.cmp-card th:last-child,
.cmp-card td:last-child { padding-right: 24px; }
.cmp-card tbody tr:last-child th,
.cmp-card tbody tr:last-child td { border-bottom: 0; }
.cmp-card thead th {
  padding-top: 14px;
  padding-bottom: 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}
.cmp-card thead th.is-etude { color: rgb(var(--priv)); }
.cmp-num { text-align: right; }
.cmp-card thead .cmp-num { text-align: right; }

/* the model, its maker under it */
.cmp-card tbody th { font-weight: 500; white-space: nowrap; }
.cmp-model { display: block; color: var(--ink); }
.cmp-maker { display: block; margin-top: 1px; font-size: 12.5px; font-weight: 400; color: var(--ink-3); }
.cmp-tag { color: rgb(var(--priv)); font-weight: 500; }

/* a sub-row: the same model with speculative decoding, tucked under it. No
   rule between the two; a corner line from the model's name leads into it. */
.cmp-card tbody tr.has-sub th,
.cmp-card tbody tr.has-sub td { border-bottom: 0; padding-bottom: 6px; }
.cmp-card tbody tr.cmp-sub th,
.cmp-card tbody tr.cmp-sub td { padding-top: 6px; }
.cmp-card tbody tr.cmp-sub th { position: relative; padding-left: 46px; font-weight: 400; }
.cmp-card tbody tr.cmp-sub th::before {
  content: "";
  position: absolute;
  left: 30px;
  top: -2px;
  width: 9px;
  height: calc(50% + 1px);
  border-left: 1.5px solid var(--line);
  border-bottom: 1.5px solid var(--line);
  border-bottom-left-radius: 5px;
}
.cmp-variant { font-size: 13.5px; color: var(--ink-2); white-space: nowrap; }

/* a speed: the number, and a bar against the fastest in its row */
.cmp-speed { width: 17%; }
.cmp-v {
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.cmp-speed.is-best .cmp-v { font-weight: 700; color: var(--ink); }
.cmp-bar {
  display: block;
  height: 4px;
  margin-top: 6px;
  border-radius: 2px;
  background: var(--glass-fill);
  overflow: hidden;
}
.cmp-bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--ink-3);
  opacity: 0.55;
}
.cmp-speed.is-etude .cmp-bar i { background: rgb(var(--priv)); opacity: 1; }

/* no number: why */
.cmp-na { color: var(--ink-3); }
.cmp-dash { color: var(--ink-3); }
.cmp-nofit {
  display: inline-block;
  width: 14px;
  height: 14px;
  vertical-align: -2px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-3);
  background: linear-gradient(45deg, transparent calc(50% - 0.75px), var(--ink-3) calc(50% - 0.75px), var(--ink-3) calc(50% + 0.75px), transparent calc(50% + 0.75px));
  opacity: 0.8;
}

/* Etude's lead over the fastest other engine */
.cmp-lead { width: 1%; text-align: right; white-space: nowrap; }
.cmp-pill {
  display: inline-block;
  min-width: 56px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.cmp-pill.is-ahead  { color: rgb(var(--priv)); background: rgba(var(--priv), 0.12); }
.cmp-pill.is-even   { color: var(--ink-2); background: var(--glass-fill); font-weight: 500; }
.cmp-pill.is-behind { color: var(--ink-2); background: var(--glass-fill); }

.cmp-legend {
  max-width: 76ch;
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-3);
}
.cmp-legend .cmp-nofit { margin: 0 2px 0 6px; }
.cmp-legend .cmp-dash { margin: 0 2px 0 6px; }
.cmp-legend + .cmp-legend { margin-top: 4px; }
.cmp-empty { padding: 28px 24px; color: var(--ink-2); }

/* A phone: each model is a block, its lead beside its name, then a line per
   engine (name, bar, number). */
@media (max-width: 640px) {
  .cmp-card table { min-width: 0; }
  .cmp-card thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .cmp-card tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
  }
  .cmp-card tbody tr:last-child { border-bottom: 0; }
  .cmp-card th,
  .cmp-card td { padding: 0; border: 0; }
  .cmp-card th:first-child { padding-left: 0; }
  .cmp-card th:last-child, .cmp-card td:last-child { padding-right: 0; }
  .cmp-card tbody th { grid-column: 1; grid-row: 1; white-space: normal; }
  .cmp-lead { grid-column: 2; grid-row: 1; align-self: start; width: auto; }
  .cmp-speed, .cmp-na {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    width: auto;
    margin-top: 8px;
  }
  .cmp-speed::before, .cmp-na::before {
    content: attr(data-label);
    flex: none;
    width: 118px;   /* "Etude Engine (Pie)" on one line */
    font-size: 13px;
    color: var(--ink-3);
  }
  .cmp-speed.is-etude::before { color: rgb(var(--priv)); font-weight: 500; }
  .cmp-blank { display: none; }
  /* the sub-row's block sits close under its model's */
  .cmp-card tbody tr.has-sub { border-bottom: 0; padding-bottom: 6px; }
  .cmp-card tbody tr.cmp-sub { padding-top: 4px; }
  .cmp-card tbody tr.cmp-sub th { padding-left: 18px; }
  .cmp-variant { white-space: normal; }
  .cmp-card tbody tr.cmp-sub th::before { left: 2px; top: -3px; height: 12px; }
  .cmp-bar { flex: 1; order: 1; margin-top: 0; }
  .cmp-v { order: 2; min-width: 40px; text-align: right; }
}

/* the line naming Etude's engine, under the lede */
.cmp-engine { margin-top: 12px; font-size: 16px; line-height: 1.5; color: var(--ink-2); }
.cmp-engine a { color: var(--ink); text-underline-offset: 3px; }
.cmp-engine a:hover { color: rgb(var(--priv)); }
