/*
Theme Name: FYWSS 2.0.1(Tailwind Modernized)
Theme URI: https://www.fywss.edu.hk
Author: Titus C / Modernized by AI
Author URI: https://www.fywss.edu.hk
Description: 現代化中華基督教會方潤華中學官方主題，全面升級支援 WordPress 7.x、PHP 8.3+ 與 Tailwind CSS 響應式切版。
Version: 2.0.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: fywss
*/

/* ============================================================

Base & Global Reset Settings
============================================================ */
html {
scroll-behavior: smooth;
-webkit-tap-highlight-color: transparent;
}

body {
font-family: "Noto Sans TC", "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
color: #1e293b;
background-color: #f8fafc;
}

/* 設定標題專用字體：思源宋體 (Noto Serif TC)，移除 !important 以允許編輯器與局部樣式覆蓋 */
h1, h2, h3, h4, h5, h6, .font-serif {
font-family: 'Noto Serif TC', "Songti TC", "PMingLiU", serif;
font-weight: 700;
}

/* Fix images overflow */
img, iframe, object, embed {
max-width: 100%;
height: auto;
}

/* Custom Scrollbar Styling */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
background: #cbd5e1;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #94a3b8;
}

/* ============================================================
2. Custom Animations & Utilities
============================================================ */
@keyframes fadeIn {
from {
opacity: 0;
transform: scale(0.96);
}
to {
opacity: 1;
transform: scale(1);
}
}

.animate-fade-in {
animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Line Clamp Utilities Fallback */
.line-clamp-1 {
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
}
.line-clamp-2 {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.line-clamp-3 {
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}

/* WordPress Alignments & Float Clearfix */
.aligncenter {
display: block;
margin-left: auto;
margin-right: auto;
}
.alignright {
float: right;
margin-left: 1.5rem;
margin-bottom: 1rem;
}
.alignleft {
float: left;
margin-right: 1.5rem;
margin-bottom: 1rem;
}
.entry-content::after {
content: "";
display: table;
clear: both;
}

/* Responsive Video Container /
.video-container {
position: relative;
padding-bottom: 56.25%; / 16:9 aspect ratio */
height: 0;
overflow: hidden;
border-radius: 1rem;
}
.video-container iframe,
.video-container object,
.video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
}

/* ============================================================
3. WordPress 區塊編輯器 (Gutenberg) 相簿與區塊排版相容性
============================================================ */

/* 1. 確保相簿容器使用 Flexbox 並正確換行與計算間距 */
.entry-content .wp-block-gallery.has-nested-images {
display: flex;
flex-wrap: wrap;
gap: var(--wp--style--unstable-gallery-gap, 1rem);
margin: 1.5rem 0;
}

/* 2. 清除 Tailwind / Prose 對相簿內子 figure 的預設上下邊距 */
.entry-content .wp-block-gallery.has-nested-images figure.wp-block-image {
margin: 0 !important;
display: flex;
flex-direction: column;
position: relative;
box-sizing: border-box;
}

/* 3. 修復裁剪圖片 (Crop Images) 開啟時的走位與高度塌陷 */
.entry-content .wp-block-gallery.has-nested-images.is-cropped figure.wp-block-image img {
width: 100%;
height: 100% !important;
object-fit: cover;
flex: 1 0 0%;
margin: 0 !important;
}

/* 4. 修復未開啟裁剪時的圖片比例 */
.entry-content .wp-block-gallery.has-nested-images:not(.is-cropped) figure.wp-block-image img {
width: 100%;
height: auto;
margin: 0 !important;
}

/* 5. 美化相簿內部的圖片說明文字 (Caption) */
.entry-content .wp-block-gallery figure.wp-block-image figcaption {
margin: 0;
padding: 0.5rem 0.75rem;
font-size: 0.85rem;
text-align: center;
line-height: 1.4;
}

/* 6. 支援 WordPress 齊寬 (alignfull) 與 寬幅 (alignwide) 設定，防止超出白色卡片 */
.entry-content .alignwide,
.entry-content .alignfull {
max-width: 100%;
width: 100%;
}

