/* ============================================================
   FORK LANDING — apps arc + scrollytelling
   Contains: .l-arc-spacer, .l-arc-stage (sticky), .l-arc-card,
   .l-arc-cursors + .l-cursor-N, .l-arc-platforms, .l-arc-showcase,
   .l-arc-final, responsive grid fallback.
   ============================================================ */

/* ═══════════════════════════════════════════════════
   APPS ARC — Nintendo-style row of app cards
   ═══════════════════════════════════════════════════ */
/* Tall spacer establishes the scroll distance for the scrollytelling.
   Total ≈ 5.5 viewport-heights = enough for fan + 7-app showcase + final. */
.l-arc-spacer {
    position: relative;
    width: 100%;
    height: 550vh;
}

/* The actual stage stays visible via NATIVE position:sticky.
   No GSAP pin, no scroller fights, no jitter on custom scroll containers. */
.l-arc-stage {
    position: sticky;
    top: 14vh;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    height: 72vh;
    min-height: 600px;
    max-height: 720px;
    perspective: 1800px;
    contain: layout;
}

.l-arc-bg {
    position: absolute;
    top: 40%; left: 50%;
    width: 900px;
    height: 900px;
    max-width: 100%;
    transform: translateX(-50%);
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--accent) 18%, transparent), transparent 55%);
    filter: blur(70px);
    pointer-events: none;
}

.l-arc-card {
    position: absolute;
    top: 30px;
    left: 50%;
    width: 240px;
    height: 360px;
    border-radius: 26px;
    background: var(--l-surface);
    border: 1px solid var(--l-border);
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 35px 60px -20px rgba(0, 0, 0, 0.55),
        0 15px 30px -15px rgba(0, 0, 0, 0.4);
    transform-origin: 50% 100%;
    will-change: transform;
}
[data-theme="light"] .l-arc-card {
    box-shadow:
        0 30px 55px -20px rgba(17, 24, 39, 0.22),
        0 12px 24px -12px rgba(17, 24, 39, 0.15);
}

.l-arc-frame {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    background: var(--l-surface);
    border-radius: 22px 22px 0 0;
    overflow: hidden;
    margin: 8px 8px 0;
}
.l-arc-label {
    padding: 12px 14px 14px;
    text-align: center;
    flex-shrink: 0;
    border-top: 1px solid var(--l-border);
    background: var(--l-surface);
}
.l-arc-label-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--l-fg);
    letter-spacing: -0.005em;
}
.l-arc-label-prompt {
    font-family: ui-monospace, "SF Mono", monospace;
    font-size: 10px;
    color: var(--l-dim);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.l-arc-card.featured .l-arc-label-prompt { color: var(--accent); }
.l-arc-card.featured {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--l-border));
    box-shadow:
        0 50px 90px -20px rgba(0, 0, 0, 0.65),
        0 20px 50px -15px color-mix(in srgb, var(--accent) 40%, transparent);
}

/* GSAP takes full control over arc card transforms on wide screens.
   On small screens the grid layout below handles positioning. */
@media (min-width: 1101px) {
    html.gsap-loaded .l-arc-card { transform: none; }
}

/* ═══ Multi-user floating cursors (collab vibe) ═══ */
.l-arc-cursors {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 8;
}
@media (max-width: 1100px) { .l-arc-cursors { display: none; } }

.l-cursor {
    position: absolute;
    top: 0; left: 0;
    display: flex;
    align-items: flex-start;
    gap: 5px;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    animation-iteration-count: infinite;
    animation-fill-mode: both;
    will-change: transform;
    transition: opacity 0.4s;
}
.l-cursor svg {
    width: 22px;
    height: 26px;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35));
    flex-shrink: 0;
    transform-origin: 12% 8%;
    transition: transform 0.12s;
}
.l-cursor.clicking svg {
    transform: scale(0.78);
}

