/* IEEC v2 下層プレビュー用。SWELL の本文ブロックは上書きしない。
   対象: シェル（フォント・色）、パンくず、ページタイトル、サイドバー見出し。 */

body.ieec-v2-lower {
  color: var(--text);
  background: var(--white);
}
/* font-family はアイコンフォントを潰さないよう、#body_wrap 全体には当てない */

/* 差し替え成功時だけ、旧 SWELL ヘッダー／追従ヘッダー／スマホメニュー／旧フッターを隠す */
body.ieec-v2-lower:has(.site-header) #sp_menu,
body.ieec-v2-lower:has(.site-header) .p-spMenu,
body.ieec-v2-lower:has(.site-header) header.l-header,
body.ieec-v2-lower:has(.site-header) #header,
body.ieec-v2-lower:has(.site-header) #fix_header,
body.ieec-v2-lower:has(.site-header) .l-fixHeader,
body.ieec-v2-lower:has(.site-header) #search_modal,
body.ieec-v2-lower:has(.site-header) .p-searchModal,
body.ieec-v2-lower:has(.site-header) #fix_bottom_menu,
body.ieec-v2-lower:has(.site-footer) footer.l-footer {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: none !important;
}

/* v2 ヘッダーは全ブラウザで sticky に統一する。
   Safari 向けの position:fixed + #body_wrap の padding-top は、
   追従サイドバーと目次アンカーの位置をずらすため使わない。 */
body.ieec-v2-lower .site-header {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
}

/* iOS で overflow-x:clip が sticky の包含ブロックになるのを避ける。
   横スクロールは表などの内側で行う。 */
html.ieec-v2-lower {
  overflow-x: clip;
}
body.ieec-v2-lower,
body.ieec-v2-lower #body_wrap {
  overflow-x: visible;
  overflow-y: visible;
}

/* SWELL の追従オフセットは #fix_header 前提で、v2 では 0 になる。
   バナー全体がヘッダーの下に隠れないよう、v2 ヘッダー高さを使う。 */
html.ieec-v2-lower {
  --swl-pad_container: 24px;
  --header-h: 80px;
  --swl-fix_headerH: var(--header-h) !important;
  --swl-headerH: var(--header-h) !important;
  --swl-offset_y: calc(var(--header-h) + 8px) !important;
  --swl-adminbarH: 0px;
  scroll-padding-top: calc(var(--header-h) + 8px);
  scroll-behavior: auto;
}
@media (max-width: 767px) {
  html.ieec-v2-lower { --header-h: 64px; --swl-pad_container: 20px; }
}
html.ieec-v2-lower:has(#wpadminbar) {
  --swl-adminbarH: 32px;
  scroll-padding-top: calc(var(--header-h) + 32px + 8px);
}
@media screen and (max-width: 782px) {
  html.ieec-v2-lower:has(#wpadminbar) {
    --swl-adminbarH: 46px;
    scroll-padding-top: calc(var(--header-h) + 46px + 8px);
  }
}
@media screen and (max-width: 600px) {
  html.ieec-v2-lower:has(#wpadminbar) {
    --swl-adminbarH: 0px;
    scroll-padding-top: calc(var(--header-h) + 8px);
  }
}

