/* --- Variables & Reset --- */
:root {
    --bg-color: #ffffff;
    --text-dark: #222222;
    --text-gray: #888888;
    --grid-gap: 8px; /* ช่องว่างระหว่างรูป บีบให้แคบลงแบบ Pixieset */
    --font-serif: 'Playfair Display', serif;
    --font-sans: 'Kanit', 'Kanit Fallback', sans-serif;
}
/* ปิดกรอบฟ้าเวลากดในมือถือ (Tap Highlight) สำหรับทุกองค์ประกอบทั้งเว็บ */
* {
    -webkit-tap-highlight-color: transparent;
}

/* ปิดเส้นขอบโฟกัส (Outline) เวลากดปุ่ม เลือกลิงก์ หรือช่องกรอกข้อความ */
button:focus, 
a:focus, 
input:focus,
textarea:focus {
    outline: none;
}

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

body {
    background-color: var(--bg-color);
    font-family: var(--font-sans);
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
}

/* --- Header & Navigation (แถบเมนูด้านบนสุด) --- */
.site-header {
    display: flex; /* จัดให้อยู่บรรทัดเดียวกันซ้าย-ขวา */
    justify-content: space-between;
    align-items: center;
    padding: 30px 5%;
    background-color: var(--bg-color);
}

.logo {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 2px; /* เพิ่มระยะห่างตัวอักษรให้ดูแพง */
}

.site-nav a {
    text-decoration: none;
    color: var(--text-gray);
    margin-left: 30px;
    font-size: 0.9rem;
    font-weight: 400;
    transition: color 0.3s ease;
}

.site-nav a.active {
    color: var(--text-dark);
}

@media (hover: hover) and (pointer: fine) {
    .site-nav a:hover {
        color: var(--text-dark);
    }
}

/* --- Hero Cover Section --- */
.hero-cover {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 95vh; /* ความสูงเกือบเต็มจอ */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 40px 20px;
    color: white;
    text-align: center;
}

.hero-cover::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(to bottom, rgba(0, 0, 0, 0.44) 0%, rgba(0, 0, 0, 0) 26%),
        linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.36) 38%, rgba(0, 0, 0, 0) 68%);
}

.hero-top-logo {
    position: relative;
    z-index: 2;
    font-size: 0.75rem;
    letter-spacing: 3px;
    font-weight: 500;
    text-transform: uppercase;
    opacity: 0.92;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.38);
}

.hero-content {
    position: relative;
    z-index: 2;
    margin-bottom: 5vh;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.38);
}

.hero-title {
    font-family: var(--font-main);
    font-size: 4.5rem;
    font-weight: 500; /* ใช้ตัวหนาปานกลางให้ดูโมเดิร์น */
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.hero-subtitle {
    font-size: 0.8rem;
    letter-spacing: 4px;
    font-weight: 400;
    margin-bottom: 40px;
    opacity: 0.9;
}

.view-gallery-btn {
    color: white;
    text-decoration: none;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255,255,255,0.5);
    padding-bottom: 5px;
    transition: all 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
    .view-gallery-btn:hover {
        border-bottom: 1px solid white;
        opacity: 0.8;
    }
}

/* --- Action Bar (Toolbar: แถวเดียว ชื่ออัลบั้ม+แบรนด์ซ้าย, ตะกร้า+เมนูขวา) --- */
.action-bar {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    min-height: 64px;
    padding: 14px 4%;
    background-color: var(--bg-color);
    position: sticky;
    top: 70px; /* ยึดเกาะใต้ .pg-navbar ไม่ทับซ้อนกัน */
    z-index: 100;
    border-bottom: 1px solid rgba(128, 128, 128, 0.15);
    box-sizing: border-box;
    transition: background-color 0.3s ease, top 0.3s ease;
}

.action-left {
    min-width: 0;
    flex: 1 1 auto;
    text-align: left;
}

.action-left h2 {
    font-family: var(--font-main);
    font-weight: 500;
    font-size: clamp(1.08rem, 2.2vw, 1.45rem);
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.action-left p {
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: var(--text-gray);
    text-transform: uppercase;
    margin: 0;
    text-align: left;
}

.action-left p.action-meta-line {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
}

.action-brand-label {
    flex-shrink: 0;
}

.action-photo-count {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
    text-transform: none;
    font-weight: 500;
    color: var(--text-gray);
    opacity: 0.92;
    overflow: hidden;
    text-overflow: ellipsis;
}

.action-photo-count[hidden] {
    display: none;
}

.action-photo-count::before {
    content: "•";
    margin-right: 6px;
    opacity: 0.55;
}

.action-right {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .action-bar {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        min-height: 58px;
        padding: 12px 4%;
        gap: 12px;
    }
    .action-right {
        gap: 14px;
    }
}

.text-link {
    font-size: 0.8rem;
    color: var(--text-gray);
    cursor: pointer;
    transition: color 0.3s;
}

@media (hover: hover) and (pointer: fine) {
    .text-link:hover { color: var(--text-dark); }
}

.divider {
    height: 15px;
    width: 1px;
    background-color: #ddd;
    margin: 0 5px;
}

.icon {
    width: 20px;
    height: 20px;
    color: var(--text-gray);
    cursor: pointer;
    transition: color 0.3s, transform 0.2s;
}

@media (hover: hover) and (pointer: fine) {
    .icon:hover {
        color: var(--text-dark);
        transform: scale(1.1);
    }
}

/* --- Masonry Gallery Grid --- */
.gallery-container {
    padding: 20px 4% 60px; /* ลด Padding ด้านบนให้ต่อจาก Action bar เนียนๆ */
}

/* --- Modern Masonry Gallery Tracks (Zero-Flicker & Zero-Layout-Shift) --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--grid-gap);
    align-items: start;
}

.gallery-column {
    display: flex;
    flex-direction: column;
    gap: var(--grid-gap);
    min-width: 0;
    width: 100%;
}

.gallery-item {
    position: relative;
    width: 100%;
    margin-bottom: 0;
    overflow: hidden;
    contain: layout style paint;
    background-color: rgba(125, 125, 125, 0.08);
    border-radius: 10px;
    box-sizing: border-box;
}

.gallery-item.is-inview:not(.loaded) {
    /* แถบ Shimmer Placeholder เฉพาะการ์ดที่เข้าใกล้หน้าจอ เพื่อไม่ให้การ์ดนอกจอรัน Animation ซ้อนกัน */
    background-image: linear-gradient(
        110deg,
        rgba(148, 163, 184, 0.06) 20%,
        rgba(148, 163, 184, 0.16) 50%,
        rgba(148, 163, 184, 0.06) 80%
    );
    background-size: 200% 100%;
    animation: pgShimmer 1.6s infinite linear;
}

.gallery-item.is-inview:not(.loaded)::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border-radius: 50%;
    border: 2px solid rgba(148, 163, 184, 0.22);
    border-top-color: rgba(148, 163, 184, 0.65);
    animation: pgPreloadSpin 0.8s linear infinite;
    pointer-events: none;
    z-index: 1;
}

.gallery-item.loaded {
    background-image: none;
    animation: none;
}

.gallery-item.loaded::after {
    display: none;
}

@keyframes pgShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes pgPreloadSpin {
    to { transform: rotate(360deg); }
}

.gallery-grid.ready .gallery-item {
    visibility: visible !important;
}

.gallery-item img.pro-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
    opacity: 0;
    color: transparent;
    font-size: 0;
    transition: opacity 0.35s ease, transform 0.3s ease;
}

.gallery-item img.pro-image.loaded {
    opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
    .gallery-item:hover img.pro-image.loaded {
        opacity: 0.88;
    }
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .gallery-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-title { font-size: 3.5rem; }
}

@media (max-width: 768px) {
    .hero-title { font-size: 2.5rem; }
}

@media (max-width: 580px) {
    .gallery-grid { grid-template-columns: 1fr; }
}

/* --- Collection (Folder) Page Styles --- */
.collection-container {
    padding: 24px 5% 60px;
    max-width: 1400px;
    margin: 0 auto;
    scroll-margin-top: 80px;
}

.collection-header {
    text-align: center;
    margin-bottom: 60px;
}

.collection-header h1 {
    font-size: 2.5rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.collection-header p {
    color: var(--text-gray);
    font-weight: 300;
}

/* --- Collection Toolbar & Filter Controls --- */
.collection-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 0;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.dark-mode .collection-toolbar {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.collection-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-dark);
    letter-spacing: -0.01em;
}

.collection-count-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-gray);
    letter-spacing: 0.2px;
}

.dark-mode .collection-count-badge {
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
}

.toolbar-right {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 344px;
    max-width: 100%;
    height: 42px;
    flex: 0 1 344px;
    contain: layout style;
}

/* Compact Album Grid Layout Switcher Pill (1/2/3 Mobile, 2/3/4 Desktop) */
.collection-layout-btn {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 42px;
    min-width: 50px;
    padding: 0 12px;
    border-radius: 9999px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.10);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    color: #27272a;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    white-space: nowrap;
    outline: none;
    transform: translate3d(0, 0, 0) scale(1);
    transform-origin: left center;
    opacity: 1;
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1) 0.04s,
                opacity 0.18s ease 0.04s,
                background-color 0.2s ease,
                border-color 0.2s ease,
                color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.collection-layout-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    transition: transform 0.26s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.collection-layout-icon svg {
    width: 15px;
    height: 15px;
    display: block;
}

.collection-layout-num {
    line-height: 1;
}

.collection-layout-btn:active {
    transform: translate3d(0, 0, 0) scale(0.94);
    transition-delay: 0s;
}

.collection-layout-btn.is-popping .collection-layout-icon {
    transform: scale(1.2) rotate(6deg);
}

@media (hover: hover) and (pointer: fine) {
    .collection-layout-btn:hover {
        border-color: rgba(0, 0, 0, 0.22);
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
        color: #111827;
    }
}

.toolbar-right.is-search-expanded .collection-layout-btn {
    z-index: 1;
    opacity: 0;
    transform: translate3d(-10px, 0, 0) scale(0.84);
    pointer-events: none;
    transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.14s ease;
}

/* Unified Collection Search + Inline Filter Pill */
.collection-search-filter-wrap {
    position: relative;
    width: 100%;
    padding-left: var(--pg-layout-slot, 60px);
    box-sizing: border-box;
    z-index: 2;
    pointer-events: none;
    will-change: padding-left;
    transition: padding-left 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.toolbar-right.is-search-expanded .collection-search-filter-wrap {
    padding-left: 0;
}

.collection-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    height: 42px;
    padding: 0 7px 0 15px;
    border-radius: 9999px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.10);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    transition: border-color 0.18s ease, background-color 0.18s ease;
    cursor: text;
    box-sizing: border-box;
    pointer-events: auto;
    contain: layout style;
}

