/* CLIP ViT-Large/14 — token-only styles (zero raw hex, zero --ok/--err, >=44px controls). */

[hidden] {
  display: none !important;
}

button,
.button,
.model-loader button,
select,
input[type="range"],
input[type="checkbox"],
summary,
.ladder-nav a,
.crumbs a,
footer a,
.clp-upload-zone,
.clp-pill,
.clp-sample-btn,
.clp-cat-pill,
.clp-perturb-btn {
  min-block-size: 44px;
  min-inline-size: 44px;
}

.crumbs a,
footer a,
.model-loader summary,
.inside-table a,
.img-credit a,
details.show-code .sc-meta a,
#ref-list a {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  min-inline-size: 44px;
}

@media (max-width: 640px) {
  .ladder-nav {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .ladder-nav a {
    flex: 1 1 auto;
    white-space: normal;
  }
}

.clp-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 0.55rem;
}

.clp-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--color);
}

.clp-badge-accent {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-raised));
  color: var(--accent);
  font-weight: 600;
}

.clp-badge-good {
  border-color: color-mix(in srgb, var(--good) 48%, var(--border));
  background: color-mix(in srgb, var(--good) 12%, var(--bg-raised));
  color: var(--good);
  font-weight: 600;
}

.clp-badge-warn {
  border-color: color-mix(in srgb, var(--warn) 48%, var(--border));
  background: color-mix(in srgb, var(--warn) 12%, var(--bg-raised));
  color: var(--warn);
  font-weight: 600;
}

.clp-upload-zone {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.85rem 1rem;
  margin: 0.7rem 0;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--color);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.clp-upload-zone > * {
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

.clp-upload-zone:hover,
.clp-upload-zone.is-drag {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-raised));
}

.clp-upload-zone:focus-within,
.clp-upload-zone:has(input:focus-visible) {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.clp-upload-zone:has(:disabled) {
  opacity: 0.52;
  cursor: not-allowed;
  pointer-events: none;
}

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

.sample-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 7rem), 1fr));
  gap: 0.55rem;
  margin: 0.65rem 0 0.4rem;
}

.clp-sample-btn {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
  padding: 0.35rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--color);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 500;
  text-align: start;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.clp-sample-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.clp-sample-btn[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 26%, transparent);
}

.clp-sample-btn img {
  inline-size: 100%;
  block-size: 4.2rem;
  object-fit: cover;
  border-radius: 5px;
  display: block;
}

.clp-sample-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clp-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 1rem;
  align-items: start;
}

.clp-col {
  min-inline-size: 0;
}

.clp-stage-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  padding: 0.55rem;
  margin-top: 0.55rem;
}

.clp-stage-wrap img,
.clp-stage-wrap canvas,
.clp-stage-wrap video {
  display: block;
  inline-size: auto;
  max-inline-size: 100%;
  block-size: auto;
  max-block-size: 54vh;
  margin-inline: auto;
  border-radius: 6px;
}

.clp-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.8rem;
  align-items: flex-end;
  margin: 0.65rem 0;
}

.clp-toolbar > :not(button, .button) {
  min-inline-size: 0;
}

.clp-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-inline-size: 0;
  flex: 1 1 12rem;
}

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

.clp-field textarea,
.clp-field input[type="text"],
.clp-field input[type="search"],
.clp-field select {
  inline-size: 100%;
  min-inline-size: 0;
  min-block-size: 44px;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--color);
  font: inherit;
}

.clp-field textarea {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.45;
  resize: vertical;
}

.clp-check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-block-size: 44px;
  padding: 0.25rem 0.5rem;
  font-size: 0.86rem;
  cursor: pointer;
}

.clp-check-label input[type="checkbox"] {
  appearance: none;
  flex: none;
  box-sizing: border-box;
  inline-size: 44px;
  block-size: 44px;
  min-inline-size: 44px;
  min-block-size: 44px;
  padding: 10px;
  margin: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.clp-check-label input[type="checkbox"]::before {
  content: "";
  inline-size: 24px;
  block-size: 24px;
  border-radius: 6px;
  border: 2px solid var(--border-strong);
  background: var(--bg-raised);
  box-sizing: border-box;
}

.clp-check-label input[type="checkbox"]:checked::before {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 4px var(--accent-ink);
}

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

.clp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.5rem 0;
}

.clp-pill,
.clp-cat-pill,
.clp-perturb-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  color: var(--color);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.clp-pill:hover,
.clp-cat-pill:hover,
.clp-perturb-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.clp-pill[aria-pressed="true"],
.clp-cat-pill[aria-pressed="true"],
.clp-perturb-btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.clp-bars {
  display: grid;
  gap: 0.48rem;
  margin: 0.7rem 0;
}

.clp-bar-row {
  display: grid;
  gap: 0.25rem;
  padding: 0.42rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}

.clp-bar-row.is-top {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-raised));
}

.clp-bar-head {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.86rem;
}

.clp-bar-label {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.clp-bar-row.is-top .clp-bar-label {
  font-weight: 700;
}

.clp-bar-pct {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  flex: none;
}

.clp-bar-track {
  block-size: 0.55rem;
  border-radius: 999px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  overflow: hidden;
}

.clp-bar-fill {
  block-size: 100%;
  border-radius: 999px;
  background: var(--accent);
}

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

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

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

.clp-metric strong {
  display: block;
  margin-top: 0.14rem;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.clp-table-wrap {
  overflow-x: auto;
  max-inline-size: 100%;
  margin-top: 0.65rem;
}

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

.clp-table caption {
  text-align: start;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

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

.clp-table th {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.clp-mono {
  font-family: var(--font-mono);
}

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

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

.clp-warn {
  color: var(--warn);
  font-weight: 600;
}

.clp-note {
  border-inline-start: 4px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-raised));
  padding: 0.7rem 0.9rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.88rem;
  margin: 0.7rem 0;
}

.clp-album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14.5rem), 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.clp-album-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 260px;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  box-shadow: var(--shadow-sm);
  min-inline-size: 0;
}

.clp-album-card img {
  inline-size: 100%;
  block-size: 8.5rem;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.clp-album-card h3 {
  margin: 0;
  font-size: 0.94rem;
  overflow-wrap: anywhere;
}

.clp-tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-raised));
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
}

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

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

.clp-stage-card h3 {
  margin: 0 0 0.35rem;
  font-size: 0.96rem;
}

.clp-cam-box {
  margin-top: 0.65rem;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}

.clp-cam-box video {
  display: block;
  inline-size: auto;
  max-inline-size: 100%;
  max-block-size: 46vh;
  border-radius: 6px;
  margin-inline: auto;
  background: var(--bg-raised);
}

.clp-matrix-cell-hi {
  background: color-mix(in srgb, var(--accent) 16%, var(--bg-raised));
  font-weight: 700;
}

.clp-matrix-cell-mid {
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-raised));
}

pre {
  max-inline-size: 100%;
  overflow-x: auto;
}
