/* ===== PROJECTS SHOWCASE ===== */
.projects-showcase {
    position: relative;
    background: var(--bg-primary);
    overflow: hidden;
}

/* ---- BG Canvas ---- */
#showcase-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* ---- AI Scanner ---- */
.ai-scanner {
    position: fixed;
    top: 50%; left: 50%;
    width: min(500px, 80vw);
    height: min(500px, 80vw);
    transform: translate(-50%, -50%);
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.ai-scanner.active {
    opacity: 1;
}

.scanner-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(124,58,237,0.15);
    animation: scannerPulse 3s ease-in-out infinite;
}

.scanner-ring:nth-child(2) { animation-delay: 0.3s; }
.scanner-ring:nth-child(3) { animation-delay: 0.6s; }
.scanner-ring:nth-child(4) { animation-delay: 0.9s; }

@keyframes scannerPulse {
    0%, 100% { transform: scale(1); opacity: 0.3; border-color: rgba(124,58,237,0.1); }
    50% { transform: scale(1.15); opacity: 0.6; border-color: rgba(124,58,237,0.3); }
}

.scanner-arc {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: #7c3aed;
    border-right-color: #06b6d4;
    animation: scannerRotate 4s linear infinite;
    filter: blur(1px);
    box-shadow: 0 0 20px rgba(124,58,237,0.2), 0 0 60px rgba(6,182,212,0.1);
}

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

.scanner-line {
    position: absolute;
    top: 50%; left: 50%;
    width: 120%;
    height: 1px;
    transform: translate(-50%, -50%) rotate(0deg);
    background: linear-gradient(90deg, transparent, #7c3aed, #06b6d4, transparent);
    animation: scannerLineRotate 6s linear infinite;
    opacity: 0.4;
}

@keyframes scannerLineRotate {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.scanner-info {
    position: absolute;
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    text-align: center;
    opacity: 0;
    transition: all 0.5s ease;
}

.ai-scanner.active .scanner-info {
    opacity: 1;
    bottom: -60px;
}

.scanner-info .si-name {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: linear-gradient(90deg, #7c3aed, #06b6d4);
    -webkit-text-fill-color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
}

.scanner-info .si-detail {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.3);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-top: 4px;
}

/* ---- Header ---- */
.projects-header {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 120px 40px 80px;
}

.projects-header .bg-title {
    position: absolute;
    font-size: clamp(6rem, 18vw, 16rem);
    font-weight: 900;
    color: transparent;
    -webkit-text-stroke: 2px rgba(124,58,237,0.06);
    text-stroke: 2px rgba(124,58,237,0.06);
    letter-spacing: 0.08em;
    pointer-events: none;
    user-select: none;
    animation: headerGlow 5s ease-in-out infinite;
}

@keyframes headerGlow {
    0%, 100% { -webkit-text-stroke-color: rgba(124,58,237,0.06); }
    50% { -webkit-text-stroke-color: rgba(124,58,237,0.14); }
}

.projects-header h1 {
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 900;
    letter-spacing: 4px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #fff 0%, #7c3aed 35%, #06b6d4 65%, #ec4899 100%);
    -webkit-text-fill-color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
    position: relative;
    z-index: 1;
    line-height: 1.1;
}

.projects-header .subtitle {
    color: var(--text-secondary);
    letter-spacing: 6px;
    text-transform: uppercase;
    margin-top: 20px;
    font-size: clamp(0.7rem, 1.2vw, 0.95rem);
    max-width: 700px;
    line-height: 1.8;
    position: relative;
    z-index: 1;
}

.projects-header .scroll-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.2);
    font-size: 0.55rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    animation: hintFade 2s ease-in-out infinite;
}

@keyframes hintFade {
    0%, 100% { opacity: 0.2; transform: translateX(-50%) translateY(0); }
    50% { opacity: 0.6; transform: translateX(-50%) translateY(4px); }
}

/* ---- Project Section ---- */
.project-section {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 100px 60px;
    overflow: hidden;
}

.project-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at var(--spot-x, 50%) var(--spot-y, 50%), rgba(124,58,237,0.03) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.project-inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    align-items: center;
}

/* Project Left */
.project-left {
    position: relative;
}

.project-number {
    font-size: clamp(4rem, 8vw, 7rem);
    font-weight: 900;
    color: transparent;
    -webkit-text-stroke: 1px rgba(124,58,237,0.15);
    text-stroke: 1px rgba(124,58,237,0.15);
    line-height: 1;
    margin-bottom: 8px;
}

.project-theme {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: rgba(124,58,237,0.5);
    margin-bottom: 24px;
    display: block;
}

