/* ===================================================
 * @module now-timeline | @vars --now-* (7개, 인라인 정의)
 * @pair inc/now-timeline.php ([vault_timeline] 숏코드)
 * @flow Now page timeline: alt-side cards + center line
 *
 * 사용자 자주 조정 포인트:
 *   - .now-content font-size: 19px / line-height 1.9
 *   - .now-item::after: 도트 크기 12px
 *   - .now-item:hover: 호버 색상 (--point-color)
 *   - @keyframes dotBreathing: scale(2.0)
 * =================================================== */

/* =======================================================
   ADMIN: 폼 레이아웃 (label-above 스택 구조)
   (관리자 페이지 전용 — 프론트엔드에는 미적용)
======================================================= */
.vault-form-body {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.vault-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 0;
    border-bottom: 1px solid #eee;
}

.vault-field:first-child {
    padding-top: 0;
}

.vault-label {
    font-size: 11px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.vault-input {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    color: #222;
}

.vault-input:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

/* 미디어 버튼 행 */
.vault-media-btns {
    display: flex;
    gap: 8px;
}

/* 선택된 이미지 이름 표시 */
.vault-img-selected {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 20px;
}

.vault-img-name {
    font-size: 12px;
    color: #555;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 320px;
}

.vault-img-clear {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 13px;
    padding: 0 4px;
    line-height: 1;
}

.vault-img-clear:hover { color: #c21807; }

/* 갤러리 항목 */
.vault-gallery-item {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 4px 0;
}

.vault-gallery-name {
    flex: 0 0 130px;
    font-size: 12px;
    color: #555;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 갤러리 행의 사진별 캡션 입력 */
.vault-gallery-item .vault-gallery-caption {
    flex: 1;
    min-width: 0;
    width: auto;
}

.vault-form-footer {
    margin-top: 20px;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* =======================================================
   ADMIN: WYSIWYG 툴바 + contenteditable 에디터
   (관리자 페이지 전용 — 프론트엔드에는 미적용)
======================================================= */

#vault_content[contenteditable] {
    width: 100%;
    min-height: 120px;
    padding: 10px 12px;
    font-family: 'Pretendard', -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.7;
    outline: none;
    box-sizing: border-box;
    white-space: pre-wrap;
    word-break: break-word;
    color: #222;
}

/* =======================================================
   ADMIN: 프리뷰 헤더 + 정렬 토글
======================================================= */
.vault-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #e8e8e8;
    border-bottom: 1px solid #ddd;
}

.vault-preview-title {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    letter-spacing: 0.05em;
}

.vault-align-btns {
    display: flex;
    gap: 4px;
}

.vault-align-btn {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    letter-spacing: 0.03em;
    transition: all 0.15s;
}

.vault-align-btn:hover {
    border-color: #aaa;
    color: #444;
}

.vault-align-btn.is-active {
    background: #333;
    border-color: #333;
    color: #fff;
}

/* 정렬 모드 — 중앙선(타임라인 센터) 표시 (inset shadow → 레이아웃 영향 없음) */
#vault-preview-body.vault-preview-align-right {
    box-shadow: inset -3px 0 0 #ccc;
}

#vault-preview-body.vault-preview-align-left {
    box-shadow: inset 3px 0 0 #ccc;
}

/* =======================================================
   ADMIN: 라이브 프리뷰 (텍스트 전용)
======================================================= */
.vault-preview-date-ym {
    font-size: 13px;
    color: #888;
    line-height: 1.2;
}

.vault-preview-day {
    font-size: 48px;
    font-weight: 900;
    line-height: 1;
    color: #222;
}

.vault-preview-dow {
    font-size: 12px;
    color: #888;
    letter-spacing: 0.08em;
    margin-top: 2px;
}

.vault-preview-content {
    margin-top: 12px;
    font-family: 'Pretendard', -apple-system, sans-serif;
    font-size: 19px;
    line-height: 1.9;
    color: #222;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 정렬 방향에 따른 프리뷰 텍스트 정렬 */
.vault-preview-align-right .vault-preview-date-ym,
.vault-preview-align-right .vault-preview-day,
.vault-preview-align-right .vault-preview-dow,
.vault-preview-align-right .vault-preview-content {
    text-align: right;
}

.vault-preview-align-left .vault-preview-date-ym,
.vault-preview-align-left .vault-preview-day,
.vault-preview-align-left .vault-preview-dow,
.vault-preview-align-left .vault-preview-content {
    text-align: left;
}

/* =======================================================
   06. COMPONENT: NOW TIMELINE
   - 쇼트코드 [vault_timeline] 렌더링 스타일
   - 홀수/짝수 항목 좌우 교차 배치
   - 중앙 세로선 + 도트 + 페이드인
======================================================= */
.now-content {
    font-size: 19px;
    line-height: 1.9;
    max-width: none;
    white-space: pre-line;
    transition: transform 0.4s var(--transition-ease);
    cursor: default;
}

.now-content:hover {
    transform: scale(1.05);
}

.now-date {
    display: inline-block;
    transition: transform 0.4s var(--transition-ease);
    cursor: default;
}

.now-date:hover {
    transform: scale(1.1);
}

.now-day,
.now-content {
    transition: var(--transition);
    cursor: default;
}

/* 타임라인 도트 */
.now-item::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 12px;
    background: var(--text-black);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    transition: var(--transition);
}

