/* 公開サイトのデザイン（エディタの「公開サイトのデザイン」で設定。直接書き換えても次の公開で上書きされます） */
:root {
    --accent: #1e6fd9;
    --text: #1c2024;
    --bg: #ffffff;
    --header-bg: #1c1f24;
    --header-text: #ffffff;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
    --font-size: 16px;
    --content-width: 820px;
    --radius: 8px;
    --heading-bg: #1c1f24;
    --heading-text: #ffffff;
    --notice-bg: #ff6b35;
    --notice-text: #ffffff;
}
@media (prefers-color-scheme: dark) {
    :root {
        --accent: #58a6ff;
        --text: #e6edf3;
        --bg: #0d1117;
        --header-bg: #161b22;
        --header-text: #e6edf3;
        --heading-bg: #2d333b;
        --heading-text: #e6edf3;
        color-scheme: dark;
    }
    .post-body img { background: #fff; }
}
:root {
    /* 色の濃淡は文字・背景・アクセントの色から作る */
    --muted: color-mix(in srgb, var(--text) 62%, var(--bg));
    --line: color-mix(in srgb, var(--text) 14%, var(--bg));
    --bg-soft: color-mix(in srgb, var(--text) 4%, var(--bg));
    --tag-bg: color-mix(in srgb, var(--accent) 14%, var(--bg));
    --code-bg: color-mix(in srgb, var(--text) 6%, var(--bg));
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: var(--font);
    font-size: var(--font-size);
    line-height: 1.8;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
    border-bottom: 1px solid var(--line);
    background: var(--header-bg);
    padding-top: env(safe-area-inset-top);
}

.site-header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 24px;
    max-width: calc(var(--content-width) + 300px);
    margin: 0 auto;
    padding: 14px max(20px, env(safe-area-inset-right)) 14px max(20px, env(safe-area-inset-left));
}

.site-title { display: inline-flex; align-items: center; gap: 10px; color: var(--header-text); font-size: 20px; font-weight: 700; }
.site-title:hover { text-decoration: none; }
.site-logo { height: 32px; width: auto; display: block; }

.site-nav ul { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; padding: 0; list-style: none; }
.site-nav a { color: var(--header-text); font-size: 14px; opacity: 0.85; }
.site-nav a:hover { opacity: 1; }

/* ヘッダー: サイト名を中央、その下にリンクを横一列 */
.site-header.centered { border-bottom: 0; }
.site-header.centered .site-header-inner { flex-direction: column; justify-content: center; gap: 10px; padding-bottom: 12px; }
.site-header.centered .site-title { font-size: 24px; }
.site-header.centered .site-nav ul { justify-content: center; gap: 4px 22px; }
.site-header.centered .site-nav a { font-size: 13px; font-weight: 700; opacity: 0.92; }

/* お知らせの帯（ヘッダーの下） */
.site-notice {
    color: var(--notice-text);
    background: linear-gradient(90deg, var(--notice-bg), color-mix(in srgb, var(--notice-bg) 72%, #ffffff));
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}
.site-notice a, .site-notice p { display: block; margin: 0; padding: 10px 20px; color: var(--notice-text); }
.site-notice a:hover { text-decoration: none; opacity: 0.9; }
.notice-arrow {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    margin-left: 8px;
    color: var(--notice-bg);
    background: var(--notice-text);
    border-radius: 50%;
    font-size: 14px;
    line-height: 1;
    vertical-align: -2px;
}

/* パンくず */
.breadcrumbs ol { display: flex; flex-wrap: wrap; margin: 0 0 12px; padding: 0; list-style: none; color: var(--muted); font-size: 13px; }
.breadcrumbs li + li::before { content: "›"; margin: 0 8px; }
.breadcrumbs a { color: var(--muted); }

.list, .layout {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 32px max(20px, env(safe-area-inset-right)) 48px max(20px, env(safe-area-inset-left));
}

.site-description { color: var(--muted); margin: 0 0 20px; }
.list-title { font-size: 24px; margin: 0 0 24px; }
.empty { color: var(--muted); }

.list-heading { display: flex; align-items: center; gap: 8px; margin: 24px 0 4px; font-size: 1.1em; }
.list-heading::before { content: ""; width: 4px; height: 1.1em; background: var(--accent); border-radius: 2px; }

/* 記事の写真（記事の最初の画像） */
.card-thumb, .thumb { display: block; }
.thumb { aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-soft); border-radius: var(--radius); }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.card-thumb:hover img, .related a:hover .thumb img { transform: scale(1.04); }
.thumb-placeholder { display: grid; place-items: center; color: var(--muted); font-size: 13px; border: 1px dashed var(--line); }

/* 記事一覧: リスト */
.card { padding: 22px 0; border-bottom: 1px solid var(--line); }
.card h2 { margin: 0 0 4px; font-size: 1.3em; line-height: 1.5; }
.card h2 a { color: var(--text); }
.card .summary { margin: 8px 0 0; color: var(--muted); }
.post-list:not(.cards) .card.has-thumb { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }

/* 記事一覧: カード（写真が上、その下にタイトル） */
.post-list.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-top: 12px; }
.post-list.cards .card {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    transition: box-shadow 0.2s;
}
.post-list.cards .card:hover { box-shadow: 0 6px 18px color-mix(in srgb, var(--text) 14%, transparent); }
.post-list.cards .card .thumb { border-radius: 0; }
.post-list.cards .card-body { padding: 14px 16px 16px; }
.post-list.cards .card h2 { font-size: 1.05em; }
.post-list.cards .card .summary { font-size: 14px; }

