/* ==========================================================================
   Base Styles & CSS Variables
   ========================================================================== */
:root {
    --primary-color: #1E3A8A;
    --primary-light: #3B82F6;
    --primary-dark: #1E40AF;
    --accent-color: #F59E0B;
    --accent-hover: #D97706;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --bg-main: #F8FAFC;
    --bg-white: #FFFFFF;
    --border-color: #E2E8F0;
    --font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --header-height: 60px;
    --transition: all 0.3s ease;
    --border-radius-sm: 8px;
    --border-radius-md: 16px;
    --border-radius-lg: 24px;
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: var(--font-family);
    color: var(--text-main);
    background-color: var(--bg-main);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Page Transition Animations */
.fade-in-page {
    animation: pageFadeIn 0.3s ease forwards;
}

.fade-out-left {
    animation: pageSlideOutLeft 0.25s ease forwards;
}

.fade-out-right {
    animation: pageSlideOutRight 0.25s ease forwards;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes pageSlideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(-30px);
    }
}

@keyframes pageSlideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(30px);
    }
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul {
    list-style: none;
}

/* Utilities */
h1,
h2,
h3,
h4,
h5,
h6 {
    line-height: 1.3;
    font-weight: 700;
}

.container {
    width: 100%;
    padding: 0 20px;
    margin: 0 auto;
    max-width: 1200px;
}

.section {
    padding: 90px 0 60px;
    flex: 1;
}

/* Offset for header */
.section-full {
    display: block;
    padding-top: 100px;
    padding-bottom: 100px;
    min-height: 100vh;
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-header h2 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    position: relative;
    display: inline-block;
}

.section-header h2::after {
    content: '';
    position: absolute;
    width: 50%;
    height: 4px;
    background-color: var(--accent-color);
    bottom: -10px;
    left: 25%;
    border-radius: 2px;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 20px;
}

.text-center {
    text-align: center;
}

.w-100 {
    width: 100%;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background-color: var(--accent-color);
    color: #fff;
    box-shadow: 0 4px 14px 0 rgba(245, 158, 11, 0.39);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid #fff;
    color: #fff;
}

.btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.btn-outline-dark {
    background-color: transparent;
    border: 2px solid var(--bg-white);
    color: var(--bg-white);
}

.btn-outline-dark:hover {
    background-color: var(--bg-white);
    color: var(--primary-color);
}

/* Header / Navigation */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

/* On Hero it starts transparent */
.hero-nav {
    background: rgba(30, 58, 138, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.hero-nav.scrolled {
    background: rgba(255, 255, 255, 0.95);
}

.hero-nav .logo-name,
.hero-nav .mobile-menu-btn {
    color: #fff;
}

.hero-nav.scrolled .logo-name,
.hero-nav.scrolled .mobile-menu-btn {
    color: var(--primary-color);
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.logo-name {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

.nav-links {
    display: none;
}

.mobile-menu-btn {
    display: block;
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1.5rem;
    cursor: pointer;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100vh;
    background-color: rgba(30, 58, 138, 0.98);
    z-index: 1001;
    transition: all 0.4s cubic-bezier(0.77, 0.2, 0.05, 1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.mobile-menu-overlay.active {
    left: 0;
}

.mobile-menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.close-menu-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
}

.menu-item {
    font-size: 1.8rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    margin: 15px 0;
    transition: all 0.3s ease;
}

.menu-item.active {
    color: #fff;
    border-bottom: 2px solid var(--accent-color);
}

/* Swipe Indicator Helper */
.swipe-hint {
    position: fixed;
    bottom: 80px;
    left: 0;
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    z-index: 10;
    pointer-events: none;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.8;
    }

    100% {
        opacity: 0.3;
    }
}

.swipe-hint-dark {
    color: var(--text-muted);
}

/* Hero Section */
.hero {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding-bottom: 60px;
    margin-top: -60px;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(30, 58, 138, 0.9) 0%, rgba(30, 58, 138, 0.4) 50%, rgba(0, 0, 0, 0.1) 100%);
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: #fff;
    padding: 0 20px;
    margin-top: 180px;
}

.slogan-badge {
    display: inline-block;
    background-color: var(--accent-color);
    color: #fff;
    padding: 6px 16px;
    border-radius: 50px;
    font-weight: 700;
    margin-bottom: 20px;
}

.main-slogan {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 15px;
}

.main-slogan .highlight {
    color: var(--accent-color);
}

/* Profile, Pledges, Contact (Reused from previous) */
.profile-card {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    box-shadow: var(--box-shadow);
    margin-bottom: 30px;
}

.greeting {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary-color);
    font-style: italic;
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.timeline {
    position: relative;
    padding-left: 20px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 2px;
    background-color: var(--primary-light);
    opacity: 0.3;
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
}

.timeline-dot {
    position: absolute;
    left: -25px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--primary-color);
    border: 2px solid #fff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.timeline-date {
    color: var(--accent-color);
    font-weight: 700;
}

.timeline-content h3 {
    font-size: 1.1rem;
}

.pledge-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.pledge-card {
    background: var(--bg-white);
    border-radius: var(--border-radius-md);
    padding: 30px 20px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.pledge-icon {
    width: 60px;
    height: 60px;
    background-color: rgba(30, 58, 138, 0.1);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 20px;
}

.contact {
    background-color: var(--primary-color);
    color: #fff;
    min-height: 100vh;
    padding-top: 100px;
    display: flex;
    flex-direction: column;
}

.contact .section-header h2 {
    color: #fff;
}

.action-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px 20px;
    border-radius: var(--border-radius-md);
    text-align: center;
    margin-bottom: 20px;
}

.card-icon {
    font-size: 2.5rem;
    color: var(--accent-color);
    margin-bottom: 15px;
}

/* Gallery Specific & Upload Functionality */
.gallery-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.gallery-count {
    color: var(--text-muted);
    font-weight: 600;
}

.btn-upload {
    background-color: var(--primary-light);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--box-shadow);
}

.btn-upload:hover {
    background-color: var(--primary-color);
}

.gallery-grid-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

.gallery-img-container {
    position: relative;
    width: 100%;
    padding-top: 75%;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    background: #e2e8f0;
}

.gallery-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px 15px 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: #fff;
    font-weight: 600;
}

