/* Shared look for the in-browser author tools (preflights, calculators). Uses the site's own colour tokens,
   so it follows light/dark/e-ink. Pass/fix/check states always carry a word, never colour alone. */

.pf-drop { display: grid; place-items: center; gap: .5rem; padding: 1.75rem 1rem; border: 2px dashed var(--line); border-radius: 1rem; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.pf-drop:hover, .pf-drop:focus-within, .pf-drop.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.pf-drop strong { color: var(--ink); font-size: 1.05rem; }
.pf-drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }

.pf-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.pf-chip { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .8rem; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; user-select: none; }
.pf-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pf-chip input { accent-color: var(--accent); }

.pf-progress { height: .4rem; border-radius: 999px; background: var(--line); overflow: hidden; }
.pf-progress > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.pf-state { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; white-space: nowrap; }
.pf-state::before { content: ""; width: .7rem; height: .7rem; border-radius: 50%; flex: none; }
.pf-ok::before { background: #16a34a; }
.pf-fix::before { background: #dc2626; }
.pf-check::before { background: #d97706; }

.pf-verdicts { display: grid; gap: .75rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 40rem) { .pf-verdicts { grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); } }
.pf-verdict { padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); }
.pf-verdict h3 { font-size: 1.05rem; font-weight: 700; }
.pf-verdict ul { margin-top: .5rem; display: grid; gap: .35rem; font-size: .9rem; }
.pf-verdict li { display: grid; grid-template-columns: auto 1fr; gap: .5rem; align-items: start; }

.pf-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.pf-table th, .pf-table td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.pf-table th { font-weight: 600; color: var(--muted); white-space: nowrap; }
.pf-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Phones: each row becomes a card with its labels. */
@media (max-width: 39.99rem) {
    .pf-table thead { display: none; }
    .pf-table, .pf-table tbody, .pf-table tr, .pf-table td { display: block; width: 100%; }
    .pf-table tr { padding: .5rem 0; border-bottom: 1px solid var(--line); }
    .pf-table td { border: 0; padding: .2rem 0; display: flex; justify-content: space-between; gap: 1rem; }
    .pf-table td::before { content: attr(data-label); color: var(--muted); font-weight: 600; }
    .pf-table td:first-child { font-weight: 700; display: block; }
    .pf-table td:first-child::before { content: none; }
}

.pf-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.pf-note { font-size: .875rem; color: var(--muted); }

@media print {
    header, footer, nav, .pf-noprint, .pf-drop { display: none !important; }
    .pf-verdict, .pf-table tr { break-inside: avoid; }
}

/* Print book checker: per-platform sizes, template preview, overlay. */
.pf-sizes { width: 100%; border-collapse: collapse; font-size: .875rem; }
.pf-sizes th, .pf-sizes td { padding: .3rem 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.pf-sizes th { font-weight: 600; color: var(--muted); padding-right: .75rem; }
.pf-sizes td.num { font-variant-numeric: tabular-nums; }
.pf-preview { border: 1px solid var(--line); border-radius: .5rem; background: #fff; padding: .25rem; }
.pf-preview svg { display: block; width: 100%; height: auto; }
.pf-overlay { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: .5rem; background: #fff; }
.pf-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .8rem; color: var(--muted); }
.pf-legend span::before { content: ""; display: inline-block; width: .9rem; height: .2rem; margin-right: .35rem; vertical-align: middle; background: var(--c); }
.pf-row { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
.pf-row > *, .pf-verdict { min-width: 0; }
.pf-drop, .pf-verdict { overflow-wrap: anywhere; }
@media (min-width: 40rem) { .pf-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pf-spec { width: 100%; border-collapse: collapse; font-size: .9rem; }
.pf-spec th, .pf-spec td { padding: .45rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.pf-spec th { color: var(--muted); font-weight: 600; width: 34%; }

/* Ebook cover checker: the cover at store-listing sizes. */
.pf-thumbs { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1.25rem; }
.pf-thumb { display: grid; gap: .4rem; justify-items: start; font-size: .8rem; color: var(--muted); }
.pf-thumb img { height: auto; box-shadow: 0 1px 4px rgba(0,0,0,.25); }

/* A warning inside a tool's explanation. */
.pf-warn { padding: .5rem .75rem; border-left: 3px solid #d97706; background: rgba(217,119,6,.1); border-radius: .25rem; }

/* Ebook maker: the table of contents, one row per part. */
.pf-toc { display: grid; gap: .4rem; counter-reset: none; }
.pf-toc-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .75rem; align-items: start; padding: .5rem; border: 1px solid var(--line); border-radius: .6rem; }
.pf-toc-row input[type=checkbox] { margin-top: .7rem; width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.pf-toc-main { display: grid; gap: .25rem; min-width: 0; overflow-wrap: anywhere; }
.pf-toc-row.is-off { opacity: .6; }

/* A folding block inside a spec card (print checker: Paperback / Hardcover / Where it's sold). */
.pf-fold { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.pf-fold > summary { cursor: pointer; font-weight: 700; font-size: 1.05rem; padding-block: .25rem; }
.pf-fold > summary:hover { color: var(--accent); }
/* Phones: spec tables stack (label over value) instead of squeezing two columns. */
@media (max-width: 39.99rem) {
    .pf-spec, .pf-spec tbody, .pf-spec tr, .pf-spec th, .pf-spec td { display: block; width: 100%; }
    .pf-spec tr { padding: .5rem 0; border-bottom: 1px solid var(--line); }
    .pf-spec th, .pf-spec td { border: 0; padding: .1rem 0; }
}

/* Trim size matrix: one compact table at every width (it scrolls inside its card on a phone; the page doesn't). */
.pf-matrix { width: 100%; border-collapse: collapse; font-size: .9rem; }
.pf-matrix th, .pf-matrix td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
.pf-matrix thead th { font-weight: 600; color: var(--muted); font-size: .8rem; }
.pf-matrix tbody th { font-weight: 600; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.pf-matrix tr:last-child > * { border-bottom: 0; }
.pf-mark { display: inline-grid; place-items: center; width: 1.35rem; height: 1.35rem; margin-right: .2rem; border-radius: .35rem; background: var(--accent-soft); color: var(--ink); font-size: .75rem; font-weight: 700; }

/* Print preview (print-preview.js): before and after side by side at every width, so they're easy to compare. */
.pf-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.pf-pair figure { min-width: 0; }
.pf-pair canvas { width: 100%; max-height: 70vh; object-fit: contain; }
