/* 藤立病院テーマ：記事フロント用CSS（本家 fujitate.jp のデザイン基準に統一） */

/* ── デザイントークン（本家 :root を踏襲） ── */
:root {
    --fjt-main:        #00adec; /* メインカラー（本家 --color-main） */
    --fjt-main-light:  #e8f6fd; /* 淡い背景（本家 --color-main-light） */
    --fjt-text:        #4e4e4e; /* 文字色（本体 fujitate.jp と同値） */
    --fjt-muted:       #777777; /* 補助テキスト */
    --fjt-border:      #e5e7eb; /* 枠線（本家 --color-border） */
    --fjt-bg:          #ffffff; /* 背景（本家 --color-bg） */
    --fjt-bg-thumb:    #efefef; /* サムネ背景（本家 --color-bg-thumb） */
    --fjt-tint2:       #f9fafb; /* グレー寄りの淡い背景 */
    --fjt-radius-sm:   8px;  /* 本家 --radius-sm */
    --fjt-radius-md:   16px;    /* 本家 --radius-md */
    --fjt-shadow-sm:   0 4px 10px rgba(15, 23, 42, 0.06);  /* 本家 --shadow-sm */
    --fjt-shadow-md:   0 18px 45px rgba(15, 23, 42, 0.12); /* 本家 --shadow-md */
    /* 後方互換の別名（既存参照を壊さない） */
    --fjt-navy: var(--fjt-text);
    --fjt-link: var(--fjt-main);
    --fjt-tint: var(--fjt-main-light);
}

/* ── ベースタイポグラフィ（本家準拠） ── */
main {
    font-size: 16px;
    line-height: 1.9;
    letter-spacing: 0.02em;
    color: var(--fjt-text);
    font-family: 'Yu Gothic', "游ゴシック", 'YuGothic', "游ゴシック体", 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
}

/* ── 記事コンテナ（読みやすい本文幅で中央寄せ） ── */
.fjt-article {
    /* 親サイト（fujitate.jp）が html{font-size:625%} を入れる関係で rem は使わない。
       配下の数値は全て px で記述。writing-mode は念のため横書き明示。 */
    writing-mode: horizontal-tb !important;
    max-width: 760px;
    margin: 24px auto 64px;
    padding: 0 20px;
    color: var(--fjt-text);
    word-break: break-word;
}

/* タイトル（記事の唯一のh1）：本体 .title h1 を踏襲・H2より大きい青ダッシュ */
.fjt-article .entry-title {
    display: flex;
    align-items: center;
    font-size: 30.4px;
    font-weight: normal;
    line-height: 1.45;
    color: var(--fjt-main);
    margin: 8px 0 12px;
}
.fjt-article .entry-title::before {
    content: "";
    flex: 0 0 auto;
    width: 44px;
    border-top: 2px solid currentColor;
    margin-right: 18px;
}

/* 更新日 */
.fjt-article .entry-dates {
    font-size: 13.6px;
    color: var(--fjt-muted);
    margin-bottom: 20px;
}
.fjt-article .entry-dates span + span::before {
    content: "・";
    margin: 0 6px;
}

/* アイキャッチ */
.fjt-article .post-thumbnail {
    margin: 0 auto 28px;
    text-align: center;
}
.fjt-article .post-thumbnail img {
    display: block;
    width: 80%;
    height: auto;
    margin-left: auto;
    margin-right: auto;
    border-radius: var(--fjt-radius-sm);
}

/* ── 見出しタグ（本家 main > article の作りに統一） ── */
/* h2：本体 .title h1 を踏襲（先頭に青い横ライン＋ブルー文字・細字・下線なし） */
.fjt-article h2 {
    display: flex;
    align-items: center;
    font-size: 24px;
    font-weight: normal;
    color: var(--fjt-main);
    margin: 2.4em 0 1em;
    line-height: 1.5;
}
.fjt-article h2::before {
    content: "";
    flex: 0 0 auto;
    width: 36px;
    border-top: 2px solid currentColor;
    margin-right: 18px;
}