body.ieec-v2-lower .w-fixSide,
body.ieec-v2-lower #fix_sidebar {
  top: calc(var(--header-h) + 8px);
  max-height: calc(100vh - var(--header-h) - 16px);
}
body.ieec-v2-lower:has(#wpadminbar) .w-fixSide,
body.ieec-v2-lower:has(#wpadminbar) #fix_sidebar {
  top: calc(var(--header-h) + 32px + 8px);
  max-height: calc(100vh - var(--header-h) - 32px - 16px);
}
@media screen and (max-width: 782px) {
  body.ieec-v2-lower:has(#wpadminbar) .w-fixSide,
  body.ieec-v2-lower:has(#wpadminbar) #fix_sidebar {
    top: calc(var(--header-h) + 46px + 8px);
    max-height: calc(100vh - var(--header-h) - 46px - 16px);
  }
}
@media screen and (max-width: 600px) {
  body.ieec-v2-lower:has(#wpadminbar) .w-fixSide,
  body.ieec-v2-lower:has(#wpadminbar) #fix_sidebar {
    top: calc(var(--header-h) + 8px);
    max-height: calc(100vh - var(--header-h) - 16px);
  }
}

/* 目次や見出しへの着地がヘッダーに隠れないようにする（ネイティブアンカー用）。
   SWELL の JS スクロールは別途 JS でオフセットする。 */
body.ieec-v2-lower .post_content :is(h1, h2, h3, h4, h5, h6, [id]) {
  scroll-margin-top: calc(var(--header-h) + 8px);
}
body.ieec-v2-lower:has(#wpadminbar) .post_content :is(h1, h2, h3, h4, h5, h6, [id]) {
  scroll-margin-top: calc(var(--header-h) + 32px + 8px);
}
@media screen and (max-width: 782px) {
  body.ieec-v2-lower:has(#wpadminbar) .post_content :is(h1, h2, h3, h4, h5, h6, [id]) {
    scroll-margin-top: calc(var(--header-h) + 46px + 8px);
  }
}
@media screen and (max-width: 600px) {
  body.ieec-v2-lower:has(#wpadminbar) .post_content :is(h1, h2, h3, h4, h5, h6, [id]) {
    scroll-margin-top: calc(var(--header-h) + 8px);
  }
}

/* 管理バーがあるとき、固定ヘッダーをトップと同じ位置にずらす。
   下層は <body> に admin-bar が付かないことがあるため :has(#wpadminbar) を使う。 */
body.ieec-v2-lower:has(#wpadminbar) .site-header,
#body_wrap.admin-bar.ieec-v2-lower .site-header {
  top: 32px;
}
@media screen and (max-width: 782px) {
  body.ieec-v2-lower:has(#wpadminbar) .site-header,
  #body_wrap.admin-bar.ieec-v2-lower .site-header { top: 46px; }
}
@media screen and (max-width: 600px) {
  body.ieec-v2-lower:has(#wpadminbar) .site-header,
  #body_wrap.admin-bar.ieec-v2-lower .site-header { top: 0; }
}

/* 固定シェアボタン（SWELL, 左端に浮く）は本文が左端に近い幅では本文に重なる。記事末尾のシェアボタンを使う */
@media (min-width: 768px) and (max-width: 1279px) {
  body.ieec-v2-lower .c-shareBtns.-fix { display: none; }
}

/* プレビュー告知（管理者だけに出力される） */
body.ieec-v2-lower .ieec-v2-preview-banner {
  position: relative;
  z-index: 70;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  margin: 0;
  padding: 8px 20px;
  background: var(--band);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  border-bottom: 1px solid var(--hair);
  text-align: center;
}
@media (max-width: 767px) {
  body.ieec-v2-lower .ieec-v2-preview-banner { font-size: 12px; }
}
body.ieec-v2-lower .ieec-v2-preview-banner a {
  color: var(--link);
  font-weight: 700;
  text-underline-offset: 3px;
}

/* パンくず */
body.ieec-v2-lower .p-breadcrumb {
  background: var(--soft);
  border: 0;
  box-shadow: none;
  font-family: var(--font);
  font-size: 13px;
  color: var(--muted);
  padding: 0;
}
body.ieec-v2-lower .p-breadcrumb__list {
  width: min(100% - (var(--pad) * 2), var(--max));
  margin-inline: auto;
  padding-inline: 0;
  gap: 8px;
}
body.ieec-v2-lower .p-breadcrumb__item {
  gap: 8px;
  min-height: 40px;
}
@media (max-width: 767px) {
  body.ieec-v2-lower .p-breadcrumb__item { min-height: 44px; }
}
body.ieec-v2-lower .p-breadcrumb a,
body.ieec-v2-lower .p-breadcrumb .p-breadcrumb__text {
  color: var(--muted);
  text-decoration: none;
}
body.ieec-v2-lower .p-breadcrumb a:hover {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 記事では SWELL が最後の項目（記事タイトル）を display:none にするため、
   カテゴリの後ろの区切りだけが残る。プレビューではタイトルを出して揃える。 */
body.ieec-v2-lower:has(#body_wrap.single) .p-breadcrumb__item:last-child,
body.ieec-v2-lower #body_wrap.single .p-breadcrumb__item:last-child {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
body.ieec-v2-lower:has(#body_wrap.single) .p-breadcrumb__item:last-child > span.p-breadcrumb__text,
body.ieec-v2-lower #body_wrap.single .p-breadcrumb__item:last-child > span.p-breadcrumb__text {
  display: inline-block !important;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 固定ページ・アーカイブ・検索・404 のページタイトル */
body.ieec-v2-lower .c-pageTitle,
body.ieec-v2-lower .c-pageTitle[data-style="b_bottom"] {
  font-family: var(--font);
  font-weight: 700;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: 0.02em;
  color: var(--text);
  line-height: 1.35;
  margin: 24px 0 32px;
  padding: 0 0 16px;
  border: 0;
  border-bottom: 1px solid var(--hair);
  background: none;
  float: none;
  position: static;
}
body.ieec-v2-lower .c-pageTitle::before,
body.ieec-v2-lower .c-pageTitle::after {
  content: none !important;
  display: none !important;
  background: none !important;
  border: 0 !important;
  width: 0 !important;
  height: 0 !important;
  box-shadow: none !important;
}
body.ieec-v2-lower .c-pageTitle__inner,
body.ieec-v2-lower .c-pageTitle[data-style="b_bottom"] .c-pageTitle__inner {
  display: block;
  float: none;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}
body.ieec-v2-lower .c-pageTitle__subTitle {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* 記事タイトル */
body.ieec-v2-lower .p-articleHead.c-postTitle,
body.ieec-v2-lower .c-postTitle {
  font-family: var(--font);
  margin: 16px 0 12px;
}
body.ieec-v2-lower .c-postTitle__ttl {
  font-family: var(--font);
  font-weight: 700;
  font-size: clamp(26px, 3.4vw, 36px);
  letter-spacing: 0.02em;
  color: var(--text);
  line-height: 1.4;
  margin: 0;
}
body.ieec-v2-lower .c-postTitle__ttl::before,
body.ieec-v2-lower .c-postTitle__ttl::after {
  content: none !important;
  display: none !important;
}
body.ieec-v2-lower .c-postTitle__date {
  font-family: var(--font);
  color: var(--muted);
}
body.ieec-v2-lower .p-articleMetas {
  font-family: var(--font);
  color: var(--muted);
  font-size: 14px;
}
body.ieec-v2-lower .c-categoryList__link {
  background-color: var(--band);
  color: var(--link);
  font-weight: 500;
  text-decoration: none;
}
body.ieec-v2-lower .c-categoryList__link:hover,
body.ieec-v2-lower .c-categoryList__link:focus {
  background-color: var(--soft);
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* 本文の基本（ブロックの見た目は触らない） */
body.ieec-v2-lower .post_content,
body.ieec-v2-lower .l-mainContent {
  font-family: var(--font);
  color: var(--text);
}
/* 通常の本文リンクだけ色を変える。ボタン内の a は SWELL の色（塗りボタンは白）を保つ。
   以前は :not(.swl-inline-btn) を a 自身に付けていたが、class は親の span にあり、
   オレンジボタンの文字が --link（#00118F）で上書きされていた。 */
body.ieec-v2-lower .post_content a:not(:is(
  .swl-inline-btn a,
  .swell-block-button a,
  a[class*="swell-block-button"],
  .wp-block-button a,
  a.wp-element-button,
  a.c-btn,
  .c-btn a,
  [class*="is-style-btn_"] a,
  a[class*="is-style-btn_"]
)) {
  color: var(--link);
}

/* サイドバー */
body.ieec-v2-lower .l-sidebar,
body.ieec-v2-lower #sidebar,
body.ieec-v2-lower #fix_sidebar {
  font-family: var(--font);
  color: var(--text);
}
body.ieec-v2-lower .c-widget__title {
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  border-color: var(--hair);
}

/* アーカイブ・検索の一覧 */
body.ieec-v2-lower .p-postList,
body.ieec-v2-lower .p-postList__title,
body.ieec-v2-lower .p-postList__body {
  font-family: var(--font);
}
body.ieec-v2-lower .p-postList a {
  color: var(--text);
}

/* 404 */
body.ieec-v2-lower.error404 .l-mainContent,
body.ieec-v2-lower #body_wrap.error404 .l-mainContent {
  font-family: var(--font);
}

/* SWELL 本文ブロック（ボックス・ボタン・表・目次・吹き出し・リンクカード・FAQ）は現状維持。
   ここより下に .swell-block-* / .c-balloon / .p-blogCard / .p-toc / .swell-block-faq の上書きを足さないこと。 */