.project-title {
    font-size: clamp(1.5rem, 3vw, 2.8rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.project-title span {
    background: linear-gradient(135deg, #7c3aed, #06b6d4);
    -webkit-text-fill-color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
}

.project-desc {
    color: var(--text-secondary);
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    line-height: 1.9;
    margin-bottom: 24px;
    max-width: 520px;
}

/* Project details list */
.project-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 24px;
    margin-bottom: 24px;
}

.project-details dt {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(124,58,237,0.5);
    margin-bottom: 2px;
}

.project-details dd {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 10px;
}

/* Tags */
.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.project-tag {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(124,58,237,0.1);
    border: 1px solid rgba(124,58,237,0.15);
    color: rgba(255,255,255,0.6);
    transition: all 0.4s ease;
}

.project-tag:hover {
    background: rgba(124,58,237,0.2);
    border-color: rgba(124,58,237,0.3);
    color: #fff;
    box-shadow: 0 0 20px rgba(124,58,237,0.1);
}

/* Project Right — visual content */
.project-right {
    position: relative;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-visual {
    width: 100%;
    max-width: 520px;
    aspect-ratio: 4/3;
    border-radius: 20px;
    background: rgba(19,28,49,0.4);
    border: 1px solid rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: all 0.6s ease;
}

.project-visual canvas,
.project-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 20px;
}

.visual-placeholder {
    text-align: center;
    padding: 40px;
}

.visual-placeholder .vp-icon {
    width: 64px; height: 64px;
    margin: 0 auto 16px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 800;
}

.visual-placeholder .vp-label {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.2);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Achievement badges */
.achievement-badge {
    position: absolute;
    padding: 10px 16px;
    border-radius: 10px;
    background: rgba(19,28,49,0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.06);
    font-size: 0.6rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.5s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.achievement-badge .ab-value {
    font-size: 1.1rem;
    font-weight: 800;
    background: linear-gradient(135deg, #7c3aed, #06b6d4);
    -webkit-text-fill-color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
    display: block;
    margin-bottom: 2px;
}

.achievement-badge .ab-label {
    color: rgba(255,255,255,0.4);
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.badge-1 { top: 10%; left: -20px; }
.badge-2 { top: 40%; right: -10px; }
.badge-3 { bottom: 15%; left: 10%; }

/* ---- PLC Showcase ---- */
.plc-showcase {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 100px 60px 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.plc-header {
    text-align: center;
    margin-bottom: 60px;
}

.plc-header h2 {
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #7c3aed, #06b6d4, #ec4899);
    -webkit-text-fill-color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
    margin-bottom: 12px;
}

.plc-header p {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 4px;
}

.plc-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 24px;
    max-width: 1100px;
    width: 100%;
    perspective: 1200px;
}

.plc-card {
    position: relative;
    aspect-ratio: 1;
    border-radius: 20px;
    background: rgba(19,28,49,0.3);
    border: 1px solid rgba(255,255,255,0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.34,1.56,0.64,1);
    transform-style: preserve-3d;
    overflow: hidden;
}

.plc-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.plc-card .plc-logo {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    transition: all 0.5s ease;
}

.plc-card .plc-name {
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5);
    transition: all 0.5s ease;
}

.plc-card .plc-details {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 16px;
    background: rgba(5,8,22,0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.34,1.56,0.64,1);
    border-top: 1px solid rgba(124,58,237,0.1);
}

.plc-card:hover .plc-details {
    transform: translateY(0);
}

.plc-details .pd-title {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
    background: linear-gradient(90deg, #7c3aed, #06b6d4);
    -webkit-text-fill-color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
}

.plc-details .pd-desc {
    font-size: 0.55rem;
    color: rgba(255,255,255,0.4);
    line-height: 1.5;
}

.plc-card:hover {
    transform: translateZ(40px) rotateX(4deg) scale(1.05);
    border-color: rgba(124,58,237,0.2);
    box-shadow: 0 20px 60px rgba(124,58,237,0.15);
}

.plc-card:hover .plc-logo {
    transform: scale(1.3) translateY(-8px);
}

.plc-card:hover .plc-name {
    color: #fff;
    text-shadow: 0 0 20px rgba(124,58,237,0.3);
}

.plc-card:nth-child(1)::before { background: linear-gradient(135deg, rgba(0,0,0,0.1), rgba(124,58,237,0.05)); }
.plc-card:nth-child(2)::before { background: linear-gradient(135deg, rgba(0,0,0,0.1), rgba(6,182,212,0.05)); }
.plc-card:nth-child(3)::before { background: linear-gradient(135deg, rgba(0,0,0,0.1), rgba(236,72,153,0.05)); }
.plc-card:nth-child(4)::before { background: linear-gradient(135deg, rgba(0,0,0,0.1), rgba(16,185,129,0.05)); }
.plc-card:nth-child(5)::before { background: linear-gradient(135deg, rgba(0,0,0,0.1), rgba(245,158,11,0.05)); }

/* ---- Scroll Story overlay ---- */
.story-active .project-section {
    will-change: transform, opacity;
}

/* ---- Footer spacer ---- */
.showcase-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 80px 40px 160px;
    border-top: 1px solid rgba(255,255,255,0.03);
}

.showcase-footer h3 {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.showcase-footer p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.8;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .project-inner { grid-template-columns: 1fr; gap: 40px; }
    .project-right { min-height: 300px; }
    .project-section { padding: 80px 40px; }
    .badge-1 { left: 10px; }
    .badge-2 { right: 10px; }
    .badge-3 { left: 20%; }
    .plc-grid { grid-template-columns: repeat(3, 1fr); max-width: 600px; }
}

@media (max-width: 768px) {
    .projects-header { padding: 100px 20px 60px; min-height: 80vh; }
    .projects-header h1 { font-size: clamp(1.8rem, 8vw, 2.8rem); }
    .projects-header .bg-title { font-size: clamp(4rem, 15vw, 8rem); }
    .project-section { padding: 60px 20px; min-height: auto; }
    .project-inner { gap: 30px; }
    .project-details { grid-template-columns: 1fr; }
    .project-visual { aspect-ratio: 16/10; }
    .badge-1, .badge-2, .badge-3 { position: relative; top: auto; left: auto; right: auto; bottom: auto; display: inline-block; margin: 4px; }
    .ai-scanner { width: min(320px, 90vw); height: min(320px, 90vw); }
    .scanner-info { display: none; }
    .plc-showcase { padding: 60px 20px 100px; }
    .plc-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; max-width: 400px; }
    .projects-header .scroll-hint { display: none; }
}

@media (max-width: 480px) {
    .projects-header { padding: 80px 16px 40px; }
    .project-section { padding: 40px 16px; }
    .project-number { font-size: 3rem; }
    .badge-1, .badge-2, .badge-3 { font-size: 0.5rem; padding: 6px 10px; }
    .badge-1 .ab-value, .badge-2 .ab-value, .badge-3 .ab-value { font-size: 0.9rem; }
    .plc-grid { gap: 12px; }
    .plc-card .plc-logo { width: 36px; height: 36px; font-size: 0.5rem; }
    .plc-card .plc-name { font-size: 0.45rem; }
    .showcase-footer { padding: 40px 16px 100px; }
}

/* ===== GALLERY ===== */
.portal-gallery {
    padding: 60px 0; overflow: hidden;
    position: relative; z-index: 1;
}
.gallery-header {
    text-align: center; margin-bottom: 36px; padding: 0 20px;
}
.gallery-header h2 {
    font-size: clamp(1rem, 2vw, 1.6rem); font-weight: 800;
    text-transform: uppercase; letter-spacing: 2px;
    background: linear-gradient(135deg, #fff 0%, #7c3aed 50%, #06b6d4 100%);
    -webkit-text-fill-color: transparent; background-clip: text; -webkit-background-clip: text;
}
.gallery-header p {
    font-size: 0.55rem; color: rgba(255,255,255,0.2);
    text-transform: uppercase; letter-spacing: 2px; margin-top: 6px;
}
.gallery-track-wrap {
    position: relative; display: flex; flex-direction: column; gap: 12px;
}
.gallery-track {
    display: flex; gap: 12px; width: fit-content;
    animation: galleryScroll 70s linear infinite;
}
.gallery-track-2 {
    animation: galleryScroll2 90s linear infinite;
}
@keyframes galleryScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
@keyframes galleryScroll2 {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.gallery-item {
    width: 200px; height: 140px; border-radius: 16px; flex-shrink: 0;
    display: flex; align-items: flex-end; justify-content: center;
    padding: 0; position: relative; overflow: hidden;
    transition: all 0.4s cubic-bezier(0.34,1.56,0.64,1);
    cursor: pointer;
}
.gallery-item img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; border-radius: 16px;
}
.gallery-item::after {
    content: ''; position: absolute; inset: 0; border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.06);
    background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 50%);
    pointer-events: none;
}
.gallery-item .gi-label {
    font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
    color: #fff; position: relative; z-index: 2; margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5); text-align: center; padding: 0 8px;
}
.gallery-item:hover {
    transform: translateY(-6px) scale(1.03); border-radius: 20px;
    box-shadow: 0 15px 40px rgba(124,58,237,0.15);
}
.gallery-item:hover img { transform: scale(1.08); }
.gallery-item img { transition: transform 0.4s ease; }

.gallery-empty {
    color: rgba(255,255,255,0.08); font-size: 0.6rem; text-transform: uppercase;
    letter-spacing: 2px; padding: 20px 0; width: 100%; text-align: center;
}

@media (max-width: 768px) {
    .portal-gallery { padding: 40px 0; }
    .gallery-track { gap: 8px; }
    .gallery-item { width: 150px; height: 100px; border-radius: 12px; }
    .gallery-item .gi-label { font-size: 0.5rem; }
}
