/**
 * Mythology Ambiance - Atmospheric styling for the soul of Azrael
 * Whispers, sacred geometry, and numinous loading states
 */

/* ==========================================
   WHISPERS - Ephemeral quotes that breathe
   ========================================== */

.entity-whisper {
    position: relative;
    margin: 1rem 0;
    padding: 1rem 1.5rem;
    font-family: 'Crimson Text', Georgia, 'Times New Roman', serif;
    font-style: italic;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--color-text-secondary, #a0a0a0);
    border-left: 2px solid rgba(var(--color-primary-rgb, 139, 127, 255), 0.4);
    background: linear-gradient(
        90deg,
        rgba(var(--color-primary-rgb, 139, 127, 255), 0.05) 0%,
        transparent 100%
    );
    opacity: 0;
    animation: whisperReveal 1.5s ease-out 0.5s forwards;
    will-change: opacity, transform;
}

.entity-whisper::before {
    content: '\201C'; /* Opening curly quote */
    position: absolute;
    top: -0.5rem;
    left: 0.5rem;
    font-size: 3rem;
    color: rgba(var(--color-primary-rgb, 139, 127, 255), 0.15);
    font-family: Georgia, serif;
    line-height: 1;
}

.entity-whisper-text {
    position: relative;
    z-index: 1;
}

.entity-whisper-source {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    font-style: normal;
    color: var(--color-text-muted, #666);
    text-align: right;
}

.entity-whisper-source::before {
    content: '\2014 '; /* Em dash */
}

@keyframes whisperReveal {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover effect for card whispers */
.entity-card:hover .entity-whisper {
    border-left-color: rgba(var(--color-primary-rgb, 139, 127, 255), 0.7);
}

/* ==========================================
   SACRED GEOMETRY LOADING STATE
   ========================================== */

.sacred-loader {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 2rem auto;
}

.sacred-loader-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid transparent;
    border-top-color: var(--color-primary, #8b7fff);
    border-radius: 50%;
    animation: sacredSpin 1.5s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
    will-change: transform;
}

.sacred-loader-ring:nth-child(2) {
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
    border-top-color: var(--color-secondary, #ff7fcc);
    animation-duration: 2s;
    animation-direction: reverse;
}

.sacred-loader-ring:nth-child(3) {
    width: 40%;
    height: 40%;
    top: 30%;
    left: 30%;
    border-top-color: var(--color-accent, #7fffcc);
    animation-duration: 1s;
}

.sacred-loader-center {
    position: absolute;
    width: 10px;
    height: 10px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--color-primary, #8b7fff);
    border-radius: 50%;
    animation: sacredPulse 1s ease-in-out infinite;
    will-change: transform, opacity;
}

@keyframes sacredSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes sacredPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.5;
    }
}

/* Sacred geometry patterns (background) */
.sacred-geometry-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cpolygon fill='none' stroke='%238b7fff' stroke-width='0.5' points='50,10 90,90 10,90'/%3E%3Ccircle fill='none' stroke='%238b7fff' stroke-width='0.5' cx='50' cy='50' r='30'/%3E%3C/svg%3E");
    z-index: -1;
}

/* ==========================================
   ENTITY SUMMONING ANIMATION
   ========================================== */

.entity-summoning {
    position: relative;
    overflow: hidden;
}

.entity-summoning::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        rgba(var(--color-primary-rgb, 139, 127, 255), 0.1) 60deg,
        transparent 120deg
    );
    animation: summonRotate 3s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
    will-change: transform;
}

.entity-summoning.summoning::before {
    opacity: 1;
}

@keyframes summonRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==========================================
   MYTHOLOGY ATMOSPHERE OVERLAYS
   ========================================== */

/* Subtle mythology-specific color washes */
[data-mythology="greek"] .entity-card,
[data-mythology="roman"] .entity-card {
    --mythology-glow: rgba(100, 149, 237, 0.1); /* Cornflower blue */
}

[data-mythology="norse"] .entity-card {
    --mythology-glow: rgba(70, 130, 180, 0.1); /* Steel blue - ice */
}

[data-mythology="egyptian"] .entity-card {
    --mythology-glow: rgba(218, 165, 32, 0.1); /* Golden */
}

[data-mythology="hindu"] .entity-card {
    --mythology-glow: rgba(255, 140, 0, 0.1); /* Deep orange - saffron */
}

