/* 기본 설정 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@import url('https://fonts.googleapis.com/css2?family=Gowun+Batang:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Nanum+Barun+Gothic:wght@400;700&display=swap');

@font-face {
    font-family: 'MaruBuri';
    src: url('./font/MaruBuri-Regular.ttf') format('truetype');
    font-weight: 400;
}

@font-face {
    font-family: 'MaruBuri';
    src: url('./font/MaruBuri-Bold.ttf') format('truetype');
    font-weight: 700;
}

body {
    font-family: 'Nanum Barun Gothic', 'MaruBuri', sans-serif;
    line-height: 1.6;
    color: rgb(95, 88, 89);
    background: #ffffff;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    touch-action: pan-x pan-y;
}

html {
    margin: 0;
    padding: 0;
    touch-action: pan-x pan-y;
}

.container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 이미지 확대 및 저장 방지 */
img {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
    pointer-events: none;
}

/* 클릭 가능한 이미지는 포인터 이벤트 허용 */
img[onclick] {
    pointer-events: auto;
}

/* 커스텀 메시지 스타일 */
#invitation-message-section .custom-message {
    font-size: 15px;
    line-height: 1.8;
    color: rgb(95, 88, 89);
}

#invitation-message-section .custom-message p {
    margin-bottom: 1em;
}

#invitation-message-section .custom-message h1,
#invitation-message-section .custom-message h2,
#invitation-message-section .custom-message h3 {
    color: rgb(95, 88, 89);
    margin: 1em 0 0.5em 0;
}

#invitation-message-section .custom-message a {
    color: #cb8c8c;
    text-decoration: underline;
}

#invitation-message-section .custom-message strong {
    font-weight: 700;
}

#invitation-message-section .custom-message em {
    font-style: italic;
}

#invitation-message-section .custom-message ul,
#invitation-message-section .custom-message ol {
    padding-left: 20px;
    margin: 0.5em 0;
}

/* 모바일 사파리 강제 전체 너비 */
@supports (-webkit-touch-callout: none) {
    body {
        display: block !important;
        background: #ffffff !important;
    }

    .container {
        max-width: 100% !important;
        width: 100% !important;
        box-shadow: none !important;
    }
}

/* PC에서 최대 너비 제한 */
@media (min-width: 769px) and (hover: hover) and (pointer: fine) {
    /* 사파리가 아닌 경우만 적용 */
    @supports not (-webkit-touch-callout: none) {
        body {
            display: flex;
            justify-content: center;
            background: #f5f5f5;
        }

        .container {
            max-width: 480px !important;
            background: #ffffff;
            box-shadow: 0 0 20px rgba(0,0,0,0.1);
            margin: 0;
        }
    }
}

/* PC 사파리만 적용 (터치 불가능한 큰 화면) */
@supports (-webkit-touch-callout: none) {
    @media (min-width: 1200px) and (hover: hover) {
        body {
            display: flex !important;
            justify-content: center !important;
            background: #f5f5f5 !important;
        }

        .container {
            max-width: 480px !important;
            background: #ffffff !important;
            box-shadow: 0 0 20px rgba(0,0,0,0.1) !important;
            margin: 0 !important;
        }
    }
}

/* 헤더 스타일 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="2" fill="white" opacity="0.1"/></svg>') repeat;
    animation: float 20s infinite linear;
}

@keyframes float {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-100px); }
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 300;
    letter-spacing: 2px;
}

.date-info {
    font-size: 1.1em;
    margin: 20px 0;
    font-weight: 300;
}

.venue {
    font-size: 0.95em;
    opacity: 0.9;
    line-height: 1.8;
}

/* 갤러리 뷰페이저 스타일 */
.gallery-viewpager-container {
    width: 100%;
    position: relative;
    padding: 20px 0 50px 0;
    overflow: hidden;
}

