/* ==========================================================================
   JUSOOR LABS — VIRTUAL EXPERIMENTS PAGE
   "Make science feel alive"

   Colour: the official identity only — primary blue #2C66FE, cyan #38C0EF,
   white. Ink + muted neutrals are for type only; darker/lighter steps of the
   blue and cyan are used for depth inside illustrations.
   Motion: entrance → one discovery at a time → quiet idle. Everything stops
   for prefers-reduced-motion and pauses when off screen.
   ========================================================================== */

.xp {
    --xp-blue: #2C66FE;
    --xp-blue-600: #1F55E6;
    --xp-blue-700: #1A47C9;
    --xp-cyan: #38C0EF;
    --xp-white: #FFFFFF;
    --xp-blue-soft: #EEF3FF;
    --xp-cyan-soft: #E6F7FD;
    --xp-ink: #14254A;
    --xp-muted: #5B6B86;
    --xp-line: #E3EBF7;
    --xp-gradient: linear-gradient(120deg, #2C66FE 0%, #2C66FE 34%, #3B8EF6 68%, #38C0EF 100%);
    --xp-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --xp-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --xp-shadow-card: 0 1px 2px rgba(20, 37, 74, 0.05), 0 14px 34px -22px rgba(20, 37, 74, 0.28);
    --xp-shadow-lift: 0 2px 4px rgba(20, 37, 74, 0.04), 0 30px 54px -26px rgba(20, 37, 74, 0.38);

    font-family: var(--jl-font);
    color: var(--xp-ink);
    font-size: var(--jl-fs-body);
    line-height: var(--jl-lh-body);
    background: var(--xp-white);
    overflow-x: clip;
}

.xp *,
.xp *::before,
.xp *::after {
    box-sizing: border-box;
}

.xp :where(h1, h2, h3, p, ul, ol, dl, dd, dt, figure) {
    margin: 0;
    padding: 0;
}

.xp :where(h1, h2, h3) {
    font-family: var(--jl-font-display);
    color: var(--xp-ink);
    text-wrap: balance;
}

.xp :where(ul, ol) {
    list-style: none;
}

.xp :where(button, input, select) {
    font-family: inherit;
}

.xp :where(a, button, input, select):focus-visible {
    outline: 3px solid var(--xp-blue);
    outline-offset: 3px;
}

.xp a:hover {
    text-decoration: none;
}

.xl-container {
    width: 100%;
    max-width: calc(var(--jl-max) + var(--jl-gutter) * 2);
    margin-inline: auto;
    padding-inline: var(--jl-gutter);
}

.xl-sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

[dir="rtl"] .xp-flip {
    transform: scaleX(-1);
}

/* ── Buttons ─────────────────────────────────────────────── */
.xp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 54px;
    padding: 0 1.625rem;
    border: 1.5px solid transparent;
    border-radius: 999px;
    font-family: var(--jl-font-display);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.35s var(--xp-spring), box-shadow 0.3s ease, background-color 0.25s ease, color 0.25s ease;
}

.xp-btn i {
    font-size: 1.25rem;
    transition: transform 0.35s var(--xp-spring);
}

.xp-btn--light {
    background: var(--xp-white);
    color: var(--xp-blue);
    box-shadow: 0 10px 26px -12px rgba(10, 30, 90, 0.55);
}

.xp-btn--light:hover {
    color: var(--xp-blue-600);
    transform: translateY(-2px);
    box-shadow: 0 16px 32px -14px rgba(10, 30, 90, 0.6);
}

.xp-btn--light:hover i {
    transform: translateY(2px);
}

.xp-btn--light:hover .bx-right-arrow-alt {
    transform: translateX(3px);
}

[dir="rtl"] .xp-btn--light:hover .bx-right-arrow-alt {
    transform: scaleX(-1) translateX(3px);
}

.xp-btn--ghost {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.55);
    color: var(--xp-white);
}

.xp-btn--ghost:hover {
    color: var(--xp-white);
    background: rgba(255, 255, 255, 0.18);
    border-color: var(--xp-white);
    transform: translateY(-2px);
}

.xp-btn--primary {
    background: var(--xp-blue);
    color: var(--xp-white);
}

.xp-btn--primary:hover {
    background: var(--xp-blue-600);
    color: var(--xp-white);
}

/* ── Section headings ────────────────────────────────────── */
.xp-head {
    max-width: 720px;
}

.xp-head--center {
    margin-inline: auto;
    text-align: center;
}

.xp-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--xp-blue);
    font-size: 0.8125rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.xp-eyebrow::before {
    content: "";
    width: 22px;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--xp-blue), var(--xp-cyan));
}

[dir="rtl"] .xp-eyebrow {
    letter-spacing: 0;
    font-size: 0.9375rem;
}

