/* 検索ページ・旧保育園connectデザイン撤廃（2026-08-04）
 * 対象ページ（施設検索アーカイブ・施設詳細・facility_type/areaタクソノミー）でのみ、
 * 旧ヘッダー・旧フッター（SHOP/広告バナー・パプリカBASE画像スライダー・旧ナビメニューを
 * 含む）を非表示にする。DOMからは削除しない（他プラグインの依存を壊さないため）。
 * それ以外の旧ページ（会社概要・お問い合わせ等）には一切影響しない。
 */
/* 【2026-08-13 不具合修正】
   ここは以前 `body.xxx > .l-header`（直接の子）と書かれていたが、
   親テーマ（Snow Monkey）の実際のDOMでは
     body … > div.l-container > header.l-header
   と入れ子になっており、一致しないため非表示が効いていなかった。
   その結果、施設検索・施設詳細で旧「保育園connect」のヘッダーと旧ナビ
   （TOP／保育園の選び方／保育事業者さま／会社概要／お問い合わせ／お気に入り）が
   本番に表示され続けていた。すぐ下のフッター側は最初から子孫指定で正しく効いていた。
   結合子を揃えて修正する（DOMからの削除はしない方針は変えない）。 */
body.post-type-archive-nursery .l-header,
body.single-nursery .l-header,
body.tax-facility_type .l-header,
body.tax-area .l-header,
body.post-type-archive-nursery .l-footer,
body.single-nursery .l-footer,
body.tax-facility_type .l-footer,
body.tax-area .l-footer {
  display: none !important;
}

/* 【2026-08-13 不具合修正】Family Oneロゴが表示されない問題
   これらのページだけは旧テーマの style.css も同時に読み込まれる。その中に
       img { height: 100% !important; }
   という全画像に効く指定があり、Family Oneのヘッダーロゴが潰れていた。
   ロゴは「余白の多い素材を枠で切り抜いて見せる」作りで、画像の高さが
   枠いっぱい（51px）に固定されると、切り抜き位置（top:-103.6%）の外へ出てしまい
   何も見えなくなる。実測：本来 158px の画像が 51px になり、枠の外＝完全に不可視。
   ここでは family-one.css 側の意図した寸法を、同じ折り返し幅で復元するだけ。
   （!important を使うのは、相手が !important のため。ロゴ以外の画像には触らない） */
.f1-nursery-rebrand-header .f1-header__logo .f1-brand-logo__wordmark img { height: 40px !important; }
.f1-nursery-rebrand-header .f1-header__logo .f1-brand-logo__symbol img { height: 42px !important; }
@media (min-width: 641px) {
  .f1-nursery-rebrand-header .f1-header__logo .f1-brand-logo__wordmark img { height: auto !important; }
}

/* Family Oneヘッダー／フッターの「保育園connectへ戻る」「保育園connectで施設を探す」
   リンクは、このページ群自体が保育園connect（検索）そのものなので意味を持たない。
   共通コンポーネント（family_one_render_header/footer）自体は変更せず、
   このページ限定でCSSにより非表示にする。 */
.f1-nursery-rebrand-header .f1-header__back,
.f1-nursery-rebrand-footer .f1-footer__back {
  display: none !important;
}

/* Family Oneヘッダーは通常 <body> 直下・アプリ全体を包む前提のレイアウトのため、
   通常のWPページ内（wp_body_openの直後）に差し込んでもヘッダーらしく上部に固定されるよう、
   位置指定を補強する。 */
.f1-nursery-rebrand-header {
  position: relative;
  z-index: 100;
}
.f1-nursery-rebrand-header .f1-header {
  position: sticky;
  top: 0;
}

/* ==========================================================================
   検索結果カードUI改善（2026-08-29）
   これまで検索結果一覧（.c-entries--panel）は親テーマ（Snow Monkey）の汎用ブログ
   カード用グリッドをそのまま使っており、施設写真・名称・種別・バッジ・住所・特徴・
   利用条件・CTAという情報量の多いカードには不向きな、細長い多列グリッドになっていた。
   検索順位・検索ロジック・DB・施設データ自体は一切変更せず、表示（グリッド列数・
   カード内の配置）だけをこのページ限定で作り直す。
   ========================================================================== */