/* 갤러리 화살표 버튼 */
.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(203, 140, 140, 0.3);
    border-radius: 50%;
    color: #cb8c8c;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.gallery-arrow:hover {
    background: rgba(203, 140, 140, 0.1);
    border-color: #cb8c8c;
}

.gallery-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.gallery-arrow-left {
    left: 10%;
}

.gallery-arrow-right {
    right: 10%;
}

.gallery-viewpager {
    display: flex;
    position: relative;
    align-items: center;
    width: 100%;
}

.gallery-page {
    flex-shrink: 0;
    width: 20% !important;
    box-sizing: border-box;
    padding: 0 8px;
}

/* 활성 페이지: 60% */
.gallery-page.active {
    width: 60% !important;
    padding: 0 12px;
}

/* 빈 공간도 20% 유지 */
.gallery-page-empty {
    width: 20% !important;
    padding: 0;
}

.gallery-page-inner {
    width: 100%;
    aspect-ratio: 4/5;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0.6;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gallery-page.active .gallery-page-inner {
    opacity: 1;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    animation: galleryFadeIn 0.4s ease-in-out;
}

@keyframes galleryFadeIn {
    from {
        opacity: 0.6;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.gallery-page img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-page.active img {
    cursor: pointer;
    pointer-events: auto;
}

.gallery-page:not(.active) img {
    cursor: default;
    pointer-events: none;
}

/* 프로그레스바 인디케이터 */
.gallery-indicators {
    width: 80%;
    max-width: 300px;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    margin: 30px auto 0;
    position: relative;
    overflow: hidden;
}

.gallery-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #cb8c8c, #e4a9a9);
    border-radius: 2px;
    transition: width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
}

.gallery-progress-bar::after {
    content: '';
    position: absolute;
    right: 0;
    top: -4px;
    width: 12px;
    height: 12px;
    background: #cb8c8c;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(203, 140, 140, 0.4);
}

/* 지도 스타일 */
.map-container {
    background: #f8f8f8;
    padding: 15px;
    margin: 20px 0;
    border-radius: 8px;
    text-align: center;
}

.map-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    margin-bottom: 10px;
    border-radius: 6px;
}

.transport-info {
    background: #f5f5f5;
    padding: 15px;
    margin: 15px 0;
    border-radius: 8px;
}

.transport-info h4 {
    color: #764ba2;
    margin-bottom: 10px;
}

.transport-info ul {
    list-style: none;
    line-height: 1.6;
}

.transport-info li {
    padding: 3px 0;
}

/* 계좌 정보 스타일 */
.account-info {
    background: #fff8e1;
    padding: 15px;
    margin: 15px 0;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
}

.account-item {
    margin-bottom: 15px;
}

.account-item:last-child {
    margin-bottom: 0;
}

.account-item h4 {
    color: #764ba2;
    margin-bottom: 5px;
}

.copy-btn {
    background: #764ba2;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    cursor: pointer;
    margin-left: 10px;
}

.copy-btn:hover {
    background: #5e3a85;
}

/* 방명록 스타일 */
.guestbook {
    margin-top: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #666;
    font-weight: bold;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.form-group textarea {
    height: 80px;
    resize: vertical;
}

.submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(118, 75, 162, 0.3);
}

.attendance-options {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.attendance-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #764ba2;
    background: white;
    color: #764ba2;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.attendance-btn.selected {
    background: #764ba2;
    color: white;
}

.messages-list {
    margin-top: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.message-item {
    padding: 20px 0;
    border-bottom: 1px solid #f0f0f0;
}

.message-item:last-child {
    border-bottom: none;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.message-name {
    font-family: 'Nanum Barun Gothic', sans-serif;
    font-weight: 600;
    color: #cb8c8c;
    font-size: 14px;
}

.message-date {
    font-family: 'Nanum Barun Gothic', sans-serif;
    font-size: 12px;
    color: #999;
}

.message-text {
    font-family: 'Nanum Barun Gothic', sans-serif;
    color: rgb(95, 88, 89);
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
}

.attendance-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    margin-left: 10px;
}

.attendance-yes {
    background: #e8f5e8;
    color: #4caf50;
}

.attendance-no {
    background: #ffebee;
    color: #f44336;
}

/* 스크롤 애니메이션 */
.fade-in-section {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.fade-in-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 애니메이션 지연 효과 */
.fade-in-section:nth-child(1) { transition-delay: 0s; }
.fade-in-section:nth-child(2) { transition-delay: 0.1s; }
.fade-in-section:nth-child(3) { transition-delay: 0.2s; }
.fade-in-section:nth-child(4) { transition-delay: 0.3s; }
.fade-in-section:nth-child(5) { transition-delay: 0.4s; }

/* 눈 내리는 효과 */
.snowfall {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    top: -10px;
    color: #ffffff !important;
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.8), 0 0 6px rgba(255, 255, 255, 0.6);
    user-select: none;
    pointer-events: none;
    animation-name: snowfall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    -webkit-text-fill-color: #ffffff !important;
    filter: brightness(0) invert(1);
}

@keyframes snowfall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0.3;
    }
}

