/* Of Heart and Hand: discreet, accessible site-wide cursors. 2026-11-16 (classic arrow shape restored; matching sage palette + consistency + zoom update).
   No changes to layout, text or navigation. Normal cursor: 32x32;
   hand: 40x40; I-beam: 30x38; zoom: 36x36. All assets are transparent PNGs.
   The hand is animated by /of-heart-and-hand-cursors.js?v=20261126glimpses1 only on fine pointers. */

@media (hover: hover) and (pointer: fine) {
  :root {
    --ohh-cursor-arrow: url("/assets/cursors/sage-arrow-32.png?v=20261116f") 2 1, default;
    --ohh-cursor-hand: url("/assets/cursors/sage-hand-40.png?v=20261116e") 18 7, pointer;
    --ohh-cursor-zoom: url("/assets/cursors/sage-zoom-in-36.png?v=20261116e") 16 16, zoom-in;
    --ohh-cursor-text: url("/assets/cursors/sage-text-30.png?v=20261116e") 15 19, text;
  }

  /* All elements get the site arrow, not only the page background.
     These are intentionally not !important, allowing specialised
     drag, resize, and other site controls to retain their behaviour. */
  html, body, body * { cursor: var(--ohh-cursor-arrow); }

  /* Text and its inline descendants remain recognisable as selectable,
     including markup inside Reflections and Study passages. */
  body :where(p, h1, h2, h3, h4, h5, h6, blockquote, cite, q, li,
       dt, dd, figcaption, small, strong, em, b, i, time, code, pre),
  body :where(p, h1, h2, h3, h4, h5, h6, blockquote, cite, q, li,
       dt, dd, figcaption, small, strong, em, b, i, time, code, pre) *,
  body :where(main, article, section) :where(span),
  body :where(input[type="text"], input[type="search"], input[type="email"],
       input[type="url"], input[type="tel"], input[type="password"],
       input[type="number"], textarea, [contenteditable="true"]),
  body :where([contenteditable="true"]) * {
    cursor: var(--ohh-cursor-text) !important;
  }

  /* Interactive elements and every nested child use the hand.  This
     overrides other stylesheet declarations like cursor:pointer. */
  body :where(a[href], button:not(:disabled), summary, select, label[for],
       [role="button"], [role="link"], [data-cursor="pointer"],
       .reflection-card-main,
       .home-page .feature-reflection[data-expandable]:not(.is-reading),
       .glimpses-page .gallery-filter,
       .study-theme-filter):not([aria-disabled="true"]),
  body :where(a[href], button:not(:disabled), summary, select, label[for],
       [role="button"], [role="link"], [data-cursor="pointer"],
       .reflection-card-main,
       .home-page .feature-reflection[data-expandable]:not(.is-reading),
       .glimpses-page .gallery-filter,
       .study-theme-filter):not([aria-disabled="true"]) * {
    cursor: var(--ohh-cursor-hand) !important;
  }

  /* Only pictures that really open an image viewer get the magnifier.
     .photo-link is generated by gallery.js for Glimpses and Fragments.
     Other galleries can opt in with data-cursor="zoom-in". */
  body :where(a.photo-link, [data-cursor="zoom-in"], [data-zoom-in],
       a[data-lightbox], button[data-lightbox], .image-zoom-trigger):not([aria-disabled="true"]),
  body :where(a.photo-link, [data-cursor="zoom-in"], [data-zoom-in],
       a[data-lightbox], button[data-lightbox], .image-zoom-trigger):not([aria-disabled="true"]) * {
    cursor: var(--ohh-cursor-zoom) !important;
  }

  /* The animated hand replaces the PNG, but only while it is visible.
     Highest priority prevents duplicate cursors on child elements. */
  html body .ohh-cursor-hand-active,
  html body .ohh-cursor-hand-active * {
    cursor: none !important;
  }
}

/* Subtle beige selection instead of a saturated blue, for mouse and touch. */
::selection { background: #e7d6be; color: #334c3a; }

/* Decorative pointer follows mouse on interactive elements only. */
#ohh-cursor-hand-overlay {
  position: fixed;
  inset: 0 auto auto 0;
  width: 40px;
  height: 40px;
  pointer-events: none;
  z-index: 2147483646;
  display: none;
  transform: translate(-18px, -7px);
  contain: layout style;
}
#ohh-cursor-hand-overlay.is-visible { display: block; }
#ohh-cursor-hand-overlay .ohh-hand-art {
  width: 40px;
  height: 40px;
  display: block;
  transform-origin: 18px 7px;
  filter: drop-shadow(0 1px 1px rgba(61,82,75,.10));
}
#ohh-cursor-hand-overlay .ohh-hand-art.is-tapping {
  animation: ohh-cursor-tap .34s ease-out;
}
@keyframes ohh-cursor-tap {
  0%, 100% { transform: scale(1); }
  38% { transform: scale(.83); }
  70% { transform: scale(1.045); }
}
.ohh-cursor-click-ring {
  position: fixed;
  left: 0; top: 0;
  width: 36px; height: 36px;
  border: 1.5px solid #d3bda5;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(217,197,173,.10);
  pointer-events: none;
  z-index: 2147483645;
  animation: ohh-cursor-ripple .48s ease-out forwards;
}
@keyframes ohh-cursor-ripple {
  from { transform: translate(-50%, -50%) scale(.3); opacity: .65; }
  to   { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  #ohh-cursor-hand-overlay .ohh-hand-art.is-tapping { animation: none; }
  .ohh-cursor-click-ring { display: none; }
}
