/**
 * Frontend Styles for Arcana Oracle Cards
 */

/* Container Layout */
.arcana-oracle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    padding: 40px;
    min-height: 600px;
    transition: all 0.5s ease;
    position: relative;
}

/* When card is revealed, switch to grid layout */
.arcana-oracle-container.card-revealed {
    display: grid;
    grid-template-columns: 0 2fr; 
    align-items: start;
    justify-content: initial;
}

/* Deck Area */
.arcana-oracle-deck-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease;
}

.arcana-oracle-deck-area.slide-left {
    transform: translateX(-50px);
    opacity: 0.3;
}

/* Complete fade out when card is drawn */
.arcana-oracle-deck-area.fade-out {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s ease;
}

.arcana-oracle-deck-area.slide-up {
    transform: translateY(-100vh);
    opacity: 0;

}


/* Breathing animation (idle state) */
@keyframes breathe {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.02); }
}
/* ==================================================
   3-CARD STACK CSS
   Add/replace these sections in frontend.css
   ================================================== */

/* Shadow Container - No shadow, just spacing */
.arcana-deck-shadow-container {
    display: inline-block;
    margin: 40px auto;
}

/* Deck Wrapper - Contains the 3 stacked cards */
.arcana-deck-wrapper {
    position: relative;
    width: 300px;
    height: 420px; /* Fixed height for stacking */
    margin: 0 auto;
    background: transparent;
      border-radius: 18px;
}
  

  
/* Individual Card Backs - Stacked with offsets */
.arcana-card-back {
    position: absolute;
    width: 100%;
    height: auto;
    display: block;
    border-radius: 18px;
    transition: all 0.3s ease;
}

.arcana-card-back img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 18px;
    border: none;
    outline: none;
    vertical-align: bottom;
    box-shadow: rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, rgba(0, 0, 0, 0.06) 0px 0px 0px 1px;
}
  


/* Card positioning - stacked with slight offsets */
.arcana-card-1 {
    top: 10px;
    left: 5px;
    z-index: 1;
    transform: rotate(-2deg);
}

.arcana-card-2 {
    top: 5px;
    left: 0;
    z-index: 2;
    transform: rotate(1deg);
}

.arcana-card-3 {
    top: 0;
    left: -5px;
    z-index: 3;
    transform: rotate(-1deg);
}

/* Breathing animation (idle state) - applies to all cards */
@keyframes breathe {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.01); }
}

.arcana-card-1 {
    animation: breathe 4s ease-in-out infinite;
    animation-delay: 0s;
}

.arcana-card-2 {
    animation: breathe 4s ease-in-out infinite;
    animation-delay: 0.1s;
}

.arcana-card-3 {
    animation: breathe 4s ease-in-out infinite;
    animation-delay: 0.2s;
}

/* ==================================================
   COMPLETE SHUFFLE WITH Z-INDEX CYCLING
   Cards shuffle AND move through the stack
   ================================================== */

/* CARD 1: Shuffles at 0-1s, moves to back, cycles through stack */
@keyframes shuffle-card-1 {
    0% {
        transform: rotate(0) translateX(0) scale(1);
        z-index: 3;  /* Start on top */
    }
    16.67% {  /* 0.5s - peak of shuffle */
        transform: rotate(5deg) translateX(105%) scale(0.96);
        z-index: 3;
    }
    33.33% {  /* 1s - back to center, NOW MOVE TO BACK */
        transform: rotate(0) translateX(0) scale(1);
        z-index: 1;  /* Move to back */
    }
    66.67% {  /* 2s - move up one level */
        transform: rotate(0) translateX(0) scale(1);
        z-index: 2;  /* Move to middle */
    }
    100% {  /* 3s - back to top */
        transform: rotate(0) translateX(0) scale(1);
        z-index: 3;  /* Back to top */
    }
}

/* CARD 2: Starts middle, moves to top when card 1 goes back */
@keyframes shuffle-card-2 {
    0% {  /* 0s - in middle */
        transform: rotate(0) translateX(0) scale(1);
        z-index: 2;
    }
    33.33% {  /* 1s - move to top, then shuffle */
        transform: rotate(0) translateX(0) scale(1);
        z-index: 3;  /* Now on top */
    }
    50% {  /* 1.5s - peak of shuffle */
        transform: rotate(5deg) translateX(105%) scale(0.96);
        z-index: 3;
    }
    66.67% {  /* 2s - back to center, MOVE TO BACK */
        transform: rotate(0) translateX(0) scale(1);
        z-index: 1;  /* Move to back */
    }
    100% {  /* 3s - move to middle */
        transform: rotate(0) translateX(0) scale(1);
        z-index: 2;  /* Back to middle */
    }
}