.post-meta { margin: 0; color: var(--muted); font-size: 13px; }
.post-meta .separator { margin: 0 6px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.tags a {
    display: inline-block;
    padding: 2px 10px;
    font-size: 13px;
    line-height: 1.7;
    background: var(--tag-bg);
    border-radius: calc(var(--radius) + 4px);
}
.tags .count { color: var(--muted); font-size: 12px; }
.tag-cloud { margin-bottom: 8px; }

/* 右側（運営者情報・目次）。狭い画面では記事・一覧の下に並ぶ */
.layout.has-side, .list.has-side {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    row-gap: 40px;
    max-width: calc(var(--content-width) + 330px);
}
.side { display: flex; flex-direction: column; gap: 24px; }
.side-title {
    margin: 0;
    padding: 8px 12px;
    color: var(--heading-text);
    background: var(--heading-bg);
    font-size: 14px;
    text-align: center;
}
.profile { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); }
.profile-body { padding: 16px 18px 18px; text-align: center; }
.profile-image { display: block; width: 104px; height: 104px; margin: 0 auto 10px; object-fit: cover; border-radius: 50%; border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--line); }
.profile-name { margin: 0 0 8px; font-weight: 700; }
.profile-text { margin: 0; font-size: 14px; line-height: 1.75; text-align: left; }

/* 記事 */

.post-header { margin-bottom: 28px; }
.post-header h1 { margin: 0 0 8px; font-size: 1.9em; line-height: 1.4; }

