/* ============================================================
   contrast-kit.css - shared UI for the contrast and accessibility
   tools ONLY (contrast-checker, contrast-ratio-checker,
   contrast-grid, palette-accessibility-matrix,
   palette-accessibility-audit, focus-indicator-checker,
   legibility-analyzer). One family look: verdict badges, ratio
   hero, criteria table, tier cells, fix chips, APCA panel.
   Pairs with assets/js/contrast-kit.js. Plain source file,
   deployed as-is (no .min copy).
   ============================================================ */

/* ---------- Verdict badges ---------- */
.ck-badges { display: flex; flex-wrap: wrap; gap: .5rem; }
.ck-badge {
  display: inline-flex; align-items: center; gap: .375rem;
  padding: .3rem .75rem;
  border-radius: 999px;
  font-size: .8125rem; font-weight: 700; line-height: 1.25;
  white-space: nowrap;
}
.ck-badge--pass { background: #d1fae5; color: #065f46; }
.ck-badge--fail { background: #fee2e2; color: #991b1b; }
.ck-badge--warn { background: #fef3c7; color: #92400e; }
.ck-badge--info { background: #e0e7ff; color: #3730a3; }
.ck-badge--sm { padding: .125rem .5rem; font-size: .6875rem; gap: .25rem; }

/* ---------- Ratio hero ---------- */
.ck-hero {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .75rem 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid #e5e7eb; border-radius: 12px;
  background: #f9fafb; color: #111827;
  transition: background-color .2s ease, border-color .2s ease;
}
.ck-hero--aaa { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.ck-hero--aa { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.ck-hero--large { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.ck-hero--fail { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.ck-hero__ratio {
  margin: 0;
  font-size: clamp(2.25rem, 8vw, 3.25rem); font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.ck-hero__ratio small { font-size: .45em; font-weight: 700; letter-spacing: 0; }
.ck-hero__body { flex: 1 1 14rem; min-width: 0; }
.ck-hero__verdict { margin: 0 0 .5rem; font-weight: 600; font-size: .9375rem; line-height: 1.45; }
.ck-hero__sample {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  width: 5.5rem; height: 4rem; border-radius: 10px;
  font-size: 1.75rem; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, .1);
}
.ck-meter { height: .5rem; margin-top: .6rem; border-radius: 999px; background: rgba(17, 24, 39, .08); overflow: hidden; }
.ck-meter__fill { height: 100%; border-radius: inherit; background: currentColor; transition: width .25s ease; }

/* ---------- Criteria table ---------- */
.ck-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 1rem; }
.ck-table { width: 100%; border-collapse: collapse; font-size: .875rem; background: #fff; }
.ck-table th, .ck-table td { padding: .6rem .75rem; border-bottom: 1px solid #eef0f3; text-align: left; vertical-align: middle; }
.ck-table thead th {
  background: #f9fafb; color: #4b5563;
  font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  white-space: nowrap;
}
.ck-table td small { display: block; color: #6b7280; font-size: .75rem; line-height: 1.4; }
.ck-table .ck-num { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: nowrap; }

/* ---------- Tier cells (grids, matrices, audits) ---------- */
.ck-tier--aaa { background: #065f46; color: #ecfdf5; }
.ck-tier--aa { background: #d1fae5; color: #065f46; }
.ck-tier--large { background: #fef3c7; color: #92400e; }
.ck-tier--fail { background: #fee2e2; color: #991b1b; }
.ck-tier--same { background: #f3f4f6; color: #6b7280; }
.ck-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin: 0 0 .75rem; padding: 0; list-style: none; font-size: .8125rem; color: #374151; }
.ck-legend li { display: inline-flex; align-items: center; gap: .4rem; }
.ck-legend__dot { width: .875rem; height: .875rem; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgba(17, 24, 39, .15); }

.ck-matrix-wrap {
  overflow: auto; max-height: 75vh;
  border: 1px solid #e5e7eb; border-radius: 10px;
  -webkit-overflow-scrolling: touch;
  background: #fff;
}
.ck-matrix { border-collapse: separate; border-spacing: 0; font-size: .8125rem; margin: 0 auto 0 0; }
.ck-matrix th, .ck-matrix td { padding: 0; text-align: center; vertical-align: middle; border-right: 2px solid #fff; border-bottom: 2px solid #fff; }
.ck-matrix thead th { position: sticky; top: 0; z-index: 2; background: #f9fafb; }
.ck-matrix tbody th { position: sticky; left: 0; z-index: 1; background: #f9fafb; }
.ck-matrix thead th:first-child { left: 0; z-index: 3; }
.ck-matrix__corner { padding: .4rem .5rem; font-size: .6875rem; font-weight: 700; color: #6b7280; line-height: 1.3; text-align: left; min-width: 5rem; }
.ck-head { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .4rem .35rem; min-width: 4.5rem; }
.ck-head__swatch {
  width: 2rem; height: 2rem; padding: 0;
  border: 0; border-radius: 6px; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, .18);
}
.ck-head__swatch:focus-visible { outline: 2px solid #4f46e5; outline-offset: 2px; }
.ck-head__label { max-width: 6rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .6875rem; font-weight: 600; color: #374151; }
.ck-head__hex { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .6875rem; color: #6b7280; }
.ck-cell {
  min-width: 4.5rem; height: 3.75rem; padding: .25rem;
  cursor: pointer; font-weight: 700;
  transition: box-shadow .12s ease, opacity .15s ease;
}
.ck-cell:hover { box-shadow: inset 0 0 0 3px rgba(79, 70, 229, .55); }
.ck-cell:focus-visible { outline: 3px solid #4f46e5; outline-offset: -3px; }
.ck-cell.is-selected { box-shadow: inset 0 0 0 3px #4f46e5; }
.ck-cell.is-dim { opacity: .18; }
.ck-cell__ratio { display: block; font-size: .875rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.ck-cell__tag { display: block; font-size: .625rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; opacity: .9; }
.ck-cell__sample { display: block; font-size: 1.125rem; line-height: 1.1; }

/* ---------- Fix suggestions ---------- */
.ck-fixes { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .75rem; }
.ck-fix {
  display: flex; align-items: center; gap: .75rem;
  width: 100%; min-height: 44px;
  padding: .55rem .75rem;
  border: 1px solid #e5e7eb; border-radius: 10px;
  background: #fff; color: #111827;
  font: inherit; text-align: left; cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.ck-fix:hover { border-color: #6366f1; box-shadow: 0 3px 10px rgba(99, 102, 241, .15); transform: translateY(-1px); }
.ck-fix:focus-visible { outline: 2px solid #4f46e5; outline-offset: 2px; }
.ck-fix__pair {
  flex: none;
  display: flex; align-items: center; justify-content: center;
  width: 3.25rem; height: 2.75rem; border-radius: 8px;
  font-weight: 700; font-size: 1rem;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, .1);
}
.ck-fix__meta { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.ck-fix__meta strong { font-size: .8125rem; line-height: 1.35; }
.ck-fix__meta code { padding: 0; background: none; color: inherit; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8125rem; }
.ck-fix__meta small { font-size: .75rem; color: #4b5563; line-height: 1.35; }
.ck-empty { display: flex; align-items: center; gap: .6rem; padding: .85rem 1rem; border-radius: 10px; font-size: .875rem; font-weight: 600; background: #f9fafb; color: #4b5563; }
.ck-empty--pass { background: #ecfdf5; color: #065f46; }

/* ---------- APCA panel ---------- */
.ck-apca {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .5rem 1rem;
  margin-top: 1rem; padding: .85rem 1rem;
  border: 1px solid #e2e8f0; border-radius: 10px;
  background: #f8fafc;
}
.ck-apca__value { font-size: 1.6rem; font-weight: 800; color: #0f172a; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ck-apca__meta { flex: 1 1 14rem; min-width: 0; }
.ck-apca__meta strong { display: block; font-size: .875rem; color: #0f172a; }
.ck-apca__meta span { display: block; font-size: .8125rem; color: #475569; line-height: 1.45; }
.ck-draft {
  display: inline-block; margin-left: .35rem; padding: .05rem .4rem;
  border-radius: 4px; background: #fef3c7; color: #92400e;
  font-size: .6875rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; vertical-align: 1px;
}

/* ---------- Notes, presets, sidebar bits ---------- */
.ck-note { margin: .75rem 0 0; font-size: .8125rem; line-height: 1.55; color: #4b5563; }
.ck-note code { font-size: .8em; }
.ck-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .4rem; }
.ck-preset {
  display: flex; align-items: center; justify-content: flex-start; gap: .45rem;
  min-height: 2.5rem; padding: .3rem .5rem;
  border: 1px solid #e5e7eb; border-radius: 8px;
  background: #fff; color: #1f2937;
  font: inherit; font-size: .75rem; font-weight: 600; line-height: 1.2; text-align: left;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.ck-preset__sw {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.9rem; height: 1.6rem; border-radius: 5px;
  font-size: .75rem; font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, .14);
}
.ck-preset:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(17, 24, 39, .15); }
.ck-preset:focus-visible { outline: 2px solid #4f46e5; outline-offset: 2px; }
.ck-swap { width: 100%; margin: .25rem 0 1rem; }
.ck-bulk { margin-top: .75rem; }
.ck-bulk summary { cursor: pointer; font-size: .875rem; font-weight: 600; color: #4338ca; padding: .4rem 0; min-height: 2rem; }
.ck-bulk summary:focus-visible { outline: 2px solid #4f46e5; outline-offset: 2px; border-radius: 4px; }
.ck-bulk textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8125rem; min-height: 7rem; }
.ck-bulk .button { margin-top: .5rem; }
.ck-help { margin: .35rem 0 0; font-size: .75rem; color: #6b7280; line-height: 1.45; }
.ck-toggle { display: flex; align-items: center; gap: .5rem; min-height: 2rem; font-size: .875rem; color: #374151; cursor: pointer; }
.ck-toggle input { width: 1.05rem; height: 1.05rem; accent-color: #4f46e5; flex: none; }
.sidebar .seg-tabs, .tool-container .seg-tabs.is-fullwidth { width: 100%; }

@media (max-width: 768px) {
  .ck-bulk textarea { font-size: 16px; }
  .ck-hero { padding: .85rem 1rem; }
}
@media (pointer: coarse) {
  .ck-head__swatch { width: 2.75rem; height: 2.75rem; }
  .ck-preset { min-height: 44px; }
  .ck-toggle { min-height: 44px; }
  .ck-bulk summary { min-height: 44px; display: flex; align-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  .ck-hero, .ck-meter__fill, .ck-cell, .ck-fix, .ck-preset { transition: none; }
  .ck-fix:hover, .ck-preset:hover { transform: none; }
}
