/**
 * Targaryen v1.9 — Skeleton Loaders & Cascaded Animations
 * Drop-in CSS · Auto-applies to .tc-fleet-card, .tc-airport-card during load
 * Plus cascaded fade-in for grid items
 */

/* === Skeleton shimmer === */
@keyframes targSkeleton {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.targ-skel,
.targ-skeleton {
    background: linear-gradient(
        90deg,
        rgba(255,255,255,.04) 0%,
        rgba(255,255,255,.08) 25%,
        rgba(212,175,55,.10) 50%,
        rgba(255,255,255,.08) 75%,
        rgba(255,255,255,.04) 100%
    );
    background-size: 200% 100%;
    animation: targSkeleton 1.6s ease-in-out infinite;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

/* Skeleton card layout (matches .tc-fleet-card structure) */
.targ-skel-card {
    background: rgba(255,255,255,.025);
    border: 1px solid rgba(212,175,55,.10);
    border-radius: var(--radius, 16px);
    overflow: hidden;
    height: 480px;
    display: flex;
    flex-direction: column;
}
.targ-skel-card .targ-skel-img {
    height: 240px;
    border-radius: 0;
    border-bottom: 1px solid rgba(212,175,55,.08);
}
.targ-skel-card .targ-skel-body {
    padding: 18px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.targ-skel-card .targ-skel-title {
    height: 22px;
    width: 70%;
}
.targ-skel-card .targ-skel-line {
    height: 12px;
    width: 100%;
}
.targ-skel-card .targ-skel-line.short { width: 40%; }
.targ-skel-card .targ-skel-cta {
    height: 44px;
    width: 100%;
    margin-top: auto;
    border-radius: 10px;
}

/* === Cascaded fade-in for grid items === */
@keyframes targCascadeIn {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.targ-cascade > * {
    opacity: 0;
    animation: targCascadeIn 0.55s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) forwards;
}
.targ-cascade > *:nth-child(1)  { animation-delay: 0.00s; }
.targ-cascade > *:nth-child(2)  { animation-delay: 0.06s; }
.targ-cascade > *:nth-child(3)  { animation-delay: 0.12s; }
.targ-cascade > *:nth-child(4)  { animation-delay: 0.18s; }
.targ-cascade > *:nth-child(5)  { animation-delay: 0.24s; }
.targ-cascade > *:nth-child(6)  { animation-delay: 0.30s; }
.targ-cascade > *:nth-child(7)  { animation-delay: 0.36s; }
.targ-cascade > *:nth-child(8)  { animation-delay: 0.42s; }
.targ-cascade > *:nth-child(9)  { animation-delay: 0.48s; }
.targ-cascade > *:nth-child(10) { animation-delay: 0.54s; }
.targ-cascade > *:nth-child(11) { animation-delay: 0.60s; }
.targ-cascade > *:nth-child(12) { animation-delay: 0.66s; }
.targ-cascade > *:nth-child(n+13) { animation-delay: 0.72s; }

/* Auto-apply to common grids if class is added by JS */
.tc-fleet-grid.targ-cascade > .tc-fleet-card,
.tc-cards-grid.targ-cascade > .tc-vehicle-card,
.tc-airports-grid.targ-cascade > .tc-airport-card {
    animation-fill-mode: both;
}

/* === Smooth filter transitions on /flotte === */
.tc-fleet-card[data-filter-hidden="true"] {
    opacity: 0;
    transform: scale(0.92);
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}
.tc-fleet-card[data-filter-shown="true"] {
    animation: targCascadeIn 0.4s var(--ease-out) forwards;
}

/* === Page transition === */
@keyframes targPageIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
body.targ-page-ready main,
body.targ-page-ready .tc-container {
    animation: targPageIn 0.4s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1));
}

/* === Reduce motion respect === */
@media (prefers-reduced-motion: reduce) {
    .targ-cascade > *,
    .targ-skel,
    .targ-skeleton,
    body.targ-page-ready main {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* === Auto-trigger cascade on common grids === */
.tc-fleet-grid > .tc-fleet-card,
.tc-cards-grid > .tc-vehicle-card,
.tc-airports-grid > .tc-airport-card {
    animation: targCascadeIn 0.5s var(--ease-out, cubic-bezier(0.16, 1, 0.3, 1)) both;
}
.tc-fleet-grid > .tc-fleet-card:nth-child(1),
.tc-cards-grid > .tc-vehicle-card:nth-child(1),
.tc-airports-grid > .tc-airport-card:nth-child(1)  { animation-delay: 0.00s; }
.tc-fleet-grid > .tc-fleet-card:nth-child(2),
.tc-cards-grid > .tc-vehicle-card:nth-child(2),
.tc-airports-grid > .tc-airport-card:nth-child(2)  { animation-delay: 0.05s; }
.tc-fleet-grid > .tc-fleet-card:nth-child(3),
.tc-cards-grid > .tc-vehicle-card:nth-child(3),
.tc-airports-grid > .tc-airport-card:nth-child(3)  { animation-delay: 0.10s; }
.tc-fleet-grid > .tc-fleet-card:nth-child(4),
.tc-cards-grid > .tc-vehicle-card:nth-child(4),
.tc-airports-grid > .tc-airport-card:nth-child(4)  { animation-delay: 0.15s; }
.tc-fleet-grid > .tc-fleet-card:nth-child(5),
.tc-cards-grid > .tc-vehicle-card:nth-child(5),
.tc-airports-grid > .tc-airport-card:nth-child(5)  { animation-delay: 0.20s; }
.tc-fleet-grid > .tc-fleet-card:nth-child(6),
.tc-cards-grid > .tc-vehicle-card:nth-child(6),
.tc-airports-grid > .tc-airport-card:nth-child(6)  { animation-delay: 0.25s; }
.tc-fleet-grid > .tc-fleet-card:nth-child(n+7),
.tc-cards-grid > .tc-vehicle-card:nth-child(n+7),
.tc-airports-grid > .tc-airport-card:nth-child(n+7) { animation-delay: 0.30s; }
