/* =====================================================
   TrendTech v2 — GERÇEK PUZZLE PARÇASI KARTLARI
   Hizmetler ve Çözümler bölümleri için
   ===================================================== */

/* SVG mask için tarayıcı uyumluluk değişkenleri */
:root {
    --puzzle-tab-size: 14%;
}

/* =============== PUZZLE GRID KAPLAMA =============== */
.puzzle-services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    margin: 32px 0;
    perspective: 1500px;
}

/* 4 satırlı puzzle düzeni */
.puzzle-services-grid.rows-2 {
    grid-template-rows: repeat(2, auto);
}

/* =============== PUZZLE PARÇASI KART =============== */
.puzzle-card {
    position: relative;
    aspect-ratio: 1.1;
    padding: 0;
    margin: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    text-decoration: none;
    display: block;
    /* Negatif margin ile parçalar üst üste binip kenetlenir */
    margin: -1.4% -1.4% 0 0;
    z-index: 1;
}

/* Puzzle parça svg formu */
.puzzle-card-shape {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.puzzle-card-shape path {
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Parça gövde rengi - varsayılan */
.puzzle-card-shape .piece-body {
    fill: rgba(15, 29, 51, 0.85);
    stroke: rgba(78, 168, 255, 0.3);
    stroke-width: 0.4;
    filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.3));
    transition: all 0.5s ease;
}

