/* ============================================================
   SKILLS SECTION — VISUAL / INTERACTION REDESIGN LAYER
   ------------------------------------------------------------
   Scoped entirely under #skills. Loaded after style.css + motion.css
   so it can safely override presentation on the existing markup
   without touching content, copy, technologies, or the existing
   pink/dark theme tokens (--main, --main-soft, --main-rgb, --surface…).
   No text, labels, categories or technologies are added, removed
   or renamed anywhere in this file.
   ============================================================ */

#skills {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    padding: 140px 8% 120px;
}

/* Faint structural grid — pure decoration, reinforces the
   "interface" feeling without adding any new information. */
#skills::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(var(--main-rgb), 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(var(--main-rgb), 0.05) 1px, transparent 1px);
    background-size: 64px 64px;
    -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 72%);
    mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 72%);
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
}

/* "Active field" — a soft pink atmosphere that drifts toward the
   cursor / active scroll position. Purely additive light, never
   interactive text, never covers content (low opacity + blur). */
.skills-active-field {
    position: absolute;
    inset: -10%;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(
            520px 520px at var(--field-x, 50%) var(--field-y, 32%),
            rgba(var(--main-rgb), 0.16),
            transparent 62%
        );
    transition: background-position 0.6s ease;
    will-change: background-position;
}

/* ---------- Header: shifted asymmetric, larger scale ---------- */
#skills > p {
    text-align: left;
    max-width: 1200px;
    margin: 0 auto 6px;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}
#skills > p::before {
    content: "";
    width: 28px;
    height: 1px;
    background: linear-gradient(90deg, var(--main), transparent);
    display: inline-block;
}
#skills > h1 {
    text-align: left;
    max-width: 1200px;
    margin: 0 auto 22px;
    position: relative;
    z-index: 1;
    font-size: clamp(32px, 5vw, 54px);
    letter-spacing: -0.5px;
}
#skills > hr {
    margin: 0 auto 64px;
    max-width: 1200px;
    margin-left: 0;
    margin-right: auto;
    position: relative;
    z-index: 1;
}
@media (max-width: 900px) {
    #skills > p,
    #skills > h1,
    #skills > hr {
        text-align: center;
        margin-left: auto;
    }
}

/* ---------- Stage: scroll canvas + skill cards ---------- */
.scroll-video-section {
    position: relative;
    z-index: 1;
    max-width: 1300px;
    margin-left: auto;
    margin-right: auto;
}

.scroll-video-sticky::before {
    background: radial-gradient(circle at 50% 50%, rgba(var(--main-rgb), 0.16) 0%, transparent 68%);
    filter: blur(2px);
}

/* Canvas becomes a framed "viewport" object rather than a plain
   video rectangle — glass bezel, ambient ring, subtle depth tilt. */
#scrollVideoCanvas {
    border-radius: 26px;
    box-shadow:
        0 50px 120px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(var(--main-rgb), 0.3),
        0 0 80px rgba(var(--main-rgb), 0.12);
    background: linear-gradient(180deg, rgba(var(--main-rgb), 0.06), transparent 40%);
    transform: perspective(1400px) rotateY(0deg);
    transition: box-shadow 0.4s ease, transform 0.6s ease;
}
.scroll-video-sticky:hover #scrollVideoCanvas {
    box-shadow:
        0 50px 130px rgba(0, 0, 0, 0.65),
        0 0 0 1px rgba(var(--main-rgb), 0.5),
        0 0 100px rgba(var(--main-rgb), 0.2);
}

/* Skill category cards → premium interface objects */
#skills .skill-category {
    background: linear-gradient(160deg, var(--surface-strong), var(--surface) 70%);
    border: 1px solid var(--main-line);
    border-radius: 18px;
    padding: 26px 24px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
    position: relative;
    overflow: hidden;
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.4s ease,
                box-shadow 0.4s ease,
                background 0.4s ease;
}
/* Hairline gradient border glow drawn on a pseudo-layer so the
   real border stays crisp at 1px while the glow can be soft. */
#skills .skill-category::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(var(--main-rgb), 0.55), transparent 60%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}
#skills .skill-category::after {
    content: "";
    position: absolute;
    top: -40%;
    left: -20%;
    width: 60%;
    height: 180%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: translateX(-120%) rotate(8deg);
    transition: transform 0.9s ease;
    pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
    #skills .skill-category:hover {
        transform: translateY(-6px);
        border-color: rgba(var(--main-rgb), 0.45);
        box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45), 0 0 40px rgba(var(--main-rgb), 0.18);
    }
    #skills .skill-category:hover::before { opacity: 1; }
    #skills .skill-category:hover::after { transform: translateX(120%) rotate(8deg); }
}
#skills .skill-category:active {
    transform: translateY(-2px) scale(0.99);
}

