/* --- 1. DESIGN TOKENS --- */
@import url("./_tokens.css");

/* FIX SCROLL & WHITE PAGE (SỬA LẠI) */
html {
    scroll-behavior: smooth;
    /* Bỏ height: 100% để tránh kẹt scroll trên mobile */
}

body {
    margin: 0;
    padding: 0;
    /* Chừa chỗ cho .player-wrapper fixed-bottom — thay cho spacer 220px cũ */
    padding-bottom: calc(var(--audio-h) + var(--space-5));
    width: 100%;
    min-height: 100vh;
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    color: var(--text-color);
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* QUAN TRỌNG: Đổi overflow thành visible để Sticky Menu hoạt động */
#site-content { 
    display: block; 
    width: 100%; 
    overflow: visible; /* FIX: Đã sửa từ hidden thành visible */
}

/* --- 2. BACKGROUND SYSTEM --- */
.bg-layer {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
    background-size: cover; background-position: center;
    z-index: -2; opacity: 0; transition: opacity 0.8s ease-in-out;
    will-change: opacity; pointer-events: none;
}
.bg-layer.active { opacity: 1; }

#bg-1 {
    background-image: image-set(
        url("../library/background/bg1-1600.webp") type("image/webp") 1x,
        url("../library/background/bg1.jpeg") 1x
    );
}
#bg-2 {
    background-image: image-set(
        url("../library/background/bg2-1600.webp") type("image/webp") 1x,
        url("../library/background/bg2.jpeg") 1x
    );
}
#bg-3 { background-image: none; background-color: #0e0b1e; }

.bg-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.75); z-index: -1; pointer-events: none;
}

/* --- 3. HEADER --- */
header {
    position: fixed; top: 0; width: 100%; height: 60px;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 20px; z-index: 1000; background: var(--nav-bg);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.logo { font-family: var(--font-title); font-size: 1.4rem; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--primary-color); text-decoration: none; }

.desktop-nav { display: none; gap: 25px; list-style: none; margin: 0; padding: 0; }
.desktop-nav a { text-decoration: none; color: var(--text-color); font-size: 0.9rem; text-transform: uppercase; transition: color 0.3s; }
.desktop-nav a:hover { color: var(--primary-color); }

/* Active state cho Menu Desktop */
.desktop-nav a.active { color: var(--primary-color); position: relative; }
.desktop-nav a.active::after { content: ''; position: absolute; bottom: -5px; left: 0; width: 100%; height: 2px; background-color: var(--primary-color); box-shadow: 0 0 10px var(--primary-color); }

