/**
 * ブロック共通CSS（フロント・エディター両方、enqueue_block_assets経由）
 *
 * lib/includes/blocks.php の exoasis_enqueue_block_assets() がファイル存在時
 * だけ読み込む。カンプdist（assets/comp/配下）は改変せず、そちらでカバーしない
 * 小さな追加分だけをここに置く。
 *
 * reCAPTCHA v3 バッジ（.grecaptcha-badge）: 既定は全ページ非表示。CF7本体は
 * reCAPTCHA有効時バッジを全ページで読み込む（条件読込は公式非推奨のため
 * ページ限定しない、docs/research/cf7-recaptcha-2026-09-23.md）。
 *
 * 2026-09-24追記（user裁定: バッジはお問い合わせフォームのあるページでは表示して
 * よい）: `body.has-cf7Form`（lib/includes/contact-form.phpの
 * exoasis_cf7_body_class()がexo/sub-page-contact・exo/mar-contactを持つページ
 * ＝/contact/・/service/pet-hotel/・/mar/contact/だけに付与）でバッジを再表示する。
 * バッジ自体にGoogle公式の必須文言が含まれるため、テーマ側の注記
 * （.px-contact__recaptchaNote、下記）の呼び出しは撤去した。
 * SP幅（≤900px）ではバッジ（右下固定、Google側JSがinline styleでbottomを
 * 直接持つ）がSP固定バー（.px-spbar、高さ約64px、z-index:98、
 * design/src/scss/Object/Project/common/_spbar.scss）と重なるため、bottomを
 * 固定バーの上まで持ち上げる（inline style勝ちのため!important必須）。
 *
 * 注記（.px-contact__recaptchaNote）のスタイルは、呼び出しが無くなった後も
 * exoasis_cf7_recaptcha_notice_html()の将来的な再利用に備えて残す。
 * .px-contact__formは面によって文字色の前提が違う（通常ページ=暗い面=
 * var(--bone)継承、body.p-mar配下の/mar/contact/だけ
 * `body.p-mar{color:var(--ink)}`＝明るい面、exoasis-sub.cssの
 * `body.p-mar .px-contact__form{border-color:#1a140c38}`が明面variantの証拠）ため、
 * 色を固定値で指定せず親から継承した上でopacityだけ絞る（暗面ではbone×.78で
 * 既存の.p-subpage-cta__note相当、明面ではink×.78で自然に薄くなる）。
 */
.grecaptcha-badge {
    visibility: hidden;
}

body.has-cf7Form .grecaptcha-badge {
    visibility: visible;
}

@media (max-width: 900px) {
    /* .px-spbar（高さ約64px）の上へ逃がす。バッジは inline style で bottom を持つため !important 必須 */
    body.has-cf7Form .grecaptcha-badge {
        bottom: calc(64px + 14px) !important;
    }
}

.px-contact__recaptchaNote {
    margin-top: 16px;
    font-size: 13px;
    line-height: 1.8;
    opacity: .78;
}

.px-contact__recaptchaNote p:not(:first-child) {
    margin-top: 4px;
}

.px-contact__recaptchaNote a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/*
 * お問い合わせフォームの補正（2026-11-07 user指摘）。
 * (1) 件名セレクトの選択肢: 選択欄の文字色（bone）を引き継いだ選択肢が、
 *     ブラウザ既定の白い一覧上で読めなかった。暗い面では一覧自体を暗色にする。
 *     /mar/contact/（body.p-mar、明るい面）は既定の白一覧＋ink文字のままでよい。
 * (2) 送信結果欄（.wpcf7-response-output）: カンプdistのCSSが枠線を常時持つため、
 *     CF7の自前CSS（init時に非表示）を読まない当テーマでは、未送信でも空の赤枠が
 *     出ていた。空の間は枠・余白を消す（スクリーンリーダー通知用にDOMには残す）。
 * (3) 同意文言内のリンク（.px-contact__acceptLink、PHPで付与）。
 */
body:not(.p-mar) .px-contact__form select {
    color-scheme: dark;
}

body:not(.p-mar) .px-contact__form select option {
    background-color: #16120c;
    color: #f7f2e6;
}

body.p-mar .px-contact__form select option {
    background-color: #fff;
    color: #1a140c;
}

.px-contact .px-contact__form .wpcf7-response-output:empty {
    margin: 0;
    padding: 0;
    border: 0;
}

/*
 * 送信結果欄の色（2026-11-07 受け入れ確認 C-7）。カンプdistは状態を問わず
 * 枠・文字をember（赤）に固定しており、送信成功まで赤く出ていた。
 * CF7は状態をform要素のクラス（sent / invalid / unaccepted / failed / spam / aborted）で
 * 付けるため、成功（sent）だけ金系に上書きし、エラー系は赤のまま明示する。
 * 暗い面（/contact/）は明るい金、明るい面（body.p-mar の /mar/contact/）は濃い金＋ink文字。
 */
