/* ==========================================================================
   Kar-Han Tedarik - Animasyon katmanı
   Renkler tailwind-config.js'deki kurumsal palete aittir.
   ========================================================================== */

:root {
    --kh-primary: #003e6f;
    --kh-primary-container: #005596;
    --kh-deep-navy: #002D56;
    --kh-tertiary: #00415c;
    --kh-secondary: #5c5f63;
    --kh-border-gray: #D1D1D1;
    --kh-surface: #f9f9f9;
}

/* --------------------------------------------------------------------------
   Aşama 1 - AOS
   -------------------------------------------------------------------------- */

/* AOS bir blok için yer ayırmaz ama yatay animasyonlar taşma yaratmasın */
body {
    overflow-x: hidden;
}

/* Mobilde yatay kayma yerine dikey kayma: sayfa genişliği taşmasın */
@media (max-width: 767px) {
    [data-aos="fade-left"]:not(.aos-animate),
    [data-aos="fade-right"]:not(.aos-animate) {
        transform: translate3d(0, 30px, 0);
    }
}

/* --------------------------------------------------------------------------
   Aşama 3 - Ürün kartları mikro animasyonları
   Tetikleyici: masaüstünde kart :hover, dokunmatik cihazda ikon görünür
   olunca JS'in eklediği .is-active sınıfı.
   -------------------------------------------------------------------------- */

/* Kart: hafif yükselme + gölge geçişi */
.corp-card.ambient-shadow {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

@media (hover: hover) {
    .corp-card.ambient-shadow:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 32px rgba(0, 45, 86, 0.16);
    }
}

.kh-icon {
    position: relative;
    display: inline-block;
    transform-origin: 50% 60%;
}

/* Çalışma koltuğu: dönüp yaylanır */
@keyframes kh-chair-spring {
    0%   { transform: rotate(0deg) scale(1); }
    25%  { transform: rotate(-24deg) scale(1.12); }
    50%  { transform: rotate(14deg) scale(1.05); }
    70%  { transform: rotate(-7deg) scale(1.02); }
    85%  { transform: rotate(3deg) scale(1); }
    100% { transform: rotate(0deg) scale(1); }
}

/* Tuz damlası: düşer, altta halka oluşur */
@keyframes kh-drop-fall {
    0%   { transform: translateY(-0.45em) scaleY(1.15); opacity: 0; }
    15%  { opacity: 1; }
    70%  { transform: translateY(0) scaleY(1); opacity: 1; }
    82%  { transform: translateY(0.04em) scale(1.12, 0.88); }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes kh-ripple {
    0%   { transform: scale(0.2); opacity: 0.7; }
    100% { transform: scale(1.9); opacity: 0; }
}

.kh-icon--drop::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -0.05em;
    width: 0.9em;
    height: 0.3em;
    margin-left: -0.45em;
    border: 2px solid currentColor;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

.kh-icon--chair.is-active {
    animation: kh-chair-spring 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) 1;
}

.kh-icon--drop.is-active {
    animation: kh-drop-fall 0.8s cubic-bezier(0.55, 0, 1, 0.45) 1;
}

.kh-icon--drop.is-active::after {
    animation: kh-ripple 0.9s ease-out 0.65s 1;
}

@media (hover: hover) {
    .corp-card:hover .kh-icon--chair {
        animation: kh-chair-spring 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) 1;
    }

    .corp-card:hover .kh-icon--drop {
        animation: kh-drop-fall 0.8s cubic-bezier(0.55, 0, 1, 0.45) 1;
    }

    .corp-card:hover .kh-icon--drop::after {
        animation: kh-ripple 0.9s ease-out 0.65s 1;
    }
}

/* --------------------------------------------------------------------------
   Aşama 4 - Lottie
   .kh-lottie kutusu sabit en-boy oranlıdır (CLS yok). Fallback içerik
   Lottie hazır olana kadar (ya da hiç yüklenemezse) görünür kalır.
   -------------------------------------------------------------------------- */
.kh-lottie {
    position: relative;
    width: 100%;
}

.kh-lottie__fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease;
}

.kh-lottie__fallback img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.kh-lottie__canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.kh-lottie.is-ready .kh-lottie__canvas {
    opacity: 1;
}