@media (hover: hover) and (pointer: fine) {
    .collection-search-bar:not(.is-hover-suppressed):hover {
        border-color: rgba(0, 0, 0, 0.22);
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
    }
}

.collection-search-bar:focus-within {
    border-color: rgba(17, 17, 17, 0.36);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03), 0 0 0 2px rgba(17, 17, 17, 0.06);
}

.collection-search-icon {
    width: 16px;
    height: 16px;
    color: #71717a;
    flex-shrink: 0;
    transition: color 0.18s ease;
}

.collection-search-bar:focus-within .collection-search-icon {
    color: #111827;
}

.collection-search-bar input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.86rem;
    font-family: inherit;
    color: #111827;
    padding: 0;
}

.collection-search-bar input::placeholder {
    color: #9ca3af;
}

.collection-search-clear {
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    color: #52525b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.15s ease;
}

.collection-search-clear.hidden {
    display: none !important;
}

@media (hover: hover) and (pointer: fine) {
    .collection-search-clear:hover {
        background: rgba(0, 0, 0, 0.12);
        color: #111111;
    }
}

.collection-search-clear:active {
    transform: scale(0.92);
}

.collection-search-clear svg {
    width: 12px;
    height: 12px;
}

.collection-filter-inline-btn {
    position: relative;
    width: 30px;
    height: 30px;
    border-radius: 9999px;
    border: none;
    background: transparent;
    color: #3f3f46;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
    outline: none;
}

.collection-filter-inline-btn svg {
    width: 17px;
    height: 17px;
}

.collection-filter-inline-btn[aria-expanded="true"] {
    background: rgba(0, 0, 0, 0.06);
    color: #111111;
}

@media (hover: hover) and (pointer: fine) {
    .collection-filter-inline-btn:hover {
        background: rgba(0, 0, 0, 0.06);
        color: #111111;
    }
}

.collection-filter-inline-btn:active {
    transform: scale(0.94);
}

.collection-filter-inline-btn.has-filters {
    background: rgba(17, 17, 17, 0.08);
    color: #111111;
}

.collection-filter-inline-btn .filter-badge-count {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 15px;
    height: 15px;
    padding: 0 4px;
    font-size: 0.62rem;
    border: 1.5px solid #ffffff;
}

/* Dark Mode for Album Layout Switcher Pill */
.dark-mode .collection-layout-btn,
body.dark-mode .collection-layout-btn,
html.dark-mode .collection-layout-btn,
[data-theme="dark"] .collection-layout-btn {
    background: rgba(24, 24, 28, 0.94);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.32);
    color: #e4e4e7;
}

@media (hover: hover) and (pointer: fine) {
    .dark-mode .collection-layout-btn:hover,
    body.dark-mode .collection-layout-btn:hover,
    html.dark-mode .collection-layout-btn:hover,
    [data-theme="dark"] .collection-layout-btn:hover {
        border-color: rgba(255, 255, 255, 0.28);
        color: #ffffff;
    }
}

/* Dark Mode for Unified Collection Search + Inline Filter Pill */
.dark-mode .collection-search-bar,
body.dark-mode .collection-search-bar,
html.dark-mode .collection-search-bar,
[data-theme="dark"] .collection-search-bar {
    background: rgba(24, 24, 28, 0.94);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.32);
}

@media (hover: hover) and (pointer: fine) {
    .dark-mode .collection-search-bar:not(.is-hover-suppressed):hover,
    body.dark-mode .collection-search-bar:not(.is-hover-suppressed):hover,
    html.dark-mode .collection-search-bar:not(.is-hover-suppressed):hover,
    [data-theme="dark"] .collection-search-bar:not(.is-hover-suppressed):hover {
        border-color: rgba(255, 255, 255, 0.26);
    }
}

.dark-mode .collection-search-bar:focus-within,
body.dark-mode .collection-search-bar:focus-within,
html.dark-mode .collection-search-bar:focus-within,
[data-theme="dark"] .collection-search-bar:focus-within {
    border-color: rgba(255, 255, 255, 0.42);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.36), 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.dark-mode .collection-search-icon,
body.dark-mode .collection-search-icon,
html.dark-mode .collection-search-icon,
[data-theme="dark"] .collection-search-icon {
    color: #a1a1aa;
}

.dark-mode .collection-search-bar:focus-within .collection-search-icon,
body.dark-mode .collection-search-bar:focus-within .collection-search-icon,
html.dark-mode .collection-search-bar:focus-within .collection-search-icon,
[data-theme="dark"] .collection-search-bar:focus-within .collection-search-icon {
    color: #f4f4f5;
}

.dark-mode .collection-search-bar input,
body.dark-mode .collection-search-bar input,
html.dark-mode .collection-search-bar input,
[data-theme="dark"] .collection-search-bar input {
    color: #f4f4f5;
}

.dark-mode .collection-search-bar input::placeholder,
body.dark-mode .collection-search-bar input::placeholder,
html.dark-mode .collection-search-bar input::placeholder,
[data-theme="dark"] .collection-search-bar input::placeholder {
    color: #71717a;
}

.dark-mode .collection-search-clear,
body.dark-mode .collection-search-clear,
html.dark-mode .collection-search-clear,
[data-theme="dark"] .collection-search-clear {
    background: rgba(255, 255, 255, 0.12);
    color: #d4d4d8;
}

@media (hover: hover) and (pointer: fine) {
    .dark-mode .collection-search-clear:hover,
    body.dark-mode .collection-search-clear:hover,
    html.dark-mode .collection-search-clear:hover,
    [data-theme="dark"] .collection-search-clear:hover {
        background: rgba(255, 255, 255, 0.22);
        color: #ffffff;
    }
}

.dark-mode .collection-filter-inline-btn,
body.dark-mode .collection-filter-inline-btn,
html.dark-mode .collection-filter-inline-btn,
[data-theme="dark"] .collection-filter-inline-btn {
    color: #d4d4d8;
}

.dark-mode .collection-filter-inline-btn[aria-expanded="true"],
body.dark-mode .collection-filter-inline-btn[aria-expanded="true"],
html.dark-mode .collection-filter-inline-btn[aria-expanded="true"],
[data-theme="dark"] .collection-filter-inline-btn[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

@media (hover: hover) and (pointer: fine) {
    .dark-mode .collection-filter-inline-btn:hover,
    body.dark-mode .collection-filter-inline-btn:hover,
    html.dark-mode .collection-filter-inline-btn:hover,
    [data-theme="dark"] .collection-filter-inline-btn:hover {
        background: rgba(255, 255, 255, 0.12);
        color: #ffffff;
    }
}

.dark-mode .collection-filter-inline-btn.has-filters,
body.dark-mode .collection-filter-inline-btn.has-filters,
html.dark-mode .collection-filter-inline-btn.has-filters,
[data-theme="dark"] .collection-filter-inline-btn.has-filters {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

.dark-mode .collection-filter-inline-btn .filter-badge-count,
body.dark-mode .collection-filter-inline-btn .filter-badge-count,
html.dark-mode .collection-filter-inline-btn .filter-badge-count,
[data-theme="dark"] .collection-filter-inline-btn .filter-badge-count {
    border-color: #18181b;
}

/* Inline Push-down Filter & Sort Bar (กางแทรกดันการ์ดลง ไม่บังปกอัลบั้ม) */
.album-filter-pushbar {
    position: relative;
    z-index: 30;
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    margin: 0;
    transition: grid-template-rows 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.2s ease,
                margin 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0s linear 0.28s;
}

.album-filter-pushbar.open {
    grid-template-rows: 1fr;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    margin: 18px 0 0 0;
    transition: grid-template-rows 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.24s ease 0.04s,
                margin 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0s linear 0s;
}

.album-filter-pushbar-inner {
    overflow: hidden;
    min-height: 0;
}

.album-filter-pushbar.is-expanded .album-filter-pushbar-inner {
    overflow: visible;
}

.album-filter-pushbar-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    padding: 18px 20px;
    box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
}

body.dark-mode .album-filter-pushbar-card,
html.dark-mode .album-filter-pushbar-card,
[data-theme="dark"] .album-filter-pushbar-card {
    background: rgba(24, 24, 28, 0.94);
    border-color: rgba(255, 255, 255, 0.11);
    box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.45);
}

.album-filter-pushbar-fields {
    display: grid;
    grid-template-columns: minmax(110px, 0.9fr) minmax(125px, 1fr) minmax(130px, 1fr) minmax(145px, 1.15fr) auto;
    align-items: end;
    gap: 12px;
}

.album-filter-pushbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.album-filter-pushbar-actions .album-filter-modal-btn-reset,
.album-filter-pushbar-actions .album-filter-modal-btn-apply {
    height: 41px;
    padding: 0 18px;
    flex: 0 0 auto;
    white-space: nowrap;
}

/* Custom Accessible Select Dropdown (ไม่ใช้ Native Select Popup ที่เพี้ยนตำแหน่งบน macOS) */
.album-filter-select-wrap.is-custom {
    position: relative;
}

.album-filter-select-wrap.is-custom.is-open {
    z-index: 45;
}

.album-filter-native-select-hidden {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 1px !important;
    height: 1px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

.pg-cselect-trigger {
    width: 100%;
    height: 41px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background-color: rgba(0, 0, 0, 0.045);
    border: none;
    border-radius: 14px;
    padding: 0 13px 0 14px;
    font-size: 0.87rem;
    font-family: inherit;
    font-weight: 500;
    color: #111827;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    outline: none;
}

@media (hover: hover) and (pointer: fine) {
    .pg-cselect-trigger:hover {
        background-color: rgba(0, 0, 0, 0.075);
    }
}

.pg-cselect-trigger:focus-visible,
.album-filter-select-wrap.is-open .pg-cselect-trigger {
    background-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.14);
}

.pg-cselect-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pg-cselect-chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: #4b5563;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.album-filter-select-wrap.is-open .pg-cselect-chevron {
    transform: rotate(180deg);
}