[data-mythology="japanese"] .entity-card {
    --mythology-glow: rgba(255, 192, 203, 0.08); /* Cherry blossom */
}

[data-mythology="celtic"] .entity-card {
    --mythology-glow: rgba(34, 139, 34, 0.1); /* Forest green */
}

[data-mythology="chinese"] .entity-card {
    --mythology-glow: rgba(220, 20, 60, 0.08); /* Crimson - luck */
}

[data-mythology="mesopotamian"] .entity-card {
    --mythology-glow: rgba(139, 90, 43, 0.1); /* Terracotta */
}

.entity-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--mythology-glow, transparent);
    pointer-events: none;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.entity-card:hover::after {
    opacity: 1;
}

/* ==========================================
   TEMPORAL DEPTH INDICATOR
   ========================================== */

.temporal-depth {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: rgba(var(--color-bg-card-rgb, 30, 30, 40), 0.8);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--color-text-muted, #666);
}

.temporal-depth-icon {
    opacity: 0.7;
}

.temporal-depth-text {
    font-style: italic;
}

/* ==========================================
   CROSS-CULTURAL CONNECTION BADGE
   ========================================== */

.cross-cultural-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    background: linear-gradient(
        135deg,
        rgba(var(--color-primary-rgb, 139, 127, 255), 0.2),
        rgba(var(--color-secondary-rgb, 255, 127, 204), 0.2)
    );
    border: 1px solid rgba(var(--color-primary-rgb, 139, 127, 255), 0.3);
    border-radius: 16px;
    font-size: 0.7rem;
    color: var(--color-text-secondary, #a0a0a0);
    cursor: pointer;
    transition: all 0.2s ease;
}

.cross-cultural-badge:hover {
    background: linear-gradient(
        135deg,
        rgba(var(--color-primary-rgb, 139, 127, 255), 0.3),
        rgba(var(--color-secondary-rgb, 255, 127, 204), 0.3)
    );
    transform: translateY(-1px);
}

.cross-cultural-badge-icon {
    font-size: 0.9rem;
}

/* ==========================================
   FAVORITE BUTTON - Personal Pantheon
   ========================================== */