.kh-lottie.is-ready .kh-lottie__fallback {
    opacity: 0;
}

/* --------------------------------------------------------------------------
   Aşama 5 - Süreç akışı ("Nasıl Çalışıyoruz?")
   Varsayılan görünüm statiktir (GSAP yoksa/hareket azaltılmışsa böyle kalır).
   JS, GSAP varken .kh-process--js sınıfını ekler ve ilerleme durumunu yönetir.
   -------------------------------------------------------------------------- */
.kh-process {
    position: relative;
}

.kh-process__rail {
    position: relative;
    height: 44px;
    margin: 0 10% 24px;
}

.kh-process__line,
.kh-process__fill {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 4px;
    margin-top: -2px;
    border-radius: 2px;
}

.kh-process__line {
    background: var(--kh-border-gray);
}

.kh-process__fill {
    background: var(--kh-primary);
    transform-origin: 0 50%;
}

.kh-process__dot {
    position: absolute;
    left: calc(var(--pos, 0) * 100%);
    top: 50%;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border-radius: 50%;
    background: var(--kh-primary);
    border: 2px solid var(--kh-primary);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.kh-process__truck {
    display: none;
    position: absolute;
    left: 0;
    top: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    background: var(--kh-primary-container);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 45, 86, 0.25);
    will-change: left, top;
}

.kh-process__truck .material-symbols-outlined {
    font-size: 22px;
}

.kh-process--js .kh-process__truck {
    display: flex;
}

.kh-process--js .kh-process__fill {
    transform: scaleX(0);
}

.kh-process--js .kh-process__dot {
    background: var(--kh-surface);
    border-color: var(--kh-border-gray);
}

.kh-process--js .kh-process__dot.is-reached {
    background: var(--kh-primary);
    border-color: var(--kh-primary);
}

.kh-process__steps {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.kh-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.kh-step__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    border-radius: 50%;
    border: 2px solid var(--kh-primary);
    background: var(--kh-primary);
    color: #fff;
    transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}

.kh-step__icon .material-symbols-outlined {
    font-size: 30px;
}

.kh-process--js .kh-step:not(.is-reached) .kh-step__icon {
    background: #fff;
    border-color: var(--kh-border-gray);
    color: var(--kh-secondary);
}

.kh-process--js .kh-step:not(.is-reached) .kh-step__title {
    color: var(--kh-secondary);
}

.kh-step__title {
    transition: color 0.35s ease;
}

/* Mobil: dikey düzen. Rail'in konumunu JS ölçüp --rail-top / --rail-h ile verir */
@media (max-width: 767px) {
    .kh-process__rail {
        position: absolute;
        left: 0;
        top: var(--rail-top, 0);
        width: 36px;
        height: var(--rail-h, 0);
        margin: 0;
    }

    .kh-process__line,
    .kh-process__fill {
        top: 0;
        bottom: 0;
        left: 50%;
        right: auto;
        width: 4px;
        height: auto;
        margin: 0 0 0 -2px;
    }

    .kh-process__fill {
        transform-origin: 50% 0;
    }

    .kh-process--js .kh-process__fill {
        transform: scaleY(0);
    }

    .kh-process__dot {
        left: 50%;
        top: calc(var(--pos, 0) * 100%);
    }

    .kh-process__truck {
        left: 50%;
        top: 0;
        width: 36px;
        height: 36px;
        margin: -18px 0 0 -18px;
    }

    .kh-process__truck .material-symbols-outlined {
        font-size: 20px;
    }

    .kh-process__steps {
        display: flex;
        flex-direction: column;
        gap: 32px;
    }

    .kh-step {
        position: relative;
        align-items: flex-start;
        text-align: left;
        min-height: 52px;
        padding-left: 108px;
    }

    .kh-step__icon {
        position: absolute;
        left: 44px;
        top: 0;
        width: 52px;
        height: 52px;
        margin: 0;
    }

    .kh-step__icon .material-symbols-outlined {
        font-size: 26px;
    }
}

/* --------------------------------------------------------------------------
   Aşama 7 - Partner firmalar kayan şerit (saf CSS)
   İki özdeş .kh-marquee__group yan yana durur; track -%50 kayınca döngü kesintisiz olur.
   Her grup en az kap genişliğindedir (min-width: 100%), az logoda da boşluk kalmaz.
   -------------------------------------------------------------------------- */