.pg-cselect-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 100%;
    max-height: 230px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    padding: 5px;
    box-shadow: 0 16px 38px -8px rgba(0, 0, 0, 0.16), 0 4px 12px rgba(0, 0, 0, 0.06);
    z-index: 95;
    box-sizing: border-box;
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
    transform-origin: top center;
    transition: opacity 0.15s ease, transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.pg-cselect-menu.open {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.pg-cselect-menu[hidden] {
    display: none;
}

.pg-cselect-option {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #1f2937;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    box-sizing: border-box;
}

@media (hover: hover) and (pointer: fine) {
    .pg-cselect-option:hover {
        background: rgba(0, 0, 0, 0.05);
        color: #111827;
    }
}

.pg-cselect-option.is-selected {
    background: #111827;
    color: #ffffff;
    font-weight: 600;
}

.pg-cselect-option svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

/* Dark Mode for Custom Select */
body.dark-mode .pg-cselect-trigger,
html.dark-mode .pg-cselect-trigger,
[data-theme="dark"] .pg-cselect-trigger {
    background-color: rgba(255, 255, 255, 0.07);
    color: #f4f4f5;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pg-cselect-trigger:hover,
    html.dark-mode .pg-cselect-trigger:hover,
    [data-theme="dark"] .pg-cselect-trigger:hover {
        background-color: rgba(255, 255, 255, 0.11);
    }
}

body.dark-mode .pg-cselect-trigger:focus-visible,
body.dark-mode .album-filter-select-wrap.is-open .pg-cselect-trigger,
html.dark-mode .pg-cselect-trigger:focus-visible,
html.dark-mode .album-filter-select-wrap.is-open .pg-cselect-trigger,
[data-theme="dark"] .pg-cselect-trigger:focus-visible,
[data-theme="dark"] .album-filter-select-wrap.is-open .pg-cselect-trigger {
    background-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22);
}

body.dark-mode .pg-cselect-chevron,
html.dark-mode .pg-cselect-chevron,
[data-theme="dark"] .pg-cselect-chevron {
    color: #a1a1aa;
}

body.dark-mode .pg-cselect-menu,
html.dark-mode .pg-cselect-menu,
[data-theme="dark"] .pg-cselect-menu {
    background: #18181b;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.65), 0 4px 12px rgba(0, 0, 0, 0.4);
}

body.dark-mode .pg-cselect-option,
html.dark-mode .pg-cselect-option,
[data-theme="dark"] .pg-cselect-option {
    color: #e4e4e7;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pg-cselect-option:hover,
    html.dark-mode .pg-cselect-option:hover,
    [data-theme="dark"] .pg-cselect-option:hover {
        background: rgba(255, 255, 255, 0.08);
        color: #ffffff;
    }
}

body.dark-mode .pg-cselect-option.is-selected,
html.dark-mode .pg-cselect-option.is-selected,
[data-theme="dark"] .pg-cselect-option.is-selected {
    background: #ffffff;
    color: #111111;
}

@media (max-width: 980px) {
    .album-filter-pushbar-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
    .album-filter-pushbar-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }
}

/* ปุ่มเปิด Modal ตัวกรองอัลบั้มแบบมินิมอล & ลีน (Single Filter Button) */
.collection-filter-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    height: 36px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-dark, #1e293b);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    user-select: none;
    box-sizing: border-box;
    white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) {
    .collection-filter-trigger-btn:hover {
        border-color: rgba(17, 17, 17, 0.35);
        color: #111111;
        background: #f4f4f5;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    }
}

.collection-filter-trigger-btn:active {
    transform: scale(0.98);
}

.collection-filter-trigger-btn svg {
    width: 14px;
    height: 14px;
    stroke-width: 2.2;
    flex-shrink: 0;
}

.collection-filter-trigger-btn.has-filters {
    border-color: #111111;
    background: rgba(17, 17, 17, 0.05);
    color: #111111;
}

.filter-badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    border-radius: 9999px;
    background: #111111;
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
}

.filter-badge-count.hidden {
    display: none !important;
}

/* Dark Mode for Filter Trigger Button */
.dark-mode .collection-filter-trigger-btn,
body.dark-mode .collection-filter-trigger-btn,
html.dark-mode .collection-filter-trigger-btn,
[data-theme="dark"] .collection-filter-trigger-btn {
    background: #18181b;
    border-color: rgba(255, 255, 255, 0.14);
    color: #f4f4f5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

@media (hover: hover) and (pointer: fine) {
    .dark-mode .collection-filter-trigger-btn:hover,
    body.dark-mode .collection-filter-trigger-btn:hover,
    html.dark-mode .collection-filter-trigger-btn:hover,
    [data-theme="dark"] .collection-filter-trigger-btn:hover {
        border-color: rgba(255, 255, 255, 0.42);
        color: #ffffff;
        background: rgba(255, 255, 255, 0.1);
    }
}

.dark-mode .collection-filter-trigger-btn.has-filters,
body.dark-mode .collection-filter-trigger-btn.has-filters,
html.dark-mode .collection-filter-trigger-btn.has-filters,
[data-theme="dark"] .collection-filter-trigger-btn.has-filters {
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.dark-mode .filter-badge-count,
body.dark-mode .filter-badge-count,
html.dark-mode .filter-badge-count,
[data-theme="dark"] .filter-badge-count {
    background: #ffffff;
    color: #111111;
}

/* Album Filter Modal Card Styles — Minimal Glassmorphism */
#albumFilterModal.pg-modal-overlay {
    background: rgba(15, 23, 42, 0.34);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 16px;
}

body.dark-mode #albumFilterModal.pg-modal-overlay,
html.dark-mode #albumFilterModal.pg-modal-overlay,
[data-theme="dark"] #albumFilterModal.pg-modal-overlay {
    background: rgba(0, 0, 0, 0.62);
}

.album-filter-modal-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.88) 0%, rgba(255, 255, 255, 0.76) 100%);
    backdrop-filter: blur(32px) saturate(180%);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    border: none;
    border-radius: 28px;
    width: 100%;
    max-width: 420px;
    padding: 26px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.16), 0 4px 16px rgba(0, 0, 0, 0.05);
    font-family: var(--font-sans, 'Kanit', sans-serif);
    color: #111827;
    position: relative;
    box-sizing: border-box;
}

body.dark-mode .album-filter-modal-card,
html.dark-mode .album-filter-modal-card,
[data-theme="dark"] .album-filter-modal-card {
    background: linear-gradient(145deg, rgba(39, 39, 42, 0.86) 0%, rgba(18, 18, 20, 0.9) 100%);
    border: none;
    color: #f4f4f5;
    box-shadow: 0 28px 64px rgba(0, 0, 0, 0.65), 0 4px 16px rgba(0, 0, 0, 0.4);
}

.album-filter-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
    padding-bottom: 0;
    border: none;
}

.album-filter-modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.album-filter-modal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.055);
    color: #111827;
    flex-shrink: 0;
}

body.dark-mode .album-filter-modal-icon,
html.dark-mode .album-filter-modal-icon,
[data-theme="dark"] .album-filter-modal-icon {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.album-filter-modal-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.album-filter-modal-card .pg-modal-title {
    font-size: 1.12rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

body.dark-mode .album-filter-modal-card .pg-modal-title,
html.dark-mode .album-filter-modal-card .pg-modal-title,
[data-theme="dark"] .album-filter-modal-card .pg-modal-title {
    color: #f9fafb;
}

.album-filter-modal-subtitle {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 400;
    color: #6b7280;
    line-height: 1.35;
}

body.dark-mode .album-filter-modal-subtitle,
html.dark-mode .album-filter-modal-subtitle,
[data-theme="dark"] .album-filter-modal-subtitle {
    color: #a1a1aa;
}

.album-filter-modal-card .pg-modal-close {
    position: static;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    color: #4b5563;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .album-filter-modal-card .pg-modal-close:hover {
        background: rgba(0, 0, 0, 0.1);
        color: #111827;
        transform: scale(1.04);
    }
}

body.dark-mode .album-filter-modal-card .pg-modal-close,
html.dark-mode .album-filter-modal-card .pg-modal-close,
[data-theme="dark"] .album-filter-modal-card .pg-modal-close {
    background: rgba(255, 255, 255, 0.08);
    color: #a1a1aa;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .album-filter-modal-card .pg-modal-close:hover,
    html.dark-mode .album-filter-modal-card .pg-modal-close:hover,
    [data-theme="dark"] .album-filter-modal-card .pg-modal-close:hover {
        background: rgba(255, 255, 255, 0.16);
        color: #ffffff;
    }
}

.album-filter-modal-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
}

.album-filter-row-2col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.album-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.album-filter-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    color: #4b5563;
    padding-left: 4px;
}

body.dark-mode .album-filter-label,
html.dark-mode .album-filter-label,
[data-theme="dark"] .album-filter-label {
    color: #a1a1aa;
}

.album-filter-select-wrap {
    position: relative;
    width: 100%;
}

.album-filter-modal-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: rgba(0, 0, 0, 0.045);
    border: none;
    border-radius: 16px;
    padding: 11px 34px 11px 14px;
    font-size: 0.88rem;
    font-family: inherit;
    font-weight: 500;
    color: #111827;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    box-sizing: border-box;
    text-overflow: ellipsis;
}

@media (hover: hover) and (pointer: fine) {
    .album-filter-modal-select:hover {
        background-color: rgba(0, 0, 0, 0.075);
    }
}

.album-filter-modal-select:focus {
    outline: none;
    background-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.14);
}

body.dark-mode .album-filter-modal-select,
html.dark-mode .album-filter-modal-select,
[data-theme="dark"] .album-filter-modal-select {
    background-color: rgba(255, 255, 255, 0.07);
    border: none;
    color: #f4f4f5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

body.dark-mode .album-filter-modal-select option,
html.dark-mode .album-filter-modal-select option,
[data-theme="dark"] .album-filter-modal-select option {
    background-color: #18181b;
    color: #f4f4f5;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .album-filter-modal-select:hover,
    html.dark-mode .album-filter-modal-select:hover,
    [data-theme="dark"] .album-filter-modal-select:hover {
        background-color: rgba(255, 255, 255, 0.11);
    }
}

body.dark-mode .album-filter-modal-select:focus,
html.dark-mode .album-filter-modal-select:focus,
[data-theme="dark"] .album-filter-modal-select:focus {
    background-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22);
}

.album-filter-modal-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 0;
    border: none;
}

.album-filter-modal-btn-reset {
    padding: 11px 18px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 9999px;
    color: #4b5563;
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
}

@media (hover: hover) and (pointer: fine) {
    .album-filter-modal-btn-reset:hover {
        background: rgba(239, 68, 68, 0.1);
        color: #dc2626;
    }
}