/* 7. 修正區塊按鈕 (wp-block-button) 連結底線問題 */
.entry-content .wp-block-button__link {
text-decoration: none !important;
}

/* 8. 修正多欄區塊 (wp-block-columns) 間距 */
.entry-content .wp-block-columns {
gap: 1.5rem;
margin-bottom: 1.5rem;
}

/* 9. 修正表格區塊 (wp-block-table) 框線與內距 */
.entry-content .wp-block-table table {
width: 100%;
border-collapse: collapse;
}
.entry-content .wp-block-table th,
.entry-content .wp-block-table td {
border: 1px solid #cbd5e1;
padding: 0.65rem 0.9rem;
}
.entry-content .wp-block-table thead th {
background-color: #f8fafc;
font-weight: 700;
}

/* ============================================================
4. 統一前後台編輯器字型大小（區塊大中小字 + 傳統編輯器 pt 點數）
同時支援後台 (.editor-styles-wrapper) 與前台 (.entry-content / .prose)
============================================================ */

/* 區塊編輯器大中小字 */
.has-small-font-size,
.prose .has-small-font-size,
.entry-content .has-small-font-size { font-size: 0.875rem !important; line-height: 1.6 !important; }

.has-normal-font-size,
.has-regular-font-size,
.prose .has-normal-font-size,
.prose .has-regular-font-size,
.entry-content .has-normal-font-size,
.entry-content .has-regular-font-size { font-size: 1rem !important; line-height: 1.75 !important; }

.has-medium-font-size,
.prose .has-medium-font-size,
.entry-content .has-medium-font-size { font-size: 1.25rem !important; line-height: 1.6 !important; }

.has-large-font-size,
.prose .has-large-font-size,
.entry-content .has-large-font-size { font-size: 1.625rem !important; line-height: 1.45 !important; }

.has-x-large-font-size,
.prose .has-x-large-font-size,
.entry-content .has-x-large-font-size { font-size: 2.125rem !important; line-height: 1.35 !important; }

.has-xx-large-font-size,
.has-huge-font-size,
.prose .has-xx-large-font-size,
.prose .has-huge-font-size,
.entry-content .has-xx-large-font-size,
.entry-content .has-huge-font-size { font-size: 2.625rem !important; line-height: 1.25 !important; }

