/* Manody stylesheet, part 12 — Site cursor.
   Loaded in order by core/templates/core/includes/stylesheets.html. */

/* ==========================================================================
   Site cursor: Manody's "spark" arrow
   ==========================================================================
   Pages concerned: <html class="manody-cursor"> (the whole site, and the public
   pages that display "Créé avec Manody").

   1. Fallback (touch screen, reduced motion, no JavaScript): brand-gradient
      SVG pointers.
   2. Animated cursor (core/static/core/js/cursor.js): arrow, trail
      of sparks, editor labels, burst on click. */
:root {
    --cursor-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%236366f1'/%3E%3Cstop offset='.55' stop-color='%23a855f7'/%3E%3Cstop offset='1' stop-color='%23ec4899'/%3E%3C/linearGradient%3E%3Cfilter id='s' x='-30%25' y='-30%25' width='160%25' height='160%25'%3E%3CfeDropShadow dx='0' dy='1.2' stdDeviation='1.1' flood-color='%230f172a' flood-opacity='.35'/%3E%3C/filter%3E%3C/defs%3E%3Cpath filter='url(%23s)' d='M5 3.5 L5 23.5 L10.3 18.4 L13.9 26.6 L17.6 25 L14 17 L21.3 17 Z' fill='url(%23g)' stroke='%23fff' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E") 5 4, default;
    --cursor-click: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%236366f1'/%3E%3Cstop offset='.55' stop-color='%23a855f7'/%3E%3Cstop offset='1' stop-color='%23ec4899'/%3E%3C/linearGradient%3E%3Cfilter id='s' x='-30%25' y='-30%25' width='160%25' height='160%25'%3E%3CfeDropShadow dx='0' dy='1.2' stdDeviation='1.1' flood-color='%230f172a' flood-opacity='.35'/%3E%3C/filter%3E%3C/defs%3E%3Cpath filter='url(%23s)' d='M10 15 V5.5 a2 2 0 0 1 4 0 V12.5 a2 2 0 0 1 4 0 V13.5 a2 2 0 0 1 4 0 V15 a2 2 0 0 1 4 0 V21 c0 4.4 -3.1 7 -7.5 7 h-1.5 c-2.6 0 -4.3 -1.1 -5.7 -3.1 L5.6 20.2 a1.9 1.9 0 0 1 3 -2.3 L10 19.6 Z' fill='url(%23g)' stroke='%23fff' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M14 13v4.5M18 14v3.5M22 15.5v2.5' stroke='%23fff' stroke-opacity='.75' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E") 12 4, pointer;
    --cursor-grab: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%236366f1'/%3E%3Cstop offset='.55' stop-color='%23a855f7'/%3E%3Cstop offset='1' stop-color='%23ec4899'/%3E%3C/linearGradient%3E%3Cfilter id='s' x='-30%25' y='-30%25' width='160%25' height='160%25'%3E%3CfeDropShadow dx='0' dy='1.2' stdDeviation='1.1' flood-color='%230f172a' flood-opacity='.35'/%3E%3C/filter%3E%3C/defs%3E%3Ccircle filter='url(%23s)' cx='16' cy='16' r='12' fill='url(%23g)' stroke='%23fff' stroke-width='1.6'/%3E%3Cpath d='M16 9.5v13.0M9.5 16h13.0' stroke='%23fff' stroke-width='1.8' stroke-linecap='round'/%3E%3Cpath d='M13.5 12.0L16 9.5L18.5 12.0M13.5 20.0L16 22.5L18.5 20.0M12.0 13.5L9.5 16L12.0 18.5M20.0 13.5L22.5 16L20.0 18.5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 16 16, grab;
    --cursor-grabbing: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%236366f1'/%3E%3Cstop offset='.55' stop-color='%23a855f7'/%3E%3Cstop offset='1' stop-color='%23ec4899'/%3E%3C/linearGradient%3E%3Cfilter id='s' x='-30%25' y='-30%25' width='160%25' height='160%25'%3E%3CfeDropShadow dx='0' dy='1.2' stdDeviation='1.1' flood-color='%230f172a' flood-opacity='.35'/%3E%3C/filter%3E%3C/defs%3E%3Ccircle filter='url(%23s)' cx='16' cy='16' r='9.5' fill='url(%23g)' stroke='%23fff' stroke-width='1.6'/%3E%3Ccircle cx='16' cy='16' r='5.2' fill='none' stroke='%23fff' stroke-opacity='.55' stroke-width='1.4'/%3E%3Ccircle cx='16' cy='16' r='2.4' fill='%23fff'/%3E%3C/svg%3E") 16 16, grabbing;
}

/* ---------- 1. Fallback SVG pointers ---------- */
html.manody-cursor,
html.manody-cursor * { cursor: var(--cursor-arrow); }

html.manody-cursor :is(a, button, [role="button"], select, label, summary, .bb, .layer-list li,
    input[type="checkbox"], input[type="radio"], input[type="range"], input[type="color"], input[type="file"],
    input[type="submit"], input[type="button"]),