.mobile-menu-btn { font-size: 1.5rem; color: #fff; cursor: pointer; padding: 10px; }
.mobile-menu-btn-logout { font-size: 1.5rem; color: #fff; padding: 10px; }

.mobile-nav-overlay {
    position: fixed; top: 60px; left: 0; width: 100%; height: 0;
    background: rgba(15, 23, 42, 0.98); overflow: hidden;
    transition: height 0.3s ease; z-index: 999;
    display: flex; flex-direction: column; align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.mobile-nav-overlay.open { height: 340px; padding-top: 20px; }

.mobile-nav-link {
    font-family: var(--font-title); font-size: 1.3rem; color: #fff;
    text-decoration: none; margin: 10px 0; opacity: 0; transform: translateY(10px);
    transition: all 0.3s ease;
}
.mobile-nav-overlay.open .mobile-nav-link { opacity: 1; transform: translateY(0); }

/* Active state cho Menu Mobile */
.mobile-nav-link.active { color: var(--primary-color); font-weight: 600; border-left: 3px solid var(--primary-color); padding-left: 15px; transition: all 0.3s; }
.mobile-nav-overlay.open a:nth-child(1) { transition-delay: 0.05s; }
.mobile-nav-overlay.open a:nth-child(2) { transition-delay: 0.1s; }
.mobile-nav-overlay.open a:nth-child(3) { transition-delay: 0.15s; }
.mobile-nav-overlay.open a:nth-child(4) { transition-delay: 0.2s; }
.mobile-nav-overlay.open a:nth-child(5) { transition-delay: 0.25s; }
.mobile-nav-overlay.open a:nth-child(6) { transition-delay: 0.3s; }

#backToTop {
    position: fixed; bottom: 140px; right: 20px; z-index: 900;
    width: 40px; height: 40px; background: rgba(255,255,255,0.15);
    border: 1px solid var(--primary-color); border-radius: 50%;
    color: var(--primary-color); display: flex; align-items: center; justify-content: center;
    cursor: pointer; opacity: 0; transition: opacity 0.3s; pointer-events: none;
    backdrop-filter: blur(5px);
}
#backToTop.show { opacity: 1; pointer-events: all; }

/* --- 4. SECTIONS --- */
section { position: relative; }

/* .section util: nhịp spacing dọc dùng cho mọi <section> không full-bleed */
.section {
    padding: var(--space-6) var(--space-4);
}
@media (min-width: 768px) {
    .section { padding: var(--space-7) var(--space-5); }
}
@media (min-width: 1200px) {
    .section { padding: clamp(72px, 8vw, 120px) var(--space-6); }
}
/* full-bleed variant: dọc dùng util, ngang giữ 0 (gallery horizontal) */
.section--bleed { padding-inline: 0; }
.hero { height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 20px; }
.hero h1 {
    font-size: clamp(2.4rem, 7vw, 4.6rem);
    line-height: 1.05;
    letter-spacing: -0.01em;
    margin-bottom: 15px;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    text-wrap: balance;
}
.hero p {
    font-size: clamp(1.05rem, 2.4vw, 1.5rem);
    line-height: 1.4;
    margin-top: clamp(12px, 2vw, 20px);
    margin-bottom: 40px;
    font-style: italic;
    color: var(--primary-color);
    opacity: 0.9;
    font-family: var(--font-title);
    text-wrap: balance;
}
/* --- Mobile nav: ẩn header logout ≤768px (đã có "Đăng xuất" trong menu) --- */
@media (max-width: 768px) {
    .mobile-menu-btn-logout { display: none !important; }
}
.mobile-nav-link--logout {
    color: var(--text-faint);
    border-top: 1px solid var(--border);
    margin-top: auto;
    padding-top: var(--space-4);
}

/* --- Mobile nav backdrop --- */
.nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 40;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}
.nav-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* Required marker bên label form share */
.share-required {
    color: var(--lavender);
    margin-left: 4px;
    font-weight: 700;
}

/* --- BUTTON SYSTEM (chuẩn hoá) --- */
.btn-primary,
.btn-ghost {
    display: inline-block;
    padding: 12px 22px;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease, background 0.2s ease;
    position: relative;
    z-index: 10;
}
.btn-primary {
    background: linear-gradient(135deg, #e6c9ff, #c9a4f5);
    color: #1b1230;
    font-weight: 600;
    border: none;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.4) inset,
        0 8px 22px -8px rgba(216, 180, 254, 0.45);
}
.btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    color: #f5efff;
    font-weight: 500;
    border: 1px solid rgba(216, 180, 254, 0.35);
}
.btn-primary:hover,
.btn-ghost:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.section-title { text-align: center; margin-bottom: 40px; color: #fff; font-size: 2.5rem; font-family: var(--font-title); text-wrap: balance; }
.intro-text { max-width: 800px; margin: 0 auto; text-align: center; color: #cbd5e1; font-size: 1.1rem; }

/* --- 5. TIMELINE --- */
.timeline-container { max-width: 800px; margin: 0 auto; position: relative; border-left: 2px solid rgba(216, 180, 254, 0.3); padding-left: 30px; }
.timeline-item { position: relative; margin-bottom: 40px; }
.timeline-item::before { content: ''; position: absolute; width: 14px; height: 14px; left: -38px; top: 5px; background: var(--bg-dark); border: 2px solid var(--primary-color); border-radius: 50%; }
.content-box { padding: 15px; background: rgba(255,255,255,0.05); border-radius: 8px; border: 1px solid rgba(255,255,255,0.05); }
.date { color: var(--primary-color); font-weight: 700; font-size: 0.85rem; margin-bottom: 5px; display: block; }
.loc { font-size: 1.3rem; color: #fff; font-family: var(--font-title); line-height: 1.2; }
.resort { font-size: 0.9rem; font-style: italic; opacity: 0.7; margin-bottom: 10px; }
.t-img { width: 100%; height: 180px; object-fit: cover; border-radius: 4px; margin-top: 5px; filter: brightness(0.9); }

/* --- 6. GALLERY --- */
#gallery { background: rgba(0,0,0,0.2); touch-action: pan-y; }
.gallery-title-wrap { padding: 0 20px; }
/* Masonry grid: ảnh dọc vẫn dọc, ngang vẫn ngang, không crop xấu. */
.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    grid-auto-rows: 8px;
    gap: 12px;
    padding: 0 var(--space-4) var(--space-5);
    max-width: 1400px;
    margin: 0 auto;
}
.gallery-item {
    grid-row: span var(--span, 30);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
}
.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: var(--focus, 50% 35%);
    display: block;
}
.play-icon-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 3rem; color: #fff; opacity: 0.9; pointer-events: none; text-shadow: 0 0 15px rgba(0,0,0,0.6); z-index: 2; }

/* --- 7. DIARY (STICKY MENU) --- */
#letters { 
    padding: 0; margin-top: 40px; 
    position: relative; 
    overflow: visible; /* Để sticky hoạt động */
}
.diary-nav-wrapper {
    position: -webkit-sticky;
    position: sticky;
    top: 60px; /* Dính dưới header */
    z-index: 90;
    background: rgba(15, 23, 42, 0.98);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 15px 0;
    margin-bottom: 40px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    overflow: hidden; /* Để gradient fade không tràn ra ngoài */
}
/* Gradient fade ở 2 mép trái/phải */
.diary-nav-wrapper::before,
.diary-nav-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 36px;
    z-index: 2;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.diary-nav-wrapper::before {
    left: 0;
    background: linear-gradient(to right, var(--nav-bg, #0f172a), transparent);
}
.diary-nav-wrapper::after {
    right: 0;
    background: linear-gradient(to left, var(--nav-bg, #0f172a), transparent);
}
.diary-nav-wrapper.at-start::before { opacity: 0; }
.diary-nav-wrapper.at-end::after { opacity: 0; }

.diary-nav { display: flex; gap: 10px; overflow-x: auto; padding: 0 20px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.diary-nav::-webkit-scrollbar { display: none; }

.nav-pill {
    flex: 0 0 auto;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid transparent;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-soft, #cbd5e1);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    opacity: 0.7;
    transition: all 0.3s;
}
.nav-pill.active {
    background: linear-gradient(135deg, #e6c9ff, #c9a4f5);
    color: #1b1230;
    border-color: transparent;
    font-weight: 600;
    padding-inline: 21px; /* ~30% nhiều hơn 16px */
    opacity: 1;
}
.nav-pill span.t { font-weight: 600; margin-top: 2px; }
.diary-content { padding: 0 20px 60px 20px; max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; gap: 60px; }
.letter { background: rgba(30, 41, 59, 0.85); border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); overflow: hidden; scroll-margin-top: 180px; }
.letter.secret {
    border: 1px solid var(--border);
    border-left: 2px solid var(--lavender);
    background: linear-gradient(90deg, rgba(216, 180, 254, 0.06), transparent), rgba(30, 41, 59, 0.85);
}
.letter-cover { width: 100%; height: 250px; object-fit: cover; border-bottom: 1px solid rgba(255,255,255,0.05); filter: brightness(0.8); }

/* --- Letter variants (tăng nhịp đọc, không monotone) --- */
.letter.letter--quote {
    background: var(--lavender-soft);
    text-align: center;
    font-family: var(--serif);
    font-style: italic;
    font-size: clamp(1.3rem, 2.4vw, 1.7rem);
    padding: var(--space-5);
}
.letter.letter--quote .l-text { font-family: inherit; font-style: inherit; text-align: center; }
.letter.letter--quote .l-date { color: var(--lavender); font-weight: 500; }
.letter.letter--quote .l-sign { font-size: 1rem; }

.letter.letter--photo {
    padding: 0;
    border: 0;
    background: transparent;
}
.letter.letter--photo .letter-cover {
    height: auto;
    max-height: 70vh;
    border-bottom: none;
    filter: none;
    border-radius: var(--radius-md);
}
.letter.letter--photo .letter-body-wrap {
    padding: var(--space-3) var(--space-4) var(--space-4);
    text-align: center;
}
.letter.letter--photo .l-title { font-size: 1.2rem; margin-bottom: var(--space-2); }
.letter.letter--photo .l-text { font-size: 0.95rem; color: var(--text-soft); text-align: center; }

/* --- Quote card variants (micro-treatment subtle, random theo id) --- */
.quote-card.quote-card--variant-a { border-left: 2px solid var(--lavender); }
.quote-card.quote-card--variant-b { background: var(--lavender-soft); }
.quote-card.quote-card--variant-c {
    font-family: var(--serif);
    font-style: italic;
}
.quote-card.quote-card--variant-c .quote-text { font-family: inherit; }
.letter-body-wrap { padding: 30px 25px; }
.l-date { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--primary-color); margin-bottom: 8px; }
.l-title { font-size: 2rem; color: #fff; font-family: var(--font-title); line-height: 1.2; margin-bottom: 25px; padding-bottom: 0; }
.l-text {
    font-family: var(--font-letter);
    font-size: 1.15rem;
    color: var(--text);
    white-space: pre-line;
    text-align: left;        /* trước: justify — gây "river" trên mobile VN */
    text-wrap: pretty;
    hyphens: none;
    line-height: 1.7;
    margin-bottom: 15px;
}
.l-sign { text-align: right; margin-top: 30px; font-family: var(--font-title); font-size: 1.2rem; color: var(--primary-color); font-style: italic; }
.yt-link { display: block; text-align: center; margin-top: 20px; padding: 12px; background: rgba(255,255,255,0.08); border-radius: 8px; color: #fff; text-decoration: none; font-size: 0.9rem; }

/* --- 8. QUOTES --- */
#quotes { position: relative; z-index: 2; }
.quote-grid { display: flex; flex-direction: column; gap: 20px; max-width: 900px; margin: 0 auto; }
.quote-card { background: rgba(30, 41, 59, 0.85); border: 1px solid rgba(255, 255, 255, 0.05); padding: 25px; border-radius: 16px; position: relative; }
.quote-icon { font-size: 1.5rem; color: var(--primary-color); opacity: 0.5; margin-bottom: 10px; }
.quote-text { font-family: var(--font-letter); font-size: 1.1rem; color: #e2e8f0; font-style: italic; line-height: 1.6; margin-bottom: 15px; }
.quote-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.8rem; opacity: 0.7; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 10px; }
.quote-sender { font-weight: bold; color: var(--primary-color); }
/* --- 9. PLAYER --- */
.player-wrapper { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); width: 95%; max-width: 520px; z-index: 1000; }

/* --- PLAYER 2.0: cover + meta + controls + progress --- */
.player {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    grid-template-areas:
        "cover meta controls"
        "progress progress progress";
    gap: 10px 12px;
    align-items: center;
    padding: 10px 14px 8px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
}
.player__cover {
    grid-area: cover;
    width: 48px; height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #e6c9ff 0%, #c9a4f5 60%, #8a6bc7 100%);
    background-size: cover;
    background-position: center;
    box-shadow: 0 4px 12px rgba(216, 180, 254, 0.25);
    flex: 0 0 auto;
}
.player__meta {
    grid-area: meta;
    min-width: 0; /* để text-overflow ellipsis hoạt động trong grid */
    overflow: hidden;
}
.player__title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}
.player__artist {
    font-size: 0.7rem;
    color: var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player__resume {
    font-size: 0.65rem;
    color: var(--text-faint);
    margin-top: 2px;
    font-style: italic;
}
/* Marquee chậm khi hover (desktop): title chạy nếu bị truncate */
@media (hover: hover) and (min-width: 769px) {
    .player__title:hover {
        overflow: visible;
        animation: player-marquee 8s linear infinite;
    }
}
@keyframes player-marquee {
    0%   { transform: translateX(0); }
    100% { transform: translateX(calc(-100% + 240px)); }
}
@media (max-width: 768px) {
    .player__title {
        white-space: normal;
        max-width: none;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        line-height: 1.2;
    }
}

.player__controls {
    grid-area: controls;
    display: flex;
    gap: 8px;
    align-items: center;
}
.player__progress {
    grid-area: progress;
    display: flex;
    align-items: center;
    gap: 8px;
}
.player__time {
    font-size: 0.7rem;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
    min-width: 32px;
    text-align: center;
}
.player__seek {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    outline: none;
    cursor: pointer;
}
.player__seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px; height: 14px;
    background: var(--lavender);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 0 4px rgba(216, 180, 254, 0.15);
    transition: transform 0.1s ease;
}
.player__seek::-webkit-slider-thumb:hover { transform: scale(1.15); }
.player__seek::-moz-range-thumb {
    width: 14px; height: 14px;
    background: var(--lavender);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}
.player__seek:focus-visible {
    outline: 2px solid var(--lavender);
    outline-offset: 4px;
}
.player-bar { backdrop-filter: blur(15px); padding: 5px 20px; border-radius: 50px; border: 1px solid rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: space-between; box-shadow: 0 10px 30px rgba(0,0,0,0.6); }
.song-info { display: flex; flex-direction: column; overflow: hidden; margin-right: 10px; flex: 1; }
.song-title { font-size: 0.8rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-artist { font-size: 0.7rem; color: var(--primary-color); }
.controls { display: flex; gap: 15px; align-items: center; }
.btn-icon { background: none; border: none; color: #fff; font-size: 1.1rem; cursor: pointer; padding: 5px; }
.btn-play { width: 36px; height: 36px; background: var(--primary-color); color: #000; border-radius: 50%; display: flex; align-items: center; justify-content: center; border:none; cursor: pointer; }
.playlist { position: absolute; bottom: 75px; left: 0; width: 100%; background: rgba(20, 25, 40, 0.98); border-radius: 15px; border: 1px solid rgba(255,255,255,0.1); max-height: 300px; overflow-y: auto; display: none; }
.playlist.active { display: block; }
.pl-item { padding: 12px; border-bottom: 1px solid rgba(255,255,255,0.05); cursor: pointer; display: flex; justify-content: space-between; color: #ccc; }
.pl-item.active { color: var(--primary-color); font-weight: bold; }
.pl-item.active {
    background: rgba(216, 180, 254, 0.15);
    border-left: 3px solid var(--primary-color);
    color: var(--primary-color);
    font-weight: bold;
}
.pl-item.active span:last-child {
    color: #fff; /* Tên ca sĩ sáng lên */
    opacity: 1;
}


/* --- LIGHTBOX (Thêm hoặc chỉnh sửa các phần này trong style.css của bạn) --- */

#lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9); /* Nền tối hơn, gần như đen hoàn toàn */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90vw; /* Chiều rộng tối đa của nội dung lightbox */
    max-height: 90vh; /* Chiều cao tối đa của nội dung lightbox */
    display: flex; /* Dùng flex để căn giữa media-container */
    justify-content: center;
    align-items: center;
}

/* Container cho Media và Description */
.media-container {
    position: relative; /* Rất quan trọng: để description có thể position: absolute theo container này */
    display: flex;
    justify-content: center;
    align-items: center;
    /* Kích thước sẽ được điều chỉnh bởi media bên trong */
    max-width: 100%;
    max-height: 100%;
}

.lightbox-media {
    max-width: 100%;
    max-height: 90vh; /* Điều chỉnh chiều cao tối đa của ảnh/video */
    border-radius: 8px; /* Bo góc nhẹ nhàng cho media */
    display: block; /* Loại bỏ khoảng trắng dưới ảnh */
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); /* Thêm đổ bóng nhẹ */
}

/* Caption mặc định visible — toggle bằng .is-caption-hidden trên .media-container */
.lightbox-description {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px 20px 18px;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.4) 60%, rgba(0,0,0,0) 100%);
    color: #fff;
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: left;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    max-height: 50%;
    overflow-y: auto;
    pointer-events: none; /* Tap đi qua caption để toggle */
    &::-webkit-scrollbar {
        width: 6px;
        background: rgba(255,255,255,0.1);
        border-radius: 3px;
    }
    &::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,0.3);
        border-radius: 3px;
    }
}

.media-container.is-caption-hidden .lightbox-description {
    opacity: 0;
    visibility: hidden;
    transform: translateY(100%);
}

/* Chấm chỉ báo còn caption khi đang ẩn */
.media-container.is-caption-hidden.has-caption::after {
    content: '';
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 0 6px rgba(216, 180, 254, 0.7);
    pointer-events: none;
}


/* Nút đóng Lightbox: pill backdrop để luôn đọc được trên ảnh sáng/tối */
.lightbox-close {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-pill);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s ease, transform 0.15s ease;
}
.lightbox-close:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.05);
}

