/* Native browser cursors remain immediate; decorative ink never receives input. */
.cursor-trail {
  --cafe-trail-ink: #f3ede2;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  pointer-events: none;
}
.cursor-trail[hidden], .motion-paused .cursor-trail { display: none; }
@media (prefers-reduced-motion: reduce), (hover: none), (pointer: coarse), (forced-colors: active) {
  .cursor-trail { display: none; }
}

@media (hover: hover) and (pointer: fine) and (forced-colors: none) {
  :root {
    --cafe-cursor: url('/assets/cursor-cafe.svg') 4 3;
    --cafe-link-cursor: url('/assets/cursor-cafe-link.svg') 12 3;
    --cafe-press-cursor: url('/assets/cursor-cafe-press.svg') 12 3;
  }

  html,
  body,
  dialog {
    cursor: var(--cafe-cursor), auto;
  }

  /* Reading still feels like reading, including text beside a native dialog. */
  :root body :where(h1, h2, h3, h4, h5, h6, p, li, dd, blockquote, figcaption):not(:where(a[href], button, summary, [role='button'], [role='tab']) *) {
    cursor: text;
  }

  :root body :is(a[href], button, summary, [role='button'], [role='tab'], label[for]):where(:not(:disabled, :disabled *, [aria-disabled='true'], [aria-disabled='true'] *)) {
    cursor: var(--cafe-link-cursor), pointer;
  }

  :root body :is(a[href], button, summary, [role='button'], [role='tab'], label[for]):where(:not(:disabled, :disabled *, [aria-disabled='true'], [aria-disabled='true'] *)):active {
    cursor: var(--cafe-press-cursor), pointer;
  }

  /* Leave platform controls and embedded players to their own interaction UI. */
  :root body :is(input, textarea, select, video, audio, iframe, [contenteditable]:not([contenteditable='false'])):where(:not(:disabled, :disabled *, [aria-disabled='true'], [aria-disabled='true'] *)) {
    cursor: auto;
  }

  :root body :is(input:not([type]), input[type='text'], input[type='search'], input[type='email'], input[type='url'], input[type='tel'], input[type='password'], [contenteditable]:not([contenteditable='false'])):where(:not(:disabled, :disabled *, [aria-disabled='true'], [aria-disabled='true'] *)) {
    cursor: text;
  }

  :root body input:is([type='button'], [type='submit'], [type='reset']):where(:not(:disabled, :disabled *, [aria-disabled='true'], [aria-disabled='true'] *)) {
    cursor: var(--cafe-link-cursor), pointer;
  }

  :root body input:is([type='button'], [type='submit'], [type='reset']):where(:not(:disabled, :disabled *, [aria-disabled='true'], [aria-disabled='true'] *)):active {
    cursor: var(--cafe-press-cursor), pointer;
  }

  /* This comes after text / platform rules so an unavailable action is truthful. */
  :root body :is(:disabled, [aria-disabled='true']),
  :root body :is(:disabled, [aria-disabled='true']) * {
    cursor: not-allowed;
  }

  :root body [aria-busy='true'],
  :root body [aria-busy='true'] :is(button[type='submit'], [role='button']),
  :root body [aria-busy='true'] :is(button[type='submit'], [role='button']) *,
  :root body .official-media.youtube-loading .youtube-play,
  :root body .official-media.youtube-loading .youtube-play * {
    cursor: progress;
  }
}