/* CARD 3: Starts back, cycles through */
@keyframes shuffle-card-3 {
    0% {  /* 0s - in back */
        transform: rotate(0) translateX(0) scale(1);
        z-index: 1;
    }
    33.33% {  /* 1s - move to middle */
        transform: rotate(0) translateX(0) scale(1);
        z-index: 2;
    }
    66.67% {  /* 2s - move to top, then shuffle */
        transform: rotate(0) translateX(0) scale(1);
        z-index: 3;  /* Now on top */
    }
    83.33% {  /* 2.5s - peak of shuffle */
        transform: rotate(5deg) translateX(105%) scale(0.96);
        z-index: 3;
    }
    100% {  /* 3s - back to center, MOVE TO BACK */
        transform: rotate(0) translateX(0) scale(1);
        z-index: 1;  /* Move to back */
    }
}

/* Card initial positioning - will be overridden by animations */
.arcana-card-1 {
    top: 0;
    left: 0;
    z-index: 3;
}

.arcana-card-2 {
    top: 4px;
    left: 0;
    z-index: 2;
}

.arcana-card-3 {
    top: 8px;
    left: 0;
    z-index: 1;
}

/* No animation when idle */
.arcana-card-1,
.arcana-card-2,
.arcana-card-3 {
    animation: none;
}

/* Apply the looping animations when shuffling */
.arcana-card-1.shuffling-subtle,
.arcana-card-1.shuffling-medium,
.arcana-card-1.shuffling-intense {
    animation: shuffle-card-1 3s linear 0s infinite normal;
}

.arcana-card-2.shuffling-subtle,
.arcana-card-2.shuffling-medium,
.arcana-card-2.shuffling-intense {
    animation: shuffle-card-2 3s linear 0s infinite normal;
}

.arcana-card-3.shuffling-subtle,
.arcana-card-3.shuffling-medium,
.arcana-card-3.shuffling-intense {
    animation: shuffle-card-3 3s linear 0s infinite normal;
}

/* Fade out all cards when drawn */
.arcana-deck-wrapper.fade-out .arcana-card-back {
    opacity: 0;
    transition: opacity 0.4s ease;
}


/* ==================================================
   HOW THE SHUFFLE WORKS:
   
   0-1s: Card 1 (top) shuffles → moves to BACK (z:1)
         Card 2 moves from middle to TOP (z:3)
         Card 3 moves from back to MIDDLE (z:2)
   
   1-2s: Card 2 (now top) shuffles → moves to BACK (z:1)
         Card 3 moves from middle to TOP (z:3)
         Card 1 moves from back to MIDDLE (z:2)
   
   2-3s: Card 3 (now top) shuffles → moves to BACK (z:1)
         Card 1 moves from middle to TOP (z:3)
         Card 2 moves from back to MIDDLE (z:2)
   
   Then the 3s cycle repeats!
   
   This creates the "dealing from top, putting on bottom"
   effect like real card shuffling.
   ================================================== */