/* PC/タブレット：1施設＝横長1カードを基本とし、1行2列を基本とする。
   スマホ（641px未満）は既存どおり1列のまま変更しない。 */
@media (min-width: 641px) {
  body.post-type-archive-nursery .c-entries--panel,
  body.single-nursery .c-entries--panel,
  body.tax-facility_type .c-entries--panel,
  body.tax-area .c-entries--panel {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 20px !important;
  }
  /* 親テーマ（Snow Monkey）は .c-entries--panel を本来flexboxの汎用ブログ一覧として
     組んでおり、.c-entries__item 側に flex: 0 1 50%; max-width: 50%; padding-*
     が付いている。親を display:grid に変えても、子側のこれらの指定は残ったままだと
     グリッドセル幅を無視して狭くなってしまうため、ここで明示的に無効化する。 */
  body.post-type-archive-nursery .c-entries--panel .c-entries__item,
  body.single-nursery .c-entries--panel .c-entries__item,
  body.tax-facility_type .c-entries--panel .c-entries__item,
  body.tax-area .c-entries--panel .c-entries__item {
    width: auto !important;
    max-width: none !important;
    flex: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* カード自体を「写真は左、情報は右」の横長レイアウトにする。
     バッジ（安心認定・Family One認定）は<a>の外側の兄弟要素のため影響を受けない。 */
  body.post-type-archive-nursery .dc3-fcard > a,
  body.single-nursery .dc3-fcard > a,
  body.tax-facility_type .dc3-fcard > a,
  body.tax-area .dc3-fcard > a {
    display: flex !important;
    align-items: stretch;
    gap: 16px;
  }
  body.post-type-archive-nursery .dc3-fcard__photo,
  body.single-nursery .dc3-fcard__photo,
  body.tax-facility_type .dc3-fcard__photo,
  body.tax-area .dc3-fcard__photo {
    flex: 0 0 220px;
    width: 220px;
    aspect-ratio: 4 / 3;
    align-self: flex-start;
    border-radius: var(--dc3-radius-md, 12px);
  }
  body.post-type-archive-nursery .dc3-fcard__body,
  body.single-nursery .dc3-fcard__body,
  body.tax-facility_type .dc3-fcard__body,
  body.tax-area .dc3-fcard__body {
    flex: 1;
    min-width: 0;
    padding-left: 0;
  }
  /* 横長レイアウトでは説明文の折返し行数を少し増やし、右側の余白を活かす。 */
  body.post-type-archive-nursery .dc3-fcard__catchphrase,
  body.single-nursery .dc3-fcard__catchphrase,
  body.tax-facility_type .dc3-fcard__catchphrase,
  body.tax-area .dc3-fcard__catchphrase {
    -webkit-line-clamp: 3;
  }
}

/* 「病児・病後児保育に対応」カード（.f1-sick-child-card）を、別の縦長カードとして
   分離させず、施設カードの下部セクションとして視覚的に一体化する。
   PHP側の生成関数・データ取得は変更せず、CSSで見た目だけを1枚のカードに統合する。 */
body.post-type-archive-nursery .c-entries__item,
body.single-nursery .c-entries__item,
body.tax-facility_type .c-entries__item,
body.tax-area .c-entries__item {
  display: flex;
  flex-direction: column;
}
body.post-type-archive-nursery .c-entries__item .dc3-fcard,
body.single-nursery .c-entries__item .dc3-fcard,
body.tax-facility_type .c-entries__item .dc3-fcard,
body.tax-area .c-entries__item .dc3-fcard {
  margin-bottom: 0;
}
body.post-type-archive-nursery .c-entries__item .dc3-fcard:has(+ .f1-sick-child-card),
body.single-nursery .c-entries__item .dc3-fcard:has(+ .f1-sick-child-card),
body.tax-facility_type .c-entries__item .dc3-fcard:has(+ .f1-sick-child-card),
body.tax-area .c-entries__item .dc3-fcard:has(+ .f1-sick-child-card) {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: none;
}
body.post-type-archive-nursery .f1-sick-child-card,
body.single-nursery .f1-sick-child-card,
body.tax-facility_type .f1-sick-child-card,
body.tax-area .f1-sick-child-card {
  margin-top: 0 !important;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: 1px dashed rgba(249, 115, 22, 0.35);
}
