/* ===================================================================
   MYSTICAL.QUEST - Dopamine-Fueled Tarot Arcade Styles
   =================================================================== */

/* COLOR PALETTE */
:root {
    --cream-cloud: #fef5e7;
    --mystic-lilac: #d8b4fe;
    --oracle-green: #a7f3d0;
    --fortune-blush: #fda4af;
    --star-butter: #fde68a;
    --crystal-sky: #bae6fd;
    --amethyst-bold: #7c3aed;
    --deep-plum: #3b0764;
    --hot-coral: #ff3366;
    --muted-grape: #c084fc;

    /* Gradients */
    --hero-gradient: linear-gradient(135deg, #d8b4fe 0%, #a7f3d0 100%);
}

/* ===================================================================
   GLOBAL STYLES
   =================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: 'DM Sans', sans-serif;
    color: var(--deep-plum);
    overflow-x: hidden;
}

body {
    background-color: var(--cream-cloud);
}

/* Typography Base */
h1, h2, h3, h4, h5, h6 {
    font-weight: 400;
}

p {
    line-height: 1.7;
}

/* ===================================================================
   SECTION CONTAINER
   =================================================================== */

.section {
    position: relative;
    width: 100%;
    min-height: 100vh;
    padding: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.8s ease;
}

.section-hero {
    background: var(--hero-gradient);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3rem;
}

.section-cards {
    background-color: var(--cream-cloud);
    flex-direction: column;
    padding: 4rem 2rem;
    gap: 3rem;
}

.section-ticker {
    background: repeating-linear-gradient(
        45deg,
        var(--mystic-lilac),
        var(--mystic-lilac) 10px,
        var(--oracle-green) 10px,
        var(--oracle-green) 20px
    );
    min-height: 12vh;
    padding: 2rem;
    overflow: hidden;
}

.section-fortunes {
    background-color: var(--cream-cloud);
    flex-direction: column;
    padding: 4rem 2rem;
    gap: 3rem;
}

.section-closing {
    background: repeating-linear-gradient(
        90deg,
        var(--fortune-blush),
        var(--fortune-blush) 20px,
        var(--star-butter) 20px,
        var(--star-butter) 40px
    );
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    position: relative;
}

/* ===================================================================
   HERO PORTAL
   =================================================================== */

.hero-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.kinetic-title {
    font-family: 'Bungee', cursive;
    font-size: clamp(3rem, 10vw, 7rem);
    font-weight: 400;
    letter-spacing: 0.02em;
    display: inline-flex;
    gap: 0.05em;
    color: var(--deep-plum);
}

.kinetic-title .letter {
    display: inline-block;
    animation: bounce 2s ease-in-out infinite;
    will-change: transform;
}

.kinetic-title .letter:nth-child(1) { animation-delay: 0.05s; }
.kinetic-title .letter:nth-child(2) { animation-delay: 0.1s; }
.kinetic-title .letter:nth-child(3) { animation-delay: 0.15s; }
.kinetic-title .letter:nth-child(4) { animation-delay: 0.2s; }
.kinetic-title .letter:nth-child(5) { animation-delay: 0.25s; }
.kinetic-title .letter:nth-child(6) { animation-delay: 0.3s; }
.kinetic-title .letter:nth-child(7) { animation-delay: 0.35s; }
.kinetic-title .letter:nth-child(8) { animation-delay: 0.4s; }
.kinetic-title .letter:nth-child(9) { animation-delay: 0.45s; }
.kinetic-title .letter:nth-child(10) { animation-delay: 0.5s; }
.kinetic-title .letter:nth-child(11) { animation-delay: 0.55s; }
.kinetic-title .letter:nth-child(12) { animation-delay: 0.6s; }
.kinetic-title .letter:nth-child(13) { animation-delay: 0.65s; }
.kinetic-title .letter:nth-child(14) { animation-delay: 0.7s; }

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

/* All-Seeing Eye */
.all-seeing-eye {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eye-outer {
    position: absolute;
    width: 100px;
    height: 60px;
    border-radius: 50% / 40%;
    background: var(--cream-cloud);
    border: 3px solid var(--amethyst-bold);
    display: flex;
    align-items: center;
    justify-content: center;
}

.eye-iris {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, var(--amethyst-bold), var(--deep-plum));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.eye-pupil {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: black;
    position: absolute;
}

.eye-triangle {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 25px solid var(--amethyst-bold);
    bottom: -25px;
    opacity: 0.6;
}

.eye-outer.blinking {
    animation: blink 0.3s ease-in-out;
}

@keyframes blink {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.05); }
}

.hero-tagline {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(0.9rem, 1.3vw, 1.05rem);
    color: var(--deep-plum);
    font-weight: 400;
    letter-spacing: 0.02em;
    font-style: italic;
}

