/* mk-tooltip: the styled replacement for the browser's `title` box.
   Behaviour lives in assets/js/mk-tooltip.js. One bubble is reused for the
   whole page, positioned with `position: fixed`.

   Light theme: near-black bubble (reads on any light surface).
   Dark theme: raised grey bubble with a hairline border, so it separates
   from black cards instead of disappearing into them. */
.mk-tip {
    --mk-tip-bg: #18181b;
    --mk-tip-fg: #fafafa;
    --mk-tip-line: transparent;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2147483000;
    display: none;
    max-width: min(300px, calc(100vw - 16px));
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--mk-tip-bg);
    color: var(--mk-tip-fg);
    border: 1px solid var(--mk-tip-line);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .18), 0 1px 3px rgba(0, 0, 0, .12);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.45;
    letter-spacing: 0;
    text-align: start;
    white-space: normal;
    overflow-wrap: anywhere;
    pointer-events: none;
    opacity: 0;
    transform: translateY(3px);
    transition: opacity .12s ease, transform .12s ease;
}
.mk-tip[data-side="bottom"] { transform: translateY(-3px); }
.mk-tip.is-on { opacity: 1; transform: none; }
html:is([lang="ar"],[lang="ur"]) .mk-tip, html[dir="rtl"] .mk-tip { font-size: 13px; line-height: 1.6; }

.mk-tip__text { white-space: pre-line; }

/* Arrow: a rotated square sharing the bubble's fill and border. */
.mk-tip__arrow {
    position: absolute;
    width: 8px;
    height: 8px;
    margin-left: -4px;
    background: var(--mk-tip-bg);
    border: 1px solid var(--mk-tip-line);
    transform: rotate(45deg);
}
.mk-tip[data-side="top"] .mk-tip__arrow { bottom: -5px; border-top-color: transparent; border-left-color: transparent; }
.mk-tip[data-side="bottom"] .mk-tip__arrow { top: -5px; border-bottom-color: transparent; border-right-color: transparent; }

html.dark .mk-tip {
    --mk-tip-bg: #2a2a2e;
    --mk-tip-fg: #f4f4f5;
    --mk-tip-line: rgba(255, 255, 255, .12);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .55);
}

@media (prefers-reduced-motion: reduce) {
    .mk-tip, .mk-tip[data-side="bottom"] { transition: none; transform: none; }
}

/* ── Same look for the two libraries still in use ─────────────────────────
   Bootstrap 5 tooltips (new bootstrap.Tooltip(...)) and Tippy (the "watch
   tutorial" markers and emotion chips) get the mk-tooltip colours, radius and
   type, so every tooltip on the site reads the same. */
html .tooltip {
    --bs-tooltip-bg: #18181b;
    --bs-tooltip-color: #fafafa;
    --bs-tooltip-opacity: 1;
    --bs-tooltip-max-width: 300px;
    --bs-tooltip-padding-x: 10px;
    --bs-tooltip-padding-y: 6px;
    --bs-tooltip-border-radius: 8px;
    --bs-tooltip-font-size: 12.5px;
    font-family: inherit;
}
html .tooltip .tooltip-inner {
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.45;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
html.dark .tooltip { --bs-tooltip-bg: #2a2a2e; --bs-tooltip-color: #f4f4f5; }
html.dark .tooltip .tooltip-inner { border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 8px 24px rgba(0, 0, 0, .55); }

html .tippy-box:not([data-theme]),
html .tippy-box[data-theme~="light-border"] {
    background: #18181b;
    color: #fafafa;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.45;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
html .tippy-box:not([data-theme]) .tippy-content,
html .tippy-box[data-theme~="light-border"] .tippy-content { padding: 6px 10px; }
html .tippy-box:not([data-theme]) > .tippy-arrow,
html .tippy-box[data-theme~="light-border"] > .tippy-arrow { color: #18181b; }
html .tippy-box[data-theme~="light-border"] > .tippy-arrow::after,
html .tippy-box[data-theme~="light-border"] > svg { display: none; }
html.dark .tippy-box:not([data-theme]),
html.dark .tippy-box[data-theme~="light-border"] {
    background: #2a2a2e;
    color: #f4f4f5;
    border-color: rgba(255, 255, 255, .12);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .55);
}
html.dark .tippy-box:not([data-theme]) > .tippy-arrow,
html.dark .tippy-box[data-theme~="light-border"] > .tippy-arrow { color: #2a2a2e; }
/* light-border paints its arrow white per side; point it at currentColor
   (the arrow colour set above) for whichever side it sits on. */
html .tippy-box[data-theme~="light-border"][data-placement^="top"] > .tippy-arrow::before { border-top-color: currentColor; }
html .tippy-box[data-theme~="light-border"][data-placement^="bottom"] > .tippy-arrow::before { border-bottom-color: currentColor; }
html .tippy-box[data-theme~="light-border"][data-placement^="left"] > .tippy-arrow::before { border-left-color: currentColor; }
html .tippy-box[data-theme~="light-border"][data-placement^="right"] > .tippy-arrow::before { border-right-color: currentColor; }