.xp-h2 {
    margin-top: 0.75rem !important;
    font-size: clamp(2rem, 1.35rem + 2.2vw, 3.125rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.028em;
}

[dir="rtl"] .xp-h2 {
    letter-spacing: 0;
    line-height: 1.3;
}

.xp .xp-sub {
    margin-top: 1rem;
    color: var(--xp-muted);
    font-size: var(--jl-fs-lead);
    max-width: 56ch;
}

/* Scroll reveal (only when JS + motion are available) */
.xp-js:not(.xp-nojs) [data-reveal] {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s ease, transform 1s var(--xp-ease);
}

.xp-js:not(.xp-nojs) [data-reveal].is-in {
    opacity: 1;
    transform: none;
}

/* ==========================================================================
   HERO
   ========================================================================== */
.xh {
    padding: 12px 12px 0;
}

.xh-stage {
    --xh-angle: 118deg;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border-radius: clamp(24px, 2vw + 12px, 40px);
    background: linear-gradient(var(--xh-angle), #2C66FE 0%, #2C66FE 36%, #3A86F7 62%, #38C0EF 100%);
    color: var(--xp-white);
}

[dir="rtl"] .xh-stage {
    --xh-angle: 242deg;
}

/* Background light */
.xh-bg {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.xh-light {
    position: absolute;
    border-radius: 50%;
    filter: blur(10px);
}

.xh-light--a {
    width: 70vmax;
    height: 70vmax;
    inset-inline-end: -22vmax;
    top: -30vmax;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 60%);
}

.xh-light--b {
    width: 50vmax;
    height: 50vmax;
    inset-inline-start: -18vmax;
    bottom: -30vmax;
    background: radial-gradient(circle, rgba(56, 192, 239, 0.45) 0%, rgba(56, 192, 239, 0) 62%);
}

.xh-dots {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1.2px, transparent 1.4px);
    background-size: 28px 28px;
    -webkit-mask-image: radial-gradient(ellipse 70% 80% at 30% 40%, #000 0%, transparent 75%);
    mask-image: radial-gradient(ellipse 70% 80% at 30% 40%, #000 0%, transparent 75%);
}

.xh-star {
    position: absolute;
    left: var(--sx);
    top: var(--sy);
    width: 14px;
    height: 14px;
    background: var(--xp-white);
    clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
    opacity: 0.7;
    animation: xh-twinkle 5.5s ease-in-out infinite;
    animation-delay: var(--sd);
}

@keyframes xh-twinkle {
    0%, 100% { transform: scale(0.5) rotate(0); opacity: 0.25; }
    50% { transform: scale(1) rotate(45deg); opacity: 0.9; }
}

/* Layout */
.xh-grid {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
    align-items: center;
    gap: clamp(1rem, 3vw, 3rem);
    min-height: min(780px, calc(100svh - var(--jl-nav-h) - 22px));
}

.xh-copy {
    position: relative;
    z-index: 2;
    padding-block: clamp(2.5rem, 1.5rem + 3vw, 4.25rem);
}

.xh-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.4rem 1rem 0.4rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--xp-white);
}

.xh-eyebrow-dot {
    position: relative;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--xp-cyan);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9);
}

.xh-eyebrow-dot::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid var(--xp-white);
    animation: xh-ping 2.4s var(--xp-ease) infinite;
}

@keyframes xh-ping {
    0% { transform: scale(1); opacity: 0.9; }
    100% { transform: scale(2.6); opacity: 0; }
}

.xp .xh-title {
    margin-top: 1.5rem;
    max-width: 15ch;
    color: var(--xp-white);
    font-size: clamp(2.4rem, 1.3rem + 3.3vw, 4.1rem);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -0.035em;
}

[dir="rtl"] .xp .xh-title {
    letter-spacing: 0;
    line-height: 1.28;
}

.xh-mark {
    position: relative;
    display: inline-block;
    white-space: nowrap;
}

.xh-swoosh {
    position: absolute;
    left: -2%;
    width: 104%;
    bottom: -0.16em;
    height: 0.32em;
    overflow: visible;
}

.xh-swoosh path {
    fill: none;
    stroke: var(--xp-cyan);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
}

.xp .xh-lead {
    margin-top: 1.5rem;
    max-width: 46ch;
    color: rgba(255, 255, 255, 0.9);
    font-size: var(--jl-fs-lead);
    line-height: 1.6;
}

.xh-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2.25rem;
}

.xh-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem clamp(1.5rem, 3vw, 2.75rem);
    margin-top: 2.25rem !important;
    padding-top: 1.25rem !important;
    border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.xh-stats > div {
    display: flex;
    flex-direction: column-reverse;
    justify-content: flex-end;
    gap: 0.125rem;
}

.xh-stats dt {
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.875rem;
    font-weight: 500;
}

.xh-stats dd {
    color: var(--xp-white);
    font-family: var(--jl-font-display);
    font-size: 1.875rem;
    font-weight: 800;
    line-height: 1.15;
    font-variant-numeric: lining-nums tabular-nums;
}

.xh-stats .xh-stat-text {
    font-size: 1.0625rem;
    line-height: 1.9;
    font-weight: 700;
}

/* ── The living scene ───────────────────────────────────── */
.xh-scene {
    --mx: 0;
    --my: 0;
    position: relative;
    align-self: end;
    justify-self: center;
    width: 100%;
    max-width: 640px;
    aspect-ratio: 1 / 1;
    margin-top: 1.5rem;
    container-type: inline-size;
}

.xh-orbits {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.xh-orbit {
    transform-box: view-box;
    transform-origin: 50% 50%;
    animation: xh-spin 110s linear infinite;
}

.xh-orbit--2 {
    animation-duration: 80s;
    animation-direction: reverse;
}

.xh-orbit ellipse {
    fill: none;
    stroke: rgba(255, 255, 255, 0.38);
    stroke-width: 1.5;
    stroke-dasharray: 2 9;
    stroke-linecap: round;
}

.xh-orbit--2 ellipse {
    stroke: rgba(255, 255, 255, 0.24);
    stroke-dasharray: none;
}

.xh-orbit circle {
    fill: var(--xp-white);
}

@keyframes xh-spin {
    to { transform: rotate(360deg); }
}

.xh-portal {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 72%;
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle at 46% 34%, #FFFFFF 0%, #F3FAFF 50%, #D6F1FC 100%);
    box-shadow:
        0 0 0 16px rgba(255, 255, 255, 0.14),
        0 0 0 34px rgba(255, 255, 255, 0.07),
        0 50px 90px -40px rgba(8, 28, 92, 0.6);
    overflow: hidden;
}

.xh-portal-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(44, 102, 254, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(44, 102, 254, 0.08) 1px, transparent 1px);
    background-size: 7% 7%;
    -webkit-mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 70%);
    mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 70%);
}

/* The young scientist */
.xh-kid {
    position: absolute;
    left: 50%;
    bottom: 0;
    z-index: 2;
    height: 91%;
    transform: translateX(-50%);
    margin: 0;
    pointer-events: none;
}

