/* =============================================
   대동여지도 탐구 - Main Page Styles
   ============================================= */

/* Main Page Layout */
.main-page {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Canvas Container with gradient background */
.canvas-container {
    position: absolute;
    inset: 0;
    z-index: 1;
    /* Radial gradient - bright center, dark edges */
    background: radial-gradient(
        ellipse 80% 70% at 50% 45%,
        #f5ead6 0%,
        #e8dcc8 30%,
        #d4c4a8 60%,
        #b8a888 85%,
        #9a8870 100%
    );
}

/* Vignette + Gold Border Frame */
.canvas-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse 100% 100% at 50% 50%,
        transparent 40%,
        rgba(92, 64, 51, 0.15) 80%,
        rgba(60, 40, 30, 0.3) 100%
    );
    pointer-events: none;
    z-index: 2;
}

#main-map-image {
    width: 100%;
    height: 100%;
    display: block;
    position: relative;
    z-index: 1;
    object-fit: contain;
    object-position: center;
    background-color: #e5d9c4;
}

/* Title Overlay */
.title-overlay {
    position: absolute;
    top: 44%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    pointer-events: none;
    padding: var(--spacing-md);
    width: 100%;
    max-width: 400px;
}

.main-title {
    font-size: 2rem;
    font-family: var(--font-primary);
    font-weight: 900;
    color: var(--color-text);
    -webkit-text-stroke: 5px #fff;
    paint-order: stroke fill;
    text-shadow: 0 2px 4px rgba(60, 29, 8, 0.3);
    margin-bottom: var(--spacing-sm);
}

.main-subtitle {
    font-size: 1rem;
    font-family: var(--font-primary);
    font-weight: 700;
    color: var(--color-text-light);
    text-shadow: 0 1px 5px rgba(255, 255, 255, 0.6);
}

/* Bottom UI */
.bottom-ui {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-md);
    padding-bottom: calc(var(--spacing-md) + var(--safe-area-bottom));
    background: none;
}


/* Start Button - pill 스타일 */
.start-btn {
    display: inline-block;
    margin-top: 0;
    margin-bottom: var(--spacing-md);
    width: auto;
    padding: 14px 36px;
    background: #3c1d08;
    color: #FFFFFF;
    font-family: var(--font-primary);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 999px;
    box-shadow:
        0 0 8px rgba(201, 162, 39, 0.3),
        0 4px 12px rgba(74, 55, 40, 0.4),
        0 8px 24px rgba(44, 24, 16, 0.2);
    transition: all var(--transition-fast);
    perspective: 800px;
    animation: btnGlow 2.5s ease-in-out infinite,
               btnBreathe 6s ease-in-out infinite;
}

/* 1-A. 금색 쉬머 스윕 */
.start-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(
        105deg,
        transparent 35%,
        rgba(232, 212, 138, 0.35) 45%,
        rgba(201, 162, 39, 0.25) 50%,
        rgba(232, 212, 138, 0.35) 55%,
        transparent 65%
    );
    transform: translateX(-120%);
    animation: shimmerSweep 3.5s ease-in-out 3s infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes shimmerSweep {
    0%, 100% { transform: translateX(-120%); }
    40%, 60% { transform: translateX(120%); }
}

/* 1-B. 향상된 오비팅 스포트라이트 글로우 (4단계) */
@keyframes btnGlow {
    0% {
        box-shadow:
            0 0 8px rgba(201, 162, 39, 0.3),
            0 4px 12px rgba(74, 55, 40, 0.4),
            0 8px 24px rgba(44, 24, 16, 0.2),
            4px -2px 16px 2px rgba(232, 212, 138, 0.35);
    }
    25% {
        box-shadow:
            0 0 14px 2px rgba(201, 162, 39, 0.45),
            0 4px 14px rgba(74, 55, 40, 0.45),
            0 8px 24px rgba(44, 24, 16, 0.22),
            2px 4px 18px 3px rgba(232, 212, 138, 0.4);
    }
    50% {
        box-shadow:
            0 0 20px 4px rgba(201, 162, 39, 0.5),
            0 4px 16px rgba(74, 55, 40, 0.5),
            0 8px 24px rgba(44, 24, 16, 0.25),
            -4px 2px 16px 2px rgba(232, 212, 138, 0.35);
    }
    75% {
        box-shadow:
            0 0 14px 2px rgba(201, 162, 39, 0.45),
            0 4px 14px rgba(74, 55, 40, 0.45),
            0 8px 24px rgba(44, 24, 16, 0.22),
            -2px -4px 18px 3px rgba(232, 212, 138, 0.4);
    }
    100% {
        box-shadow:
            0 0 8px rgba(201, 162, 39, 0.3),
            0 4px 12px rgba(74, 55, 40, 0.4),
            0 8px 24px rgba(44, 24, 16, 0.2),
            4px -2px 16px 2px rgba(232, 212, 138, 0.35);
    }
}

