/* ============================================
   TAROT CARD SYSTEM - KARMA SIM
   Hindu/Vedic Inspired Design
   ============================================ */

/* === COLOR PALETTE === */
:root {
    /* Primary mystical colors */
    --tarot-indigo: #1a237e;
    --tarot-indigo-light: #3949ab;
    --tarot-purple: #4a148c;
    --tarot-purple-light: #7c43bd;
    
    /* Accent colors */
    --tarot-gold: #ffd54f;
    --tarot-gold-dark: #c8a415;
    --tarot-gold-glow: rgba(255, 213, 79, 0.3);
    --tarot-lotus: #ec407a;
    --tarot-lotus-light: #f48fb1;
    --tarot-green: #66bb6a;
    --tarot-red: #ef5350;
    
    /* Background and surface */
    --tarot-bg-dark: #0d0d1a;
    --tarot-surface: #1a1a2e;
    --tarot-border: rgba(255, 213, 79, 0.4);
    
    /* Card dimensions */
    --card-width: 160px;
    --card-height: 260px;
    --card-border-radius: 12px;
}

/* === CARD SPREAD CONTAINER === */
.tarot-spread {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 30px 10px;
    perspective: 1000px;
    min-height: calc(var(--card-height) + 60px);
}

/* Adjust for different card counts */
.tarot-spread[data-card-count="2"] {
    gap: 40px;
}

.tarot-spread[data-card-count="3"] {
    gap: 25px;
}

/* === CARD BASE === */
.tarot-card {
    width: var(--card-width);
    height: var(--card-height);
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
    
    /* Initial state - slightly rotated for mystery */
    opacity: 0;
    transform: translateY(30px);
    animation: cardAppear 0.5s ease forwards;
}

@keyframes cardAppear {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tarot-card:nth-child(1) { animation-delay: 0.1s; }
.tarot-card:nth-child(2) { animation-delay: 0.2s; }
.tarot-card:nth-child(3) { animation-delay: 0.3s; }

/* Hover lift effect (only when revealed) */
.tarot-card.revealed:hover:not(.selecting):not(.dismissed) {
    transform: translateY(-10px);
}

.tarot-card.revealed:hover:not(.selecting):not(.dismissed) .tarot-card-inner {
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 30px var(--tarot-gold-glow);
}

/* === CARD INNER (for flip) === */
.tarot-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
    border-radius: var(--card-border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Flip when revealed */
.tarot-card.revealed .tarot-card-inner {
    transform: rotateY(180deg);
}

/* === CARD FACES (shared) === */
.tarot-card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--card-border-radius);
    border: 2px solid var(--tarot-border);
    overflow: hidden;
}

/* === CARD BACK (face-down) === */
.tarot-card-back {
    background: linear-gradient(145deg, var(--tarot-indigo) 0%, var(--tarot-purple) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mandala design */
.tarot-mandala {
    position: relative;
    width: 100px;
    height: 100px;
}

.mandala-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--tarot-gold);
    opacity: 0.6;
}

.mandala-ring.ring-1 {
    width: 100px;
    height: 100px;
    top: 0;
    left: 0;
    animation: mandalaRotate 20s linear infinite;
}

.mandala-ring.ring-2 {
    width: 70px;
    height: 70px;
    top: 15px;
    left: 15px;
    border-style: dashed;
    animation: mandalaRotate 15s linear infinite reverse;
}

.mandala-ring.ring-3 {
    width: 40px;
    height: 40px;
    top: 30px;
    left: 30px;
    animation: mandalaRotate 10s linear infinite;
}

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

.mandala-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: var(--tarot-gold);
    text-shadow: 0 0 10px var(--tarot-gold-glow);
}

/* Corner decorations */
.tarot-corner {
    position: absolute;
    font-size: 12px;
    color: var(--tarot-gold);
    opacity: 0.5;
}

.tarot-corner-tl { top: 8px; left: 8px; }
.tarot-corner-tr { top: 8px; right: 8px; }
.tarot-corner-bl { bottom: 8px; left: 8px; }
.tarot-corner-br { bottom: 8px; right: 8px; }

/* === CARD FRONT (face-up) === */
.tarot-card-front {
    background: linear-gradient(180deg, var(--tarot-bg-dark) 0%, var(--tarot-surface) 100%);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    padding: 12px;
}

/* Top border decoration */
.tarot-border {
    display: flex;
    justify-content: center;
    gap: 8px;
    color: var(--tarot-gold);
    font-size: 14px;
    opacity: 0.8;
}