body.dark-mode .album-filter-modal-btn-reset,
html.dark-mode .album-filter-modal-btn-reset,
[data-theme="dark"] .album-filter-modal-btn-reset {
    background: rgba(255, 255, 255, 0.08);
    color: #a1a1aa;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .album-filter-modal-btn-reset:hover,
    html.dark-mode .album-filter-modal-btn-reset:hover,
    [data-theme="dark"] .album-filter-modal-btn-reset:hover {
        background: rgba(239, 68, 68, 0.18);
        color: #f87171;
    }
}

.album-filter-modal-btn-apply {
    flex: 1;
    padding: 11px 22px;
    background: #111827;
    border: none;
    border-radius: 9999px;
    color: #ffffff;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 8px 20px rgba(17, 24, 39, 0.18);
}

@media (hover: hover) and (pointer: fine) {
    .album-filter-modal-btn-apply:hover {
        background: #1f2937;
        transform: translateY(-1px);
        box-shadow: 0 10px 24px rgba(17, 24, 39, 0.24);
    }
}

.album-filter-modal-btn-apply:active {
    transform: translateY(0);
}

body.dark-mode .album-filter-modal-btn-apply,
html.dark-mode .album-filter-modal-btn-apply,
[data-theme="dark"] .album-filter-modal-btn-apply {
    background: #ffffff;
    color: #111827;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .album-filter-modal-btn-apply:hover,
    html.dark-mode .album-filter-modal-btn-apply:hover,
    [data-theme="dark"] .album-filter-modal-btn-apply:hover {
        background: #f4f4f5;
        box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
    }
}

@media (max-width: 520px) {
    .album-filter-modal-card {
        padding: 22px 18px;
        border-radius: 24px;
    }

    .album-filter-modal-header {
        margin-bottom: 18px;
    }

    .album-filter-modal-icon {
        width: 38px;
        height: 38px;
    }

    .album-filter-modal-card .pg-modal-title {
        font-size: 1.04rem;
    }

    .album-filter-modal-subtitle {
        font-size: 0.74rem;
    }

    .album-filter-row-2col {
        gap: 10px;
    }

    .album-filter-modal-select {
        padding: 10px 30px 10px 12px;
        font-size: 0.84rem;
        border-radius: 14px;
    }

    .album-filter-modal-btn-reset,
    .album-filter-modal-btn-apply {
        padding: 10.5px 16px;
        font-size: 0.84rem;
    }
}

.filter-select-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.filter-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--bg-color);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    padding: 8px 32px 8px 14px;
    font-size: 0.82rem;
    font-family: inherit;
    font-weight: 400;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 11px;
}

@media (hover: hover) and (pointer: fine) {
    .filter-select:hover {
        border-color: rgba(0, 0, 0, 0.25);
    }
}

.filter-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.dark-mode .filter-select {
    background-color: #171923;
    border-color: rgba(255, 255, 255, 0.14);
    color: #e2e8f0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

@media (hover: hover) and (pointer: fine) {
    .dark-mode .filter-select:hover {
        border-color: rgba(255, 255, 255, 0.28);
    }
}

.dark-mode .filter-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* ปุ่มล้างตัวกรองแบบลีน (Lean & Flat Reset Button) */
.filter-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    height: 36px;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: inherit;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.06);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.22);
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    user-select: none;
}

@media (hover: hover) and (pointer: fine) {
    .filter-reset-btn:hover {
        background: rgba(239, 68, 68, 0.12);
        border-color: rgba(239, 68, 68, 0.35);
        color: #dc2626;
    }
}

.filter-reset-btn:active {
    transform: scale(0.98);
}

.filter-reset-btn svg {
    width: 13px;
    height: 13px;
    stroke-width: 2.2;
    flex-shrink: 0;
}

.dark-mode .filter-reset-btn,
body.dark-mode .filter-reset-btn,
html.dark-mode .filter-reset-btn,
[data-theme="dark"] .filter-reset-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
}

@media (hover: hover) and (pointer: fine) {
    .dark-mode .filter-reset-btn:hover,
    body.dark-mode .filter-reset-btn:hover,
    html.dark-mode .filter-reset-btn:hover,
    [data-theme="dark"] .filter-reset-btn:hover {
        background: rgba(239, 68, 68, 0.18);
        border-color: rgba(239, 68, 68, 0.4);
        color: #fca5a5;
    }
}

.filter-reset-btn.hidden {
    display: none !important;
}

.filter-btn-text-short,
.filter-reset-text-short {
    display: none;
}

/* Visibility Badge on Album Cover (Matched with profile.php "อัลบั้มของฉัน" Glass Badge) */
.folder-visibility-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 9999px;
    background: rgba(24, 24, 27, 0.62);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0;
    border: none;
    pointer-events: none;
}
.folder-visibility-badge span {
    font-size: inherit;
    font-weight: inherit;
    color: #ffffff;
    letter-spacing: 0;
}
.folder-visibility-badge svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    color: #ffffff;
}

/* No Albums Found state */
.no-albums-match {
    text-align: center;
    padding: 70px 20px;
    color: var(--text-gray);
    width: 100%;
    grid-column: 1 / -1;
}

.no-albums-match svg {
    margin: 0 auto 16px;
    opacity: 0.45;
}

.no-albums-match h3 {
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.no-albums-match p {
    font-size: 0.85rem;
    color: var(--text-gray);
    margin-bottom: 18px;
}

.no-albums-match .inline-reset {
    margin-top: 6px;
}

.no-albums-match.hidden {
    display: none !important;
}

@media (max-width: 640px) {
    .collection-toolbar {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        margin-bottom: 0;
        padding-bottom: 16px;
    }
    .toolbar-left {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
    .toolbar-right {
        width: 100%;
        height: 46px;
        flex: none;
    }
    .collection-layout-btn {
        height: 46px;
        min-width: 52px;
        padding: 0 13px;
        font-size: 0.8rem;
    }
    .collection-search-bar:focus-within {
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    }
    .dark-mode .collection-search-bar:focus-within,
    body.dark-mode .collection-search-bar:focus-within,
    html.dark-mode .collection-search-bar:focus-within,
    [data-theme="dark"] .collection-search-bar:focus-within {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.32);
    }
    html[data-pg-album-cols-mobile="1"] .folder-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
    }
    html[data-pg-album-cols-mobile="2"] .folder-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }
    html[data-pg-album-cols-mobile="2"] .folder-item,
    html[data-pg-album-cols-mobile="3"] .folder-item {
        contain-intrinsic-size: auto 190px;
    }
    html[data-pg-album-cols-mobile="2"] .folder-image {
        margin-bottom: 10px;
        border-radius: 8px;
    }
    html[data-pg-album-cols-mobile="2"] .folder-info h3 {
        font-size: 0.94rem;
        line-height: 1.32;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    html[data-pg-album-cols-mobile="2"] .folder-info span {
        font-size: 0.72rem;
    }
    html[data-pg-album-cols-mobile="3"] .folder-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
    }
    html[data-pg-album-cols-mobile="3"] .folder-image {
        margin-bottom: 7px;
        border-radius: 8px;
    }
    html[data-pg-album-cols-mobile="3"] .folder-info h3 {
        font-size: 0.78rem;
        line-height: 1.28;
        margin-bottom: 2px;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    html[data-pg-album-cols-mobile="3"] .folder-info span {
        font-size: 0.65rem;
        letter-spacing: 0.2px;
    }
    html[data-pg-album-cols-mobile="2"] .folder-visibility-badge {
        top: 8px;
        right: 8px;
        width: 26px;
        height: 26px;
        padding: 0;
        justify-content: center;
        gap: 0;
    }
    html[data-pg-album-cols-mobile="3"] .folder-visibility-badge {
        top: 6px;
        right: 6px;
        width: 22px;
        height: 22px;
        padding: 0;
        justify-content: center;
        gap: 0;
    }
    html[data-pg-album-cols-mobile="2"] .folder-visibility-badge span,
    html[data-pg-album-cols-mobile="3"] .folder-visibility-badge span {
        display: none;
    }
    .collection-search-bar {
        height: 46px;
        padding: 0 9px 0 16px;
    }
    .collection-search-bar input {
        font-size: 16px;
    }
    .collection-filter-inline-btn {
        width: 34px;
        height: 34px;
    }
    .album-filter-pushbar {
        margin: 0;
    }
    .album-filter-pushbar.open {
        margin: 14px 0 0 0;
    }
    .folder-grid {
        margin-top: 22px;
    }
    .album-filter-pushbar-card {
        padding: 16px;
        border-radius: 18px;
    }
    .album-filter-pushbar-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
    .album-filter-pushbar-actions {
        grid-column: 1 / -1;
    }
    .album-filter-pushbar-actions {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 8px;
        margin-top: 2px;
    }
    .collection-filter-trigger-btn {
        flex: 1 1 auto;
        min-width: 0;
        justify-content: center;
        padding: 6px 12px;
        height: 36px;
        font-size: 0.8rem;
    }
    .filter-reset-btn {
        flex: 0 0 auto;
        justify-content: center;
        padding: 6px 12px;
        height: 36px;
        font-size: 0.8rem;
    }
}

@media (max-width: 360px) {
    .album-filter-pushbar-fields {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .filter-btn-text-full {
        display: none;
    }
    .filter-btn-text-short {
        display: inline;
    }
}

@media (max-width: 360px) {
    .filter-reset-text-full {
        display: none;
    }
    .filter-reset-text-short {
        display: inline;
    }
}

/* Grid สำหรับเรียงโฟลเดอร์ */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 40px;
    margin-top: 30px;
}

@media (min-width: 641px) {
    html[data-pg-album-cols-desktop="2"] .folder-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 36px;
    }
    html[data-pg-album-cols-desktop="3"] .folder-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 32px;
    }
    html[data-pg-album-cols-desktop="4"] .folder-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 24px;
    }
    html[data-pg-album-cols-desktop="4"] .folder-image {
        margin-bottom: 12px;
    }
    html[data-pg-album-cols-desktop="4"] .folder-info h3 {
        font-size: 1.05rem;
    }
}

@media (min-width: 641px) and (max-width: 960px) {
    html[data-pg-album-cols-desktop="3"] .folder-grid {
        gap: 22px;
    }
    html[data-pg-album-cols-desktop="4"] .folder-grid {
        gap: 16px;
    }
}

.folder-item {
    text-decoration: none;
    color: var(--text-dark);
    display: block;
    transition: transform 0.3s ease;
    content-visibility: auto;
    contain-intrinsic-size: auto 340px;
}