.delete-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(220, 38, 38, 0.95); /* 좀 더 진한 빨간색으로 가시성 강화 */
    color: white;
    border: 2px solid white; /* 잘 보이도록 흰색 테두리 추가 */
    width: 42px; /* 모바일 터치 편의성을 위해 크기 확대 */
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3); /* 그림자 추가 */
}

.delete-btn:hover {
    background: rgba(220, 38, 38, 1);
    transform: scale(1.15); /* 호버 액션 강화 */
}

.edit-btn {
    position: absolute;
    top: 12px;
    right: 60px; /* 휴지통 좌측에 배치 */
    background: rgba(37, 99, 235, 0.95); /* 파란색 */
    color: white;
    border: 2px solid white;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.edit-btn:hover {
    background: rgba(37, 99, 235, 1);
    transform: scale(1.15);
}

/* Footer Wrapper for flex bottom */
.footer {
    background-color: #0F172A;
    color: #94A3B8;
    padding: 30px 0 20px;
    text-align: center;
    margin-top: auto;
}

/* Animations & Utilities */
.fade-up {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.ripple {
    position: relative;
    overflow: hidden;
}

.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(30, 58, 138, 0.1);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(65px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    gap: 20px;
    align-items: center;
    z-index: 9999;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    width: 65px;
    min-width: 60px;
    transition: var(--transition);
    text-decoration: none;
    padding: 5px 0;
}

.bottom-nav-item i {
    font-size: 1.2rem;
    margin-bottom: 4px;
    transition: transform 0.2s;
}

.bottom-nav-item.active {
    color: var(--primary-color);
}

.bottom-nav-item.active i {
    transform: scale(1.1);
    color: var(--accent-color);
}

body {
    padding-bottom: 65px;
}

/* Prevent content hiding behind bottom nav */
.swipe-hint {
    bottom: 85px;
}

/* Adjust swipe hint */

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.lightbox-overlay.show .lightbox-img {
    transform: scale(1);
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.page-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    color: var(--text-muted);
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.page-btn:hover {
    background: var(--bg-main);
    color: var(--primary-color);
}

.page-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Welcome Popup Carousel */
.welcome-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.welcome-popup.show {
    opacity: 1;
    pointer-events: auto;
}

.welcome-popup .popup-content {
    background: transparent;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    padding: 0;
    position: relative;
    box-shadow: none;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.welcome-popup.show .popup-content {
    transform: translateY(0);
}

.popup-close-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.7);
    border: 2px solid white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.carousel {
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: relative;
    background-color: transparent;
    touch-action: pan-y;
    display: flex;
    align-items: center;
}

.carousel-track {
    display: flex;
    transition: transform 0.3s ease-in-out;
    height: 100%;
}

.carousel-slide {
    width: 100vw;
    height: 100%;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 이미지를 감싸는 이너 래퍼 (닫기 버튼의 기준점) */
.carousel-slide-inner {
    position: relative;
    display: inline-block;
}

.carousel-slide img {
    height: auto;
    width: auto;
    max-width: 95vw;
    max-height: 85vh; /* 화면비율 유지하면서 꽉 차게 제한 */
    object-fit: contain; 
    display: block;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}

.carousel-caption {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.9rem;
    padding: 5px 10px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Desktop Navigation */
@media (min-width: 768px) {
    /* 하단 버튼 화면크기에 상관없이 항상 표시되도록 숨김(display: none) 부분 제거 */

    .mobile-menu-btn {
        display: none;
    }

    .nav-links {
        display: flex;
        align-items: center;
        gap: 25px;
    }

    .nav-links a {
        font-weight: 600;
        color: var(--text-muted);
        transition: var(--transition);
        border-bottom: 2px solid transparent;
        padding-bottom: 5px;
    }

    .nav-links a:hover,
    .nav-links a.active {
        color: var(--primary-color);
        border-bottom-color: var(--primary-color);
    }

    .hero-nav .nav-links a {
        color: rgba(255, 255, 255, 0.8);
    }

    .hero-nav.scrolled .nav-links a {
        color: var(--text-muted);
    }

    .hero-nav .nav-links a:hover,
    .hero-nav.scrolled .nav-links a.active {
        color: var(--primary-color);
    }

    .hero-nav .nav-links a.active {
        color: #fff;
        border-bottom-color: #fff;
    }

    .hero-nav.scrolled .nav-links a.active {
        color: var(--primary-color);
        border-bottom-color: var(--primary-color);
    }

    .gallery-grid-layout {
        grid-template-columns: repeat(2, 1fr);
    }

    .pledge-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .contact .action-cards {
        display: flex;
        gap: 30px;
    }

    .contact .action-card {
        flex: 1;
    }

    .swipe-hint {
        display: none;
    }

    /* hide swipe hint on desktop */
}