.px-contact .px-contact__form form.sent .wpcf7-response-output {
    color: var(--gold-lt);
    border-color: var(--gold);
}

body.p-mar .px-contact .px-contact__form form.sent .wpcf7-response-output {
    color: var(--ink);
    border-color: #8a6a22;
}

.px-contact .px-contact__form form.invalid .wpcf7-response-output,
.px-contact .px-contact__form form.unaccepted .wpcf7-response-output,
.px-contact .px-contact__form form.failed .wpcf7-response-output,
.px-contact .px-contact__form form.spam .wpcf7-response-output,
.px-contact .px-contact__form form.aborted .wpcf7-response-output {
    color: var(--ember);
    border-color: var(--ember);
}

.px-contact__acceptLink {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/*
 * 長い英数字タイトルの折り返し（2026-11-07 受け入れ確認 A-NG-05）。
 * 半角英数字とハイフンだけの長いタイトルは単語の切れ目がなく、375pxで右へ突き抜けて
 * 欠けていた（親がoverflow:hiddenのため横スクロールにも出ない）。日本語は従来どおり。
 */
body .px-article__title,
body .p-subpage-hero__title,
body .p-column-archive__cardTitle,
body .p-creatures-archive__cardJp,
body .p-creatures-single-head__jp,
body .px-newsList__title,
body .px-columnCard__title,
body .px-columnCard__titleSmall,
body .px-relatedName {
    overflow-wrap: anywhere;
}

/*
 * 砂色の面が先頭の一覧ページ（/news/・お知らせのカテゴリ一覧・汎用アーカイブ等）のヘッダー
 * （2026-11-07 受け入れ確認 A-NG-06）。ヘッダーは最上部では透明で白文字のため、
 * 先頭が砂色だとロゴ・ナビ・ハンバーガーが埋もれていた。ほかの下層ページは先頭が
 * 暗いヒーローなので問題がない。先頭が砂色のページだけ、スクロール後と同じ
 * 暗い帯（.is-solid と同じ配色）を最初から付ける。:has() なのでページ遷移後も追従する。
 * MAR側（body.p-mar）は明るい配色のヘッダーを別に持つため対象外。
 */
body:not(.p-mar):has(.l-main > .px-section--sand.px-section--top:first-child) .px-header:not(.is-solid) {
    background: rgba(11, 10, 8, .92);
    border-bottom-color: rgba(201, 162, 75, .22);
    backdrop-filter: blur(8px);
}

/*
 * 固定ページの既定テンプレート（templates/page.html・page-mar.html の post-content）に、
 * お客さんが標準ブロック（段落・見出し・リスト・画像・表・引用・ボタン・区切り）だけで
 * 本文を足したときの基本スタイル（2026-11-07 受け入れ確認 B-NG-10）。
 * exo/* ブロックはすべて section 要素で出力されるため、post-content 直下の「section 以外」だけを
 * 対象にし、既存のデザインブロックで組んだ固定ページの見た目は変えない。
 * 左端・最大幅は .l-container（最大1440px・左右 --gut）と揃え、読みやすい行長（820px）に絞る。
 * 色は親から継承する（暗い面はbone、body.p-mar の明るい面はink）。
 */
.l-main > .wp-block-post-content > :not(section) {
    box-sizing: border-box;
    width: min(820px, 100% - 2 * var(--gut));
    max-width: none;
    margin-top: 0;
    margin-bottom: 0;
    margin-left: max(var(--gut), calc((100% - 1440px) / 2 + var(--gut)));
    margin-right: auto;
    font-size: 16px;
    line-height: 2.05;
    overflow-wrap: anywhere;
}

.l-main > .wp-block-post-content > :not(section) + :not(section) {
    margin-top: 1.4em;
}

/* 固定ヘッダー（高さ84px）の下に潜らない上余白。先頭が section のページは section 側が持つ */
.l-main > .wp-block-post-content:has(> :first-child:not(section)) {
    padding-top: 150px;
}

.l-main > .wp-block-post-content:has(> :last-child:not(section)) {
    padding-bottom: 96px;
}

.l-main > .wp-block-post-content > section + :not(section) {
    margin-top: 72px;
}

.l-main > .wp-block-post-content > :not(section) + section {
    margin-top: 72px;
}

.l-main > .wp-block-post-content > :where(h1, h2, h3, h4, h5, h6):not(section) {
    font-family: var(--f-min);
    font-weight: 700;
    line-height: 1.6;
    letter-spacing: .04em;
}

.l-main > .wp-block-post-content > h1,
.l-main > .wp-block-post-content > h2 {
    font-size: clamp(22px, 2.2vw, 30px);
}

.l-main > .wp-block-post-content > h3 {
    font-size: clamp(19px, 1.8vw, 24px);
}

.l-main > .wp-block-post-content > :where(h4, h5, h6) {
    font-size: 17px;
}

.l-main > .wp-block-post-content > :not(section) + h1,
.l-main > .wp-block-post-content > :not(section) + h2 {
    margin-top: 64px;
    padding-top: 26px;
    border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent);
}