.xh-kid img {
    display: block;
    height: 100%;
    width: auto;
    max-width: none;
    transform-origin: 50% 100%;
    filter: drop-shadow(0 24px 30px rgba(8, 28, 92, 0.25));
    animation: xh-breathe 6.5s ease-in-out infinite;
}

@keyframes xh-breathe {
    0%, 100% { transform: rotate(0deg) scale(1); }
    35% { transform: rotate(-0.8deg) scale(1.006); }
    70% { transform: rotate(0.6deg) scale(1.003); }
}

/* Flask glow + bubbles (placed on the flask by JS) */
.xh-glow,
.xh-bubbles {
    position: absolute;
    left: var(--fx, 66%);
    top: var(--fy, 58%);
    z-index: 3;
    pointer-events: none;
}

.xh-glow {
    width: 26cqw;
    aspect-ratio: 1;
    border-radius: 50%;
    translate: -50% -50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.85) 0%, rgba(56, 192, 239, 0.55) 30%, rgba(56, 192, 239, 0) 68%);
    mix-blend-mode: screen;
    opacity: 0.45;
    animation: xh-glow 3.2s ease-in-out infinite;
    transition: opacity 0.4s ease, scale 0.5s var(--xp-spring);
}

.xh-glow.is-firing {
    opacity: 1;
    scale: 1.35;
}

@keyframes xh-glow {
    0%, 100% { transform: scale(0.9); }
    50% { transform: scale(1.08); }
}

.xh-bubbles {
    left: var(--bx, 66%);
    top: var(--by, 50%);
    width: 0;
    height: 0;
}

.xh-bubbles i {
    position: absolute;
    left: 0;
    top: 0;
    width: calc(1.2cqw + var(--b) * 0.25cqw);
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.35);
    opacity: 0;
    animation: xh-bubble 3.6s ease-out infinite;
    animation-delay: calc(var(--b) * 0.9s);
}

@keyframes xh-bubble {
    0% { transform: translate(-50%, 0) scale(0.4); opacity: 0; }
    15% { opacity: 1; }
    60% { transform: translate(calc(-50% + 1.6cqw), -9cqw) scale(1); opacity: 0.9; }
    100% { transform: translate(calc(-50% - 0.8cqw), -16cqw) scale(1.1); opacity: 0; }
}

/* Connection: flask → object */
.xh-links {
    position: absolute;
    inset: 0;
    z-index: 4;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.xh-link {
    fill: none;
    stroke: var(--xp-white);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 1 1;
    stroke-dashoffset: 1;
    opacity: 0;
    filter: drop-shadow(0 0 4px rgba(56, 192, 239, 0.9));
}

.xh-spark {
    fill: var(--xp-white);
    opacity: 0;
    filter: drop-shadow(0 0 5px #38C0EF) drop-shadow(0 0 12px rgba(255, 255, 255, 0.9));
}

/* Science objects */
.xo {
    position: absolute;
    left: var(--x);
    top: var(--y);
    z-index: 5;
    width: calc(var(--w) * 1cqw);
    translate: calc(-50% + var(--mx) * var(--d) * 1px) calc(-50% + var(--my) * var(--d) * 1px);
}

.xo-float {
    position: relative;
    animation: xo-bob var(--dur) ease-in-out infinite;
    animation-delay: calc(var(--i) * -1.7s);
}

@keyframes xo-bob {
    0%, 100% { transform: translateY(0) rotate(-2.5deg); }
    50% { transform: translateY(-7%) rotate(2.5deg); }
}

.xo-art {
    position: relative;
    filter: drop-shadow(0 14px 16px rgba(8, 28, 92, 0.3));
    transition: transform 0.7s var(--xp-spring);
}

.xo-art svg {
    position: relative;
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.xo-halo {
    position: absolute;
    inset: -22%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(56, 192, 239, 0.45) 40%, rgba(56, 192, 239, 0) 70%);
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.5s ease, transform 0.7s var(--xp-spring);
}

.xo-art::after {
    content: "";
    position: absolute;
    inset: -8%;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.95);
    opacity: 0;
    pointer-events: none;
}

.xo.is-lit .xo-art {
    transform: scale(1.16);
}

.xo.is-lit .xo-halo {
    opacity: 1;
    transform: scale(1);
}

.xo.is-lit .xo-art::after {
    animation: xo-ripple 1.3s var(--xp-ease) forwards;
}

@keyframes xo-ripple {
    0% { transform: scale(0.6); opacity: 1; }
    100% { transform: scale(1.7); opacity: 0; }
}

.xo-tag {
    position: absolute;
    left: 50%;
    top: 100%;
    padding: 0.35em 0.9em;
    border-radius: 999px;
    background: var(--xp-white);
    color: var(--xp-blue);
    font-family: var(--jl-font-display);
    font-size: clamp(11px, 2.2cqw, 14px);
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 10px 22px -10px rgba(8, 28, 92, 0.55);
    opacity: 0;
    transform: translate(-50%, 4px) scale(0.85);
    transition: opacity 0.35s ease, transform 0.55s var(--xp-spring);
}

.xo.is-lit .xo-tag {
    opacity: 1;
    transform: translate(-50%, 12px) scale(1);
}

/* Robot companion */
.xh-robot {
    position: absolute;
    left: 85%;
    bottom: 3%;
    z-index: 6;
    width: 17cqw;
    translate: calc(-50% + var(--mx) * 1.5px) calc(var(--my) * 1.5px);
    rotate: calc(var(--look, 0) * 9deg);
    transition: rotate 0.9s var(--xp-ease);
}

.xh-robot img {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 18px 18px rgba(8, 28, 92, 0.3));
    animation: xh-hover 4.6s ease-in-out infinite;
}

.xh-robot-shadow {
    position: absolute;
    left: 15%;
    right: 15%;
    bottom: -8%;
    height: 7%;
    border-radius: 50%;
    background: rgba(8, 28, 92, 0.28);
    filter: blur(4px);
    animation: xh-hover-shadow 4.6s ease-in-out infinite;
}

