/* The free tools: one quiet card on the site's own tokens, and the home page's call to action.
   Loaded after article.css, which supplies the page, the type and the colors. */

:root { --measure: 1080px; }
.prose { max-width: 720px; }

/* trust line under the title */
.trust { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 4px 0 30px; padding: 0; list-style: none; font-size: 13.5px; color: var(--dim); }
.trust li { display: inline-flex; align-items: center; gap: 7px; margin: 0; }
.trust svg { width: 14px; height: 14px; color: #4ade80; flex: 0 0 auto; }

/* the top line: what it is on the left, the call to action on the right, both above the fold */
.topline { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px 24px; margin: 6px 0 30px; }
.topline .trust { margin: 0; }
.btn-cta.sm { height: 46px; padding-inline: 22px; font-size: 15px; }
.tbtn .ic { width: 16px; height: 16px; }
.stagebar .tbtn svg { width: 16px; height: 16px; }

/* the card */
.tcard { border: 1px solid var(--line-2); border-radius: 22px; background: var(--surface); overflow: hidden; margin: 0 0 64px; }
.tgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.tcol { padding: 26px; min-width: 0; }
.tcol + .tcol { border-left: 1px solid var(--line); }
.tlabel { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 30px; margin: 0 0 16px; font-size: 11.5px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--dim); }

