/* ========================================
   KOICA ODA 타임라인 - Redesign
   와이어프레임 목업 스타일
   
   NOTE: Tailwind CDN 모드에서는 @apply가 동작하지 않으므로
   모든 스타일을 일반 CSS로 작성합니다.
   레이아웃/유틸리티는 HTML 내 Tailwind 클래스로 처리합니다.
======================================== */

/* ========================================
   와이어프레임 기본 컴포넌트
======================================== */
.wireframe-border {
    border-width: 2px;
    border-style: dashed;
    border-color: #9ca3af; /* gray-400 */
}

.wireframe-card {
    background-color: #fff;
    border-width: 2px;
    border-style: dashed;
    border-color: #d1d5db; /* gray-300 */
    border-radius: 0.5rem;
    transition: all 0.3s;
}
.wireframe-card:hover {
    border-color: #6b7280; /* gray-500 */
    box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
}

/* ========================================
   타임라인 레이아웃 컴포넌트 (업데이트됨)
======================================== */
.timeline-event-row {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 3rem 1.5rem;
    align-items: center;
    position: relative;
    z-index: 20;
    scroll-margin-top: 100px;
}

@media (min-width: 768px) {
    .timeline-event-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
        padding: 3rem;
    }
}

/* Timeline events content column - vertical spacing between events */
.timeline-events-content {
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

/* New Section Events Wrapper */
.timeline-section-grid {
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .timeline-section-grid {
        display: grid;
        grid-template-columns: 2fr 10fr;
        /* NO gap - scale col handles its own spacing */
        position: relative;
    }
}

/* Sticky Scale Column */
.timeline-sticky-scale {
    display: none;
}

@media (min-width: 768px) {
    .timeline-sticky-scale {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        justify-content: center;
        position: sticky;
        top: 100px;
        height: calc(100vh - 100px);
        padding-right: 1rem;
        z-index: 20;
    }
}

.scale-date-list {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    position: relative;
    transition: transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: transform;
}

.scale-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 0.3;
    cursor: default;
}

.scale-item.active {
    opacity: 1;
}

.scale-item-dot {
    width: 8px;
    height: 8px;
    border-radius: 9999px;
    background-color: #d1d5db;
    flex-shrink: 0;
    transition: background-color 0.4s ease, transform 0.4s ease, box-shadow 0.4s ease;
    order: 2;
}

.scale-item.active .scale-item-dot {
    background-color: #000;
    transform: scale(1.5);
    box-shadow: 0 0 0 3px white, 0 0 0 5px rgba(0,0,0,0.08);
}

.scale-item-label {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    text-align: right;
    transition: color 0.4s ease;
    order: 1;
}

.scale-item-year {
    font-size: 0.875rem;
    font-weight: 500;
    color: #9ca3af;
    transition: all 0.4s ease;
}

.scale-item.active .scale-item-year {
    font-size: 2rem;
    font-weight: 900;
    color: #000;
    line-height: 1;
}

.scale-item-month {
    font-size: 0.75rem;
    font-weight: 500;
    color: #9ca3af;
    transition: all 0.4s ease;
}

.scale-item.active .scale-item-month {
    font-size: 1rem;
    font-weight: 700;
    color: #4b5563;
}

/* Dashed vertical line in sticky scale */
.timeline-sticky-scale .scale-line {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 7px;
    width: 2px;
    border-right: 2px dashed #d1d5db;
    z-index: -1;
}

.timeline-content-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* 단독 이벤트 좌측 콘텐츠: sticky 고정, 뷰포트 수직 중앙 */
@media (min-width: 768px) {
    .timeline-content-col {
        position: sticky;
        top: 50vh;
        transform: translateY(-50%);
        align-self: start;
    }
}

.timeline-media-col {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    justify-content: center;
}

@media (min-width: 768px) {
    .timeline-media-col {
        /* no specific grid column needed */
    }
}

/* ========================================
   커스텀 유틸리티
======================================== */

/* 스크롤바 숨기기 */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* 텍스트 줄임 */
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 뷰어 모달 애니메이션 */
#viewer-modal.active {
    opacity: 1;
    pointer-events: auto;
}
#viewer-modal.active #viewer-container {
    transform: scale(1);
}