/* Đảm bảo reset style mặc định của button */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: color 0.2s ease;
    z-index: 1001;

    /* --- CÁC THAY ĐỔI MỚI --- */
    background: none; /* Loại bỏ background mặc định */
    border: none;    /* Loại bỏ border mặc định */
    padding: 0;      /* Loại bỏ padding mặc định */
    display: flex;   /* Dùng flexbox để căn giữa icon */
    align-items: center;
    justify-content: center;
    width: 60px; /* Đặt chiều rộng cho vùng click */
    height: 60px; /* Đặt chiều cao cho vùng click */
    border-radius: 50%; /* Có thể làm cho vùng click tròn */
    backdrop-filter: blur(5px); /* Tạo hiệu ứng mờ cho nền nút */
    -webkit-backdrop-filter: blur(5px); /* Hỗ trợ Safari */
    background-color: rgba(0, 0, 0, 0.2); /* Nền hơi tối để nút nổi bật hơn */
}

.lightbox-nav:hover {
    color: #fff;
    background-color: rgba(0, 0, 0, 0.4); /* Nền tối hơn khi hover */
}

/* Đảm bảo icon Font Awesome có màu sắc mong muốn */
.lightbox-nav i {
    color: inherit; /* Kế thừa màu từ .lightbox-nav */
}

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
/* Responsive */
@media (max-width: 768px) {
    .section-title { font-size: 2rem; text-wrap: balance; }
    .lb-nav-btn { width: 40px; height: 40px; font-size: 1.2rem; background: rgba(0,0,0,0.4); }
    .lb-prev { left: 10px; } .lb-next { right: 10px; }
}
@media (min-width: 769px) {
    .mobile-menu-btn { display: none; }
    .mobile-menu-btn-logout { display: none; }
    .desktop-nav { display: flex; }
    .timeline-container { padding-left: 0; border-left: none; }
    .timeline-container::after { content: ''; position: absolute; width: 2px; background: rgba(216, 180, 254, 0.3); top: 0; bottom: 0; left: 50%; }
    .timeline-item { width: 50%; }
    .timeline-item:nth-child(odd) { left: 0; text-align: right; padding-right: 40px; }
    .timeline-item:nth-child(even) { left: 50%; text-align: left; padding-left: 40px; }
    .timeline-item::before { left: auto; }
    .timeline-item:nth-child(odd)::before { right: -10px; }
    .timeline-item:nth-child(even)::before { left: -8px; }
    .quote-grid { display: grid; grid-template-columns: 1fr 1fr; }
    .quote-card.full-width { grid-column: span 2; }
}