.kh-marquee {
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 10%, #000 90%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, #000 10%, #000 90%, transparent 100%);
}

.kh-marquee__track {
    display: flex;
    width: max-content;
    animation: kh-marquee 32s linear infinite;
}

.kh-marquee:hover .kh-marquee__track {
    animation-play-state: paused;
}

.kh-marquee__group {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-around;
    min-width: 100vw;
}

@media (min-width: 1280px) {
    .kh-marquee__group {
        min-width: 1280px;
    }
}

.kh-marquee__item {
    flex-shrink: 0;
    padding: 0 40px;
    white-space: nowrap;
    opacity: 0.6;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.kh-marquee__item:hover {
    opacity: 1;
}

/* Logo dosyaları eklendiğinde: gri tonlamalı, hover'da renkli */
.kh-marquee__item img {
    display: block;
    height: 40px;
    width: auto;
    filter: grayscale(1);
    transition: filter 0.3s ease;
}

.kh-marquee__item:hover img {
    filter: grayscale(0);
}

@keyframes kh-marquee {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

@media (max-width: 767px) {
    .kh-marquee__track {
        animation-duration: 24s;
    }

    .kh-marquee__item {
        padding: 0 24px;
    }
}

/* --------------------------------------------------------------------------
   Aşama 8 - Float, buton parlaması, yukarı çık butonu
   -------------------------------------------------------------------------- */
@keyframes kh-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

.kh-float {
    animation: kh-float 5s ease-in-out infinite;
}

/* Butonlar: hafif yükselme + üzerinden geçen parlama */
.btn-primary,
.btn-secondary {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.btn-primary::before,
.btn-secondary::before {
    content: "";
    position: absolute;
    top: 0;
    left: -80%;
    z-index: -1;
    width: 50%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s ease;
    pointer-events: none;
}

.btn-secondary::before {
    background: linear-gradient(120deg, transparent, color-mix(in srgb, currentColor 16%, transparent), transparent);
}

@media (hover: hover) {
    .btn-primary:hover,
    .btn-secondary:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(0, 45, 86, 0.2);
    }

    .btn-primary:hover::before,
    .btn-secondary:hover::before {
        left: 130%;
    }
}

.btn-primary,
.btn-secondary {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease,
        box-shadow 0.2s ease, transform 0.2s ease;
}

/* Sayfa başına dön */
.kh-to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--kh-primary);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 45, 86, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s, background-color 0.2s ease;
}

.kh-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.kh-to-top:hover {
    background: var(--kh-primary-container);
}

.kh-to-top:focus-visible {
    outline: 2px solid var(--kh-tertiary);
    outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Genel responsive düzenlemeler (mobil)
   Tailwind yardımcı sınıfları ile çakışmamak için özgüllük bilerek yüksek tutuldu.
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
    main > section.py-20,
    main > section.py-24 {
        padding-top: 3.5rem;
        padding-bottom: 3.5rem;
    }

    main > section .text-center.mb-16 {
        margin-bottom: 2.5rem;
    }

    main > section .text-center.mb-12 {
        margin-bottom: 2rem;
    }

    main > section .grid.gap-16 {
        gap: 2rem;
    }

    main > section .grid.mb-20 {
        margin-bottom: 2rem;
    }
}

/* --------------------------------------------------------------------------
   Hareket azaltma tercihi: tüm animasyonlar kapatılır
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        animation-delay: 0s !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
        scroll-behavior: auto !important;
    }

    .kh-marquee {
        -webkit-mask-image: none;
        mask-image: none;
    }

    .kh-marquee__track {
        animation: none !important;
        width: auto;
    }

    .kh-marquee__group {
        flex-wrap: wrap;
        justify-content: center;
        min-width: 0;
        width: 100%;
    }

    .kh-marquee__group[aria-hidden="true"] {
        display: none;
    }

    .kh-float {
        animation: none !important;
    }

    .btn-primary::before,
    .btn-secondary::before {
        display: none;
    }

    [data-aos] {
        opacity: 1 !important;
        transform: none !important;
    }
}