.tarot-border-top {
    margin-bottom: 8px;
}

.border-symbol {
    text-shadow: 0 0 5px var(--tarot-gold-glow);
}

/* Card name */
.tarot-name {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--card-accent, var(--tarot-gold));
    margin-bottom: 8px;
    text-shadow: 0 0 8px var(--tarot-gold-glow);
}

/* Symbol area */
.tarot-symbol-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    margin: 8px 0;
    border: 1px solid rgba(255, 213, 79, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
}

.tarot-main-symbol {
    font-size: 36px;
    filter: drop-shadow(0 0 10px var(--tarot-gold-glow));
}

/* Flavor text */
.tarot-flavor {
    text-align: center;
    font-size: 11px;
    line-height: 1.4;
    color: #b0bec5;
    padding: 8px 4px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Effect preview */
.tarot-effect {
    text-align: center;
    font-size: 10px;
    color: var(--tarot-lotus-light);
    padding: 6px;
    background: rgba(236, 64, 122, 0.1);
    border-radius: 4px;
    border: 1px solid rgba(236, 64, 122, 0.2);
    margin-top: auto;
}

/* Bottom border */
.tarot-border-bottom {
    margin-top: 8px;
}

.lotus-symbol {
    color: var(--tarot-lotus);
    font-size: 16px;
}

/* === SELECTION STATES === */

/* Card being selected */
.tarot-card.selecting {
    z-index: 10;
    animation: cardSelect 0.6s ease forwards;
}

@keyframes cardSelect {
    0% {
        transform: translateY(-10px);
    }
    50% {
        transform: translateY(-30px) scale(1.1);
    }
    100% {
        transform: translateY(0) scale(1.05);
        opacity: 1;
    }
}

.tarot-card.selecting .tarot-card-inner {
    box-shadow: 
        0 0 40px var(--tarot-gold-glow),
        0 0 60px var(--tarot-gold-glow);
}

/* Dismissed cards */
.tarot-card.dismissed {
    animation: cardDismiss 0.5s ease forwards;
    pointer-events: none;
}

@keyframes cardDismiss {
    to {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
}

/* === RESPONSIVE ADJUSTMENTS === */
@media (max-width: 600px) {
    :root {
        --card-width: 130px;
        --card-height: 210px;
    }
    
    .tarot-spread {
        gap: 12px;
        padding: 20px 5px;
    }
    
    .tarot-name {
        font-size: 11px;
        letter-spacing: 1px;
    }
    
    .tarot-flavor {
        font-size: 10px;
        padding: 6px 2px;
    }
    
    .tarot-main-symbol {
        font-size: 28px;
    }
}

@media (max-width: 450px) {
    :root {
        --card-width: 100px;
        --card-height: 170px;
    }
    
    .tarot-border {
        font-size: 10px;
    }
    
    .tarot-name {
        font-size: 9px;
    }
    
    .tarot-flavor {
        font-size: 8px;
        min-height: 36px;
    }
    
    .tarot-effect {
        font-size: 8px;
        padding: 4px;
    }
    
    .mandala-ring.ring-1 {
        width: 60px;
        height: 60px;
    }
    
    .mandala-ring.ring-2 {
        width: 40px;
        height: 40px;
        top: 10px;
        left: 10px;
    }
    
    .mandala-ring.ring-3 {
        width: 24px;
        height: 24px;
        top: 18px;
        left: 18px;
    }
    
    .mandala-center {
        font-size: 16px;
    }
    
    .tarot-mandala {
        width: 60px;
        height: 60px;
    }
}

/* === GLOW EFFECTS === */
.tarot-card.revealed .tarot-card-front::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: var(--card-border-radius);
    background: linear-gradient(45deg, 
        var(--tarot-gold) 0%, 
        transparent 40%, 
        transparent 60%, 
        var(--tarot-gold) 100%
    );
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.tarot-card.revealed:hover .tarot-card-front::before {
    opacity: 0.3;
}

/* === ACCESSIBILITY === */
.tarot-card:focus {
    outline: 2px solid var(--tarot-gold);
    outline-offset: 3px;
}

.tarot-card:focus:not(:focus-visible) {
    outline: none;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .tarot-card,
    .tarot-card-inner,
    .mandala-ring {
        transition: none;
        animation: none;
    }
    
    .tarot-card {
        opacity: 1;
        transform: none;
    }
    
    .tarot-card.revealed .tarot-card-inner {
        transform: rotateY(180deg);
    }
}
