/* ════════════════════════════════════════════════════════════════
   Portfolio Visual Enhancements
   Phase 1 · 3 · 5 · 6 — global styles shared across components
   ════════════════════════════════════════════════════════════════ */

/* ── Phase 1.1 — Scroll Progress Bar ────────────────────────── */
#scroll-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: var(--scroll-progress, 0%);
    background: linear-gradient(90deg, var(--primary) 0%, #8b5cf6 100%);
    z-index: 9999;
    pointer-events: none;
    transition: width 0.06s linear;
    border-radius: 0 1px 1px 0;
}

/* ── Phase 1.2 — Cursor Spotlight ────────────────────────────── */
.cursor-spotlight {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(
        600px circle at var(--cx, -1000px) var(--cy, -1000px),
        rgba(59, 130, 246, 0.055),
        transparent 80%
    );
}

[data-theme="light"] .cursor-spotlight {
    background: radial-gradient(
        600px circle at var(--cx, -1000px) var(--cy, -1000px),
        rgba(37, 99, 235, 0.055),
        transparent 80%
    );
}

/* ── Phase 1.3 — Section Navigator ──────────────────────────── */
.section-nav {
    position: fixed;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    z-index: 200;
    align-items: flex-end;
    padding: 0.5rem 0;
}

.section-nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 5px 0;
}

.section-nav-item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}

.section-nav-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted);
    font-family: var(--font-mono);
    opacity: 0;
    transform: translateX(6px);
    transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
    white-space: nowrap;
    letter-spacing: 0.03em;
    pointer-events: none;
}

.section-nav-item:hover .section-nav-label {
    opacity: 1;
    transform: translateX(0);
}

.section-nav-item.active .section-nav-label {
    opacity: 1;
    transform: translateX(0);
    color: var(--primary);
}

.section-nav-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.section-nav-item:hover .section-nav-dot {
    background: var(--muted);
    transform: scale(1.3);
}

.section-nav-item.active .section-nav-dot {
    background: var(--primary);
    transform: scale(1.5);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ── Phase 5.3 / 5.4 — Particle Burst & Sparkle Keyframes ──── */
@keyframes particle-burst {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) translate(var(--tx), var(--ty)) scale(0.2);
    }
}

/* ── Phase 6.1 — Faint Section Number Watermarks ────────────── */
body {
    counter-reset: section-counter;
}

section[id]:not(#home) {
    counter-increment: section-counter;
    position: relative; /* required so ::after is positioned within the section */
}

section[id]:not(#home)::after {
    content: counter(section-counter, decimal-leading-zero);
    position: absolute;
    top: calc(var(--section-space, 96px) - 2rem);
    right: 2rem;
    font-size: 11rem;
    font-weight: 800;
    color: var(--text);
    opacity: 0.028;
    line-height: 1;
    pointer-events: none;
    letter-spacing: -0.05em;
    font-family: var(--font-body);
    z-index: 0;
    user-select: none;
}

/* ── B.3 — Section numbers: reduce opacity on light theme ────── */
/* Dark text (#0f172a) at the default 0.028 opacity reads heavier
   on white than light text (#e5e7eb) does on the dark background,
   so we pull it back to match the perceived visual weight.        */
[data-theme="light"] section[id]:not(#home)::after {
    opacity: 0.018;
}

/* ── B.4 — Tech marquee badges: add border on light theme ─────── */
/* On light, --primary-soft is rgba(37,99,235,0.10) on #f8fafc —
   without a border the badge outline disappears. A thin border
   gives it the same definition it has on the dark theme.          */
[data-theme="light"] .tech-mq-badge {
    border: 1px solid rgba(37, 99, 235, 0.22);
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 900px) {
    .section-nav {
        display: none;
    }

    section[id]:not(#home)::after {
        font-size: 7rem;
        right: 1rem;
    }
}

@media (max-width: 640px) {
    .cursor-spotlight {
        display: none;
    }

    section[id]:not(#home)::after {
        font-size: 5.5rem;
        top: calc(var(--section-space, 56px) - 0.5rem);
    }
}

/* ── Reduced Motion ───────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    #scroll-progress-bar {
        transition: none;
    }
}