.entity-favorite {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: rgba(var(--color-bg-secondary-rgb, 45, 45, 60), 0.4);
    border: 1.5px solid rgba(var(--color-border-primary-rgb, 100, 100, 120), 0.6);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: var(--color-text-muted, #999);
    font-size: 1.35rem;
    line-height: 1;
    position: relative;
    overflow: visible;
}

.entity-favorite:hover {
    background: rgba(var(--color-primary-rgb, 139, 127, 255), 0.2);
    border-color: var(--color-primary, #8b7fff);
    color: var(--color-primary, #8b7fff);
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(var(--color-primary-rgb, 139, 127, 255), 0.25);
}

.entity-favorite:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb, 139, 127, 255), 0.3);
    border-color: var(--color-primary, #8b7fff);
}

.entity-favorite:focus-visible {
    outline: 2px solid var(--color-primary, #8b7fff);
    outline-offset: 3px;
}

.entity-favorite:active {
    transform: scale(0.92);
}

.entity-favorite.favorited {
    background: rgba(var(--color-accent-rgb, 255, 217, 61), 0.25);
    border-color: var(--color-accent, #ffd93d);
    color: var(--color-accent, #ffd93d);
    box-shadow: 0 0 16px rgba(var(--color-accent-rgb, 255, 217, 61), 0.4);
}

.entity-favorite.favorited:hover {
    background: rgba(var(--color-accent-rgb, 255, 217, 61), 0.35);
    transform: scale(1.18);
    box-shadow: 0 6px 20px rgba(var(--color-accent-rgb, 255, 217, 61), 0.5);
}

.favorite-icon {
    display: inline-block;
    font-family: inherit;
    font-size: 1.35rem;
    line-height: 1;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center;
}

.entity-favorite.favorited .favorite-icon {
    animation: starPulse 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes starPulse {
    0% {
        transform: scale(0.6) rotate(-15deg);
    }
    50% {
        transform: scale(1.3) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

.entity-favorite:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.entity-favorite.loading .favorite-icon {
    animation: starSpin 0.8s linear infinite;
}

@keyframes starSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Favorites list styling */
.favorites-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    border-radius: 8px;
    background: rgba(var(--color-primary-rgb, 139, 127, 255), 0.05);
    border: 2px dashed rgba(var(--color-primary-rgb, 139, 127, 255), 0.2);
    min-height: 300px;
}

.favorites-empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
    animation: emptyStateBreathe 3s ease-in-out infinite;
}

.favorites-empty-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--color-text-primary, #fff);
}

.favorites-empty-text {
    font-size: 1rem;
    color: var(--color-text-secondary, #a0a0a0);
    margin-bottom: 1.5rem;
    max-width: 400px;
}

.favorites-explore-btn {
    padding: 0.75rem 1.5rem;
    background: rgba(var(--color-primary-rgb, 139, 127, 255), 0.2);
    border: 1px solid var(--color-primary, #8b7fff);
    color: var(--color-primary, #8b7fff);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.favorites-explore-btn:hover {
    background: rgba(var(--color-primary-rgb, 139, 127, 255), 0.3);
    transform: translateY(-2px);
}

@keyframes emptyStateBreathe {
    0%, 100% {
        opacity: 0.4;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

.favorites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem 0;
}

.favorite-item {
    animation: fadeInUp 0.4s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.favorites-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--color-accent, #ffd93d);
    color: #000;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 0.5rem;
}

/* ==========================================
   RESPONSIVE ADJUSTMENTS
   ========================================== */

@media (max-width: 768px) {
    .entity-whisper {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        margin: 0.75rem 0;
    }

    .entity-whisper::before {
        font-size: 2rem;
        top: -0.25rem;
    }

    .entity-whisper-source {
        font-size: 0.75rem;
    }

    .sacred-loader {
        width: 60px;
        height: 60px;
        margin: 1.5rem auto;
    }

    .sacred-loader-center {
        width: 8px;
        height: 8px;
    }

    .entity-favorite {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }

    .favorite-icon {
        font-size: 1.2rem;
    }

    .cross-cultural-badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.5rem;
    }

    .temporal-depth {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
    .entity-whisper {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        line-height: 1.6;
    }

    .entity-whisper::before {
        font-size: 1.5rem;
        left: 0.25rem;
    }

    .sacred-loader {
        width: 50px;
        height: 50px;
    }

    .sacred-loader-center {
        width: 6px;
        height: 6px;
    }

    .favorites-grid {
        grid-template-columns: 1fr;
    }

    .favorites-empty-state {
        padding: 2rem 1rem;
        min-height: 250px;
    }

    .favorites-empty-icon {
        font-size: 3rem;
    }

    .favorites-empty-title {
        font-size: 1.25rem;
    }
}

/* ==========================================
   REDUCED MOTION SUPPORT
   ========================================== */

@media (prefers-reduced-motion: reduce) {
    /* Remove will-change hints when not animating */
    .entity-whisper,
    .sacred-loader-ring,
    .sacred-loader-center,
    .entity-summoning::before,
    .entity-favorite.favorited .favorite-icon,
    .favorite-item,
    .favorites-empty-icon {
        will-change: auto;
    }

    .entity-whisper {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .sacred-loader-ring {
        animation: none;
        border-color: rgba(var(--color-primary-rgb, 139, 127, 255), 0.3);
        border-top-color: var(--color-primary, #8b7fff);
    }

    .sacred-loader-ring:nth-child(2) {
        border-top-color: var(--color-secondary, #ff7fcc);
    }

    .sacred-loader-ring:nth-child(3) {
        border-top-color: var(--color-accent, #7fffcc);
    }

    .sacred-loader-center {
        animation: none;
        opacity: 1;
    }

    .entity-summoning::before {
        animation: none;
        display: none;
    }

    .entity-favorite.favorited .favorite-icon,
    .entity-favorite.loading .favorite-icon,
    .favorite-item,
    .favorites-empty-icon {
        animation: none;
    }

    .entity-favorite:hover,
    .entity-favorite:active,
    .cross-cultural-badge:hover,
    .favorites-explore-btn:hover {
        transform: none;
    }

    .entity-favorite,
    .entity-favorite:hover,
    .cross-cultural-badge,
    .entity-card::after,
    .favorite-icon,
    .favorites-explore-btn,
    .favorite-item {
        transition: none;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    .sacred-loader,
    .sacred-geometry-bg,
    .entity-summoning::before {
        display: none;
    }

    .entity-whisper {
        border-left-color: #333;
        background: none;
    }
}