/* h3：本体の下層見出しに合わせ装飾なし・ブルー細字（H2より小さく階層を区別） */
.fjt-article h3 {
    font-size: 19.2px;
    font-weight: normal;
    color: var(--fjt-main);
    margin: 2em 0 0.8em;
    line-height: 1.55;
}

/* h4：太字 */
.fjt-article h4 {
    font-size: 17.6px;
    font-weight: 700;
    color: var(--fjt-text);
    margin: 1.8em 0 0.6em;
    line-height: 1.6;
}

.fjt-article h5 {
    font-size: 16px;
    font-weight: 700;
    color: var(--fjt-text);
    margin: 1.6em 0 0.5em;
}
.fjt-article h6 {
    font-size: 15.2px;
    font-weight: 700;
    color: var(--fjt-muted);
    margin: 1.4em 0 0.5em;
}

/* ── 本文 ── */
.fjt-article p {
    margin: 0 0 1.4em;
    line-height: 1.9;
}

.fjt-article a {
    color: var(--fjt-main);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.fjt-article a:hover {
    text-decoration: none;
}

.fjt-article strong {
    font-weight: 700;
    color: var(--fjt-text);
}

.fjt-article em {
    font-style: italic;
}

/* ── リスト（本家準拠でプレーン。旧テーマのボックス装飾は廃止） ── */
.fjt-article ul,
.fjt-article ol {
    margin: 0 0 1.4em;
    padding-left: 1.6em;
}
.fjt-article li {
    margin: 0.4em 0;
    line-height: 1.8;
}
.fjt-article ul > li {
    list-style: disc;
}
.fjt-article ol > li {
    list-style: decimal;
}
.fjt-article li > ul,
.fjt-article li > ol {
    margin: 0.4em 0 0.4em;
}

/* ── 画像 ── */
.fjt-article img {
    max-width: 100%;
    height: auto;
}
.fjt-article .wp-block-image {
    margin: 1.6em auto;
    text-align: center;
}
.fjt-article .wp-block-image img {
    display: block;
    margin-left: auto;
    margin-right: auto;
    border-radius: var(--fjt-radius-sm);
}
.fjt-article .wp-block-image.alignleft {
    float: left;
    margin: 0.3em 1.4em 1em 0;
    max-width: 50%;
}
.fjt-article .wp-block-image.alignright {
    float: right;
    margin: 0.3em 0 1em 1.4em;
    max-width: 50%;
}
/* 左右寄せ時は img の中央寄せ・block を解除（回り込みを保つ） */
.fjt-article .wp-block-image.alignleft img,
.fjt-article .wp-block-image.alignright img {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
}
.fjt-article .wp-block-image figcaption,
.fjt-article .wp-element-caption,
.fjt-article figcaption {
    font-size: 12.8px;
    color: var(--fjt-muted);
    text-align: center;
    margin-top: 0.5em;
    line-height: 1.6;
}

/* ── 引用 ── */
.fjt-article blockquote {
    margin: 1.6em 0;
    padding: 1em 1.2em;
    background: var(--fjt-main-light);
    border-left: 4px solid var(--fjt-main);
    border-radius: 0 var(--fjt-radius-sm) var(--fjt-radius-sm) 0;
    color: var(--fjt-text);
}
.fjt-article blockquote p:last-child {
    margin-bottom: 0;
}

/* ── テーブル（本家：セル padding 10px ／枠線 #e5e7eb） ── */
.fjt-article .wp-block-table {
    margin: 1.6em 0;
    overflow-x: auto;
}
.fjt-article .wp-block-table table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #ccc;
    font-size: 15.2px;
}
.fjt-article .wp-block-table th,
.fjt-article .wp-block-table td {
    padding: 10px 12px;
    border: 1px solid #ccc;
    text-align: left;
    line-height: 1.6;
}
.fjt-article .wp-block-table thead th {
    font-weight: 700;
}