/* 1-C. 3D 브리딩 (부유 효과) */
@keyframes btnBreathe {
    0%, 100% {
        transform: translateY(0) rotateX(0deg) rotateY(0deg);
    }
    25% {
        transform: translateY(-3px) rotateX(1.5deg) rotateY(-0.5deg);
    }
    50% {
        transform: translateY(-5px) rotateX(0deg) rotateY(0.5deg);
    }
    75% {
        transform: translateY(-3px) rotateX(-1.5deg) rotateY(0deg);
    }
}


.start-btn:hover,
.start-btn:focus {
    background: #2e1506;
    transform: translateY(-1px);
    box-shadow:
        0 0 16px rgba(201, 162, 39, 0.45),
        0 6px 16px rgba(74, 55, 40, 0.45),
        0 10px 28px rgba(44, 24, 16, 0.2);
    color: #FFFFFF;
}

.start-btn:active {
    transform: translateY(1px) scale(0.97);
    box-shadow:
        0 0 6px rgba(201, 162, 39, 0.4),
        0 2px 6px rgba(74, 55, 40, 0.4);
    transition: all 0.08s ease;
}

/* 2. 클릭 트랜지션 효과 */
#page-transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
}

.golden-burst {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.3) 0%,
        rgba(232, 212, 138, 0.15) 30%,
        rgba(201, 162, 39, 0.05) 60%,
        transparent 70%
    );
    transform: scale(0);
    animation: burstExpand 0.7s ease-out forwards;
    pointer-events: none;
}

@keyframes burstExpand {
    0% { transform: scale(0); opacity: 1; }
    60% { opacity: 0.8; }
    100% { transform: scale(1); opacity: 0; }
}

.golden-flash {
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at var(--cx, 50%) var(--cy, 50%),
        rgba(255, 255, 255, 0.2) 0%,
        transparent 50%
    );
    opacity: 0;
    animation: flashPulse 0.5s ease-out 0.1s forwards;
    pointer-events: none;
}

@keyframes flashPulse {
    0% { opacity: 0; }
    30% { opacity: 0.6; }
    100% { opacity: 0; }
}

.sparkle-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold-light, #E8D48A);
    box-shadow: 0 0 6px 2px rgba(232, 212, 138, 0.6);
    transform: translate(0, 0) scale(1);
    animation: sparkleFly 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes sparkleFly {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}

/* 2-D. 쇼크웨이브 링 */
.shockwave-ring {
    position: absolute;
    border-radius: 50%;
    border: 3px solid var(--gold-primary, #C9A227);
    background: transparent;
    pointer-events: none;
    transform: scale(0);
    animation: shockwaveExpand 0.5s ease-out forwards;
}

@keyframes shockwaveExpand {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

/* 2-E. 버튼 히트 플래시 */
.btn-hit-flash {
    background: #fff !important;
    color: #fff !important;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.8) !important;
    transition: background 0.15s ease, box-shadow 0.15s ease !important;
}

/* 2-F. 페이지 줌스루 */
.main-page.transitioning {
    transition: transform 0.7s ease-in, filter 0.7s ease-in, opacity 0.5s ease-in 0.2s;
    transform: scale(1.15);
    filter: brightness(1.5);
    opacity: 0;
}

/* Loading Screen Override for Main */
.main-page .loading-screen {
    background: linear-gradient(135deg, var(--color-background) 0%, var(--color-secondary) 100%);
}

/* Touch Prompt (when canvas is interactive) */
.touch-prompt-overlay {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    text-align: center;
    pointer-events: none;
}

.touch-prompt-text {
    font-size: 0.875rem;
    color: var(--color-text-light);
    opacity: 0.8;
}

.touch-prompt-icon {
    width: 40px;
    height: 40px;
    margin: var(--spacing-sm) auto 0;
    animation: touchPrompt 1.5s ease-in-out infinite;
}

/* Header override for main page - transparent */
.main-page .header {
    background-color: transparent;
}

/* Responsive */
@media (min-width: 768px) {
    .main-title {
        font-size: 2.5rem;
    }

    .main-subtitle {
        font-size: 1.125rem;
    }

    .start-btn {
        max-width: 320px;
    }
}

/* Landscape mode adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .main-title {
        font-size: 1.5rem;
    }

    .main-subtitle {
        font-size: 0.875rem;
    }

    .bottom-ui {
        padding: var(--spacing-sm);
    }
}
