/* PUB to PDF tool page, on top of the site stylesheet and tools/_shared/tool.css.
   Ported from the reviewed D1 draft (app/p15-tools.css, .ck-*). Uses the site colour tokens only. */
:root { --ok: #1f7a4d; --bad: #b4332b; --bad-wash: rgba(180, 51, 43, 0.08); }
@media (prefers-color-scheme: dark) { :root { --ok: #5fd39a; --bad: #f2877f; --bad-wash: rgba(242, 135, 127, 0.12); } }

.tool-head { border-bottom: 1px solid var(--line); background: var(--bg-2); }
.tool-head .wrap { padding-top: 40px; padding-bottom: 28px; display: grid; gap: 12px; }
.tool-head h1 { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.06; letter-spacing: -0.04em; margin: 4px 0 0; max-width: 24ch; }
.tool-head .lede { font-size: 17.5px; color: var(--ink-2); margin: 0; max-width: 62ch; }
.tool-wrap { padding-top: 28px; padding-bottom: 80px; display: grid; gap: 56px; }
.tool-wrap > section > h2 { font-size: 24px; letter-spacing: -0.03em; margin: 0 0 14px; }

.ck-tool { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: grid; gap: 14px; position: relative; max-width: 880px; }
.ck-tool h3 { margin: 0; letter-spacing: -0.02em; }
.ck-tool .nojs { margin: 0; color: var(--ink-2); }
.ck-tool.js .nojs { display: none; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* The tool card's children live inside [data-view]; it needs the same rhythm as the card itself. */
.ck-tool [data-view] { display: grid; gap: 14px; min-width: 0; }
.ck-fmts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ck-fmts .lbl { font-size: 14px; color: var(--muted); margin-right: 6px; }
.ck-fmt { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: 12px; padding: 8px 12px; cursor: pointer; background: var(--bg); }
.ck-fmt.on { border-color: var(--accent); background: var(--accent-wash); }
.ck-fmt input { accent-color: var(--accent); margin: 0; }
.ck-fmt span { display: grid; line-height: 1.25; }
.ck-fmt b { font-weight: 600; font-size: 14.5px; }
.ck-fmt small { font-size: 12.5px; color: var(--muted); }

.ck-drop { border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 34px 18px; display: grid; justify-items: center; gap: 10px; text-align: center; background: var(--bg); transition: border-color .15s, background .15s; cursor: pointer; }
.ck-drop:hover, .ck-drop.over { border-color: var(--accent); background: var(--accent-wash); }
.ck-drop svg { width: 34px; height: 34px; stroke: var(--ink-2); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ck-drop .big { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.ck-drop .sub { font-size: 13.5px; color: var(--muted); }
.touch { display: none; }
@media (pointer: coarse) { .desk { display: none !important; } .touch { display: inline; } .ck-drop .sub.touch { display: block; } }

.ck-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; font: 500 14.5px/1 var(--sans); border: 0; white-space: nowrap; text-decoration: none; cursor: pointer; }
.ck-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ck-btn.pri { background: var(--btn-bg); color: var(--btn-ink); }
.ck-btn.gho { background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); }
.ck-btn.sm { min-height: 36px; padding: 0 13px; font-size: 13.5px; }
.ck-btn[disabled] { opacity: .5; cursor: default; }
a.ck-btn.pri { color: var(--btn-ink); }

.ck-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-2); justify-content: center; }
.ck-facts span { white-space: nowrap; }
.ck-facts span + span::before { content: "·"; margin-right: 14px; color: var(--muted); }
.ck-quota { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; font-size: 13.5px; border-top: 1px solid var(--line); padding-top: 12px; }
.ck-quota .l { color: var(--ink-2); }
.ck-quota b { font-weight: 600; color: var(--ink); }
.ck-sample { font-size: 13px; color: var(--muted); text-align: center; }

.ck-banner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; border-radius: 12px; padding: 12px 14px; background: var(--accent-wash); font-size: 14.5px; }
.ck-banner .x { background: none; border: 0; color: var(--muted); font-size: 20px; line-height: 1; padding: 0 4px; cursor: pointer; }
.ck-banner svg { width: 18px; height: 18px; margin-top: 2px; stroke: var(--accent); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ck-banner-act { margin-top: 8px; }

.ck-sum { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.ck-sum h3 { font-size: 18px; }
.ck-sum .s { font-size: 13.5px; color: var(--ink-2); }
progress.ck-prog { width: 100%; height: 6px; border: 0; border-radius: 999px; background: var(--bg-2); overflow: hidden; -webkit-appearance: none; appearance: none; color: var(--accent); }
progress.ck-prog::-webkit-progress-bar { background: var(--bg-2); border-radius: 999px; }
progress.ck-prog::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress.ck-prog::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

.ck-files { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; max-height: 520px; overflow-y: auto; }
.ck-files > li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0 12px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 14px; }
.ck-files > li:first-child { border-top: 0; }
.ck-files .ico { grid-row: 1 / 3; width: 26px; height: 32px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--surface); display: grid; place-items: center; font: 600 9px/1 var(--mono); color: var(--muted); overflow: hidden; position: relative; }
.ck-files .ico.th::before { content: ""; position: absolute; inset: 5px 5px auto 5px; height: 9px; border-radius: 2px; background: var(--warm-wash); }
.ck-files .ico.th::after { content: ""; position: absolute; left: 5px; right: 5px; top: 18px; height: 9px; background: repeating-linear-gradient(var(--line-2) 0 1.5px, transparent 1.5px 4px); }
.ck-files .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ck-files .meta { grid-column: 2; font-size: 12.5px; color: var(--muted); min-width: 0; }
.ck-files .act { grid-row: 1 / 3; grid-column: 3; display: flex; gap: 8px; align-items: center; }
.ck-files .why { grid-column: 2 / 4; margin: 6px 0 2px; font-size: 13px; color: var(--ink-2); background: var(--bg); border-radius: 8px; padding: 8px 10px; display: grid; gap: 4px; }
.ck-files .why b { font-weight: 600; color: var(--ink); }
.ck-files li.warn .why { background: var(--warm-wash); }
.ck-files li.lock { color: var(--muted); }
.ck-files li.lock .nm { font-weight: 400; }
.ck-st { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; color: var(--ink-2); }
.ck-st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.ck-st.ok::before { background: var(--ok); }
.ck-st.bad { color: var(--bad); }
.ck-st.bad::before { background: var(--bad); }
.ck-st.run::before { background: var(--accent); animation: ckpulse 1s infinite; }
@keyframes ckpulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .ck-st.run::before { animation: none; } }