/* ===================================================================
   CARD SPREAD SECTION
   =================================================================== */

.section-heading {
    font-family: 'Bungee', cursive;
    font-size: clamp(1.5rem, 4vw, 3rem);
    width: 100%;
    text-align: center;
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    gap: 0.05em;
}

.section-heading .letter {
    display: inline-block;
    animation: bounce 2s ease-in-out infinite;
}

.section-heading:nth-child(1) .letter:nth-child(1) { animation-delay: 0.05s; }
.section-heading:nth-child(1) .letter:nth-child(2) { animation-delay: 0.1s; }
.section-heading:nth-child(1) .letter:nth-child(3) { animation-delay: 0.15s; }
.section-heading:nth-child(1) .letter:nth-child(4) { animation-delay: 0.2s; }
.section-heading:nth-child(1) .letter:nth-child(5) { animation-delay: 0.25s; }
.section-heading:nth-child(1) .letter:nth-child(6) { animation-delay: 0.3s; }
.section-heading:nth-child(1) .letter:nth-child(7) { animation-delay: 0.35s; }
.section-heading:nth-child(1) .letter:nth-child(8) { animation-delay: 0.4s; }

/* Card Spread Layout */
.card-spread-layout {
    position: relative;
    width: 100%;
    min-height: 80vh;
    margin-bottom: 2rem;
}

/* Tarot Cards */
.tarot-card {
    position: absolute;
    width: 280px;
    height: 420px;
    perspective: 1200px;
    cursor: pointer;
}

.card-left {
    width: 60%;
    max-width: 420px;
    left: 5%;
    top: 0;
}

.card-right {
    width: 35%;
    max-width: 320px;
    right: 5%;
    top: 15vh;
}

.card-center {
    width: 45%;
    max-width: 380px;
    left: 50%;
    transform: translateX(-50%);
    bottom: 5vh;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.tarot-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    border: 3px solid;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.card-front {
    background-size: 16px 16px;
    background-repeat: repeat;
}

.pattern-checkerboard {
    background-image:
        repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(124, 58, 237, 0.25) 8px, rgba(124, 58, 237, 0.25) 16px),
        repeating-linear-gradient(-45deg, transparent, transparent 8px, rgba(124, 58, 237, 0.25) 8px, rgba(124, 58, 237, 0.25) 16px);
    background-color: var(--mystic-lilac);
    border-color: var(--amethyst-bold);
}

.pattern-zigzag {
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(124, 58, 237, 0.3) 10px,
        rgba(124, 58, 237, 0.3) 20px
    );
    background-color: var(--oracle-green);
    border-color: var(--amethyst-bold);
}

.pattern-polkadot {
    background-image: radial-gradient(circle, rgba(124, 58, 237, 0.3) 4px, transparent 4px);
    background-size: 16px 16px;
    background-position: 0 0;
    background-color: var(--star-butter);
    border-color: var(--hot-coral);
}

.card-front-decor {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
}

.crescent {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid rgba(59, 7, 100, 0.4);
}

.crescent-1 {
    top: 20px;
    left: 20px;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 100%, 50% 50%, 0 50%);
}

.crescent-2 {
    bottom: 20px;
    right: 20px;
    clip-path: polygon(0 0, 50% 0, 50% 50%, 100% 50%, 100% 100%, 0 100%);
}

.star-shape {
    width: 40px;
    height: 40px;
    opacity: 0.3;
}

.card-numeral {
    font-family: 'Bungee', cursive;
    font-size: 4rem;
    color: rgba(59, 7, 100, 0.3);
    font-weight: 400;
}

.card-back {
    background-color: var(--cream-cloud);
    border-color: var(--amethyst-bold);
    transform: rotateY(180deg);
    padding: 2rem;
    gap: 1rem;
    text-align: center;
}

.card-back h3 {
    font-family: 'Bungee', cursive;
    font-size: 1.5rem;
    color: var(--amethyst-bold);
    margin-bottom: 0.5rem;
}

.card-back p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--deep-plum);
}

.card-hint {
    text-align: center;
    font-size: 0.9rem;
    color: var(--muted-grape);
    margin-top: 2rem;
    font-style: italic;
}

/* ===================================================================
   TICKER STRIP
   =================================================================== */

.ticker-track {
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.ticker-content {
    display: flex;
    gap: 3rem;
    animation: scroll-left 40s linear infinite;
    white-space: nowrap;
    will-change: transform;
}

.ticker-item {
    font-family: 'Archivo Black', sans-serif;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--deep-plum);
    flex-shrink: 0;
}

