/* ============ Promotion tools (feature graphic, icon, listing text, QR, checklist, video notes) ============
   Built on the site tokens (--bg-card, --bg-input, --border-color, --text-*, --primary, --success, --error),
   so the same markup reads correctly on the dark sites and the light one. Mobile first: one column below
   900px, no fixed widths, 44px minimum touch targets, visible keyboard focus. */

.pt-tool { --pt-gap: 16px; --pt-radius: 12px; }
.pt-tool *, .pt-tool *::before, .pt-tool *::after { box-sizing: border-box; }
.pt-tool .tool-card { padding: 16px; }

.pt-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--pt-gap); }
@media (min-width: 900px) {
    .pt-layout { grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); align-items: start; }
    .pt-preview-col { position: sticky; top: 84px; }
}
.pt-preview-col, .pt-controls-col { min-width: 0; display: flex; flex-direction: column; gap: 12px; }

.pt-group { border: 1px solid var(--border-color); border-radius: var(--pt-radius); background: var(--bg-input); padding: 14px; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.pt-group legend { padding: 0 6px; font-weight: 700; font-size: 15px; color: var(--text-primary); }

.pt-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pt-field label, .pt-label-row label { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.pt-field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.pt-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }

.pt-tool input[type="text"], .pt-tool input[type="url"], .pt-tool input[type="email"], .pt-tool input[type="number"],
.pt-tool select, .pt-tool textarea {
    width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; font-size: 16px; line-height: 1.4;
    color: var(--text-primary); background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 10px;
}
.pt-tool textarea { resize: vertical; min-height: 88px; }
.pt-tool input[type="color"] { width: 100%; min-height: 44px; padding: 4px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-card); cursor: pointer; }
.pt-tool input[type="file"] { width: 100%; min-height: 44px; padding: 8px; font-size: 14px; color: var(--text-secondary); background: var(--bg-card); border: 1px dashed var(--border-color); border-radius: 10px; }
.pt-tool input[type="range"] { width: 100%; min-height: 44px; accent-color: var(--primary); }
.pt-tool input[readonly] { color: var(--text-secondary); }

.pt-tool :is(input, select, textarea, button, a, summary, label.pt-file-btn):focus-visible,
.pt-tool .pt-file-btn:focus-within {
    outline: 3px solid var(--primary); outline-offset: 2px;
}

.pt-btn { min-height: 44px; width: 100%; justify-content: center; text-align: center; font-weight: 600; cursor: pointer; }
.pt-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pt-btn-inline { width: auto; flex: 0 0 auto; }
.pt-row { display: flex; gap: 10px; align-items: center; min-width: 0; }
.pt-row > input { flex: 1 1 auto; min-width: 0; }
.pt-row-wrap { flex-wrap: wrap; }
.pt-row-wrap .pt-btn { width: auto; flex: 1 1 160px; }
.pt-danger { color: var(--error) !important; border-color: var(--error) !important; }

.pt-hint { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-secondary); }
.pt-warn-text { color: var(--warning); }
.pt-subhead { font-size: 16px; margin: 8px 0 0; color: var(--text-primary); }
.pt-note { border: 1px solid var(--border-color); border-left: 4px solid var(--primary); background: var(--bg-input); border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.55; color: var(--text-primary); margin: 12px 15px 0; }
.pt-note ol { margin: 8px 0 0 18px; padding: 0; }
.pt-note li { margin: 4px 0; }
.pt-note code, .pt-hint code { font-size: 12.5px; word-break: break-all; }
.pt-video-export { padding: 12px 15px 0; flex-wrap: wrap; }
.pt-video-export .pt-btn { flex: 1 1 140px; width: auto; }
.collapsible-content > .pt-btn, .collapsible-content > .pt-hint { margin: 0 0 10px; }

.pt-switch, .pt-check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; color: var(--text-primary); cursor: pointer; }
.pt-switch input, .pt-check input { width: 22px; height: 22px; accent-color: var(--primary); flex: 0 0 auto; }

.pt-segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pt-segmented label { position: relative; display: flex; }
.pt-segmented input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.pt-segmented span { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; min-height: 44px; padding: 8px 10px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-card); font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.pt-segmented input:checked + span { border-color: var(--primary); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--primary); }
.pt-segmented input:focus-visible + span { outline: 3px solid var(--primary); outline-offset: 2px; }

