/**
 * home.css - Home Page Styles
 *
 * Styles specific to the home page (index.html).
 * Uses design tokens from variables.css.
 *
 * Animated version - CSS keyframe animations for page elements.
 */

/* ========================================
   KEYFRAME ANIMATIONS
   ======================================== */

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes floatCard {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50% { transform: translateY(-15px) rotate(1deg); }
}

@keyframes textGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes sparkle {
    0%, 100% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.5); opacity: 1; }
}

@keyframes sneakyPulse {
    0%, 90%, 100% { opacity: 0.5; transform: scale(1); }
    95% { opacity: 1; transform: scale(1.1); }
}

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

@keyframes bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.1); }
}

/* ========================================
   PAGE BACKGROUND
   ======================================== */

body {
    background: var(--gradient-primary);
    animation: gradientShift 8s ease infinite;
}

/* ========================================
   FIXED DECORATIVE ELEMENTS
   ======================================== */

.clickable-emoji {
    position: fixed;
    font-size: var(--font-size-3xl);
    cursor: pointer;
    z-index: var(--z-floating);
    animation: gentleFloat 4s ease-in-out infinite;
    transition: transform 0.2s;
}

.clickable-emoji:hover {
    transform: scale(1.3);
}

.clickable-emoji:active {
    transform: scale(0.8);
}

.bouncing-emoji {
    position: fixed;
    font-size: var(--font-size-2xl);
    z-index: var(--z-overlay);
    pointer-events: none;
    animation: bounce 2s ease-in-out infinite;
}

/* Scatter bouncing emojis across the page */
#bouncing .bouncing-emoji:nth-child(1) { top: 12%;  left: 8%;   animation-delay: 0s; }
#bouncing .bouncing-emoji:nth-child(2) { top: 35%;  right: 6%;  animation-delay: 0.3s; }
#bouncing .bouncing-emoji:nth-child(3) { top: 65%;  left: 5%;   animation-delay: 0.6s; }
#bouncing .bouncing-emoji:nth-child(4) { bottom: 15%; right: 9%; animation-delay: 0.2s; }
#bouncing .bouncing-emoji:nth-child(5) { top: 50%;  left: 45%;  animation-delay: 0.5s; }

/* ========================================
   SECRET BUTTON
   ======================================== */

.dont-touch-container {
    position: fixed;
    bottom: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-overlay);
}

.dont-touch-btn {
    background: var(--color-surface-overlay);
    border: 2px dashed rgba(255, 255, 255, 0.5);
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-xs);
    font-weight: bold;
    color: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    opacity: 0.5;
    animation: sneakyPulse 4s ease infinite;
    transition: all 0.3s;
}

.dont-touch-btn:hover {
    transform: scale(1.2);
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    color: white;
    border: none;
    padding: 10px 15px;
    opacity: 1;
}

/* ========================================
   MAIN CONTENT WRAPPER
   ======================================== */

.main-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: var(--space-5);
    position: relative;
    z-index: var(--z-content);
}

/* ========================================
   GREETING CARD
   ======================================== */

.greeting-card {
    background: var(--color-surface-card);
    padding: var(--space-8) var(--space-9);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
    position: relative;
    max-width: 90%;
    animation: floatCard 3s ease-in-out infinite;
}

/* ========================================
   TITLE AND SUBTITLE
   ======================================== */

h1 {
    font-size: var(--font-size-3xl);
    background: var(--gradient-title);
    background-size: 400% 400%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-4);
    animation: textGradient 3s ease infinite;
}

.scramble-name {
    /* Span for future animation - inherits h1 styles */
}

.subtitle {
    font-size: var(--font-size-lg);
    color: var(--color-primary-2);
    margin-bottom: var(--space-5);
}

/* ========================================
   SPARKLE DECORATIONS
   ======================================== */

.sparkle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: gold;
    border-radius: 50%;
    animation: sparkle 1.5s ease-in-out infinite;
}

.sparkle:nth-child(1) { top: 10%; left: 10%; animation-delay: 0s; }
.sparkle:nth-child(2) { top: 10%; right: 10%; animation-delay: 0.3s; }
.sparkle:nth-child(3) { bottom: 30%; left: 10%; animation-delay: 0.6s; }
.sparkle:nth-child(4) { bottom: 30%; right: 10%; animation-delay: 0.9s; }

