/**
 * Masonry Photo Wall Block - Frontend Styles
 * 
 * @package Masonry_Photo_Wall
 * @since 1.0.0
 */

/* 基礎容器 */
.masonry-photo-wall {
width: 100%;
max-width: 100%;
margin: 0 auto;
padding: 0;
box-sizing: border-box;
}

.masonry-photo-wall__item {
padding-top: var(--masonry-item-spacing-top, 0px);
padding-bottom: var(--masonry-item-spacing-bottom, 0px);
box-sizing: border-box;
}

.masonry-photo-wall--grid-static-1 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-2 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-3 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-5-2 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-5-3 .masonry-photo-wall__item {
padding-top: 0 !important;
padding-bottom: 0 !important;
}

/* 確保在 fc-block 內正確顯示 */
.fc-block.fc-masonry-grid {
width: 100%;
max-width: 100%;
box-sizing: border-box;
min-height: var(--masonry-cls-min-height-desktop, 0px);
contain-intrinsic-size: auto var(--masonry-cls-min-height-desktop, 360px);
overflow-anchor: none;
/* 對於 Justified 布局，使用 visible 以確保 margin 可見 */
overflow: visible;
/* 預設上下間距（減少默認值） */
margin-top: var(--fc-spacing-md, 20px);
margin-bottom: var(--fc-spacing-md, 20px);
}

.fc-block.fc-masonry-grid[data-masonry-layout-ready="true"] {
contain-intrinsic-size: auto;
min-height: 0;
}

/* Fullwidth 布局時，父容器需要特殊處理 */
.fc-block.fc-masonry-grid:has(.masonry-photo-wall--fullwidth) {
margin-left: calc(50% - 50vw) !important;
margin-right: calc(50% - 50vw) !important;
width: 100vw !important;
padding-left: max(10px, env(safe-area-inset-left)) !important;
padding-right: max(10px, env(safe-area-inset-right)) !important;
overflow-x: visible !important;
}

/* Justified 布局時，確保容器不會隱藏 margin */
.fc-block.fc-masonry-grid.masonry-photo-wall--justified {
overflow: visible !important;
}

.fc-block.fc-masonry-grid .masonry-photo-wall {
width: 100%;
max-width: 100%;
/* CSS 變數會自動繼承，無需顯式設置 */
}

.masonry-photo-wall__container {
display: grid;
grid-auto-rows: min-content;
gap: var(--masonry-gap, 15px);
/* 確保從父元素繼承 CSS 變數 */
grid-template-columns: repeat(var(--masonry-columns-desktop, 3), 1fr);
width: 100%;
box-sizing: border-box;
min-height: 0;
height: auto; /* 使用 auto 確保容器只占用必要的高度 */
/* align-content 僅在桌面版應用，避免平板和手機版出現空白 */
}

/* 確保容器在所有布局下都可見（僅在桌面版） */
@media (min-width: 1181px) {
.masonry-photo-wall__container:empty::after {
content: '';
display: block;
min-height: 100px;
}
}


/* 響應式欄數 - 確保變數能正確繼承 */
@media (max-width: 1180px) {
.fc-block.fc-masonry-grid {
min-height: var(--masonry-cls-min-height-tablet, var(--masonry-cls-min-height-desktop, 0px));
contain-intrinsic-size: auto var(--masonry-cls-min-height-tablet, var(--masonry-cls-min-height-desktop, 360px));
}

.masonry-photo-wall__container {
grid-template-columns: repeat(var(--masonry-columns-tablet, 2), 1fr) !important;
}
}

@media (max-width: 767px) {
.fc-block.fc-masonry-grid {
min-height: var(--masonry-cls-min-height-mobile, var(--masonry-cls-min-height-tablet, 0px));
contain-intrinsic-size: auto var(--masonry-cls-min-height-mobile, var(--masonry-cls-min-height-tablet, 320px));
}

.fc-block.fc-masonry-grid[data-masonry-layout-ready="true"] {
min-height: 0 !important;
}

.masonry-photo-wall__container {
/* 移除強制單欄，使用設定的欄位數 */
grid-template-columns: repeat(var(--masonry-columns-mobile, 2), 1fr) !important;
}
}

/* 圖片項目 - 基礎樣式 */
.masonry-photo-wall__item {
position: relative;
overflow: hidden;
border-radius: 4px;
background: transparent; /* 移除灰色背景 */
display: flex;
align-items: stretch;
min-height: 0;
width: 100%;
box-sizing: border-box;
/* 動畫效果 */
animation: fadeIn 0.3s ease-in;
}

.masonry-photo-wall--frame-soft .masonry-photo-wall__item,
.masonry-photo-wall--frame-outline .masonry-photo-wall__item,
.masonry-photo-wall--frame-elevated .masonry-photo-wall__item,
.masonry-photo-wall--frame-editorial .masonry-photo-wall__item {
overflow: visible;
}

/* 完整顯示模式：移除最小高度限制 */
.masonry-photo-wall--grid-static-2.masonry-photo-wall--full-height .masonry-photo-wall__item,
.masonry-photo-wall--two-cols.masonry-photo-wall--full-height .masonry-photo-wall__item {
min-height: 0 !important;
}

/* 明確支持 grid-column 和 grid-row（非 Justified、Pinterest 布局） */
/* 這些樣式會通過內聯 style 屬性應用，無需額外 CSS 規則 */

/* 確保項目在所有布局下都可見 */
.masonry-photo-wall__item img {
max-width: 100%;
height: auto;
display: block;
}

.masonry-photo-wall__item .masonry-photo-wall__lightbox-link {
display: flex;
flex-direction: column;
text-decoration: none;
color: inherit;
width: 100%;
height: 100%;
position: relative;
z-index: 1;
border: none;
outline: none;
min-height: 0;
}

/* Grid 布局中的链接：确保高度正确 */
.masonry-photo-wall--grid .masonry-photo-wall__item .masonry-photo-wall__lightbox-link {
height: 100% !important; /* 覆蓋外部樣式的 height: auto */
min-height: 0 !important;
}

.masonry-photo-wall__image-wrapper {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
min-height: 0;
box-sizing: border-box;
/* Safari 模糊修復 */
-webkit-backface-visibility: hidden;
-webkit-transform: translateZ(0);
backface-visibility: hidden;
transform: translateZ(0);
}

.masonry-photo-wall__image-wrapper--has-footer-notice {
align-items: stretch;
justify-content: stretch;
background: #000;
}

.masonry-photo-wall__image-stack {
width: 100%;
height: 100%;
display: grid;
grid-template-rows:
minmax(0, calc(100% / var(--masonry-footer-notice-total-scale, 1.1)))
minmax(0, calc((100% * var(--masonry-footer-notice-ratio, 0.1)) / var(--masonry-footer-notice-total-scale, 1.1)));
gap: 0;
}

.masonry-photo-wall__image-stage {
position: relative;
width: 100%;
height: 100%;
min-height: 0;
overflow: hidden;
display: flex;
align-items: stretch;
justify-content: stretch;
isolation: isolate;
}

.masonry-photo-wall__image-stage > picture,
.masonry-photo-wall__image-stage > picture > picture {
display: block;
width: 100%;
height: 100%;
flex: 1 1 auto;
min-width: 0;
min-height: 0;
}

.masonry-photo-wall__image-stage > picture > img,
.masonry-photo-wall__image-stage > picture > picture > img {
display: block;
width: 100%;
height: 100%;
max-width: none;
flex: 1 1 auto;
}