@keyframes xh-hover {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-9%); }
}

@keyframes xh-hover-shadow {
    0%, 100% { transform: scaleX(1); opacity: 0.9; }
    50% { transform: scaleX(0.75); opacity: 0.5; }
}

/* ── Entrance choreography (JS + motion only) ───────────── */
.xp-js:not(.xp-nojs) .xh-in {
    opacity: 0;
    transform: translateY(22px);
}

.xp-js:not(.xp-nojs) .xh.is-ready .xh-in {
    opacity: 1;
    transform: none;
    transition: opacity 0.9s ease, transform 1s var(--xp-ease);
    transition-delay: calc(var(--in) * 90ms + 120ms);
}

.xp-js:not(.xp-nojs) .xh-swoosh path {
    stroke-dashoffset: 1;
}

.xp-js:not(.xp-nojs) .xh.is-ready .xh-swoosh path {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1.1s var(--xp-ease) 0.95s;
}

.xp-js:not(.xp-nojs) .xh:not(.is-ready) :is(.xh-portal, .xh-orbits, .xh-kid, .xo, .xh-robot, .xh-glow, .xh-bubbles) {
    opacity: 0;
}

.xp-js:not(.xp-nojs) .xh.is-ready .xh-portal {
    animation: xh-portal-in 1.2s var(--xp-spring) 0.1s backwards;
}

.xp-js:not(.xp-nojs) .xh.is-ready .xh-orbits {
    animation: xh-fade 1.6s ease 0.45s backwards;
}

.xp-js:not(.xp-nojs) .xh.is-ready .xh-kid {
    animation: xh-kid-in 1.15s var(--xp-ease) 0.3s backwards;
}

.xp-js:not(.xp-nojs) .xh.is-ready .xo {
    animation: xo-in 0.9s var(--xp-spring) backwards;
    animation-delay: calc(0.75s + var(--i) * 0.12s);
}

.xp-js:not(.xp-nojs) .xh.is-ready .xh-robot {
    animation: xh-robot-in 1.2s var(--xp-ease) 1.45s backwards;
}

.xp-js:not(.xp-nojs) .xh.is-ready .xh-glow {
    animation: xh-glow 3.2s ease-in-out infinite, xh-fade 0.8s ease 1.2s backwards;
}

.xp-js:not(.xp-nojs) .xh.is-ready .xh-bubbles {
    animation: xh-fade 0.8s ease 1.2s backwards;
}

@keyframes xh-fade {
    from { opacity: 0; }
}

@keyframes xh-portal-in {
    from { opacity: 0; scale: 0.6; }
}

@keyframes xh-kid-in {
    from { opacity: 0; translate: 0 12%; }
}

@keyframes xo-in {
    from { opacity: 0; scale: 0.2; }
}

@keyframes xh-robot-in {
    from { opacity: 0; scale: 0.6; translate: calc(-50% + 30px) 40%; }
}

/* Pause every loop while the hero is off screen or the tab is hidden */
.xh.is-paused *,
.xh.is-paused *::before,
.xh.is-paused *::after {
    animation-play-state: paused !important;
}

/* ==========================================================================
   BROWSE — worlds, toolbar, cards
   ========================================================================== */
.xb {
    padding-block: clamp(4rem, 2.5rem + 5vw, 7.5rem) clamp(3.5rem, 2rem + 4vw, 6rem);
    scroll-margin-top: calc(var(--jl-nav-h) + 8px);
}

/* Worlds (subject filter) */
.xw {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: clamp(0.75rem, 0.5rem + 0.8vw, 1.25rem);
    margin-top: clamp(2rem, 1.5rem + 1.5vw, 3rem);
}

.xw-tile {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.125rem;
    padding: 1.125rem 1.125rem 1.25rem;
    border: 1.5px solid var(--xp-line);
    border-radius: 26px;
    background: var(--xp-white);
    color: var(--xp-ink);
    text-align: start;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.45s var(--xp-spring), box-shadow 0.35s ease, border-color 0.3s ease, color 0.3s ease;
}

