/* The touch layer (tactile.js): pointer light, card lean, press physics on the content pages, ripples and paper.
   Works on both the workbench (styles.css tokens) and the content pages (site.css tokens). Everything here is
   decoration: with reduced motion it is switched off, and without tactile.js nothing here applies. */
:root {
  --tk-glint: rgb(255 255 255 / 22%);
  --tk-glint-soft: rgb(255 255 255 / 10%);
  --tk-paper: #f2c14e;
  --tk-ring: var(--accent, #b75d39);
  --tk-spring: cubic-bezier(.34, 1.56, .64, 1);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --tk-glint: rgb(255 255 255 / 14%); --tk-glint-soft: rgb(255 255 255 / 6%); } }
:root[data-theme="dark"] { --tk-glint: rgb(255 255 255 / 14%); --tk-glint-soft: rgb(255 255 255 / 6%); }

/* Light follows the pointer. Filled buttons get a brighter glint; outlined ones and cards a softer wash. */
.tk-on .tk-lit { background-image: radial-gradient(circle at var(--tk-x, 50%) var(--tk-y, 50%), var(--tk-glint-soft), transparent 65%); }
.tk-on .tk-lit:is(.run-button, .primary-button, .upload-button, .cta:not(.secondary), .open) {
  background-image: radial-gradient(circle at var(--tk-x, 50%) var(--tk-y, 50%), var(--tk-glint), transparent 60%);
}

/* Cards lean a degree or two toward the pointer and settle back on a spring when it leaves. */
@media (hover: hover) and (pointer: fine) {
  .tk-on .tool-card.tk-lit:hover:not(:active) { transform: translateY(-2px) perspective(760px) rotateX(var(--tk-rx, 0deg)) rotateY(var(--tk-ry, 0deg)); }
  .tk-on .cards a { transition: border-color .15s, box-shadow .25s, transform .5s var(--tk-spring); }
  .tk-on .cards a.tk-lit:hover:not(:active) { transform: translateY(-2px) perspective(760px) rotateX(var(--tk-rx, 0deg)) rotateY(var(--tk-ry, 0deg)); box-shadow: var(--shadow, 0 10px 30px rgb(0 0 0 / 8%)); }
}

/* Content pages: the same give-and-spring-back press the workbench buttons have. */
.tk-on :is(.cta, .site-nav a.open, .cards a) { transition: background-color .15s, border-color .15s, color .15s, box-shadow .25s, transform .45s var(--tk-spring); }
.tk-on :is(.cta, .site-nav a.open):active { transform: scale(.965); transition-duration: .15s, .15s, .15s, .2s, .08s; }
.tk-on .cards a:active { transform: scale(.985); transition-duration: .15s, .2s, .08s; }

/* Effects layer: click-through, above everything, never in the way of the page. */
.tk-fx { position: fixed; inset: 0; z-index: 2147483000; overflow: hidden; pointer-events: none; contain: strict; perspective: 600px; }
.tk-ring { position: absolute; width: 64px; height: 64px; border: 2px solid var(--tk-ring); border-radius: 50%; opacity: 0; will-change: transform, opacity; }
.tk-paper { position: absolute; width: 7px; height: 10px; margin: -5px 0 0 -3.5px; border-radius: 1.5px; opacity: 0; will-change: transform, opacity; backface-visibility: visible; }
.tk-paper:nth-child(3n) { width: 5px; height: 5px; border-radius: 50%; }
.tk-paper:nth-child(4n) { width: 9px; height: 4px; }

@media (prefers-reduced-motion: reduce) {
  .tk-on .tk-lit { background-image: none !important; }
  .tk-on .tool-card.tk-lit:hover, .tk-on .cards a.tk-lit:hover { transform: none !important; }
  .tk-fx { display: none; }
}