.folder-grid.is-layout-animating .folder-item:hover {
    transform: none;
}

.folder-image {
    width: 100%;
    aspect-ratio: 4 / 3; /* บังคับสัดส่วนหน้าปกให้เท่ากันทุกโฟลเดอร์ */
    background-size: cover;
    background-position: center;
    background-color: #2a2a2a;
    border-radius: 4px;
    margin-bottom: 15px;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.folder-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
    .folder-item:hover {
        transform: translateY(-5px); /* เวลานำเมาส์ชี้ โฟลเดอร์จะลอยขึ้นนิดๆ */
    }

    .folder-item:hover .folder-image,
    .folder-item:hover .folder-cover-img {
        opacity: 0.85;
    }
}

@media (prefers-reduced-motion: reduce) {
    .toolbar-right,
    .collection-layout-btn,
    .collection-layout-icon,
    .collection-search-filter-wrap {
        transition: none !important;
    }
}

.folder-info h3 {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 5px;
}

.folder-info span {
    font-size: 0.8rem;
    color: var(--text-gray);
    letter-spacing: 1px;
}

/* --- Dark Mode Colors --- */
body.dark-mode {
    --bg-color: #111111;
    --text-dark: #ffffff;
    --text-gray: #888888;
}

/* ปุ่ม Dark Mode Toggle Switch Pill */
.theme-switch-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 58px;
    height: 30px;
    padding: 3px;
    border-radius: 9999px;
    background-color: #ffffff;
    border: 1px solid #e4e4e7;
    cursor: pointer;
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.2s ease,
                transform 0.15s ease;
    box-sizing: border-box;
    flex-shrink: 0;
    vertical-align: middle;
}

.theme-switch-pill:focus-visible {
    box-shadow: 0 0 0 2px #3b82f6;
}

@media (hover: hover) and (pointer: fine) {
    .theme-switch-pill:hover {
        border-color: #d4d4d8;
    }
}

.theme-switch-pill:active {
    transform: scale(0.97);
}

.theme-switch-pill .theme-switch-track {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
    pointer-events: none;
}

.theme-switch-pill .theme-switch-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    flex-shrink: 0;
}

.theme-switch-pill .theme-switch-icon svg {
    width: 13.5px;
    height: 13.5px;
    display: block;
    stroke: currentColor;
}

.theme-switch-pill .theme-switch-icon.moon {
    color: #a1a1aa;
}

.theme-switch-pill .theme-switch-icon.sun {
    color: #374151;
}

.theme-switch-pill .theme-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    background-color: #e5e7eb;
    transform: translateX(28px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                background-color 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
    pointer-events: none;
}

html.dark-mode .theme-switch-pill,
body.dark-mode .theme-switch-pill,
[data-theme="dark"] .theme-switch-pill,
html.dark .theme-switch-pill,
.theme-switch-pill.is-dark {
    background-color: #09090b !important;
    border-color: #27272a !important;
}

@media (hover: hover) and (pointer: fine) {
    html.dark-mode .theme-switch-pill:hover,
    body.dark-mode .theme-switch-pill:hover,
    [data-theme="dark"] .theme-switch-pill:hover,
    html.dark .theme-switch-pill:hover,
    .theme-switch-pill.is-dark:hover {
        border-color: #3f3f46 !important;
    }
}

html.dark-mode .theme-switch-pill .theme-switch-thumb,
body.dark-mode .theme-switch-pill .theme-switch-thumb,
[data-theme="dark"] .theme-switch-pill .theme-switch-thumb,
html.dark .theme-switch-pill .theme-switch-thumb,
.theme-switch-pill.is-dark .theme-switch-thumb {
    background-color: #27272a !important;
    transform: translateX(0) !important;
}

html.dark-mode .theme-switch-pill .theme-switch-icon.moon,
body.dark-mode .theme-switch-pill .theme-switch-icon.moon,
[data-theme="dark"] .theme-switch-pill .theme-switch-icon.moon,
html.dark .theme-switch-pill .theme-switch-icon.moon,
.theme-switch-pill.is-dark .theme-switch-icon.moon {
    color: #ffffff !important;
}

html.dark-mode .theme-switch-pill .theme-switch-icon.sun,
body.dark-mode .theme-switch-pill .theme-switch-icon.sun,
[data-theme="dark"] .theme-switch-pill .theme-switch-icon.sun,
html.dark .theme-switch-pill .theme-switch-icon.sun,
.theme-switch-pill.is-dark .theme-switch-icon.sun {
    color: #71717a !important;
}

@media (max-width: 640px) {
    .theme-switch-pill {
        width: 52px;
        height: 27px;
        padding: 2px;
    }

    .theme-switch-pill .theme-switch-icon {
        width: 21px;
        height: 21px;
    }

    .theme-switch-pill .theme-switch-icon svg {
        width: 12px;
        height: 12px;
    }

    .theme-switch-pill .theme-switch-thumb {
        top: 2px;
        left: 2px;
        width: 21px;
        height: 21px;
        transform: translateX(25px);
    }

    html.dark-mode .theme-switch-pill .theme-switch-thumb,
    body.dark-mode .theme-switch-pill .theme-switch-thumb,
    [data-theme="dark"] .theme-switch-pill .theme-switch-thumb,
    html.dark .theme-switch-pill .theme-switch-thumb,
    .theme-switch-pill.is-dark .theme-switch-thumb {
        transform: translateX(0) !important;
    }
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    vertical-align: middle;
}

/* --- Filter Menu --- */
.filter-menu {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
}

.filter-btn {
    background: none;
    border: none;
    font-family: var(--font-main);
    font-size: 0.85rem;
    color: var(--text-gray);
    cursor: pointer;
    padding-bottom: 5px;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.filter-btn.active {
    color: var(--text-dark);
    border-bottom: 1px solid var(--text-dark);
}

@media (hover: hover) and (pointer: fine) {
    .filter-btn:hover {
        color: var(--text-dark);
        border-bottom: 1px solid var(--text-dark);
    }
}

/* --- Lock Icon --- */
.folder-image {
    position: relative; /* สำคัญมาก เพื่อให้ไอคอนล็อกอยู่ข้างในรูป */
}

.lock-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px); /* ทำพื้นหลังเบลอนิดๆ ดูแพง */
    color: white;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lock-icon svg { width: 12px; height: 12px; }

/* ซ่อนโฟลเดอร์เวลาโดน Filter */
.folder-item.hidden {
    display: none;
}

/* =========================================
   Responsive Design (แท็บเล็ตและโทรศัพท์มือถือ)
   ========================================= */

/* สำหรับ iPad และหน้าจอที่เล็กกว่า 768px */
@media (max-width: 768px) {
    /* 1. จัด Header ใหม่ให้เรียงลงมาตรงกลาง */
    .site-header {
        flex-direction: column;
        gap: 15px;
        padding: 20px 5%;
        text-align: center;
    }
    
    /* 2. จัดเมนู Navigation ให้มีระยะห่างสมดุล */
    .site-nav {
        display: flex;
        justify-content: center;
        align-items: center;
        flex-wrap: wrap;
        gap: 20px;
    }

    .site-nav a {
        margin-left: 0; /* ลบ margin ซ้ายของเดิมทิ้ง */
        font-size: 0.85rem;
    }

    .theme-toggle {
        margin-left: 0;
    }

    /* 3. ลดขนาดหัวข้อลงนิดหน่อย */
    .collection-header h1 {
        font-size: 2rem;
    }

    /* 4. ปรับกริดโฟลเดอร์ให้รูปเล็กลงนิดนึงจะได้พอดีจอ iPad */
    .folder-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 25px;
    }
}

/* สำหรับสมาร์ทโฟน หน้าจอเล็กกว่า 480px */
@media (max-width: 480px) {
    /* ป้องกันโลโก้ตกบรรทัด */
    .logo {
        font-size: 1rem;
        white-space: nowrap; 
    }

    /* เพิ่มระยะห่างปุ่ม Filter เวลาถูกดันลงมาบรรทัดใหม่ */
    .filter-menu {
        gap: 15px;
    }

    .filter-btn {
        font-size: 0.75rem;
    }

    /* ปรับระยะห่างรวมของ Container ไม่ให้ชิดขอบจอเกินไป */
    .collection-container {
        padding: 16px 5% 40px;
        scroll-margin-top: 70px;
    }
}

/* =========================================
   Lightbox (ระบบขยายรูปภาพเต็มจอ สไตล์ Threads / iOS Pop-Spring)
   ========================================= */
.lightbox {
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    display: flex; 
    justify-content: center; 
    align-items: center;
    z-index: 99990;
    
    /* ซ่อนแบบสมูท ลื่นไหล 60/120fps สไตล์ Threads (Single-Balloon Architecture) */
    opacity: 0; 
    visibility: hidden;
    pointer-events: none;
    transition: background-color 0.26s cubic-bezier(0.22, 1, 0.36, 1);
    overscroll-behavior: none;
    touch-action: none;
}

.lightbox.is-animating {
    opacity: 1;
    visibility: visible;
    pointer-events: none;
}

.lightbox.active {
    opacity: 1; 
    visibility: visible;
    pointer-events: auto;
    background-color: rgba(0, 0, 0, 0.94);
}