/* --- THẾ GIỚI SONG SONG (PHƯƠNG ÁN 2 — CORMORANT + LORA) --- */
.parallel-world {
    max-width: 900px;
    margin: 0 auto;
    color: #e2e8f0;
    line-height: 1.8;

    backdrop-filter: blur(2px);
    padding: 20px 1px;
    margin-top: 0px;
}

/* Câu mở đầu — nên là 1 câu riêng trong <p class="first-line"> */
.parallel-world .first-line {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.45rem;
    font-style: italic;
    line-height: 1.6;
    letter-spacing: 0.3px;
    margin-bottom: 25px;
    color: #ffffff;
}

/* Các đoạn tiếp theo — Lora để giữ chất mềm & thơ */
.parallel-world .body {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.45rem;
    font-style: italic;
    line-height: 1.6;
    letter-spacing: 0.3px;
    margin-bottom: 25px;
    color: #ffffff;
}

/* Accent (đoạn mở/đóng) — Cormorant Garamond italic, to hơn */
.parallel-world .pw-paragraph--accent {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 1.5rem;
    line-height: 1.6;
    letter-spacing: 0.3px;
    margin-bottom: 25px;
    color: #ffffff;
}

/* Đoạn giữa — Lora chữ thường, dịu mắt */
.parallel-world .pw-paragraph {
    font-family: 'Lora', serif;
    font-style: normal;
    font-size: 1.15rem;
    line-height: 1.75;
    letter-spacing: normal;
    margin-bottom: 25px;
    color: var(--text-soft);
}