/* 다양한 눈송이 크기와 속도 */
.snowflake:nth-child(1) { left: 3%; animation-duration: 6s; font-size: 8px; animation-delay: 0s; }
.snowflake:nth-child(2) { left: 8%; animation-duration: 8s; font-size: 10px; animation-delay: -1s; }
.snowflake:nth-child(3) { left: 13%; animation-duration: 7s; font-size: 7px; animation-delay: -2s; }
.snowflake:nth-child(4) { left: 18%; animation-duration: 9s; font-size: 12px; animation-delay: -0.5s; }
.snowflake:nth-child(5) { left: 23%; animation-duration: 5s; font-size: 9px; animation-delay: -3s; }
.snowflake:nth-child(6) { left: 28%; animation-duration: 10s; font-size: 11px; animation-delay: -1.5s; }
.snowflake:nth-child(7) { left: 33%; animation-duration: 6s; font-size: 8px; animation-delay: -4s; }
.snowflake:nth-child(8) { left: 38%; animation-duration: 8s; font-size: 10px; animation-delay: -2.5s; }
.snowflake:nth-child(9) { left: 43%; animation-duration: 7s; font-size: 9px; animation-delay: -5s; }
.snowflake:nth-child(10) { left: 48%; animation-duration: 9s; font-size: 7px; animation-delay: -0.8s; }
.snowflake:nth-child(11) { left: 53%; animation-duration: 6s; font-size: 12px; animation-delay: -3.5s; }
.snowflake:nth-child(12) { left: 58%; animation-duration: 8s; font-size: 8px; animation-delay: -1.2s; }
.snowflake:nth-child(13) { left: 63%; animation-duration: 7s; font-size: 11px; animation-delay: -4.5s; }
.snowflake:nth-child(14) { left: 68%; animation-duration: 10s; font-size: 9px; animation-delay: -2.8s; }
.snowflake:nth-child(15) { left: 73%; animation-duration: 5s; font-size: 10px; animation-delay: -6s; }
.snowflake:nth-child(16) { left: 78%; animation-duration: 9s; font-size: 8px; animation-delay: -1.8s; }
.snowflake:nth-child(17) { left: 83%; animation-duration: 6s; font-size: 7px; animation-delay: -3.8s; }
.snowflake:nth-child(18) { left: 88%; animation-duration: 8s; font-size: 12px; animation-delay: -0.3s; }
.snowflake:nth-child(19) { left: 93%; animation-duration: 7s; font-size: 9px; animation-delay: -5.5s; }
.snowflake:nth-child(20) { left: 98%; animation-duration: 9s; font-size: 11px; animation-delay: -2.3s; }
.snowflake:nth-child(21) { left: 6%; animation-duration: 8s; font-size: 8px; animation-delay: -4.8s; }
.snowflake:nth-child(22) { left: 16%; animation-duration: 6s; font-size: 10px; animation-delay: -1.7s; }
.snowflake:nth-child(23) { left: 26%; animation-duration: 7s; font-size: 9px; animation-delay: -3.2s; }
.snowflake:nth-child(24) { left: 36%; animation-duration: 9s; font-size: 7px; animation-delay: -5.8s; }
.snowflake:nth-child(25) { left: 46%; animation-duration: 5s; font-size: 12px; animation-delay: -0.7s; }
.snowflake:nth-child(26) { left: 56%; animation-duration: 8s; font-size: 8px; animation-delay: -4.2s; }
.snowflake:nth-child(27) { left: 66%; animation-duration: 7s; font-size: 11px; animation-delay: -2.1s; }
.snowflake:nth-child(28) { left: 76%; animation-duration: 6s; font-size: 9px; animation-delay: -6.5s; }
.snowflake:nth-child(29) { left: 86%; animation-duration: 9s; font-size: 10px; animation-delay: -1.4s; }
.snowflake:nth-child(30) { left: 96%; animation-duration: 8s; font-size: 8px; animation-delay: -3.7s; }

