/* ═══════════════════════════════════════════════════════
   KNOWLEDGE HUB — Stylesheet  (fixed)
   Combines 3D coverflow, glow hover, and
   design-demo aesthetics for SaniBook Knowledge Hub.

   CHANGES vs original:
   ─ Removed broken @property --hov / CSS-mask border approach
   ─ Replaced .kh-card::after with universal border + box-shadow fade
   ─ Added pointer-events:none on card-child elements so the card
     element itself receives all pointer events (fixes orbit dead-spot)
   ─ Simplified .kh-book-body::after
═══════════════════════════════════════════════════════ */

:root {
    --kh-navy: #060e1f;
    --kh-navy2: #0a1628;
    --kh-teal: #00d4c8;
    --kh-teal-dark: #00897b;
    --kh-orange: #ff8c00;
    --kh-orange-light: #ffa733;
    --kh-green: #2ecc71;
    --kh-panel-bg: rgba(0, 30, 60, 0.85);
    --kh-glow: 0 0 20px rgba(0, 212, 200, 0.4);
    --kh-glow-orange: 0 0 20px rgba(255, 140, 0, 0.4);
}


/* ── BACKGROUND SCENE ── */

.kh-bg-scene {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: radial-gradient(ellipse 90% 55% at 50% -5%, rgba(0, 130, 140, 0.2) 0%, transparent 65%), radial-gradient(ellipse 45% 35% at 85% 85%, rgba(0, 60, 120, 0.18) 0%, transparent 60%), linear-gradient(180deg, #060e1f 0%, #081422 100%);
}

.kh-bg-scene::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(0, 212, 200, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 212, 200, 0.035) 1px, transparent 1px);
    background-size: 52px 52px;
}

.kh-bg-scene::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 220px;
    background: linear-gradient(to top, rgba(6, 14, 31, 0.9), transparent);
}


/* ── PAGE SYSTEM ── */

.kh-page {
    position: relative;
    z-index: 1;
    display: none;
    min-height: 100vh;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
}

.kh-page.active {
    display: flex;
}


/* ── ANIMATIONS ── */

@keyframes khFadeUp {
    from {
        opacity: 0;
        transform: translateY(28px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes khFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes khCardEntrance {
    0% {
        opacity: 0;
        transform: translate3d(var(--kh-tx, 0), 40px, var(--kh-tz, 0)) rotateY(var(--kh-ry, 0));
    }
    100% {
        opacity: 1;
        transform: translate3d(var(--kh-tx, 0), 0, var(--kh-tz, 0)) rotateY(var(--kh-ry, 0));
    }
}

@keyframes khBookFloat {
    0%,
    100% {
        transform: translateY(0px) rotate(-0.3deg);
    }
    50% {
        transform: translateY(-12px) rotate(0.3deg);
    }
}

@keyframes khSpin {
    to {
        transform: rotate(360deg);
    }
}


/* ── HOME (FIRST VIEW) ── */

#kh-home {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 20px 24px;
    gap: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}


/* Top Bar */

.kh-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1200px;
    margin-bottom: clamp(16px, 3vh, 32px);
    opacity: 0;
    animation: khFadeUp 0.7s 0.05s forwards;
}

.kh-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.kh-brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--kh-teal-dark), var(--kh-teal));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: var(--kh-glow);
    overflow: hidden;
}

.kh-brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.kh-brand-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.kh-brand-sub {
    font-size: 10px;
    color: rgba(0, 212, 200, 0.6);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.kh-back-home {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 212, 200, 0.08);
    border: 1px solid rgba(0, 212, 200, 0.25);
    border-radius: 30px;
    padding: 8px 20px;
    cursor: pointer;
    color: var(--kh-teal);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    text-decoration: none;
    transition: background 0.2s;
    white-space: nowrap;
}

.kh-back-home:hover {
    background: rgba(0, 212, 200, 0.18);
    color: var(--kh-teal);
}


/* Heading */