/* Tăng nhẹ độ blur của nền cho đoạn văn dễ đọc hơn */
.parallel-world-bg {
    backdrop-filter: blur(3px);
}

/* --- 10. LOGIN PAGE (NEW SECTION) --- */
.login-body { /* Class này sẽ được thêm vào <body> của login.php */
    height: 100vh; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    margin: 0; 
    padding: 0; 
    font-family: var(--font-body); 
    color: #fff;
    background-image: image-set(
        url("../library/background/bg1-1600.webp") type("image/webp") 1x,
        url("../library/background/bg1.jpeg") 1x
    );
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
    overflow: hidden; /* Tránh scrollbar khi có backdrop-filter */
}
.login-body::after { /* Overlay cho trang login */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.75);
    z-index: 1;
}

/* Login container */
.login-container { 
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px); 
    padding: 40px; 
    border-radius: 16px; 
    border: 1px solid rgba(216, 180, 254, 0.2); 
    width: 90%; 
    max-width: 380px; 
    text-align: center; 
    box-shadow: 0 15px 40px rgba(0,0,0,0.8); 
    position: relative;
    z-index: 10;
}

/* Tiêu đề */
.pw-title { 
    font-family: var(--font-title); 
    font-size: 2.5rem; 
    color: var(--primary-color); 
    margin-bottom: 30px; 
    letter-spacing: 1px; 
    font-weight: 600;
}