html.manody-cursor :is(a, button, [role="button"], select, label, summary, .bb, .layer-list li) * {
    cursor: var(--cursor-click);
}

html.manody-cursor .builder-stage:not(.is-preview) .bb,
html.manody-cursor .builder-stage:not(.is-preview) .bb * { cursor: var(--cursor-click); }

html.manody-cursor :is(.bb-handle, .block-card),
html.manody-cursor .builder :is(.bb-handle, .block-card),
html.manody-cursor .builder-stage:not(.is-preview) .bb .bb-handle,
html.manody-cursor :is(.bb-handle, .block-card) * { cursor: var(--cursor-grab); }

html.manody-cursor :is(.bb-handle, .block-card):active,
html.manody-cursor :is(.bb-handle, .block-card):active * { cursor: var(--cursor-grabbing); }

/* Text input and disabled elements: usual pointers (priority rules). */
html.manody-cursor :is(input:not([type]), input[type="text"], input[type="url"], input[type="search"],
    input[type="email"], input[type="password"], input[type="number"], input[type="tel"], input[type="date"],
    input[type="datetime-local"], textarea, [contenteditable="true"]) { cursor: text !important; }

html.manody-cursor :disabled,
html.manody-cursor :disabled * { cursor: not-allowed !important; }

/* ---------- 2. Animated cursor ---------- */
html.has-comet,
html.has-comet * { cursor: none !important; }

html.has-comet :is(input:not([type]), input[type="text"], input[type="url"], input[type="search"],
    input[type="email"], input[type="password"], input[type="number"], input[type="tel"], input[type="date"],
    input[type="datetime-local"], textarea, select, [contenteditable="true"]) { cursor: text !important; }

html.has-comet select { cursor: default !important; }

html.has-comet :disabled,
html.has-comet :disabled * { cursor: not-allowed !important; }

.comet {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.comet.is-visible { opacity: 1; }
.comet[data-state="hidden"] { opacity: 0; }

.comet-pointer {
    position: absolute;
    top: 0;
    left: 0;
    will-change: transform;
}

/* The arrow: its tip (5, 4 in the drawing) is exactly on the mouse. */
.comet-arrow {
    position: absolute;
    top: -4px;
    left: -5px;
    display: block;
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 1.5px 2px rgba(15, 23, 42, 0.35));
    transform-origin: 5px 4px;
    transition: transform 0.22s var(--ease);
}

.comet-arrow svg { display: block; width: 32px; height: 32px; }

/* Arrow states */
/* Small hand (same drawing as the arrow), index fingertip on the mouse (12, 4). */
.comet-hand {
    position: absolute;
    top: -4px;
    left: -12px;
    display: block;
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 1.5px 2px rgba(15, 23, 42, 0.35));
    transform-origin: 12px 4px;
    opacity: 0;
    transform: scale(0.6) rotate(-12deg);
    transition: opacity 0.15s ease, transform 0.22s var(--ease);
}

.comet-hand svg { display: block; width: 32px; height: 32px; }

.comet-arrow { transition: opacity 0.15s ease, transform 0.22s var(--ease); }

.comet[data-state="click"] .comet-arrow { opacity: 0; transform: scale(0.6); }
.comet[data-state="click"] .comet-hand { opacity: 1; transform: none; }
.comet.is-pressed[data-state="click"] .comet-hand { transform: scale(0.86) translateY(1px); }
.comet[data-state="grab"] .comet-arrow { transform: rotate(-12deg) scale(1.08); }
.comet.is-pressed .comet-arrow { transform: scale(0.86); }
.comet.is-pressed[data-state="grab"] .comet-arrow { transform: rotate(-12deg) scale(0.86); }

/* Context label (editor) */
.comet-label {
    position: absolute;
    top: 22px;
    left: 16px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--brand-gradient);
    color: #ffffff;
    font: 600 0.72rem/1.2 var(--font);
    letter-spacing: 0.01em;
    white-space: nowrap;
    box-shadow: 0 6px 16px rgba(168, 85, 247, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.5);
    opacity: 0;
    transform: translate(-4px, -4px) scale(0.8);
    transform-origin: top left;
    transition: opacity 0.2s ease, transform 0.25s var(--ease);
}

.comet.has-label .comet-label { opacity: 1; transform: none; }

/* Burst of sparks on click */
.comet-spark {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    box-shadow: 0 0 6px currentColor;
    animation: comet-spark 0.75s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

/* One spark in three is a small four-pointed star. */
.comet-spark:nth-of-type(3n) {
    border-radius: 1px;
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    width: 10px;
    height: 10px;
}

@keyframes comet-spark {
    0%   { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
    65%  { opacity: 1; }
    100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.3) rotate(90deg); opacity: 0; }
}
/* With the hand (taller than the arrow), the label moves down a bit. */
.comet[data-state="click"] .comet-label { top: 30px; left: 10px; }