.l-main > .wp-block-post-content > :not(section) + h3 {
    margin-top: 44px;
}

.l-main > .wp-block-post-content > :not(section) + :where(h4, h5, h6) {
    margin-top: 32px;
}

/* 見出しの直後は詰める */
.l-main > .wp-block-post-content > :where(h1, h2, h3, h4, h5, h6) + :not(section) {
    margin-top: 18px;
}

.l-main > .wp-block-post-content > p a,
.l-main > .wp-block-post-content > :where(ul, ol) a {
    color: var(--gold-lt);
    text-decoration: underline;
    text-underline-offset: 3px;
}

body.p-mar .l-main > .wp-block-post-content > p a,
body.p-mar .l-main > .wp-block-post-content > :where(ul, ol) a {
    color: #7a5a14;
}

/* リスト（点・番号を出す） */
.l-main > .wp-block-post-content > :where(ul, ol) {
    padding-left: 1.7em;
}

.l-main > .wp-block-post-content > ul {
    list-style: disc;
}

.l-main > .wp-block-post-content > ol {
    list-style: decimal;
}

.l-main > .wp-block-post-content > :where(ul, ol) li {
    margin-top: .4em;
    padding-left: .2em;
}

.l-main > .wp-block-post-content > :where(ul, ol) li::marker {
    color: var(--gold);
}

/* 画像 */
.l-main > .wp-block-post-content > figure {
    margin-left: max(var(--gut), calc((100% - 1440px) / 2 + var(--gut)));
}

.l-main > .wp-block-post-content > figure img {
    display: block;
    max-width: 100%;
    height: auto;
}

.l-main > .wp-block-post-content > figure figcaption {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.7;
    letter-spacing: .04em;
    text-align: left;
    color: var(--muted);
}

body.p-mar .l-main > .wp-block-post-content > figure figcaption {
    color: #6b5a3c;
}

/* 表（狭い幅では横にスクロール） */
.l-main > .wp-block-post-content > figure.wp-block-table {
    overflow-x: auto;
}

.l-main > .wp-block-post-content > figure.wp-block-table table {
    width: 100%;
    min-width: 420px;
    border-collapse: collapse;
}

.l-main > .wp-block-post-content > figure.wp-block-table :where(th, td) {
    padding: 12px 16px;
    border: 1px solid color-mix(in srgb, currentColor 28%, transparent);
    text-align: left;
    font-size: 15px;
    line-height: 1.8;
    overflow-wrap: break-word;
}

.l-main > .wp-block-post-content > figure.wp-block-table th {
    font-weight: 700;
    background: color-mix(in srgb, currentColor 8%, transparent);
}

/* 引用 */
.l-main > .wp-block-post-content > blockquote {
    padding: 6px 0 6px 20px;
    border-left: 3px solid var(--gold);
}

.l-main > .wp-block-post-content > blockquote p + p {
    margin-top: .8em;
}

.l-main > .wp-block-post-content > blockquote cite {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    font-style: normal;
    color: var(--muted);
}

body.p-mar .l-main > .wp-block-post-content > blockquote cite {
    color: #6b5a3c;
}

/* ボタン */
.l-main > .wp-block-post-content > .wp-block-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.l-main > .wp-block-post-content > .wp-block-buttons .wp-block-button__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 30px;
    border: 1px solid var(--gold);
    border-radius: 0;
    background: transparent;
    color: var(--gold-lt);
    font-size: 15px;
    letter-spacing: .08em;
    text-decoration: none;
    transition: background-color .3s, color .3s;
}

.l-main > .wp-block-post-content > .wp-block-buttons .wp-block-button__link:hover {
    background: var(--gold);
    color: var(--night);
}

body.p-mar .l-main > .wp-block-post-content > .wp-block-buttons .wp-block-button__link {
    border-color: var(--ink);
    color: var(--ink);
}

body.p-mar .l-main > .wp-block-post-content > .wp-block-buttons .wp-block-button__link:hover {
    background: var(--ink);
    color: var(--sand);
}

/* 区切り線（コアの既定は幅100px。ほかの要素と同じ幅にそろえる） */
.l-main > .wp-block-post-content > hr.wp-block-separator:not(.is-style-dots) {
    width: min(820px, 100% - 2 * var(--gut));
}

.l-main > .wp-block-post-content > hr {
    height: 0;
    border: 0;
    border-top: 1px solid color-mix(in srgb, currentColor 25%, transparent);
    background: none;
}

.l-main > .wp-block-post-content > hr + :not(section) {
    margin-top: 1.8em;
}

.l-main > .wp-block-post-content > :not(section) + hr {
    margin-top: 48px;
}
