/*
Theme Name: overlay_child
Template: overlay
*/

/*youtube埋め込み*/
.video {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%;
  overflow: hidden;
  margin-bottom: 50px;
}
.video iframe {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}
/*youtube埋め込み終了*/ 

@media (max-width: 767px) {
  ul.products {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  ul.products li.product {
    width: 48% !important;
    margin: 0 1% 20px 1% !important;
    box-sizing: border-box !important;
    float: none !important;
    display: block !important;
  }

  /* 不要な columns-* の影響を除去 */
  ul.products[class*="columns-"] li.product {
    width: 48% !important;
    float: none !important;
    display: block !important;
  }
}




/* === 商品リスト本体をFlexboxで制御 === */
.woocommerce ul.products,
.woocommerce-page ul.products {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* === 商品1つ分の基本スタイル（PC：4列） === */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
    width: 23.5% !important;         /* 4列用幅 */
    margin-bottom: 40px !important;             /* 行間スペース */
    box-sizing: border-box !important;
    float: none !important !important;
    text-align: center !important;              /* テキスト中央揃え */
}

/* === 「カートに追加」ボタンを中央揃え === */
.woocommerce ul.products li.product .button,
.woocommerce-page ul.products li.product .button {
    display: block !important;
    margin: 10px auto 0 auto !important;
    text-align: center !important;
}

/* === タブレット（3列表示） === */
@media (max-width: 1024px) {
    .woocommerce ul.products li.product,
    .woocommerce-page ul.products li.product {
        width: 31.3% !important;     /* 3列用幅 */
        margin-bottom: 30px !important;
    }
}

/* === スマホ（2列表示） === */
@media (max-width: 767px) {
    .woocommerce ul.products li.product,
    .woocommerce-page ul.products li.product {
        width: 48% !important;       /* 2列用幅 */
        margin-bottom: 20px !important;
    }
}

/* === 超小型スマホ対応（1列にする場合のみ、必要なら解除可） === 
@media (max-width: 300px) {
    .woocommerce ul.products li.product,
    .woocommerce-page ul.products li.product {
        width: 100% !important;
    }
}
*/


/* フッターにあるテーマ名（Theme: Overlay by Kaira.）を削除 */
.site-bar-left {
    display: none;
}

/* フッターのコピーライト表示をセンター寄せ */
.site-bar-right {
    display: flex;
    justify-content: center;
}

/* Overlayテーマが自動で出している並び順セレクタをCSSで消す 
form.woocommerce-ordering {
  display: none !important;
}



.shop-header-controls select {
  padding: 4px 8px;
  font-size: 14px;
}

.shop-header-controls label {
  font-size: 14px;
}
*/

form.woocommerce-ordering {
  display: block !important;
}



/* デバッグコードstart */
/*
body:before {
    content: "✅ check pc css";
    display: block;
    background: #ffeb3b;
    color: black;
    text-align: center;
    font-size: 16px;
    padding: 8px;
}

@media only screen and (max-width: 767px) {
  html body .woocommerce ul.products li.product,
  html body .woocommerce-page ul.products li.product {
    width: 48% !important;
    margin-bottom: 20px !important;
  }

  html body:before {
    content: "✅ check mobile css";
    background: #ff80ab;
    color: white;
    display: block !important;
    padding: 8px;
  }
}
*/
/* デバッグコードend */




@media (max-width: 767px) {
  /* columns-4 をFlexbox化 */
  ul.products.columns-4 {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  ul.products.columns-4 li.product {
    width: 48% !important;
    float: none !important;
    margin-bottom: 20px !important;
    box-sizing: border-box !important;
    display: block !important;
  }
}

@media screen and (max-width: 767px) {
  .woocommerce ul.products.columns-4,
  .woocommerce-page ul.products.columns-4 {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .woocommerce ul.products.columns-4 li.product,
  .woocommerce-page ul.products.columns-4 li.product {
    width: calc(50% - 10px) !important;
    margin-bottom: 20px;
    float: none !important;
  }
}


@media screen and (max-width: 767px) {
  .woocommerce ul.products li.product,
  .woocommerce-page ul.products li.product {
    width: 48% !important;
    margin: 1% !important;
    float: none !important;
    display: inline-block !important;
  }
}


/* 件数と並び順のセレクトボックスを横並びに */
.shop-header-controls form {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 12px !important;
}

.shop-header-controls label {
  display: inline-block !important;
  margin: 0 !important;
  white-space: nowrap !important;
}

.shop-header-controls select {
  display: inline-block !important;
  margin: 0 !important;
}









/* All in One SEOのパンくずリストを非表示 */
.aioseo-breadcrumb,
.aioseo-breadcrumbs,
.aioseo-breadcrumbs-wrapper,
.aioseo-breadcrumbs-container,
.aioseo-breadcrumbs a,
.aioseo-breadcrumbs span,
.aioseo-breadcrumbs ul,
.aioseo-breadcrumbs li {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 0 !important;
}


/* 自作パンくずリストを表示させるために、一旦WOOCOMMERCEの純正パンくずリストを表示（純正パンくずはPHPコードで非表示） */
body.post-type-archive-product main nav.woocommerce-breadcrumb {
    display: block !important;
}


/* 自作カスタムパンくずを WP パンくずと統一 */
.woocommerce-breadcrumb {
  font-size: 0.9rem;          /* WP標準に寄せる */
  color: #333 !important;     /* リンク以外のテキスト色 */
  font-family: inherit;
  line-height: 1.6;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
  padding: 0.5em 0;
}

.woocommerce-breadcrumb a {
  color: #0073aa !important;     /* WPのリンク色 */
  text-decoration: none;
  transition: color 0.3s ease;
}

.woocommerce-breadcrumb a:hover {
  color: #005177 !important;     /* WPのホバー色 */
  text-decoration: underline;
}

.woocommerce-breadcrumb .separator {
  color: #999;
  margin: 0 5px;
}

.woocommerce-breadcrumb .current {
  font-weight: bold;
  color: #111 !important;
}

/* モバイル対応 */
@media (max-width: 768px) {
  .woocommerce-breadcrumb {
    font-size: 0.85rem;
  }
}







/* パンくず全体をスクロール可能に */
.woocommerce-breadcrumb-group {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    padding: 0.8em 1em;
    background-color: #fafafa;
    border-bottom: 1px solid #e0e0e0;
    scrollbar-width: none; /* Firefox非表示 */
}

.woocommerce-breadcrumb-group::-webkit-scrollbar {
    display: none; /* Chrome/Safari 非表示 */
}

/* パンくず本体をインライン表示 */
.woocommerce-breadcrumb {
    display: inline-block;
    font-size: 0.95em;
    line-height: 1.6;
    color: #666;
}

/* 各パンくずリンクに余白と装飾を追加 
.woocommerce-breadcrumb [itemprop="itemListElement"] a {
    color: #333;
    text-decoration: none;
    padding: 0.2em 0.4em;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}
*/

.woocommerce-breadcrumb [itemprop="itemListElement"] a:hover {
    background-color: #f0f0f0;
}

/* セパレーターの調整 */
.woocommerce-breadcrumb .separator {
    display: inline-block;
    color: #ccc;
    margin: 0 0.3em;
    font-weight: bold;
}

/* 現在地を強調 */
.woocommerce-breadcrumb .current {
    font-weight: 600;
    color: #000;
}

/* モバイルではフォントサイズ最適化 */
@media (max-width: 767px) {
    .woocommerce-breadcrumb {
        font-size: 0.95em;
    }

    .woocommerce-breadcrumb .separator {
        margin: 0 0.25em;
    }
}


/* ショップページのカテゴリリンクボタンを中央揃えに */
.wp-block-buttons,
.wp-block-themeisle-blocks-button-group {
  display: flex;
  justify-content: center;
}


/* WPボタンを白背景＋黒文字に強制する */
.wp-block-button__link {
  background-color: #fff !important;
  color: #000 !important;
  border: 1px solid #000; /* 必要であれば追加 */
}

/* ホバー時の色調整（オプション） */
.wp-block-button__link:hover {
  background-color: #f0f0f0 !important;
  color: #000 !important;
}

/* Otter Blocksボタンのシャドーを明示的に適用 */
.wp-block-button__link {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3) !important;
}

/* shop_tableを明示的に適用 */
table.shop_table {
    border-collapse: collapse;
    width: 100%;
}

table.shop_table th,
table.shop_table td {
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
    border: none;
}

table.shop_table th {
    white-space: nowrap;
    font-weight: bold;
    width: 160px; /* 任意で固定幅にして揃える */
}

table.shop_table td {
    word-break: break-word;
}

// 国名/都道府県の英日マップをまとめて読み込む（簡易キャッシュ付き）
if (!function_exists('nk_country_state_maps')) {
    function nk_country_state_maps(): array {
        static $cache = null;
        if ($cache !== null) return $cache;

        $dir = get_stylesheet_directory() . '/functions/custom/functions-utility/';
        $cache = [
            'country_en' => file_exists($dir . 'full_country_code_map_en.php') ? require $dir . 'full_country_code_map_en.php' : [],
            'country_jp' => file_exists($dir . 'full_country_code_map_jp.php') ? require $dir . 'full_country_code_map_jp.php' : [],
            'state_en'   => file_exists($dir . 'full_state_code_map_en.php')   ? require $dir . 'full_state_code_map_en.php'   : [],
            'state_jp'   => file_exists($dir . 'full_state_code_map_jp.php')   ? require $dir . 'full_state_code_map_jp.php'   : [],
        ];
        return $cache;
    }
}


// トップバーのボタン用
/* トップバーのカート・マイページを横並びにする */
.site-bar .topbar-mini-cart,
.site-bar .topbar-account-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-left: 12px;
}

/* トップバーのカートボタン */
.site-bar .topbar-mini-cart .wc-block-mini-cart__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-width: 36px;
    min-height: 36px;
    line-height: 1;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* トップバーのカートアイコンサイズ */
.site-bar .topbar-mini-cart .wc-block-mini-cart__icon {
    width: 30px;
    height: 30px;
}

/* トップバーのカート件数バッジを大きくする */
.site-bar .topbar-mini-cart .wc-block-mini-cart__badge {
    font-size: 14px !important;
    min-width: 22px;
    height: 22px;
    line-height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    top: -8px;		/* カート件数バッジの位置調整 */
    right: 10px;	/* カート件数バッジの位置調整 */
}

/* カート件数バッジの基準位置 */
.site-bar .topbar-mini-cart .wc-block-mini-cart__quantity-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.site-bar .topbar-mini-cart .wc-block-mini-cart__badge {
    font-size: 12px;
}

/* トップバーのマイページボタン */
.site-bar .topbar-account-button a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
}

/* トップバーのマイページアイコンサイズ */
.site-bar .topbar-account-button a svg {
    width: 30px !important;
    height: 30px !important;
}