.ck-note { font-size: 13.5px; color: var(--ink-2); }
.ck-note.muted { color: var(--muted); }
.ck-fails { border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; background: var(--bad-wash); }
.ck-fails h4 { font-size: 15px; margin: 0; }
.ck-fails ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.ck-fails li { display: grid; gap: 2px; font-size: 13.5px; padding-top: 8px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.ck-fails li:first-child { border-top: 0; padding-top: 0; }
.ck-fails li b { font-weight: 600; }
.ck-fails .do { color: var(--ink-2); }
.ck-fails .do::before { content: "What you can do: "; color: var(--muted); }
.ck-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.ck-big { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: start; }
.ck-thumb { width: 110px; aspect-ratio: 8.5 / 11; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); position: relative; overflow: hidden; box-shadow: var(--shadow); }
.ck-thumb::before { content: ""; position: absolute; left: 10%; right: 10%; top: 8%; height: 22%; border-radius: 4px; background: var(--warm-wash); }
.ck-thumb::after { content: ""; position: absolute; left: 10%; right: 10%; top: 36%; bottom: 14%; background: repeating-linear-gradient(var(--line-2) 0 2px, transparent 2px 7px); }
.ck-thumb.blank::before, .ck-thumb.blank::after { display: none; }
.ck-thumb .ft { position: absolute; left: 0; right: 0; bottom: 3px; text-align: center; font: 6.5px/1 var(--mono); color: var(--muted); }
.ck-big h3 { font-size: 17px; overflow-wrap: anywhere; }
.ck-big .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.ck-big .stack { display: grid; gap: 10px; min-width: 0; }
.ck-gone { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ok); }
.ck-gone svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ck-msg { font-size: 13.5px; border-radius: 10px; padding: 9px 12px; background: var(--warm-wash); }
.ck-msg b { font-weight: 600; }

