/*
Theme Name: 小兔森林-Macchiato瑪奇朵佈景主題
Theme URI: https://yourwebsite.com/macchiato
Author: 瑪奇朵
Author URI: https://yourwebsite.com
Description: Macchiato 是一個現代、靈活且易於客製化的 WordPress 佈景主題，整合了 Bootstrap 5，支援 Elementor 頁面編輯器，同時保持程式碼簡潔和高效能。適合用於各種網站專案的快速開發。
Version: 0.2.2
Requires at least: 5.6
Tested up to: 6.4
Requires PHP: 7.4
License: MIT
License URI: https://mit-license.org/
Text Domain: macchiato
Tags: custom-background, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready, blog, e-commerce, portfolio, one-column, two-columns, left-sidebar, right-sidebar, flexible-header, full-width-template, sticky-post, theme-options, editor-style, block-styles, wide-blocks
*/

/* 
 * 這個檔案主要用於 WordPress 主題識別，大部分的樣式會透過以下方式處理：
 * 1. Bootstrap 5 提供基礎 UI 樣式 (透過 CDN 引入)
 * 2. 主要自訂樣式在 assets/css/main.css
 * 3. 這裡只包含一些必要的全域變數和基本覆蓋
 */

:root {
  /* == Theme Specific Variables (用於非 Bootstrap 控制的元素或特殊目的) == */
  --macchiato-font-family-sans: "Noto Sans TC",
    "Microsoft JhengHei", "微軟正黑體", sans-serif;
  --macchiato-font-family-serif: "Noto Serif TC", serif;
  --macchiato-accent-color: #2ea7e0;
  --macchiato-light-color: #ebf0f5;

  /* 間距系統 */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;

  /*
   * ============================================
   * == Bootstrap Variable Overrides ==
   * ============================================
   * 在這裡重新定義 Bootstrap 的 CSS 變數，以全域修改主題外觀。
   * 確保 Bootstrap CSS 在 head 中先載入，此 style.css 後載入。
   */

  /* --- 整體顏色與字體 --- */
  --bs-body-font-family: var(--macchiato-font-family-sans);
  --bs-body-font-size: 1rem;
  --bs-body-line-height: 1.6;
  --bs-body-color: #333333;
  --bs-body-bg: #ffffff;

  /* --- 主題顏色 --- */
  --bs-primary: var(--macchiato-accent-color, #6f4e37);
  --bs-primary-rgb: 111, 78, 55; /* 對應 --macchiato-accent-color 的 RGB 值 */
  --bs-secondary: #6c757d;
  --bs-secondary-rgb: 108, 117, 125;
  --bs-success: #198754;
  --bs-info: #0dcaf0;
  --bs-warning: #ffc107;
  --bs-danger: #dc3545;
  --bs-light: var(--macchiato-light-color, #f5f0eb);
  --bs-light-rgb: 245, 240, 235; /* 對應 --macchiato-light-color 的 RGB 值 */
  --bs-dark: #212529;
  --bs-dark-rgb: 33, 37, 41;

  /* --- 連結顏色 --- */
  --bs-link-color: var(--bs-primary);
  --bs-link-hover-color: color-mix(in srgb, var(--bs-primary) 80%, black);
  --bs-link-decoration: none;
  --bs-link-hover-decoration: underline;

  /* --- 標題 --- */
  --bs-headings-font-weight: 700;
  --bs-headings-line-height: 1.3;
  --bs-headings-color: inherit;

  /* --- 元件 --- */
  --bs-border-radius: 0.25rem;
  --bs-border-radius-sm: 0.2rem;
  --bs-border-radius-lg: 0.5rem;
  --bs-border-color: #dee2e6;

  /* --- 間距 --- */
  --bs-gutter-x: 1.5rem;
  --bs-gutter-y: 1rem;
}

/* 主要按鈕樣式 - 咖啡色調 */
.btn-primary {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background-color: color-mix(in srgb, var(--bs-primary) 85%, black);
  border-color: color-mix(in srgb, var(--bs-primary) 85%, black);
}

.btn-outline-primary {
  color: var(--bs-primary);
  border-color: var(--bs-primary);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
  color: white;
}

/* == 基本樣式，最小化，其他移至 main.css == */

/* 確保圖片響應式且不會超出容器 */
img {
  max-width: 100%;
  height: auto;
}

/* WordPress 必要樣式 - 確保 WordPress 生成的類別能正確顯示 */
.aligncenter {
  display: block;
  margin-left: auto;
  margin-right: auto;
  clear: both;
}

.alignleft {
  float: left;
  margin: 0.5em 1em 0.5em 0;
}

.alignright {
  float: right;
  margin: 0.5em 0 0.5em 1em;
}

.wp-caption {
  max-width: 100%;
}

.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important;
}

/* 針對使用 Elementor 的頁面添加基本支援 */
.elementor-page .site-content {
  padding: 0;
  margin: 0;
  width: 100%;
  max-width: none;
}

/* 覆蓋某些 Bootstrap 類別，以更好支援 WordPress */
.widget-area .card {
  margin-bottom: var(--spacing-md);
}

/* 移動設備導航優化 */
@media (max-width: 991.98px) {
  .navbar-collapse {
    max-height: 80vh;
    overflow-y: auto;
  }
}

/**
 * 區塊小工具樣式 - Modern WordPress Sidebar
 * 文件路徑: /assets/css/block-widgets.css
 */

/* 側邊欄容器 */
.widget-area {
  background: #f9f9f9;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
}

/* 區塊小工具特定樣式 */
.sidebar-block-widgets .widget-area {
  background: transparent;
  padding: 0;
}

/* 小工具基本樣式 */
.widget {
  background: #ffffff;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 1px solid #e1e1e1;
}

.widget:last-child {
  margin-bottom: 0;
}

/* 小工具標題 */
.widget-title,
.wp-block-heading {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #007cba;
  color: #333;
}

/* 區塊小工具中的標題 */
.widget-area .wp-block-heading {
  font-size: 1.125rem;
  margin-top: 0;
}

/* 列表樣式 */
.widget ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.widget li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.widget li:last-child {
  border-bottom: none;
}

.widget li a {
  color: #333;
  text-decoration: none;
  transition: color 0.3s ease;
}

.widget li a:hover {
  color: #007cba;
}

/* 搜尋表單 */
.widget .wp-block-search,
.widget_search .search-form {
  margin-bottom: 0;
}

.widget .wp-block-search .wp-block-search__input,
.widget_search .search-field {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
}

.widget .wp-block-search .wp-block-search__button,
.widget_search .search-submit {
  background: #007cba;
  color: white;
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  transition: background-color 0.3s ease;
}

.widget .wp-block-search .wp-block-search__button:hover,
.widget_search .search-submit:hover {
  background: #005a87;
}

/* 最新文章區塊 */
.widget .wp-block-latest-posts {
  list-style: none;
  padding: 0;
}

.widget .wp-block-latest-posts li {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f0f0f0;
}

.widget .wp-block-latest-posts li:last-child {
  margin-bottom: 0;
  border-bottom: none;
}

.widget .wp-block-latest-posts a {
  font-weight: 500;
  line-height: 1.4;
}

.widget .wp-block-latest-posts .wp-block-latest-posts__post-date {
  color: #666;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.widget .wp-block-latest-posts .wp-block-latest-posts__featured-image {
  margin-bottom: 0.5rem;
}

.widget .wp-block-latest-posts .wp-block-latest-posts__featured-image img {
  border-radius: 4px;
}

/* 分類區塊 */
.widget .wp-block-categories {
  list-style: none;
  padding: 0;
}

.widget .wp-block-categories li {
  padding: 0.5rem 0;
}

.widget .wp-block-categories .wp-block-categories__post-count {
  color: #666;
  font-size: 0.875rem;
  margin-left: 0.5rem;
}

/* 標籤雲區塊 */
.widget .wp-block-tag-cloud {
  line-height: 2;
}

.widget .wp-block-tag-cloud a {
  display: inline-block;
  background: #f5f5f5;
  padding: 0.25rem 0.75rem;
  margin: 0.25rem 0.25rem 0.25rem 0;
  border-radius: 15px;
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.3s ease;
}

.widget .wp-block-tag-cloud a:hover {
  background: #007cba;
  color: white;
}

/* 社交圖示區塊 */
.widget .wp-block-social-links {
  justify-content: flex-start;
}

.widget .wp-block-social-links .wp-social-link {
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

/* 圖片區塊 */
.widget .wp-block-image {
  margin: 0 0 1rem 0;
}

.widget .wp-block-image img {
  border-radius: 6px;
  width: 100%;
  height: auto;
}

/* 引用區塊 */
.widget .wp-block-quote {
  border-left: 4px solid #007cba;
  padding-left: 1rem;
  margin: 1rem 0;
  font-style: italic;
}

/* 群組區塊 */
.widget .wp-block-group {
  margin-bottom: 1rem;
}

.widget .wp-block-group:last-child {
  margin-bottom: 0;
}

/* 分隔線區塊 */
.widget .wp-block-separator {
  border: none;
  border-top: 1px solid #e1e1e1;
  margin: 1.5rem 0;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .widget-area {
    padding: 1rem;
    margin-bottom: 1.5rem;
  }

  .widget {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .widget-title,
  .wp-block-heading {
    font-size: 1rem;
  }
}

/* 深色模式支援 */
@media (prefers-color-scheme: dark) {
  .widget-area {
    background: #1a1a1a;
  }

  .widget {
    background: #2d2d2d;
    border-color: #404040;
    color: #ffffff;
  }

  .widget-title,
  .wp-block-heading {
    color: #ffffff;
    border-bottom-color: #0073aa;
  }

  .widget li {
    border-bottom-color: #404040;
  }

  .widget li a {
    color: #ffffff;
  }

  .widget li a:hover {
    color: #00a0d2;
  }

  .widget .wp-block-search .wp-block-search__input,
  .widget_search .search-field {
    background: #404040;
    border-color: #606060;
    color: #ffffff;
  }

  .widget .wp-block-tag-cloud a {
    background: #404040;
    color: #ffffff;
  }

  .widget .wp-block-tag-cloud a:hover {
    background: #0073aa;
  }
}

/* 高對比度支援 */
@media (prefers-contrast: high) {
  .widget {
    border-width: 2px;
    border-color: #000000;
  }

  .widget-title,
  .wp-block-heading {
    border-bottom-width: 3px;
    border-bottom-color: #000000;
  }

  .widget li a {
    text-decoration: underline;
  }
}

/* 列印樣式 */
@media print {
  .widget-area {
    background: none;
    box-shadow: none;
  }

  .widget {
    background: none;
    box-shadow: none;
    border: 1px solid #000;
    page-break-inside: avoid;
  }
}
