/* Color Contrast Checker — a colours card (foreground and background rows,
   each a hex field beside the shared colour well, the swap in the actions
   tray), a result card (the ratio as a hero with its grade tag, the three
   WCAG groups as a row grid) and the live preview as a flush card (layout
   from styles/components/form.css). Only the hex field, the tags and marks
   and the preview samples are the page's own. */

.cc-pick { flex: 0 1 auto; }

/* input.<class>: the shared form rule input[type="…"] in common.css is
   (0,1,1) and would beat a bare class. */
input.cc-hex {
  flex: 0 1 160px;
  min-width: 0;
  font-family: var(--mono);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.cc-swap { gap: var(--space-2); }

/* The ratio is the hero value and a borderless copy button. */
button.cc-ratio {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  font-family: var(--mono);
  letter-spacing: -0.02em;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color var(--duration-snap) var(--ease-standard);
}
button.cc-ratio:hover { color: var(--accent); }
button.cc-ratio:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
button.cc-ratio.is-done { color: var(--success); }

.cc-tag {
  align-self: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}
.cc-tag[data-grade="aaa"]  { color: var(--success); background: var(--success-soft); }
.cc-tag[data-grade="aa"]   { color: var(--accent);  background: var(--accent-soft); }
.cc-tag[data-grade="aa-l"] { color: var(--warning); background: var(--warning-soft); }
.cc-tag[data-grade="fail"] { color: var(--danger);  background: var(--danger-soft); }

/* One WCAG group per grid cell: the name, then a line per criterion. */
.cc-grade { --gap: var(--space-1); }
.cc-grade__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}
.cc-grade small { color: var(--text-muted); font-weight: 400; }
.cc-grade__line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--row-gap);
  font-size: 12.5px;
  color: var(--text);
}
.cc-mark {
  font-weight: 700;
  font-size: 12px;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg-fill-2);
  color: var(--text-muted);
}
.cc-mark[data-pass="true"]  { color: var(--success); background: var(--success-soft); }
.cc-mark[data-pass="false"] { color: var(--danger);  background: var(--danger-soft); }

/* Live preview — the two colours fill the card. */
.cc-preview {
  --gap: var(--space-5);
  padding: var(--space-6);
  background: var(--cc-bg, #F2F2F7);
  color: var(--cc-fg, #1A1A1F);
  transition: background var(--duration-snap) var(--ease-standard),
              color var(--duration-snap) var(--ease-standard),
              opacity var(--duration-snap) var(--ease-standard);
}
/* Invalid hex: dim the preview so it matches the "invalid" readout instead
   of rendering the last valid colours. */
.cc-preview[data-invalid] { opacity: 0.4; }

.cc-preview__label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.65;
  margin-block-end: var(--space-2);
}
.cc-preview__sample p { margin: 0; }
.cc-ui { --gap: var(--space-2); }
.cc-preview__sample--normal p { font-size: 15px; line-height: 1.55; }
.cc-preview__sample--large p  { font-size: 26px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }

.cc-preview__btn {
  background: var(--cc-fg, #1A1A1F);
  color: var(--cc-bg, #F2F2F7);
  border: none;
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.cc-preview__pill {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border: 1.5px solid currentColor;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
}

@media (max-width: 560px) {
  .cc-preview { padding: var(--space-4); }
}