.xw-tile::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(140deg, #2C66FE 0%, #2C66FE 30%, #38C0EF 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.xw-tile::after {
    content: "";
    position: absolute;
    z-index: -1;
    width: 180px;
    aspect-ratio: 1;
    inset-inline-end: -70px;
    bottom: -90px;
    border-radius: 50%;
    border: 1.5px dashed rgba(255, 255, 255, 0.35);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.xw-tile:hover {
    border-color: #BCD0FF;
    transform: translateY(-4px);
    box-shadow: var(--xp-shadow-lift);
}

.xw-tile[aria-pressed="true"] {
    border-color: transparent;
    color: var(--xp-white);
    box-shadow: 0 22px 40px -22px rgba(44, 102, 254, 0.75);
}

.xw-tile[aria-pressed="true"]::before,
.xw-tile[aria-pressed="true"]::after {
    opacity: 1;
}

.xw-art {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    border-radius: 24px;
    background: linear-gradient(145deg, var(--xp-blue-soft) 0%, var(--xp-cyan-soft) 100%);
    transition: background 0.35s ease, box-shadow 0.35s ease;
}

.xw-art svg {
    width: 74%;
    height: 74%;
    overflow: visible;
    filter: drop-shadow(0 6px 6px rgba(20, 37, 74, 0.16));
    transition: transform 0.6s var(--xp-spring);
}

.xw-tile:hover .xw-art svg {
    transform: translateY(-4px) rotate(-7deg) scale(1.08);
}

.xw-tile[aria-pressed="true"] .xw-art {
    background: var(--xp-white);
    box-shadow: 0 10px 22px -12px rgba(8, 28, 92, 0.6);
}

.xw-tile[aria-pressed="true"] .xw-art svg {
    animation: xw-pop 0.7s var(--xp-spring);
}

@keyframes xw-pop {
    0% { transform: scale(0.7) rotate(-12deg); }
    100% { transform: none; }
}

.xw-text {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.xw-name {
    font-family: var(--jl-font-display);
    font-size: 1.1875rem;
    font-weight: 800;
    line-height: 1.25;
}

.xw-count {
    color: var(--xp-muted);
    font-size: 0.875rem;
    font-weight: 500;
    font-variant-numeric: lining-nums;
    transition: color 0.3s ease;
}

.xw-tile[aria-pressed="true"] .xw-count {
    color: rgba(255, 255, 255, 0.88);
}

/* Toolbar */
.xt {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.5rem;
    margin-top: clamp(2rem, 1.5rem + 1.5vw, 2.75rem);
}

.xt-search {
    position: relative;
    flex: 1 1 340px;
    max-width: 540px;
}

.xt-search-icon {
    position: absolute;
    inset-inline-start: 1.125rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--xp-blue);
    font-size: 1.375rem;
    pointer-events: none;
}

.xt-search-input {
    width: 100%;
    height: 56px;
    padding-inline: 3.25rem;
    border: 1.5px solid var(--xp-line);
    border-radius: 999px;
    background: #F6F9FF;
    color: var(--xp-ink);
    font-size: 1rem;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.xt-search-input::placeholder {
    color: var(--xp-muted);
    opacity: 1;
}

.xt-search-input::-webkit-search-cancel-button {
    display: none;
}

.xt-search-input:hover {
    border-color: #BCD0FF;
}

.xp .xt-search-input:focus,
.xp .xt-search-input:focus-visible {
    outline: none;
    border-color: var(--xp-blue);
    background: var(--xp-white);
    box-shadow: 0 0 0 4px rgba(44, 102, 254, 0.16);
}

.xt-search-clear {
    position: absolute;
    inset-inline-end: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--xp-muted);
    font-size: 1.375rem;
    cursor: pointer;
}

.xt-search-clear:hover {
    background: var(--xp-blue-soft);
    color: var(--xp-blue);
}

.xt-search-clear[hidden] {
    display: none;
}

.xt-sort {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    margin: 0;
    color: var(--xp-muted);
    font-size: 0.9375rem;
}

.xt-sort select {
    min-height: 48px;
    padding-inline: 1.125rem 2.5rem;
    border: 1.5px solid var(--xp-line);
    border-radius: 999px;
    color: var(--xp-ink);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background: var(--xp-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%232C66FE' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 1rem center;
    transition: border-color 0.25s ease;
}

.xt-sort select:hover {
    border-color: #BCD0FF;
}

.xp .xt-sort select:focus-visible {
    outline: none;
    border-color: var(--xp-blue);
    box-shadow: 0 0 0 4px rgba(44, 102, 254, 0.16);
}

[dir="rtl"] .xt-sort select {
    background-position: left 1rem center;
}

.xp .xt-summary {
    min-height: 1.6rem;
    margin-top: 1.25rem;
    color: var(--xp-muted);
    font-size: 0.9375rem;
    font-variant-numeric: lining-nums tabular-nums;
}

.xt-summary strong {
    color: var(--xp-ink);
    font-weight: 700;
}

/* Grid */
.xg {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(1rem, 0.5rem + 1.5vw, 1.75rem);
    margin-top: 1.25rem;
    transition: opacity 0.25s ease;
}

.xg[aria-busy="true"] {
    opacity: 0.6;
}

/* Card */
.xc {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--xp-line);
    border-radius: 26px;
    background: var(--xp-white);
    color: var(--xp-ink);
    box-shadow: var(--xp-shadow-card);
    transition: transform 0.5s var(--xp-spring), box-shadow 0.4s ease, border-color 0.3s ease;
}

.xc:hover {
    color: var(--xp-ink);
    border-color: rgba(56, 192, 239, 0.6);
    box-shadow: var(--xp-shadow-lift);
    transform: translateY(-6px);
}

.xc:focus-visible {
    outline-offset: 4px;
}

.xc-media {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(145deg, var(--xp-blue-soft) 0%, var(--xp-cyan-soft) 100%);
}

.xc-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.9s var(--xp-ease);
}

.xc:hover .xc-media img {
    transform: scale(1.07);
}

.xc-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(20, 37, 74, 0.38) 0%, rgba(20, 37, 74, 0) 45%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.xc:hover .xc-media::after {
    opacity: 1;
}

.xc-fallback {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 42%;
    height: 56%;
    filter: drop-shadow(0 10px 12px rgba(20, 37, 74, 0.18));
}

.xc-access {
    position: absolute;
    top: 12px;
    inset-inline-start: 12px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem 0.3rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1.35;
    box-shadow: 0 6px 16px -8px rgba(20, 37, 74, 0.45);
}

.xc-access i {
    font-size: 1rem;
}

.xc-access--free {
    background: var(--xp-cyan);
    color: var(--xp-ink);
}

.xc-access--lock {
    background: rgba(255, 255, 255, 0.94);
    color: var(--xp-ink);
}

.xc-access--lock i {
    color: var(--xp-blue);
}

.xc-go {
    position: absolute;
    bottom: 12px;
    inset-inline-end: 12px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    height: 44px;
    padding: 0 0.7rem;
    border-radius: 999px;
    background: var(--xp-white);
    color: var(--xp-blue);
    font-size: 0.875rem;
    font-weight: 800;
    box-shadow: 0 8px 20px -10px rgba(20, 37, 74, 0.5);
    transition: background-color 0.3s ease, color 0.3s ease, padding 0.45s var(--xp-ease);
}

.xc-go i {
    font-size: 1.375rem;
    transition: transform 0.4s var(--xp-spring);
}

[dir="rtl"] .xc-go i {
    transform: scaleX(-1);
}

.xc-go-label {
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    transition: max-width 0.5s var(--xp-ease), opacity 0.3s ease, margin 0.5s var(--xp-ease);
}