.ck-pay { border: 1px solid var(--line-2); border-radius: 14px; padding: 16px; display: grid; gap: 12px; background: var(--bg); }
.ck-pay h3 { font-size: 19px; }
.ck-pay .price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ck-pay .price b { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; }
.ck-pay .price s { color: var(--muted); }
.ck-pay .price span { font-size: 13.5px; color: var(--ink-2); }
.ck-pay ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 14px; }
.ck-pay li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 8px; }
.ck-pay li svg { width: 16px; height: 16px; margin-top: 3px; stroke: var(--accent); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ck-pay li.no svg { stroke: var(--muted); }
.ck-pay .fine { font-size: 12.5px; color: var(--muted); margin: 0; }

.ck-keybox { border-top: 1px solid var(--line); padding-top: 10px; font-size: 14px; }
.ck-keybox > summary { cursor: pointer; color: var(--ink-2); width: max-content; }
.ck-keybox .ck-licence { margin: 12px 0 0; box-shadow: none; padding: 16px; }
.ck-keybox .ck-licence h2 { font-size: 17px; }
.ck-licrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 12px; }
.ck-licrow code { font-family: var(--mono); }
.ck-lic { display: inline-flex; align-items: center; gap: 6px; font: 500 12px/1 var(--mono); padding: 5px 9px; border-radius: 999px; background: var(--accent-wash); color: var(--ink); margin-right: 4px; }
.ck-ts:empty { display: none; }

/* sections under the tool */
.ck-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.ck-cols > div { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--surface); }
.ck-cols h3 { font-size: 16px; margin: 0 0 6px; }
.ck-cols p { margin: 0; color: var(--ink-2); font-size: 15px; }
.ck-tested { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--surface); display: grid; gap: 14px; }
.ck-tested .row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ck-tested .n { display: block; font-size: 26px; font-weight: 600; letter-spacing: -0.03em; }
.ck-tested .cap { font-size: 14px; color: var(--ink-2); }
.ck-tested p { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.ck-plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ck-plan { border: 1px solid var(--line); border-radius: 14px; padding: 18px; background: var(--surface); display: grid; gap: 8px; align-content: start; }
.ck-plan.top { border-color: var(--accent); }
.ck-plan h3 { margin: 0; font-size: 17px; }
.ck-plan .p { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; }
.ck-plan .p small { font-size: 14px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.ck-plan .p s { font-size: 18px; color: var(--muted); font-weight: 400; }
.ck-plan ul { margin: 0; padding-left: 1.1em; color: var(--ink-2); font-size: 15px; display: grid; gap: 4px; }
.ck-faq details { border-top: 1px solid var(--line); padding: 12px 0; }
.ck-faq details:last-child { border-bottom: 1px solid var(--line); }
.ck-faq summary { cursor: pointer; font-weight: 600; }
.ck-faq p { margin: 8px 0 0; color: var(--ink-2); }
.ck-more { display: flex; flex-wrap: wrap; gap: 10px 20px; padding: 0; margin: 0; list-style: none; }
.ck-updated { font: 500 13px/1 var(--mono); color: var(--muted); }

@media (max-width: 720px) {
  .tool-head .wrap { padding-top: 28px; padding-bottom: 20px; }
  .ck-tool { padding: 14px; }
  .ck-cols, .ck-tested .row, .ck-plans { grid-template-columns: 1fr; }
  .ck-big { grid-template-columns: 1fr; }
  .ck-thumb { width: 84px; }
  .ck-files > li { grid-template-columns: auto minmax(0, 1fr); }
  .ck-files .act { grid-row: auto; grid-column: 2; margin-top: 6px; }
  .ck-files .why { grid-column: 1 / 3; }
}
@media (max-width: 520px) {
  .ck-facts { flex-direction: column; gap: 2px; }
  .ck-facts span + span::before { content: none; }
}