.masonry-photo-wall__notice-strip {
width: 100%;
min-height: 0;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
background: var(--masonry-footer-notice-bg, #000);
border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.masonry-photo-wall__notice-text {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
padding: 0 16px;
box-sizing: border-box;
background: var(--masonry-footer-notice-bg, #000);
color: var(--masonry-footer-notice-text-color, #fff);
font-size: clamp(12px, var(--masonry-footer-notice-text-size, 16px), 28px);
font-weight: 700;
line-height: 1.25;
letter-spacing: 0.04em;
text-align: center;
white-space: normal;
}

.masonry-photo-wall__item--media .masonry-photo-wall__image-stage {
background: linear-gradient(180deg, rgba(15, 23, 42, 0.02) 0%, rgba(15, 23, 42, 0.08) 100%);
}

.masonry-photo-wall__media-badge {
position: absolute;
top: 12px;
left: 12px;
z-index: 2;
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 28px;
padding: 0 10px;
border-radius: 999px;
background: rgba(15, 23, 42, 0.82);
color: #fff;
font-size: 11px;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
box-shadow: 0 10px 20px rgba(15, 23, 42, 0.18);
pointer-events: none;
}

.masonry-photo-wall__watermarks {
position: absolute;
inset: 0;
z-index: 4;
display: block;
visibility: visible;
pointer-events: none;
}

.masonry-photo-wall__item--composite-image-active .masonry-photo-wall__watermarks,
.masonry-photo-wall__justified-item--composite-image-active .masonry-photo-wall__watermarks,
.masonry-photo-wall__item--composite-image-active .masonry-photo-wall__notice-strip,
.masonry-photo-wall__justified-item--composite-image-active .masonry-photo-wall__notice-strip {
display: none !important;
}

.masonry-photo-wall__item--composite-image-active .masonry-photo-wall__image-stack,
.masonry-photo-wall__justified-item--composite-image-active .masonry-photo-wall__image-stack {
display: block !important;
height: 100% !important;
}

.masonry-photo-wall__item--composite-image-active .masonry-photo-wall__image-wrapper--has-footer-notice,
.masonry-photo-wall__justified-item--composite-image-active .masonry-photo-wall__image-wrapper--has-footer-notice {
background: transparent !important;
}

.masonry-photo-wall--warning-strip .masonry-photo-wall__item--composite-image-active .masonry-photo-wall__image-stack,
.masonry-photo-wall--warning-strip .masonry-photo-wall__justified-item--composite-image-active .masonry-photo-wall__image-stack {
height: auto !important;
}

.masonry-photo-wall--warning-strip .masonry-photo-wall__item--composite-image-active .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--warning-strip .masonry-photo-wall__justified-item--composite-image-active .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--warning-strip .masonry-photo-wall__item--composite-image-active .masonry-photo-wall__image-stage,
.masonry-photo-wall--warning-strip .masonry-photo-wall__justified-item--composite-image-active .masonry-photo-wall__image-stage {
aspect-ratio: auto !important;
height: auto !important;
min-height: 0 !important;
}

.masonry-photo-wall__watermark {
position: absolute;
display: inline-flex;
align-items: center;
justify-content: center;
max-width: min(38%, 260px);
opacity: var(--masonry-watermark-opacity, 0.55);
pointer-events: none;
user-select: none;
z-index: 1;
}

.masonry-photo-wall__watermark img {
display: block;
width: min(100%, calc(var(--masonry-watermark-image-width, 18) * 1%));
height: auto;
max-width: min(38%, var(--masonry-watermark-image-max-width, 220px));
filter: drop-shadow(0 12px 24px rgba(15, 23, 42, 0.22));
}

.masonry-photo-wall__watermark--text {
padding: 6px 10px;
font-size: clamp(12px, calc(var(--masonry-watermark-text-size, 18) * 1px), 48px);
font-weight: 800;
line-height: 1.15;
letter-spacing: 0.08em;
text-transform: uppercase;
white-space: nowrap;
color: var(--masonry-watermark-text-color, #ffffff);
text-shadow: 0 4px 18px rgba(15, 23, 42, 0.5);
transform: rotate(var(--masonry-watermark-text-rotate, 0deg));
}

.masonry-photo-wall__watermark--digital {
padding: 4px 8px;
font-size: clamp(10px, calc(var(--masonry-watermark-text-size, 10) * 1px), 18px);
font-weight: 700;
line-height: 1.1;
letter-spacing: 0.08em;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
white-space: nowrap;
color: rgba(255, 255, 255, 0.62);
background: rgba(15, 23, 42, 0.18);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 999px;
backdrop-filter: blur(2px);
box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.masonry-photo-wall__watermark--top-left {
top: 14px;
left: 14px;
}

.masonry-photo-wall__watermark--top-center {
top: 14px;
left: 50%;
transform: translateX(-50%);
}

.masonry-photo-wall__watermark--top-right {
top: 14px;
right: 14px;
}

.masonry-photo-wall__watermark--center-left {
top: 50%;
left: 14px;
transform: translateY(-50%);
}

.masonry-photo-wall__watermark--center {
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}

.masonry-photo-wall__watermark--center-right {
top: 50%;
right: 14px;
transform: translateY(-50%);
}

.masonry-photo-wall__watermark--bottom-left {
left: 14px;
bottom: 14px;
}

.masonry-photo-wall__watermark--bottom-center {
left: 50%;
bottom: 14px;
transform: translateX(-50%);
}

.masonry-photo-wall__watermark--bottom-right {
right: 14px;
bottom: 14px;
}

.masonry-photo-wall__watermark--text.masonry-photo-wall__watermark--top-center,
.masonry-photo-wall__watermark--text.masonry-photo-wall__watermark--center,
.masonry-photo-wall__watermark--text.masonry-photo-wall__watermark--bottom-center {
transform: translateX(-50%) rotate(var(--masonry-watermark-text-rotate, 0deg));
}

.masonry-photo-wall__watermark--text.masonry-photo-wall__watermark--center-left,
.masonry-photo-wall__watermark--text.masonry-photo-wall__watermark--center-right {
transform: translateY(-50%) rotate(var(--masonry-watermark-text-rotate, 0deg));
}

.masonry-photo-wall__watermark--text.masonry-photo-wall__watermark--center {
transform: translate(-50%, -50%) rotate(var(--masonry-watermark-text-rotate, 0deg));
}

.masonry-photo-wall__more-overlay {
position: absolute;
inset: 0;
z-index: 5;
appearance: none;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 8px;
padding: 18px;
border: 0;
width: 100%;
height: 100%;
background: linear-gradient(180deg, rgba(15, 23, 42, 0.14) 0%, rgba(15, 23, 42, 0.72) 100%);
color: #fff;
text-align: center;
cursor: pointer;
box-sizing: border-box;
backdrop-filter: blur(2px);
}

.masonry-photo-wall__more-overlay-count {
display: block;
font-size: clamp(18px, 2.6vw, 30px);
font-weight: 800;
line-height: 1.05;
letter-spacing: 0.04em;
text-transform: uppercase;
}

.masonry-photo-wall__more-overlay-label {
display: block;
font-size: 12px;
font-weight: 600;
line-height: 1.4;
letter-spacing: 0.08em;
text-transform: uppercase;
opacity: 0.92;
}

.masonry-photo-wall__more-hidden-reservoir {
display: none !important;
}

.masonry-photo-wall__item--has-more-overlay .masonry-photo-wall__image-stage,
.masonry-photo-wall__justified-item--has-more-overlay .masonry-photo-wall__image-stage,
.masonry-photo-wall__item--has-more-overlay .masonry-photo-wall__image-wrapper,
.masonry-photo-wall__justified-item--has-more-overlay .masonry-photo-wall__image-wrapper,
.masonry-photo-wall__item--has-more-overlay,
.masonry-photo-wall__justified-item--has-more-overlay {
position: relative;
}

.masonry-photo-wall--frame-soft .masonry-photo-wall__image-wrapper {
border-radius: 18px;
background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.masonry-photo-wall--frame-outline .masonry-photo-wall__image-wrapper {
border: 1px solid rgba(15, 23, 42, 0.12);
border-radius: 18px;
background: #fff;
}

.masonry-photo-wall--frame-elevated .masonry-photo-wall__image-wrapper {
border-radius: 20px;
background: #fff;
box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
}

.masonry-photo-wall--frame-editorial .masonry-photo-wall__image-wrapper {
border: 1px solid rgba(15, 23, 42, 0.16);
border-radius: 0;
background: #fff;
box-shadow: 8px 8px 0 rgba(15, 23, 42, 0.08);
}

/* 完整顯示模式：移除 image-wrapper 的最小高度和絕對定位限制 */
.masonry-photo-wall--grid-static-2.masonry-photo-wall--full-height .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--two-cols.masonry-photo-wall--full-height .masonry-photo-wall__image-wrapper {
min-height: 0 !important;
height: auto !important;
position: relative !important;
display: block !important;
align-items: unset !important;
justify-content: unset !important;
overflow: visible !important;
/* 確保包裝器不會被壓縮 */
flex-shrink: 0 !important;
}

/* 完整顯示模式：lightbox link 不應該使用絕對定位 */
.masonry-photo-wall--grid-static-2.masonry-photo-wall--full-height .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--two-cols.masonry-photo-wall--full-height .masonry-photo-wall__lightbox-link {
position: relative !important;
height: auto !important;
width: 100% !important;
display: block !important;
top: auto !important;
left: auto !important;
}

/* 完整顯示模式：lightbox link 不應該使用絕對定位 */
.masonry-photo-wall--grid-static-2.masonry-photo-wall--full-height .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--two-cols.masonry-photo-wall--full-height .masonry-photo-wall__lightbox-link {
position: relative !important;
height: auto !important;
width: 100% !important;
display: block !important;
}

.masonry-photo-wall__image {
width: 100%;
height: 100%;
display: block;
transition: transform 0.3s ease, opacity 0.3s ease;
object-position: var(--masonry-focal-position, center);
flex-shrink: 0;
border: none;
outline: none;
min-height: 0;
box-sizing: border-box;
/* Safari 模糊修復 */
-webkit-backface-visibility: hidden;
-webkit-transform: translateZ(0);
-webkit-perspective: 1000;
backface-visibility: hidden;
transform: translateZ(0);
perspective: 1000;
image-rendering: -webkit-optimize-contrast;
/* 減少過渡過程中的抖動 */
will-change: transform, opacity;
}

.masonry-photo-wall__notice-image {
width: 100%;
height: 100%;
display: block;
object-fit: contain;
object-position: center;
background: var(--masonry-footer-notice-bg, #000);
border: none;
outline: none;
min-height: 0;
box-sizing: border-box;
background: #000;
}

/* 確保圖片在所有情況下都可見 */
.masonry-photo-wall__image[src] {
opacity: 1;
visibility: visible;
}

/* 圖片尺寸模式 */
.masonry-photo-wall__image--cover {
object-fit: cover;
}

.masonry-photo-wall__image--contain {
object-fit: contain;
}

.masonry-photo-wall__image--auto {
    object-fit: contain;
}

/* 長寬比 */
.masonry-photo-wall__item--aspect-1\:1 {
aspect-ratio: 1 / 1;
}

.masonry-photo-wall__item--aspect-4\:3 {
aspect-ratio: 4 / 3;
}

.masonry-photo-wall__item--aspect-16\:9 {
aspect-ratio: 16 / 9;
}

.masonry-photo-wall__item--aspect-3\:2 {
aspect-ratio: 3 / 2;
}

.masonry-photo-wall__intro {
margin-bottom: 20px;
padding: 0 0 16px;
border-bottom: 1px solid #e5e7eb;
}

.masonry-photo-wall__intro-title {
font-size: clamp(22px, 3vw, 30px);
font-weight: 700;
line-height: 1.25;
color: #111827;
margin-bottom: 8px;
}

.masonry-photo-wall__intro-description {
font-size: 14px;
line-height: 1.8;
color: #4b5563;
}

.masonry-photo-wall__intro-description:last-child,
.masonry-photo-wall__intro-title:last-child {
margin-bottom: 0;
}

.masonry-photo-wall__intro-description p {
margin: 0 0 8px;
}

.masonry-photo-wall__intro-description p:last-child {
margin-bottom: 0;
}

.masonry-photo-wall__outro {
margin-top: 20px;
padding: 16px 0 0;
border-top: 1px solid #e5e7eb;
display: grid;
gap: 8px;
}

.masonry-photo-wall__outro-title {
font-size: clamp(20px, 2.8vw, 28px);
font-weight: 700;
line-height: 1.3;
color: #111827;
}

.masonry-photo-wall__outro-description {
font-size: 14px;
line-height: 1.8;
color: #4b5563;
}

.masonry-photo-wall__outro-description p {
margin: 0 0 8px;
}

.masonry-photo-wall__outro-description p:last-child {
margin-bottom: 0;
}

.masonry-photo-wall__outro--align-left {
text-align: left;
}

.masonry-photo-wall__outro--align-center {
text-align: center;
}

.masonry-photo-wall__outro--align-right {
text-align: right;
}

.masonry-photo-wall--has-intro .masonry-photo-wall__intro {
display: grid;
gap: 8px;
}

.masonry-photo-wall__intro--align-left {
text-align: left;
}

.masonry-photo-wall__intro--align-center {
text-align: center;
}

.masonry-photo-wall__intro--align-right {
text-align: right;
}

.masonry-photo-wall__group-heading {
display: grid;
gap: 8px;
}

.masonry-photo-wall__group-heading--align-left {
text-align: left;
}

.masonry-photo-wall__group-heading--align-center {
text-align: center;
}

.masonry-photo-wall__group-heading--align-right {
text-align: right;
}

.masonry-photo-wall__group-heading--top {
margin-bottom: 20px;
}

.masonry-photo-wall__group-heading--bottom {
margin-top: 20px;
}

.masonry-photo-wall__group-heading--with-divider {
padding-bottom: 16px;
border-bottom: 1px solid #e5e7eb;
}

.masonry-photo-wall__group-heading-title {
font-size: clamp(20px, 2.8vw, 28px);
font-weight: 700;
line-height: 1.3;
color: #111827;
margin-bottom: 0;
}

.masonry-photo-wall__group-heading-description {
font-size: 14px;
line-height: 1.8;
color: #4b5563;
}

.masonry-photo-wall__group-heading-description:last-child,
.masonry-photo-wall__group-heading-title:last-child {
margin-bottom: 0;
}

.masonry-photo-wall__group-heading-description p {
margin: 0 0 8px;
}

.masonry-photo-wall__group-heading-description p:last-child {
margin-bottom: 0;
}

.masonry-photo-wall__info-sections {
display: grid;
gap: 22px;
}

.masonry-photo-wall__info-sections--top {
margin: 0 0 20px;
}

.masonry-photo-wall__info-sections--bottom {
margin: 20px 0 0;
}

.masonry-photo-wall__info-sections--align-left {
text-align: left;
}

.masonry-photo-wall__info-sections--align-center {
text-align: center;
}

.masonry-photo-wall__info-sections--align-right {
text-align: right;
}

.masonry-photo-wall__info-section {
display: grid;
gap: 12px;
}

.masonry-photo-wall__info-section--align-left {
text-align: left;
}

.masonry-photo-wall__info-section--align-center {
text-align: center;
}

.masonry-photo-wall__info-section--align-right {
text-align: right;
}

.masonry-photo-wall__info-sections--style-card .masonry-photo-wall__info-section,
.masonry-photo-wall__info-sections--style-editorial .masonry-photo-wall__info-section {
padding: 18px 20px;
border: 1px solid #e5e7eb;
border-radius: 18px;
background: #fff;
}

.masonry-photo-wall__info-sections--style-card .masonry-photo-wall__info-section {
background: #f8fafc;
box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.masonry-photo-wall__info-sections--style-editorial .masonry-photo-wall__info-section {
border: 1px solid rgba(15, 23, 42, 0.16);
border-radius: 0;
background: #fff;
box-shadow: 8px 8px 0 rgba(15, 23, 42, 0.08);
}

.masonry-photo-wall__info-sections--style-compact {
gap: 12px;
}

.masonry-photo-wall__info-sections--style-compact .masonry-photo-wall__info-section {
gap: 8px;
padding: 12px 14px;
border-radius: 12px;
background: #f1f5f9;
}

.masonry-photo-wall__info-sections--style-blank .masonry-photo-wall__info-section,
.masonry-photo-wall__info-section--style-blank {
min-height: 32px;
padding: 12px 14px;
border: 1px dashed #cbd5e1;
border-radius: 12px;
background: rgba(248, 250, 252, 0.72);
}

.masonry-photo-wall__info-section-title {
font-size: clamp(18px, 2.4vw, 26px);
font-weight: 800;
line-height: 1.35;
color: #111827;
}

.masonry-photo-wall__info-section-title--align-left,
.masonry-photo-wall__info-section-description--align-left {
text-align: left;
}

.masonry-photo-wall__info-section-title--align-center,
.masonry-photo-wall__info-section-description--align-center {
text-align: center;
}

.masonry-photo-wall__info-section-title--align-right,
.masonry-photo-wall__info-section-description--align-right {
text-align: right;
}

.masonry-photo-wall__info-section-description {
font-size: 15px;
line-height: 1.9;
color: #4b5563;
}

.masonry-photo-wall__info-section-description p {
margin: 0 0 10px;
}

.masonry-photo-wall__info-section-description p:last-child,
.masonry-photo-wall__info-section-description ul:last-child {
margin-bottom: 0;
}

.masonry-photo-wall__info-section-description ul {
display: grid;
gap: 10px;
margin: 0 0 12px 1.25em;
padding: 0;
list-style-type: square;
}

.masonry-photo-wall__info-section-description li {
padding-left: 0.25em;
}

.masonry-photo-wall__info-sections--align-center .masonry-photo-wall__info-section-description ul,
.masonry-photo-wall__info-sections--align-right .masonry-photo-wall__info-section-description ul,
.masonry-photo-wall__info-section--align-center .masonry-photo-wall__info-section-description ul,
.masonry-photo-wall__info-section--align-right .masonry-photo-wall__info-section-description ul,
.masonry-photo-wall__info-section-description--align-center ul,
.masonry-photo-wall__info-section-description--align-right ul {
display: inline-grid;
text-align: left;
}

.masonry-photo-wall__item-intro {
display: grid;
gap: 6px;
margin-bottom: 10px;
}

.masonry-photo-wall__item-intro-title {
font-size: 15px;
font-weight: 700;
line-height: 1.45;
color: #111827;
margin: 0;
}

.masonry-photo-wall__item-intro-description {
font-size: 13px;
line-height: 1.7;
color: #4b5563;
}

.masonry-photo-wall__item-intro-description:last-child,
.masonry-photo-wall__item-intro-title:last-child {
margin-bottom: 0;
}

.masonry-photo-wall__item-intro-description p {
margin: 0 0 8px;
}

.masonry-photo-wall__item-intro-description p:last-child {
margin-bottom: 0;
}

.masonry-photo-wall--item-intro-align-left .masonry-photo-wall__item-intro {
text-align: left;
}

.masonry-photo-wall--item-intro-align-center .masonry-photo-wall__item-intro {
text-align: center;
}

.masonry-photo-wall--item-intro-align-right .masonry-photo-wall__item-intro {
text-align: right;
}

.masonry-photo-wall__item-outro {
display: grid;
gap: 6px;
margin-top: 10px;
}

.masonry-photo-wall__item-outro-title {
font-size: 15px;
font-weight: 700;
line-height: 1.45;
color: #111827;
margin: 0;
}

.masonry-photo-wall__item-outro-description {
font-size: 13px;
line-height: 1.7;
color: #4b5563;
}

.masonry-photo-wall__item-outro-description p {
margin: 0 0 8px;
}

.masonry-photo-wall__item-outro-description p:last-child,
.masonry-photo-wall__item-outro-description ul:last-child {
margin-bottom: 0;
}

.masonry-photo-wall__item-outro-description ul {
display: grid;
gap: 6px;
margin: 0 0 8px 1.2em;
padding: 0;
list-style-type: square;
}

.masonry-photo-wall--item-outro-align-left .masonry-photo-wall__item-outro {
text-align: left;
}

.masonry-photo-wall--item-outro-align-center .masonry-photo-wall__item-outro {
text-align: center;
}

.masonry-photo-wall--item-outro-align-center .masonry-photo-wall__item-outro-description ul {
display: inline-grid;
text-align: left;
}

.masonry-photo-wall--item-outro-align-right .masonry-photo-wall__item-outro {
text-align: right;
}

.masonry-photo-wall--item-outro-align-right .masonry-photo-wall__item-outro-description ul {
display: inline-grid;
text-align: left;
}

.masonry-photo-wall__item-content-sections {
display: grid;
gap: 10px;
}

.masonry-photo-wall__item-content-sections--top {
margin-bottom: 10px;
}

.masonry-photo-wall__item-content-sections--bottom {
margin-top: 10px;
}

.masonry-photo-wall__item-content-sections--align-left {
text-align: left;
}

.masonry-photo-wall__item-content-sections--align-center {
text-align: center;
}

.masonry-photo-wall__item-content-sections--align-right {
text-align: right;
}

.masonry-photo-wall__item-content-section {
display: grid;
gap: 6px;
}

.masonry-photo-wall__item-content-sections--style-card .masonry-photo-wall__item-content-section,
.masonry-photo-wall__item-content-sections--style-editorial .masonry-photo-wall__item-content-section {
padding: 10px 12px;
border: 1px solid #e5e7eb;
border-radius: 12px;
background: #fff;
}

.masonry-photo-wall__item-content-sections--style-card .masonry-photo-wall__item-content-section {
box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.masonry-photo-wall__item-content-sections--style-editorial .masonry-photo-wall__item-content-section {
border: 1px solid rgba(15, 23, 42, 0.16);
border-radius: 0;
box-shadow: 6px 6px 0 rgba(15, 23, 42, 0.08);
}

.masonry-photo-wall__item-content-sections--style-compact {
gap: 6px;
}

.masonry-photo-wall__item-content-sections--style-compact .masonry-photo-wall__item-content-section {
gap: 4px;
padding: 8px 10px;
border-radius: 10px;
background: #f1f5f9;
}

.masonry-photo-wall__item-content-sections--style-blank .masonry-photo-wall__item-content-section,
.masonry-photo-wall__item-content-section--style-blank {
min-height: 24px;
padding: 8px 10px;
border: 1px dashed #cbd5e1;
border-radius: 10px;
background: rgba(248, 250, 252, 0.72);
}

.masonry-photo-wall__item-content-section--align-left {
text-align: left;
}

.masonry-photo-wall__item-content-section--align-center {
text-align: center;
}

.masonry-photo-wall__item-content-section--align-right {
text-align: right;
}

.masonry-photo-wall__item-content-title {
font-size: var(--masonry-item-content-title-size, 16px);
font-weight: 700;
line-height: 1.45;
color: #111827;
margin: 0;
}

.masonry-photo-wall__item-content-title--align-left,
.masonry-photo-wall__item-content-description--align-left {
text-align: left;
}

.masonry-photo-wall__item-content-title--align-center,
.masonry-photo-wall__item-content-description--align-center {
text-align: center;
}

.masonry-photo-wall__item-content-title--align-right,
.masonry-photo-wall__item-content-description--align-right {
text-align: right;
}

.masonry-photo-wall__item-content-description {
font-size: var(--masonry-item-content-description-size, 13px);
line-height: 1.7;
color: #4b5563;
}

.masonry-photo-wall__item-content-description p {
font-size: inherit;
margin: 0 0 8px;
}

.masonry-photo-wall__item-content-description ul,
.masonry-photo-wall__item-content-description li {
font-size: inherit;
}

.masonry-photo-wall__item-content-description p:last-child,
.masonry-photo-wall__item-content-description ul:last-child {
margin-bottom: 0;
}

.masonry-photo-wall__item-content-description ul {
display: grid;
gap: 6px;
margin: 0 0 8px 1.2em;
padding: 0;
list-style-type: square;
}

.masonry-photo-wall--item-content-align-left .masonry-photo-wall__item-content-sections {
text-align: left;
}

.masonry-photo-wall--item-content-align-center .masonry-photo-wall__item-content-sections {
text-align: center;
}

.masonry-photo-wall--item-content-align-center .masonry-photo-wall__item-content-description ul {
display: inline-grid;
text-align: left;
}

.masonry-photo-wall--item-content-align-right .masonry-photo-wall__item-content-sections {
text-align: right;
}

.masonry-photo-wall--item-content-align-right .masonry-photo-wall__item-content-description ul,
.masonry-photo-wall__item-content-section--align-center .masonry-photo-wall__item-content-description ul,
.masonry-photo-wall__item-content-section--align-right .masonry-photo-wall__item-content-description ul,
.masonry-photo-wall__item-content-description--align-center ul,
.masonry-photo-wall__item-content-description--align-right ul {
display: inline-grid;
text-align: left;
}

/* 說明文字 */
.masonry-photo-wall__caption {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
color: #fff;
padding: 12px 15px;
font-size: 14px;
line-height: 1.4;
-webkit-transform: translateY(100%);
transform: translateY(100%);
transition: transform 0.3s ease;
}

.masonry-photo-wall__item:hover .masonry-photo-wall__caption {
transform: translateY(0);
}

/* Hover 效果 */
.masonry-photo-wall--hover-zoom .masonry-photo-wall__item:hover .masonry-photo-wall__image {
-webkit-transform: scale(1.05);
transform: scale(1.05);
}

.masonry-photo-wall--hover-fade .masonry-photo-wall__item:hover .masonry-photo-wall__image {
opacity: 0.8;
}

.masonry-photo-wall--hover-lift .masonry-photo-wall__item {
transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.masonry-photo-wall--hover-lift .masonry-photo-wall__item:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* 布局樣式 */
/* Masonry 瀑布流 */
.masonry-photo-wall--masonry .masonry-photo-wall__container {
grid-auto-rows: 10px !important;
display: grid !important; /* 確保使用 grid */
}

.masonry-photo-wall--masonry .masonry-photo-wall__item {
grid-row-end: span var(--row-span, 20);
height: auto; /* 讓高度自動計算 */
min-height: 150px; /* 確保有最小高度 */
}

/* 確保 colspan 在 Masonry 布局中生效 */
/* 這些樣式會通過內聯 style 屬性應用，無需額外 CSS 規則 */

.masonry-photo-wall--masonry .masonry-photo-wall__image-wrapper {
height: auto; /* Masonry 布局讓高度自動 */
min-height: 150px; /* 確保有最小高度 */
display: block; /* 改為 block 以確保正確顯示 */
}

.masonry-photo-wall--masonry .masonry-photo-wall__image {
width: 100%;
height: auto; /* Masonry 布局讓圖片保持原始比例 */
min-height: 150px;
display: block;
object-fit: cover;
}

/* Grid 網格 */
.masonry-photo-wall--grid .masonry-photo-wall__container {
display: grid !important; /* 確保使用 grid */
gap: var(--masonry-gap, 15px) !important; /* 使用統一的 gap，參考 homepage-layouts.css */
align-items: start !important; /* 對齊到頂部 */
align-content: start !important; /* 對齊到頂部 */
height: auto !important;
/* 設置 grid-auto-rows 為 auto，讓每個項目根據 aspect-ratio 自動計算高度 */
/* 這樣 grid-row: span 才能正確計算（span 4 就是 4 倍高度） */
grid-auto-rows: auto !important;
}

/* Single Image Layout (Full Width) */
.masonry-photo-wall--single .masonry-photo-wall__container {
    grid-template-columns: 1fr !important;
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.masonry-photo-wall--single .masonry-photo-wall__item {
    width: 100% !important;
    grid-column: 1 / -1 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    height: auto !important;
    min-height: 0 !important;
}

.masonry-photo-wall--single .masonry-photo-wall__image-wrapper {
    height: auto !important;
    padding-bottom: 0 !important;
    min-height: 0 !important;
    display: block !important;
    position: relative !important;
}

.masonry-photo-wall--single .masonry-photo-wall__image {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important; /* Allow natural aspect ratio */
    display: block !important;
    position: relative !important;
}

/* Single Full Display Layout（單張完整顯示） */
.masonry-photo-wall--single-full .masonry-photo-wall__container {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.masonry-photo-wall--single-full .masonry-photo-wall__item {
    width: 100% !important;
    height: auto !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    display: block !important;
    position: relative !important;
    overflow: visible !important;
    min-height: 0 !important;
    aspect-ratio: unset !important;
}

.masonry-photo-wall--single-full .masonry-photo-wall__image-wrapper {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding-bottom: 0 !important;
}

.masonry-photo-wall--single-full .masonry-photo-wall__image {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important;
    display: block !important;
    position: relative !important;
}

.masonry-photo-wall--single-full .masonry-photo-wall__lightbox-link {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    height: auto !important;
}

.masonry-photo-wall--warning-strip {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.masonry-photo-wall--warning-strip .masonry-photo-wall__container {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
}

.masonry-photo-wall--warning-strip .masonry-photo-wall__item,
.masonry-photo-wall--warning-strip .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--warning-strip .masonry-photo-wall__image-wrapper {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    overflow: visible !important;
}

.masonry-photo-wall--warning-strip .masonry-photo-wall__image-wrapper--has-footer-notice,
.masonry-photo-wall--warning-strip .masonry-photo-wall__image-stack {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    background: var(--masonry-footer-notice-bg, #000) !important;
}

.masonry-photo-wall--warning-strip .masonry-photo-wall__image-stage {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    background: var(--masonry-footer-notice-bg, #000);
}

.masonry-photo-wall--warning-strip .masonry-photo-wall__image {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    object-fit: contain !important;
    display: block !important;
}

.masonry-photo-wall--warning-strip .masonry-photo-wall__notice-strip {
    width: 100% !important;
    min-height: 0 !important;
    background: var(--masonry-footer-notice-bg, #000) !important;
    border-top: 0 !important;
}

.masonry-photo-wall--warning-strip .masonry-photo-wall__notice-image {
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    background: var(--masonry-footer-notice-bg, #000) !important;
    display: block !important;
}

/* Two-item fallback: avoid complex layouts reserving empty tracks */
.masonry-photo-wall--two-items-fit .masonry-photo-wall__container {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: none !important;
    grid-auto-rows: auto !important;
    gap: var(--masonry-gap, 15px) !important;
    height: auto !important;
    min-height: 0 !important;
    align-items: stretch !important;
    align-content: stretch !important;
    overflow: visible !important;
}

.masonry-photo-wall--two-items-fit .masonry-photo-wall__item {
    grid-column: auto !important;
    grid-row: auto !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin-top: 0 !important;
    transform: none !important;
}

.masonry-photo-wall--two-items-fit .masonry-photo-wall__item:first-child {
    grid-column: auto !important;
    grid-row: auto !important;
}

.masonry-photo-wall--two-items-fit .masonry-photo-wall__image-wrapper {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    display: flex !important;
    overflow: hidden !important;
}

.masonry-photo-wall--two-items-fit .masonry-photo-wall__image {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    object-fit: cover !important;
    display: block !important;
}

.masonry-photo-wall--two-items-fit.masonry-photo-wall--full-height .masonry-photo-wall__item {
    aspect-ratio: unset !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
}

.masonry-photo-wall--two-items-fit.masonry-photo-wall--full-height .masonry-photo-wall__image-wrapper {
    height: auto !important;
    display: block !important;
}

.masonry-photo-wall--two-items-fit.masonry-photo-wall--full-height .masonry-photo-wall__lightbox-link {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    height: auto !important;
    display: block !important;
}

.masonry-photo-wall--two-items-fit.masonry-photo-wall--full-height .masonry-photo-wall__image {
    height: auto !important;
    object-fit: contain !important;
    max-height: none !important;
}

@media (max-width: 767px) {
    .masonry-photo-wall--two-items-fit .masonry-photo-wall__container {
        grid-template-columns: repeat(var(--masonry-columns-mobile, 2), minmax(0, 1fr)) !important;
    }
}

/* Landscape Side by Side Layout */
.masonry-photo-wall--landscape-side-by-side .masonry-photo-wall__container {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 5px !important;
    height: auto !important;
}

.masonry-photo-wall--landscape-side-by-side .masonry-photo-wall__item {
    aspect-ratio: unset !important;
    width: 100% !important;
    height: var(--masonry-custom-height, 300px) !important;
    min-height: 0 !important;
}

.masonry-photo-wall--landscape-side-by-side .masonry-photo-wall__image-wrapper {
    position: relative !important;
    height: 100% !important;
    width: 100% !important;
    padding-bottom: 0 !important;
    min-height: 0 !important;
    display: block !important;
}

.masonry-photo-wall--landscape-side-by-side .masonry-photo-wall__image {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    object-fit: cover !important;
}

/* Full Height (Natural Aspect Ratio) for Landscape Side by Side */
.masonry-photo-wall--landscape-side-by-side.masonry-photo-wall--full-height .masonry-photo-wall__item {
    aspect-ratio: unset !important;
    height: var(--masonry-custom-height, 300px) !important;
    min-height: 0 !important;
}

.masonry-photo-wall--landscape-side-by-side.masonry-photo-wall--full-height .masonry-photo-wall__image-wrapper {
    height: 100% !important;
    position: relative !important;
}

.masonry-photo-wall--landscape-side-by-side.masonry-photo-wall--full-height .masonry-photo-wall__lightbox-link {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    height: auto !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 1 !important;
}

.masonry-photo-wall--landscape-side-by-side.masonry-photo-wall--full-height .masonry-photo-wall__image {
    height: 100% !important;
    width: 100% !important;
    object-fit: contain !important;
    position: relative !important;
}

/**
 * ============================================================================
 * 靜態網格布局 (grid-static-1 到 grid-static-12)
 * ============================================================================
 * 
 * 1-7 欄：完全按照 gallery-layout 的靜態方式實現
 * - 使用純 CSS Grid，不需要 JavaScript 動態計算
 * - 不支援跨欄數 (colspan) 和跨行數 (rowspan)
 * - 參考 gallery-layout 的 layout-1 到 layout-7 實現
 * 
 * 8-12 欄：客製化實現
 * - 使用純 CSS Grid，不需要 JavaScript 動態計算
 * - 不支援跨欄數 (colspan) 和跨行數 (rowspan)
 * - 適用於需要更多欄數的簡單網格布局
 * ============================================================================
 */

/* 1-7 欄：完全靜態 CSS 實現（參考 gallery-layout，不支援 colspan/rowspan） */
.masonry-photo-wall--grid-static-1 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-2 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-3 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-5-2 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-5-3 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-6 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-7 .masonry-photo-wall__container {
    display: grid !important;
    gap: var(--masonry-gap, 15px) !important;
    align-items: stretch !important;
    align-content: stretch !important;
    height: auto !important;
    grid-auto-rows: auto !important; /* 參考 gallery-layout：使用 auto 讓圖片高度自動計算 */
    grid-auto-flow: row !important;
    /* 參考 gallery-layout：使用固定的 grid-template-columns，不支援 colspan/rowspan */
}

/* 8-12 欄：客製化實現（不支援 colspan/rowspan） */
.masonry-photo-wall--grid-static-8 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-9 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-10 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-11 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-12 .masonry-photo-wall__container {
    display: grid !important;
    gap: var(--masonry-gap, 15px) !important;
    align-items: stretch !important;
    align-content: stretch !important;
    height: auto !important;
    grid-auto-rows: 1fr !important; /* 固定行高，不支援 rowspan */
    grid-auto-flow: row !important;
    /* 注意：8-12 欄不支援跨欄數 (colspan) 和跨行數 (rowspan) */
}

/* 1-7 欄：完全按照 gallery-layout 的布局實現 */
.masonry-photo-wall--grid-static-1 .masonry-photo-wall__container {
grid-template-columns: 1fr !important; /* 1 欄：單欄 */
}

.masonry-photo-wall--grid-static-2 .masonry-photo-wall__container {
grid-template-columns: 1fr 1fr !important; /* 2 欄：左右兩欄 */
}

.masonry-photo-wall--grid-static-3 .masonry-photo-wall__container {
    display: grid !important;
    grid-template-columns: 2fr 1fr !important;
    grid-template-rows: 1fr 1fr !important;
    gap: var(--masonry-gap, 15px) !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    align-items: stretch !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__container {
    display: grid !important;
    grid-template-columns: 1fr 2fr !important;
    grid-template-rows: 1fr 1fr !important;
    gap: var(--masonry-gap, 15px) !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    align-items: stretch !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

.masonry-photo-wall--grid-static-4 .masonry-photo-wall__container {
    display: grid !important;
    grid-template-columns: 2fr 1fr !important;
    grid-template-rows: 1fr 1fr 1fr !important;
    gap: var(--masonry-gap, 15px) !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    align-items: stretch !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__container {
    display: grid !important;
    grid-template-columns: 1fr 2fr !important;
    grid-template-rows: 1fr 1fr 1fr !important;
    gap: var(--masonry-gap, 15px) !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    align-items: stretch !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

/* 靜態網格項目位置控制 */
/* Grid Static 3 (Left 1 Big, Right 2 Small) */
.masonry-photo-wall--grid-static-3 .masonry-photo-wall__item:nth-child(1) { grid-column: 1 / 2 !important; grid-row: 1 / 3 !important; }
.masonry-photo-wall--grid-static-3 .masonry-photo-wall__item:nth-child(2) { grid-column: 2 / 3 !important; grid-row: 1 / 2 !important; }
.masonry-photo-wall--grid-static-3 .masonry-photo-wall__item:nth-child(3) { grid-column: 2 / 3 !important; grid-row: 2 / 3 !important; }
.masonry-photo-wall--grid-static-3 .masonry-photo-wall__item:nth-child(n+4) { display: block !important; grid-column: auto !important; grid-row: auto !important; }

/* Grid Static 3 Right (Left 2 Small, Right 1 Big) */
.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__item:nth-child(1) { grid-column: 1 / 2 !important; grid-row: 1 / 2 !important; }
.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__item:nth-child(2) { grid-column: 1 / 2 !important; grid-row: 2 / 3 !important; }
.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__item:nth-child(3) { grid-column: 2 / 3 !important; grid-row: 1 / 3 !important; }
.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__item:nth-child(n+4) { display: block !important; grid-column: auto !important; grid-row: auto !important; }

/* Grid Static 4 (Left 1 Big, Right 3 Small) */
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__item:nth-child(1) { grid-column: 1 / 2 !important; grid-row: 1 / 4 !important; }
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__item:nth-child(2) { grid-column: 2 / 3 !important; grid-row: 1 / 2 !important; }
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__item:nth-child(3) { grid-column: 2 / 3 !important; grid-row: 2 / 3 !important; }
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__item:nth-child(4) { grid-column: 2 / 3 !important; grid-row: 3 / 4 !important; }
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__item:nth-child(n+5) { display: block !important; grid-column: auto !important; grid-row: auto !important; }

/* Grid Static 4 Right (Left 3 Small, Right 1 Big) */
.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__item:nth-child(1) { grid-column: 1 / 2 !important; grid-row: 1 / 2 !important; }
.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__item:nth-child(2) { grid-column: 1 / 2 !important; grid-row: 2 / 3 !important; }
.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__item:nth-child(3) { grid-column: 1 / 2 !important; grid-row: 3 / 4 !important; }
.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__item:nth-child(4) { grid-column: 2 / 3 !important; grid-row: 1 / 4 !important; }
.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__item:nth-child(n+5) { display: block !important; grid-column: auto !important; grid-row: auto !important; }

/* 確保圖片和包裝器填滿格子 */
.masonry-photo-wall--grid-static-3 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-5-2 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-5-3 .masonry-photo-wall__item {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    min-height: 0 !important;
}

.masonry-photo-wall--grid-static-3 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-static-5-2 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-static-5-3 .masonry-photo-wall__image-wrapper {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    overflow: hidden !important;
    min-height: 0 !important;
}

.masonry-photo-wall--grid-static-3 .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-5-2 .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-5-3 .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-3 .masonry-photo-wall__image-stack,
.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__image-stack,
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__image-stack,
.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__image-stack,
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__image-stack,
.masonry-photo-wall--grid-static-5-2 .masonry-photo-wall__image-stack,
.masonry-photo-wall--grid-static-5-3 .masonry-photo-wall__image-stack,
.masonry-photo-wall--grid-static-3 .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-static-5-2 .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-static-5-3 .masonry-photo-wall__image-stage {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
}

.masonry-photo-wall--grid-static-3 .masonry-photo-wall__image,
.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__image,
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__image,
.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__image,
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__image,
.masonry-photo-wall--grid-static-5-2 .masonry-photo-wall__image,
.masonry-photo-wall--grid-static-5-3 .masonry-photo-wall__image {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: var(--masonry-focal-position, center) !important;
}

.masonry-photo-wall--grid-image-mode-contain.masonry-photo-wall--grid .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-contain.masonry-photo-wall--mosaic .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-contain.masonry-photo-wall--instagram .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-contain.masonry-photo-wall--featured-big .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-contain.masonry-photo-wall--split-focus .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-contain.masonry-photo-wall--two-cols .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-contain.masonry-photo-wall--offset-cols .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-contain.masonry-photo-wall--grid-static-2 .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-contain.masonry-photo-wall--grid-static-3 .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-contain.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-contain.masonry-photo-wall--grid-static-4 .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-contain.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-contain.masonry-photo-wall--grid-static-5 .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-contain.masonry-photo-wall--grid-static-5-2 .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-contain.masonry-photo-wall--grid-static-5-3 .masonry-photo-wall__image {
    object-fit: contain !important;
    background: transparent !important;
}

.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--mosaic .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--instagram .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--featured-big .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--split-focus .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--two-cols .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--offset-cols .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-2 .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-3 .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-4 .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-5 .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-5-2 .masonry-photo-wall__image,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-5-3 .masonry-photo-wall__image {
    object-fit: contain !important;
    background: #e5e7eb !important;
}

.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--mosaic .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--instagram .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--featured-big .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--split-focus .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--two-cols .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--offset-cols .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-2 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-3 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-4 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-5 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-5-2 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-5-3 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--mosaic .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--instagram .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--featured-big .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--split-focus .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--two-cols .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--offset-cols .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-2 .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-3 .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-4 .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-5 .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-5-2 .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-image-mode-letterbox.masonry-photo-wall--grid-static-5-3 .masonry-photo-wall__image-stage {
    background: #e5e7eb !important;
}

/* 2欄完整顯示模式（適合教學） */
.masonry-photo-wall--grid-static-2.masonry-photo-wall--full-height .masonry-photo-wall__container,
.masonry-photo-wall--two-cols.masonry-photo-wall--full-height .masonry-photo-wall__container {
grid-template-columns: 1fr 1fr !important;
grid-auto-rows: auto !important; /* 讓行高自動適應內容 */
}

.masonry-photo-wall--grid-static-2.masonry-photo-wall--full-height .masonry-photo-wall__item,
.masonry-photo-wall--two-cols.masonry-photo-wall--full-height .masonry-photo-wall__item {
aspect-ratio: unset !important;
height: auto !important;
min-height: 0 !important;
display: flex !important;
flex-direction: column !important;
}

.masonry-photo-wall--grid-static-2.masonry-photo-wall--full-height .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--two-cols.masonry-photo-wall--full-height .masonry-photo-wall__image-wrapper {
position: relative !important;
height: auto !important;
min-height: 0 !important;
flex-shrink: 0 !important;
width: 100% !important;
/* 確保包裝器不會被壓縮 */
align-self: flex-start !important;
}

.masonry-photo-wall--grid-static-2.masonry-photo-wall--full-height .masonry-photo-wall__image,
.masonry-photo-wall--two-cols.masonry-photo-wall--full-height .masonry-photo-wall__image {
object-fit: contain !important;
height: auto !important;
width: 100% !important;
position: relative !important;
max-height: none !important;
display: block !important;
/* 確保圖片有正確的高度 - 移除 min-height，讓圖片自然高度顯示 */
}

/* 圖說模式 - 在各自圖片下方顯示 */
.masonry-photo-wall--has-individual-captions .masonry-photo-wall__item {
overflow: visible;
}

.masonry-photo-wall__image-caption-item--inline {
margin-top: 8px;
padding-top: 8px;
border-top: 1px solid #e0e0e0;
font-size: 13px;
line-height: 1.5;
color: #666;
/* 確保圖說可見 */
display: block !important;
visibility: visible !important;
opacity: 1 !important;
width: 100% !important;
}

.masonry-photo-wall--caption-style-card .masonry-photo-wall__image-caption-item--inline,
.masonry-photo-wall--caption-style-card .masonry-photo-wall__image-captions {
padding: 14px 16px;
border: 1px solid #e2e8f0;
border-radius: 16px;
background: #f8fafc;
}

.masonry-photo-wall--caption-style-card .masonry-photo-wall__image-caption-item--inline {
margin-top: 12px;
border-top: 0;
}

.masonry-photo-wall--caption-style-card .masonry-photo-wall__image-captions {
margin-top: 18px;
padding-top: 14px;
}

.masonry-photo-wall--caption-style-compact .masonry-photo-wall__image-caption-item--inline,
.masonry-photo-wall--caption-style-compact .masonry-photo-wall__image-captions {
padding: 10px 12px;
border: 1px solid #e5e7eb;
border-radius: 12px;
background: #f1f5f9;
}

.masonry-photo-wall--caption-style-compact .masonry-photo-wall__image-caption-item--inline {
margin-top: 10px;
border-top: 0;
font-size: 12px;
}

.masonry-photo-wall--caption-style-compact .masonry-photo-wall__image-captions {
margin-top: 16px;
padding-top: 10px;
}

.masonry-photo-wall__image-caption-item--inline .masonry-photo-wall__image-caption-text {
margin-bottom: 4px;
font-weight: 500;
display: block !important;
}

.masonry-photo-wall__image-caption-item--inline .masonry-photo-wall__image-caption-source {
font-size: 11px;
color: #999;
font-style: italic;
display: block !important;
line-height: 1.6;
}

.masonry-photo-wall--caption-style-compact .masonry-photo-wall__image-caption-item--inline .masonry-photo-wall__image-caption-source,
.masonry-photo-wall--caption-style-compact .masonry-photo-wall__image-caption-unified-source {
font-size: 10px;
font-style: normal;
letter-spacing: 0.04em;
text-transform: uppercase;
color: #64748b;
}

.masonry-photo-wall--caption-align-left .masonry-photo-wall__image-caption-item--inline,
.masonry-photo-wall--caption-align-left .masonry-photo-wall__image-caption-unified-caption {
text-align: left;
}

.masonry-photo-wall--caption-align-center .masonry-photo-wall__image-caption-item--inline,
.masonry-photo-wall--caption-align-center .masonry-photo-wall__image-caption-unified-caption {
text-align: center;
}

.masonry-photo-wall--caption-align-right .masonry-photo-wall__image-caption-item--inline,
.masonry-photo-wall--caption-align-right .masonry-photo-wall__image-caption-unified-caption {
text-align: right;
}

.masonry-photo-wall__image-caption-text a,
.masonry-photo-wall__image-caption-source a,
.masonry-photo-wall__image-caption-unified-caption a,
.masonry-photo-wall__image-caption-unified-source a,
.masonry-photo-wall__lightbox-caption-text a,
.masonry-photo-wall__lightbox-caption-source a {
color: inherit;
text-decoration: none;
transition: all var(--fc-transition-normal);
}

/* 統一來源（顯示在最底下，僅當有統一來源時） */
.masonry-photo-wall--has-caption .masonry-photo-wall__image-captions {
margin-top: 20px;
padding-top: 20px;
border-top: 1px solid #e0e0e0;
}

.masonry-photo-wall--caption-style-card.masonry-photo-wall--has-caption .masonry-photo-wall__image-captions,
.masonry-photo-wall--caption-style-compact.masonry-photo-wall--has-caption .masonry-photo-wall__image-captions {
border-top: 0;
}

.masonry-photo-wall--has-group-heading-bottom.masonry-photo-wall--group-heading-divider .masonry-photo-wall__image-captions {
margin-top: 14px;
padding-top: 0;
border-top: 0;
}

/* 統一圖說（顯示在來源上方） */
.masonry-photo-wall__image-caption-unified-caption {
font-size: 13px;
color: #666;
text-align: center;
margin-bottom: 6px;
line-height: 1.6;
}

/* 統一來源（顯示在最底下） */
.masonry-photo-wall__image-caption-unified-source {
font-size: 12px;
color: #999;
font-style: italic;
text-align: center; /* 居中顯示 */
/* 移除 border-top，避免與 .masonry-photo-wall__image-captions 的 border-top 重複 */
/* border-top 已在 .masonry-photo-wall__image-captions 中處理 */
}

.masonry-photo-wall__image-caption-unified-source-list {
display: grid;
gap: 4px;
}

.masonry-photo-wall__image-caption-unified-source-entry {
display: block;
}

.masonry-photo-wall__image-caption-unified-source-list .masonry-photo-wall__image-caption-unified-source-entry + .masonry-photo-wall__image-caption-unified-source-entry {
margin-top: 2px;
}

.masonry-photo-wall__lightbox-caption-text {
font-size: 13px;
line-height: 1.6;
}

.masonry-photo-wall__lightbox-caption-source {
margin-top: 6px;
font-size: 12px;
line-height: 1.5;
opacity: 0.8;
}

@media (max-width: 767px) {
.masonry-photo-wall__intro {
margin-bottom: 16px;
padding-bottom: 14px;
}

.masonry-photo-wall__intro-title {
font-size: clamp(18px, 5vw, 24px);
}

.masonry-photo-wall__intro-description {
font-size: 13px;
line-height: 1.7;
}

.masonry-photo-wall__outro {
margin-top: 16px;
padding-top: 14px;
}

.masonry-photo-wall__outro-title,
.masonry-photo-wall__info-section-title {
font-size: clamp(18px, 5vw, 24px);
}

.masonry-photo-wall__outro-description,
.masonry-photo-wall__info-section-description {
font-size: 13px;
line-height: 1.7;
}

.masonry-photo-wall__info-sections--top {
margin-bottom: 16px;
}

.masonry-photo-wall__info-sections--bottom {
margin-top: 16px;
}

.masonry-photo-wall__info-section {
gap: 10px;
}

.masonry-photo-wall__info-sections--style-card .masonry-photo-wall__info-section,
.masonry-photo-wall__info-sections--style-editorial .masonry-photo-wall__info-section {
padding: 15px 16px;
border-radius: 14px;
}

.masonry-photo-wall__info-sections--style-editorial .masonry-photo-wall__info-section {
border-radius: 0;
}

.masonry-photo-wall__group-heading--top {
margin-bottom: 16px;
}

.masonry-photo-wall__group-heading--bottom {
margin-top: 16px;
}

.masonry-photo-wall__group-heading--with-divider {
padding-bottom: 14px;
}

.masonry-photo-wall__group-heading-title {
font-size: clamp(18px, 5vw, 24px);
}

.masonry-photo-wall__group-heading-description {
font-size: 13px;
line-height: 1.7;
}
}

/* 5 欄：上1大下4小（預設） */
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__container {
    grid-template-columns: repeat(4, 1fr) !important;
    grid-template-rows: 2fr 1fr !important;
    align-items: stretch !important;
    min-height: 0 !important;
}

/* 5 欄：上1大下3小 */
.masonry-photo-wall--grid-static-5-3 .masonry-photo-wall__container {
    grid-template-columns: repeat(3, 1fr) !important;
    grid-template-rows: 2fr 1fr !important;
    align-items: stretch !important;
    min-height: 0 !important;
}

/* 5 欄：上1大下2小 */
.masonry-photo-wall--grid-static-5-2 .masonry-photo-wall__container {
    grid-template-columns: repeat(2, 1fr) !important;
    grid-template-rows: 2fr 1fr !important;
    align-items: stretch !important;
    min-height: 0 !important;
}

.masonry-photo-wall--grid-static-6 .masonry-photo-wall__container {
grid-template-columns: repeat(6, 1fr) !important; /* 6 欄：簡單 6 欄網格 */
}

.masonry-photo-wall--grid-static-7 .masonry-photo-wall__container {
grid-template-columns: repeat(7, 1fr) !important; /* 7 欄：簡單 7 欄網格 */
}

.masonry-photo-wall--grid-static-8 .masonry-photo-wall__container {
grid-template-columns: repeat(8, 1fr) !important;
}

.masonry-photo-wall--grid-static-9 .masonry-photo-wall__container {
grid-template-columns: repeat(9, 1fr) !important;
}

.masonry-photo-wall--grid-static-10 .masonry-photo-wall__container {
grid-template-columns: repeat(10, 1fr) !important;
}

.masonry-photo-wall--grid-static-11 .masonry-photo-wall__container {
grid-template-columns: repeat(11, 1fr) !important;
}

.masonry-photo-wall--grid-static-12 .masonry-photo-wall__container {
grid-template-columns: repeat(12, 1fr) !important;
}

/* 1-7 欄：完全按照 gallery-layout 的項目樣式 */
.masonry-photo-wall--grid-static-1 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-2 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-3 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-6 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-7 .masonry-photo-wall__item {
/* 參考 gallery-layout：.wp-block-image 樣式 */
margin: 0 !important;
padding: 0 !important;
box-sizing: border-box !important;
overflow: hidden !important;
width: 100% !important;
height: 100% !important; /* 參考 gallery-layout：height: 100% */
position: relative !important;
display: block !important;
visibility: visible !important;
opacity: 1 !important;
align-self: start !important;
/* 覆蓋基礎樣式 */
min-height: 0 !important; /* 移除基礎樣式的 min-height: 150px */
align-items: unset !important; /* 移除 flex 相關屬性 */
/* 覆蓋外部樣式（如 #si-single-content a） */
height: 100% !important; /* 確保高度不被外部樣式覆蓋 */
}

.masonry-photo-wall--grid-static-3 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-5-2 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-5-3 .masonry-photo-wall__item {
display: flex !important;
flex-direction: column !important;
}

/* 覆蓋外部樣式對 lightbox-link 的影響 */
.masonry-photo-wall--grid-static-1 .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-2 .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-3 .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-6 .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-7 .masonry-photo-wall__lightbox-link {
height: 100% !important; /* 覆蓋 #si-single-content a { height: auto; } */
width: 100% !important;
display: flex !important;
flex-direction: column !important;
position: relative !important;
top: auto !important;
left: auto !important;
z-index: 1 !important;
min-height: 0 !important;
}

/* 1、2、6、7 欄：使用 aspect-ratio 確保項目有高度 */
.masonry-photo-wall--grid-static-1 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-2 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-6 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-7 .masonry-photo-wall__item {
aspect-ratio: 1 / 1 !important; /* 使用正方形比例確保項目有高度 */
}

/* 3、4、5 欄：不使用 aspect-ratio，讓 JavaScript 控制高度 */
.masonry-photo-wall--grid-static-3 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__item {
aspect-ratio: unset !important; /* 讓 JavaScript 控制高度 */
}

/* 8-12 欄：客製化項目樣式 */
.masonry-photo-wall--grid-static-8 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-9 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-10 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-11 .masonry-photo-wall__item,
.masonry-photo-wall--grid-static-12 .masonry-photo-wall__item {
aspect-ratio: 1 / 1 !important;
width: 100% !important;
height: auto !important;
position: relative !important;
overflow: hidden !important;
display: block !important;
align-items: unset !important;
min-height: 0 !important;
max-height: none !important;
box-sizing: border-box !important;
margin: 0 !important;
padding: 0 !important;
visibility: visible !important;
opacity: 1 !important;
align-self: start !important;
}

/* 1-7 欄：參考 gallery-layout，image-wrapper 應該填滿 item */
.masonry-photo-wall--grid-static-1 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-static-2 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-static-3 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-static-6 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-static-7 .masonry-photo-wall__image-wrapper {
/* 參考 gallery-layout：包裝器應該填滿整個項目 */
position: relative !important;
top: auto !important;
left: auto !important;
width: 100% !important;
height: 100% !important;
display: flex !important;
padding: 0 !important;
margin: 0 !important;
box-sizing: border-box !important;
min-height: 0 !important; /* 移除基礎樣式的 min-height: 150px */
align-items: stretch !important;
justify-content: stretch !important;
overflow: hidden !important;
/* 確保包裝器可見 */
visibility: visible !important;
opacity: 1 !important;
z-index: 0 !important; /* 確保在正確的層級 */
}

.masonry-photo-wall--grid-static-3 .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-5-2 .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-5-3 .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--grid-static-3 .masonry-photo-wall__image-stack,
.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__image-stack,
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__image-stack,
.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__image-stack,
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__image-stack,
.masonry-photo-wall--grid-static-5-2 .masonry-photo-wall__image-stack,
.masonry-photo-wall--grid-static-5-3 .masonry-photo-wall__image-stack,
.masonry-photo-wall--grid-static-3 .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-static-3-right .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-static-4-right .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-static-5-2 .masonry-photo-wall__image-stage,
.masonry-photo-wall--grid-static-5-3 .masonry-photo-wall__image-stage {
display: flex !important;
width: 100% !important;
height: 100% !important;
flex: 1 1 auto !important;
min-height: 0 !important;
}

/* 8-12 欄：保持原有的 image-wrapper 樣式 */
.masonry-photo-wall--grid-static-8 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-static-9 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-static-10 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-static-11 .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid-static-12 .masonry-photo-wall__image-wrapper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
padding: 0;
margin: 0;
box-sizing: border-box;
min-height: 0 !important;
}

/* 1-7 欄：完全按照 gallery-layout 的圖片樣式 */
.masonry-photo-wall--grid-static-1 .masonry-photo-wall__image,
.masonry-photo-wall--grid-static-2 .masonry-photo-wall__image,
.masonry-photo-wall--grid-static-3 .masonry-photo-wall__image,
.masonry-photo-wall--grid-static-4 .masonry-photo-wall__image,
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__image,
.masonry-photo-wall--grid-static-6 .masonry-photo-wall__image,
.masonry-photo-wall--grid-static-7 .masonry-photo-wall__image {
/* 參考 gallery-layout：.wp-block-image img 樣式 */
display: block !important;
width: 100% !important;
height: 100% !important;
object-fit: cover !important; /* gallery-layout 在 JS 中設置為 cover */
object-position: var(--masonry-focal-position, center) !important;
border: none !important;
margin: 0 !important;
padding: 0 !important;
min-height: 0 !important;
/* 確保圖片可見 */
visibility: visible !important;
opacity: 1 !important;
max-width: 100% !important;
/* 確保圖片正確顯示 */
position: relative !important;
z-index: 1 !important;
/* 覆蓋外部樣式（如 #si-single-content a img） */
height: 100% !important; /* 確保高度不被外部樣式覆蓋 */
}

/* 8-12 欄：保持原有的圖片樣式 */
.masonry-photo-wall--grid-static-8 .masonry-photo-wall__image,
.masonry-photo-wall--grid-static-9 .masonry-photo-wall__image,
.masonry-photo-wall--grid-static-10 .masonry-photo-wall__image,
.masonry-photo-wall--grid-static-11 .masonry-photo-wall__image,
.masonry-photo-wall--grid-static-12 .masonry-photo-wall__image {
width: 100% !important;
height: 100% !important;
object-fit: cover !important;
object-position: var(--masonry-focal-position, center) !important;
display: block !important;
min-height: 0 !important;
aspect-ratio: unset !important;
}

/* 注意：所有靜態網格布局（1-12 欄）都不支援 data-colspan 和 data-rowspan 屬性 */

/* 注意：所有靜態網格布局（1-12 欄）都不支援 colspan/rowspan，因此不需要特殊的樣式規則 */

/* 靜態網格布局響應式（參考 gallery-layout） */
@media (max-width: 1180px) {
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-6 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-7 .masonry-photo-wall__container {
grid-template-columns: repeat(3, 1fr) !important;
}
/* 8-12 欄：最多 4 欄 */
.masonry-photo-wall--grid-static-8 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-9 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-10 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-11 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-12 .masonry-photo-wall__container {
grid-template-columns: repeat(4, 1fr) !important;
}

/* 2欄完整顯示模式：平板也是2欄 */
.masonry-photo-wall--grid-static-2.masonry-photo-wall--full-height .masonry-photo-wall__container,
.masonry-photo-wall--two-cols.masonry-photo-wall--full-height .masonry-photo-wall__container {
grid-template-columns: 1fr 1fr !important;
}
}

@media (max-width: 767px) {
.masonry-photo-wall--grid-static-5 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-6 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-7 .masonry-photo-wall__container {
grid-template-columns: repeat(2, 1fr) !important;
}
/* 8-12 欄：手機版最多 2 欄 */
.masonry-photo-wall--grid-static-8 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-9 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-10 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-11 .masonry-photo-wall__container,
.masonry-photo-wall--grid-static-12 .masonry-photo-wall__container {
grid-template-columns: repeat(2, 1fr) !important;
}

/* 2欄完整顯示模式：手機版也是2欄 */
.masonry-photo-wall--grid-static-2.masonry-photo-wall--full-height .masonry-photo-wall__container,
.masonry-photo-wall--two-cols.masonry-photo-wall--full-height .masonry-photo-wall__container {
grid-template-columns: 1fr 1fr !important;
}
}


/* 僅在桌面版應用 align-content: start 來修復空白 */
@media (min-width: 1181px) {
.masonry-photo-wall--grid .masonry-photo-wall__container {
align-content: start !important; /* 對齊到頂部，避免底部空白 */
}
}


.masonry-photo-wall--grid .masonry-photo-wall__item {
aspect-ratio: 1 / 1 !important; /* 使用 aspect-ratio 創建正方形，參考 homepage-layouts.css */
width: 100% !important;
height: auto !important; /* 讓 aspect-ratio 控制高度 */
position: relative !important;
overflow: hidden !important;
display: block !important; /* 覆蓋基礎樣式的 flex */
align-items: unset !important; /* 移除 flex 相關屬性 */
min-height: 0 !important; /* 覆蓋基礎樣式的 min-height: 150px */
max-height: none !important;
box-sizing: border-box !important;
/* 確保項目沒有多餘的 margin 和 padding */
margin: 0 !important;
padding: 0 !important;
/* 確保項目可見 */
visibility: visible !important;
opacity: 1 !important;
}

/* 橫圖處理：橫圖（寬度大於高度）可以通過設置 colspan 來適應 */
/* 例如：橫圖（16:9）可以設置 colspan: 2, rowspan: 1 來顯示 */
/* 或者設置 colspan: 3, rowspan: 1 來顯示更寬的橫圖 */
/* 當設置了 colspan 或 rowspan 時，aspect-ratio 會自動變為 auto，讓 Grid 計算正確的高度 */

/* 確保 colspan 和 rowspan 在 Grid 布局中生效 */
/* 只有當 colspan > 1 或 rowspan > 1 時才使用 aspect-ratio: auto */
.masonry-photo-wall--grid .masonry-photo-wall__item[style*="grid-column"],
.masonry-photo-wall--grid .masonry-photo-wall__item[style*="grid-row"],
.masonry-photo-wall--grid .masonry-photo-wall__item[style*="grid-column: span"],
.masonry-photo-wall--grid .masonry-photo-wall__item[style*="grid-row: span"],
.masonry-photo-wall--grid .masonry-photo-wall__item[data-colspan]:not([data-colspan="1"]),
.masonry-photo-wall--grid .masonry-photo-wall__item[data-rowspan]:not([data-rowspan="1"]) {
/* 允許自訂 grid-column 和 grid-row（僅當 colspan > 1 或 rowspan > 1） */
aspect-ratio: auto !important; /* 當有 colspan/rowspan > 1 時，不使用固定長寬比 */
height: auto !important; /* 恢復自動高度，讓 Grid 自動計算 */
min-height: 200px !important; /* 確保有最小高度，避免高度為 0 */
}

/* 確保跨欄/跨行項目的圖片包裝器和圖片正確顯示 */
.masonry-photo-wall--grid .masonry-photo-wall__item[style*="grid-column"] .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid .masonry-photo-wall__item[style*="grid-row"] .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid .masonry-photo-wall__item[data-colspan]:not([data-colspan="1"]) .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--grid .masonry-photo-wall__item[data-rowspan]:not([data-rowspan="1"]) .masonry-photo-wall__image-wrapper {
position: absolute !important;
top: 0 !important;
left: 0 !important;
width: 100% !important;
height: 100% !important; /* 確保包裝器填滿項目 */
min-height: 0 !important;
display: flex !important;
align-items: center !important;
justify-content: center !important;
}

.masonry-photo-wall--grid .masonry-photo-wall__item[style*="grid-column"] .masonry-photo-wall__image,
.masonry-photo-wall--grid .masonry-photo-wall__item[style*="grid-row"] .masonry-photo-wall__image,
.masonry-photo-wall--grid .masonry-photo-wall__item[data-colspan]:not([data-colspan="1"]) .masonry-photo-wall__image,
.masonry-photo-wall--grid .masonry-photo-wall__item[data-rowspan]:not([data-rowspan="1"]) .masonry-photo-wall__image {
width: 100% !important;
height: 100% !important;
object-fit: cover !important;
object-position: var(--masonry-focal-position, center) !important;
min-height: 0 !important;
display: block !important;
}

.masonry-photo-wall--grid .masonry-photo-wall__image-wrapper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
padding: 0;
margin: 0;
box-sizing: border-box;
min-height: 0 !important; /* 覆蓋基礎樣式的 min-height: 150px */
}

.masonry-photo-wall--grid .masonry-photo-wall__image {
width: 100% !important;
height: 100% !important;
object-fit: cover !important; /* 確保圖片填滿正方形容器 */
object-position: var(--masonry-focal-position, center) !important;
display: block !important;
min-height: 0 !important; /* 覆蓋基礎樣式的 min-height: 150px */
/* 覆蓋圖片內聯的 aspect-ratio，確保使用容器的正方形 */
aspect-ratio: unset !important;
}

/* Justified 對齊式 */
.masonry-photo-wall--justified .masonry-photo-wall__container {
display: block !important; /* 使用 block，由 JavaScript 動態生成行 */
width: 100%;
grid-template-columns: none !important; /* 覆蓋 grid 設定 */
grid-auto-rows: none !important;
gap: 0 !important; /* Justified 布局不使用 grid gap，改用 row margin-bottom */
/* 確保容器不會影響行的 margin */
overflow: visible !important;
/* 防止 margin collapse */
padding: 0 !important;
border: 0 !important;
}

/* 行容器（由 JavaScript 動態生成） */
.masonry-photo-wall--justified .masonry-photo-wall__row {
display: flex !important;
width: 100% !important;
box-sizing: border-box;
/* margin-bottom 完全由 JavaScript 通過內聯樣式控制，此處不設置任何默認值 */
/* 確保行之間有間距 */
position: relative;
/* 確保 margin-bottom 不會被其他規則覆蓋 */
margin-top: 0 !important;
/* 防止 margin collapse */
overflow: visible !important;
/* 確保 margin-bottom 生效 */
min-height: 0 !important;
}

/* 注意：最後一行的 margin-bottom 由 JavaScript 設置為 0 */
/* 無需額外 CSS 規則，完全由 JavaScript 控制 */

/* 響應式規則已移除 - 完全依賴 JavaScript 內聯樣式設置 margin-bottom */
/* 這樣可以避免 CSS 規則與內聯樣式衝突 */

/* Justified 項目 */
.masonry-photo-wall--justified .masonry-photo-wall__justified-item {
flex-shrink: 0;
display: block;
height: 100%;
box-sizing: border-box;
overflow: hidden;
transition: transform 0.2s ease, box-shadow 0.2s ease;
position: relative;
margin: 0 !important; /* 確保項目本身沒有 margin，間距由 row 的 margin-bottom 控制 */
padding: 0 !important;
/* 確保項目不會超出行的邊界 */
max-width: 100%;
max-height: 100%;
/* 移除 min-height，讓項目完全由行的實際高度控制 */
min-height: 0 !important;
}

/* Justified 布局不支援 colspan/rowspan（會導致版面溢出） */
/* 相關 CSS 規則已移除 */

.masonry-photo-wall--justified .masonry-photo-wall__justified-item:hover {
transform: translateY(-3px);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
z-index: 2;
/* 確保 hover 時不會影響行的 margin */
margin-bottom: 0 !important;
}

.masonry-photo-wall--justified .masonry-photo-wall__justified-item .masonry-photo-wall__image-wrapper {
width: 100%;
height: 100%;
display: block;
position: relative;
overflow: hidden;
/* 確保圖片包裝器不會超出行的邊界 */
box-sizing: border-box;
margin: 0 !important;
padding: 0 !important;
/* 移除 min-height，讓包裝器完全由項目的實際高度控制 */
min-height: 0 !important;
}

.masonry-photo-wall--justified .masonry-photo-wall__justified-item img {
width: 100%;
height: 100%;
display: block;
border: none !important;
object-fit: contain;
object-position: var(--masonry-focal-position, center);
/* 確保圖片不會超出容器邊界，影響視覺間距 */
max-width: 100%;
max-height: 100%;
/* vertical-align 對 block 元素無效，已移除 */
/* 確保圖片不會導致視覺上的間距消失 */
margin: 0 !important;
padding: 0 !important;
}

/* 確保 lightbox link 正確覆蓋 */
.masonry-photo-wall--justified .masonry-photo-wall__justified-item .masonry-photo-wall__lightbox-link {
position: relative;
top: auto;
left: auto;
width: 100%;
height: auto;
z-index: 1;
display: block;
}

/* 確保 caption 正確顯示 */
.masonry-photo-wall--justified .masonry-photo-wall__justified-item .masonry-photo-wall__caption {
z-index: 2;
}

/* 精準對齊時移除 LQIP 模糊 placeholder，避免 Safari 等瀏覽器殘留或疊加造成模糊 */
.masonry-photo-wall--justified .masonry-photo-wall__justified-item img.lazy-with-lqip,
.masonry-photo-wall--justified .masonry-photo-wall__justified-item .masonry-photo-wall__image.lazy-with-lqip {
background-image: none !important;
background-size: unset !important;
}

/* 精準對齊：全域關閉 compositor 層（translateZ/will-change），避免整張圖被模糊 */
.masonry-photo-wall--justified .masonry-photo-wall__row,
.masonry-photo-wall--justified .masonry-photo-wall__justified-item,
.masonry-photo-wall--justified .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--justified .masonry-photo-wall__image {
    transform: none !important;
    -webkit-transform: none !important;
    will-change: auto !important;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.masonry-photo-wall--justified .masonry-photo-wall__image {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    filter: none !important;
}

/* Safari 精準對齊模糊修復：不建 compositor 層、搭配 JS 整數寬度 */
@media screen and (-webkit-min-device-pixel-ratio:0) {
    .masonry-photo-wall--justified .masonry-photo-wall__image {
        -webkit-transform: none !important;
        transform: none !important;
        image-rendering: -webkit-optimize-contrast !important;
        position: relative !important;
        display: block !important;
    }
}

/* Mosaic 拼貼 */
.masonry-photo-wall--mosaic .masonry-photo-wall__container {
display: grid !important;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
grid-auto-rows: 200px !important;
width: 100%;
gap: var(--masonry-gap, 15px); /* 確保使用 gap */
}

.masonry-photo-wall--mosaic .masonry-photo-wall__item {
min-height: 200px; /* 確保有最小高度 */
}

.masonry-photo-wall--mosaic .masonry-photo-wall__item:nth-child(odd) {
grid-row: span 2;
min-height: 400px; /* 跨兩行的項目需要兩倍高度 */
}

/* 確保 colspan 和 rowspan 在 Mosaic 布局中生效（優先於 nth-child 規則） */
/* 這些樣式會通過內聯 style 屬性應用，無需額外 CSS 規則 */

.masonry-photo-wall--mosaic .masonry-photo-wall__image-wrapper {
height: 100%;
min-height: 200px;
}

.masonry-photo-wall--mosaic .masonry-photo-wall__image {
width: 100%;
height: 100%;
min-height: 200px;
}

/* Pinterest 風格 */
.masonry-photo-wall--pinterest .masonry-photo-wall__container {
column-count: var(--masonry-columns-desktop, 3) !important;
column-gap: var(--masonry-gap, 15px);
width: 100%;
display: block !important; /* 確保容器可見，覆蓋 grid */
grid-template-columns: none !important; /* 覆蓋 grid 設定 */
grid-auto-rows: none !important;
}

.masonry-photo-wall--pinterest .masonry-photo-wall__item {
break-inside: avoid;
margin-bottom: var(--masonry-gap, 15px);
display: inline-block;
width: 100%;
page-break-inside: avoid;
min-height: 150px; /* 確保有最小高度 */
/* vertical-align 對 inline-block 有效，無需移除 */
}

/* Pinterest 布局不支援 colspan/rowspan（會導致版面溢出） */
/* 相關 CSS 規則已移除 */

.masonry-photo-wall--pinterest .masonry-photo-wall__image-wrapper {
height: auto;
min-height: 150px;
display: block;
width: 100%;
}

.masonry-photo-wall--pinterest .masonry-photo-wall__image {
width: 100%;
height: auto;
display: block;
min-height: 150px;
}

@media (max-width: 1180px) {
.masonry-photo-wall--pinterest .masonry-photo-wall__container {
column-count: var(--masonry-columns-tablet, 2) !important;
}
}

@media (max-width: 767px) {
.masonry-photo-wall--pinterest .masonry-photo-wall__container {
/* 移除強制單欄，使用設定的欄位數 */
column-count: var(--masonry-columns-mobile, 2) !important;
}
}

/* Instagram 方格 */
.masonry-photo-wall--instagram .masonry-photo-wall__container {
display: grid !important; /* 確保使用 grid */
}

.masonry-photo-wall--instagram .masonry-photo-wall__item {
aspect-ratio: 1 / 1 !important; /* Instagram 布局使用正方形，強制保持 */
width: 100% !important;
height: auto !important;
padding-bottom: 0 !important;
position: relative !important;
overflow: hidden !important;
display: flex !important;
flex-direction: column !important;
align-items: stretch !important;
justify-content: stretch !important;
min-height: 0 !important;
box-sizing: border-box !important;
}

/* 確保 colspan 和 rowspan 在 Instagram 布局中生效 */
.masonry-photo-wall--instagram .masonry-photo-wall__item[style*="grid-column"],
.masonry-photo-wall--instagram .masonry-photo-wall__item[style*="grid-row"] {
/* 允許自訂 grid-column 和 grid-row */
aspect-ratio: auto !important; /* 當有 colspan/rowspan 時，不使用固定長寬比 */
padding-bottom: 0 !important; /* 移除備用 padding */
height: auto !important; /* 恢復自動高度 */
}

.masonry-photo-wall--instagram .masonry-photo-wall__image-wrapper {
position: relative;
top: auto;
left: auto;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
min-height: 0;
flex: 1 1 auto;
overflow: hidden;
}

.masonry-photo-wall--instagram .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--instagram .masonry-photo-wall__image-stack,
.masonry-photo-wall--instagram .masonry-photo-wall__image-stage {
display: flex;
width: 100%;
height: 100%;
flex: 1 1 auto;
min-height: 0;
}

.masonry-photo-wall--instagram .masonry-photo-wall__image {
width: 100%;
height: 100%;
object-fit: cover; /* 確保圖片填滿正方形容器 */
object-position: var(--masonry-focal-position, center);
}

/* 載入動畫已移至基礎樣式中，避免重複定義 */

/* 禁用過渡效果，避免重新計算時閃爍 */
.masonry-photo-wall--recalculating {
animation: none !important;
transition: none !important;
opacity: 0 !important;
visibility: hidden !important;
}

/* =============================================================================
   從 gallery-layout 新增的布局樣式
   ============================================================================= */

/* 均分列 (Equal Row) */
.masonry-photo-wall--equal-row .masonry-photo-wall__container {
display: grid !important;
grid-template-columns: repeat(var(--masonry-columns-desktop, 3), minmax(0, 1fr)) !important;
grid-auto-rows: auto !important;
gap: var(--masonry-gap, 15px) !important;
width: 100%;
align-items: stretch;
align-content: stretch;
}

.masonry-photo-wall--equal-row .masonry-photo-wall__item {
min-width: 0;
height: auto;
display: block;
}

.masonry-photo-wall--equal-row .masonry-photo-wall__image {
width: 100%;
height: 100%;
object-fit: contain;
object-position: var(--masonry-focal-position, center);
background: #f8f8f8;
}

.masonry-photo-wall--equal-row .masonry-photo-wall__item--has-content-flow {
display: flex;
flex-direction: column;
align-items: stretch;
overflow: visible;
height: auto;
aspect-ratio: auto !important;
}

.masonry-photo-wall--equal-row .masonry-photo-wall__item--has-content-flow.masonry-photo-wall__item--aspect-1\:1 .masonry-photo-wall__image-wrapper {
aspect-ratio: 1 / 1;
}

.masonry-photo-wall--equal-row .masonry-photo-wall__item--has-content-flow.masonry-photo-wall__item--aspect-4\:3 .masonry-photo-wall__image-wrapper {
aspect-ratio: 4 / 3;
}

.masonry-photo-wall--equal-row .masonry-photo-wall__item--has-content-flow.masonry-photo-wall__item--aspect-16\:9 .masonry-photo-wall__image-wrapper {
aspect-ratio: 16 / 9;
}

.masonry-photo-wall--equal-row .masonry-photo-wall__item--has-content-flow.masonry-photo-wall__item--aspect-3\:2 .masonry-photo-wall__image-wrapper {
aspect-ratio: 3 / 2;
}

.masonry-photo-wall--equal-row .masonry-photo-wall__item--has-content-flow .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--equal-row .masonry-photo-wall__item--has-content-flow .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--equal-row .masonry-photo-wall__item--has-content-flow .masonry-photo-wall__image-stage,
.masonry-photo-wall--equal-row .masonry-photo-wall__item--has-content-flow .masonry-photo-wall__image-stage > picture,
.masonry-photo-wall--equal-row .masonry-photo-wall__item--has-content-flow .masonry-photo-wall__image-stage > picture > picture {
height: auto !important;
min-height: 0;
flex: 0 0 auto;
}

.masonry-photo-wall--equal-row .masonry-photo-wall__item--has-content-flow .masonry-photo-wall__image-stage > picture > img,
.masonry-photo-wall--equal-row .masonry-photo-wall__item--has-content-flow .masonry-photo-wall__image-stage > picture > picture > img,
.masonry-photo-wall--equal-row .masonry-photo-wall__item--has-content-flow .masonry-photo-wall__image {
height: auto !important;
max-height: none;
object-fit: contain;
}

/* 左右兩欄 並排 */
.masonry-photo-wall--two-cols .masonry-photo-wall__container {
display: grid !important;
grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
gap: var(--masonry-gap, 15px) !important;
height: auto !important;
align-items: start !important;
}

.masonry-photo-wall--two-cols .masonry-photo-wall__item {
height: 100%;
width: 100%;
display: block;
margin: 0;
padding: 0;
min-width: 0;
}

.masonry-photo-wall--two-cols .masonry-photo-wall__image {
width: 100%;
height: 100%;
object-fit: cover;
}

@media (max-width: 767px) {
.masonry-photo-wall--two-cols .masonry-photo-wall__container {
grid-template-columns: repeat(var(--masonry-columns-mobile, 2), minmax(0, 1fr)) !important;
}

.masonry-photo-wall--two-cols .masonry-photo-wall__item,
.masonry-photo-wall--two-cols .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--two-cols .masonry-photo-wall__lightbox-link {
min-width: 0 !important;
}
}

/* Fullwidth 滿版橫排 */
.masonry-photo-wall--fullwidth {
width: 100% !important;
max-width: 100% !important;
box-sizing: border-box !important;
}

.masonry-photo-wall--fullwidth .masonry-photo-wall__container {
display: flex !important;
flex-wrap: nowrap !important;
overflow-x: auto !important;
gap: var(--masonry-gap, 15px) !important;
scroll-snap-type: x mandatory !important;
width: 100% !important;
margin: 0 !important;
padding: 0 !important;
-webkit-overflow-scrolling: touch;
align-items: stretch !important;
}

.masonry-photo-wall--fullwidth .masonry-photo-wall__item {
flex: 0 0 clamp(260px, 80vw, 920px) !important;
height: clamp(220px, 60vh, 640px) !important;
scroll-snap-align: center !important;
min-width: 0 !important;
position: relative !important;
display: flex !important;
flex-direction: column !important;
overflow: hidden !important;
}

.masonry-photo-wall--fullwidth .masonry-photo-wall__image {
width: 100% !important;
height: 100% !important;
object-fit: cover !important;
}

.masonry-photo-wall--fullwidth .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--fullwidth .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--fullwidth .masonry-photo-wall__image-stack,
.masonry-photo-wall--fullwidth .masonry-photo-wall__image-stage {
display: flex;
width: 100%;
height: 100%;
flex: 1 1 auto;
min-height: 0;
}

/* Coverflow 3D */
.masonry-photo-wall--coverflow .masonry-photo-wall__container {
display: block !important;
height: clamp(300px, 56vh, 520px);
padding: 2rem 0;
perspective: 1200px;
}

.masonry-photo-wall--coverflow .masonry-photo-wall__container:not(.flickity-enabled) {
display: flex !important;
align-items: stretch;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}

.masonry-photo-wall--coverflow .masonry-photo-wall__container .flickity-viewport,
.masonry-photo-wall--coverflow .masonry-photo-wall__container .flickity-slider {
height: 100%;
}

.masonry-photo-wall--coverflow .masonry-photo-wall__item,
.masonry-photo-wall--coverflow .masonry-photo-wall__item.gallery-cell {
width: clamp(220px, 40vw, 520px);
height: 100%;
margin-right: var(--masonry-gap, 15px);
box-sizing: border-box;
transition: transform 0.5s ease;
transform: rotateY(24deg) scale(0.88);
display: flex !important;
flex-direction: column !important;
align-items: stretch !important;
justify-content: stretch !important;
}

.masonry-photo-wall--coverflow .masonry-photo-wall__item:hover,
.masonry-photo-wall--coverflow .masonry-photo-wall__item.is-selected {
transform: rotateY(0) scale(1);
z-index: 10;
}

.masonry-photo-wall--coverflow .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--coverflow .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--coverflow .masonry-photo-wall__image-stack,
.masonry-photo-wall--coverflow .masonry-photo-wall__image-stage {
display: flex;
width: 100%;
height: 100%;
flex: 1 1 auto;
min-height: 0;
}

.masonry-photo-wall--coverflow .masonry-photo-wall__image {
width: 100% !important;
height: 100% !important;
object-fit: cover !important;
}

/* 拍立得效果 (Polaroid) */
.masonry-photo-wall--polaroid .masonry-photo-wall__container {
display: flex !important;
flex-wrap: wrap;
gap: 20px;
justify-content: center;
padding: 20px;
}

.masonry-photo-wall--polaroid .masonry-photo-wall__item {
background: white;
padding: 10px 10px 30px 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
transform: rotate(-2deg);
transition: transform 0.3s ease;
width: 200px !important;
height: auto !important;
position: relative;
}

.masonry-photo-wall--polaroid .masonry-photo-wall__item:nth-child(even) {
transform: rotate(2deg);
}

.masonry-photo-wall--polaroid .masonry-photo-wall__item:hover {
transform: rotate(0deg) scale(1);
z-index: 10;
}

.masonry-photo-wall--polaroid .masonry-photo-wall__image {
object-fit: cover;
}

/* 主圖精選 (Featured Big) */
.masonry-photo-wall--featured-big .masonry-photo-wall__container {
display: grid !important;
gap: var(--masonry-gap, 15px) !important;
grid-template-columns: 2fr 1fr !important;
grid-template-rows: 1fr 1fr !important;
grid-auto-rows: minmax(0, 1fr) !important;
grid-auto-flow: row dense !important;
align-items: stretch !important;
min-height: clamp(300px, 54vw, 520px) !important;
height: auto !important;
width: 100% !important;
}

.masonry-photo-wall--featured-big .masonry-photo-wall__item {
width: 100% !important;
height: 100% !important;
display: flex !important;
flex-direction: column !important;
margin: 0 !important;
padding: 0 !important;
overflow: hidden !important;
min-width: 0 !important;
min-height: 0 !important;
}

.masonry-photo-wall--featured-big .masonry-photo-wall__item:first-child {
grid-row: 1 / 3 !important;
grid-column: 1 / 2 !important;
}

.masonry-photo-wall--featured-big .masonry-photo-wall__image-wrapper {
position: relative;
top: auto;
left: auto;
width: 100%;
height: 100%;
display: flex;
align-items: stretch;
justify-content: stretch;
min-height: 0;
}

.masonry-photo-wall--featured-big .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--featured-big .masonry-photo-wall__image-stack,
.masonry-photo-wall--featured-big .masonry-photo-wall__image-stage {
display: flex;
width: 100%;
height: 100%;
flex: 1 1 auto;
min-height: 0;
}

.masonry-photo-wall--featured-big .masonry-photo-wall__image {
width: 100% !important;
height: 100% !important;
object-fit: cover !important;
display: block !important;
}

/* 圓形網格 (Circle Grid) */
.masonry-photo-wall--circle-grid .masonry-photo-wall__container {
display: grid !important;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 20px;
padding: 20px;
justify-content: center;
}

.masonry-photo-wall--circle-grid .masonry-photo-wall__item {
aspect-ratio: 1 / 1;
border-radius: 50%;
overflow: hidden;
transition: transform 0.3s ease, box-shadow 0.3s ease;
display: flex !important;
flex-direction: column !important;
min-width: 0 !important;
min-height: 0 !important;
}

.masonry-photo-wall--circle-grid .masonry-photo-wall__item:hover {
transform: scale(1);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.masonry-photo-wall--circle-grid .masonry-photo-wall__image {
width: 100%;
height: 100%;
object-fit: cover;
}

.masonry-photo-wall--circle-grid .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--circle-grid .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--circle-grid .masonry-photo-wall__image-stack,
.masonry-photo-wall--circle-grid .masonry-photo-wall__image-stage {
display: flex;
width: 100%;
height: 100%;
flex: 1 1 auto;
min-height: 0;
border-radius: inherit;
overflow: hidden;
}

/* 底片風格 (Film Strip) */
.masonry-photo-wall--film-strip .masonry-photo-wall__container {
background: #222;
padding: 20px 10px;
display: flex !important;
gap: 5px;
overflow-x: auto;
border-top: 10px solid #333;
border-bottom: 10px solid #333;
position: relative;
}

.masonry-photo-wall--film-strip .masonry-photo-wall__container::before,
.masonry-photo-wall--film-strip .masonry-photo-wall__container::after {
content: '';
position: absolute;
left: 0;
right: 0;
height: 8px;
background: repeating-linear-gradient(
to right,
#444 0px,
#444 15px,
#666 15px,
#666 25px
);
}

.masonry-photo-wall--film-strip .masonry-photo-wall__container::before {
top: 2px;
}

.masonry-photo-wall--film-strip .masonry-photo-wall__container::after {
bottom: 2px;
}

.masonry-photo-wall--film-strip .masonry-photo-wall__item {
flex: 0 0 200px;
height: 150px !important;
border: 2px solid #555;
}

.masonry-photo-wall--film-strip .masonry-photo-wall__image {
object-fit: cover;
}

/* 交錯網格 (Offset Columns) */
.masonry-photo-wall--offset-cols .masonry-photo-wall__container {
display: grid !important;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 15px;
}

.masonry-photo-wall--offset-cols .masonry-photo-wall__item:nth-child(even) {
transform: translateY(30px);
transition: transform 0.3s ease;
}

.masonry-photo-wall--offset-cols .masonry-photo-wall__item:hover {
transform: translateY(0px) scale(1);
}

/* 主副分欄 (Split Focus) */
.masonry-photo-wall--split-focus .masonry-photo-wall__container {
display: grid !important;
grid-template-columns: 3fr 2fr;
grid-template-rows: 1fr 1fr;
grid-auto-rows: minmax(0, 1fr);
grid-auto-flow: row dense;
align-items: stretch;
gap: 15px;
height: auto;
min-height: clamp(300px, 54vw, 520px);
}

.masonry-photo-wall--split-focus .masonry-photo-wall__item {
display: flex !important;
flex-direction: column !important;
min-width: 0 !important;
min-height: 0 !important;
}

.masonry-photo-wall--split-focus .masonry-photo-wall__item:first-child {
grid-row: 1 / -1;
}

.masonry-photo-wall--split-focus .masonry-photo-wall__item:not(:first-child) {
    height: 100% !important;
}

.masonry-photo-wall--split-focus .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--split-focus .masonry-photo-wall__image-wrapper {
    flex: 1 1 auto;
    min-height: 0;
}

.masonry-photo-wall--split-focus .masonry-photo-wall__image {
object-fit: cover;
}

/* 滑塊輪播 (Slider) - 需要 Flickity */
.masonry-photo-wall--slider .masonry-photo-wall__container {
height: 50vh;
max-height: 500px;
min-height: 300px;
background: #f0f0f0;
display: block;
opacity: 1;
}

.masonry-photo-wall--slider .masonry-photo-wall__container .flickity-viewport,
.masonry-photo-wall--slider .masonry-photo-wall__container .flickity-slider {
height: 100%;
}

.masonry-photo-wall--slider .masonry-photo-wall__item {
height: 100%;
margin-right: 10px;
box-sizing: border-box;
width: 100%;
display: flex !important;
flex-direction: column !important;
}

.masonry-photo-wall--slider .masonry-photo-wall__item img {
display: block;
width: 100%;
height: 100%;
object-fit: contain;
}

.masonry-photo-wall--slider .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--slider .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--slider .masonry-photo-wall__image-stack,
.masonry-photo-wall--slider .masonry-photo-wall__image-stage {
display: flex;
width: 100%;
height: 100%;
flex: 1 1 auto;
min-height: 0;
}

.masonry-photo-wall--slider .masonry-photo-wall__container.flickity-enabled {
outline: none;
}

.masonry-photo-wall--slider .flickity-page-dots {
bottom: -40px;
}

.masonry-photo-wall--slider .flickity-prev-next-button {
background: rgba(255, 255, 255, 0.8);
border-radius: 50%;
}

/* 輪播圖 (Carousel) - 需要 Flickity */
.masonry-photo-wall--carousel .masonry-photo-wall__container {
height: 400px;
display: block;
}

.masonry-photo-wall--carousel .masonry-photo-wall__item {
height: 100%;
margin-right: 10px;
box-sizing: border-box;
width: calc(33.333% - 7px);
display: flex !important;
flex-direction: column !important;
}

.masonry-photo-wall--carousel .masonry-photo-wall__item img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}

.masonry-photo-wall--carousel .masonry-photo-wall__lightbox-link,
.masonry-photo-wall--carousel .masonry-photo-wall__image-wrapper,
.masonry-photo-wall--carousel .masonry-photo-wall__image-stack,
.masonry-photo-wall--carousel .masonry-photo-wall__image-stage {
display: flex;
width: 100%;
height: 100%;
flex: 1 1 auto;
min-height: 0;
}

/* 響應式設計 */
@media (max-width: 1180px) {
.masonry-photo-wall--equal-row .masonry-photo-wall__container {
grid-template-columns: repeat(var(--masonry-columns-tablet, 2), minmax(0, 1fr)) !important;
}
}

@media (max-width: 768px) {
.masonry-photo-wall--equal-row .masonry-photo-wall__container {
grid-template-columns: repeat(var(--masonry-columns-mobile, 2), minmax(0, 1fr)) !important;
}

.masonry-photo-wall--equal-row .masonry-photo-wall__item {
width: 100% !important;
height: auto !important;
}

.masonry-photo-wall--equal-row .masonry-photo-wall__image {
height: 100% !important;
max-height: none;
}

.masonry-photo-wall--featured-big .masonry-photo-wall__container {
grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) !important;
grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
height: clamp(280px, 62vw, 400px) !important;
}

.masonry-photo-wall--featured-big .masonry-photo-wall__item:first-child {
grid-row: 1 / 3 !important;
grid-column: 1 / 2 !important;
}

.masonry-photo-wall--split-focus .masonry-photo-wall__container {
grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) !important;
grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
height: clamp(280px, 62vw, 400px) !important;
}

.masonry-photo-wall--split-focus .masonry-photo-wall__item:first-child {
grid-row: 1 / -1 !important;
}

.masonry-photo-wall--split-focus .masonry-photo-wall__item:not(:first-child) {
height: 100% !important;
}

/* 1-12 Columns Grid 響應式：在手機版可以自動調整，或保持固定欄數 */
/* 如果需要響應式，可以在這裡覆蓋 */
}

.masonry-photo-wall--recalculating * {
animation: none !important;
transition: none !important;
}

.masonry-photo-wall--recalculating .masonry-photo-wall__item,
.masonry-photo-wall--recalculating .masonry-photo-wall__row,
.masonry-photo-wall--recalculating .masonry-photo-wall__justified-item,
.masonry-photo-wall--recalculating .masonry-photo-wall__image {
animation: none !important;
transition: none !important;
opacity: 1 !important;
}

/* 防止底部多餘空間 */
.masonry-photo-wall__item:last-child {
margin-bottom: 0;
}

/* 確保圖片完全填充容器（僅 Mosaic 布局，Grid 和 Instagram 使用絕對定位） */
.masonry-photo-wall--mosaic .masonry-photo-wall__item {
display: flex;
flex-direction: column;
min-height: 200px; /* 確保有最小高度 */
}

.masonry-photo-wall--mosaic .masonry-photo-wall__image-wrapper {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
min-height: 200px;
}

@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}

/* 無障礙支援 */
.masonry-photo-wall__item:focus {
outline: 2px solid #0073aa;
outline-offset: 2px;
}

/* =========================================================================
   與 feature-content 整合：防止超出容器
   ========================================================================= */

/* 確保在一般文章容器內不會超出 */
.entry-content .fc-masonry-grid,
.post-content .fc-masonry-grid,
.article-content .fc-masonry-grid,
.single .content-area .fc-masonry-grid,
.content-area .entry-content .fc-masonry-grid {
max-width: 100% !important;
width: 100% !important;
box-sizing: border-box;
overflow: hidden;
}

.entry-content .fc-masonry-grid .masonry-photo-wall,
.post-content .fc-masonry-grid .masonry-photo-wall,
.article-content .fc-masonry-grid .masonry-photo-wall {
max-width: 100% !important;
width: 100% !important;
}

.entry-content .fc-masonry-grid .masonry-photo-wall__container,
.post-content .fc-masonry-grid .masonry-photo-wall__container,
.article-content .fc-masonry-grid .masonry-photo-wall__container {
max-width: 100% !important;
width: 100% !important;
}

/* 響應式：確保在小螢幕上不會超出 */
@media (max-width: 767px) {
.masonry-photo-wall__item {
min-width: 0; /* 移除最小寬度限制 */
}
}