/* ========================================
   JOKE BOX
   ======================================== */

.joke-box {
    background: var(--gradient-joke);
    padding: var(--space-5);
    border-radius: var(--radius-md);
    margin-top: var(--space-4);
    cursor: pointer;
    transition: transform 0.2s;
}

.joke-box:hover {
    transform: scale(1.02);
}

.joke-box:active {
    transform: scale(0.98);
}

.joke-label {
    font-size: var(--font-size-md);
    color: var(--color-accent-orange);
    font-weight: bold;
    margin-bottom: var(--space-2);
}

.joke-text {
    font-size: var(--font-size-base);
    color: var(--color-text-primary);
    line-height: var(--line-height-base);
}

.joke-answer {
    font-weight: bold;
    color: var(--color-accent-purple);
    margin-top: var(--space-2);
    opacity: 0;
    transition: opacity 0.3s;
}

.tap-hint {
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-2);
}

/* Revealed state */
.joke-box.revealed .joke-answer {
    opacity: 1;
}

.joke-box.revealed .tap-hint {
    display: none;
}

/* ========================================
   NAME GENERATORS
   ======================================== */

.name-generators {
    display: flex;
    gap: var(--space-4);
    margin-top: var(--space-4);
    flex-wrap: wrap;
    justify-content: center;
}

.name-gen-box {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-sm);
    cursor: pointer;
    flex: 1;
    min-width: 140px;
    max-width: 200px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.name-gen-box:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.name-gen-box:active {
    transform: scale(0.95);
}

.name-gen-box.fairy {
    background: var(--gradient-fairy);
}

.name-gen-box.numpty {
    background: var(--gradient-numpty);
}

.name-gen-label {
    font-size: var(--font-size-sm);
    color: var(--color-text-light);
    font-weight: bold;
    margin-bottom: var(--space-1);
}

.name-gen-result {
    font-size: var(--font-size-base);
    color: var(--color-text-dark);
    font-weight: bold;
    min-height: 1.5em;
}

.name-gen-hint {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-1);
}

/* Activated state - hint hidden after first click */
.name-gen-box.activated .name-gen-hint {
    display: none;
}

/* ========================================
   PRINCESS SHORTCUT ICON
   ======================================== */

.princess-shortcut {
    width: 40px;
    height: 40px;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    cursor: pointer;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.princess-shortcut.visible {
    opacity: 1;
    pointer-events: auto;
    animation: princess-float 3s ease-in-out infinite;
}

/* Face circle */
.princess-shortcut .ps-face {
    width: 32px;
    height: 32px;
    background: radial-gradient(circle at 50% 40%, #fce4d6, #f5c6a8);
    border-radius: 50%;
    position: relative;
    margin: 8px auto 0;
}

/* Eyes */
.princess-shortcut .ps-eye {
    width: 5px;
    height: 6px;
    background: #333;
    border-radius: 50%;
    position: absolute;
    top: 12px;
    transition: height 0.1s;
}

.princess-shortcut .ps-eye.left { left: 8px; }
.princess-shortcut .ps-eye.right { right: 8px; }

/* Eye highlight */
.princess-shortcut .ps-eye::after {
    content: '';
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 1px;
    right: 1px;
}

/* Cheeks */
.princess-shortcut .ps-cheek {
    width: 6px;
    height: 4px;
    background: rgba(255, 150, 150, 0.5);
    border-radius: 50%;
    position: absolute;
    top: 18px;
}

.princess-shortcut .ps-cheek.left { left: 3px; }
.princess-shortcut .ps-cheek.right { right: 3px; }

/* Mini crown */
.princess-shortcut .ps-crown {
    width: 18px;
    height: 8px;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(to bottom, #ffd700, #daa520);
    clip-path: polygon(0% 100%, 15% 30%, 30% 100%, 50% 0%, 70% 100%, 85% 30%, 100% 100%);
}

/* Mouth (tiny smile) */
.princess-shortcut .ps-mouth {
    width: 8px;
    height: 4px;
    border-bottom: 2px solid #cc7766;
    border-radius: 0 0 50% 50%;
    position: absolute;
    bottom: 7px;
    left: 50%;
    transform: translateX(-50%);
}

/* Float/bob animation */
@keyframes princess-float {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-5px); }
}

/* Blink */
.princess-shortcut.blink .ps-eye {
    height: 2px;
}

/* Wink (left eye only) */
.princess-shortcut.wink .ps-eye.left {
    height: 2px;
}

/* Bounce (tap 1) */
.princess-shortcut.bounce {
    animation: princess-bounce 0.3s ease !important;
}

@keyframes princess-bounce {
    0% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-12px); }
    70% { transform: translateX(-50%) translateY(-2px); }
    100% { transform: translateX(-50%) translateY(0); }
}

