/* ===== POETIC LOADING STATES - INK FLOW ANIMATION ===== */
/* Enterprise-grade custom loading that reflects the poetry brand identity */

/* Main Loading Container */
.poetic-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-lg);
    padding: var(--spacing-3xl) var(--spacing-md);
    min-height: 300px;
}

/* Ink Flow Container - Arabic Calligraphy Inspired */
.ink-flow {
    position: relative;
    width: 200px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Individual Ink Drops - Forming Letters */
.ink-drop {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--color-accent-primary);
    border-radius: 50%;
    opacity: 0;
    animation: inkDrop 2.4s ease-in-out infinite;
}

.ink-drop:nth-child(1) {
    left: 20%;
    animation-delay: 0s;
}

.ink-drop:nth-child(2) {
    left: 35%;
    animation-delay: 0.3s;
}

.ink-drop:nth-child(3) {
    left: 50%;
    animation-delay: 0.6s;
}

.ink-drop:nth-child(4) {
    left: 65%;
    animation-delay: 0.9s;
}

.ink-drop:nth-child(5) {
    left: 80%;
    animation-delay: 1.2s;
}

@keyframes inkDrop {
    0% {
        opacity: 0;
        transform: translateY(-30px) scale(0.3);
    }
    15% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    20% {
        transform: translateY(0) scale(1);
    }
    35% {
        opacity: 1;
        transform: translateY(5px) scale(1.2);
    }
    50% {
        opacity: 0.8;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(20px) scale(0.5);
    }
}

/* Flowing Ink Line - Connecting Animation */
.ink-flow::before {
    content: '';
    position: absolute;
    left: 10%;
    right: 10%;
    top: 50%;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--color-accent-primary) 20%,
        var(--color-accent-primary) 80%,
        transparent 100%);
    opacity: 0;
    animation: inkLine 2.4s ease-in-out infinite;
    transform-origin: left center;
}

@keyframes inkLine {
    0%, 20% {
        opacity: 0;
        transform: scaleX(0);
    }
    35% {
        opacity: 0.6;
        transform: scaleX(1);
    }
    65% {
        opacity: 0.6;
        transform: scaleX(1);
    }
    100% {
        opacity: 0;
        transform: scaleX(0);
    }
}

/* Loading Text - Poetic Message */
.poetic-loading-text {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 400;
    color: var(--color-text-secondary);
    text-align: center;
    letter-spacing: 0.02em;
    opacity: 0;
    animation: textFade 2.4s ease-in-out infinite;
}

@keyframes textFade {
    0%, 30% {
        opacity: 0;
        transform: translateY(10px);
    }
    45%, 75% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* ===== SKELETON LOADING - POETIC VARIANT ===== */
/* Enhanced skeleton that mimics poem structure */

.poetic-skeleton {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
    padding: var(--spacing-xl);
}

.skeleton-poem {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    background: var(--color-canvas-warm);
    border-radius: var(--border-radius);
    border-right: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

/* Ink Wash Effect - Replacing Generic Shimmer */
.skeleton-poem::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(212, 146, 90, 0.08) 30%,
        rgba(212, 146, 90, 0.12) 50%,
        rgba(212, 146, 90, 0.08) 70%,
        transparent 100%);
    background-size: 200% 100%;
    animation: inkWash 2.5s ease-in-out infinite;
}

@keyframes inkWash {
    0% {
        background-position: -200% 0;
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        background-position: 200% 0;
        opacity: 0;
    }
}

/* Skeleton Title - Variable Width for Organic Feel */
.skeleton-title {
    height: 32px;
    background: linear-gradient(90deg,
        rgba(93, 64, 55, 0.1) 0%,
        rgba(93, 64, 55, 0.08) 50%,
        rgba(93, 64, 55, 0.1) 100%);
    border-radius: 8px;
    width: 70%;
    align-self: flex-end; /* RTL alignment */
}

/* Skeleton Lines - Poem Structure */
.skeleton-line {
    height: 20px;
    background: linear-gradient(90deg,
        rgba(93, 64, 55, 0.08) 0%,
        rgba(93, 64, 55, 0.06) 50%,
        rgba(93, 64, 55, 0.08) 100%);
    border-radius: 6px;
    align-self: flex-end; /* RTL alignment */
}

.skeleton-line:nth-child(1) { width: 85%; }
.skeleton-line:nth-child(2) { width: 92%; }
.skeleton-line:nth-child(3) { width: 78%; }
.skeleton-line:nth-child(4) { width: 88%; }

/* Skeleton Meta - Author, Category */
.skeleton-meta {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
    margin-top: var(--spacing-sm);
}

.skeleton-badge {
    height: 24px;
    width: 80px;
    background: rgba(93, 64, 55, 0.06);
    border-radius: 12px;
}

.skeleton-badge:first-child {
    width: 100px;
}

/* ===== SECTION LOADING STATE ===== */
/* Replace generic shimmer in editorial-layout.css */

.editorial-featured.loading,
.editorial-latest.loading,
.editorial-discover.loading {
    opacity: 1;
    pointer-events: none;
    position: relative;
}

.editorial-featured.loading::after,
.editorial-latest.loading::after,
.editorial-discover.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(212, 146, 90, 0.05) 20%,
        rgba(212, 146, 90, 0.08) 50%,
        rgba(212, 146, 90, 0.05) 80%,
        transparent 100%);
    background-size: 200% 100%;
    animation: inkWash 2.5s ease-in-out infinite;
    pointer-events: none;
}

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 767px) {
    .ink-flow {
        width: 150px;
        height: 60px;
    }
    
    .ink-drop {
        width: 6px;
        height: 6px;
    }
    
    .poetic-loading-text {
        font-size: var(--text-base);
    }
    
    .poetic-skeleton {
        gap: var(--spacing-md);
        padding: var(--spacing-md);
    }
}

/* ===== ACCESSIBILITY ===== */

@media (prefers-reduced-motion: reduce) {
    .ink-drop,
    .ink-flow::before,
    .poetic-loading-text,
    .skeleton-poem::before {
        animation: none !important;
    }
    
    .poetic-loading-text {
        opacity: 1;
    }
    
    .ink-drop {
        opacity: 0.6;
        position: static;
        display: inline-block;
        margin: 0 4px;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .ink-drop,
    .ink-flow::before {
        background: currentColor;
    }
    
    .skeleton-title,
    .skeleton-line,
    .skeleton-badge {
        border: 1px solid currentColor;
    }
}
