/* ========================================
   a6c.quest - Candy Quest Adventure Portal
   ======================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Comfortaa', sans-serif;
    font-weight: 300;
    font-size: 1.125rem;
    line-height: 1.75;
    color: #2D1833;
    background-color: #FFF6EC;
    overflow-x: hidden;
    position: relative;
}

/* --- Floating Navigation --- */
.floating-nav {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: calc(100% - 48px);
    max-width: 600px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border-radius: 999px;
    box-shadow:
        0 2px 8px rgba(255, 180, 204, 0.3),
        0 8px 24px rgba(255, 180, 204, 0.15);
    transition: opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.floating-nav.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
    pointer-events: none;
}

.nav-wordmark {
    font-family: 'Varela Round', sans-serif;
    font-size: 1.5rem;
    color: #FF6B9D;
    letter-spacing: -0.02em;
}

.nav-hamburger {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-hamburger:hover {
    transform: rotate(-2deg) scale(1.03);
}

.nav-hamburger span {
    display: block;
    width: 22px;
    height: 2.5px;
    background-color: #FF6B9D;
    border-radius: 2px;
    transition: transform 0.3s ease;
}

/* --- Hero Section --- */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 24px;
}

.hero-bg-gradient {
    position: absolute;
    inset: 24px;
    border-radius: 40px;
    background: radial-gradient(ellipse at center, #FFF6EC 0%, #FFE66D 40%, #FF6B9D 100%);
    z-index: 0;
    box-shadow:
        0 4px 16px rgba(255, 212, 229, 0.4),
        0 16px 48px rgba(255, 212, 229, 0.2),
        0 32px 80px rgba(255, 107, 157, 0.1);
}

.floating-shapes {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.floating-shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.floating-shape.visible {
    opacity: var(--shape-opacity, 0.5);
}

.floating-shape.circle {
    border-radius: 50%;
}

.floating-shape.rounded-square {
    border-radius: 30%;
}

.floating-shape.blob {
    animation-name: morphBlob;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

@keyframes morphBlob {
    0% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    33% { border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%; }
    66% { border-radius: 50% 50% 30% 70% / 60% 40% 60% 40%; }
    100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
}

@keyframes floatShape {
    0% { transform: translateY(0) rotate(var(--rot-start, 0deg)); }
    50% { transform: translateY(-20px) rotate(calc(var(--rot-start, 0deg) + 180deg)); }
    100% { transform: translateY(0) rotate(calc(var(--rot-start, 0deg) + 360deg)); }
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-logotype {
    font-family: 'Varela Round', sans-serif;
    font-size: 18vw;
    font-weight: 400;
    color: #FF6B9D;
    line-height: 1;
    letter-spacing: -0.03em;
    text-shadow:
        0 4px 0 #FFB4CC,
        0 8px 24px rgba(255, 107, 157, 0.25);
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-logotype.animate-in {
    opacity: 1;
    transform: scale(1);
}

.hero-quest {
    font-family: 'Varela Round', sans-serif;
    font-size: 4vw;
    color: #4ECDC4;
    letter-spacing: 0.1em;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.5s ease 0.7s, transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.7s;
}

.hero-quest.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.hero-confetti {
    position: absolute;
    width: 300px;
    height: 300px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 3;
}

.confetti-piece {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
}

.confetti-piece.animate-in {
    animation: confettiBurst 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes confettiBurst {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0) rotate(0deg)
            translateX(var(--confetti-x, 0))
            translateY(var(--confetti-y, 0));
    }
    60% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2) rotate(var(--confetti-rot, 180deg))
            translateX(var(--confetti-x, 0))
            translateY(var(--confetti-y, 0));
    }
    100% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(1) rotate(var(--confetti-rot, 180deg))
            translateX(var(--confetti-x, 0))
            translateY(var(--confetti-y, 0));
    }
}

.hero-chevron {
    position: absolute;
    bottom: 48px;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.5s ease 1.5s;
    animation: bounceChevron 2s ease-in-out infinite;
}

.hero-chevron.animate-in {
    opacity: 1;
}

@keyframes bounceChevron {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* --- Quest Map Line --- */
.quest-line {
    position: absolute;
    top: 100vh;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 2000px;
    z-index: 1;
    pointer-events: none;
}

#quest-path {
    stroke-dasharray: 5000;
    stroke-dashoffset: 5000;
    transition: stroke-dashoffset 0.1s linear;
}

/* --- Quest Cards Container --- */
.quest-cards {
    position: relative;
    z-index: 5;
    padding: 80px 0 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 80px;
}

/* --- Quest Card --- */
.quest-card {
    position: relative;
    width: 90vw;
    max-width: 900px;
    border-radius: 32px;
    padding: 60px 48px 48px;
    border: 2px solid #FFD4E5;
    box-shadow:
        0 4px 12px rgba(255, 212, 229, 0.3),
        0 12px 32px rgba(255, 212, 229, 0.15),
        0 24px 60px rgba(255, 107, 157, 0.08);
    opacity: 0;
    transform: scale(0.85) translateY(30px);
    transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quest-card.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.quest-card:hover {
    transform: rotate(-1deg) scale(1.02);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quest-card.visible:hover {
    transform: rotate(-1deg) scale(1.02);
}

/* Card color variants */
.card-1 {
    background: linear-gradient(135deg, #FF6B9D, #FFB4CC);
}

.card-2 {
    background: linear-gradient(135deg, #4ECDC4, #8EEEE5);
}

.card-3 {
    background: linear-gradient(135deg, #C3A6FF, #DDD0FF);
}

.card-4 {
    background: linear-gradient(135deg, #FF9F43, #FFC98A);
}

.card-5 {
    background: linear-gradient(135deg, #7FE5A0, #B5F0C8);
}

/* --- Level Badge --- */
.level-badge {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    width: 48px;
    height: 48px;
    background: #FFE66D;
    border: 3px solid #2D1833;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Baloo 2', cursive;
    font-weight: 600;
    font-size: 1.25rem;
    color: #2D1833;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.quest-card.visible .level-badge {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    animation: badgeBounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes badgeBounce {
    0% {
        transform: translateX(-50%) translateY(-20px) scaleX(1) scaleY(1);
    }
    50% {
        transform: translateX(-50%) translateY(2px) scaleX(1.1) scaleY(0.9);
    }
    75% {
        transform: translateX(-50%) translateY(-4px) scaleX(0.95) scaleY(1.05);
    }
    100% {
        transform: translateX(-50%) translateY(0) scaleX(1) scaleY(1);
    }
}

/* --- Card Confetti --- */
.card-confetti {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 60px;
    pointer-events: none;
    z-index: 5;
}

.card-confetti-piece {
    position: absolute;
    top: 0;
    left: 50%;
    opacity: 0;
    transform: translate(-50%, 0) scale(0);
}

.quest-card.visible .card-confetti-piece {
    animation: cardConfettiBurst 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: var(--confetti-delay, 0s);
}

@keyframes cardConfettiBurst {
    0% {
        opacity: 0;
        transform: translate(-50%, 0) scale(0) rotate(0deg)
            translateX(var(--cx, 0)) translateY(var(--cy, 0));
    }
    100% {
        opacity: 0.8;
        transform: translate(-50%, 0) scale(1) rotate(var(--cr, 45deg))
            translateX(var(--cx, 0)) translateY(var(--cy, 0));
    }
}

/* --- Card Inner Layout --- */
.card-inner {
    display: grid;
    grid-template-columns: 1fr 0.6fr;
    gap: 32px;
    align-items: center;
}

.card-text {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card-title {
    font-family: 'Varela Round', sans-serif;
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 400;
    color: #FFF6EC;
    line-height: 1.15;
    text-shadow: 0 2px 0 rgba(45, 24, 51, 0.1);
}

.card-subtitle {
    font-family: 'Baloo 2', cursive;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 246, 236, 0.8);
}

.card-description {
    font-family: 'Comfortaa', sans-serif;
    font-weight: 300;
    font-size: 1rem;
    line-height: 1.75;
    color: rgba(255, 246, 236, 0.9);
}

.card-illustration {
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-40px);
}

.illustration-svg {
    width: 100%;
    max-width: 200px;
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(45, 24, 51, 0.15));
}

/* --- Background Decorations --- */
.bg-decorations {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-deco-shape {
    position: absolute;
    opacity: 0.15;
    animation: rotateSlow var(--deco-duration, 40s) linear infinite;
}

.bg-deco-donut {
    border-radius: 50%;
    border: 6px solid var(--deco-color, #FF6B9D);
    background: transparent;
}

.bg-deco-plus {
    width: 30px;
    height: 30px;
    position: absolute;
}

.bg-deco-plus::before,
.bg-deco-plus::after {
    content: '';
    position: absolute;
    background: var(--deco-color, #4ECDC4);
    border-radius: 3px;
}

.bg-deco-plus::before {
    width: 100%;
    height: 6px;
    top: 50%;
    transform: translateY(-50%);
}

.bg-deco-plus::after {
    width: 6px;
    height: 100%;
    left: 50%;
    transform: translateX(-50%);
}

.bg-deco-zigzag {
    width: 60px;
    height: 20px;
    border-bottom: 4px solid var(--deco-color, #FFE66D);
    border-radius: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 8px,
        var(--deco-color, #FFE66D) 8px,
        var(--deco-color, #FFE66D) 10px
    );
}

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

/* --- Star SVG shapes used as decorations --- */
.star-accent {
    position: absolute;
    z-index: 2;
    opacity: 0.5;
    animation: twinkle 3s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(0.9); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hero-logotype {
        font-size: 28vw;
    }

    .hero-quest {
        font-size: 7vw;
    }

    .quest-card {
        width: 92vw;
        padding: 48px 24px 32px;
    }

    .card-inner {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .card-illustration {
        order: -1;
        transform: translateY(0);
    }

    .illustration-svg {
        max-width: 150px;
    }

    .card-title {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
    }

    .quest-cards {
        gap: 60px;
    }

    .floating-nav {
        width: calc(100% - 32px);
    }
}

@media (max-width: 480px) {
    .hero-logotype {
        font-size: 32vw;
    }

    .hero-quest {
        font-size: 9vw;
    }

    .quest-card {
        padding: 40px 20px 28px;
    }
}

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

    .hero-logotype,
    .hero-quest,
    .hero-chevron,
    .quest-card,
    .level-badge {
        opacity: 1;
        transform: none;
    }

    .hero-logotype.animate-in,
    .hero-quest.animate-in {
        transform: none;
    }

    .floating-shape {
        opacity: var(--shape-opacity, 0.5) !important;
    }
}