.xc:hover .xc-go,
.xc:focus-visible .xc-go {
    padding-inline: 1rem 0.8rem;
    background: var(--xp-blue);
    color: var(--xp-white);
}

.xc:hover .xc-go-label,
.xc:focus-visible .xc-go-label {
    max-width: 200px;
    opacity: 1;
    margin-inline-end: 0.35rem;
}

.xc:hover .xc-go i {
    transform: translateX(2px);
}

[dir="rtl"] .xc:hover .xc-go i {
    transform: scaleX(-1) translateX(2px);
}

.xc-body {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 1rem 0.625rem 0.625rem;
}

.xc-subject {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--xp-blue);
    font-size: 0.8125rem;
    font-weight: 800;
    line-height: 1.3;
}

.xc-subject::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--xp-cyan);
    box-shadow: 0 0 0 3px var(--xp-cyan-soft);
}

.xp .xc-title {
    font-size: 1.1875rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

/* Featured: the newest experiment on the default first page */
.xc--feat {
    grid-column: span 2;
    flex-direction: row;
    gap: 10px;
}

.xc--feat .xc-media {
    flex: 0 0 58%;
    aspect-ratio: auto;
    min-height: 320px;
}

.xc--feat .xc-body {
    justify-content: center;
    gap: 0.875rem;
    padding: 1.5rem 1.25rem;
}

.xc-flag {
    align-self: flex-start;
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
    background: linear-gradient(120deg, var(--xp-blue), var(--xp-cyan));
    color: var(--xp-white);
    font-size: 0.78rem;
    font-weight: 800;
}

.xp .xc--feat .xc-title {
    font-size: clamp(1.4rem, 1.1rem + 0.8vw, 1.875rem);
    font-weight: 800;
    line-height: 1.2;
    -webkit-line-clamp: 3;
}

.xc-cta {
    align-self: flex-start;
    margin-top: 0.5rem;
    min-height: 48px;
    padding-inline: 1.375rem;
    font-size: 0.9375rem;
}

.xc:hover .xc-cta {
    background: var(--xp-blue-600);
}

.xc:hover .xc-cta i {
    transform: translateX(3px);
}

[dir="rtl"] .xc-cta i {
    transform: scaleX(-1);
}

[dir="rtl"] .xc:hover .xc-cta i {
    transform: scaleX(-1) translateX(3px);
}

/* New results settle in */
.xc.is-entering {
    animation: xc-in 0.65s var(--xp-ease) backwards;
    animation-delay: calc(var(--i, 0) * 55ms);
}

@keyframes xc-in {
    from { opacity: 0; transform: translateY(18px) scale(0.98); }
}

/* Loading skeletons */
.xc-skel {
    padding: 10px;
    border: 1px solid var(--xp-line);
    border-radius: 26px;
    background: var(--xp-white);
}

.xc-skel i {
    display: block;
    border-radius: 8px;
    background: linear-gradient(90deg, #EDF2FB 0%, #F8FAFE 50%, #EDF2FB 100%);
    background-size: 200% 100%;
    animation: xc-shimmer 1.4s linear infinite;
}

.xc-skel i:first-child {
    aspect-ratio: 4 / 3;
    border-radius: 18px;
}

.xc-skel i:nth-child(2) {
    width: 30%;
    height: 12px;
    margin: 1.1rem 0.6rem 0.6rem;
}

.xc-skel i:nth-child(3) {
    width: 75%;
    height: 18px;
    margin: 0 0.6rem 0.75rem;
}

@keyframes xc-shimmer {
    to { background-position: -200% 0; }
}

/* Empty + error states */
.xl-state {
    grid-column: 1 / -1;
    padding: clamp(2.5rem, 2rem + 3vw, 4.5rem) 1.5rem;
    border: 1.5px dashed #CCDAF2;
    border-radius: 26px;
    background: #F7FAFF;
    text-align: center;
}

.xl-state-art {
    display: block;
    width: 96px;
    height: 96px;
    margin: 0 auto 1rem;
}

.xp .xl-state h2 {
    font-size: var(--jl-fs-h3);
    font-weight: 800;
    line-height: 1.3;
}

.xp .xl-state p {
    max-width: 46ch;
    margin: 0.5rem auto 0;
    color: var(--xp-muted);
}

.xl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin-top: 1.25rem;
    padding: 0.625rem 1.5rem;
    border: 1.5px solid var(--xp-blue);
    border-radius: 999px;
    background: var(--xp-white);
    color: var(--xp-blue);
    font-family: var(--jl-font-display);
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.3s var(--xp-spring);
}

.xl-btn:hover {
    background: var(--xp-blue-soft);
    transform: translateY(-1px);
}

/* Pagination */
.xpg {
    margin-top: clamp(2rem, 1.5rem + 2vw, 3rem);
}

.xpg ul {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.xl-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-width: 46px;
    height: 46px;
    padding-inline: 0.75rem;
    border: 1.5px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--xp-ink);
    font-size: 0.9375rem;
    font-weight: 600;
    font-variant-numeric: lining-nums tabular-nums;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.xl-page-btn:hover {
    background: var(--xp-blue-soft);
    color: var(--xp-blue);
}

.xl-page-btn[aria-current="page"] {
    background: var(--xp-blue);
    color: var(--xp-white);
    font-weight: 800;
    cursor: default;
    box-shadow: 0 10px 20px -10px rgba(44, 102, 254, 0.8);
}

.xl-page-btn--step {
    padding-inline: 1.125rem;
    border-color: var(--xp-line);
}

.xl-page-btn--step:hover {
    border-color: #BCD0FF;
}

.xl-page-btn--step:first-child {
    margin-inline-end: 0.5rem;
}

.xl-page-btn--step:last-child {
    margin-inline-start: 0.5rem;
}

[dir="rtl"] .xl-page-btn--step i {
    transform: scaleX(-1);
}

.xl-page-gap {
    min-width: 28px;
    color: var(--xp-muted);
    text-align: center;
}

/* ==========================================================================
   JOURNEY — Explore. Experiment. Discover.
   ========================================================================== */
.xj {
    padding-block: clamp(4rem, 2.5rem + 5vw, 7rem);
    background: linear-gradient(180deg, #FFFFFF 0%, #F3F7FF 22%, #F3F7FF 78%, #FFFFFF 100%);
}

.xj-track {
    position: relative;
    margin-top: clamp(2.5rem, 2rem + 2vw, 4rem);
}

.xj-path {
    position: absolute;
    top: 24px;
    left: 0;
    width: 100%;
    height: 120px;
    overflow: visible;
    pointer-events: none;
}

.xj-path path {
    fill: none;
    stroke: rgba(44, 102, 254, 0.4);
    stroke-width: 2.5;
    stroke-dasharray: 3 10;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

[dir="rtl"] .xj-path {
    transform: scaleX(-1);
}

.xp-js:not(.xp-nojs) .xj-path {
    clip-path: inset(0 100% 0 0);
    transition: clip-path 1.8s var(--xp-ease) 0.35s;
}

.xp-js:not(.xp-nojs) .xj-track.is-in .xj-path {
    clip-path: inset(0 0 0 0);
}

.xj-steps {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(1.5rem, 1rem + 2vw, 3rem);
    text-align: center;
}

.xp-js:not(.xp-nojs) .xj-step {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.8s ease, transform 0.9s var(--xp-ease);
    transition-delay: calc(var(--n) * 0.22s + 0.15s);
}

.xp-js:not(.xp-nojs) .xj-track.is-in .xj-step {
    opacity: 1;
    transform: none;
}

.xj-art {
    position: relative;
    display: grid;
    place-items: center;
    width: 172px;
    height: 172px;
    margin-inline: auto;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 30%, #FFFFFF 0%, #EEF4FF 58%, #DDF2FC 100%);
    box-shadow: inset 0 0 0 1px #E1EAF8, 0 26px 44px -30px rgba(20, 37, 74, 0.45);
}

.xj-art > svg {
    position: relative;
    overflow: visible;
    filter: drop-shadow(0 10px 10px rgba(20, 37, 74, 0.16));
}

.xj-num {
    position: absolute;
    top: 8px;
    inset-inline-end: 8px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--xp-blue), var(--xp-cyan));
    color: var(--xp-white);
    font-family: var(--jl-font-display);
    font-size: 0.9375rem;
    font-weight: 800;
    box-shadow: 0 0 0 4px var(--xp-white);
}

/* 1 · Explore: a lens scanning a planet */
.xj-planet {
    width: 60%;
}

.xj-lens {
    position: absolute;
    width: 46%;
    left: 30%;
    top: 26%;
    animation: xj-scan 6s ease-in-out infinite;
}

@keyframes xj-scan {
    0%, 100% { transform: translate(-30%, -24%) rotate(-6deg); }
    33% { transform: translate(26%, -8%) rotate(4deg); }
    66% { transform: translate(-4%, 26%) rotate(-2deg); }
}

/* 2 · Experiment: a bubbling flask */
.xj-flask {
    width: 62%;
    transform-origin: 50% 90%;
    animation: xj-swirl 4s ease-in-out infinite;
}

@keyframes xj-swirl {
    0%, 100% { transform: rotate(-4deg); }
    50% { transform: rotate(4deg); }
}

.xj-bubbles {
    position: absolute;
    left: 50%;
    top: 22%;
}

.xj-bubbles i {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--xp-cyan);
    background: rgba(56, 192, 239, 0.2);
    opacity: 0;
    animation: xj-rise 2.7s ease-out infinite;
}