.lightbox.is-closing {
    /* คง opacity: 1 ของ Container ไว้เพื่อให้ #lightbox-img (ลูกโป่งใบเดียว) หดกลับเข้าการ์ดได้โดยไม่จางหายไปก่อน */
    opacity: 1;
    visibility: visible;
    pointer-events: none;
    background-color: rgba(0, 0, 0, 0) !important;
    transition: background-color 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ล็อกการเลื่อนหน้าเว็บพื้นหลังผ่าน JS scroll lock เพื่อไม่ให้ overflow: hidden ทำลาย position: sticky ของ Action bar */
html.lightbox-open,
body.lightbox-open {
    overscroll-behavior: none !important;
}

/* ซ่อนเฉพาะปุ่ม Back to Top ขณะเปิดดูรูปภาพเต็มจอ (คง .pg-navbar และ #action-bar ไว้นิ่งด้านหลัง Lightbox) */
body.lightbox-open .back-to-top-btn,
body.lightbox-open #back-to-top,
.lightbox.active ~ .back-to-top-btn,
.lightbox.is-closing ~ .back-to-top-btn {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* ภาพหลัก (Single-Balloon GPU Element): พองและหดด้วย transform + clip-path บน GPU ล้วน 100% ไร้การสลับ Element */
.lightbox-img {
    max-width: calc(100vw - 140px);
    max-height: calc(100vh - 160px);
    object-fit: cover;
    border-radius: 0px;
    box-shadow: none !important;
    opacity: 1;
    transform-origin: center center;
    translate: 0px 0px 0px;
    scale: 1;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: translate, scale, clip-path;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

/* Neighbor slides for Ultra-Smooth 3-Slot GPU Carousel */
.lightbox-slide-neighbor {
    position: absolute;
    max-width: none;
    max-height: none;
    object-fit: cover;
    border-radius: 0px;
    box-shadow: none !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform-origin: center center;
    translate: 0px 0px 0px;
    scale: 1;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: translate, opacity;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

.lightbox.is-dragging .close-lightbox,
.lightbox.is-dragging .lightbox-counter,
.lightbox.is-dragging .lightbox-top-actions,
.lightbox.is-dragging .lightbox-actions-bar,
.lightbox.is-dragging .lightbox-nav,
.lightbox.is-closing .close-lightbox,
.lightbox.is-closing .lightbox-counter,
.lightbox.is-closing .lightbox-top-actions,
.lightbox.is-closing .lightbox-actions-bar,
.lightbox.is-closing .lightbox-nav {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.14s ease !important;
}

/* ตัวนับลำดับภาพใน Lightbox (เช่น 1/2) */
.lightbox-counter {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 7px 14px;
    border-radius: 9999px;
    background: rgba(24, 24, 27, 0.62);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: rgba(255, 255, 255, 0.94);
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    pointer-events: none;
    user-select: none;
    z-index: 10002;
    opacity: 0;
    transition: opacity 0.24s ease;
}

.lightbox.active .lightbox-counter {
    opacity: 1;
}

/* ปุ่มกากบาทปิด (มินิมอลไร้กรอบ อยู่ฝั่งซ้ายบน) */
.close-lightbox {
    position: absolute; 
    top: 24px; 
    left: 24px;
    right: auto;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.88); 
    font-size: 24px; 
    line-height: 1;
    font-family: var(--font-main, sans-serif);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10003;
    padding: 0;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.24s ease, transform 0.26s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease, color 0.2s ease;
}

.lightbox.active .close-lightbox {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 0.28s ease, transform 0.34s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease, color 0.2s ease;
    transition-delay: 0.08s;
}

.close-lightbox svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

@media (hover: hover) and (pointer: fine) {
    .close-lightbox:hover { 
        background: rgba(255, 255, 255, 0.16);
        color: #ffffff;
        transform: translateY(0) scale(1.06);
        transition-delay: 0s;
    }
}

.close-lightbox:active {
    transform: translateY(0) scale(0.95);
    transition-delay: 0s;
}

/* แถบรวมปุ่มฝั่งขวาบน (ถูกใจ & ขอซ่อนรูป มินิมอลไร้กรอบ) */
.lightbox-top-actions {
    position: absolute;
    top: 24px;
    right: 24px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    border-radius: 9999px;
    background: rgba(24, 24, 27, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 10003;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.24s ease, transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox.active .lightbox-top-actions {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition: opacity 0.28s ease, transform 0.34s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: 0.08s;
}

@media (max-width: 680px) {
    .lightbox-img {
        max-width: calc(100vw - 24px);
        max-height: calc(100vh - 156px);
    }
    .close-lightbox {
        top: 16px;
        left: 16px;
        width: 38px;
        height: 38px;
        font-size: 22px;
    }
    .lightbox-top-actions {
        top: 16px;
        right: 16px;
        gap: 6px;
        padding: 4px;
    }
}

/* ปุ่มดาวน์โหลดใน Lightbox */
.lightbox-actions-bar .lightbox-download,
.lightbox-download {
    color: white; 
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: background 0.3s, transform 0.2s;
}

.lightbox-download svg {
    width: 18px;
    height: 18px;
}

/* =========================================
   UI & Animations (ปุ่มย้อนกลับและโหลดหน้า)
   ========================================= */

/* แอนิเมชันเปิดหน้าเว็บให้ดูสมูท */
body {
    animation: fadeInPage 0.8s ease-out forwards;
}

@keyframes fadeInPage {
    from { 
        opacity: 0; 
        
    }
    to { 
        opacity: 1; 
        
    }
}

/* ปุ่มย้อนกลับ (Back Button) */
.back-btn {
    position: absolute;
    top: 30px;
    left: 4%;
    color: white;
    text-decoration: none;
    font-size: 0.75rem;
    letter-spacing: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.7;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 101; /* ให้อยู่บนสุดเสมอ */
}

@media (hover: hover) and (pointer: fine) {
    .back-btn:hover {
        opacity: 1;
        transform: translateX(-5px); /* เลื่อนไปทางซ้ายนิดๆ เวลานำเมาส์ชี้ */
    }
}

.back-btn svg { 
    width: 16px; 
    height: 16px; 
}

/* ปรับ responsive ให้ปุ่มย้อนกลับบนมือถือ */
@media (max-width: 768px) {
    .back-btn {
        top: 20px;
        left: 5%;
        font-size: 0.65rem;
    }
}

/* =========================================
   Responsive หน้า Album (Hero Cover)
   ========================================= */

/* สำหรับ iPad และแท็บเล็ต (หน้าจอเล็กกว่า 768px) */
@media (max-width: 768px) {
    .hero-cover {
        padding-top: 80px; /* เพิ่มพื้นที่ด้านบน ดันโลโก้ลงมาไม่ให้ชนขอบ */
    }
    
    .back-btn {
        top: 25px;
        left: 20px;
    }
    
    .hero-title {
        font-size: 3rem; /* ลดขนาดชื่ออัลบั้มลงจาก 4.5rem */
    }
}

/* สำหรับโทรศัพท์มือถือ (หน้าจอเล็กกว่า 480px) */
@media (max-width: 480px) {
    .hero-cover {
        height: 85vh; /* ลดความสูงหน้าปกลงนิดนึง ให้ลูกค้าเห็นขอบแกลเลอรีด้านล่าง จะได้รู้ว่าเลื่อนลงได้ */
        padding-top: 70px; 
        
        /* เลื่อนจุดโฟกัสรูปภาพจากตรงกลาง (center) ให้ขยับขึ้นมาด้านบนนิดนึง (30%) 
           ช่วยให้รูปหน้าปกแนวนอนแสดงผลบนมือถือแนวตั้งได้สวยขึ้น */
        background-position: center 30%; 
    }
    
    .back-btn {
        top: 20px;
        left: 15px;
        font-size: 0.6rem; /* ลดขนาดปุ่มย้อนกลับ */
    }

    .hero-top-logo {
        margin-top: 15px; /* ดันโลโก้ "PIXEL GALLERY PHOTOGRAPHY" หนีปุ่มย้อนกลับเพิ่มอีก */
        font-size: 0.65rem;
    }

    .hero-title {
        font-size: 2.2rem; /* ย่อชื่ออัลบั้มให้พอดีจอมือถือ */
        margin-bottom: 10px;
    }

    .hero-subtitle {
        font-size: 0.7rem;
        margin-bottom: 25px;
    }

    /* ปรับขนาดแถบ Action Bar ด้านล่างหน้าปกให้กะทัดรัดขึ้น */
    .action-bar {
        padding: 20px 5%;
    }
    
    .action-left h2 {
        font-size: 1.2rem;
    }
}

/* --- Lightbox Navigation Buttons --- */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%) scale(0.9);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: rgba(255, 255, 255, 0.85);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.26s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease, color 0.2s ease;
    z-index: 1001;
}

.lightbox.active .lightbox-nav {
    opacity: 1;
    transform: translateY(-50%) scale(1);
    pointer-events: auto;
    transition: opacity 0.3s ease, transform 0.34s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease, color 0.2s ease;
    transition-delay: 0.12s;
}

@media (hover: hover) and (pointer: fine) {
    .lightbox-nav:hover {
        background: rgba(255, 255, 255, 0.16);
        color: #ffffff;
        transform: translateY(-50%) scale(1.06);
        transition-delay: 0s;
    }
}

.lightbox-nav:active {
    transform: translateY(-50%) scale(0.95);
    transition-delay: 0s;
}

.lightbox.active .lightbox-nav.is-edge-disabled,
.lightbox-nav.is-edge-disabled {
    opacity: 0.22 !important;
    pointer-events: none !important;
}

.lightbox-nav svg {
    width: 20px;
    height: 20px;
}

.lightbox-nav.prev { left: 24px; }
.lightbox-nav.next { right: 24px; }

@media (max-width: 768px) {
    .lightbox-nav { width: 38px; height: 38px; }
    .lightbox-nav svg { width: 18px; height: 18px; }
    .lightbox-nav.prev { left: 12px; }
    .lightbox-nav.next { right: 12px; }
}

/* --- Search Bar --- */
.search-bar {
    display: flex;
    align-items: center;
    max-width: 350px; /* กำหนดความกว้างไม่ให้ยาวเกินไป */
    margin: 35px auto 0;
    padding: 8px 10px;
    border-bottom: 1px solid var(--text-gray);
    transition: border-color 0.3s ease;
}

/* ตอนคลิกพิมพ์ให้เส้นเข้มขึ้น */
.search-bar:focus-within {
    border-bottom-color: var(--text-dark);
}

.search-bar svg {
    width: 18px;
    height: 18px;
    color: var(--text-gray);
    margin-right: 12px;
}

.search-bar input {
    border: none;
    outline: none;
    background: transparent; /* โปร่งใสเพื่อให้เนียนไปกับโหมดมืด/สว่าง */
    width: 100%;
    font-family: var(--font-main);
    font-size: 0.95rem;
    color: var(--text-dark); /* สีตัวอักษรเปลี่ยนตามโหมด */
}

.search-bar input::placeholder {
    color: var(--text-gray);
    font-weight: 300;
}

/* =========================================
   Landing Page Hero Section (งานที่ 3 & อัปเดตเต็มจอสมูท)
   ========================================= */
.landing-hero {
    position: relative;
    min-height: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 75px 5% 0;
    overflow: hidden;
    background: var(--bg-color);
    transition: background-color 0.3s ease;
}

.hero-perspective-wrap {
    position: absolute;
    inset: -60px;
    perspective: 1200px;
    perspective-origin: 50% 38%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.hero-perspective-cards {
    position: absolute;
    width: 140%;
    left: -20%;
    top: -10%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    transform: rotateX(20deg) rotateY(-10deg) rotateZ(5deg) scale(0.96);
    transform-style: preserve-3d;
    pointer-events: auto;
    /* แอนิเมชันเลื่อนวนรูปช้าๆ เรื่อยๆ แบบสมูท วนลูปไม่สะดุด */
    animation: heroCardsDrift 40s ease-in-out infinite alternate;
}

@keyframes heroCardsDrift {
    0% {
        transform: rotateX(20deg) rotateY(-10deg) rotateZ(5deg) translateY(0px) scale(0.96);
    }
    50% {
        transform: rotateX(17deg) rotateY(-6deg) rotateZ(3deg) translateY(-60px) scale(1.01);
    }
    100% {
        transform: rotateX(22deg) rotateY(-13deg) rotateZ(6deg) translateY(-120px) scale(0.96);
    }
}

.perspective-card {
    position: relative;
    aspect-ratio: 16 / 10;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.15);
    opacity: 0.58;
    filter: blur(1.2px);
    transition: transform 0.4s ease, opacity 0.4s ease, filter 0.4s ease, box-shadow 0.4s ease;
    cursor: pointer;
    text-decoration: none;
    display: block;
    background-color: #1e1e24;
}

@media (hover: hover) and (pointer: fine) {
    .perspective-card:hover {
        opacity: 0.95;
        filter: blur(0px);
        transform: translateZ(60px) scale(1.05);
        box-shadow: 0 35px 65px -15px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.3);
        z-index: 10;
    }
}

.perspective-card-img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.6s ease;
}

@media (hover: hover) and (pointer: fine) {
    .perspective-card:hover .perspective-card-img {
        transform: scale(1.06);
    }
}

.perspective-card-glow {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.7) 100%);
}