#skills .skill-category h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    letter-spacing: 0.5px;
    color: #fff;
}
#skills .skill-category h3 i {
    color: var(--main);
    filter: drop-shadow(0 0 8px var(--main-glow-sm));
}

#skills .skill-tags span {
    background: rgba(var(--main-rgb), 0.07);
    border-radius: 999px;
    transition: border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}
#skills .skill-tags span:hover {
    transform: translateY(-2px);
}

/* Graceful cross-fade / mask reveal instead of an abrupt swap when
   the active scroll-linked skill panel changes (item 11 / 12). */
#skills .scroll-skill-card.is-transitioning {
    animation: skillsRevealV2 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes skillsRevealV2 {
    0%   { opacity: 0; transform: translateY(14px) scale(0.97); filter: blur(6px); }
    60%  { filter: blur(0px); }
    100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* Progress rail — minimal, decorative-only scroll indicator for
   this section (desktop). No new informational content. */
.skills-progress-rail {
    position: absolute;
    left: calc(50% - 430px);
    top: 8%;
    bottom: 8%;
    width: 2px;
    background: rgba(var(--main-rgb), 0.12);
    border-radius: 2px;
    z-index: 3;
    overflow: hidden;
}
.skills-progress-rail .skills-progress-fill {
    display: block;
    width: 100%;
    height: var(--skills-progress, 0%);
    background: linear-gradient(180deg, var(--main), var(--main-soft));
    box-shadow: 0 0 14px var(--main-glow-md);
    transition: height 0.15s linear;
}
@media (max-width: 1300px) {
    .skills-progress-rail { left: 24px; }
}
@media (max-width: 1100px) {
    .skills-progress-rail { display: none; }
}

/* ---------- Technology grid → panel treatment ---------- */
.tech-panel {
    position: relative;
    z-index: 1;
    max-width: 1160px;
    margin: 0 auto;
    padding: 44px 40px;
    border-radius: 24px;
    background: linear-gradient(180deg, var(--surface), rgba(255, 255, 255, 0.015));
    border: 1px solid var(--main-line);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.4);
}

.tech-icons-grid {
    grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
    gap: 14px;
    max-width: none;
}

#skills .tech-icon {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 16px 8px 12px;
    color: #b8b8b8;
    opacity: 0;
    transform: translateY(14px);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.5s ease,
                border-color 0.35s ease,
                background 0.35s ease,
                box-shadow 0.35s ease;
}
#skills .tech-icon.in-view {
    opacity: 1;
    transform: translateY(0);
}
#skills .tech-icon i {
    font-size: 32px;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), filter 0.35s ease;
}
#skills .tech-icon span {
    font-size: 11.5px;
    letter-spacing: 0.2px;
    opacity: 0.85;
}
@media (hover: hover) and (pointer: fine) {
    .tech-panel:hover .tech-icon:not(:hover) {
        opacity: 0.55;
    }
    #skills .tech-icon:hover {
        border-color: rgba(var(--main-rgb), 0.4);
        background: rgba(var(--main-rgb), 0.08);
        box-shadow: 0 12px 30px rgba(var(--main-rgb), 0.15);
        opacity: 1 !important;
    }
    #skills .tech-icon:hover i {
        transform: translateY(-4px) scale(1.08);
    }
}
#skills .tech-icon:active {
    border-color: rgba(var(--main-rgb), 0.5);
    background: rgba(var(--main-rgb), 0.1);
}

@media (max-width: 640px) {
    #skills { padding: 100px 6% 90px; }
    .tech-panel { padding: 30px 18px; }
    .tech-icons-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}

/* ---------- Reduced motion: strip decorative motion, keep content ---------- */
@media (prefers-reduced-motion: reduce) {
    .skills-active-field { transition: none; }
    #skills .skill-category,
    #skills .skill-category::before,
    #skills .skill-category::after,
    #skills .tech-icon,
    #skills .tech-icon i,
    #scrollVideoCanvas {
        transition: none !important;
        animation: none !important;
        transform: none !important;
    }
    #skills .tech-icon { opacity: 1 !important; }
    #skills .scroll-skill-card.is-transitioning { animation: none !important; opacity: 1; filter: none; }
    .skills-progress-rail .skills-progress-fill { transition: none; }
}