/* Inputs */
.input-group { position: relative; margin-bottom: 20px; width: 100%; }
.input-group i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--primary-color); z-index: 2; }
.pw-input { 
    width: 100%; 
    padding: 12px 15px 12px 45px; 
    border-radius: 50px; 
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: var(--input-bg-color); 
    color: #fff; 
    outline: none; 
    font-size: 1rem; 
    transition: 0.3s; 
    margin-bottom: 0; 
    font-family: var(--font-body);

}
.pw-input:focus { 
    border-color: var(--primary-color); 
    background: var(--bg-dark); 
    box-shadow: 0 0 10px rgba(216, 180, 254, 0.5);
}

/* Button */
.pw-btn { 
    width: 100%; 
    padding: 12px 30px;
    border-radius: 50px; 
    border: 1px solid #fff;
    background: rgba(255, 255, 255, 0.1); 
    color: #fff; 
    font-size: 1rem; 
    cursor: pointer; 
    transition: all 0.3s; 
    margin-top: 25px; 
    letter-spacing: 0.5px;
    box-shadow: none;
    font-family: var(--font-body);
}

.pw-btn:hover { background: var(--primary-color); color: #000; border-color: var(--primary-color); }

/* --- 10. LOGIN PAGE (NEW SECTION) --- */
/* ... (các style login đã có) ... */

/* Style cho thông báo xem tốt nhất */
.info-message {
    margin-top: 25px; /* Điều chỉnh khoảng cách với button */
    font-size: 0.7rem;
    color: #cbd5e1; /* Màu xám nhạt */
    opacity: 0.8;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: inline-block; /* Giúp khung bọc vừa nội dung */
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.info-message p {
    margin: 0;
}

.info-message i {
    margin-right: 8px;
    color: var(--primary-color); /* Icon màu tím */
}

/* Responsive cho trang login */
@media (max-width: 480px) {
    .login-container { padding: 30px 20px; max-width: 95%; }
    .pw-title { font-size: 2rem; }
    .info-message { font-size: 0.8rem; padding: 8px 12px; }
}

/* .landing-quote chỉ giữ shadow + inherit font-size từ .hero p (clamp) */
.landing-quote {
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

/* Decorative variant — chỉ khi thật sự "decorative" (watermark, hint).
   Đừng dùng cho metadata cần đọc được. */
.is-decorative { opacity: 0.55; }

/* Share cue: link nhẹ dẫn từ #story xuống #daily-share */
.share-cue-wrap {
    text-align: center;
    margin: var(--space-3) 0 var(--space-6);
}
.share-cue {
    display: inline-block;
    color: var(--text-soft);
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.05rem;
    text-decoration: none;
    padding: var(--space-2) var(--space-4);
    border-bottom: 1px dashed rgba(216, 180, 254, 0.3);
    transition: color 0.2s ease, border-color 0.2s ease;
}
.share-cue:hover {
    color: var(--lavender);
    border-color: var(--lavender);
}

/* ========== Daily share ========== */
.share-section {
    background: rgba(30, 41, 59, 0.5);
    z-index: 2;
}
.share-intro {
    max-width: 600px;
    margin: 0 auto;
}
.share-intro__title { margin-bottom: var(--space-5); color: #fff; }
.share-intro__lead  { color: var(--text-soft); font-size: 0.95rem; }

.share-form-card {
    background: rgba(255, 255, 255, 0.05);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(216, 180, 254, 0.1);
    margin-bottom: var(--space-5);
}
.share-form-row { text-align: left; margin-bottom: var(--space-4); }
.share-form-row:last-of-type { margin-bottom: var(--space-5); }
.share-form-row__label {
    display: block;
    color: var(--primary-color);
    margin-bottom: var(--space-2);
    font-weight: 600;
    font-size: 0.95rem;
}
.share-textarea {
    width: 100%;
    padding: var(--space-3);
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    border: 1px solid #334155;
    border-radius: var(--radius-md);
    height: 100px;
    resize: none;
    font-family: inherit;
}
.share-submit { width: 100%; font-family: var(--font-body); }

.share-list__head {
    color: #fff;
    font-size: 1rem;
    margin-bottom: var(--space-4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: var(--space-3);
}
.share-empty {
    color: var(--text-faint);
    font-size: 1rem;
    font-style: italic;
}
.share-card {
    text-align: left;
    background: rgba(30, 41, 59, 0.8);
    padding: 18px;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    border-left: 5px solid var(--primary-color);
    box-shadow: var(--shadow-md);
}
.share-card__head {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: var(--space-1);
}
.share-card__meta {
    font-size: 0.8rem;
    opacity: 0.7;
    color: var(--text-faint);
    font-weight: 400;
}
.share-card__msg {
    font-style: italic;
    color: var(--text-soft);
    white-space: pre-line;
    margin-top: var(--space-3);
}

/* --- MOOD CHIPS (radio dạng chip cho form chia sẻ) --- */
.mood-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    border: 0;
    padding: 0;
    margin: 0 0 var(--space-4);
}
.mood-chips label {
    cursor: pointer;
    display: inline-flex;
    position: relative;
}
.mood-chips input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.mood-chips label span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 14px;
    user-select: none;
    transition: all 0.15s ease;
}
.mood-chips label:hover span {
    border-color: rgba(216, 180, 254, 0.5);
    color: var(--text);
}
.mood-chips input:checked + span {
    background: var(--lavender-soft);
    border-color: var(--lavender);
    color: var(--lavender);
}
.mood-chips input:focus-visible + span {
    outline: 2px solid var(--lavender);
    outline-offset: 2px;
}

/* --- prefers-reduced-motion: tắt mọi animation/transition không thiết yếu --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