/* 타임라인 점선 연결선 (가상 요소로 구현) */
.timeline-connector {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 20px;
    width: 2px;
    background-image: linear-gradient(to bottom, transparent 50%, #ccc 50%);
    background-size: 2px 10px;
    z-index: -1;
}

@media (max-width: 768px) {
    .timeline-connector {
        right: auto;
        left: 20px;
    }
}

/* ========================================
   배경 지도 애니메이션 효과
======================================== */
#section-1,
#section-2,
#section-3,
#section-4,
#outro {
    overflow: clip;
}

.fixed-bg-layer {
    position: sticky !important;
    top: 0;
    height: 100vh !important;
    width: 100%;
    margin-bottom: -100vh;
}
.fixed-bg-layer svg {
    transition: opacity 1s ease;
}

.fixed-bg-layer .scroll-zoom-map {
    will-change: transform;
}


/* ========================================
   레코드 아이템 스타일
======================================== */
.record-card {
    position: relative;
    overflow: hidden;
    background-color: #f9fafb;
    cursor: pointer;
    width: 100%;
    max-width: 520px;
}

.record-card-inner {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    border-width: 2px;
    border-style: dashed;
    border-color: #d1d5db;
    overflow: hidden;
    transition: all 0.3s;
}

.record-card:hover .record-card-inner {
    border-style: solid;
    border-color: #1f2937;
}

.record-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
    transition: transform 0.3s;
}

.record-card:hover .record-thumbnail {
    transform: scale(1.03);
}

.record-title {
    padding: 0.5rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #374151;
    line-height: 1.4;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.record-icon {
    opacity: 0.3;
    transition: all 0.3s;
}

.record-card:hover .record-icon {
    opacity: 1;
    transform: scale(1.1);
}

.record-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-top-width: 1px;
    border-top-style: dashed;
    border-top-color: #d1d5db;
    padding: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    transform: translateY(100%);
    transition: transform 0.3s;
}

.record-card:hover .record-caption {
    transform: translateY(0);
}

/* ========================================
   서브이벤트 그룹 (같은 No. 그룹)
   좌측 제목/설명 sticky, 우측 자료 스크롤 전환
======================================== */
.sub-event-group {
    position: relative;
    z-index: 20;
    scroll-margin-top: 100px;
    padding: 3rem 1.5rem;
}

@media (min-width: 768px) {
    .sub-event-group {
        padding: 3rem;
    }
}

.sub-event-group-inner {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 768px) {
    .sub-event-group-inner {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
        align-items: start;
    }
}

/* 좌측 제목/설명: sticky 고정 */
.sub-event-content-sticky {
    text-align: center;
}

@media (min-width: 768px) {
    .sub-event-content-sticky {
        position: sticky;
        top: 50vh;
        transform: translateY(-50%);
        padding-left: 2rem;
        text-align: left;
    }
}

/* 우측 자료 스크롤 영역 */
.sub-event-media-scroll {
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .sub-event-media-scroll {
        padding-left: 2rem;
    }
}

/* 각 서브이벤트 행 (스크롤 단위) */
.sub-event-row {
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem 0;
    position: relative;
}

/* 서브이벤트 간 구분선 */
.sub-event-row + .sub-event-row {
    border-top: 1px dashed #d1d5db;
}

.sub-event-pagination {
    display: none;
}

@media (min-width: 768px) {
    .sub-event-pagination {
        display: flex;
        gap: 0.5rem;
        align-items: center;
    }
}

.pagination-dot {
    width: 8px;
    height: 8px;
    border-radius: 9999px;
    background-color: #d1d5db;
    transition: all 0.3s ease;
    cursor: default;
}

.pagination-dot.active {
    width: 24px;
    background-color: #000;
}

/* ========================================
   섹션 전환 효과 (Section Transitions)
======================================== */

/* Section hero intro - initial hidden state */
.section-hero-content {
    opacity: 0;
    transform: translateY(60px);
    transition: opacity 0.8s cubic-bezier(0.39, 0, 0.12, 0.99),
                transform 0.8s cubic-bezier(0.39, 0, 0.12, 0.99);
}

/* Revealed state */
.section-hero-content.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Section dimmed overlay - injected by JS at end of each section's events */
.section-exit-overlay {
    position: relative;
    z-index: 15;
    height: 40vh;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.15));
    pointer-events: none;
    margin-top: -2rem;
}

/* Next section entrance spacer - visual breathing room */
.section-entrance-spacer {
    position: relative;
    z-index: 5;
    height: 20vh;
}
