/* ===================================================================
   Workspace tour: a spotlight over the editor and a coach-mark card.
   On phones the card becomes a bottom sheet.
   =================================================================== */
body.hp-ui .hp-tour { position: fixed; inset: 0; z-index: 400; }
body.hp-ui .hp-tour-spot {
    position: absolute; top: 0; left: 0; width: 0; height: 0; border-radius: 22px; pointer-events: none;
    box-shadow: 0 0 0 200vmax rgba(4, 23, 15, .58), inset 0 0 0 1.5px rgba(217, 178, 119, .95), 0 0 0 6px rgba(217, 178, 119, .14);
}
body.hp-ui .hp-tour.is-glide .hp-tour-spot { transition: transform .38s var(--hx-ease), width .38s var(--hx-ease), height .38s var(--hx-ease); }

body.hp-ui .hp-tour-card {
    position: absolute; top: 0; left: 0; width: min(360px, calc(100vw - 24px));
    padding: 18px 20px 16px; border-radius: 22px; background: var(--hx-surface); color: var(--hx-ink);
    border: 1px solid var(--hx-line); box-shadow: var(--hx-shadow-lg);
}
body.hp-ui .hp-tour-card:focus, body.hp-ui .hp-tour-card:focus-visible { outline: none !important; box-shadow: var(--hx-shadow-lg) !important; }
body.hp-ui .hp-tour.is-in .hp-tour-card { animation: hpTourIn .32s var(--hx-ease); }
body.hp-ui .hp-tour.is-glide .hp-tour-card { transition: transform .38s var(--hx-ease); }

body.hp-ui .hp-tour-head { display: flex; align-items: center; gap: 12px; }
body.hp-ui .hp-tour-count { margin: 0; font-size: .78rem; font-weight: 700; color: var(--hx-quill-ink); font-variant-numeric: tabular-nums; }
body.hp-ui .hp-tour-dots { display: flex; gap: 4px; margin-inline-end: auto; }
body.hp-ui .hp-tour-dots i { width: 14px; height: 3px; border-radius: 3px; background: var(--hx-line-2); transition: background-color .3s ease; }
body.hp-ui .hp-tour-dots i.is-on { background: var(--hx-quill); }
body.hp-ui .hp-tour-skip {
    border: 0; background: none; padding: 6px 2px; color: var(--hx-ink-2); font: 600 .8rem/1 var(--hx-f-body); cursor: pointer;
}
body.hp-ui .hp-tour-skip:hover { color: var(--hx-ink); text-decoration: underline; text-underline-offset: 3px; }

body.hp-ui .hp-tour-title {
    margin: 12px 0 6px !important; font-family: var(--hx-f-display) !important; font-weight: 400 !important;
    font-size: 1.7rem !important; line-height: 1.08 !important; letter-spacing: -.01em !important; color: var(--hx-ink) !important;
}
html[lang="ar"] body.hp-ui .hp-tour-title { font-weight: 700 !important; font-size: 1.45rem !important; line-height: 1.35 !important; }
body.hp-ui .hp-tour-body { margin: 0; color: var(--hx-ink-2); font-size: .93rem; line-height: 1.6; }

body.hp-ui .hp-tour-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 16px; }
body.hp-ui .hp-tour-docs { margin-inline-end: auto; color: var(--hx-royal-ink); font-size: .84rem; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
body.hp-ui .hp-tour-docs[hidden], body.hp-ui .hp-tour-back[hidden] { display: none; }
body.hp-ui :is(.hp-tour-back, .hp-tour-next) {
    height: 38px; padding: 0 16px; border-radius: 999px; font: 700 .84rem/1 var(--hx-f-body); cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease;
}
body.hp-ui .hp-tour-back { border: 1px solid var(--hx-line-2); background: var(--hx-surface); color: var(--hx-ink); }
body.hp-ui .hp-tour-back:hover { border-color: var(--hx-royal); }
body.hp-ui .hp-tour-next { border: 0; background: var(--hx-btn); color: #fff; min-width: 84px; }
body.hp-ui .hp-tour-next:hover { background: var(--hx-royal-hover); }

body.hp-ui .hp-tour-arrow {
    position: absolute; width: 14px; height: 14px; margin: -7px; background: var(--hx-surface);
    border: 1px solid var(--hx-line); transform: rotate(45deg);
}
body.hp-ui .hp-tour-arrow[hidden] { display: none; }
body.hp-ui .hp-tour-card[data-side="bottom"] .hp-tour-arrow { top: 0; border-right: 0; border-bottom: 0; }
body.hp-ui .hp-tour-card[data-side="top"] .hp-tour-arrow { top: 100%; border-left: 0; border-top: 0; }
body.hp-ui .hp-tour-card[data-side="right"] .hp-tour-arrow { left: 0; border-top: 0; border-right: 0; }
body.hp-ui .hp-tour-card[data-side="left"] .hp-tour-arrow { left: 100%; border-bottom: 0; border-left: 0; }

/* Phones: a bottom sheet, no arrow */
body.hp-ui .hp-tour.is-sheet .hp-tour-card {
    top: auto; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); width: auto; transform: none !important;
    padding: 18px 18px 14px;
}
body.hp-ui .hp-tour.is-sheet.is-in .hp-tour-card { animation-name: hpTourUp; }
body.hp-ui .hp-tour.is-sheet .hp-tour-title { font-size: 1.5rem !important; }
body.hp-ui .hp-tour.is-sheet :is(.hp-tour-back, .hp-tour-next) { height: 42px; }

/* While the tour is open the floating help and scroll buttons step back */
html.hp-tour-open body.hp-ui :is(.hp-help, .back-to-top) { visibility: hidden; }

/* "Take the tour" under the Humanize button */
body.hp-ui .hp-tour-replay { margin: 10px 0 0; text-align: center; }
body.hp-ui .hp-tour-link {
    display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 2px;
    color: var(--hx-royal-ink); font: 700 .8rem/1.2 var(--hx-f-body); cursor: pointer;
}
body.hp-ui .hp-tour-link svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
body.hp-ui .hp-tour-link:hover span { text-decoration: underline; text-underline-offset: 3px; }

html[data-hp-theme="dark"] body.hp-ui .hp-tour-spot { box-shadow: 0 0 0 200vmax rgba(0, 0, 0, .66), inset 0 0 0 1.5px rgba(217, 178, 119, .95), 0 0 0 6px rgba(217, 178, 119, .14); }
html[data-hp-theme="dark"] body.hp-ui .hp-tour-card { background: var(--hx-surface-2); border-color: var(--hx-line-2); }
html[data-hp-theme="dark"] body.hp-ui .hp-tour-arrow { background: var(--hx-surface-2); border-color: var(--hx-line-2); }
html[data-hp-theme="dark"] body.hp-ui .hp-tour-next { color: #fff; }

@keyframes hpTourIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes hpTourUp { from { opacity: 0; translate: 0 16px; } to { opacity: 1; translate: 0 0; } }

@media (prefers-reduced-motion: reduce) {
    body.hp-ui .hp-tour.is-glide :is(.hp-tour-spot, .hp-tour-card) { transition: none; }
    body.hp-ui .hp-tour.is-in .hp-tour-card { animation: none; }
}
@media print { body.hp-ui .hp-tour { display: none; } }