/* Pull Button */
.arcana-pull-button {
    background: transparent;
    border: none;
    color: #A2790D;
    cursor: pointer;
    padding: 12px 24px;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 1px;
    position: relative;
    font-family: "Esther Font", Sans-serif;
    font-size: 48px;
    font-weight: 500;
    line-height: 1em;
    background: -webkit-linear-gradient(#EBD197, #BD8E0F, #A2790D);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.arcana-pull-button::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.3s ease;
}

.arcana-pull-button:hover::after,
.arcana-pull-button:focus::after {
    width: 0;
}

.arcana-pull-button:hover,
.arcana-pull-button:focus {
    transform: translateY(-2px);
    opacity: 0.8;
    color: #000000;
    background-color: #f7c73e80;
    text-decoration: none;
    border: none; 
}

.arcana-pull-button.shuffling {
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Card Display Area */
.arcana-oracle-card-area {
    display: none;
    align-items: center;
    justify-content: center;
    position: relative;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.arcana-oracle-card-area.reveal-area {
    display: flex;
    opacity: 1;
}

.arcana-card-display {
    width: 100%;
}

/* Fade Animations */
@keyframes fadeInLeft {
    0% {
        opacity: 0;
        transform: translateX(-30px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInDown {
    0% {
        opacity: 0;
        transform: translateY(-30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Revealed Card Styling */
.arcana-card-reveal-wrapper {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 40px;
    align-items: start;
}

.arcana-revealed-card-image {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    padding: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
}

.arcana-revealed-card-image.reveal-desktop {
    animation: fadeInLeft 0.8s ease-out forwards;
}

.arcana-revealed-card-image.reveal-mobile {
    animation: fadeInDown 0.8s ease-out forwards;
}

.arcana-card-content-wrapper {
    padding: 20px 0;
    opacity: 0;
    color: inherit;
}

.arcana-card-content-wrapper.reveal-desktop {
    animation: fadeInLeft 0.8s ease-out 0.2s forwards;
}

.arcana-card-content-wrapper.reveal-mobile {
    animation: fadeInDown 0.8s ease-out 0.2s forwards;
}

.arcana-card-image-wrapper {
    position: relative;
}

.arcana-card-image {
    width: 100%;
    height: auto;
    border-radius: 18px;
    display: block;
}


/* ===================================================
   CSS NEEDED FOR REVERSALS
   Add to frontend.css
   =================================================== */

/* Reversed card back during shuffle */
.arcana-card-back.will-reverse {
    transform: rotate(180deg);
}

/* Reversed card image when displayed */
.arcana-card-image.reversed {
    transform: rotate(180deg);
}

/* Draw Another section styling */
.arcana-draw-another-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid rgba(0, 0, 0, 0.1);
    text-align: center;
}

.arcana-draw-another-heading {
    font-size: 24px;
    margin: 0 0 20px 0;
    font-weight: 500;
    color: inherit;
}

.arcana-draw-another-button {
    background: rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 500;
    color: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

.arcana-draw-another-button:hover {
    background: rgba(0, 0, 0, 0.15);
    border-color: rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}


/* Word Overlay on Card */
.arcana-card-word-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    z-index: 10;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

.arcana-card-word-overlay.word-overlay-light {
    color: rgba(255, 255, 255, 0.95);
}

.arcana-card-word-overlay.word-overlay-dark {
    color: rgba(0, 0, 0, 0.85);
}

/* Card Content */
.arcana-card-title {
    font-size: 36px;
    font-weight: 500;
    margin: 0 0 20px 0;
    text-transform: capitalize;
    letter-spacing: 2px;
}

.arcana-card-quote {
    font-size: 22px;
      line-height: 1.2;
    font-style: italic;
    margin-bottom: 20px;
}

.arcana-card-integration {
    font-size: 20px;
    line-height: 1.2;
    margin-bottom: 20px;
}

.arcana-card-integration p:last-child {
    margin-bottom: 0;
}

/* PDF Download Button */
.arcana-card-pdf-download {
    margin: 25px 0;
    text-align: center;
}
.arcana-pdf-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.05);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.arcana-pdf-button:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.arcana-pdf-icon {
    font-size: 20px;
}

/* Photo Credit */
.arcana-photo-credit {
    font-size: 11px;
    color: #999;
    font-style: italic;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    text-align: left;
}

.arcana-photo-credit a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.arcana-photo-credit a:hover {
    opacity: 0.7;
    text-decoration: underline;
}

/* Social Share Buttons */
.arcana-social-share {
    display: flex;
    gap: 12px;
    margin-top: 25px;
    justify-content: center;
    flex-wrap: wrap;
}

.arcana-share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    color: inherit;
    text-decoration: none;
    font-size: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.arcana-share-button:hover,
.arcana-share-button:focus {
    transform: translateY(-3px);
    background: rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.arcana-share-icon {
    display: block;
    line-height: 1;
}

/* Error Message */
.arcana-oracle-error {
    color: #d63638;
    background: #fef7f8;
    border: 1px solid #d63638;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .arcana-oracle-container.card-revealed {
        grid-template-columns: 1fr;
    }
    
    .arcana-card-reveal-wrapper {
        grid-template-columns: 350px 1fr;
        gap: 30px;
    }
    
    .arcana-deck-wrapper {
        max-width: 250px;
    }
}

@media (max-width: 768px) {
    .arcana-oracle-container {
        padding: 20px;
    }
    
    .arcana-oracle-container.card-revealed {
        grid-template-columns: 1fr;
    }
    
    .arcana-card-reveal-wrapper {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .arcana-revealed-card-image {
        max-width: 400px;
        margin: 0 auto;
    }
    
    .arcana-deck-wrapper {
        max-width: 200px;
    }
    
    .arcana-card-content-wrapper {
        padding: 0;
    }
    
    .arcana-card-title {
        font-size: 28px;
    }
    
    .arcana-card-word-overlay {
        font-size: 32px;
    }
    
    .arcana-card-quote {
        font-size: 16px;
    }
    
    .arcana-card-integration {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .arcana-oracle-container {
        padding: 15px;
    }
    
    .arcana-revealed-card-image {
        padding: 15px;
        max-width: 100%;
    }
    
    .arcana-deck-wrapper {
        max-width: 180px;
    }
    
    .arcana-card-title {
        font-size: 24px;
    }
    
    .arcana-card-word-overlay {
        font-size: 24px;
    }
    
    .arcana-social-share {
        gap: 8px;
    }
    
    .arcana-share-button {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}

/* Accessibility */
.arcana-pull-button:focus,
.arcana-share-button:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .arcana-oracle-deck-area,
    .arcana-pull-button,
    .arcana-social-share {
        display: none;
    }
    
    .arcana-oracle-container {
        display: block;
        padding: 0;
    }
    
    .arcana-card-reveal-wrapper {
        display: block;
    }
    
    .arcana-revealed-card-image {
        box-shadow: none;
        page-break-inside: avoid;
        max-width: 100%;
    }
    
    .arcana-card-content-wrapper {
        page-break-inside: avoid;
    }
}