/* Giggle (tap 2) */
.princess-shortcut.giggle {
    animation: princess-giggle 0.3s ease !important;
}

@keyframes princess-giggle {
    0%, 100% { transform: translateX(-50%) rotate(0deg); }
    25% { transform: translateX(-50%) rotate(-5deg); }
    75% { transform: translateX(-50%) rotate(5deg); }
}

/* Wave (single tap) */
.princess-shortcut.wave {
    animation: princess-wave 0.5s ease !important;
}

@keyframes princess-wave {
    0%, 100% { transform: translateX(-50%) rotate(0deg); }
    20% { transform: translateX(-50%) rotate(-10deg); }
    40% { transform: translateX(-50%) rotate(10deg); }
    60% { transform: translateX(-50%) rotate(-8deg); }
    80% { transform: translateX(-50%) rotate(6deg); }
}

/* Magical swirl (tap 3 / navigate) */
.princess-shortcut.swirl {
    animation: princess-swirl 0.5s ease forwards !important;
}

@keyframes princess-swirl {
    0% { transform: translateX(-50%) rotate(0deg) scale(1); }
    50% { transform: translateX(-50%) rotate(360deg) scale(1.3); }
    100% { transform: translateX(-50%) rotate(720deg) scale(0); opacity: 0; }
}

/* Sparkle elements for tap 2 */
.princess-sparkle {
    position: fixed;
    font-size: 14px;
    pointer-events: none;
    z-index: 101;
    animation: princess-sparkle-fly 0.6s ease-out forwards;
}

@keyframes princess-sparkle-fly {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--sparkle-dx, 20px), var(--sparkle-dy, -30px)) scale(0.3); }
}

/* Hide-and-seek repositioning */
.princess-shortcut.hide-seek-hide {
    animation: princess-hide 0.3s ease forwards !important;
}

@keyframes princess-hide {
    0% { opacity: 1; transform: translateX(-50%) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) scale(0.3); }
}

.princess-shortcut.hide-seek-show {
    animation: princess-show 0.3s ease forwards !important;
}

@keyframes princess-show {
    0% { opacity: 0; transform: translateX(-50%) scale(0.3); }
    100% { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* Animal+princess interaction: heart between */
.princess-interaction-heart {
    position: fixed;
    font-size: 24px;
    pointer-events: none;
    z-index: 101;
    animation: interaction-heart-float 1s ease-out forwards;
}

@keyframes interaction-heart-float {
    0% { opacity: 0; transform: scale(0) translateY(0); }
    30% { opacity: 1; transform: scale(1.2) translateY(-10px); }
    100% { opacity: 0; transform: scale(0.8) translateY(-40px); }
}

/* Animal move-toward animation */
.animal-move-toward {
    transition: transform 0.5s ease !important;
    animation: none !important;
}

/* Dog tail wag */
.animal-tail-wag {
    animation: tail-wag 0.2s ease infinite !important;
}

@keyframes tail-wag {
    0%, 100% { transform: rotate(0deg) scale(1.1); }
    50% { transform: rotate(15deg) scale(1.1); }
}

/* Fox bow */
.animal-bow {
    animation: animal-bow 0.8s ease !important;
}

@keyframes animal-bow {
    0%, 100% { transform: rotate(0deg); }
    40% { transform: rotate(20deg) translateY(5px); }
    60% { transform: rotate(20deg) translateY(5px); }
}

/* Frog hop */
.animal-hop {
    animation: animal-hop 0.5s ease !important;
}

@keyframes animal-hop {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-25px); }
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 480px) {
    .greeting-card {
        padding: var(--space-5) var(--space-4);
    }

    h1 {
        font-size: var(--font-size-2xl);
    }

    .name-gen-box {
        min-width: 100%;
    }
}

