/* ════════════════ TEMPLATE PREVIEWS (v0.103) ════════════════
   Every template picker draws the head of a real page in each look.
   The box is paper; the page inside it is the sheet's own markup,
   scaled and cropped by renderMiniInto. */
[data-tpl-pv], .tp-big-pv {
  display: block; position: relative; overflow: hidden;
  background: #fff;
  box-shadow: 0 0 0 1px var(--chrome-line-2, #d9d2c6);
  border-radius: var(--r);
}
.mini-frame.is-crop { position: absolute; inset: 0; overflow: hidden; }
.mini-frame.is-crop .mini-page {
  position: absolute; top: 0; left: 0;
  background: #fff; box-shadow: none; border: 0;
}
.mini-frame.is-crop .mini-page * { pointer-events: none !important; cursor: default !important; }
.mini-frame.is-crop .mini-page .blk:hover,
.mini-frame.is-crop .mini-page .cell:hover { background: none !important; box-shadow: none !important; }
.mini-frame.is-crop .mini-page .cell[data-ph]:empty::before { content: none; }
/* The bottom of a crop fades to paper, so the page reads as running on
   rather than cut off. */
[data-tpl-pv]::after, .tp-big-pv::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 22%;
  background: linear-gradient(rgba(255,255,255,0), #fff);
  pointer-events: none;
}

/* ---- Desk: the Template menu ---- */
.menu-tpl { width: auto; }
.menu-tpl .tp-wrap { display: flex; gap: 14px; align-items: flex-start; min-height: 0; }
.menu-tpl .tp-list { flex: none; width: 436px; }
.menu-tpl .tgrid { grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 2px 4px 8px; }
.menu-tpl .tcard {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  padding: 5px 4px 6px; text-align: center;
}
.menu-tpl .tc-pv { width: 96px; height: 70px; margin: 0 auto; }
.menu-tpl .tcard:hover .tc-pv,
.menu-tpl .tcard:focus-visible .tc-pv { box-shadow: 0 0 0 1px var(--accent-line); }
.menu-tpl .tcard.sel .tc-pv { box-shadow: 0 0 0 1.5px var(--accent); }
.menu-tpl .tc-name { font-size: 13.5px; line-height: 1.15; margin: 0; }
.menu-tpl .tp-big {
  position: sticky; top: 0; flex: none; width: 296px;
  padding: 10px 6px 6px 0;
}
.menu-tpl .tp-big-pv { width: 296px; height: 300px; }
.menu-tpl .tp-big-name { margin-top: 11px; font-size: 19px; line-height: 1.15; color: var(--ink); }
.menu-tpl .tp-big-sub {
  margin-top: 3px; font-family: var(--font-ui-2); font-size: 11px;
  line-height: 1.4; color: var(--ink-soft);
}
.menu-tpl .tp-big-state {
  margin-top: 8px; font-family: var(--font-ui-2); font-size: 10.5px;
  letter-spacing: .02em; color: var(--ink-soft);
}
.menu-tpl .tp-big.is-cur .tp-big-state { color: var(--accent-ink, var(--accent)); }

/* ---- Phone: the Format sheet ---- */
.m-choice.has-pv { display: flex; flex-direction: column; padding: 8px 8px 10px; }
.m-choice-pv { width: 100%; aspect-ratio: 3 / 2; margin-bottom: 8px; }
.m-choice[aria-pressed="true"] .m-choice-pv { box-shadow: 0 0 0 1.5px var(--accent); }
.m-choice.has-pv .m-choice-name { font-weight: 400; }

/* ---- Library: Choose a look ---- */
.lnf-tpl-pv { width: 100%; aspect-ratio: 4 / 3; margin-bottom: 6px; }
.lnf-tpl.is-sel .lnf-tpl-pv { box-shadow: 0 0 0 1.5px var(--accent); }

/* Dark chrome: the paper stays paper, as the sheet does. */
[data-theme="dark"] [data-tpl-pv], [data-theme="dark"] .tp-big-pv { box-shadow: 0 0 0 1px rgba(255,255,255,.14); }

/* v0.165: in the dark, every keyboard ring is the word red. Fifty-odd
   rings were drawn in the fill red (#b5303f), which on the dark chrome
   is quiet and reads as yet another shade beside the word red the other
   ten used. Colour only; each ring keeps its own width and offset.
   The page is left alone: paper is never themed. */
[data-theme="dark"] *:focus-visible:not(.page *) { outline-color: var(--accent-ink) !important; }