.pt-details { border: 1px solid var(--border-color); border-radius: 10px; padding: 0 12px; }
.pt-details summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text-primary); }
.pt-details[open] { padding-bottom: 12px; }
.pt-details .pt-field { margin-top: 10px; }

/* findings (lint results) */
.pt-findings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pt-finding { position: relative; padding: 10px 12px 10px 38px; border-radius: 10px; font-size: 14px; line-height: 1.5; color: var(--text-primary); background: var(--bg-input); border: 1px solid var(--border-color); }
.pt-finding::before { position: absolute; left: 12px; top: 10px; font-weight: 800; }
.pt-finding.pt-error { border-color: var(--error); }
.pt-finding.pt-error::before { content: "✕"; color: var(--error); }
.pt-finding.pt-warn { border-color: var(--warning); }
.pt-finding.pt-warn::before { content: "!"; color: var(--warning); left: 16px; }
.pt-finding.pt-ok { border-color: var(--success); }
.pt-finding.pt-ok::before { content: "✓"; color: var(--success); }
.pt-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--border-color); color: var(--text-secondary); vertical-align: middle; }
.pt-badge.pt-ok { color: var(--success); border-color: var(--success); }
.pt-badge.pt-error { color: var(--error); border-color: var(--error); }

/* counters */
.pt-counter { font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 700; color: var(--text-secondary); }
.pt-counter.pt-near { color: var(--warning); }
.pt-counter.pt-over { color: var(--error); }
.pt-counter.pt-over::after { content: " over limit"; font-weight: 600; }

/* ---- feature graphic ---- */
.pt-banner-stage { position: relative; width: 100%; aspect-ratio: 1024 / 500; border-radius: 8px; overflow: hidden; background: var(--bg-input); border: 1px solid var(--border-color); }
.pt-banner-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#fgOverlay { touch-action: none; }
.pt-template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 520px) { .pt-template-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pt-template { display: flex; flex-direction: column; gap: 4px; padding: 4px; min-height: 44px; border: 2px solid transparent; border-radius: 10px; background: var(--bg-card); color: var(--text-secondary); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pt-template img { width: 100%; aspect-ratio: 1024 / 500; border-radius: 6px; display: block; }
.pt-template.active { border-color: var(--primary); color: var(--text-primary); }

/* ---- icon ---- */
.pt-dropzone { border: 2px dashed var(--border-color); border-radius: var(--pt-radius); padding: 14px; background: var(--bg-input); display: flex; flex-direction: column; gap: 10px; }
.pt-dropzone.dragover { border-color: var(--primary); }
.pt-drop-label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--text-secondary); }
.pt-drop-label strong { color: var(--text-primary); font-size: 15px; }
.pt-play-icon-row { display: grid; grid-template-columns: minmax(96px, 160px) minmax(0, 1fr); gap: 14px; align-items: center; }
.pt-play-icon { width: 100%; aspect-ratio: 1; border-radius: 20%; background: repeating-conic-gradient(rgba(127,127,127,0.25) 0% 25%, transparent 0% 50%) 50% / 16px 16px; border: 1px solid var(--border-color); }
.pt-play-icon-row .pt-btn { margin-top: 8px; }
.pt-mask-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.pt-mask-row figure { margin: 0; text-align: center; }
.pt-mask-row canvas { width: 100%; max-width: 120px; aspect-ratio: 1; display: block; margin: 0 auto 6px; }
.pt-mask-row figcaption { font-size: 12.5px; color: var(--text-secondary); line-height: 1.3; }
.pt-size-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 10px; }
.pt-size-item { margin: 0; padding: 10px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--bg-input); text-align: center; }
.pt-size-item img { width: 64px; height: 64px; object-fit: contain; display: block; margin: 0 auto 6px; }
.pt-size-item img.pt-checker { background: repeating-conic-gradient(rgba(127,127,127,0.3) 0% 25%, transparent 0% 50%) 50% / 10px 10px; }
.pt-size-item figcaption { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--text-secondary); }
.pt-size-item strong { color: var(--text-primary); font-size: 12.5px; word-break: break-word; }

