/* X Codec Pack - shared motion and blueprint kit (2026-11-30)
   One place for the site-wide motion: scroll reveals, the reading line under the header, corner squares on hover,
   count-up figures and the hairline "cells" grid. Loaded on every page after site.css; assets/js/motion.js drives it.
   Everything is additive: without the script, or with reduced motion, pages look exactly as before. */

/* ---- reveal on scroll ---- */
.xm-js .xm-rv { opacity: 0; transform: translateY(16px); transition: opacity .55s ease, transform .55s cubic-bezier(.2,.8,.2,1); transition-delay: calc(var(--xm-i, 0) * 70ms); }
.xm-js .xm-rv.xm-h { transform: translateY(10px); }
.xm-js .xm-rv.xm-in { opacity: 1; transform: none; }
/* once shown, hand the element back to its own hover transitions */
.xm-js .xm-rv.xm-done { transition: none; transition-delay: 0s; }

/* ---- reading line: how far down the page you are ---- */
.xm-read { position: fixed; left: 0; top: 0; z-index: 1200; width: 100%; height: 2px; background: var(--accent-primary); transform: scaleX(var(--xm-read, 0)); transform-origin: left; pointer-events: none; opacity: 0; transition: opacity .3s ease; }
.xm-read.on { opacity: 1; }

/* ---- corner squares: the footer's drawing marks, shown on a card while it is hovered or focused ---- */
.xm-cs { position: absolute; inset: -4px; z-index: 3; pointer-events: none; opacity: 0; transform: scale(.985); transition: opacity .2s ease, transform .25s cubic-bezier(.2,.8,.2,1); }
.xm-cs i { position: absolute; width: 7px; height: 7px; box-sizing: border-box; background: var(--bg-card); border: 1px solid var(--accent-primary); }
.xm-cs i:nth-child(1) { left: 0; top: 0; } .xm-cs i:nth-child(2) { right: 0; top: 0; }
.xm-cs i:nth-child(3) { left: 0; bottom: 0; } .xm-cs i:nth-child(4) { right: 0; bottom: 0; }
.xm-card:hover > .xm-cs, .xm-card:focus-within > .xm-cs { opacity: 1; transform: none; }

/* ---- cells: a card grid drawn as one hairline sheet with corner squares (as on the About and 404 pages) ---- */
.xm-cells.xm-cells { position: relative; gap: 0; border-top: 1px solid var(--border); border-left: 1px solid var(--border); --xm-bg: var(--bg-dark); }
.xm-cells.xm-on-card { --xm-bg: var(--bg-card); }
.xm-cells.xm-cells > *, .xm-cells.xm-cells > *:hover { position: relative; margin: 0; background: none; border: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; }
.xm-cells.xm-cells > * { transition: background-color .25s ease; }
.xm-cells.xm-cells > *:hover, .xm-cells.xm-cells > *:focus-within { background: color-mix(in srgb, var(--accent-primary) 6%, transparent); }
.xm-cells::before, .xm-cells::after, .xm-cells > *::before, .xm-cells > *::after { content: ''; position: absolute; inset: auto; width: 7px; height: 7px; box-sizing: border-box; background: var(--xm-bg); border: 1px solid #8fa6ba; border-radius: 0; z-index: 2; transform: none; opacity: 1; animation: none; }
:root:not([data-theme="light"]) .xm-cells::before, :root:not([data-theme="light"]) .xm-cells::after,
:root:not([data-theme="light"]) .xm-cells > *::before, :root:not([data-theme="light"]) .xm-cells > *::after { border-color: #5c728c; }
.xm-cells > *::before { top: -4px; left: -4px; } .xm-cells > *::after { bottom: -4px; right: -4px; }
.xm-cells::before { top: -4px; right: -4px; } .xm-cells::after { bottom: -4px; left: -4px; }
/* inside a cells grid the content rises, not the cell, so the lines stay put */
.xm-js .xm-cells > .xm-rv { opacity: 1; transform: none; }
.xm-js .xm-cells > .xm-rv > * { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s cubic-bezier(.2,.8,.2,1); transition-delay: calc(var(--xm-i, 0) * 80ms); }
.xm-js .xm-cells > .xm-rv.xm-in > * { opacity: 1; transform: none; }
.xm-js .xm-cells > .xm-rv.xm-done > * { transition: none; }

/* ---- small hover reactions shared by every page ---- */
.btn-primary svg, .btn-secondary svg { transition: transform .2s ease; }
.btn-primary:hover svg, .btn-primary:focus-visible svg { transform: translateY(2px); }

@media (prefers-reduced-motion: reduce) {
    .xm-read { display: none; }
    .xm-cs { transition: none; }
    .btn-primary svg, .btn-secondary svg { transition: none; }
    .btn-primary:hover svg { transform: none; }
}
@media print { .xm-read, .xm-cs { display: none; } .xm-js .xm-rv, .xm-js .xm-cells > .xm-rv > * { opacity: 1 !important; transform: none !important; } }