.kh-heading {
    text-align: center;
    margin-bottom: clamp(24px, 5vh, 48px);
    opacity: 0;
    animation: khFadeUp 0.7s 0.15s forwards;
}

.kh-heading h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(20px, 3.5vw, 38px);
    font-weight: 700;
    line-height: 1.15;
    color: #fff;
    letter-spacing: 1px;
}

.kh-heading h1 .kh-accent {
    color: var(--kh-teal);
}

.kh-heading p {
    margin-top: 10px;
    font-size: 12px;
    letter-spacing: 3px;
    color: rgba(200, 230, 240, 0.45);
    text-transform: uppercase;
}


/* ── 3D COVERFLOW ── */

.kh-coverflow-scene {
    perspective: 900px;
    width: 100%;
    max-width: 1400px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    overflow: visible;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: default;
    flex: 1;
    min-height: 0;
}

.kh-coverflow-track {
    position: relative;
    transform-style: preserve-3d;
    width: 100%;
    height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* ── CARD ── */

.kh-card {
    position: absolute;
    width: 280px;
    height: 380px;
    flex-shrink: 0;
    background: linear-gradient(160deg, #0e2540 0%, #091b30 100%);
    border-radius: 20px;
    /*
   * FIX: keep the base border but use transparent colour — the ::after
   * pseudo-element will provide the coloured glow border on hover.
   * Using a 3px transparent border (instead of the original 3px coloured one)
   * lets ::after sit flush without layout shift.
   */
    border: 3px solid rgba(255, 255, 255, 0.06);
    padding: 36px 20px 30px;
    cursor: pointer;
    text-align: center;
    overflow: visible;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transition: box-shadow 0.35s ease, border-color 0.35s ease, transform 0.45s cubic-bezier(.34, 1.56, .64, 1);
    opacity: 0;
    animation: khCardEntrance 0.65s forwards;
    -webkit-box-reflect: below 14px linear-gradient(transparent, rgba(255, 255, 255, 0.06));
}


/* ── Colour variants ── */

.kh-card[data-color="teal"] {
    --cc: #2dd4bf;
    --cb: linear-gradient(135deg, #005050, #008888);
}

.kh-card[data-color="orange"] {
    --cc: #fb923c;
    --cb: linear-gradient(135deg, #5a2a00, #9a5200);
}

.kh-card[data-color="blue"] {
    --cc: #60a5fa;
    --cb: linear-gradient(135deg, #1a3a7a, #2a5498);
}

.kh-card[data-color="red"] {
    --cc: #f87171;
    --cb: linear-gradient(135deg, #5a1a1a, #9a3232);
}

.kh-card[data-color="pink"] {
    --cc: #f472b6;
    --cb: linear-gradient(135deg, #5a1a3a, #9a3268);
}

.kh-card[data-color="purple"] {
    --cc: #a78bfa;
    --cb: linear-gradient(135deg, #3a1a5a, #6a3a9a);
}


/* ── ::before — radial ambient glow behind the card ── */

.kh-card::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 28px;
    background: radial-gradient( ellipse 80% 60% at 50% 20%, color-mix(in srgb, var(--cc, #2dd4bf) 35%, transparent), transparent 70%);
    opacity: 0;
    transition: opacity 0.35s ease;
    z-index: -1;
    pointer-events: none;
    /* Must be visible so the glow shows even when the card is 3D-rotated */
    backface-visibility: visible;
    -webkit-backface-visibility: visible;
}

.kh-card:hover::before,
.kh-card.kh-force-hover::before {
    opacity: 1;
}


/*
 * FIX: ::after — universal glowing border
 *
 * The original approach used @property --hov + CSS mask compositing
 * (conic-gradient + "subtract" mode) which is Chrome-Houdini–only and
 * silently fails in Firefox/Safari and certain Chrome builds.
 *
 * Replacement: a simple transparent border that transitions to the card's
 * accent colour with a matching box-shadow glow.  Works in every browser.
 */

.kh-card::after {
    content: '';
    position: absolute;
    inset: -3px;
    /* 3 px clearance so border sits just outside the card */
    border-radius: 24px;
    border: 2px solid var(--cc, #2dd4bf);
    box-shadow: 0 0 0 transparent, inset 0 0 0 transparent;
    opacity: 0;
    transition: opacity 0.35s ease, box-shadow 0.35s ease;
    z-index: 2;
    pointer-events: none;
    backface-visibility: visible;
    -webkit-backface-visibility: visible;
}

.kh-card:hover::after,
.kh-card.kh-force-hover::after,
.kh-card:focus-within::after {
    opacity: 1;
    box-shadow: 0 0 14px color-mix(in srgb, var(--cc, #2dd4bf) 65%, transparent), 0 0 30px color-mix(in srgb, var(--cc, #2dd4bf) 35%, transparent), inset 0 0 8px color-mix(in srgb, var(--cc, #2dd4bf) 12%, transparent);
}


/* Hover lift — keep in sync with JS transform */

.kh-card:hover {
    transform: translate3d(var(--kh-tx, 0), -14px, var(--kh-tz, -20px)) rotateY(var(--kh-ry, 0)) scale(1.06) !important;
    border-color: var(--cc, #2dd4bf);
    box-shadow: 0 0 32px color-mix(in srgb, var(--cc, #2dd4bf) 55%, transparent), 0 0 8px color-mix(in srgb, var(--cc, #2dd4bf) 35%, transparent), 0 22px 55px rgba(0, 0, 0, 0.6);
    z-index: 10;
}

.kh-card.kh-force-hover {
    transform: translate3d(var(--kh-tx, 0), -14px, var(--kh-tz, -20px)) rotateY(var(--kh-ry, 0)) scale(1.06) !important;
    border-color: var(--cc, #2dd4bf);
    box-shadow: 0 0 32px color-mix(in srgb, var(--cc, #2dd4bf) 55%, transparent), 0 0 8px color-mix(in srgb, var(--cc, #2dd4bf) 35%, transparent), 0 22px 55px rgba(0, 0, 0, 0.6);
    z-index: 3000 !important;
}


/*
 * FIX: pointer-events on card children
 *
 * Card text / icon children were consuming pointer events, which meant that
 * at certain ring angles the browser would try to hit-test a child that was
 * partially obscured by another card — causing the "dead spot" on the orbit.
 * Setting pointer-events:none on every inner element forces all hits to land
 * on the card element itself, where the browser uses true 3D Z-ordering.
 */

.kh-card-step,
.kh-card-icon,
.kh-card-title,
.kh-card-sub,
.kh-card-num,
.kh-card-arrow {
    pointer-events: none;
}


/* Card internals */

.kh-card-step {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    letter-spacing: 2px;
    color: rgba(180, 210, 230, 0.4);
    text-transform: uppercase;
    margin-bottom: 20px;
}

.kh-card-icon {
    width: 94px;
    height: 94px;
    border-radius: 24px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    background: var(--cb, linear-gradient(135deg, #005050, #008888));
    position: relative;
    transition: transform 0.3s;
    color: #fff;
}

.kh-card:hover .kh-card-icon,
.kh-card.kh-force-hover .kh-card-icon {
    transform: scale(1.1) rotate(-2deg);
}

.kh-card-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #fff;
    line-height: 1.4;
    margin-bottom: 12px;
}

.kh-card-sub {
    font-size: 13px;
    color: rgba(180, 215, 230, 0.5);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1.5;
}

.kh-card-arrow {
    position: absolute;
    bottom: 24px;
    right: 24px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--cc, #2dd4bf) 40%, transparent);
    background: color-mix(in srgb, var(--cc, #2dd4bf) 10%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--cc, #2dd4bf);
    transition: background 0.2s;
}

.kh-card:hover .kh-card-arrow,
.kh-card.kh-force-hover .kh-card-arrow {
    background: color-mix(in srgb, var(--cc, #2dd4bf) 25%, transparent);
}

.kh-card-num {
    position: absolute;
    top: 18px;
    left: 20px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    color: var(--cc, #2dd4bf);
    font-weight: 700;
    opacity: 0.7;
}


/* Footer */

.kh-footer {
    margin-top: 44px;
    display: flex;
    align-items: center;
    gap: 14px;
    opacity: 0;
    animation: khFadeUp 0.7s 0.8s forwards;
}

.kh-footer-line {
    width: 80px;
    height: 1px;
    background: rgba(0, 212, 200, 0.18);
}

.kh-footer-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 9px;
    letter-spacing: 3px;
    color: rgba(0, 212, 200, 0.35);
    text-transform: uppercase;
}


/* ═══════════════════════════════════
   DETAIL PAGE (Second View)
═══════════════════════════════════ */

#kh-detail {
    flex-direction: column;
    align-items: stretch;
    min-height: 100vh;
    --kh-detail-accent: var(--kh-teal);
    --kh-detail-accent-soft: rgba(0, 212, 200, 0.28);
    --kh-detail-accent-shadow: rgba(0, 212, 200, 0.34);
    --kh-detail-accent-glow: rgba(0, 212, 200, 0.45);
}

#kh-detail[data-color="teal"] {
    --kh-detail-accent: #2dd4bf;
    --kh-detail-accent-soft: rgba(45, 212, 191, 0.26);
    --kh-detail-accent-shadow: rgba(45, 212, 191, 0.34);
    --kh-detail-accent-glow: rgba(45, 212, 191, 0.5);
}

#kh-detail[data-color="orange"] {
    --kh-detail-accent: #fb923c;
    --kh-detail-accent-soft: rgba(251, 146, 60, 0.25);
    --kh-detail-accent-shadow: rgba(251, 146, 60, 0.33);
    --kh-detail-accent-glow: rgba(251, 146, 60, 0.48);
}

#kh-detail[data-color="blue"] {
    --kh-detail-accent: #60a5fa;
    --kh-detail-accent-soft: rgba(96, 165, 250, 0.26);
    --kh-detail-accent-shadow: rgba(96, 165, 250, 0.35);
    --kh-detail-accent-glow: rgba(96, 165, 250, 0.5);
}

#kh-detail[data-color="red"] {
    --kh-detail-accent: #f87171;
    --kh-detail-accent-soft: rgba(248, 113, 113, 0.24);
    --kh-detail-accent-shadow: rgba(248, 113, 113, 0.34);
    --kh-detail-accent-glow: rgba(248, 113, 113, 0.46);
}

#kh-detail[data-color="pink"] {
    --kh-detail-accent: #f472b6;
    --kh-detail-accent-soft: rgba(244, 114, 182, 0.24);
    --kh-detail-accent-shadow: rgba(244, 114, 182, 0.34);
    --kh-detail-accent-glow: rgba(244, 114, 182, 0.46);
}

#kh-detail[data-color="purple"] {
    --kh-detail-accent: #a78bfa;
    --kh-detail-accent-soft: rgba(167, 139, 250, 0.25);
    --kh-detail-accent-shadow: rgba(167, 139, 250, 0.34);
    --kh-detail-accent-glow: rgba(167, 139, 250, 0.48);
}

.kh-detail-topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 36px;
    border-bottom: 1px solid rgba(0, 212, 200, 0.12);
    background: rgba(6, 14, 31, 0.82);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.kh-detail-back {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 212, 200, 0.08);
    border: 1px solid rgba(0, 212, 200, 0.25);
    border-radius: 30px;
    padding: 8px 20px;
    cursor: pointer;
    color: var(--kh-teal);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    transition: background 0.2s;
    white-space: nowrap;
    text-decoration: none;
    background: none;
    border: 1px solid rgba(0, 212, 200, 0.25);
}

.kh-detail-back:hover {
    background: rgba(0, 212, 200, 0.18);
    color: var(--kh-teal);
}

.kh-detail-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(12px, 1.8vw, 17px);
    color: #fff;
    flex: 1;
}

.kh-detail-title .kh-accent {
    color: var(--kh-teal);
}

.kh-detail-badge {
    font-size: 9px;
    letter-spacing: 2px;
    color: rgba(180, 220, 230, 0.35);
    text-transform: uppercase;
    white-space: nowrap;
}


/* Arena */

.kh-detail-arena {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px 24px 48px;
    gap: 0;
}


/* Panel columns */

.kh-det-col {
    flex: 0 0 260px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.kh-det-panel {
    background: var(--kh-panel-bg);
    border: 1.5px solid rgba(0, 212, 200, 0.2);
    border-radius: 20px;
    padding: 18px 20px 16px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    transition: transform 0.26s, box-shadow 0.26s, border-color 0.26s;
    opacity: 0;
    animation: khFadeUp 0.55s forwards;
    text-decoration: none;
    display: block;
    color: inherit;
}

.kh-det-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(0, 212, 200, 0.08), transparent 60%);
    opacity: 0;
    transition: opacity 0.26s;
}

.kh-det-panel:hover::before {
    opacity: 1;
}

.kh-det-panel:hover {
    transform: translateY(-4px) scale(1.025);
    border-color: var(--kh-teal);
    box-shadow: var(--kh-glow), 0 10px 32px rgba(0, 0, 0, 0.4);
    color: inherit;
}

.kh-det-panel-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--kh-teal);
    margin-bottom: 10px;
}

.kh-det-icons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.kh-d-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(0, 212, 200, 0.1);
    border: 1px solid rgba(0, 212, 200, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--kh-teal);
    transition: background 0.2s;
}

.kh-det-panel:hover .kh-d-icon {
    background: rgba(0, 212, 200, 0.18);
}

.kh-d-arr {
    font-size: 14px;
    color: var(--kh-detail-accent);
    flex-shrink: 0;
}

.kh-det-panel-sub {
    font-size: 9px;
    color: rgba(200, 230, 240, 0.45);
    margin-top: 8px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    line-height: 1.5;
}


/* Connectors */

.kh-det-connector {
    flex: 1;
    height: 2px;
    min-width: 18px;
    max-width: 48px;
    background: linear-gradient(90deg, rgba(255, 140, 0, 0.5), rgba(0, 212, 200, 0.3));
    position: relative;
    align-self: center;
}

.kh-det-connector.rev {
    background: linear-gradient(90deg, rgba(0, 212, 200, 0.3), rgba(255, 140, 0, 0.5));
}


/* Center Parallax Card */

.kh-center-wrap {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    min-width: 340px;
}

.kh-px-card-wrap {
    margin: 10px;
    width: 320px;
    transform: perspective(1200px);
    transform-style: preserve-3d;
    cursor: pointer;
}

.kh-px-card {
    position: relative;
    width: 320px;
    height: 320px;
    background-color: #031428;
    overflow: hidden;
    border-radius: 18px;
    box-shadow: rgba(0, 0, 0, 0.66) 0 30px 60px 0, inset rgba(0, 212, 200, 0.22) 0 0 0 2px, inset rgba(255, 255, 255, 0.08) 0 0 0 3px;
    transition: 0.8s cubic-bezier(0.445, 0.05, 0.55, 0.95);
    transform-style: preserve-3d;
}

.kh-px-card-bg {
    opacity: 0.52;
    position: absolute;
    top: -20px;
    left: -20px;
    width: 100%;
    height: 100%;
    padding: 20px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    transition: 0.8s cubic-bezier(0.445, 0.05, 0.55, 0.95), opacity 4s 0.8s cubic-bezier(0.445, 0.05, 0.55, 0.95);
    pointer-events: none;
}

.kh-px-card-wrap[data-color="teal"] .kh-px-card-bg {
    background-image: radial-gradient(circle at 20% 15%, rgba(44, 211, 191, 0.45) 0%, rgba(44, 211, 191, 0.12) 42%, transparent 65%), linear-gradient(135deg, #083f37 0%, #0a2f2f 55%, #021b2b 100%);
}

.kh-px-card-wrap[data-color="orange"] .kh-px-card-bg {
    background-image: radial-gradient(circle at 20% 15%, rgba(255, 159, 67, 0.48) 0%, rgba(255, 159, 67, 0.13) 42%, transparent 66%), linear-gradient(135deg, #503018 0%, #2d2218 55%, #0a1e32 100%);
}

.kh-px-card-wrap[data-color="blue"] .kh-px-card-bg {
    background-image: radial-gradient(circle at 20% 15%, rgba(96, 165, 250, 0.5) 0%, rgba(96, 165, 250, 0.12) 45%, transparent 66%), linear-gradient(135deg, #1a3a72 0%, #16345f 52%, #081726 100%);
}

.kh-px-card-wrap[data-color="red"] .kh-px-card-bg {
    background-image: radial-gradient(circle at 20% 15%, rgba(248, 113, 113, 0.48) 0%, rgba(248, 113, 113, 0.12) 45%, transparent 68%), linear-gradient(135deg, #5a2525 0%, #342129 55%, #0a1a2c 100%);
}

.kh-px-card-wrap[data-color="pink"] .kh-px-card-bg {
    background-image: radial-gradient(circle at 20% 15%, rgba(244, 114, 182, 0.52) 0%, rgba(244, 114, 182, 0.12) 44%, transparent 67%), linear-gradient(135deg, #52234e 0%, #332145 55%, #081b2e 100%);
}

.kh-px-card-wrap[data-color="purple"] .kh-px-card-bg {
    background-image: radial-gradient(circle at 20% 15%, rgba(167, 139, 250, 0.5) 0%, rgba(167, 139, 250, 0.12) 44%, transparent 67%), linear-gradient(135deg, #3d2b6f 0%, #2c234f 52%, #081b2e 100%);
}

.kh-px-card-info {
    padding: 22px;
    position: absolute;
    inset: 0;
    color: #fff;
    transform: translateY(40%);
    transition: 0.6s 1.6s cubic-bezier(0.215, 0.61, 0.355, 1);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.kh-px-card-info * {
    position: relative;
    z-index: 1;
}

.kh-px-card-info::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(to bottom, transparent 8%, rgba(2, 10, 22, 0.68) 62%, rgba(2, 10, 22, 0.9) 100%);
    opacity: 0;
    transform: translateY(100%);
    transition: 5s 1s cubic-bezier(0.445, 0.05, 0.55, 0.95);
}

.kh-px-card-wrap:hover .kh-px-card-info {
    transform: translateY(0);
}

.kh-px-card-wrap:hover .kh-px-card-info p {
    opacity: 1;
}

.kh-px-card-wrap:hover .kh-px-card-info,
.kh-px-card-wrap:hover .kh-px-card-info p {
    transition: 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.kh-px-card-wrap:hover .kh-px-card-info::after {
    transition: 3s cubic-bezier(0.23, 1, 0.32, 1);
    opacity: 1;
    transform: translateY(0);
}

.kh-px-card-wrap:hover .kh-px-card-bg {
    transition: 0.5s cubic-bezier(0.23, 1, 0.32, 1), opacity 4s cubic-bezier(0.23, 1, 0.32, 1);
    opacity: 0.8;
}

.kh-px-card-wrap:hover .kh-px-card {
    transition: 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: rgba(0, 0, 0, 0.6) 0 34px 66px 0, inset rgba(0, 212, 200, 0.34) 0 0 0 2px, inset rgba(255, 255, 255, 0.12) 0 0 0 3px;
}

.kh-book-badge {
    position: absolute;
    background: linear-gradient(135deg, var(--kh-teal-dark), var(--kh-teal));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--kh-glow);
    color: #fff;
}

.kh-book-badge.kh-px-badge {
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: 52px;
    height: 52px;
    font-size: 20px;
}

.kh-px-eyebrow {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    letter-spacing: 3px;
    color: var(--kh-teal);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.kh-px-title {
    margin: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 40px;
    font-weight: 700;
    line-height: 1;
    color: #f5fbff;
    text-shadow: rgba(0, 0, 0, 0.45) 0 10px 10px;
}

.kh-px-sub {
    margin-top: 12px;
    margin-bottom: 0;
    opacity: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    line-height: 1.45;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: rgba(229, 241, 247, 0.9);
    text-shadow: black 0 2px 3px;
    transition: 0.6s 1.6s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.kh-px-sub #kh-book-cat {
    color: var(--kh-detail-accent);
    font-weight: 700;
}

.kh-book-explore-btn {
    margin-top: 22px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(90deg, rgba(10, 42, 74, 0.88), rgba(14, 60, 92, 0.88));
    border: 1.5px solid var(--kh-detail-accent);
    border-radius: 30px;
    padding: 10px 22px;
    cursor: pointer;
    color: var(--kh-detail-accent);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 9px;
    letter-spacing: 2px;
    text-transform: uppercase;
    box-shadow: 0 0 18px var(--kh-detail-accent-shadow);
    text-decoration: none;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.kh-book-explore-btn:hover {
    background: linear-gradient(90deg, rgba(14, 60, 92, 0.94), rgba(18, 90, 122, 0.94));
    transform: scale(1.04);
    color: var(--kh-detail-accent);
    box-shadow: 0 0 24px var(--kh-detail-accent-glow);
}

.kh-beb-circle {
    width: 24px;
    height: 24px;
    background: var(--kh-detail-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--kh-navy);
    font-size: 12px;
    font-weight: 700;
}


/* Page counter */

.kh-pg-counter {
    position: fixed;
    bottom: 20px;
    right: 26px;
    z-index: 15;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 10px;
    letter-spacing: 2px;
    color: rgba(0, 212, 200, 0.38);
}


/* ── TRANSITION OVERLAY ── */

.kh-transition-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 14, 31, 0.95);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.kh-transition-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.kh-transition-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(0, 212, 200, 0.15);
    border-top: 3px solid var(--kh-teal);
    border-radius: 50%;
    animation: khSpin 0.8s linear infinite;
}


/* ── TOAST ── */

.kh-toast {
    position: fixed;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(10, 30, 50, 0.92);
    border: 1px solid rgba(0, 212, 200, 0.35);
    backdrop-filter: blur(12px);
    border-radius: 14px;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s, transform 0.35s;
    font-family: 'Space Grotesk', sans-serif;
}

.kh-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.kh-toast i {
    color: var(--kh-teal);
    font-size: 18px;
    flex-shrink: 0;
}

.kh-toast span {
    color: rgba(220, 240, 245, 0.85);
    font-size: 13px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}


/* ═══════════════════════════════════
   RESPONSIVE
═══════════════════════════════════ */


/* Tablet */

@media (max-width: 1100px) {
    .kh-coverflow-scene {
        perspective: 800px;
    }
    .kh-coverflow-track {
        height: 380px;
    }
    .kh-card {
        width: 230px;
        height: 320px;
        padding: 28px 16px 22px;
    }
    .kh-card-icon {
        width: 76px;
        height: 76px;
        font-size: 32px;
        margin: 0 auto 18px;
    }
    .kh-card-title {
        font-size: 14px;
    }
    .kh-card-sub {
        font-size: 12px;
    }
}


/* Medium tablets and large phones */

@media (max-width: 840px) {
    .kh-detail-arena {
        flex-direction: column;
        align-items: center;
        gap: 20px;
        padding: 24px 16px 40px;
    }
    .kh-det-col {
        flex-direction: row;
        flex: none;
        width: 100%;
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }
    .kh-det-panel {
        flex: 1 1 200px;
        min-width: 160px;
        max-width: 280px;
    }
    .kh-det-connector {
        display: none;
    }
    .kh-center-wrap {
        order: -1;
    }
    .kh-detail-topbar {
        padding: 14px 16px;
        gap: 10px;
        flex-wrap: wrap;
    }
    .kh-detail-badge {
        display: none;
    }
}


/* Mobile */

@media (max-width: 768px) {
    .kh-coverflow-scene {
        perspective: 700px;
    }
    .kh-coverflow-track {
        height: 320px;
    }
    .kh-card {
        width: 200px;
        height: 280px;
        padding: 24px 14px 18px;
    }
    .kh-card-num {
        top: 14px;
        left: 16px;
        font-size: 13px;
    }
    .kh-card-step {
        font-size: 11px;
        margin-bottom: 14px;
    }
    .kh-card-icon {
        width: 60px;
        height: 60px;
        font-size: 26px;
        margin: 0 auto 14px;
        border-radius: 16px;
    }
    .kh-card-title {
        font-size: 12px;
        margin-bottom: 8px;
    }
    .kh-card-sub {
        font-size: 10px;
    }
    .kh-card-arrow {
        width: 28px;
        height: 28px;
        bottom: 16px;
        right: 16px;
        font-size: 12px;
    }
    .kh-heading {
        margin-bottom: 36px;
    }
    .kh-center-wrap {
        min-width: 300px;
    }
    .kh-px-card-wrap,
    .kh-px-card {
        width: 280px;
        height: 280px;
    }
    .kh-px-title {
        font-size: 34px;
    }
    .kh-px-sub {
        font-size: 10px;
    }
    .kh-toast {
        padding: 12px 20px;
        bottom: 24px;
    }
    .kh-toast span {
        font-size: 12px;
    }
}


/* Small phones */

@media (max-width: 480px) {
    #kh-home {
        padding: 20px 10px 30px;
    }
    .kh-heading h1 {
        font-size: 18px;
    }
    .kh-coverflow-scene {
        perspective: 500px;
    }
    .kh-coverflow-track {
        height: 280px;
    }
    .kh-card {
        width: 160px;
        height: 230px;
        padding: 20px 12px 14px;
        border-radius: 14px;
    }
    .kh-card-num {
        top: 10px;
        left: 12px;
        font-size: 11px;
    }
    .kh-card-step {
        font-size: 9px;
        margin-bottom: 10px;
    }
    .kh-card-icon {
        width: 46px;
        height: 46px;
        font-size: 20px;
        margin: 0 auto 10px;
        border-radius: 12px;
    }
    .kh-card-title {
        font-size: 10px;
        margin-bottom: 4px;
    }
    .kh-card-sub {
        font-size: 8px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .kh-card-arrow {
        width: 22px;
        height: 22px;
        bottom: 12px;
        right: 12px;
        font-size: 10px;
    }
    .kh-back-home {
        padding: 6px 14px;
        font-size: 11px;
    }
    .kh-footer {
        margin-top: 28px;
    }
    .kh-footer-line {
        width: 40px;
    }
    .kh-toast {
        padding: 10px 16px;
        border-radius: 10px;
        gap: 8px;
    }
    .kh-toast i {
        font-size: 15px;
    }
    .kh-toast span {
        font-size: 11px;
        white-space: normal;
    }
    .kh-det-panel {
        flex: 1 1 140px;
        min-width: 130px;
        padding: 14px 14px 12px;
    }
    .kh-det-panel-title {
        font-size: 10px;
    }
    .kh-center-wrap {
        min-width: 240px;
    }
    .kh-px-card-wrap,
    .kh-px-card {
        width: 220px;
        height: 220px;
    }
    .kh-book-badge.kh-px-badge {
        width: 44px;
        height: 44px;
        font-size: 16px;
        top: 12px;
    }
    .kh-px-eyebrow {
        font-size: 9px;
        letter-spacing: 2px;
    }
    .kh-px-title {
        font-size: 26px;
    }
    .kh-px-sub {
        font-size: 9px;
        letter-spacing: 1px;
    }
    .kh-book-explore-btn {
        padding: 8px 16px;
        font-size: 8px;
    }
}