/* Shared page-local styles for intfloat/multilingual-e5-large (public/styles.css tokens ONLY). */

button,
.button,
.model-loader button,
select,
input[type="text"],
input[type="search"],
input[type="number"],
input[type="range"],
summary,
.ladder-nav a {
  min-block-size: 44px;
  min-inline-size: 44px;
}

.model-loader summary {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  min-inline-size: 44px;
}

.crumbs a,
footer.byline a,
.inside-table a,
details.show-code a,
details.show-code .sc-meta a,
.e5-table a,
.e5-refs a,
section ul a {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  min-inline-size: 44px;
  padding: 0 0.25rem;
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  inline-size: 44px;
  block-size: 44px;
  min-inline-size: 44px;
  min-block-size: 44px;
  flex: none;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  margin: 0;
  border: 0;
  background: transparent;
}

input[type="checkbox"]::before {
  content: "";
  grid-area: 1 / 1;
  inline-size: 1.25rem;
  block-size: 1.25rem;
  border-radius: 5px;
  border: 2px solid var(--border-strong);
  background: var(--bg-raised);
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

input[type="checkbox"]:checked::before {
  border-color: var(--accent);
  background: var(--accent);
}

input[type="checkbox"]:checked::after {
  content: "✓";
  grid-area: 1 / 1;
  color: var(--accent-ink);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
}

input[type="checkbox"]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.e5-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.e5-callout {
  padding: 0.75rem 0.95rem;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--border));
  border-inline-start: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-raised));
  font-size: 0.88rem;
  margin: 0.75rem 0 0;
}

.e5-callout.is-good {
  border-color: color-mix(in srgb, var(--good) 45%, var(--border));
  border-inline-start-color: var(--good);
  background: color-mix(in srgb, var(--good) 7%, var(--bg-raised));
}

.e5-callout.is-bad {
  border-color: color-mix(in srgb, var(--bad) 45%, var(--border));
  border-inline-start-color: var(--bad);
  background: color-mix(in srgb, var(--bad) 7%, var(--bg-raised));
}

.e5-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.65rem 0;
}

.e5-chip {
  min-block-size: 44px;
  min-inline-size: 44px;
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--color);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  text-align: start;
}

.e5-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.e5-chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.e5-chip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.e5-field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin: 0.6rem 0;
  min-inline-size: 0;
}

.e5-field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.e5-field input[type="text"],
.e5-field textarea,
.e5-field select {
  inline-size: 100%;
}

.e5-field textarea {
  min-block-size: 7.5rem;
  resize: vertical;
  line-height: 1.5;
}

.e5-prefix-preview {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
  margin: 0.15rem 0 0;
  overflow-wrap: anywhere;
}

.e5-dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  padding: 0.75rem 0.9rem;
  margin: 0.65rem 0;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.e5-dropzone.is-dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-raised));
}

.e5-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
  align-items: center;
  margin: 0.7rem 0;
}

.e5-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-block-size: 44px;
  padding: 0.1rem 0.75rem 0.1rem 0.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}

.e5-upload-label {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: 44px;
  min-inline-size: 44px;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--color);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.e5-upload-label input[type="file"] {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  min-block-size: 44px;
  min-inline-size: 44px;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

.e5-upload-label:focus-within,
.e5-upload-label:has(input:focus-visible) {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.e5-upload-label.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.e5-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.2rem), 1fr));
  gap: 0.55rem;
  margin: 0.8rem 0;
}

.e5-metric {
  padding: 0.6rem 0.72rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  min-inline-size: 0;
}

.e5-metric span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--muted);
}

.e5-metric b {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.96rem;
  color: var(--color);
  overflow-wrap: anywhere;
}

.e5-metric b.is-good {
  color: var(--good);
}

.e5-metric b.is-bad {
  color: var(--bad);
}

.e5-results {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.65rem 0 0;
  padding: 0;
  list-style: none;
}

.e5-result {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  padding: 0.65rem 0.8rem;
}

.e5-result.is-top {
  border-color: color-mix(in srgb, var(--good) 55%, var(--border));
  background: color-mix(in srgb, var(--good) 8%, var(--bg-raised));
}

.e5-result-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.4rem;
  align-items: baseline;
}

.e5-bar-track {
  block-size: 0.44rem;
  border-radius: 999px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  overflow: hidden;
  margin: 0.38rem 0;
}

.e5-bar-fill {
  block-size: 100%;
  background: var(--accent);
}

.e5-result.is-top .e5-bar-fill {
  background: var(--good);
}

.e5-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 285px), 1fr));
  gap: 0.9rem;
  margin-top: 0.85rem;
  align-items: start;
}

.stage-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 0.9rem;
  margin: 0.7rem 0 0.9rem;
}

.e5-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  padding: 0.85rem 0.95rem;
  min-inline-size: 0;
}

.e5-card.is-win {
  border-color: color-mix(in srgb, var(--good) 55%, var(--border));
  background: color-mix(in srgb, var(--good) 6%, var(--bg-raised));
}

.e5-card h3 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
}

.e5-loader-label {
  margin: 0 0 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  color: var(--muted);
}

.e5-canvas {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
}

.e5-canvas[tabindex="0"] {
  cursor: crosshair;
}

.e5-canvas[tabindex="0"]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.e5-table-wrap {
  overflow-x: auto;
  max-inline-size: 100%;
}

.e5-table {
  inline-size: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.e5-table th,
.e5-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.48rem 0.55rem;
  text-align: start;
  vertical-align: top;
}

.e5-table th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--muted);
}

.e5-table td.num {
  font-family: var(--font-mono);
  white-space: nowrap;
}

.e5-pos {
  color: var(--good);
  font-weight: 600;
}

.e5-neg {
  color: var(--bad);
  font-weight: 600;
}

.e5-mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.e5-dim-pills,
.e5-sp-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.e5-dim-pill,
.e5-sp-chip {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  padding: 0.22rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--color);
}

.e5-sp-chip.is-special {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent);
}

.e5-sp-chip.is-unk {
  border-color: color-mix(in srgb, var(--bad) 50%, var(--border));
  color: var(--bad);
}

.e5-queue {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-block-size: 16rem;
  overflow-y: auto;
  margin: 0.6rem 0;
  padding: 0;
  list-style: none;
}

.e5-queue-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  padding: 0.25rem 0.65rem 0.25rem 0.2rem;
}

.e5-queue-text {
  min-inline-size: 0;
  flex: 1;
  font-size: 0.84rem;
}

.e5-progress-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: 0.6rem 0;
}

.e5-progress-row progress {
  flex: 1;
  min-inline-size: 10rem;
  block-size: 0.7rem;
}

.e5-matrix-cell {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-align: center;
  border-radius: 4px;
}

@media (max-width: 600px) {
  .stage-cards,
  .e5-grid-2 {
    grid-template-columns: 1fr;
  }
}