/* Click ripple — emanates from the cursor's arrow tip */
.l-cursor::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 30px;
    height: 30px;
    border: 2px solid currentColor;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.4);
}
.l-cursor.clicking::after {
    animation: l-cursor-ripple 0.6s ease-out;
}
@keyframes l-cursor-ripple {
    0%   { opacity: 0.85; transform: translate(-50%, -50%) scale(0.4); }
    100% { opacity: 0;    transform: translate(-50%, -50%) scale(2.6); }
}
.l-cursor-label {
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.02em;
    margin-top: 14px;
    white-space: nowrap;
    box-shadow: 0 6px 14px -4px rgba(0, 0, 0, 0.35);
}
.l-cursor-label::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    margin-right: 5px;
    vertical-align: middle;
    opacity: 0.9;
}

/* Cursors are positioned and tweened entirely by JS via gsap.to in
   initCursorClicks(). CSS only sets the brand color, label background,
   and a unique z-index per cursor so they have a stable stacking order
   (no flickering when their bounding boxes overlap during navigation). */
.l-cursor svg path { fill: currentColor; stroke: #fff; stroke-width: 1.2; }

/* @sarah → Fitness */
.l-cursor-1 { color: #ff375f; z-index: 11; }
.l-cursor-1 .l-cursor-label { background: #ff375f; }

/* @marcus → Messenger */
.l-cursor-2 { color: #0a84ff; z-index: 12; }
.l-cursor-2 .l-cursor-label { background: #0a84ff; }

/* @rin → Adventure MMO */
.l-cursor-3 { color: #30d158; z-index: 13; }
.l-cursor-3 .l-cursor-label { background: #30d158; }

/* @alex → Red Light 2P */
.l-cursor-4 { color: #bf5af2; z-index: 14; }
.l-cursor-4 .l-cursor-label { background: #bf5af2; }

/* @maya → Quiz Duel */
.l-cursor-5 { color: #ff9f0a; z-index: 15; }
.l-cursor-5 .l-cursor-label { background: #ff9f0a; color: #3a2400; }

/* @noah → Focus Timer */
.l-cursor-6 { color: #ffd60a; z-index: 16; }
.l-cursor-6 .l-cursor-label { background: #ffd60a; color: #3a2a00; }

/* @lila → Today (todo) */
.l-cursor-7 { color: #ff2d55; z-index: 17; }
.l-cursor-7 .l-cursor-label { background: #ff2d55; }

/* When a cursor is mid-click, pop it above the others so its ripple
   isn't visually clipped by another cursor passing over the same spot. */
.l-cursor.clicking { z-index: 25; }

/* ═══ Platform availability row under the arc ═══ */
.l-arc-platforms {
    position: absolute;
    left: 50%;
    bottom: 6px;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 10px 18px;
    background: color-mix(in srgb, var(--bg-body) 85%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--l-border);
    border-radius: 999px;
    box-shadow: var(--l-shadow);
    z-index: 9;
    white-space: nowrap;
}

.l-arc-plat-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--l-muted);
    padding-right: 8px;
    border-right: 1px solid var(--l-border);
}

.l-arc-plat-items {
    display: inline-flex;
    align-items: center;
    gap: 16px;
}

.l-arc-plat-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    color: var(--l-fg);
    letter-spacing: -0.005em;
}

.l-arc-plat-item svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.l-arc-plat-item-ios svg     { color: var(--l-fg); }
.l-arc-plat-item-android svg { color: #3ddc84; }
.l-arc-plat-item-web svg     { color: var(--accent); }
.l-arc-plat-item-tg svg      { color: #2aabee; }

@media (max-width: 1100px) {
    .l-arc-platforms {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        margin: 8px auto 0;
        grid-column: 1 / -1;
        justify-content: center;
    }
}

@media (max-width: 560px) {
    .l-arc-plat-label { display: none; }
    .l-arc-platforms { padding: 8px 14px; gap: 10px; }
    .l-arc-plat-items { gap: 12px; }
}

/* ═══ Showcase phase (per-app spotlight) ═══ */
.l-arc-showcase {
    position: absolute;
    top: 50%;
    left: 50%;
    /* centering is done via GSAP xPercent/yPercent -50 so transforms don't fight */
    display: flex;
    align-items: center;
    gap: 60px;
    max-width: 1100px;
    width: calc(100% - 80px);
    opacity: 0;
    pointer-events: none;
    z-index: 6;
    contain: layout paint;
    will-change: transform, opacity;
}

.l-showcase-card {
    position: relative;
    width: 320px;
    height: 440px;
    flex-shrink: 0;
    border-radius: 28px;
    background: var(--l-surface);
    border: 1px solid var(--l-border);
    box-shadow:
        0 50px 100px -20px rgba(0, 0, 0, 0.55),
        0 20px 40px -15px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
[data-theme="light"] .l-showcase-card {
    box-shadow:
        0 40px 80px -20px rgba(17, 24, 39, 0.22),
        0 15px 30px -10px rgba(17, 24, 39, 0.15);
}

.l-showcase-card-mount {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    background: var(--bg-body);
    border-radius: 22px 22px 0 0;
    overflow: hidden;
    margin: 8px 8px 0;
}

.l-showcase-card-label {
    padding: 14px 16px 16px;
    border-top: 1px solid var(--l-border);
    background: var(--l-surface);
}
.l-showcase-card-label-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--l-fg);
}
.l-showcase-card-label-prompt {
    font-family: ui-monospace, "SF Mono", monospace;
    font-size: 11px;
    color: var(--accent);
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.l-showcase-text {
    flex: 1;
    max-width: 480px;
    min-width: 0;
}

.l-showcase-counter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--l-border);
    background: var(--l-surface);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}
.l-showcase-counter::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.l-showcase-title {
    margin-top: 20px;
    font-size: clamp(32px, 4.5vw, 54px);
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -0.035em;
    color: var(--l-fg);
    min-height: 2.1em; /* reserve 2 lines to prevent reflow on swap */
}
.l-showcase-title .serif {
    font-weight: 400;
    font-family: var(--serif);
    font-style: italic;
}

.l-showcase-desc {
    margin-top: 22px;
    font-size: 17px;
    line-height: 1.55;
    color: var(--l-dim);
    max-width: 42ch;
    min-height: 4.65em; /* reserve 3 lines */
}

.l-showcase-plat {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 28px;
    padding: 10px 18px;
    background: var(--l-surface);
    border: 1px solid var(--l-border);
    border-radius: 999px;
}
.l-showcase-plat-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--l-muted);
    padding-right: 10px;
    border-right: 1px solid var(--l-border);
}
.l-showcase-plat-items {
    display: inline-flex;
    gap: 14px;
}
.l-showcase-plat-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    color: var(--l-fg);
}
.l-showcase-plat-item svg { width: 13px; height: 13px; fill: currentColor; }
.l-showcase-plat-item-android svg { color: #3ddc84; }
.l-showcase-plat-item-web svg { color: var(--accent); }
.l-showcase-plat-item-tg svg { color: #2aabee; }

@media (max-width: 980px) {
    .l-arc-showcase { flex-direction: column; gap: 24px; text-align: center; }
    .l-showcase-text { text-align: center; }
    .l-showcase-desc { margin-left: auto; margin-right: auto; }
    .l-showcase-card { width: 260px; height: 360px; }
}

/* ═══ Final reveal (big "Available everywhere") ═══ */
.l-arc-final {
    position: absolute;
    top: 50%;
    left: 50%;
    /* centering via GSAP xPercent/yPercent */
    text-align: center;
    max-width: 840px;
    width: calc(100% - 80px);
    opacity: 0;
    pointer-events: none;
    z-index: 7;
    contain: layout paint;
    will-change: transform, opacity;
}

.l-arc-final-eyebrow {
    display: inline-block;
    font-size: 12px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--l-muted);
    margin-bottom: 22px;
    font-weight: 700;
}

.l-arc-final-title {
    font-size: clamp(42px, 6vw, 88px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--l-fg);
}
.l-arc-final-title .serif {
    font-weight: 400;
    font-family: var(--serif);
    font-style: italic;
}

.l-arc-final-sub {
    margin-top: 26px;
    font-size: clamp(16px, 1.6vw, 20px);
    line-height: 1.55;
    color: var(--l-dim);
    max-width: 56ch;
    margin-left: auto;
    margin-right: auto;
}

.l-arc-final-plat {
    display: inline-flex;
    align-items: center;
    gap: 22px;
    margin-top: 40px;
    padding: 22px 36px;
    background: var(--l-surface);
    border: 1px solid var(--l-border);
    border-radius: 999px;
    box-shadow: var(--l-shadow-strong);
}
.l-arc-final-plat-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 800;
    color: var(--l-fg);
    letter-spacing: -0.01em;
}
.l-arc-final-plat-item svg { width: 28px; height: 28px; fill: currentColor; }
.l-arc-final-plat-item-android svg { color: #3ddc84; }
.l-arc-final-plat-item-web svg { color: var(--accent); }
.l-arc-final-plat-item-tg svg { color: #2aabee; }
.l-arc-final-plat-sep {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--l-muted);
    flex-shrink: 0;
}

/* Fallback positions (no-GSAP) — simple static fan */
.l-arc-card-1 { transform: translate(-50%, 0) translate(-640px, 90px) rotate(-16deg) scale(0.74); z-index: 1; }
.l-arc-card-2 { transform: translate(-50%, 0) translate(-420px, 40px) rotate(-10deg) scale(0.82); z-index: 2; }
.l-arc-card-3 { transform: translate(-50%, 0) translate(-200px, 5px)  rotate(-4deg)  scale(0.92); z-index: 3; }
.l-arc-card-4 { transform: translate(-50%, 0) translate(0,      -30px) rotate(0)     scale(1.02); z-index: 5; }
.l-arc-card-5 { transform: translate(-50%, 0) translate(200px,  5px)  rotate(4deg)   scale(0.92); z-index: 3; }
.l-arc-card-6 { transform: translate(-50%, 0) translate(420px,  40px) rotate(10deg)  scale(0.82); z-index: 2; }
.l-arc-card-7 { transform: translate(-50%, 0) translate(640px,  90px) rotate(16deg)  scale(0.74); z-index: 1; }

/* ═══ Apps Arc — responsive ═══════════════════════════
   Below 1100px: scrollytelling is OFF (sticky/spacer collapsed,
   cursors hidden, showcase + final hidden). The 7 arc cards become
   a normal flexible grid that adapts cleanly down to phones. */
@media (max-width: 1100px) {
    .l-arc-spacer {
        height: auto;
        contain: none;
    }
    .l-arc-stage {
        position: relative;
        top: auto;
        height: auto;
        min-height: 0;
        max-height: none;
        padding: 16px 16px 32px;
        perspective: none;
        contain: none;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 20px;
        max-width: 920px;
        margin: 0 auto;
    }
    .l-arc-card {
        position: relative;
        top: auto;
        left: auto;
        transform: none !important;
        width: 100%;
        max-width: 320px;
        height: 360px;
        margin: 0 auto;
        box-shadow:
            0 20px 40px -15px rgba(0, 0, 0, 0.4),
            0 8px 16px -8px rgba(0, 0, 0, 0.3);
    }
    [data-theme="light"] .l-arc-card {
        box-shadow:
            0 18px 36px -15px rgba(17, 24, 39, 0.18),
            0 6px 14px -8px rgba(17, 24, 39, 0.12);
    }
    .l-arc-bg, .l-arc-cursors, .l-arc-showcase, .l-arc-final, .l-arc-platforms { display: none; }
}

/* Tablets / small laptops — keep 2-column grid, slightly bigger cards */
@media (max-width: 820px) {
    .l-arc-stage {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        gap: 18px;
        max-width: 600px;
        padding: 14px 14px 28px;
    }
    .l-arc-card {
        max-width: 280px;
        height: 340px;
    }
}

/* Phones — single column, full width */
@media (max-width: 600px) {
    .l-arc-stage {
        grid-template-columns: 1fr;
        gap: 16px;
        max-width: 360px;
        padding: 12px 16px 24px;
    }
    .l-arc-card {
        max-width: 100%;
        height: 320px;
    }
    .l-arc-label {
        padding: 11px 14px 13px;
    }
    .l-arc-label-name { font-size: 13px; }
    .l-arc-label-prompt { font-size: 10.5px; }
}

/* Section padding & header tighter on mobile so the apps section
   doesn't dwarf everything else */
@media (max-width: 820px) {
    #apps.l-section {
        padding: clamp(50px, 8vh, 90px) clamp(16px, 4vw, 32px) clamp(40px, 6vh, 70px);
    }
    #apps .l-section-header {
        margin-bottom: 32px !important;
    }
}