@keyframes scroll-left {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* ===================================================================
   FORTUNE GRID
   =================================================================== */

.fortune-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 4px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.fortune-cell {
    min-height: 240px;
    padding: 3rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 2px solid;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    font-size: clamp(0.9rem, 1.3vw, 1.05rem);
}

.cell-1 {
    background-color: var(--mystic-lilac);
    border-color: var(--amethyst-bold);
    background-image:
        repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(124, 58, 237, 0.15) 8px, rgba(124, 58, 237, 0.15) 16px),
        repeating-linear-gradient(-45deg, transparent, transparent 8px, rgba(124, 58, 237, 0.15) 8px, rgba(124, 58, 237, 0.15) 16px);
}

.cell-2 {
    background-color: var(--oracle-green);
    border-color: var(--amethyst-bold);
    background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(124, 58, 237, 0.2) 10px, rgba(124, 58, 237, 0.2) 20px);
}

.cell-3 {
    background-color: var(--fortune-blush);
    border-color: var(--hot-coral);
    background-image: radial-gradient(circle, rgba(124, 58, 237, 0.15) 4px, transparent 4px);
    background-size: 16px 16px;
}

.cell-4 {
    background-color: var(--star-butter);
    border-color: var(--amethyst-bold);
    background-image: repeating-linear-gradient(90deg, transparent, transparent 10px, rgba(124, 58, 237, 0.15) 10px, rgba(124, 58, 237, 0.15) 20px);
}

.cell-5 {
    background-color: var(--crystal-sky);
    border-color: var(--amethyst-bold);
    background-image: repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(124, 58, 237, 0.2) 10px, rgba(124, 58, 237, 0.2) 20px);
}

.cell-6 {
    background-color: var(--mystic-lilac);
    border-color: var(--amethyst-bold);
    background-image:
        repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(124, 58, 237, 0.15) 8px, rgba(124, 58, 237, 0.15) 16px),
        repeating-linear-gradient(-45deg, transparent, transparent 8px, rgba(124, 58, 237, 0.15) 8px, rgba(124, 58, 237, 0.15) 16px);
}

.magnetic-element {
    transition: transform 0.2s ease-out;
}

.fortune-cell p {
    position: relative;
    z-index: 1;
}

/* ===================================================================
   CLOSING SPIRAL
   =================================================================== */

.spiral-container {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 3rem;
}

.spiral-ring {
    position: absolute;
    border: 2px solid var(--deep-plum);
    opacity: 0.4;
    animation: spin 8s linear infinite;
}

.ring-1 {
    width: 280px;
    height: 280px;
    border-radius: 50%;
    animation-delay: 0s;
}

.ring-2 {
    width: 240px;
    height: 240px;
    border-radius: 50%;
    animation-delay: -1s;
}

.ring-3 {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    animation-delay: -2s;
}

.ring-4 {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    animation-delay: -3s;
}

.ring-5 {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    animation-delay: -4s;
}

.ring-6 {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    animation-delay: -5s;
}

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

.typewriter-text {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: var(--deep-plum);
    text-align: center;
    min-height: 3.5rem;
}

.typewriter-text.typing::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: var(--deep-plum);
    margin-left: 4px;
    animation: blink-cursor 0.6s infinite;
}

@keyframes blink-cursor {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* ===================================================================
   GLITCH EFFECT
   =================================================================== */

.glitch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    display: none;
}

.glitch-overlay.active {
    display: block;
    animation: glitch-effect 0.4s ease-out;
}

@keyframes glitch-effect {
    0% {
        clip-path: inset(0);
    }
    10% {
        clip-path: inset(5px 0 10px 0);
    }
    20% {
        clip-path: inset(10px 0 5px 0);
    }
    30% {
        clip-path: inset(2px 0 8px 0);
    }
    40% {
        clip-path: inset(8px 0 3px 0);
    }
    50% {
        clip-path: inset(3px 0 7px 0);
    }
    60% {
        clip-path: inset(6px 0 4px 0);
    }
    70% {
        clip-path: inset(4px 0 6px 0);
    }
    80% {
        clip-path: inset(7px 0 2px 0);
    }
    90% {
        clip-path: inset(1px 0 9px 0);
    }
    100% {
        clip-path: inset(0);
    }
}

/* ===================================================================
   HOVER & INTERACTIVE STATES
   =================================================================== */

.kinetic-title .letter:hover {
    animation-play-state: paused;
    transform: scale(1.3) rotate(8deg);
}

.fortune-cell:hover {
    transform: scale(1.05);
}

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

@media (max-width: 768px) {
    .section {
        padding: 2rem;
    }

    .card-left, .card-right, .card-center {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        bottom: auto !important;
        transform: none !important;
        width: 100% !important;
        margin-bottom: 2rem;
    }

    .card-spread-layout {
        min-height: auto;
    }

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

    .ticker-item {
        font-size: 1.2rem;
    }

    .kinetic-title {
        font-size: 2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