/* ========================================
   REDUCED MOTION PREFERENCE
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    body,
    .greeting-card,
    h1,
    .sparkle,
    .dont-touch-btn,
    .clickable-emoji,
    .bouncing-emoji {
        animation: none;
    }

    .sparkle {
        opacity: 1;
        transform: scale(1);
    }

    .princess-shortcut.visible {
        animation: none;
    }

    .princess-shortcut.bounce,
    .princess-shortcut.giggle,
    .princess-shortcut.wave,
    .princess-shortcut.swirl,
    .princess-shortcut.hide-seek-hide,
    .princess-shortcut.hide-seek-show,
    .princess-sparkle,
    .princess-interaction-heart,
    .animal-bow,
    .animal-hop,
    .animal-tail-wag {
        animation: none !important;
    }

    .animal-move-toward {
        transition: none !important;
    }
}

/* ============================================
   UNDER CONSTRUCTION - DADVENTURE BUTTON
   ============================================ */

.construction-btn {
    background: linear-gradient(
        135deg,
        #f5e6c8 0%,
        #e8c896 40%,
        #d4a855 70%,
        #c8783a 100%
    );
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: var(--space-4);
    border: 3px dashed rgba(139, 90, 30, 0.5);
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 18px,
            rgba(139, 90, 30, 0.12) 18px,
            rgba(139, 90, 30, 0.12) 20px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 24px,
            rgba(139, 90, 30, 0.08) 24px,
            rgba(139, 90, 30, 0.08) 26px
        ),
        linear-gradient(135deg, #f5e6c8 0%, #e8c896 40%, #d4a855 70%, #c8783a 100%);
}

.construction-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(200, 120, 58, 0.35);
}

.construction-btn:active {
    transform: scale(0.98);
}

.construction-btn__scaffold {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    position: relative;
}

.construction-sign {
    font-size: 1.8rem;
    flex-shrink: 0;
    animation: wobble 2.5s ease-in-out infinite;
}

@keyframes wobble {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

.construction-btn__label {
    flex: 1;
    text-align: left;
}

.construction-btn__title {
    display: block;
    font-size: var(--font-size-lg, 1.2rem);
    font-weight: bold;
    color: #3d2b1f;
    font-family: inherit;
}

.construction-btn__sub {
    display: block;
    font-size: var(--font-size-sm, 0.75rem);
    color: rgba(61, 43, 31, 0.7);
    margin-top: 2px;
}

.construction-brick {
    font-size: 1.2rem;
    position: absolute;
    opacity: 0.6;
}

.construction-brick--1 {
    top: -8px;
    right: 8px;
    transform: rotate(15deg);
}

.construction-brick--2 {
    bottom: -6px;
    right: 30px;
    transform: rotate(-8deg);
}

.construction-brick--3 {
    top: -4px;
    right: 50px;
    transform: rotate(5deg);
    opacity: 0.4;
}

/* ============================================
   CONSTRUCTION WARNING MODAL
   ============================================ */

.construction-overlay {
    position: fixed;
    inset: 0;
    background: rgba(30, 20, 10, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: var(--space-5);
    animation: fadeIn 0.2s ease;
}

.construction-overlay[hidden] {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.construction-modal {
    background: #fffef9;
    border-radius: 24px;
    padding: 36px 28px 28px;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 24px 60px rgba(60, 40, 20, 0.4);
    text-align: center;
    animation: slideUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    border: 3px dashed rgba(200, 120, 58, 0.4);
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.construction-modal__icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.construction-modal__title {
    font-size: 1.6rem;
    font-weight: bold;
    color: #3d2b1f;
    margin: 0 0 12px;
}

.construction-modal__body {
    font-size: 0.95rem;
    color: #5a4030;
    line-height: 1.6;
    margin: 0 0 24px;
}

.construction-modal__buttons {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.construction-modal__btn {
    padding: 12px 20px;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: transform 0.15s, box-shadow 0.15s;
}

.construction-modal__btn:hover {
    transform: scale(1.03);
}

.construction-modal__btn:active {
    transform: scale(0.97);
}

.construction-modal__btn--cancel {
    background: rgba(200, 120, 58, 0.12);
    color: #7a5030;
    border: 2px solid rgba(200, 120, 58, 0.3);
}

.construction-modal__btn--confirm {
    background: linear-gradient(135deg, #e8a050, #c8783a);
    color: white;
    box-shadow: 0 4px 16px rgba(200, 120, 58, 0.4);
}