/* ---- QR ---- */
.pt-qr-stage { background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--pt-radius); padding: 14px; display: flex; justify-content: center; }
#qrCanvas { width: 100%; max-width: 330px; height: auto; aspect-ratio: 1; image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
.pt-print-card { background: #ffffff; color: #111111; border: 1px solid #d4d4d8; border-radius: 16px; padding: 20px; max-width: 360px; width: 100%; margin: 0 auto; text-align: center; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.pt-print-head { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 12px; text-align: left; }
.pt-print-head img { width: 56px; height: 56px; border-radius: 22%; object-fit: cover; }
.pt-print-name { margin: 0; font-size: 20px; font-weight: 800; color: #111111; word-break: break-word; }
.pt-print-sub { margin: 2px 0 0; font-size: 14px; font-weight: 600; color: #3f3f46; }
.pt-print-qr svg { width: 100%; max-width: 260px; height: auto; display: block; margin: 0 auto; }
.pt-print-foot { margin: 12px 0 0; font-size: 12.5px; color: #3f3f46; }
@media print {
    body.pt-printing-card * { visibility: hidden !important; }
    body.pt-printing-card #qrPrintCard, body.pt-printing-card #qrPrintCard * { visibility: visible !important; }
    body.pt-printing-card #qrPrintCard { position: fixed; left: 50%; top: 18mm; transform: translateX(-50%); border: 1px solid #999; box-shadow: none; }
}

/* ---- checklist ---- */
.pt-cl-apps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border-color); }
@media (min-width: 760px) { .pt-cl-apps { grid-template-columns: repeat(3, minmax(0, 1fr)); } .pt-cl-app-actions { grid-column: 1 / -1; } }
.pt-cl-progress { padding: 16px 0; display: flex; flex-direction: column; gap: 8px; }
.pt-progress { height: 14px; border-radius: 999px; background: var(--bg-input); border: 1px solid var(--border-color); overflow: hidden; }
.pt-progress-fill { height: 100%; width: 0; background: var(--primary); transition: width 0.3s ease; }
.pt-progress.is-complete .pt-progress-fill { background: var(--success); }
.pt-cl-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pt-cl-item { border: 1px solid var(--border-color); border-radius: var(--pt-radius); background: var(--bg-input); padding: 12px; }
.pt-cl-item.is-done { border-color: var(--success); }
.pt-cl-head { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: start; }
.pt-cl-state { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border-color); margin-top: 2px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800; }
.pt-cl-item.is-done .pt-cl-state { border-color: var(--success); background: var(--success); color: var(--bg-card); }
.pt-cl-item.is-done .pt-cl-state::after { content: "✓"; }
.pt-cl-title label { font-weight: 700; font-size: 15px; color: var(--text-primary); }
.pt-cl-num { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.pt-cl-spec { margin: 4px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--text-secondary); }
.pt-cl-tool { grid-column: 2; display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; font-weight: 600; color: var(--primary); text-decoration: underline; text-underline-offset: 3px; width: fit-content; }
@media (min-width: 760px) { .pt-cl-head { grid-template-columns: 28px minmax(0, 1fr) auto; } .pt-cl-tool { grid-column: auto; } }
.pt-cl-body { margin: 8px 0 0 38px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
@media (max-width: 480px) { .pt-cl-body { margin-left: 0; } }
.pt-field-msg { margin: 0; min-height: 0; font-size: 13.5px; color: var(--text-secondary); }
.pt-field-msg:empty { display: none; }
.pt-field-msg.pt-bad { color: var(--error); }
.pt-field-msg.pt-good { color: var(--success); }
.pt-file-btn { position: relative; display: inline-flex; align-items: center; }
.pt-visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; border: 0 !important; min-height: 0 !important; }

@media (max-width: 480px) {
    .pt-tool .tool-card { padding: 12px; }
    .pt-group { padding: 12px; }
    .pt-note { margin: 12px 0 0; }
    .pt-video-export { padding: 12px 0 0; }
}

/* long inline code (URLs) in tool page prose must wrap at phone width */
.tool-editorial :not(pre) > code { overflow-wrap: anywhere; }

/* the [hidden] attribute must win over the display rules above */
.pt-tool [hidden] { display: none !important; }
/* the printable card is always black on white, whatever the site theme sets for p */
.pt-print-card .pt-print-name { color: #111111 !important; }
.pt-print-card .pt-print-sub, .pt-print-card .pt-print-foot { color: #3f3f46 !important; }