.perspective-card-badge {
    position: absolute;
    bottom: 12px;
    left: 14px;
    right: 14px;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 500;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.5px;
}

.hero-perspective-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0.9) 65%, var(--bg-color) 100%);
    pointer-events: none;
    backdrop-filter: blur(2.5px);
    transition: background 0.3s ease;
}

body.dark-mode .hero-perspective-overlay {
    background: radial-gradient(circle at 50% 48%, rgba(17, 17, 17, 0.75) 0%, rgba(17, 17, 17, 0.92) 65%, var(--bg-color) 100%);
}

/* เลเยอร์เฟดลงด้านล่างให้เนียนไปกับพื้นหลังสีขาว ไม่ตัดกันเป็นเส้น */
.hero-bottom-fade {
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 260px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.4) 40%, rgba(255, 255, 255, 0.88) 75%, var(--bg-color) 100%);
    pointer-events: none;
    z-index: 2;
}

body.dark-mode .hero-bottom-fade {
    background: linear-gradient(to bottom, rgba(17, 17, 17, 0) 0%, rgba(17, 17, 17, 0.4) 40%, rgba(17, 17, 17, 0.88) 75%, var(--bg-color) 100%);
}

.landing-hero-content {
    position: relative;
    z-index: 5;
    text-align: center;
    max-width: 860px;
    margin: 0 auto;
    padding: 0 20px;
    animation: heroFadeUp 1s ease-out both;
}

.hero-pill {
    display: inline-block;
    padding: 6px 18px;
    font-size: 0.72rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 600;
    border-radius: 9999px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-dark);
    border: 1px solid rgba(0, 0, 0, 0.08);
    margin-bottom: 22px;
}

body.dark-mode .hero-pill {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.landing-hero-title {
    font-family: var(--font-sans);
    font-size: clamp(2.3rem, 5.2vw, 4.4rem);
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.18;
    margin-bottom: 18px;
    color: var(--text-dark);
    text-align: center;
}

.landing-hero-desc {
    font-size: clamp(0.95rem, 1.5vw, 1.12rem);
    font-weight: 300;
    color: var(--text-gray);
    line-height: 1.65;
    max-width: 660px;
    margin: 0 auto 30px;
}

.landing-hero-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.hero-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 28px;
    border-radius: 50px;
    font-size: 0.92rem;
    font-weight: 500;
    font-family: var(--font-sans);
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-cta-btn.primary {
    background: var(--text-dark);
    color: var(--bg-color);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

@media (hover: hover) and (pointer: fine) {
    .hero-cta-btn.primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
        opacity: 0.95;
    }
}

.hero-cta-btn.secondary {
    background: transparent;
    color: var(--text-dark);
    border: 1px solid rgba(128, 128, 128, 0.3);
}

@media (hover: hover) and (pointer: fine) {
    .hero-cta-btn.secondary:hover {
        background: rgba(128, 128, 128, 0.1);
        border-color: var(--text-dark);
    }
}

/* ช่องค้นหาอัลบั้มใน Hero Landing Page (งานที่ 2) */
.hero-search-wrap {
    max-width: 440px;
    margin: 0 auto;
    width: 100%;
}

.hero-search-bar {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 9999px;
    padding: 10px 20px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.07);
    transition: all 0.3s ease;
}

.hero-search-bar:focus-within {
    background: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 14px 35px rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

body.dark-mode .hero-search-bar {
    background: rgba(28, 28, 35, 0.88);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

body.dark-mode .hero-search-bar:focus-within {
    background: #1a1a22;
    border-color: #60a5fa;
    box-shadow: 0 14px 35px rgba(96, 165, 250, 0.25);
}

.hero-search-bar svg {
    width: 20px;
    height: 20px;
    color: var(--text-gray);
    margin-right: 12px;
    flex-shrink: 0;
}

.hero-search-bar input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--text-dark);
}

.hero-search-bar input::placeholder {
    color: var(--text-gray);
    font-weight: 300;
}

@keyframes heroFadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .landing-hero {
        min-height: auto;
        height: auto;
        padding: 70px 5% 0;
    }
    .hero-perspective-cards {
        grid-template-columns: repeat(2, 1fr);
        width: 140%;
        left: -20%;
        gap: 16px;
    }
    .landing-hero-title {
        font-size: clamp(1.25rem, 6vw, 2.5rem);
        white-space: nowrap;
    }
}

/* =========================================
   Back to Top Button (งานที่ 6)
   ========================================= */
.back-to-top-btn {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #111111;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9980;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translate3d(0, 18px, 0) scale(0.92);
    transition: opacity 0.24s ease, visibility 0.24s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.3s ease;
}

.back-to-top-btn.is-visible {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
    transform: translate3d(0, 0, 0) scale(1);
}

/* เมื่อผู้ใช้ตั้งค่าแคปซูลหน้าอัลบั้มให้อยู่ฝั่งขวา ย้ายปุ่ม Back-to-Top สลับมาอยู่ฝั่งซ้ายแทน */
body.pg-album-pill-right .back-to-top-btn {
    right: auto;
    left: 32px;
}

@media (hover: hover) and (pointer: fine) {
    .back-to-top-btn.is-visible:hover {
        background: rgba(255, 255, 255, 0.98);
        transform: translate3d(0, -4px, 0) scale(1);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    }
}

.back-to-top-btn svg {
    width: 22px;
    height: 22px;
    transition: transform 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .back-to-top-btn:hover svg {
        transform: translateY(-2px);
    }
}

body.dark-mode .back-to-top-btn {
    background: rgba(28, 28, 33, 0.82);
    border-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .back-to-top-btn:hover {
        background: rgba(40, 40, 48, 0.98);
    }
}

@media (max-width: 768px) {
    .back-to-top-btn {
        bottom: 24px;
        right: 20px;
        width: 44px;
        height: 44px;
    }

    body.pg-album-pill-right .back-to-top-btn {
        right: auto;
        left: 20px;
    }
}


/* =========================================
   Share Album Modal (Cohesive UI & Dark Mode Support)
   ========================================= */
.pg-share-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s ease;
}

.pg-share-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.pg-share-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    width: 92%;
    max-width: 400px;
    background: #ffffff;
    color: #111111;
    padding: 28px 26px 24px;
    border-radius: 22px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.24), 0 0 0 1px rgba(0, 0, 0, 0.06);
    z-index: 99999;
    text-align: center;
    font-family: 'Plus Jakarta Sans', 'Prompt', 'Kanit', -apple-system, BlinkMacSystemFont, sans-serif;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s ease;
}

.pg-share-modal.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.pg-share-close-x {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .pg-share-close-x:hover {
        background: #e5e7eb;
        color: #111111;
        transform: scale(1.06);
    }
}

.pg-share-icon-badge {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(17, 17, 17, 0.07) 0%, rgba(17, 17, 17, 0.03) 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #111111;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}

.pg-share-icon-badge svg {
    width: 24px;
    height: 24px;
}

.pg-share-title {
    margin: 0 0 6px 0;
    font-size: 1.18rem;
    font-weight: 700;
    color: #111111;
    letter-spacing: -0.01em;
    font-family: inherit;
}

.pg-share-subtitle {
    margin: 0 0 18px 0;
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.5;
    font-weight: 400;
    font-family: inherit;
}

.pg-share-link-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 10px 14px;
    margin-bottom: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pg-share-link-box:focus-within {
    border-color: #111111;
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

.pg-share-link-box svg {
    width: 17px;
    height: 17px;
    color: #64748b;
    flex-shrink: 0;
}

.pg-share-link-input {
    width: 100%;
    border: none;
    background: transparent;
    color: #1e293b;
    font-size: 0.84rem;
    font-weight: 500;
    font-family: inherit;
    outline: none;
    text-overflow: ellipsis;
}

.pg-share-line-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(6, 199, 85, 0.08);
    border: 1px solid rgba(6, 199, 85, 0.22);
    color: #15803d;
    border-radius: 12px;
    padding: 9px 14px;
    margin-bottom: 18px;
    font-size: 0.82rem;
    font-family: inherit;
}

.pg-share-line-card strong {
    font-weight: 600;
    color: #166534;
}

.pg-share-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
}

.pg-share-btn-primary {
    width: 100%;
    padding: 12px 18px;
    border-radius: 13px;
    border: none;
    background: #111111;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.14);
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (hover: hover) and (pointer: fine) {
    .pg-share-btn-primary:hover {
        background: #27272a;
        transform: translateY(-1px);
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
    }
}

.pg-share-btn-primary.copied {
    background: #16a34a !important;
    color: #ffffff !important;
    box-shadow: 0 8px 22px rgba(22, 163, 74, 0.32) !important;
}

.pg-share-btn-secondary {
    width: 100%;
    padding: 11px 18px;
    border-radius: 13px;
    border: 1px solid transparent;
    background: #f3f4f6;
    color: #374151;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .pg-share-btn-secondary:hover {
        background: #e5e7eb;
        color: #111111;
    }
}

