/* ==========================================================================
   Root Deck — a card stack that grows out of the roots instead of shuffling
   ========================================================================== */

/* Outer wrapper: stack + roots illustration + caption + tree-ring progress,
   stacked vertically and centered. */
body .card-animation-container,
html body .card-animation-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background-color: transparent;
    z-index: 2 !important;
    perspective: 1000px;
    --rd-gold: var(--gold, #c97b5d);
    --rd-oxblood: var(--oxblood, #5c1f27);
    --rd-moss: #4a5a3a;
    --rd-moss-2: #6b7f52;
    --rd-cream: var(--cream, #f7f3e3);
    --rd-serif: var(--font-display, 'Bodoni Moda', Georgia, serif);
    --rd-sans: var(--font-sans, 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
}

/* Wraps the card stack + the root illustration so the roots can be
   positioned relative to the exact pivot point the cards fan from. */
body .root-deck,
html body .root-deck {
    position: relative;
    display: flex;
    justify-content: center;
}

/* Card stack styles - Higher specificity */
body .card-stack,
html body .card-stack {
    position: relative;
    width: 350px; /* Portrait card width */
    height: 525px; /* Portrait card height */
    transform-style: preserve-3d; /* Enable 3D transforms */
    z-index: 2;
}

/* Card styles - Higher specificity */
body .card-stack .card,
html body .card-stack .card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%; /* Match card-stack width */
    height: 100%; /* Match card-stack height */
    border-radius: 10px;
    overflow: hidden; /* Prevent content overflow */
    box-shadow: 0 10px 24px rgba(26, 24, 20, 0.25);
    transform-origin: center center;
    transition: transform 1.5s ease-in-out, opacity 1.5s ease-in-out;
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    opacity: 1;
    transform: rotate(0deg);
    border: 2px solid rgba(247, 243, 227, 0.6);
}

/* Speed Test Mode - Disable animations and show static fanned position */
body .speed-test-mode .card-stack .card,
html body .speed-test-mode .card-stack .card {
    transition: none !important;
    animation: none !important;
}

body .speed-test-mode .root-illustration,
html body .speed-test-mode .root-illustration {
    display: none;
}

/* YouTube iframe styling - Higher specificity */
body .card-stack .card iframe,
html body .card-stack .card iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: none;
    transform: scale(1.5);
    clip-path: inset(0 0 0 0);
}

/* ---- Root illustration -----------------------------------------------
   A small root system + soil mound rendered right at the pivot point the
   cards rotate from, so the deck visually reads as "growing" from it. */
body .root-illustration,
html body .root-illustration {
    position: absolute;
    bottom: -34px;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    height: 90px;
    z-index: 1;
    pointer-events: none;
}

body .root-illustration svg,
html body .root-illustration svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

body .root-path,
html body .root-path {
    fill: none;
    stroke: var(--rd-oxblood);
    stroke-width: 2.5;
    stroke-linecap: round;
    opacity: 0.4;
}

body .root-path--sm,
html body .root-path--sm {
    stroke-width: 1.75;
    opacity: 0.28;
}

body .root-soil,
html body .root-soil {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 96px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(74, 90, 58, 0.45) 0%, rgba(74, 90, 58, 0) 75%);
}

/* ---- Growth caption ---------------------------------------------------- */
body .root-deck-caption,
html body .root-deck-caption {
    margin: 0;
    min-height: 1.4em;
    font-family: var(--rd-serif);
    font-style: italic;
    font-size: 17px;
    letter-spacing: 0.01em;
    color: var(--rd-oxblood);
    text-align: center;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

body .root-deck-caption.is-visible,
html body .root-deck-caption.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Tree-ring progress dots ------------------------------------------- */
body .root-deck-rings,
html body .root-deck-rings {
    display: flex;
    align-items: center;
    gap: 10px;
}

body .root-ring,
html body .root-ring {
    --ring-size: 10px;
    position: relative;
    width: var(--ring-size);
    height: var(--ring-size);
    border-radius: 50%;
    border: 1.5px solid rgba(74, 90, 58, 0.4);
    box-shadow: 0 0 0 3px rgba(74, 90, 58, 0.12);
    transition: border-color 0.5s ease, box-shadow 0.5s ease, transform 0.5s ease;
}

body .root-ring.is-active,
html body .root-ring.is-active {
    border-color: var(--rd-gold);
    box-shadow: 0 0 0 3px rgba(201, 123, 93, 0.22);
    transform: scale(1.15);
}

/* Media queries - adjust breakpoints and sizes as needed */
@media (max-width: 768px) {
    body .card-stack,
    html body .card-stack {
        width: 280px;
        height: 420px;
    }
    body .root-illustration,
    html body .root-illustration {
        width: 180px;
        height: 74px;
        bottom: -28px;
    }
}

@media (max-width: 480px) {
    body .card-stack,
    html body .card-stack {
        width: 250px;
        height: 375px;
    }
    body .root-illustration,
    html body .root-illustration {
        width: 160px;
        height: 64px;
        bottom: -24px;
    }
    body .root-deck-caption,
    html body .root-deck-caption {
        font-size: 15px;
        padding: 0 12px;
    }
}

@media (max-width: 320px) {
    body .card-stack,
    html body .card-stack {
        width: 150px;
        height: 225px;
    }
    body .root-illustration,
    html body .root-illustration {
        width: 120px;
        height: 50px;
        bottom: -18px;
    }
}
