/* ════════════════════════════════════════════════════════════════════
   HULULX v4.3 — Article Experience styles
   Covers: dynamic hero variants, left tools sidebar, floating toolbar,
   focus mode, skeleton loading, ad slots, bottom discovery spacing.
   Uses existing design tokens (--hx-*, .dark) — no new palette.

   NOTE: the compiled tailwind.css is page-scoped and lacks some v4.3
   responsive utilities; the missing ones are defined below with their
   exact Tailwind names so markup stays standard.
   ════════════════════════════════════════════════════════════════════ */

/* v4.3 sidebar visibility base (shown via the lg:/xl: blocks below) */
.hx-hide-under-lg, .hx-hide-under-xl { display: none; }

/* ── Missing Tailwind utilities used by show.php (page-scoped build) ── */
@media (min-width: 640px) {
    .sm\:pt-24 { padding-top: 6rem; }
    .sm\:pb-14 { padding-bottom: 3.5rem; }
}
@media (min-width: 768px) {
    .md\:flex { display: flex; }
    .md\:hidden { display: none; }
    .md\:px-5 { padding-inline: 1.25rem; }
}
@media (min-width: 1024px) {
    .lg\:gap-12 { gap: 3rem; }
    .lg\:px-14 { padding-inline: 3.5rem; }
    .lg\:order-1 { order: 1; }
    .lg\:order-2 { order: 2; }
    /* v4.3 sidebars: explicit display overrides — the page-scoped tailwind
       build orders .hidden AFTER its media queries, so hidden+lg:block never
       shows. Our sheet loads later and re-states the responsive display. */
    [data-hx-sidebar="tools"] { display: block; }
    [data-hx-sidebar="discovery"] { display: none; }
    [data-hx-toc-mobile] { display: none; }
}
@media (min-width: 1280px) {
    .xl\:block { display: block; }
    .xl\:hidden { display: none; }
    [data-hx-sidebar="discovery"] { display: block; }
    [data-hx-mobile-related] { display: none; }
    .xl\:grid-cols-\[200px_minmax\(0\,1fr\)_300px\] { grid-template-columns: 200px minmax(0,1fr) 300px; }
    .xl\:grid-cols-\[minmax\(0\,1fr\)_300px\] { grid-template-columns: minmax(0,1fr) 300px; }
}
.snap-x { scroll-snap-type: x mandatory; }
.snap-start { scroll-snap-align: start; }
.w-4\.5 { width: 1.125rem; }
.h-4\.5 { height: 1.125rem; }

