/* お金の講座テーマ：記事フロント用CSS（本家 okanenokouza.com のデザイン基準に統一） */

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

/* ── ベースタイポグラフィ（本家準拠） ── */
main {
    font-size: 16px;
    line-height: 1.9;
    color: var(--okz-text);
    font-family: "Noto Sans JP", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ── 記事コンテナ（読みやすい本文幅で中央寄せ） ── */
.okz-article {
    max-width: 760px;
    margin: 24px auto 64px;
    padding: 0 20px;
    color: var(--okz-text);
    word-break: break-word;
}

/* タイトル（記事の唯一のh1） */
.okz-article .entry-title {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.45;
    color: var(--okz-text);
    margin: 8px 0 12px;
}

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

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

/* ── 見出しタグ（本家 main > article の作りに統一） ── */
/* h2：下線（#333）＋太字 ＝ 本家と同じ */
.okz-article h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--okz-text);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--okz-text);
    margin: 2.4em 0 1em;
    line-height: 1.5;
}

/* h3：太字＋メインカラーの左アクセント（スキャンしやすさのため。本家は太字のみ） */
.okz-article h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--okz-text);
    border-left: 4px solid var(--okz-main);
    padding-left: 12px;
    margin: 2em 0 0.8em;
    line-height: 1.55;
}

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

.okz-article h5 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--okz-text);
    margin: 1.6em 0 0.5em;
}
.okz-article h6 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--okz-muted);
    margin: 1.4em 0 0.5em;
}

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

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

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

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

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

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

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

/* ── テーブル（本家：セル padding 10px ／枠線 #e5e7eb） ── */
.okz-article .wp-block-table {
    margin: 1.6em 0;
    overflow-x: auto;
}
.okz-article .wp-block-table table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--okz-border);
    font-size: 0.95rem;
}
.okz-article .wp-block-table th,
.okz-article .wp-block-table td {
    padding: 10px 12px;
    border: 1px solid var(--okz-border);
    text-align: left;
    line-height: 1.6;
}
.okz-article .wp-block-table thead th {
    background: var(--okz-main-light);
    font-weight: 700;
    color: var(--okz-text);
}
.okz-article .wp-block-table tbody tr:nth-child(even) td {
    background: var(--okz-tint2);
}
.okz-article .wp-block-table tbody tr:hover td {
    background: var(--okz-main-light);
}

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

/* ============================================================
   一覧（トップ／アーカイブ）カードグリッド ― 本家のカード感に統一
   ============================================================ */
.okz-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 1200px;
    margin: 32px auto;
    padding: 0 20px;
}
.archive-hero + .okz-card-grid {
    margin-top: 16px;
}
/* 3列 → タブレット2列 → スマホ1列 */
@media (max-width: 960px) {
    .okz-card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .okz-card-grid { grid-template-columns: 1fr; }
}

.okz-card {
    display: flex;
    flex-direction: column;
    background: var(--okz-bg);
    border: 1px solid var(--okz-border);
    border-radius: var(--okz-radius-md);
    overflow: hidden;
    box-shadow: var(--okz-shadow-sm);
    color: var(--okz-text);
    transition: box-shadow 150ms ease-out, transform 150ms ease-out;
}
.okz-card:hover {
    box-shadow: var(--okz-shadow-md);
    transform: translateY(-4px);
}

/* サムネ＋カテゴリ帯（本家どおり、帯は半透明で画像に重なる） */
.okz-card__thumb {
    position: relative;
    margin: 0;
    height: 200px;
    background: var(--okz-bg-thumb);
    overflow: hidden;
    line-height: 0;
}
.okz-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.okz-card__nothumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--okz-muted);
    font-size: 0.85rem;
    background: var(--okz-bg-thumb);
}
.okz-card__cat {
    position: absolute;
    top: 16px;
    left: 0;
    padding: 10px 16px;
    background: rgba(15, 23, 42, 0.8); /* 本家と同じ半透明の紺 */
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1;
    min-width: 78px;
    text-align: center;
}

/* 本文側 */
.okz-card__body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1rem 1.1rem 1.2rem;
}
.okz-card__date {
    font-size: 0.8rem;
    color: var(--okz-muted);
}
.okz-card__title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0;
}
.okz-card__title a {
    color: var(--okz-text);
    text-decoration: none;
}
.okz-card:hover .okz-card__title a {
    color: var(--okz-main);
}

/* グレーの情報ボックス（本家どおり） */
.okz-card__box {
    padding: 0.75rem 0.8rem 0.8rem;
    background: var(--okz-tint2);
    border-radius: 0.75rem;
}
.okz-card__excerpt {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.7;
    margin: 0;
}

/* 「記事を読む」ボタン（本家どおり：角丸ゼロの赤・カード端まで全幅） */
.okz-card__btn {
    margin: 0.4rem -1.1rem -1.2rem;
    display: block;
    text-align: center;
    padding: 0.75rem 1rem;
    background: var(--okz-main);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}
.okz-card__btn:hover {
    opacity: 0.9;
}

/* ── アーカイブ見出し ── */
.archive-hero {
    text-align: center;
    padding: 32px 20px 0;
}
.archive-title {
    display: inline-block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--okz-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(--okz-main);
}
.archive-desc {
    color: var(--okz-muted);
    font-size: 0.9rem;
    margin-top: 14px;
}

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

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

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

    .okz-article {
        margin: 16px auto 40px;
        padding: 0 16px;
    }
    .okz-article .entry-title { font-size: 1.5rem; }
    .okz-article h2 { font-size: 1.3rem; margin: 2em 0 0.8em; }
    .okz-article h3 { font-size: 1.15rem; }
    .okz-article h4 { font-size: 1.05rem; }

    .okz-card-grid {
        gap: 18px;
        margin-top: 20px;
    }
    .archive-title { font-size: 1.5rem; }
}

/* ============================================================
   パンくず（.okz-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(--okz-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(--okz-main);
    text-decoration: none;
}
a.p-breadcrumb__text:hover {
    text-decoration: underline;
}
/* 現在ページ（リンクなし）＝グレー */
span.p-breadcrumb__text {
    color: var(--okz-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;
    }
}