.now-item:hover::after {
    background: var(--point-color);
    animation: dotBreathing 2.4s ease-in-out infinite;
}

@keyframes dotBreathing {

    0%,
    100% {
        transform: translateX(-50%) scale(1.2);
        opacity: 1;
    }

    50% {
        transform: translateX(-50%) scale(2.0);
        opacity: 0.7;
    }
}

.now-item:hover .now-day {
    color: var(--point-color);
    transform: scale(1.1);
}

.now-item:hover .now-content {
    transform: scale(1.02);
}

.now-item:nth-child(odd) .now-text-box {
    transform-origin: right center;
}

.now-item:nth-child(even) .now-text-box {
    transform-origin: left center;
}

/* 이미지 호버 확대 — 단일 이미지 */
.now-image-box {
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    background: #f0f0f0;
}

.now-image-box>a>img {
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    will-change: transform;
}

.now-image-box:not(:has(.now-gallery-wrap)):hover img {
    transform: scale(1.06);
}

/* 갤러리 wrap이 있으면 overflow visible로 전환 */
.now-image-box:has(.now-gallery-wrap) {
    overflow: visible;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

/* 갤러리 썸네일 스트립 */
.now-gallery-wrap {
    position: relative;
    width: 100%;
}

/* 메인 이미지 */
.now-gallery-main {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    line-height: 0;
    display: block;
}

.now-gallery-main img {
    width: 100%;
    display: block;
    aspect-ratio: 16/9;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.now-gallery-main:hover img {
    transform: scale(1.06);
}

/* 썸네일 스트립 */
.now-gallery-strip {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.now-gallery-thumb {
    flex: 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    line-height: 0;
    position: relative;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
    border: 2px solid transparent;
}

.now-gallery-thumb:hover {
    opacity: 1;
    transform: translateY(-2px);
}

.now-gallery-thumb.is-active {
    opacity: 1;
    border-color: var(--link-entry, #aaa);
}

.now-gallery-thumb img {
    width: 100%;
    display: block;
    aspect-ratio: 1/1;
    object-fit: cover;
}

/* 갤러리 캡션 */
.now-image-box:has(.now-gallery-wrap) .now-caption {
    border-radius: 10px;
    margin-top: 6px;
}

/* 갤러리 카운트 뱃지 */
.now-gallery-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

/* ── Lottie 플레이어 (이미지 없을 때) ── */
.now-image-box:has(.now-lottie-player) {
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.now-lottie-player {
    width: 100%;
    max-width: 340px;
    aspect-ratio: 1 / 1;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.now-lottie-player:hover {
    opacity: 1;
}

/* 다크모드 색상 영향 차단 */
.now-lottie-player {
    isolation: isolate;
    color-scheme: light;
}

/* =======================================================
   NOW NAV — CSS 변수 + 월별 네비게이션
======================================================= */
:root {
    --now-glass: rgba(0, 0, 0, 0.03);
    --now-glass-border: rgba(0, 0, 0, 0.08);
    --now-accent: var(--point-color, #C21807);
    --now-text: #222222;
    --now-text-muted: rgba(0, 0, 0, 0.4);
    --now-tag-bg: rgba(0, 0, 0, 0.05);
    --now-tag-color: #555555;
}

:where(html)[data-color-scheme="dark"] body :root,
:where(html)[data-color-scheme="dark"] body {
    --now-glass: var(--bg-soft);
    --now-glass-border: var(--border-main);
    --now-text: var(--text-main);
    --now-text-muted: var(--text-muted);
    --now-tag-bg: var(--bg-hover);
    --now-tag-color: var(--text-soft);
}

.now-nav-wrapper {
    max-width: 1100px;
    margin: 0 auto 40px;
    padding: 20px;
    font-family: 'Pretendard', sans-serif;
    color: var(--now-text);
}

.now-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 30px;
    gap: 20px;
}

.nav-tagline {
    display: inline-block;
    font-size: 13px;
    color: var(--now-tag-color);
    background: var(--now-tag-bg);
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.nav-main-title {
    margin: 0;
    font-size: clamp(28px, 5vw, 48px);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.02em;
    white-space: nowrap;
    color: var(--now-text);
}

.now-accent-breath {
    color: var(--now-accent);
    animation: now-breath 3s ease-in-out infinite;
    display: inline-block;
    margin-right: 4px;
}

.now-accent-shake {
    animation: now-shake 4s ease-in-out infinite;
    display: inline-block;
}

@keyframes now-breath {
    0%, 100% { opacity: 1; filter: drop-shadow(0 0 2px var(--now-accent)); }
    50% { opacity: 0.7; filter: drop-shadow(0 0 8px var(--now-accent)); }
}

@keyframes now-shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-0.5deg); }
    75% { transform: rotate(0.5deg); }
}

.year-selector-container {
    flex-shrink: 0;
    margin-bottom: 5px;
}

.year-nav-controls {
    display: flex;
    align-items: center;
    background: var(--now-glass);
    padding: 4px;
    border-radius: 30px;
    border: 1px solid var(--now-glass-border);
}

.year-nav-btn {
    background: rgba(0, 0, 0, 0.03);
    border: none;
    color: var(--now-text);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

html[data-color-scheme="dark"] .year-nav-btn {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.year-nav-btn:hover {
    background: var(--now-accent);
    color: white !important;
    transform: scale(1.1);
}

.year-select-wrapper {
    padding: 0 10px;
    font-weight: 800;
    font-size: 16px;
}

#vaultYearSelect {
    background: transparent;
    border: none;
    color: var(--now-text);
    font-family: inherit;
    font-weight: 900;
    cursor: pointer;
    outline: none;
    padding-right: 5px;
    appearance: none;
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 12px;
}

.month-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 5px;
    background: var(--now-glass);
    border: 1px solid var(--now-glass-border);
    border-radius: 12px;
    text-decoration: none !important;
    color: var(--now-text);
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
}

.month-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.month-item:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.month-item:hover::before { opacity: 1; }

.month-item.has-data {
    border-color: rgba(255, 255, 255, 0.15);
}

.month-item.active {
    background: var(--now-accent);
    border-color: var(--now-accent);
    box-shadow: 0 8px 20px rgba(194, 24, 7, 0.3);
}

.month-item.active .m-num,
.month-item.active .m-name {
    color: white;
}

.month-item.no-data {
    opacity: 0.3;
    cursor: default;
}

.m-num {
    font-size: 10px;
    font-weight: 700;
    color: var(--now-text-muted);
    margin-bottom: 2px;
}

.m-name {
    font-family: 'Impact', sans-serif;
    font-size: 18px;
    letter-spacing: 0.05em;
}

@media (max-width: 900px) {
    .month-grid { grid-template-columns: repeat(6, 1fr); }
}

@media (max-width: 600px) {
    .now-nav-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .year-selector-container { align-self: flex-end; }
    .month-grid { gap: 8px; }
    .month-item { padding: 10px 2px; }
    .m-name { font-size: 14px; }
}

/* =======================================================
   TIMELINE LAYOUT — 좌우 교차 + 모바일 단열
======================================================= */
.now-wrapper {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px;
    display: flex;
    flex-direction: column;
    gap: 100px;
}

.now-wrapper::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-main, #ddd);
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 0;
}

.now-item {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.now-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.now-text-box,
.now-image-box {
    flex: 0 0 calc(50% - 30px);
    width: calc(50% - 30px);
    z-index: 1;
    box-sizing: border-box;
}

.now-item:nth-child(odd)  { flex-direction: row; justify-content: flex-start; }
.now-item:nth-child(odd)  .now-text-box  { text-align: justify; }
.now-item:nth-child(odd)  .now-image-box { margin-left: 60px; }

.now-item:nth-child(even) { flex-direction: row-reverse; justify-content: flex-start; }
.now-item:nth-child(even) .now-text-box  { text-align: justify; }
.now-item:nth-child(even) .now-image-box { margin-right: 60px; }

.now-day {
    font-size: 48px;
    font-weight: 900;
    line-height: 1;
    color: var(--text-main, #222);
    position: relative;
    z-index: 1;
    display: inline-block;
}

.now-image-box img,
.now-image-box iframe {
    width: 100%;
    display: block;
    border: none;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.now-caption {
    padding: 12px 15px;
    background: #f9f9f9;
    border-top: 1px solid #eee;
    font-size: 13px;
    color: #888;
    text-align: left;
}

.now-dot { display: none; }

@media (max-width: 1200px) {
    .now-wrapper { gap: 50px; }
    .now-wrapper::before { left: 20px; }

    .now-item {
        flex-direction: column-reverse !important;
        align-items: flex-start;
        gap: 16px;
    }
    .now-item::after { display: none !important; }

    .now-text-box {
        width: 100% !important;
        flex: 0 0 100% !important;
        padding-left: 32px !important;
        margin: 0 !important;
        text-align: left !important;
    }
    .now-image-box {
        width: calc(100% - 30px) !important;
        flex: 0 0 auto !important;
        margin-left: 25px !important;
        padding-left: 0 !important;
    }

    .now-dot {
        display: block;
        position: absolute;
        left: 0;
        top: 50%;
        width: 16px;
        height: 16px;
        background: #C21807;
        border-radius: 50%;
        transform: translate(-50%, -50%);
        z-index: 2;
        pointer-events: none;
        animation: dotPulseMobile 2.4s ease-in-out infinite;
    }
}

@keyframes dotPulseMobile {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.8); opacity: 0.6; }
}