/* Dark Mode for Share Modal */
body.dark-mode .pg-share-modal {
    background: #18181b;
    color: #ffffff;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

body.dark-mode .pg-share-close-x {
    background: rgba(255, 255, 255, 0.08);
    color: #a1a1aa;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pg-share-close-x:hover {
        background: rgba(255, 255, 255, 0.15);
        color: #ffffff;
    }
}

body.dark-mode .pg-share-icon-badge {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

body.dark-mode .pg-share-title {
    color: #ffffff;
}

body.dark-mode .pg-share-subtitle {
    color: #a1a1aa;
}

body.dark-mode .pg-share-link-box {
    background: rgba(17, 17, 17, 0.85);
    border-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .pg-share-link-input {
    color: #f1f5f9;
}

body.dark-mode .pg-share-line-card {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.28);
    color: #86efac;
}

body.dark-mode .pg-share-line-card strong {
    color: #bbf7d0;
}

body.dark-mode .pg-share-btn-primary {
    background: #ffffff;
    color: #111111;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pg-share-btn-primary:hover {
        background: #e5e7eb;
    }
}

body.dark-mode .pg-share-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #d1d5db;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pg-share-btn-secondary:hover {
        background: rgba(255, 255, 255, 0.14);
        color: #ffffff;
    }
}

#shareBtn.is-copied {
    color: #16a34a !important;
    transition: color 0.2s ease, transform 0.2s ease;
    transform: scale(1.08);
}

/* =========================================
   In-App Browser Notice Modal & Toast
   ========================================= */
.pg-inapp-overlay {
    z-index: 100049;
}

.pg-inapp-modal {
    z-index: 100050;
    max-width: 420px;
}

.pg-inapp-app-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 9999px;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.pg-inapp-app-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.pg-inapp-steps {
    text-align: left;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.84rem;
    color: #334155;
    line-height: 1.45;
}

.pg-inapp-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.pg-inapp-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #111111;
    color: #ffffff;
    font-size: 0.74rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.pg-inapp-fallback-hint {
    margin: 0 0 14px;
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.45;
}

.pg-inapp-actions {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.pg-inapp-copy-btn {
    width: 100%;
    padding: 11px 18px;
    border-radius: 13px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #1e293b;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .pg-inapp-copy-btn:hover {
        background: #f8fafc;
        border-color: #cbd5e1;
    }
}

.pg-inapp-copy-btn.copied {
    border-color: #16a34a;
    background: rgba(22, 163, 74, 0.08);
    color: #15803d;
}

body.dark-mode .pg-inapp-app-pill,
html.dark-mode .pg-inapp-app-pill,
[data-theme="dark"] .pg-inapp-app-pill {
    background: rgba(96, 165, 250, 0.16);
    color: #93c5fd;
}

body.dark-mode .pg-inapp-steps,
html.dark-mode .pg-inapp-steps,
[data-theme="dark"] .pg-inapp-steps {
    background: rgba(17, 17, 17, 0.85);
    border-color: rgba(255, 255, 255, 0.12);
    color: #d4d4d8;
}

body.dark-mode .pg-inapp-step-num,
html.dark-mode .pg-inapp-step-num,
[data-theme="dark"] .pg-inapp-step-num {
    background: #ffffff;
    color: #111111;
}

body.dark-mode .pg-inapp-fallback-hint,
html.dark-mode .pg-inapp-fallback-hint,
[data-theme="dark"] .pg-inapp-fallback-hint {
    color: #94a3b8;
}

body.dark-mode .pg-inapp-copy-btn,
html.dark-mode .pg-inapp-copy-btn,
[data-theme="dark"] .pg-inapp-copy-btn {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.14);
    color: #f1f5f9;
}

@media (hover: hover) and (pointer: fine) {
    body.dark-mode .pg-inapp-copy-btn:hover,
    html.dark-mode .pg-inapp-copy-btn:hover,
    [data-theme="dark"] .pg-inapp-copy-btn:hover {
        background: rgba(255, 255, 255, 0.12);
    }
}

body.dark-mode .pg-inapp-copy-btn.copied,
html.dark-mode .pg-inapp-copy-btn.copied,
[data-theme="dark"] .pg-inapp-copy-btn.copied {
    background: rgba(34, 197, 94, 0.18);
    border-color: rgba(34, 197, 94, 0.4);
    color: #86efac;
}

.pg-inline-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(16px) scale(0.95);
    min-height: 35px;
    max-width: min(440px, calc(100vw - 28px));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #E0F2FE;
    color: #008AF5;
    border: 1px solid rgba(0, 138, 245, 0.24);
    padding: 7px 16px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: var(--font-sans, 'Kanit', sans-serif);
    box-shadow: 0 12px 30px -6px rgba(0, 138, 245, 0.22), 0 4px 10px rgba(0, 0, 0, 0.06);
    z-index: 100060;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.pg-inline-toast svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 3;
    flex-shrink: 0;
}

.pg-inline-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
}

.pg-inline-toast.is-success {
    background: #ECFDF5;
    color: #57BC6C;
    border-color: rgba(87, 188, 108, 0.24);
    box-shadow: 0 12px 30px -6px rgba(87, 188, 108, 0.24), 0 4px 10px rgba(0, 0, 0, 0.06);
}

.pg-inline-toast.is-error {
    background: #FFF1F2;
    color: #D57463;
    border-color: rgba(213, 116, 99, 0.24);
    box-shadow: 0 12px 30px -6px rgba(213, 116, 99, 0.24), 0 4px 10px rgba(0, 0, 0, 0.06);
}

body.dark-mode .pg-inline-toast {
    background: #E0F2FE;
    color: #008AF5;
    border-color: rgba(0, 138, 245, 0.28);
    box-shadow: 0 14px 36px -4px rgba(0, 0, 0, 0.45);
}

body.dark-mode .pg-inline-toast.is-success {
    background: #ECFDF5;
    color: #57BC6C;
    border-color: rgba(87, 188, 108, 0.28);
}

body.dark-mode .pg-inline-toast.is-error {
    background: #FFF1F2;
    color: #D57463;
    border-color: rgba(213, 116, 99, 0.28);
}

/* ==========================================================================
   Album Fullscreen Page Loader (#page-loader) & Dark Mode Support
   ========================================================================== */
#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f8fafc;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.45s ease;
    font-family: var(--font-sans, 'Kanit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    box-sizing: border-box;
    user-select: none;
    padding: 24px;
}

html.dark-mode #page-loader,
body.dark-mode #page-loader,
[data-theme="dark"] #page-loader {
    background-color: #0b0c10;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not(.light-mode) #page-loader {
        background-color: #0b0c10;
    }
}

.page-loader-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 440px;
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.page-loader-visual {
    position: relative;
    width: 76px;
    height: 76px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-loader-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid rgba(37, 99, 235, 0.14);
    border-top-color: #2563eb;
    border-right-color: #60a5fa;
    animation: pgLoaderSpin 1.1s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

html.dark-mode .page-loader-ring,
body.dark-mode .page-loader-ring,
[data-theme="dark"] .page-loader-ring {
    border-color: rgba(59, 130, 246, 0.2);
    border-top-color: #3b82f6;
    border-right-color: #93c5fd;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.25);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not(.light-mode) .page-loader-ring {
        border-color: rgba(59, 130, 246, 0.2);
        border-top-color: #3b82f6;
        border-right-color: #93c5fd;
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.25);
    }
}

.page-loader-icon-badge {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pgLoaderPulse 2.2s ease-in-out infinite;
}

.page-loader-icon-badge svg {
    width: 24px;
    height: 24px;
}

html.dark-mode .page-loader-icon-badge,
body.dark-mode .page-loader-icon-badge,
[data-theme="dark"] .page-loader-icon-badge {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not(.light-mode) .page-loader-icon-badge {
        background: rgba(59, 130, 246, 0.15);
        color: #60a5fa;
    }
}

#page-loader h2,
.page-loader-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.01em;
    line-height: 1.4;
}

html.dark-mode #page-loader h2,
body.dark-mode #page-loader h2,
[data-theme="dark"] #page-loader h2,
html.dark-mode .page-loader-title,
body.dark-mode .page-loader-title,
[data-theme="dark"] .page-loader-title {
    color: #f8fafc;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not(.light-mode) #page-loader h2,
    :root:not([data-theme="light"]):not(.light-mode) .page-loader-title {
        color: #f8fafc;
    }
}

#page-loader p,
.page-loader-subtitle {
    margin: 8px 0 0 0;
    font-size: 0.88rem;
    color: #64748b;
    line-height: 1.5;
}

html.dark-mode #page-loader p,
body.dark-mode #page-loader p,
[data-theme="dark"] #page-loader p,
html.dark-mode .page-loader-subtitle,
body.dark-mode .page-loader-subtitle,
[data-theme="dark"] .page-loader-subtitle {
    color: #94a3b8;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not(.light-mode) #page-loader p,
    :root:not([data-theme="light"]):not(.light-mode) .page-loader-subtitle {
        color: #94a3b8;
    }
}

.page-loader-track {
    width: 170px;
    height: 4px;
    background: rgba(0, 0, 0, 0.07);
    border-radius: 9999px;
    overflow: hidden;
    margin-top: 22px;
    position: relative;
}

html.dark-mode .page-loader-track,
body.dark-mode .page-loader-track,
[data-theme="dark"] .page-loader-track {
    background: rgba(255, 255, 255, 0.1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not(.light-mode) .page-loader-track {
        background: rgba(255, 255, 255, 0.1);
    }
}

.page-loader-bar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 40%;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    border-radius: 9999px;
    animation: pgLoaderBar 1.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

html.dark-mode .page-loader-bar,
body.dark-mode .page-loader-bar,
[data-theme="dark"] .page-loader-bar {
    background: linear-gradient(90deg, #3b82f6, #93c5fd);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not(.light-mode) .page-loader-bar {
        background: linear-gradient(90deg, #3b82f6, #93c5fd);
        box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    }
}

.page-loader-brand {
    position: absolute;
    bottom: 28px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #94a3b8;
    opacity: 0.75;
}

html.dark-mode .page-loader-brand,
body.dark-mode .page-loader-brand,
[data-theme="dark"] .page-loader-brand {
    color: #64748b;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not(.light-mode) .page-loader-brand {
        color: #64748b;
    }
}

#page-loader[style*="opacity: 0"],
#page-loader.is-hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

