/* === Colour vision check (mount version) ===
   Reuses the global .etest*, .pill, .fchip, .result-msg and .result-eye rules from pages.css and
   style.css. This file frames the tool inside the dark tool panel, keeps reading sizes at 16px or
   more, lays out the start screen, the plate + number pad, and the result, and forces the plates
   onto a white card whatever the site theme. */

.tl-colour { width: 100%; min-width: 0; }
.tl-colour [hidden] { display: none !important; }
.tl-colour .etest { width: 100%; }
.panel.dark .tl-colour .etest { background: rgb(255 255 255 / 0.04); border: 1px solid rgb(255 255 255 / 0.16); }

/* Step bar: markers are display only */
.tl-colour .etest-bar { flex-wrap: wrap; row-gap: 10px; font-size: clamp(16px, 0.95vw, 18px); color: rgb(255 255 255 / 0.82); }
.tl-colour .etest-step { cursor: default; }

/* Screens size to their content (no tall empty band above the buttons) */
.tl-colour .etest-screen { min-height: 0; gap: clamp(18px, 1.5vw, 30px); }
.tl-colour .etest-screen h2 { max-width: 32em; text-wrap: balance; }
.tl-colour .etest-screen h2:focus { outline: none; }
.tl-colour .etest-screen h2:focus-visible { outline: 2px solid #fff; outline-offset: 4px; border-radius: 4px; }
.tl-colour .etest-screen h3 { font-weight: 500; }
.tl-colour .etest-screen p, .tl-colour .etest-screen li { font-size: clamp(16px, 1.08vw, 21px); line-height: 1.5; }
.tl-colour .etest-screen ul { gap: 0.6em; }
.tl-colour .etest-note { display: flex; align-items: flex-start; gap: 12px; font-size: clamp(16px, 1vw, 19px); line-height: 1.5; color: rgb(255 255 255 / 0.88); }
.tl-colour .etest-note svg { flex: none; margin-top: 2px; color: #fde68a; }
.tl-colour .etest-hint { font-size: clamp(16px, 1.05vw, 20px); line-height: 1.5; color: rgb(255 255 255 / 0.85); }
.tl-colour .etest-disclaimer { max-width: 64em; font-size: clamp(16px, 0.95vw, 18px); line-height: 1.55; color: rgb(255 255 255 / 0.74); }
.tl-colour .etest-actions { align-items: center; margin-top: 0; padding-top: 0; gap: 12px 14px; }
.tl-colour .etest .pill { font-size: clamp(16px, 1.1vw, 22px); }
.tl-colour .etest .pill:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.tl-colour .pill:disabled { cursor: not-allowed; opacity: 0.45; }
.tl-colour label.check { align-items: start; font-size: clamp(16px, 1.05vw, 20px); color: rgb(255 255 255 / 0.92); cursor: pointer; }
.tl-colour .check input { accent-color: var(--soft); }
.tl-colour-lead { max-width: 40em; color: rgb(255 255 255 / 0.9) !important; font-size: clamp(17px, 1.2vw, 23px) !important; }
.tl-colour-link { color: #fff; font-size: clamp(16px, 1.05vw, 20px); text-decoration: underline; text-underline-offset: 3px; }
.tl-colour-link:hover { color: var(--pale); }
.tl-colour-link:focus-visible { outline: 2px solid #fff; outline-offset: 3px; border-radius: 4px; }

/* --- Start: copy beside a decorative plate --- */
.tl-colour-split { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr); gap: clamp(24px, 3vw, 64px); align-items: center; width: 100%; }
.tl-colour-main { display: flex; flex-direction: column; align-items: flex-start; gap: clamp(16px, 1.3vw, 26px); min-width: 0; }
.tl-colour-facts { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 0.8vw, 16px) !important; width: 100%; }
.tl-colour-facts li { display: flex; flex-direction: column; gap: 6px; padding: clamp(14px, 1.2vw, 22px) !important; border: 1px solid rgb(255 255 255 / 0.16); border-radius: calc(var(--r) * 0.6); background: rgb(255 255 255 / 0.06); }
.tl-colour-facts li::before { display: none; }
.tl-colour-facts b { display: flex; align-items: center; min-height: 1.1em; color: #fff; font-size: clamp(26px, 2.2vw, 42px); font-weight: 500; line-height: 1.05; letter-spacing: -0.02em; }
.tl-colour-facts b svg { width: clamp(28px, 2.2vw, 40px); height: auto; color: var(--soft); }
.tl-colour-facts span { color: rgb(255 255 255 / 0.8); font-size: clamp(16px, 0.98vw, 19px); line-height: 1.35; }
.tl-colour-aside { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 0; }
.tl-colour-aside figcaption { color: rgb(255 255 255 / 0.8); font-size: clamp(16px, 1vw, 19px); text-align: center; }

/* Plates always sit on white, whatever the site theme or colour mode */
.tl-colour-platecard { display: grid; place-items: center; width: 100%; aspect-ratio: 1; padding: clamp(10px, 1.4vw, 26px); border-radius: var(--r); background: #fff; forced-color-adjust: none; box-shadow: 0 24px 60px -30px rgb(0 0 0 / 0.55); }
.tl-colour-platecard.is-deco { max-width: 400px; }
.tl-colour-platecard canvas { display: block; max-width: 100%; border-radius: 50%; }
.tl-colour-plate.is-in { animation: tl-colour-in 0.28s var(--ease) both; }
@keyframes tl-colour-in { from { opacity: 0; } to { opacity: 1; } }

/* --- Safety --- */
.tl-colour-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(12px, 1vw, 20px); width: 100%; }
.tl-colour-box { position: relative; padding: clamp(20px, 1.8vw, 34px); padding-left: clamp(64px, 4.8vw, 92px); border: 1px solid rgb(255 255 255 / 0.16); border-radius: calc(var(--r) * 0.7); background: rgb(255 255 255 / 0.06); }
.tl-colour-tag { position: absolute; left: clamp(18px, 1.5vw, 30px); top: clamp(18px, 1.6vw, 32px); display: grid; place-items: center; width: clamp(32px, 2.2vw, 42px); height: clamp(32px, 2.2vw, 42px); border-radius: 50%; background: var(--soft); color: var(--navy); font-size: clamp(16px, 1.05vw, 20px); font-weight: 500; }
.tl-colour-ask { display: flex; flex-direction: column; gap: 12px; width: 100%; padding: clamp(16px, 1.4vw, 26px) clamp(18px, 1.6vw, 30px); border-radius: calc(var(--r) * 0.7); background: rgb(255 255 255 / 0.06); }
.tl-colour-ask p { color: #fff !important; font-weight: 500; }
.tl-colour-ask small { margin-left: 6px; padding: 3px 10px; border-radius: 999px; background: rgb(255 255 255 / 0.12); color: rgb(255 255 255 / 0.85); font-size: 16px; font-weight: 400; white-space: nowrap; }
.tl-colour-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.tl-colour .fchip { height: auto; min-height: 46px; padding: 8px 20px; font-size: clamp(16px, 1vw, 19px); }
.tl-colour .fchip:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.panel.dark .tl-colour .fchip:hover { border-color: #fff; color: #fff; }
.panel.dark .tl-colour .fchip[aria-pressed="true"]:hover { color: var(--navy); }

/* --- Screen check strip --- */
.tl-colour-strip { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: clamp(6px, 0.6vw, 12px); width: 100%; padding: clamp(10px, 1vw, 18px); border-radius: calc(var(--r) * 0.7); background: #fff; forced-color-adjust: none; }
.tl-colour-strip span { height: clamp(56px, 5.2vw, 96px); border-radius: 10px; }
.tl-colour-strip span:first-child { box-shadow: inset 0 0 0 1px #d4d4d4; }

/* --- Viewing cards --- */
.tl-colour-cards { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 1vw, 20px) !important; width: 100%; }
.tl-colour-cards li { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: clamp(18px, 1.6vw, 30px) !important; border: 1px solid rgb(255 255 255 / 0.16); border-radius: calc(var(--r) * 0.7); background: rgb(255 255 255 / 0.06); }
.tl-colour-cards li::before { display: none; }
.tl-colour-cards b { color: #fff; font-size: clamp(17px, 1.2vw, 23px); font-weight: 500; line-height: 1.3; }
.tl-colour-ico { display: grid; place-items: center; width: clamp(56px, 4vw, 72px); height: clamp(56px, 4vw, 72px); border-radius: 50%; background: rgb(255 255 255 / 0.1); color: var(--soft); }

/* --- Plate + number pad --- */
.tl-colour-test { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr); gap: clamp(24px, 3vw, 64px); align-items: center; width: 100%; }
.tl-colour-stage { display: flex; justify-content: center; min-width: 0; }
.tl-colour-stage .tl-colour-platecard { max-width: 600px; }
.tl-colour-answer { display: flex; flex-direction: column; gap: clamp(14px, 1.2vw, 22px); min-width: 0; max-width: 460px; }
.tl-colour-qhead { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.tl-colour-display { display: flex; align-items: center; gap: 10px; }
.tl-colour-digit { display: grid; place-items: center; width: clamp(60px, 4.4vw, 80px); height: clamp(70px, 5vw, 92px); border: 2px dashed rgb(255 255 255 / 0.35); border-radius: 16px; color: #fff; font-size: clamp(36px, 2.8vw, 52px); font-weight: 500; line-height: 1; }
.tl-colour-digit.is-on { border-style: solid; border-color: #fff; background: rgb(255 255 255 / 0.08); }
.tl-colour-pad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tl-colour-key { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: clamp(58px, 4.2vw, 76px); padding: 0 8px; border: 1px solid rgb(255 255 255 / 0.32); border-radius: 16px; background: rgb(255 255 255 / 0.07); color: #fff; font-size: clamp(24px, 1.8vw, 32px); font-weight: 500; transition: background-color 0.2s, border-color 0.2s, transform 0.15s; }
.tl-colour-key:hover:not(:disabled) { border-color: #fff; background: rgb(255 255 255 / 0.16); }
.tl-colour-key:active:not(:disabled) { transform: scale(0.96); }
.tl-colour-key.is-fn { color: var(--pale); }
.tl-colour-key.is-ok { border-color: #fff; background: #fff; color: var(--navy); font-size: clamp(17px, 1.15vw, 21px); }
.tl-colour-key.is-ok:hover:not(:disabled) { background: var(--pale); border-color: var(--pale); }
.tl-colour-key:disabled { cursor: not-allowed; opacity: 0.4; }
.tl-colour-key:focus-visible, .tl-colour-none:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.tl-colour-none { min-height: 56px; padding: 12px 18px; border: 1px solid rgb(255 255 255 / 0.5); border-radius: 999px; background: transparent; color: #fff; font-size: clamp(16px, 1.08vw, 20px); font-weight: 500; transition: background-color 0.2s, color 0.2s; }
.tl-colour-none:hover { background: #fff; color: var(--navy); }
.tl-colour-keys { color: rgb(255 255 255 / 0.68) !important; font-size: 16px !important; }

/* --- Result --- */
.tl-colour-result { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(12px, 1.2vw, 24px); align-items: stretch; width: 100%; }
.tl-colour .result-msg { display: flex; flex-direction: column; justify-content: center; gap: 0.8em; width: 100%; }
.tl-colour .result-msg p { max-width: 60em; color: #fff; }
.tl-colour .result-msg.is-flag { border-color: var(--soft); box-shadow: inset 4px 0 0 var(--soft); }
.tl-colour-scores { display: grid; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: clamp(12px, 1.2vw, 24px); }
.tl-colour .result-eye { display: flex; flex-direction: column; justify-content: center; }
.tl-colour .result-eye h3 { color: var(--gray-700); font-size: clamp(16px, 0.95vw, 18px); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.tl-colour .result-eye .big { margin: 0.35em 0 0; color: var(--blue); font-size: clamp(40px, 3.8vw, 76px); line-height: 1; letter-spacing: -0.02em; }
.tl-colour.is-d .tl-colour-result { grid-template-columns: 1fr; }
.tl-colour.is-d .tl-colour-scores { display: none; }
.tl-colour-meta { color: rgb(255 255 255 / 0.72) !important; font-size: 16px !important; }

/* --- Tablet and phone --- */
@media (max-width: 991.98px) {
  .tl-colour .etest-bar { padding: 16px 5vw; }
  .tl-colour .etest-screen { gap: 20px; padding: 28px 5vw 32px; }
  .tl-colour-split { grid-template-columns: 1fr; gap: 26px; }
  .tl-colour-aside { order: -1; }
  .tl-colour-platecard.is-deco { max-width: 260px; }
  .tl-colour-test { grid-template-columns: 1fr; gap: 22px; justify-items: center; }
  .tl-colour-stage { width: 100%; }
  .tl-colour-stage .tl-colour-platecard { max-width: 520px; }
  .tl-colour-answer { width: 100%; max-width: 520px; }
  .tl-colour-result { grid-template-columns: 1fr; }
  .tl-colour-scores { grid-template-rows: none; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tl-colour .result-msg { padding: 20px; }
  .tl-colour .result-eye { padding: 18px; border-radius: 20px; }
  .tl-colour .result-eye .big { font-size: clamp(36px, 9vw, 56px); }
  .tl-colour .etest-note { padding: 16px; }
}
@media (max-width: 767.98px) {
  /* Reclaim the panel's side padding so the plate and keys get the width */
  .panel.dark .tl-colour { width: auto; margin-inline: calc(var(--pad) * -1 + 4px); }
  .tl-colour .etest { border-radius: 24px; }
  .tl-colour .etest-bar { padding: 14px 16px; }
  .tl-colour .etest-screen { padding: 24px 16px 28px; }
  .tl-colour-facts { grid-template-columns: 1fr; }
  .tl-colour-facts li { flex-direction: row; align-items: center; gap: 14px; padding: 12px 16px !important; }
  .tl-colour-facts b { flex: none; min-width: 3.3em; font-size: 26px; }
  .tl-colour-grid2 { grid-template-columns: 1fr; }
  .tl-colour-box { padding: 18px 18px 18px 62px; border-radius: 20px; }
  .tl-colour-tag { left: 16px; top: 17px; }
  .tl-colour-ask { padding: 16px; border-radius: 20px; }
  .tl-colour-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); border-radius: 18px; }
  .tl-colour-strip span { height: 48px; }
  .tl-colour-cards { grid-template-columns: 1fr; }
  .tl-colour-cards li { flex-direction: row; align-items: center; padding: 14px 16px !important; border-radius: 18px; }
  .tl-colour-ico { width: 52px; height: 52px; flex: none; }
  .tl-colour-ico svg { width: 36px; height: 36px; }
  .tl-colour-platecard { padding: 10px; border-radius: 22px; }
  .tl-colour-digit { width: 58px; height: 66px; font-size: 34px; }
  .tl-colour-key { height: 58px; font-size: 24px; }
  .tl-colour-key.is-ok { font-size: 17px; }
  .tl-colour .result-msg { padding: 18px 16px; }
}
@media (max-width: 400px) {
  .tl-colour-scores { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .tl-colour-plate.is-in { animation: none; }
  .tl-colour-key, .tl-colour-none { transition: none; }
}
@media print {
  .tool-panel:has(.tl-colour) { margin: 0; padding: 0; background: none !important; color: #000; }
  .tl-colour .etest { border: 0; background: #fff !important; color: #000; }
  .tl-colour .etest-bar, .tl-colour .etest-actions, .tl-colour-link { display: none !important; }
  .tl-colour .etest-screen h2, .tl-colour .etest-screen h3, .tl-colour .etest-screen p, .tl-colour .etest-screen li, .tl-colour .result-msg p { color: #000 !important; }
  .tl-colour .result-msg { border: 1px solid #999; background: #fff !important; box-shadow: none; }
  .tl-colour .result-eye { border: 1px solid #999; }
}
