/**
 * Theme Name: Blocksy Child
 * Description: Blocksy Child theme
 * Author: Creative Themes
 * Template: blocksy
 * Text Domain: blocksy
 */






/* 修復 gallery block 不同大小問題 使圖片尺寸一致*/
.wp-block-gallery.has-nested-images figure.wp-block-image img {
  aspect-ratio: 1; /* squared size thumbnails */ 
  object-fit: cover;
}
.wp-block-gallery.has-nested-images figure.wp-block-image {
  flex-grow: 0; /* width fix */
}

/* 修改圖說位置與樣式 */
/* https://kimballrexford.com/reposition-wordpress-gutenberg-gallery-figure-caption-below-image/ */
figure.wp-block-gallery.has-nested-images figure.wp-block-image figcaption {
  background: none;
  color: #585858;
  margin-top: 0.5em;
  position: relative;
  display: none;  /* Gallery 時隱藏、燈箱顯示圖說 */
}

/* 動畫：從下往上淡入 — 套用方式：在區塊「進階 > CSS 類別」填入 apparition */
@keyframes apparition {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.apparition,
details[open] > *:not(summary) {
  animation: apparition 0.4s ease forwards;
}

/* À propos「Découvrir notre histoire」：展開區塊的標題做成按鈕樣子 — 區塊「進階 > CSS 類別」填 bouton-histoire */
.bouton-histoire > summary {
  display: inline-block;
  list-style: none; /* 拿掉預設的三角形 */
  padding: 5px 20px; /* 跟全站按鈕一樣：白底＋灰細框 */
  margin-bottom: 1em;
  background: var(--theme-button-background-initial-color);
  color: var(--theme-button-text-initial-color);
  border: var(--theme-button-border, 1px solid currentColor);
  cursor: pointer;
}

.bouton-histoire > summary::-webkit-details-marker {
  display: none;
}

/* 商品頁：標題旁的 Commander 按鈕不換行（標題長時會被擠成兩行） */
.wp-block-group.is-nowrap .wp-block-button__link {
  white-space: nowrap;
}



/* Footer 上方多留空間（Blocksy 的 Content Area Spacing 會連 header 下方一起改，所以只改 footer） */
.ct-footer {
	margin-top: 60px;
}

/* Footer 第一欄：版權跟 Instagram 圖示之間留空間 */
.ct-footer .ct-footer-copyright {
	--margin: 24px 0 0; /* Blocksy 用 --margin 控制 footer 元件間距 */
}

/* Footer 第一欄 logo 寬度（用 class 控制，不在區塊裡寫行內寬度） */
.ct-footer .footer-logo img {
	width: 130px;
	height: auto;
}

/* 商品／工作坊文字欄左右留白：電腦 3em；手機（欄位上下排）拿掉，文字跟圖片一樣寬 — 區塊「進階 > CSS 類別」填 texte-colonne */
@media (min-width: 782px) {
	.texte-colonne {
		padding-left: 3em;
		padding-right: 3em;
	}
}

/* 手機（欄位上下排）一律大圖在上：文字欄（texte-colonne）在左的那排自動上下對調 */
@media (max-width: 781px) {
	.wp-block-columns:has(> .texte-colonne:first-child) {
		flex-direction: column-reverse;
	}
}

/* 手機：每一組圖文（一款商品）之間多留空白，小圖跟下一款的大圖分得開。用 margin 是因為欄位的 padding 寫在區塊行內樣式裡 */
@media (max-width: 781px) {
	.wp-block-columns > .wp-block-column.texte-colonne:not(.is-vertically-aligned-bottom) { /* 齊下的文字欄自己有下內距 3em，不再加；要比 WordPress 的 flex 版面「margin:0」規則更明確才蓋得過 */
		margin-bottom: 3em;
	}
}

/* Footer 中排：細線到內容＝Blocksy 預設（電腦 70px／平板 50px／手機 40px）的一半，至少 2rem；最底下留白縮小 */
.ct-footer [data-row*="middle"] > .ct-container { /* 要比 Blocksy 的 .ct-footer [data-row]>div 更明確才蓋得過 */
	padding-top: max(2rem, calc(var(--container-spacing) / 2)); /* Blocksy 預設的一半，但不少於 2rem */
	padding-bottom: 1.5rem;
}

/* Footer 中排三欄底部對齊（第 2、3 欄比第 1 欄短，往下對齊到版權那行） */
.ct-footer [data-row*="middle"] [data-column] {
	align-self: end;
}

/* Footer「Informations」欄最後一行：社群圖示（區塊類別 footer-reseaux）佔一行選單的高度，跟 Service client 欄同高 */
.ct-footer .ct-widget:has(> .footer-reseaux) {
	--widgets-gap: 0px; /* 拿掉 Blocksy 小工具之間的 20px（Blocksy 用這個變數控制） */
}
.ct-footer .wp-block-social-links.footer-reseaux {
	min-height: 1lh; /* 一行選單的高度 */
	align-items: center;
}
/* 圖示顏色跟 footer 連結一樣（WordPress 預設是各品牌色） */
.ct-footer .wp-block-social-links.is-style-logos-only.footer-reseaux .wp-social-link {
	color: var(--theme-link-initial-color);
}
.ct-footer .wp-block-social-links.is-style-logos-only.footer-reseaux .wp-social-link:hover {
	color: var(--theme-link-hover-color);
}

/* 「Voir plus」展開區塊齊右（商品文字齊右時用）— 區塊「進階 > CSS 類別」填 voir-plus-droite */
.wp-block-details.voir-plus-droite {
	text-align: right;
}