/* 傳統編輯器字體點數 (pt) /
[style="font-size: 8pt"],  [style*="font-size:8pt"],  .prose [style*="font-size: 8pt"],  .prose [style*="font-size:8pt"],  .entry-content [style*="font-size: 8pt"],  .entry-content [style*="font-size:8pt"]  { font-size: 8pt !important; }
[style*="font-size: 9pt"],  [style*="font-size:9pt"],  .prose [style*="font-size: 9pt"],  .prose [style*="font-size:9pt"],  .entry-content [style*="font-size: 9pt"],  .entry-content [style*="font-size:9pt"]  { font-size: 9pt !important; }
[style*="font-size: 10pt"], [style*="font-size:10pt"], .prose [style*="font-size: 10pt"], .prose [style*="font-size:10pt"], .entry-content [style*="font-size: 10pt"], .entry-content [style*="font-size:10pt"] { font-size: 10pt !important; }
[style*="font-size: 11pt"], [style*="font-size:11pt"], .prose [style*="font-size: 11pt"], .prose [style*="font-size:11pt"], .entry-content [style*="font-size: 11pt"], .entry-content [style*="font-size:11pt"] { font-size: 11pt !important; }
[style*="font-size: 12pt"], [style*="font-size:12pt"], .prose [style*="font-size: 12pt"], .prose [style*="font-size:12pt"], .entry-content [style*="font-size: 12pt"], .entry-content [style*="font-size:12pt"] { font-size: 12pt !important; }
[style*="font-size: 14pt"], [style*="font-size:14pt"], .prose [style*="font-size: 14pt"], .prose [style*="font-size:14pt"], .entry-content [style*="font-size: 14pt"], .entry-content [style*="font-size:14pt"] { font-size: 14pt !important; }
[style*="font-size: 16pt"], [style*="font-size:16pt"], .prose [style*="font-size: 16pt"], .prose [style*="font-size:16pt"], .entry-content [style*="font-size: 16pt"], .entry-content [style*="font-size:16pt"] { font-size: 16pt !important; }
[style*="font-size: 18pt"], [style*="font-size:18pt"], .prose [style*="font-size: 18pt"], .prose [style*="font-size:18pt"], .entry-content [style*="font-size: 18pt"], .entry-content [style*="font-size:18pt"] { font-size: 18pt !important; line-height: 1.45 !important; }
[style*="font-size: 20pt"], [style*="font-size:20pt"], .prose [style*="font-size: 20pt"], .prose [style*="font-size:20pt"], .entry-content [style*="font-size: 20pt"], .entry-content [style*="font-size:20pt"] { font-size: 20pt !important; line-height: 1.45 !important; }
[style*="font-size: 22pt"], [style*="font-size:22pt"], .prose [style*="font-size: 22pt"], .prose [style*="font-size:22pt"], .entry-content [style*="font-size: 22pt"], .entry-content [style*="font-size:22pt"] { font-size: 22pt !important; line-height: 1.4 !important; }
[style*="font-size: 24pt"], [style*="font-size:24pt"], .prose [style*="font-size: 24pt"], .prose [style*="font-size:24pt"], .entry-content [style*="font-size: 24pt"], .entry-content [style*="font-size:24pt"] { font-size: 24pt !important; line-height: 1.4 !important; }
[style*="font-size: 28pt"], [style*="font-size:28pt"], .prose [style*="font-size: 28pt"], .prose [style*="font-size:28pt"], .entry-content [style*="font-size: 28pt"], .entry-content [style*="font-size:28pt"] { font-size: 28pt !important; line-height: 1.35 !important; }
[style*="font-size: 36pt"], [style*="font-size:36pt"], .prose [style*="font-size: 36pt"], .prose [style*="font-size:36pt"], .entry-content [style*="font-size: 36pt"], .entry-content [style*="font-size:36pt"] { font-size: 36pt !important; line-height: 1.3 !important; }
[style*="font-size: 48pt"], [style*="font-size:48pt"], .prose [style*="font-size: 48pt"], .prose [style*="font-size:48pt"], .entry-content [style*="font-size: 48pt"], .entry-content [style*="font-size:48pt"] { font-size: 48pt !important; line-height: 1.25 !important; }
[style*="font-size: 72pt"], [style*="font-size:72pt"], .prose [style*="font-size: 72pt"], .prose [style*="font-size:72pt"], .entry-content [style*="font-size: 72pt"], .entry-content [style*="font-size:72pt"] { font-size: 72pt !important; line-height: 1.2 !important; }

.prose [style*="font-size"],
.entry-content [style*="font-size"] { line-height: 1.45; }

.prose [style*="font-size"] > strong,
.prose [style*="font-size"] > em,
.prose [style*="font-size"] > a,
.entry-content [style*="font-size"] > strong,
.entry-content [style*="font-size"] > em,
.entry-content [style*="font-size"] > a { font-size: inherit !important; }

/* 舊版  標籤 */
font[size="1"], .prose font[size="1"], .entry-content font[size="1"] { font-size: 0.75rem !important; }
font[size="2"], .prose font[size="2"], .entry-content font[size="2"] { font-size: 0.875rem !important; }
font[size="3"], .prose font[size="3"], .entry-content font[size="3"] { font-size: 1rem !important; }
font[size="4"], .prose font[size="4"], .entry-content font[size="4"] { font-size: 1.125rem !important; }
font[size="5"], .prose font[size="5"], .entry-content font[size="5"] { font-size: 1.5rem !important; line-height: 1.45 !important; }
font[size="6"], .prose font[size="6"], .entry-content font[size="6"] { font-size: 2rem !important; line-height: 1.35 !important; }
font[size="7"], .prose font[size="7"], .entry-content font[size="7"] { font-size: 2.5rem !important; line-height: 1.25 !important; }