/* Parça içi gradient overlay */
.puzzle-card-shape .piece-glow {
    fill: url(#puzzleGlowGradient);
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* =============== HOVER EFEKTLERİ - PUZZLE KALKAR =============== */
.puzzle-card:hover {
    transform: translateY(-12px) translateZ(40px) scale(1.04);
    z-index: 10;
}

.puzzle-card:hover .puzzle-card-shape .piece-body {
    fill: rgba(20, 40, 70, 0.95);
    stroke: rgba(78, 168, 255, 0.9);
    stroke-width: 0.6;
    filter: 
        drop-shadow(0 16px 40px rgba(78, 168, 255, 0.4))
        drop-shadow(0 0 30px rgba(78, 168, 255, 0.3));
}

.puzzle-card:hover .puzzle-card-shape .piece-glow {
    opacity: 1;
}

/* =============== KART İÇERİK =============== */
.puzzle-card-content {
    position: relative;
    z-index: 2;
    padding: 28% 18% 18%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: var(--text-primary);
}

.puzzle-card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: rgba(78, 168, 255, 0.15);
    border: 1px solid rgba(78, 168, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    font-size: 1.5rem;
    margin-bottom: 14px;
    transition: all 0.4s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.puzzle-card:hover .puzzle-card-icon {
    background: var(--accent-gradient);
    color: var(--bg-primary);
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 8px 20px var(--accent-glow);
}

.puzzle-card-title {
    font-family: var(--serif);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 8px;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.puzzle-card:hover .puzzle-card-title {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.puzzle-card-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 12px;
    /* 3 satırla sınırla */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.puzzle-card-link {
    margin-top: auto;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-primary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.puzzle-card:hover .puzzle-card-link {
    opacity: 1;
    transform: translateX(2px);
}

.puzzle-card-link i {
    transition: transform 0.3s ease;
}

.puzzle-card:hover .puzzle-card-link i {
    transform: translateX(4px);
}

/* =============== PUZZLE BAĞLANTI NOKTALARI =============== */
/* Parçaların kenetlendiği yerlerdeki ışıltı */
.puzzle-card .connector-glow {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--accent-glow);
    opacity: 0;
    z-index: 3;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.puzzle-card:hover .connector-glow {
    opacity: 1;
    animation: connector-pulse-puzzle 1.5s ease-in-out infinite;
}

.puzzle-card .connector-glow.cg-top { top: 10%; left: 50%; transform: translateX(-50%); }
.puzzle-card .connector-glow.cg-right { right: 8%; top: 50%; transform: translateY(-50%); }
.puzzle-card .connector-glow.cg-bottom { bottom: 12%; left: 50%; transform: translateX(-50%); }
.puzzle-card .connector-glow.cg-left { left: 8%; top: 50%; transform: translateY(-50%); }

@keyframes connector-pulse-puzzle {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.6; }
}

/* =============== SIRALI BELİRME ANİMASYONU =============== */
@keyframes puzzle-piece-snap {
    0% {
        opacity: 0;
        transform: translateY(-30px) rotate(-8deg) scale(0.85);
    }
    60% {
        transform: translateY(8px) rotate(2deg) scale(1.03);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotate(0deg) scale(1);
    }
}

.puzzle-services-grid .puzzle-card {
    animation: puzzle-piece-snap 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

/* Her parça farklı zamanda yerleşir - puzzle birleşme efekti */
.puzzle-services-grid .puzzle-card:nth-child(1) { animation-delay: 0.0s; }
.puzzle-services-grid .puzzle-card:nth-child(2) { animation-delay: 0.15s; }
.puzzle-services-grid .puzzle-card:nth-child(3) { animation-delay: 0.30s; }
.puzzle-services-grid .puzzle-card:nth-child(4) { animation-delay: 0.45s; }
.puzzle-services-grid .puzzle-card:nth-child(5) { animation-delay: 0.60s; }
.puzzle-services-grid .puzzle-card:nth-child(6) { animation-delay: 0.75s; }
.puzzle-services-grid .puzzle-card:nth-child(7) { animation-delay: 0.90s; }
.puzzle-services-grid .puzzle-card:nth-child(8) { animation-delay: 1.05s; }
.puzzle-services-grid .puzzle-card:nth-child(9) { animation-delay: 1.20s; }

/* =============== KARTI HAFİFÇE EĞ - PUZZLE GİBİ =============== */
.puzzle-services-grid .puzzle-card:nth-child(odd) { transform-origin: bottom left; }
.puzzle-services-grid .puzzle-card:nth-child(even) { transform-origin: bottom right; }

/* =============== RESPONSIVE =============== */
@media (max-width: 992px) {
    .puzzle-services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .puzzle-card-content {
        padding: 26% 14% 14%;
    }
    
    .puzzle-card-title { font-size: 0.95rem; }
    .puzzle-card-desc { font-size: 0.74rem; -webkit-line-clamp: 2; }
}

@media (max-width: 600px) {
    .puzzle-services-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .puzzle-card {
        margin: -3% 0 0 0;
        aspect-ratio: 2.5;
    }
    
    .puzzle-card-content {
        padding: 16% 22% 12%;
        flex-direction: row;
        text-align: left;
        gap: 16px;
    }
    
    .puzzle-card-icon {
        margin-bottom: 0;
        flex-shrink: 0;
    }
    
    .puzzle-card-text-wrap {
        flex: 1;
    }
    
    .puzzle-card-title { font-size: 1.05rem; margin-bottom: 4px; }
    .puzzle-card-desc { font-size: 0.78rem; -webkit-line-clamp: 2; margin-bottom: 4px; }
}

/* =============== BÖLÜM BAŞLIĞI - PUZZLE SUNUM =============== */
.puzzle-section-header {
    text-align: center;
    max-width: 720px;
    margin: 0 auto 48px;
    position: relative;
}

.puzzle-section-header::before {
    content: '';
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M 10,10 L 35,10 Q 40,10 40,5 Q 40,0 50,0 Q 60,0 60,5 Q 60,10 65,10 L 90,10 L 90,35 Q 90,40 95,40 Q 100,40 100,50 Q 100,60 95,60 Q 90,60 90,65 L 90,90 L 65,90 Q 60,90 60,95 Q 60,100 50,100 Q 40,100 40,95 Q 40,90 35,90 L 10,90 L 10,65 Q 10,60 5,60 Q 0,60 0,50 Q 0,40 5,40 Q 10,40 10,35 Z' fill='rgba(78,168,255,0.15)' stroke='rgba(78,168,255,0.6)' stroke-width='2'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    animation: section-puzzle-spin 8s linear infinite;
}

@keyframes section-puzzle-spin {
    from { transform: translateX(-50%) rotate(0deg); }
    to { transform: translateX(-50%) rotate(360deg); }
}