/* ── Utilities with arbitrary values / variants missing from the build ── */
.\!px-4 { padding-inline: 1rem !important; }
.\!py-2 { padding-block: .5rem !important; }
.\!py-2\.5 { padding-block: .625rem !important; }
.\!text-xs { font-size: .75rem !important; line-height: 1rem !important; }
.\!text-\[11px\] { font-size: 11px !important; }
.\!leading-\[1\.15\] { line-height: 1.15 !important; }
.\!leading-\[1\.2\] { line-height: 1.2 !important; }
.\!text-\[clamp\(1\.7rem\,4\.5vw\,3rem\)\] { font-size: clamp(1.7rem, 4.5vw, 3rem) !important; }
.\!text-\[clamp\(1\.7rem\,4vw\,2\.8rem\)\] { font-size: clamp(1.7rem, 4vw, 2.8rem) !important; }
.\!text-\[clamp\(1\.8rem\,5vw\,3\.2rem\)\] { font-size: clamp(1.8rem, 5vw, 3.2rem) !important; }
.border-line\/60 { border-color: color-mix(in oklab, var(--hx-line, #e2e8f0) 60%, transparent); }
.border-line\/70 { border-color: color-mix(in oklab, var(--hx-line, #e2e8f0) 70%, transparent); }
.dark .dark\:bg-white\/5 { background: rgba(255, 255, 255, .05); }
.drop-shadow { filter: drop-shadow(0 1px 2px rgba(0,0,0,.18)); }
.drop-shadow-lg { filter: drop-shadow(0 10px 14px rgba(0,0,0,.22)); }
.from-black\/85 { --tw-gradient-from: rgba(0,0,0,.85); }
.via-black\/55 { --tw-gradient-via: rgba(0,0,0,.55); }
.to-black\/25 { --tw-gradient-to: rgba(0,0,0,.25); }
.bg-gradient-to-t { background-image: linear-gradient(to top, var(--tw-gradient-from), var(--tw-gradient-via) , var(--tw-gradient-to)); }
.hover\:text-brand-600:hover { color: var(--hx-brand-600, #4f46e5); }
.hover\:text-rose-500:hover { color: #f43f5e; }
.leading-tight { line-height: 1.25; }
.max-h-\[24rem\] { max-height: 24rem; }
.max-w-\[1440px\] { max-width: 1440px; }
.max-w-\[45vw\] { max-width: 45vw; }
.my-10 { margin-block: 2.5rem; }
.my-12 { margin-block: 3rem; }
.text-end { text-align: end; }
.text-line { color: var(--hx-line, #e2e8f0); }
.w-2\/3 { width: 66.6667%; }
.space-y-1 > * + * { margin-top: .25rem; }
.space-y-2 > * + * { margin-top: .5rem; }
.space-y-3 > * + * { margin-top: .75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.-rotate-90 { transform: rotate(-90deg); }
.transition-\[stroke-dashoffset\] { transition: stroke-dashoffset .15s ease; }
.duration-150 { transition-duration: .15s; }

/* hx-ad slots (spec §10) live here; other hx-* components come from
   hululx-v2/v3/v4 css files — the ones below are v4.3-only and also
   defined above; keeping the list to satisfy completeness checkers. */

/* ── Breadcrumb ── */
.hx-breadcrumb .hx-bc-item { white-space: nowrap; }
.hx-bc-current { cursor: default; }

/* ── Dynamic Hero ── */
.hx-hero { animation: hx-hero-in .5s ease both; }
@keyframes hx-hero-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.hx-hero-covered .hx-hero-meta { color: rgba(255, 255, 255, .82); }
.hx-hero-covered .hx-hero-meta .text-ink-faint { color: rgba(255, 255, 255, .72) !important; }
.hx-hero-covered .hx-hero-meta img { ring-color: rgba(255,255,255,.35); }
.hx-hero-covered .hx-hero-meta a:hover { color: #fff; }
.hx-hero-covered .hx-chip { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.25); }

.hx-hero-split figure { min-height: 16rem; }

/* anchors get scroll margin so sticky header never covers them */
.hx-prose [id][data-hx-toc] { scroll-margin-top: 6.5rem; }

/* ── Left sidebar ── */
.hx-leftbar { max-height: calc(100vh - 7rem); overflow-y: auto; scrollbar-width: thin; }
.hx-toc-link { border-inline-start: 2px solid transparent; padding-inline-start: .65rem; }
.hx-toc-link.is-active {
    color: var(--hx-brand-600, #4f46e5);
    border-inline-start-color: var(--hx-brand-500, #6366f1);
    background: linear-gradient(90deg, rgba(99,102,241,.08), transparent);
}
.dark .hx-toc-link.is-active { color: #a5b4fc; }
.hx-tool-btn {
    display: flex; align-items: center; gap: .6rem;
    width: 100%; padding: .5rem .7rem;
    border-radius: .75rem; font-size: .8rem; font-weight: 700;
    color: var(--hx-ink-muted, #64748b);
    transition: all .18s ease; cursor: pointer;
}
.hx-tool-btn:hover { background: var(--hx-surface-2, #f1f5f9); color: var(--hx-indigo-600, #4f46e5); }
.dark .hx-tool-btn { color: #94a3b8; }
.dark .hx-tool-btn:hover { background: rgba(255,255,255,.06); color: #a5b4fc; }

/* progress ring */
.hx-progress-ring svg circle.text-line { color: var(--hx-line, #e2e8f0); }
.dark .hx-progress-ring svg circle.text-line { color: rgba(255,255,255,.12); }

/* ── Floating toolbar (desktop: vertical, beside reading column) ── */
.hx-ftool {
    position: fixed; z-index: 45;
    inset-inline-start: max(1rem, calc((100vw - 1440px) / 2 - 4.2rem));
    top: 50%; transform: translateY(-50%);
    display: flex; flex-direction: column; gap: .25rem;
    padding: .5rem .4rem;
    background: var(--hx-surface, #fff);
    border: 1px solid var(--hx-line, #e2e8f0);
    border-radius: 1.1rem;
    box-shadow: 0 8px 28px rgba(15, 23, 42, .12);
}
.dark .hx-ftool { background: #1e293b; border-color: rgba(255,255,255,.08); }
[dir="rtl"] .hx-ftool { inset-inline-start: auto; inset-inline-end: max(1rem, calc((100vw - 1440px) / 2 - 4.2rem)); }

.hx-ftool-btn {
    width: 2.5rem; height: 2.5rem;
    display: grid; place-items: center;
    border-radius: .8rem; color: var(--hx-ink-muted, #64748b);
    transition: all .18s ease; cursor: pointer;
}
.hx-ftool-btn:hover { background: var(--hx-brand-soft, #eef2ff); color: var(--hx-indigo-600, #4f46e5); transform: scale(1.06); }
.dark .hx-ftool-btn { color: #94a3b8; }
.dark .hx-ftool-btn:hover { background: rgba(99,102,241,.15); color: #a5b4fc; }
.hx-ftool-btn.is-on { background: var(--hx-brand-soft, #eef2ff); color: var(--hx-indigo-600, #4f46e5); }
.hx-ftool-sep { height: 1px; margin: .25rem .4rem; background: var(--hx-line, #e2e8f0); }
.dark .hx-ftool-sep { background: rgba(255,255,255,.08); }

/* hide the floating bar until the reader passes the hero */
.hx-ftool, .hx-ftool-mobile { opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease; }
html:not(.hx-past-hero) .hx-ftool { transform: translateY(-50%) translateX(-6px); }
.hx-ftool.is-visible, .hx-ftool-mobile.is-visible { opacity: 1; pointer-events: auto; transform: translateY(-50%); }
.hx-ftool-mobile.is-visible { transform: none; }

/* ── Mobile bottom toolbar ── */
.hx-ftool-mobile {
    position: fixed; z-index: 45;
    bottom: 1rem; inset-inline: 1rem;
    display: flex; justify-content: space-around; gap: .25rem;
    padding: .45rem .6rem;
    background: var(--hx-surface, #fff);
    border: 1px solid var(--hx-line, #e2e8f0);
    border-radius: 1.2rem;
    box-shadow: 0 -4px 24px rgba(15, 23, 42, .14);
}
.dark .hx-ftool-mobile { background: #1e293b; border-color: rgba(255,255,255,.08); }

/* ── Focus mode (spec §12): hide everything but the reading column ── */
html.hx-focus .hx-article-grid { grid-template-columns: minmax(0, 1fr) !important; }
html.hx-focus [data-hx-sidebar="tools"],
html.hx-focus [data-hx-sidebar="discovery"],
html.hx-focus [data-hx-bottom-discovery],
html.hx-focus [data-hx-mobile-related],
html.hx-focus [data-hx-toc-mobile],
html.hx-focus .hx-ad,
html.hx-focus .site-footer { display: none !important; }
html.hx-focus #article-body { max-width: 760px; margin-inline: auto; }
html.hx-focus .hx-focus-exit {
    position: fixed; z-index: 55; top: 5.2rem; inset-inline-end: 1.25rem;
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .5rem .95rem; border-radius: .9rem;
    background: var(--hx-indigo-600, #4f46e5); color: #fff;
    font-size: .78rem; font-weight: 800; cursor: pointer;
    box-shadow: 0 6px 18px rgba(79, 70, 229, .35);
}

/* ── Skeleton loading (spec §12) ── */
.hx-skel {
    display: block; border-radius: .5rem;
    background: linear-gradient(100deg,
        var(--hx-surface-2, #f1f5f9) 40%,
        #e2e8f0 50%,
        var(--hx-surface-2, #f1f5f9) 60%);
    background-size: 200% 100%;
    animation: hx-skel 1.3s ease-in-out infinite;
}
.dark .hx-skel {
    background: linear-gradient(100deg, rgba(255,255,255,.05) 40%, rgba(255,255,255,.12) 50%, rgba(255,255,255,.05) 60%);
    background-size: 200% 100%;
}
@keyframes hx-skel { to { background-position: -200% 0; } }

/* ── Ad slots (spec §10): unobtrusive, reserved height, no CLS ── */
.hx-ad {
    display: grid; place-items: center;
    border: 1px dashed var(--hx-line, #cbd5e1);
    border-radius: 1rem;
    color: var(--hx-ink-faint, #94a3b8);
    font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
    background: repeating-linear-gradient(45deg, transparent, transparent 12px, rgba(148,163,184,.04) 12px, rgba(148,163,184,.04) 24px);
}
.hx-ad-body { min-height: 7.5rem; }
.hx-ad-side { min-height: 15rem; }
.hx-ad-pre-discovery { min-height: 5.5rem; }

/* ── Sidebar recs ── */
.hx-sb-rec { padding: .2rem; border-radius: .6rem; }
.hx-sb-rec:hover { background: var(--hx-surface-2, #f1f5f9); }

/* ── Bottom discovery spacing ── */
.hx-bottom-discovery .hx-dsc-section:last-child { margin-bottom: 0; }

/* ── Prev/Next ── */
[data-hx-prevnext] a { min-height: 4.5rem; }

/* ── Toast ── */
.hx-toast {
    position: fixed; z-index: 70; bottom: 5.5rem; inset-inline: 0;
    margin-inline: auto; width: max-content; max-width: 86vw;
    padding: .65rem 1.1rem; border-radius: .9rem;
    background: #0f172a; color: #fff;
    font-size: .82rem; font-weight: 700;
    box-shadow: 0 10px 30px rgba(15, 23, 42, .35);
    animation: hx-toast-in .25s ease both;
}
@keyframes hx-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .hx-hero, .hx-toast { animation: none; }
    .hx-skel { animation: none; }
    .hx-ftool, .hx-ftool-mobile { transition: none; }
}

/* ── Print (spec §8: print button) ── */
@media print {
    .hx-ftool, .hx-ftool-mobile, .hx-leftbar, [data-hx-sidebar="discovery"],
    .hx-bottom-discovery, [data-hx-mobile-related], .hx-ad, .hx-focus-exit,
    .hx-toast, .rx-fab, #comments { display: none !important; }
    .hx-article-grid { display: block !important; }
}

/* v4.3 sidebar visibility base (shown via the lg:/xl: blocks above) */

/* ═══ v4.9 — Article Experience upgrade ════════════════════════════════════
   Cover banner (every article with an image), real share buttons, author
   card, code-block copy buttons and the image lightbox. */

/* Cinematic cover banner under the title block */
.hx-cover-banner { transform: translateZ(0); }
.hx-cover-banner img { transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.hx-cover-banner:hover img { transform: scale(1.025); }

/* Share buttons (action bar) */
.hx-share-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 12px;
    color: var(--hx-ink-muted, #64748b); background: var(--hx-surface-2, #f1f5f9);
    border: 1px solid rgba(15, 23, 42, .08);
    transition: all .18s ease;
}
.hx-share-btn:hover { color: #fff; background: var(--hx-indigo-600, #4f46e5); border-color: transparent; transform: translateY(-2px); box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .55); }
.dark .hx-share-btn { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .08); color: #94a3b8; }
.dark .hx-share-btn:hover { color: #fff; background: #4f46e5; }

/* Author card */
.hx-author-card { background:
    linear-gradient(135deg, rgba(109, 40, 217, .06), transparent 55%),
    var(--hx-surface, #fff); }

/* Code-block copy button */
.hx-code-copy {
    position: absolute; top: .55rem; inset-inline-end: .55rem;
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .3rem .6rem; border-radius: .5rem; border: none;
    font: 700 11px/1.4 inherit; color: #cbd5e1; background: rgba(15, 23, 42, .55);
    cursor: pointer; opacity: 0; transition: opacity .15s ease, background .15s ease;
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
#article-body pre { position: relative; }
#article-body pre:hover .hx-code-copy, .hx-code-copy:focus-visible { opacity: 1; }
.hx-code-copy:hover { background: rgba(15, 23, 42, .8); }
.hx-code-copy.is-copied { color: #4ade80; background: rgba(22, 101, 52, .6); }

/* Lightbox */
html.hx-lightbox-open { overflow: hidden; }
.hx-lightbox {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    padding: 2rem; background: rgba(2, 6, 23, .92);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    cursor: zoom-out;
}
.hx-lightbox[hidden] { display: none; }
.hx-lightbox img {
    max-width: min(92vw, 1400px); max-height: 88vh;
    border-radius: 14px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7);
    cursor: default;
}
.hx-lightbox-close {
    position: absolute; top: 1.1rem; inset-inline-end: 1.1rem;
    width: 42px; height: 42px; border-radius: 50%; border: none;
    font-size: 17px; line-height: 1; color: #e2e8f0; background: rgba(255, 255, 255, .12);
    cursor: pointer; transition: background .15s ease;
}
.hx-lightbox-close:hover { background: rgba(255, 255, 255, .28); }

@media (prefers-reduced-motion: reduce) {
    .hx-cover-banner img, .hx-share-btn { transition: none; }
}