/* ── その他要素 ── */
.fjt-article dd {
    margin: 0 0 0.6em 1.4em;
}
.fjt-article pre {
    background: var(--fjt-tint2);
    border: 1px solid var(--fjt-border);
    border-radius: var(--fjt-radius-sm);
    padding: 1em;
    overflow-x: auto;
    font-size: 14.4px;
    line-height: 1.6;
}
.fjt-article address {
    font-style: normal;
    color: var(--fjt-muted);
}
.fjt-article hr {
    border: 0;
    border-top: 1px solid var(--fjt-border);
    margin: 2.4em 0;
}

/* ============================================================
   一覧（トップ／アーカイブ）カードグリッド ― 本家のカード感に統一
   ============================================================ */
.fjt-card-grid {
    /* 親サイトの html{font-size:625%} の影響を避けるため、テーマ側は rem を使わず px。
       writing-mode は念のため横書き明示。 */
    writing-mode: horizontal-tb !important;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 1200px;
    margin: 32px auto;
    padding: 0 20px;
}
/* ──────────────────────────────────────────────
   本体（fujitate.jp）のCSSは h2 等の見出しに大きなサイズや色を当てているため、
   カード内のタグはピンポイントで打ち消し、テーマのクラス指定を効かせる。
   本体CSSが詳細度で競合するため !important で確実に上書きする。
   ────────────────────────────────────────────── */
.fjt-card-grid .fjt-card,
.fjt-card-grid .fjt-card * {
    box-sizing: border-box;
}
.fjt-card-grid .fjt-card h2,
.fjt-card-grid .fjt-card h3,
.fjt-card-grid .fjt-card p,
.fjt-card-grid .fjt-card figure,
.fjt-card-grid .fjt-card time {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    color: inherit !important;
    font-family: inherit !important;
    font-weight: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    text-align: left !important;
}
/* 本体の h2::before（青ダッシュ）など擬似要素も無効化 */
.fjt-card-grid .fjt-card h2::before,
.fjt-card-grid .fjt-card h2::after,
.fjt-card-grid .fjt-card h3::before,
.fjt-card-grid .fjt-card h3::after {
    content: none !important;
    display: none !important;
}
.archive-hero + .fjt-card-grid {
    margin-top: 16px;
}
/* 3列 → タブレット2列 → スマホ1列 */
@media (max-width: 960px) {
    .fjt-card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .fjt-card-grid { grid-template-columns: 1fr; }
}

.fjt-card-grid .fjt-card {
    display: flex !important;
    flex-direction: column !important;
    background: var(--fjt-bg) !important;
    border: none !important;
    border-bottom: 2px solid #f0f2f4 !important;
    border-radius: 0 !important;
    overflow: visible !important;
    box-shadow: none !important;
    padding-bottom: 14px !important;
    color: var(--fjt-text) !important;
}

/* サムネ（カテゴリ帯なし・角丸最小） */
.fjt-card-grid .fjt-card__thumb {
    position: relative !important;
    margin: 0 !important;
    height: 150px !important;
    background: var(--fjt-bg-thumb) !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    line-height: 0 !important;
}
.fjt-card-grid .fjt-card__thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}
.fjt-card-grid .fjt-card__nothumb {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--fjt-muted) !important;
    font-size: 12px !important;
    background: var(--fjt-bg-thumb) !important;
}
/* カテゴリ帯は非表示（PHP側でも出力停止） */
.fjt-card-grid .fjt-card__cat {
    display: none !important;
}