.xj-bubbles i:nth-child(2) { animation-delay: 0.9s; width: 9px; height: 9px; }
.xj-bubbles i:nth-child(3) { animation-delay: 1.8s; width: 14px; height: 14px; }

@keyframes xj-rise {
    0% { transform: translate(-50%, 10px) scale(0.4); opacity: 0; }
    20% { opacity: 1; }
    100% { transform: translate(calc(-50% + 14px), -46px) scale(1); opacity: 0; }
}

/* 3 · Discover: the idea lights up */
.xj-art::before {
    content: "";
    position: absolute;
    inset: 14%;
    border-radius: 50%;
    opacity: 0;
}

.xj-step--discover .xj-art::before {
    background: radial-gradient(circle, rgba(56, 192, 239, 0.55) 0%, rgba(56, 192, 239, 0) 70%);
    animation: xj-lightup 3.2s ease-in-out infinite;
}

@keyframes xj-lightup {
    0%, 100% { opacity: 0.15; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.15); }
}

.xj-bulb {
    width: 60%;
    animation: xj-nod 3.2s ease-in-out infinite;
}

@keyframes xj-nod {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.xj-sparkles i {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--xp-blue);
    clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
    animation: xj-sparkle 3.2s ease-in-out infinite;
}

.xj-sparkles i:nth-child(1) { left: 18%; top: 22%; }
.xj-sparkles i:nth-child(2) { right: 16%; top: 30%; background: var(--xp-cyan); animation-delay: 0.4s; }
.xj-sparkles i:nth-child(3) { right: 26%; bottom: 18%; width: 10px; height: 10px; animation-delay: 0.8s; }

@keyframes xj-sparkle {
    0%, 30%, 100% { transform: scale(0) rotate(0); }
    50% { transform: scale(1) rotate(45deg); }
    70% { transform: scale(0) rotate(90deg); }
}

.xj-track:not(.is-live) * {
    animation-play-state: paused !important;
}

.xp .xj-title {
    margin-top: 1.5rem;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.25;
}

.xp .xj-text {
    max-width: 30ch;
    margin: 0.5rem auto 0;
    color: var(--xp-muted);
}

/* ==========================================================================
   INVITATION
   ========================================================================== */
.xcta {
    padding-block: clamp(1rem, 2vw, 2rem) clamp(4rem, 2.5rem + 5vw, 7rem);
}

