/*
 Theme Name:   Bricks Child Theme
 Theme URI:    https://bricksbuilder.io/
 Description:  Use this child theme to extend Bricks.
 Author:       Bricks
 Author URI:   https://bricksbuilder.io/
 Template:     bricks
 Version:      1.1
 Text Domain:  bricks
*/

/*--------------------------------------------------------------
# Single-Post Article Content
--------------------------------------------------------------*/
.post-article__content
{
	/* Headings */
	h2, h3, h4, h5, h6 {
		padding-bottom: 12px;
	}
	h2, h3 {
    	margin-block-start: calc(var(--space-l, var(--flow-spacing, initial)) * 1);
	}
	h4, h5, h6 {
		margin-block-start: calc(var(--space-m, var(--flow-spacing, initial)) * 0.9);
	}
	h2 {
		font-size: calc(var(--h2) * 0.86);
	}
	h3 {
		font-size: calc(var(--h3) * 0.9);
	}
	h4 {
		font-size: calc(var(--h4) * 0.96);
	}
	h5 {
		font-size: calc(var(--h5) * 0.96);
	}
	h6 {
		font-size: calc(var(--h6) * 0.96);
	}	

	/* General */
	p {
		margin: 1rem 0;
		line-height: 1.5;
	}	
	cite {
    	font-style: italic;
	}
	sup {
		font-size: 0.7em;
		line-height: 0;
		position: relative;
		vertical-align: baseline;
		top: -0.5em;
	}	
	
	/* List */
	ul, ol {        
		padding: 0;
	}
	ul li, ol li {
		margin: 0 0 12px 24px;
	}
	
	/* Blockquote */
  	blockquote, q, cite {
		quotes: none;
		font-size: calc(var(--text-m) * 0.92);
	}
	blockquote {    
		display: block;
		background-color: #F4F5F7;     
		border: 1px dashed #CCC;   
		padding: 8px 10px;    
		margin: 16px 20px;
	}
	q {
    	display: inline;
	}
	q:before {
    	content: open-quote;
	}
	q:after {
    	content: close-quote;
	}
	
	/* Image */
	img {
		object-fit: cover;
		object-position: center;
	}
	.img-border img {
		border: 1px solid var(--accent-light);    /* 邊框寬度和顏色 */
		border-radius: 4px;           /* 圓角效果 */
		padding: 2px;                 /* 內邊距 */
		box-shadow: 0 2px 6px rgba(0,0,0,0.2); /* 陰影效果 */
		transition: all 0.3s ease;    /* 平滑過渡效果 */
	}
	.img-border img:hover {
		transform: scale(1.02);       /* 懸停時輕微放大 */
		box-shadow: 0 5px 12px rgba(0,0,0,0.3); /* 懸停時陰影加強 */
	}
	.img-comparison {
		display: flex;
		justify-content: center; /* 使圖片在中間 */
		gap: 10px; /* 圖片之間的間距 */
		flex-wrap: wrap; /* 允許圖片在小螢幕上換行 */
		margin:12px 0;
	}
	.img-comparison img {
		max-height: 320px;
		max-width: 320px;
		object-fit: contain;
		padding: 4px; /* 圖片邊緣的留白 */
		box-sizing: border-box; /* 確保 padding 不影響圖片大小 */
		box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* 添加陰影效果 */
	}

    /* Table Style */
    table {
        border: 1px solid var(--accent);
        border-collapse: collapse;
        th {
            border: 1px solid var(--accent);
            font-weight: bold;
            padding: 4px 10px;    
            text-align: center;
        }
        thead th {
            background-color: #d2e8ff;
        }
        thead tbody {
            background-color: #F5F1F5;
        }
        td {
            height: 50px;
            border: 1px solid var(--accent);
            text-align: left;
            padding: 4px;
        }
    }

    /* Code */
    pre code {
        font-size: 1.5rem;
    }    
}

/* Post Content Footnote */   
.post-article__content .wp-block-footnotes
{
    margin-top: var(--space-xl);
    padding-top: var(--space-l);
    margin-bottom: var(--space-xl);
    border-top: 2px solid #e5e7eb;
    font-size: calc(var(--text-m) * 0.88); 
    line-height: 1.6;
    color: #6b7280;

    li {
        margin-bottom: 0.8rem;
        padding-left: 0.5rem;
    }
    li::marker {
        color: #3b82f6;
        font-weight: 600;
    }
    a {
        color: #3b82f6;
        text-decoration: none;
        border-bottom: 1px dotted #3b82f6;
        transition: all 0.2s ease;
    }
    a:hover {
        color: #1d4ed8;
        border-bottom-color: #1d4ed8;
    }
    /* 返回連結特殊樣式 */
    a[href^="#"]:last-child {
        font-size: calc(var(--text-m) * 0.88);
        margin-left: 0.5rem;
        padding: 0.2rem 0.4rem;
        background-color: #f3f4f6;
        border-radius: 0.25rem;
        border: none;
    }
    a[href^="#"]:last-child:hover {
        background-color: #e5e7eb;
    }    
}

/* 響應式設置 */
@media (max-width: 768px) {
    .post-article__content .img-comparison img {
 		max-height: 260px; /* 調整小螢幕上的最大高度 */
		max-width: 260px;
    }
}	

@media (max-width: 480px) {
    .post-article__content .img-comparison {
        flex-direction: column; /* 在非常小的螢幕上垂直排列 */
    }

    .post-article__content .img-comparison img {
        max-height: 240px; /* 調整非常小螢幕上的最大高度 */
		max-width: 240px;
    }
}

/* 手機版樣式 - 註腳 */
@media (max-width: 768px) {
    article.single-post .wp-block-footnotes {
        margin-top: 2rem;
        padding: 1.5rem 1rem;
 		font-size: calc(var(--text-m) * 0.7);
    }
    
    article.single-post .wp-block-footnotes::before {
        font-size: calc(var(--text-m) * 0.8);
        margin-bottom: 1rem;
    }
    
    article.single-post .wp-block-footnotes li {
        padding: 0.5rem;
        margin-bottom: 0.75rem;
    }
}
/* --------------------*/

/* Custom Link */
.single-post__ref-posts .historical-today a,
  .single-post__ref-posts .related-post-list a
{
    color: var(--link-primary) ; /* 柔和藍色系 */
    transition: color 0.2s ease;
}

.single-post__ref-posts .historical-today a,
  .single-post__ref-posts .related-post-list a
{
    color: var(--link-hover);
}

.single-post__ref-posts .historical-today a,
  .single-post__ref-posts .related-post-list a
{
    color: var(--link-visited);
}

.single-post__ref-posts .historical-today a,
  .single-post__ref-posts .related-post-list a
{
    color: var(--link-active);
}




/* ext reference */
.wp-block-group.ext-reference {
    display: flex;
    background: var(--accent-ultra-light);
    margin-top: var(--space-xl);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ext-reference ul {
    padding: 0 !important;
}

.ext-reference ul li {
    font-size: calc(var(--text-m)* 0.9);
}

.ext-reference h3 {    
    margin-top: 0;
    font-size: calc(var(--h3)* 0.96);
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.ext-reference h3:before {
    content: "※";        
    left: 0;
    color: var(--accent-dark);
    letter-spacing: 0.4em;        /* 在符號右側添加間距 */
}

/* Gutenberg Override */
.wp-block-image, .wp-block-video, figcaption, figure {
    margin: 8px 0;
    width: 100%;
}