/* ==========================================================================
   AI素振り（www.kaasan.info）共通スタイル
   外部リソース依存なし（Webフォント・外部CSS・外部JSを読み込まない＝CWV最優先）
   モバイルファースト / ダークモード対応
   ========================================================================== */

/* ---- デザイントークン ---------------------------------------------------- */
:root {
  --brand:        #0d7d6c;
  --brand-dark:   #095c50;
  --brand-light:  #e4f2ef;
  --accent:       #e8590c;   /* CTA */
  --accent-dark:  #c2410c;
  --ink:          #16181d;   /* ヘッダー地 */
  --text:         #1f2328;
  --muted:        #59636e;
  --border:       #d8dee4;
  --soft-bg:      #f6f8fa;
  --bg:           #ffffff;
  --code-bg:      #f6f8fa;
  --code-text:    #1f2328;
  --note-bg:      #fff8ef;
  --note-border:  #f0b27a;
  --warn-bg:      #fff4f2;
  --warn-border:  #f3b4ab;
  --ng:           #c0392b;
  --ok:           #0d7d6c;
  --maxw:         820px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand:      #2bb39c;
    --brand-dark: #4fd1bb;
    --brand-light:#13302c;
    --accent:     #ff7a33;
    --accent-dark:#ff9557;
    --ink:        #0d0f13;
    --text:       #e4e7eb;
    --muted:      #9aa4af;
    --border:     #2d333b;
    --soft-bg:    #171b21;
    --bg:         #0f1217;
    --code-bg:    #161b22;
    --code-text:  #e4e7eb;
    --note-bg:    #231a12;
    --note-border:#6b4423;
    --warn-bg:    #2a1715;
    --warn-border:#6e3028;
    --ng:         #ff8a7a;
    --ok:         #4fd1bb;
  }
}

/* ---- ベース -------------------------------------------------------------- */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN",
    "Hiragino Sans", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.85;
  color: var(--text);
  background: var(--bg);
  word-break: normal;
  overflow-wrap: anywhere;
}

img { max-width: 100%; height: auto; }

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--brand-dark); }

code, kbd, samp, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", "Courier New", monospace;
}

/* ---- ヘッダー ------------------------------------------------------------ */
.site-header {
  background: var(--ink);
  border-bottom: 2px solid var(--brand);
}
.site-header .inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.site-logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: .02em;
}
.site-logo:hover { color: #fff; }
.site-catch {
  margin: 0;
  font-size: .78rem;
  color: #9aa4af;
}

/* ---- グローバルナビ ------------------------------------------------------ */
.global-nav {
  background: var(--soft-bg);
  border-bottom: 1px solid var(--border);
}
.global-nav ul {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 8px;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
}
.global-nav li { margin: 0; }
.global-nav a {
  display: block;
  padding: 10px 12px;
  font-size: .86rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.global-nav a:hover { color: var(--brand); background: var(--brand-light); }

/* ---- パンくず ------------------------------------------------------------ */
.breadcrumb {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px 16px 0;
}
.breadcrumb ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  font-size: .76rem;
  color: var(--muted);
}
.breadcrumb li { margin: 0; }
.breadcrumb li + li::before { content: "›"; margin: 0 6px; color: var(--border); }

/* ---- 本体 ---------------------------------------------------------------- */
.site-main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 8px 16px 48px;
}

.post-content h1 {
  font-size: 1.6rem;
  line-height: 1.45;
  margin: 20px 0 8px;
  letter-spacing: .01em;
}
.post-meta {
  margin: 0 0 28px;
  font-size: .76rem;
  color: var(--muted);
}
.post-content h2 {
  font-size: 1.25rem;
  line-height: 1.5;
  margin: 44px 0 14px;
  padding: 6px 0 6px 12px;
  border-left: 4px solid var(--brand);
}
.post-content h3 {
  font-size: 1.08rem;
  margin: 32px 0 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}
.post-content p { margin: 0 0 1.4em; }

/* リストは marker を明示的に残す（reset で消さない） */
.post-content ul,
.post-content ol {
  margin: 0 0 1.5em;
  padding-left: 1.6em;
}
.post-content ul { list-style-type: disc; }
.post-content ol { list-style-type: decimal; }
.post-content li { margin-bottom: .5em; }
.post-content li::marker { color: var(--brand); }