/* 本文側 */
.fjt-card-grid .fjt-card__body {
    flex-grow: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 9px !important;
    padding: 13px 0 0 !important;
}
.fjt-card-grid .fjt-card__date {
    font-size: 11px !important;
    color: var(--fjt-main) !important;
    font-weight: 700 !important;
    letter-spacing: 0.06em !important;
    line-height: 1.4 !important;
}
.fjt-card-grid .fjt-card__title {
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1.55 !important;
    margin: 0 !important;
    color: #2c2c2a !important;
}
.fjt-card-grid .fjt-card__title a {
    color: #2c2c2a !important;
    text-decoration: none !important;
}
.fjt-card-grid .fjt-card:hover .fjt-card__title,
.fjt-card-grid .fjt-card:hover .fjt-card__title a {
    color: var(--fjt-main) !important;
}

/* B2はミニマル構成（日付＋タイトルのみ）。抜粋・情報ボックス・ボタンは非表示 */
.fjt-card-grid .fjt-card__box,
.fjt-card-grid .fjt-card__excerpt,
.fjt-card-grid .fjt-card__btn {
    display: none !important;
}

/* ── アーカイブ見出し ── */
.archive-hero {
    text-align: center;
    padding: 32px 20px 0;
}
.archive-title {
    display: inline-block;
    font-size: 28.8px;
    font-weight: 700;
    color: var(--fjt-text);
    position: relative;
    padding-bottom: 14px;
}
.archive-title::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    border-radius: 999px;
    background: var(--fjt-main);
}
.archive-desc {
    color: var(--fjt-muted);
    font-size: 14.4px;
    margin-top: 14px;
}

/* ── 404 の戻るボタン（本家ボタン＝丸ピル） ── */
.fjt-article .fjt-back-home {
    display: inline-block;
    background: var(--fjt-main);
    color: #fff;
    padding: 12px 28px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 700;
    transition: opacity 150ms ease-out;
}
.fjt-article .fjt-back-home:hover {
    opacity: 0.88;
}

/* ── ページネーション ── */
.nav-links {
    max-width: 1000px;
    margin: 24px auto;
    padding: 0 20px;
    font-size: 14.4px;
}
.nav-links a {
    color: var(--fjt-main);
}

/* ── レスポンシブ ── */
@media (max-width: 768px) {
    main { font-size: 15px; }

    .fjt-article {
        margin: 16px auto 40px;
        padding: 0 16px;
    }
    .fjt-article .entry-title { font-size: 24px; }
    .fjt-article h2 { font-size: 20.8px; margin: 2em 0 0.8em; }
    .fjt-article h3 { font-size: 18.4px; }
    .fjt-article h4 { font-size: 16.8px; }

    .fjt-card-grid {
        gap: 18px;
        margin-top: 20px;
    }
    .archive-title { font-size: 24px; }
}

/* ============================================================
   パンくず（.fjt-article の外に出力。本家にCSSが無いためテーマ側で用意）
   控えめなグレー＋「>」区切り、リンクはメインカラー
   ============================================================ */
.p-breadcrumb {
    max-width: 760px;
    margin: 16px auto 0;
    padding: 0 20px;
    overflow-x: auto;
}
.p-breadcrumb__list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 0;
    margin: 0;
    padding: 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--fjt-muted);
}
.p-breadcrumb__item {
    display: inline-flex;
    align-items: center;
}
/* 区切り記号「>」（先頭以外の前に表示） */
.p-breadcrumb__item:not(:first-child)::before {
    content: ">";
    color: #cbd0d6;
    margin: 0 8px;
}
/* リンク項目＝メインカラー */
a.p-breadcrumb__text {
    color: var(--fjt-main);
    text-decoration: none;
}
a.p-breadcrumb__text:hover {
    text-decoration: underline;
}
/* 現在ページ（リンクなし）＝グレー */
span.p-breadcrumb__text {
    color: var(--fjt-muted);
}

@media (max-width: 768px) {
    .p-breadcrumb {
        margin-top: 12px;
        padding: 0 16px;
        white-space: nowrap;
    }
    .p-breadcrumb__list {
        flex-wrap: nowrap;
        font-size: 12px;
    }
}