/* buttons: small and quiet inside the card */
.tbtn { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--text); font: 600 13.5px var(--font); cursor: pointer; text-decoration: none; transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease); }
.tbtn:hover { background: var(--surface-3); color: #fff; }
.tbtn.solid { background: #fff; color: #0a0a0a; border-color: #fff; }
.tbtn.solid:hover { background: #e9e9e9; color: #0a0a0a; }
.tbtn svg { width: 15px; height: 15px; }
.tbtn:focus-visible, .seg button:focus-visible, .ibtn:focus-visible, .prow:focus-visible, .strip button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ibtn { appearance: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); cursor: pointer; transition: background .2s var(--ease), color .2s var(--ease); }
.ibtn:hover { background: var(--surface-3); color: #fff; }
.ibtn svg { width: 16px; height: 16px; }

/* segmented control */
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line); gap: 2px; flex-wrap: wrap; }
.seg button { appearance: none; border: 0; background: transparent; color: var(--muted); font: 600 12.5px var(--font); letter-spacing: 0; text-transform: none; padding: 6px 12px; border-radius: 999px; cursor: pointer; transition: background .2s var(--ease), color .2s var(--ease); }
.seg button:hover { color: #fff; }
.seg button[aria-pressed="true"] { background: #fff; color: #0a0a0a; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; z-index: 60; background: #fff; color: #0a0a0a; font: 600 14px var(--font); padding: 10px 18px; border-radius: 999px; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); transition: opacity .25s var(--ease), transform .25s var(--ease); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── palette tool ───────────────────────────────────────── */
.stage { position: relative; border-radius: 14px; overflow: hidden; background: var(--surface-3); border: 1px solid var(--line); }
.stage canvas { display: block; width: 100%; height: auto; cursor: crosshair; }
.stage .over { position: absolute; inset: 0; display: none; place-items: center; background: rgba(10, 10, 10, .78); font-weight: 600; color: #fff; border: 2px dashed var(--accent); border-radius: 14px; }
.stage.is-over .over { display: grid; }
.stagebar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0 0; }
.stagebar .note { flex: 1 1 100%; font-size: 13px; color: var(--dim); }
.picked { display: none; align-items: center; gap: 12px; margin: 14px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 14px; color: var(--muted); }
.picked.on { display: flex; }
.picked i { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line-2); flex: 0 0 auto; }
.picked b { color: #fff; font: 500 14px var(--mono); }
.strip { display: flex; height: 46px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-2); margin: 0 0 14px; }
.strip button { appearance: none; border: 0; padding: 0; min-width: 6px; cursor: pointer; transition: flex-grow .3s var(--ease); }
.plist { list-style: none; margin: 0 0 22px; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.plist li { margin: 0; border-top: 1px solid var(--line); }
.plist li:first-child { border-top: 0; }
.prow { appearance: none; width: 100%; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto 44px 20px; align-items: center; gap: 12px; padding: 9px 14px 9px 10px; border: 0; background: transparent; color: var(--text); text-align: left; font: inherit; cursor: pointer; transition: background .15s var(--ease); }
.prow:hover { background: var(--surface-2); }
.prow .pchip { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line-2); }
.prow .pname { font-weight: 600; font-size: 14.5px; color: #fff; line-height: 1.25; }
.prow .pname small { display: block; font: 500 12.5px var(--mono); color: var(--dim); margin-top: 1px; }
.prow .phex { font: 500 13.5px var(--mono); color: var(--muted); }
.prow .pshare { font: 500 13px var(--mono); color: var(--dim); text-align: right; }
.prow .pc { color: var(--dim); display: grid; place-items: center; }
.prow .pc svg { width: 15px; height: 15px; }
.prow:hover .pc { color: #fff; }
.codebox { position: relative; }
.codebox pre { margin: 0; max-height: 250px; border-radius: 14px; background: #0c0c0c; padding: 18px 20px; }
.codebox code { font-size: 13.5px; }

/* ── contrast tool ──────────────────────────────────────── */
.ctr-preview { display: flex; flex-direction: column; justify-content: center; gap: 14px; min-height: 480px; padding: 36px; transition: background-color .15s linear, color .15s linear; }
.ctr-preview .aa { font: 700 clamp(72px, 12vw, 120px)/1 var(--font); letter-spacing: -0.05em; margin: 0; }
.ctr-preview h2 { margin: 0; font-size: 26px; letter-spacing: -0.02em; font-weight: 700; }
.ctr-preview p { margin: 0; font-size: 16px; line-height: 1.6; max-width: 46ch; }
.ctr-preview .demo { display: flex; align-items: center; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
.ctr-preview .demo span.btnlike { display: inline-block; padding: 11px 20px; border-radius: 999px; border: 2px solid currentColor; font-weight: 650; font-size: 15px; }
.ctr-preview .demo u { font-weight: 600; font-size: 15px; text-underline-offset: 3px; }
.fields { display: grid; grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr); gap: 8px; align-items: end; margin: 0 0 24px; }
.field span { display: block; font-size: 11.5px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--dim); margin: 0 0 8px; }
.field .pair { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 10px 0 8px; background: var(--surface-3); border: 1px solid var(--line-2); border-radius: 12px; }
.field .pair:focus-within { border-color: var(--accent); }
.field input[type="color"] { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: none; cursor: pointer; flex: 0 0 auto; }
.field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.field input[type="color"]::-webkit-color-swatch { border: 1px solid var(--line-2); border-radius: 8px; }
.field input[type="text"] { width: 100%; min-width: 0; background: none; border: 0; outline: 0; color: #fff; font: 500 15.5px var(--mono); text-transform: uppercase; }
.field input[aria-invalid="true"] { color: #f87171; }
.swapbtn { height: 46px; }
.score { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 0 0 6px; }
.score .num { font: 650 clamp(46px, 6vw, 60px)/1 var(--font); letter-spacing: -0.04em; color: #fff; font-variant-numeric: tabular-nums; }
.badge { font: 650 12.5px var(--font); letter-spacing: .04em; padding: 5px 11px; border-radius: 999px; }
.badge.ok { color: #4ade80; background: rgba(74, 222, 128, .14); }
.badge.mid { color: #facc15; background: rgba(250, 204, 21, .14); }
.badge.no { color: #f87171; background: rgba(248, 113, 113, .14); }
.verdict { color: var(--muted); font-size: 15.5px; margin: 0 0 20px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 8px; padding: 0; list-style: none; }
.checks li { margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 550; color: #fff; }
.checks small { display: block; font-weight: 400; font-size: 12.5px; color: var(--dim); margin-top: 1px; }
.checks .wide { grid-column: 1 / -1; }
.pill { flex: 0 0 auto; font: 650 12px var(--font); letter-spacing: .04em; padding: 4px 10px; border-radius: 999px; }
.pill.ok { color: #4ade80; background: rgba(74, 222, 128, .14); }
.pill.no { color: #f87171; background: rgba(248, 113, 113, .14); }
.suggest { margin: 16px 0 0; display: grid; gap: 8px; }
.suggest[hidden] { display: none; }
.sg { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: 12px; font-size: 14px; color: var(--muted); }
.sg i { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line-2); flex: 0 0 auto; }
.sg b { color: #fff; font: 500 14px var(--mono); }
.sg .tbtn { margin-left: auto; height: 32px; padding: 0 14px; }
.shareline { margin: 18px 0 0; display: flex; gap: 10px; flex-wrap: wrap; }

/* ── the home page's call to action ─────────────────────── */
.closing { position: relative; text-align: center; padding: 72px 0 8px; margin: 8px 0 24px; isolation: isolate; }
.closing::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: radial-gradient(rgba(255, 255, 255, .22) 1px, transparent 1.5px);
  background-size: 18px 18px;
  -webkit-mask-image: radial-gradient(ellipse 50% 60% at 50% 50%, #000 10%, transparent 70%);
  mask-image: radial-gradient(ellipse 50% 60% at 50% 50%, #000 10%, transparent 70%);
}
.closing h2 { margin: 0 auto 14px; max-width: 18ch; font-size: clamp(32px, 5vw, 48px); line-height: 1.08; letter-spacing: -0.035em; font-weight: 700; text-wrap: balance; }
.closing .lead { margin: 0 auto 28px; max-width: 52ch; color: var(--muted); font-size: 17.5px; }
.closing .go { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.btn-cta {
  --mx: 50%; --my: 50%; --tx: 0px; --ty: 0px;
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 54px; padding-inline: 28px; border-radius: 999px; border: 1px solid transparent;
  background: #fff; color: #000; text-decoration: none;
  font: 500 16px var(--font); letter-spacing: -0.005em; white-space: nowrap;
  transition: transform .4s var(--ease), background-color .25s ease;
}
.btn-cta svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-cta::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .3s ease; background: radial-gradient(110px circle at var(--mx) var(--my), rgba(0, 0, 0, .13), transparent 70%); }
.btn-cta::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(110deg, transparent 30%, rgba(0, 0, 0, .12) 50%, transparent 70%); transform: translateX(-120%); transition: transform .7s var(--ease); }
.btn-cta:hover { color: #000; background: #fff; transform: translate(var(--tx), calc(var(--ty) - 2px)) scale(1.035); }
.btn-cta:hover::before { opacity: 1; }
.btn-cta:hover::after { transform: translateX(120%); }
.btn-cta:active { transform: translate(var(--tx), var(--ty)) scale(.97); transition-duration: .12s; }
.btn-cta:hover svg { animation: chrome-spin .85s cubic-bezier(.34, 1.35, .5, 1); }
.btn-cta.ghost { background: rgba(255, 255, 255, .04); border-color: var(--line-2); color: var(--text); }
.btn-cta.ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.btn-cta.ghost::after, .btn-cta.ghost::before { display: none; }
@keyframes chrome-spin { from { transform: rotate(0) scale(1); } 45% { transform: rotate(200deg) scale(1.18); } to { transform: rotate(360deg) scale(1); } }
.closing .note { margin: 22px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; font-size: 13px; color: var(--dim); }
.closing .note li { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.closing .note svg { width: 14px; height: 14px; }


/* the tool pages have their own structure: no section rail or contents box */
.rail, .toc { display: none !important; }
.imgcol { display: flex; flex-direction: column; }
/* the frame hugs the picture: its size is set from the image in tool-palette.js */
.imgcol .stage { flex: 0 0 auto; align-self: center; width: fit-content; max-width: 100%; }
.imgcol .stage canvas { width: 100%; height: auto; }
.imgcol .stage canvas.zoomed { image-rendering: pixelated; }
.tfoot { border-top: 1px solid var(--line); padding: 22px 26px 26px; }
.tfoot .tlabel { justify-content: flex-start; flex-wrap: wrap; gap: 14px; }
.tfoot .tlabel .tbtn { margin-left: auto; }
.tfoot .codebox pre { max-height: 230px; }
.ctr-preview .h { margin: 0; font-size: 26px; letter-spacing: -0.02em; font-weight: 700; line-height: 1.2; }
.pair { display: flex; align-items: center; gap: 8px; }

@media (max-width: 860px) {
  .tgrid { grid-template-columns: minmax(0, 1fr); }
  .tcol + .tcol { border-left: 0; border-top: 1px solid var(--line); }
  .ctr-preview { min-height: 300px; padding: 28px; }
}
@media (max-width: 520px) {
  .tcol { padding: 18px; }
  .checks { grid-template-columns: 1fr; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .swapbtn { width: 100%; }
  .prow { grid-template-columns: 34px minmax(0, 1fr) auto 18px; }
  .prow .phex { display: none; }
  .closing { padding-top: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn-cta, .btn-cta::after, .toast, .strip button { transition: none; }
  .btn-cta:hover { transform: none; }
  .btn-cta:hover svg { animation: none; }
}

/* the title row: heading on the left, the call to action beside it */
.pagehead { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; }
.pagehead h1 { margin: 12px 0 16px; }
.pagehead .btn-cta { flex: 0 0 auto; }

/* the intro line sits straight on the card */
article > .standfirst { margin-bottom: 28px; }

/* a quieter title: the tool is the page, not the heading */
article > h1, .pagehead h1 { font-size: clamp(26px, 3.4vw, 34px); letter-spacing: -0.028em; margin-top: 8px; margin-bottom: 12px; }

/* room between the breadcrumb and the title */
.pagehead { margin-top: 20px; }
article > h1 { margin-top: 28px; }

/* the call to action sits on the breadcrumb row, on the right */
.crumbbar { max-width: var(--measure); margin: 24px auto 0; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 20px; }
.crumbbar .crumbs { margin: 0; padding: 0; max-width: none; min-width: 0; }
.crumbbar .btn-cta { flex: 0 0 auto; height: 38px; padding-inline: 18px; font-size: 14px; gap: 8px; }
.crumbbar .btn-cta svg { width: 16px; height: 16px; }
@media (max-width: 680px) { .crumbbar { padding: 0 20px; } }