.post-body { overflow-wrap: anywhere; }
.post-body h1, .post-body h2, .post-body h3, .post-body h4 { line-height: 1.4; margin: 1.8em 0 0.6em; scroll-margin-top: 16px; }
.post-body h1 { font-size: 1.6em; }
.post-body h2 { font-size: 1.38em; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.post-body h3 { font-size: 1.19em; }
.post-body h4 { font-size: 1.06em; }

/* 見出し: 大見出しは色の帯に白い文字、小見出しは薄い色の箱 */
.post-body.headings-band h2 {
    padding: 14px 18px;
    color: var(--heading-text);
    background: var(--heading-bg);
    border: 0;
    border-radius: calc(var(--radius) / 2);
    font-size: 1.28em;
}
.post-body.headings-band h3 {
    padding: 10px 14px;
    background: color-mix(in srgb, var(--heading-bg) 8%, var(--bg));
    border-left: 4px solid var(--heading-bg);
    border-radius: calc(var(--radius) / 2);
}
.post-body.headings-band h4 { padding-left: 10px; border-left: 3px solid var(--accent); }
.post-body p, .post-body ul, .post-body ol, .post-body blockquote, .post-body pre, .post-body table { margin: 0 0 1.1em; }
.post-body img { max-width: 100%; height: auto; border-radius: calc(var(--radius) / 2); }
.post-body p > img:only-child { display: block; margin: 0 auto; }
.post-body blockquote { margin-left: 0; padding: 2px 16px; color: var(--muted); border-left: 4px solid var(--line); }
.post-body mark { background-color: #fff2a8; color: inherit; }
.post-body code { padding: 2px 5px; font-size: 0.9em; background: var(--code-bg); border-radius: 4px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.post-body pre { padding: 14px 16px; overflow-x: auto; background: var(--code-bg); border-radius: var(--radius); line-height: 1.5; }
.post-body pre code { padding: 0; background: none; }
.post-body table { display: block; width: max-content; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.post-body th, .post-body td { padding: 6px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.post-body hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.post-body li > input[type=checkbox] { margin-right: 6px; }
.post-body ul.contains-task-list { padding-left: 1.2em; list-style: none; }

/* 目次 */
.toc ul, .toc-inline ul { margin: 0; padding: 0; list-style: none; }
.toc-title { margin: 0 0 6px; font-weight: 700; font-size: 14px; }
.toc a, .toc-inline a { display: block; padding: 3px 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.toc a:hover, .toc-inline a:hover { color: var(--accent); }
.toc-level-2 a { padding-left: 14px; }
.toc-level-3 a { padding-left: 28px; }
.toc-inline, .post-toc-inline { margin: 0 0 1.4em; padding: 14px 18px; background: var(--bg-soft); border-radius: var(--radius); }
.post-toc { display: none; }

@media (min-width: 1000px) {
    .post-toc-inline { display: none; }
    .layout.has-side, .list.has-side { grid-template-columns: minmax(0, 1fr) 280px; column-gap: 48px; }
    /* 右側の目次: 運営者情報と同じ形の箱。画面の上に付いてくる */
    .post-toc {
        display: block;
        position: sticky;
        top: 24px;
        max-height: calc(100vh - 48px);
        overflow-y: auto;
        border: 1px solid var(--line);
        border-radius: var(--radius);
    }
    .post-toc .toc-title {
        position: sticky;
        top: 0;
        margin: 0;
        padding: 8px 12px;
        color: var(--heading-text);
        background: var(--heading-bg);
        text-align: center;
    }
    .post-toc .toc ul { padding: 8px 12px 10px; }
}

/* 商品カード（Amazon・楽天・Yahoo! ショッピング） */
.product-card {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 20px;
    align-items: center;
    margin: 1.6em 0;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    box-shadow: 0 2px 10px color-mix(in srgb, var(--text) 7%, transparent);
}
.product-image { display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; background: #ffffff; border-radius: calc(var(--radius) / 2); }
.product-image img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.product-image-placeholder { color: #8c959f; font-size: 13px; border: 1px dashed var(--line); }
.product-body { min-width: 0; }
.post-body .product-body p { margin: 0; }
.product-title { font-weight: 700; line-height: 1.6; }
.product-title a { color: var(--text); }
.post-body .product-body .product-note { margin-top: 6px; color: var(--muted); font-size: 14px; }
.post-body .product-body .product-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.product-button {
    flex: 1 1 150px;
    padding: 9px 14px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    border-radius: 6px;
    transition: opacity 0.2s, transform 0.2s;
}
.product-button:hover { color: #ffffff; text-decoration: none; opacity: 0.88; transform: translateY(-1px); }
.product-button.amazon { background: #ff9900; }
.product-button.rakuten { background: #bf0000; }
.product-button.yahoo { background: #ff0033; }

/* 広告を含む記事の表示（PR・アソシエイト） */
.pr-notice { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.pr-label { padding: 0 8px; color: var(--bg); background: var(--muted); border-radius: 4px; font-size: 12px; font-weight: 700; line-height: 1.7; }
.affiliate-disclosure { margin-bottom: 8px !important; }

/* 広告（記事の下） */
.ad-after-post { margin-top: 40px; min-height: 90px; }
.ad-placeholder {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 13px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
}

/* 関連記事 */
.related { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); }
.related h2 { margin: 0 0 12px; font-size: 1.1em; }
.related ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.related a {
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
    padding: 12px 14px;
    color: var(--text);
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.related a:hover { border-color: var(--accent); text-decoration: none; }
.related .thumb { margin: -12px -14px 6px; border-radius: 0; }
.related a { overflow: hidden; }
.related-title { font-weight: 700; line-height: 1.5; }
.related-meta { color: var(--muted); font-size: 12px; }

@media (max-width: 600px) {
    .post-header h1 { font-size: 1.5em; }
    .card h2 { font-size: 1.2em; }
    .list, .layout { padding-top: 22px; }
    .site-nav ul { gap: 4px 14px; }
    /* 中央の並びのリンクは、狭い画面では 1 行にして横に送る（行が増えて本文が下がりすぎないように） */
    .site-header.centered .site-nav { width: 100%; }
    .site-header.centered .site-nav ul { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
    .site-header.centered .site-nav li { flex: none; }
    .post-list:not(.cards) .card.has-thumb { grid-template-columns: 112px minmax(0, 1fr); gap: 14px; }
    .post-list:not(.cards) .card.has-thumb h2 { font-size: 1.05em; }
    .post-list:not(.cards) .card.has-thumb .summary { display: none; }
    .product-card { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 14px; align-items: start; }
    .product-button { flex-basis: 100%; }
}

.site-footer {
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    border-top: 1px solid var(--line);
}
.site-footer p { margin: 0; }
.site-footer .footer-text { margin-bottom: 8px; }