/* ---- コードブロック ------------------------------------------------------ */
.post-content pre {
  margin: 0 0 1.6em;
  padding: 14px 16px;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: 4px;
  font-size: .84rem;
  line-height: 1.7;
  overflow-x: auto;
}
.post-content pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  white-space: pre;
}
.post-content :not(pre) > code {
  padding: .12em .4em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: .88em;
}

/* ---- テーブル ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; margin: 0 0 1.6em; }
.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.post-content th,
.post-content td {
  padding: 9px 11px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.post-content th { background: var(--soft-bg); font-weight: 700; }

/* ---- 補足ボックス -------------------------------------------------------- */
.note {
  margin: 0 0 1.6em;
  padding: 14px 16px;
  background: var(--note-bg);
  border: 1px solid var(--note-border);
  border-radius: 4px;
  font-size: .92rem;
}
.note > :last-child { margin-bottom: 0; }

/* ---- 目次 ---------------------------------------------------------------- */
.toc {
  margin: 0 0 2em;
  padding: 14px 18px;
  background: var(--soft-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .9rem;
}
.toc > p { margin: 0 0 .6em; font-weight: 700; }
.toc ol { margin: 0; padding-left: 1.4em; list-style-type: decimal; }
.toc li { margin-bottom: .35em; }

/* ---- CTA ----------------------------------------------------------------- */
.cta__btn {
  display: block;
  max-width: 460px;
  margin: 28px auto;
  padding: 16px 20px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
  border-radius: 6px;
  box-shadow: 0 2px 0 var(--accent-dark);
}
.cta__btn:hover { background: var(--accent-dark); color: #fff; }

/* ---- カード一覧（トップ・ハブ用） --------------------------------------- */
.card-list {
  margin: 0 0 2em;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}
.card-list li { margin: 0; }
.card-list a {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  text-decoration: none;
  color: var(--text);
}
.card-list a:hover { border-color: var(--brand); background: var(--brand-light); }
.card-list .card-title { display: block; font-weight: 700; margin-bottom: 3px; }
.card-list .card-desc { display: block; font-size: .82rem; color: var(--muted); }

@media (min-width: 640px) {
  .card-list { grid-template-columns: 1fr 1fr; }
}

/* ---- セクション見出し（トップ） ----------------------------------------- */
.section-head {
  margin: 40px 0 14px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--brand);
  font-size: 1.2rem;
}
.lead {
  margin: 18px 0 28px;
  font-size: 1rem;
  color: var(--text);
}

/* ---- アーカイブ一覧 ------------------------------------------------------ */
.archive-list { margin: 0 0 2em; padding: 0; list-style: none; }
.archive-list li {
  margin: 0;
  padding: 11px 2px;
  border-bottom: 1px solid var(--border);
  font-size: .94rem;
}
.archive-list a { text-decoration: none; }
.archive-list a:hover { text-decoration: underline; }
.archive-list .archive-cat {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 7px;
  background: var(--soft-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: .72rem;
  color: var(--muted);
}

/* ---- フッター ------------------------------------------------------------ */
.site-footer {
  background: var(--ink);
  color: #c3cbd4;
  margin-top: 48px;
  padding: 28px 0 22px;
}
.site-footer .inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
}
.footer-nav {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: .82rem;
}
.footer-nav li { margin: 0; }
.footer-nav a { color: #c3cbd4; }
.footer-nav a:hover { color: #fff; }
.footer-disclaimer {
  margin: 0 0 14px;
  font-size: .74rem;
  line-height: 1.75;
  color: #8d97a1;
}
.copyright { margin: 0; font-size: .74rem; color: #8d97a1; }

/* ---- コードブロックの見出しラベル ------------------------------------- */
.post-content .code-head {
  margin: 0;
  padding: 7px 14px;
  background: var(--soft-bg);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .02em;
}
.post-content .code-head + pre {
  margin-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
.post-content .code-head--ng { color: var(--ng); border-left: 4px solid var(--ng); }
.post-content .code-head--ok { color: var(--ok); border-left: 4px solid var(--ok); }
.post-content .code-head--ng + pre { border-left-color: var(--ng); }
.post-content .code-head--ok + pre { border-left-color: var(--ok); }
.post-content .code-head--ng::before { content: "× "; }
.post-content .code-head--ok::before { content: "○ "; }

/* ---- 補足ボックスの種類 ------------------------------------------------ */
.post-content .note--warn {
  background: var(--warn-bg);
  border-color: var(--warn-border);
}
.post-content .note--warn > p:first-child::before {
  content: "ハマりどころ";
  display: block;
  margin-bottom: .4em;
  font-size: .76rem;
  font-weight: 700;
  color: var(--ng);
  letter-spacing: .04em;
}

/* ---- 手順リスト -------------------------------------------------------- */
.post-content ol.steps {
  margin: 0 0 1.8em;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.post-content ol.steps > li {
  position: relative;
  margin: 0 0 .9em;
  padding: 0 0 0 2.2em;
  counter-increment: step;
}
.post-content ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: .25em;
  width: 1.55em;
  height: 1.55em;
  background: var(--brand);
  color: #fff;
  border-radius: 50%;
  font-size: .8rem;
  font-weight: 700;
  line-height: 1.55em;
  text-align: center;
}
.post-content ol.steps > li > strong { display: block; }

/* ---- 用語の定義リスト -------------------------------------------------- */
.post-content dl.terms { margin: 0 0 1.8em; }
.post-content dl.terms dt {
  margin: 0 0 .25em;
  font-weight: 700;
  color: var(--brand-dark);
}
.post-content dl.terms dd {
  margin: 0 0 1.1em;
  padding-left: 1em;
  border-left: 2px solid var(--border);
}

@media (min-width: 680px) {
  body { font-size: 17px; }
  .post-content h1 { font-size: 1.95rem; }
  .post-content h2 { font-size: 1.4rem; }
}

/* ---------------------------------------------------------------
   カテゴリアーカイブ（アイキャッチ付きカード）
   .post-content を前置しているのは、.post-content ul / li に
   同等以上の詳細度で勝つため。末尾に置くこと（同詳細度は後勝ち）
   アイキャッチが用意できたら .card-thumb の中に
   <img src="..." alt="" width="640" height="360" loading="lazy"> を入れるだけ。
   img は absolute で敷き詰めるのでプレースホルダは自動的に隠れる
--------------------------------------------------------------- */
.post-content .card-list--thumb {
  margin: 0 0 2.2em;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 16px;
}
.post-content .card-list--thumb > li { margin: 0; }
.post-content .card-list--thumb > li::marker { content: none; }
.post-content .card-list--thumb a {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.post-content .card-list--thumb a:hover {
  border-color: var(--brand);
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
}

/* アイキャッチ枠（画像が入るまでのプレースホルダ） */
.post-content .card-thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--soft-bg);
  border-bottom: 1px solid var(--border);
  background-image: repeating-linear-gradient(
    135deg, transparent 0 11px, rgba(13,125,108,.05) 11px 22px);
}
.post-content .card-thumb::after {
  content: attr(data-label);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--muted);
  opacity: .65;
}
.post-content .card-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-content .card-body { display: block; padding: 14px 16px 16px; }
.post-content .card-list--thumb .card-title {
  display: block;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 6px;
}
.post-content .card-list--thumb a:hover .card-title { color: var(--brand-dark); }
.post-content .card-list--thumb .card-desc {
  display: block;
  font-size: .84rem;
  line-height: 1.7;
  color: var(--muted);
}
.post-content .card-list--thumb .card-meta {
  display: block;
  margin-top: 8px;
  font-size: .74rem;
  color: var(--muted);
}

/* 準備中（記事がまだ無い枠） */
.post-content .card-list--thumb > li.is-soon .card-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
  opacity: .62;
}
.post-content .card-list--thumb > li.is-soon .card-title { color: var(--muted); }

@media (min-width: 640px) {
  .post-content .card-list--thumb { grid-template-columns: 1fr 1fr; }
}

/* 外部フォーム（Googleフォーム等）の埋め込み枠 */
.post-content .form-embed {
  margin: 0 0 1.8em;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
}
.post-content .form-embed iframe {
  display: block;
  width: 100%;
  border: 0;
}