/* 지도 연결 버튼 스타일 */
.map-buttons-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px 20px;
    margin: 0px 0;
}

.map-button {
    flex: 1;
    max-width: 100px;
    background: transparent;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 10px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-size: 12px;
    color: #666;
}

.map-button:hover {
    border-color: #764ba2;
    color: #764ba2;
}

.map-button:active {
    background-color: rgba(118, 75, 162, 0.1);
}

.map-button-icon {
    width: 24px;
    height: 24px;
    margin: 0 auto 5px;
    border-radius: 4px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.tmap-icon {
    background-color: transparent;
    background-image: url('tmap_logo.png');
}

.naver-icon {
    background-color: #03C75A;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C8.1 2 5 5.1 5 9c0 5.2 7 13 7 13s7-7.8 7-13c0-3.9-3.1-7-7-7zm0 9.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5z'/%3E%3C/svg%3E");
}

.kakao-icon {
    background-color: #FEE500;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C8.1 2 5 5.1 5 9c0 5.2 7 13 7 13s7-7.8 7-13c0-3.9-3.1-7-7-7zm0 9.5c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5z'/%3E%3C/svg%3E");
}

.map-button-text {
    font-weight: 500;
    font-size: 11px;
}

/* 갤러리 팝업 스타일 */
.gallery-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.9);
}

.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.popup-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 10001;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.popup-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.popup-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
    z-index: 10001;
}

.popup-nav:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.popup-nav.prev {
    left: 20px;
}

.popup-nav.next {
    right: 20px;
}

.popup-image-container {
    position: relative;
    width: 90%;
    height: 80%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#popup-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, opacity 0.3s ease;
    position: absolute;
}

.slide-left {
    transform: translateX(-100%);
    opacity: 0;
}

.slide-right {
    transform: translateX(100%);
    opacity: 0;
}

.slide-center {
    transform: translateX(0);
    opacity: 1;
}

.popup-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 500;
}

/* 모바일 대응 추가 */
@media (max-width: 768px) {
    .map-buttons-container {
        padding: 15px 10px;
        gap: 8px;
    }

    .map-button {
        padding: 10px 6px;
        font-size: 11px;
    }

    .map-button-icon {
        width: 20px;
        height: 20px;
        margin-bottom: 3px;
    }

    .map-button-text {
        font-size: 10px;
    }

    .popup-nav {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }

    .popup-nav.prev {
        left: 10px;
    }

    .popup-nav.next {
        right: 10px;
    }

    .popup-close {
        top: 10px;
        right: 10px;
        font-size: 30px;
        width: 40px;
        height: 40px;
    }

    .popup-image-container {
        width: 95%;
        height: 75%;
    }

    #popup-image {
        max-width: 100%;
        max-height: 100%;
    }

    .popup-counter {
        bottom: 10px;
        padding: 8px 16px;
        font-size: 14px;
    }
}