/**
 * Theme Name: Mulberry Silk Child
 * Description: Mulberry Silk (mulberrysilk.fr) child theme
 * Template: blocksy
 * Text Domain: blocksy
 * Version: 1.0
 */

/* 新客戶：改 Theme Name（避免與其他客戶衝突）*/

/* === Gallery Block 修復 === */
/* 讓 gallery 圖片強制正方形、等高 */
.wp-block-gallery.has-nested-images figure.wp-block-image img {
  aspect-ratio: 1;
  object-fit: cover;
}
.wp-block-gallery.has-nested-images figure.wp-block-image {
  flex-grow: 0;
}

/* 圖說：隱藏（燈箱開啟時才顯示） */
figure.wp-block-gallery.has-nested-images figure.wp-block-image figcaption {
  background: none;
  color: #585858;
  margin-top: 0.5em;
  position: relative;
  display: none;
}

/* === 404 Page === */
.ct-404-number {
  font-size: 80px;
  font-weight: 300;
  letter-spacing: 0.1em;
  margin: 0;
  color: var(--theme-palette-color-2, #c8c8c8);
}
.ct-404-btn {
  display: inline-block;
  padding: 12px 28px;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}

/* === Mulberry Silk：方向 C「雲朵輕盈」（2026-10-21）=== */

/* 字型放在自己的主機，不從 Google 載入（RGPD） */
@font-face {
  font-family: 'Lora';
  src: url('fonts/lora-latin.woff2') format('woff2');
  font-weight: 400 600;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito Sans';
  src: url('fonts/nunito-sans-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  src: url('fonts/montserrat-latin-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --theme-font-family: 'Nunito Sans', sans-serif;
  --theme-button-border-radius: 999px; /* 膠囊按鈕 */
  --ms-radius: 32px;                   /* 圖片、卡片圓角 */
  --ms-nuage-h: 140px;                 /* 雲朵高度（寬度照 SVG 比例自動算） */
}

h1, h2, h3, h4, h5, h6,
.site-title {
  --theme-font-family: 'Lora', serif;
  --theme-font-weight: 400;
  --theme-line-height: 1.2;
}
/* 網站名稱：Montserrat 粗體全大寫，跟志娟的 logo 一樣（顏色在 Personnaliser → Header → Logo 設定，用色盤 1） */
.site-title {
  --theme-font-family: 'Montserrat', sans-serif;
  --theme-font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}
h1 { --theme-font-size: 52px; }
h2 { --theme-font-size: 36px; }
h3 { --theme-font-size: 21px; --theme-font-weight: 500; }
@media (max-width: 689px) {
  :root { --ms-nuage-h: 70px; }
  h1 { --theme-font-size: 36px; }
  h2 { --theme-font-size: 28px; }
}

/* 圖片圓角 */
.entry-content .wp-block-image img {
  border-radius: var(--ms-radius);
}

/* 區塊樣式「Carte」：圓角卡片（底色在編輯器選） */
.is-style-carte {
  border-radius: 24px;
  padding: 28px;
}

/* 區塊樣式「Nuages en bas／en haut」：區塊邊緣的雲朵，顏色＝網站底色 */
.is-style-nuage-bas,
.is-style-nuage-haut {
  position: relative;
}
.is-style-nuage-bas { padding-bottom: calc(var(--ms-nuage-h) + 24px); }
.is-style-nuage-haut { padding-top: calc(var(--ms-nuage-h) + 24px); }
.is-style-nuage-bas::after,
.is-style-nuage-haut::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: var(--ms-nuage-h);
  background-color: var(--theme-palette-color-7);
  -webkit-mask: url('images/nuage.svg') center bottom / auto 100% repeat-x;
  mask: url('images/nuage.svg') center bottom / auto 100% repeat-x;
  pointer-events: none;
}
.is-style-nuage-bas::after { bottom: -1px; }
/* 上緣用「天空」那張（雲朵上方的部分），區塊本身的顏色往上長成雲朵 */
.is-style-nuage-haut::before {
  top: -1px;
  -webkit-mask-image: url('images/nuage-ciel.svg');
  mask-image: url('images/nuage-ciel.svg');
}

/* 捲動到畫面時從下往上淡入：內容圖片、雲朵自動套用；其他區塊在「Classes CSS supplémentaires」填 apparition
 * 瀏覽器不支援（Firefox）或使用者設定減少動態效果時，照常顯示 */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .entry-content .wp-block-image,
    .is-style-nuage-bas::after,
    .is-style-nuage-haut::before,
    .apparition {
      animation: ms-flotter linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 60%;
    }
    /* 首頁四格（Des fibres longues…）：整格一起浮，1、3 先，2、4 接著；格子裡的圖不再另外浮 */
    .ms-quatre > .wp-block-column {
      animation: ms-flotter linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 60%;
    }
    .ms-quatre > .wp-block-column:nth-child(even) {
      animation-range: entry 30% entry 90%;
    }
    .ms-quatre .wp-block-image {
      animation: none;
    }
    /* 其他 Bannière：捲到時照片先淡入，裡面的區塊接著浮上來（最上面那個 Bannière 在下面另外處理） */
    .wp-block-cover__image-background {
      animation: ms-apparaitre linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 60%;
    }
    .wp-block-cover__inner-container > * {
      animation: ms-flotter linear both;
      animation-timeline: view();
      animation-range: entry 30% entry 90%;
    }
  }
}
@keyframes ms-flotter {
  from { opacity: 0; transform: translateY(80px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* 頁面最上面的 Bannière 一打開就在畫面裡，改成載入時播：照片先淡入，0.5 秒後裡面的區塊浮上來 */
@media (prefers-reduced-motion: no-preference) {
  .entry-content > .wp-block-cover:first-child .wp-block-cover__image-background {
    animation: ms-apparaitre 1.2s ease both;
  }
  .entry-content > .wp-block-cover:first-child .wp-block-cover__inner-container > * {
    animation: ms-flotter 0.9s ease 0.5s both;
  }
}
@keyframes ms-apparaitre {
  from { opacity: 0; }
}

/* Bannière 裡的雲朵要蓋在照片上面 */
.wp-block-cover.is-style-nuage-bas::after,
.wp-block-cover.is-style-nuage-haut::before {
  z-index: 1;
}

/* 首頁主視覺：照片上的米白卡片 */
/* 照片偏暗時 Bannière 會把字改白色，卡片裡維持深色字 */
.wp-block-cover .is-style-carte {
  color: var(--theme-text-color);
}
.wp-block-cover .is-style-carte :is(h1, h2, h3, h4, h5, h6) {
  color: var(--theme-headings-color);
}
/* 高度、卡片寬度、內距、靠左靠右都在區塊設定裡調；這裡只讓卡片對齊網站內容的左右邊線 */
.ms-hero.alignfull {
  padding-left: max(1em, calc((100% - min(var(--theme-container-width), var(--theme-normal-container-max-width))) / 2));
  padding-right: max(1em, calc((100% - min(var(--theme-container-width), var(--theme-normal-container-max-width))) / 2));
}

/* 頁尾：淡綠底＋上緣雲朵（底色改 --ms-footer-bg，字色改 --ms-footer-text） */
[data-footer] footer.ct-footer { /* 要比 Blocksy 的頁尾底色規則更具體 */
  --ms-footer-bg: var(--theme-palette-color-5);
  --ms-footer-text: var(--theme-palette-color-1);
  --ms-footer-hover: var(--theme-palette-color-2);
  position: relative;
  background-color: var(--ms-footer-bg);
  color: var(--ms-footer-text);
  --theme-link-initial-color: var(--ms-footer-text);
  --theme-link-hover-color: var(--ms-footer-hover);
  padding-top: var(--ms-nuage-h);
}
.ct-footer [data-row] {
  background-color: transparent;
}
.ct-footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: var(--ms-nuage-h);
  background-color: var(--theme-palette-color-7);
  -webkit-mask: url('images/nuage-ciel.svg') center bottom / auto 100% repeat-x;
  mask: url('images/nuage-ciel.svg') center bottom / auto 100% repeat-x;
}

/* 首頁小調整 */
.ms-produits { text-align: center; }
.ms-centre { text-align: center; }
.ms-centre .wp-block-buttons { justify-content: center; }
.ms-section { padding-top: 64px; padding-bottom: 64px; }
/* 頁尾選單、版權文字顏色 */
[data-footer] footer.ct-footer [data-id] {
  color: var(--ms-footer-text);
  --theme-text-color: var(--ms-footer-text);
  --theme-link-initial-color: var(--ms-footer-text);
  --theme-link-hover-color: var(--ms-footer-hover);
  --theme-link-active-color: var(--ms-footer-hover);
}

/* === 商品頁（WooCommerce）=== */
.ms-product-description {
  width: var(--theme-container-width);
  max-width: var(--theme-normal-container-max-width);
  margin: 64px auto 0;
}
.ms-product-description h2 {
  margin-top: 48px;
}
.ms-product-description > h2:first-child {
  margin-top: 0;
}
.single-product .woocommerce-product-gallery img {
  border-radius: var(--ms-radius);
}
.ms-bientot {
  font-style: italic;
  margin-bottom: 12px;
}
.ms-reassurance {
  list-style: none;
  padding: 16px 0 0;
  margin: 24px 0 0;
  border-top: 1px solid var(--theme-palette-color-5);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  font-size: 14px;
}
.ms-reassurance li::before {
  content: "✓ ";
  color: var(--theme-palette-color-1);
}
/* 尺寸表：手機上可以左右滑 */
.ms-product-description .wp-block-table {
  overflow-x: auto;
}
.ms-product-description .wp-block-table th {
  background: var(--theme-palette-color-6);
}
/* FAQ 折疊：圓角卡片 */
.entry-content .wp-block-details {
  background: var(--theme-palette-color-6);
  border-radius: 16px;
  padding: 16px 24px;
  margin-bottom: 12px;
}
.entry-content .wp-block-details summary {
  cursor: pointer;
  font-weight: 600;
  margin: 0;
}
.entry-content .wp-block-details > :not(summary) {
  margin-top: 12px;
  margin-bottom: 0;
}

/* Journal 文章卡片：圓角（Blocksy 的卡片 CSS 比子主題晚載入，所以改它用的變數） */
.entries .entry-card {
  --theme-border-radius: 24px;
  overflow: hidden;
}

/* FAQ 兩欄：左欄分組按鈕（電腦版直排、捲動時停在畫面上；手機版在最上面橫排） */
.ms-faq .wp-block-heading { scroll-margin-top: 24px; }
.ms-faq .wp-block-column > .wp-block-heading:first-child { margin-top: 0; }
@media (min-width: 782px) {
  .ms-faq-nav {
    position: sticky;
    top: 48px;
  }
  .ms-faq-nav .wp-block-buttons {
    flex-direction: column;
    align-items: stretch;
  }
}

/* 撤回表單（[ms_retractation]） */
.ms-retr input[type="text"], .ms-retr input[type="email"], .ms-retr input[type="date"], .ms-retr textarea { width: 100%; max-width: 520px; }
.ms-retr fieldset { border: 0; padding: 0; margin: 0 0 1em; }
.ms-retr-hp { position: absolute; left: -9999px; }
.ms-retr-err { color: #b32d2e; }
