/*!
 * 123PhotoTool — Color Accessibility (color-accessibility.php).
 * The shared parts (the swatch, picking from a photo) are in pt-color.css;
 * this is the page's own layout.
 */

/* ── The pair ──────────────────────────────────────────────────────────── */
#ca-colors-field { position: relative; display: grid; gap: 10px; }
.ca-color-row { display: flex; gap: 10px; align-items: stretch; padding-inline-end: 50px; }
.ca-color .ca-swatch { flex: 0 0 56px; min-height: 48px; height: auto; }
.ca-color .pt-cswatch-edit { top: 50%; transform: translateY(-50%); inset-inline-end: auto; left: 50%; margin-left: -13px; }
.ca-code {
  flex: 1 1 auto;
  min-width: 0;
  height: 48px;
  border-radius: 10px;
  font: 0.8rem/1 var(--bs-font-monospace, ui-monospace, Menlo, Consolas, monospace);
  direction: ltr;
}
[dir="rtl"] .ca-code { text-align: right; }
.ca-code.is-invalid { border-color: #dc3545; color: #b02a37; }
.ca-hint { display: block; color: var(--pt-muted, #6c757d); font-size: 0.7rem; line-height: 1.35; }
/* Swap sits in its own column, halfway between the two rows. */
.ca-swap {
  position: absolute;
  top: 81px;
  inset-inline-end: 0;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 1px solid var(--pt-line, #e3e7ee);
  border-radius: 50%;
  background: #fff;
  color: var(--pt-ink, #343f52);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(30, 34, 40, 0.12);
}
.ca-swap:hover, .ca-swap:focus-visible { color: var(--pt-accent, #0f70e6); border-color: var(--pt-accent, #0f70e6); }
.ca-swap svg { width: 20px; height: 20px; }

/* ── Suggestions ───────────────────────────────────────────────────────── */
#ca-fix-field[hidden] { display: none; }
.ca-fixes { display: grid; gap: 8px; }
.ca-fix {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--pt-line, #e3e7ee);
  border-radius: 12px;
  background: #fff;
  color: var(--pt-ink, #343f52);
  text-align: start;
}
[dir="rtl"] .ca-fix { padding: 6px 6px 6px 12px; }
.ca-fix:hover, .ca-fix:focus-visible { border-color: var(--pt-accent, #0f70e6); box-shadow: 0 0 0 3px var(--pt-accent-soft, rgba(15, 112, 230, 0.15)); }
.ca-fix-sample {
  flex: none;
  width: 52px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.ca-fix-text { flex: 1 1 auto; min-width: 0; font-size: 0.7rem; line-height: 1.3; }
.ca-fix-text b { display: block; font: 600 0.75rem/1.3 var(--bs-font-monospace, ui-monospace, Menlo, Consolas, monospace); direction: ltr; text-align: start; }
[dir="rtl"] .ca-fix-text b { text-align: right; }
.ca-fix-ratio { flex: none; font: 600 0.7rem/1 var(--bs-font-monospace, ui-monospace, Menlo, Consolas, monospace); color: #198754; direction: ltr; }

/* ── Palettes ──────────────────────────────────────────────────────────── */
.ca-seg { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; border-radius: 10px; background: var(--pt-surface, #f6f8fb); border: 1px solid var(--pt-line, #e3e7ee); }
.ca-seg button {
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--pt-muted, #6c757d);
  font-size: 0.7rem;
  font-weight: 600;
}
.ca-seg button:hover { color: var(--pt-ink, #343f52); }
.ca-seg button.active { background: #fff; color: var(--pt-ink, #343f52); box-shadow: 0 1px 3px rgba(30, 34, 40, 0.15); }
.ca-seg button:focus-visible { outline: 3px solid var(--pt-accent, #0f70e6); outline-offset: 1px; }
.ca-seg-sm button { min-height: 32px; }
.ca-pal-head { margin-bottom: 8px; }
.ca-pal-for { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; color: var(--pt-muted, #6c757d); font-size: 0.7rem; }
.ca-pal { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.ca-pal[hidden] { display: none; }
.ca-pal-sw {
  min-width: 0;
  padding: 0 0 6px;
  border: 1px solid var(--pt-line, #e3e7ee);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.ca-pal-sw i { align-self: stretch; height: 36px; background: var(--c); }
.ca-pal-hex { font: 600 0.62rem/1.2 var(--bs-font-monospace, ui-monospace, Menlo, Consolas, monospace); color: var(--pt-ink, #343f52); direction: ltr; }
.ca-pal-ratio { font: 0.6rem/1.2 var(--bs-font-monospace, ui-monospace, Menlo, Consolas, monospace); color: var(--pt-muted, #6c757d); direction: ltr; }
.ca-pal-ratio.ca-pass { color: #198754; font-weight: 700; }
.ca-pal-sw:hover, .ca-pal-sw:focus-visible { border-color: var(--pt-accent, #0f70e6); }
.ca-pal-sw.active { border-color: var(--pt-accent, #0f70e6); box-shadow: 0 0 0 2px var(--pt-accent, #0f70e6); }

/* ── The workspace: preview (or the photo), the checks, the vision ─────── */
#ca-viewport { display: flex; flex-direction: column; overflow: hidden; }
.ca-main { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: stretch; justify-content: center; }
.ca-main[data-vision="protanopia"] { filter: url(#ca-f-protanopia); }
.ca-main[data-vision="deuteranopia"] { filter: url(#ca-f-deuteranopia); }
.ca-main[data-vision="tritanopia"] { filter: url(#ca-f-tritanopia); }
.ca-main[data-vision="achromatopsia"] { filter: url(#ca-f-achromatopsia); }
.ca-preview {
  flex: 1 1 auto;
  min-width: 0;
  margin: 12px 12px 0;
  padding: 22px 24px;
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
  transition: background-color 0.15s, color 0.15s;
}
.ca-preview p { margin: 0; color: inherit; }
.ca-p-large { font-size: 24px; font-weight: 700; line-height: 1.25; }
.ca-p-body { font-size: 16px; line-height: 1.5; }
.ca-p-small { font-size: 13px; line-height: 1.4; }
.ca-p-ui { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.ca-p-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 2px solid currentColor; border-radius: 10px; font-size: 14px; font-weight: 600; }
.ca-p-ui svg { width: 20px; height: 20px; flex: none; }
.ca-p-icon, .ca-p-check { display: inline-flex; }
.ca-p-check svg, .ca-p-icon svg { width: 26px; height: 26px; }

.ca-main.ca-photo-view > .ca-preview { display: none; }
.ca-main:not(.ca-photo-view) > .pt-pick-box, .ca-main:not(.ca-photo-view) > .pt-pick-loupe, .ca-main:not(.ca-photo-view) > .ca-targets { display: none !important; }
.ca-views {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  z-index: 6;
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(17, 19, 23, 0.72);
}
.ca-views[hidden], .ca-targets[hidden] { display: none; }
.ca-views button { border: 0; border-radius: 999px; min-height: 32px; padding: 0 12px; background: transparent; color: #fff; font-size: 0.75rem; font-weight: 600; }
.ca-views button[aria-pressed="true"] { background: #fff; color: var(--pt-ink, #343f52); }
.ca-has-photo .ca-main:not(.ca-photo-view) > .ca-preview { margin-top: 54px; }
.ca-targets {
  position: absolute;
  bottom: 12px;
  left: 50%;
  z-index: 6;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(17, 19, 23, 0.8);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.ca-targets button { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 6px; border: 0; border-radius: 999px; background: transparent; color: #fff; font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
[dir="rtl"] .ca-targets button { padding: 0 6px 0 14px; }
.ca-targets button i { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.85); background: var(--c, #000); }
.ca-targets button.active { background: #fff; color: var(--pt-ink, #343f52); }
.ca-targets button.active i { border-color: var(--pt-ink, #343f52); }

/* The checks: the ratio, then normal text, large text, graphics. */
.ca-results {
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 12px 0;
}
.ca-ratio, .ca-check {
  min-width: 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(30, 34, 40, 0.06);
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}
.ca-ratio b { font: 700 1.2rem/1 var(--bs-font-monospace, ui-monospace, Menlo, Consolas, monospace); color: var(--pt-ink, #343f52); direction: ltr; text-align: start; }
[dir="rtl"] .ca-ratio b { text-align: right; }
.ca-ratio small, .ca-check-name { font-size: 0.62rem; line-height: 1.2; color: var(--pt-muted, #6c757d); font-weight: 600; overflow-wrap: anywhere; -webkit-hyphens: auto; hyphens: auto; }
.ca-ratio .ca-seen { color: #7a5a00; }
.ca-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.ca-badge { display: inline-flex; align-items: center; gap: 3px; padding: 3px 7px 3px 5px; border-radius: 999px; font-size: 0.62rem; font-weight: 700; line-height: 1; background: #fde8ea; color: #b02a37; }
.ca-badge svg { width: 11px; height: 11px; }
.ca-badge .ca-yes { display: none; }
.ca-badge.ca-pass { background: #dff3e7; color: #146c43; }
.ca-badge.ca-pass .ca-yes { display: block; }
.ca-badge.ca-pass .ca-no { display: none; }

/* How the preview is seen: a row of chips. */
.ca-vision { flex: none; display: flex; gap: 6px; margin: 10px 12px 0; overflow-x: auto; scrollbar-width: none; }
.ca-vision::-webkit-scrollbar { display: none; }
.ca-vision button { flex: none; min-height: 36px; padding: 0 12px; border: 1px solid var(--pt-line, #e3e7ee); border-radius: 999px; background: #fff; color: var(--pt-ink, #343f52); font-size: 0.68rem; font-weight: 600; }
.ca-vision button.active { background: var(--pt-ink, #343f52); border-color: var(--pt-ink, #343f52); color: #fff; }
.ca-vision button:focus-visible { outline: 3px solid var(--pt-accent, #0f70e6); outline-offset: 1px; }

.ca-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 10px 12px 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(30, 34, 40, 0.06);
}
.ca-has-photo .ca-foot { display: none; }
.ca-has-photo .ca-vision { margin-bottom: 12px; }
.ca-foot .sample-thumbnails { display: flex; justify-content: center; gap: 8px; }
.ca-foot .sample-thumbnail { width: 52px; height: 52px; padding: 0; border: 2px solid #dee2e6; border-radius: 10px; overflow: hidden; background: #fff; cursor: pointer; }
.ca-foot .sample-thumbnail:hover { border-color: var(--pt-accent, #0f70e6); }
.ca-foot .sample-thumbnail img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 0 !important; }

/* ── Narrow columns and phones ─────────────────────────────────────────── */
@media (max-width: 1199.98px) {
  .ca-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
  #ca-viewport:not(.ca-has-photo):not(.pt-app-viewport) { height: auto !important; min-height: 0 !important; }
  #ca-viewport:not(.ca-has-photo):not(.pt-app-viewport) .ca-main { flex: none; }
  .ca-preview { margin: 10px 10px 0; padding: 16px 18px; }
  .ca-p-large { font-size: 22px; }
  .ca-results, .ca-vision { margin-left: 10px; margin-right: 10px; }
  .ca-foot { margin: 10px; }
  .ca-code { font-size: 16px; } /* no iOS zoom on focus */
}
/* On the phone page a photo is not a work surface (a tap opens the editor). */
html.pt-phone:not(.pt-app-open) #ca-views, html.pt-phone:not(.pt-app-open) #ca-remove-photo, html.pt-phone:not(.pt-app-open) #ca-targets { display: none !important; }

/* ── In the phone editor ───────────────────────────────────────────────── */
#pt-app #ca-views, #pt-app .ca-foot, #pt-app .ca-vision { display: none !important; }
#pt-app .ca-preview { margin: 6px 4px 0; box-shadow: none; }
#pt-app .ca-has-photo .ca-main:not(.ca-photo-view) > .ca-preview { margin-top: 6px; }
/* The ratio on a line of its own, the three checks below it: four columns
   left "Kontrastverhältnis" and "Bedienung" ~56px at 320 and split them
   mid-word. */
#pt-app .ca-results { margin: 8px 4px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
#pt-app .ca-ratio, #pt-app .ca-check { padding: 6px 8px; background: rgba(255, 255, 255, 0.96); }
#pt-app .ca-ratio { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: flex-start; column-gap: 10px; row-gap: 2px; padding-top: 5px; padding-bottom: 5px; }
#pt-app .ca-ratio b { font-size: 0.95rem; }