.xcta-panel {
    --xc-angle: 118deg;
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 2rem;
    padding: clamp(2.25rem, 1.5rem + 3vw, 4.5rem);
    border-radius: clamp(24px, 2vw + 12px, 40px);
    background: linear-gradient(var(--xc-angle), #2C66FE 0%, #2C66FE 42%, #38C0EF 100%);
    color: var(--xp-white);
    overflow: hidden;
}

[dir="rtl"] .xcta-panel {
    --xc-angle: 242deg;
}

.xcta-deco {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

.xcta-ring {
    position: absolute;
    top: 50%;
    inset-inline-end: 4%;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.22);
    transform: translateY(-50%);
}

.xcta-ring--a {
    width: 440px;
    border-style: dashed;
    animation: xh-spin 90s linear infinite;
}

.xcta-ring--b {
    width: 300px;
    inset-inline-end: calc(4% + 70px);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 70%);
}

.xcta-obj {
    position: absolute;
    filter: drop-shadow(0 10px 12px rgba(8, 28, 92, 0.3));
    animation: xo-bob 7s ease-in-out infinite;
}

.xcta-obj--atom {
    width: 72px;
    top: 12%;
    inset-inline-end: 30%;
}

.xcta-obj--planet {
    width: 84px;
    bottom: 8%;
    inset-inline-end: 3%;
    animation-delay: -3s;
}

.xp .xcta-title {
    max-width: 18ch;
    color: var(--xp-white);
    font-size: clamp(1.875rem, 1.2rem + 2.2vw, 3rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.028em;
}

[dir="rtl"] .xp .xcta-title {
    letter-spacing: 0;
    line-height: 1.3;
}

.xp .xcta-text {
    max-width: 50ch;
    margin-top: 1rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: var(--jl-fs-lead);
}

.xcta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 2rem;
}

.xcta-robot {
    width: clamp(150px, 15vw, 220px);
    margin-inline-end: clamp(0rem, 4vw, 4rem);
}

.xcta-robot img {
    display: block;
    width: 100%;
    height: auto;
    filter: drop-shadow(0 24px 22px rgba(8, 28, 92, 0.35));
    animation: xh-hover 5s ease-in-out infinite;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1080px) {
    .xg {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 960px) {
    .xh-grid {
        grid-template-columns: minmax(0, 1fr);
        min-height: 0;
        gap: 0;
    }

    /* Recompose for small screens: headline → living scene → story → actions.
       The scene comes up into the first screen instead of trailing below it. */
    .xh-grid {
        padding-block: clamp(2rem, 6vw, 3rem) clamp(2rem, 6vw, 3rem);
    }

    .xh-copy {
        display: contents;
    }

    .xh-eyebrow { order: 1; justify-self: start; }
    .xh-title { order: 2; }
    .xh-scene { order: 3; }
    .xh-lead { order: 4; }
    .xh-actions { order: 5; }
    .xh-stats { order: 6; }

    .xp .xh-title {
        max-width: 16ch;
        margin-top: 1.25rem;
    }

    .xh-scene {
        align-self: auto;
        max-width: 520px;
        margin-top: 1rem;
    }

    /* the scientist fades into the sky instead of being cut mid-stage */
    .xh-kid {
        -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent 98%);
        mask-image: linear-gradient(to bottom, #000 72%, transparent 98%);
    }

    .xp .xh-lead {
        margin-top: 0.5rem;
    }

    /* keep the companion and the lower objects above the fade */
    .xh-robot {
        bottom: 17%;
    }

    .xj-steps {
        grid-template-columns: minmax(0, 1fr);
        gap: 2.75rem;
    }

    .xj-path {
        display: none;
    }

    .xcta-panel {
        grid-template-columns: minmax(0, 1fr);
    }

    .xcta-robot {
        position: absolute;
        width: 120px;
        inset-inline-end: 1.5rem;
        top: 1.5rem;
        margin: 0;
        opacity: 0.95;
    }

    .xcta-copy {
        padding-top: 7rem;
    }

    .xcta-obj--atom {
        display: none;
    }
}

@media (max-width: 680px) {
    .xg {
        grid-template-columns: minmax(0, 1fr);
    }

    .xc--feat {
        grid-column: auto;
        flex-direction: column;
    }

    .xc--feat .xc-media {
        flex: none;
        aspect-ratio: 4 / 3;
        min-height: 0;
    }

    .xc--feat .xc-body {
        padding: 1rem 0.625rem 0.625rem;
    }

    /* Worlds become a swipeable row */
    .xw {
        display: flex;
        gap: 0.75rem;
        margin-inline: calc(var(--jl-gutter) * -1);
        padding: 0.25rem var(--jl-gutter) 1.75rem;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    .xw::-webkit-scrollbar {
        display: none;
    }

    .xw-tile {
        flex: 0 0 auto;
        width: 158px;
        scroll-snap-align: start;
        gap: 0.875rem;
        padding: 0.875rem;
        border-radius: 22px;
    }

    .xw-art {
        width: 60px;
        height: 60px;
        border-radius: 18px;
    }

    .xw-name {
        font-size: 1.0625rem;
    }

    .xt-sort {
        width: 100%;
        justify-content: space-between;
    }

    .xl-page-btn--step span {
        display: none;
    }
}

@media (max-width: 520px) {
    .xh {
        padding-inline: 8px;
    }

    .xo--minor {
        display: none;
    }

    .xh-stats {
        gap: 1rem 1.5rem;
    }

    .xh-stats dd {
        font-size: 1.5rem;
    }

    .xh-actions .xp-btn {
        flex: 1 1 auto;
    }
}

/* ==========================================================================
   REDUCED MOTION — a still, complete composition
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .xp *,
    .xp *::before,
    .xp *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
    }

    .xc:hover,
    .xw-tile:hover,
    .xp-btn:hover {
        transform: none;
    }

    .xh-orbit circle {
        display: none;
    }
}
