/* お役立ち情報（一覧 /posts・カテゴリ /posts-cat/<slug>・記事 /posts/<slug>。テンプレートは src/templates/collections.mjs）専用。
   相談CTA（.t-contact）と色・書体の変数（.t-page）は top.css を共用し、ここではお役立ち情報だけの値を指定する。
   値は現行 STUDIO 版を 1440/1280/1024/768/390/375px で測って合わせた。ブレークポイントは現行と同じ 840 / 540px。
   現行から意図して変えた点には「現行は…」とコメントを付けている。 */

/* ---------- 見出し（INFORMATION／お役立ち情報、CATEGORY／カテゴリ名、RELATED POST／関連記事） ---------- */
.p-head{margin-bottom:60px;display:flex;flex-direction:column;align-items:center;text-align:center}
/* 見出しラベルと見出しは、利用者の声（Voice）・料金（Price）と同じ見た目（top.css の .t-label・.t-h2 と同じ値） */
.t-main .p-head__label{margin-bottom:5px;color:var(--g-bright);font-size:16px;font-weight:800;line-height:1.4}
.t-main .p-head__title{margin-bottom:20px;color:var(--ink);font-size:40px;font-weight:700;line-height:1.35;font-feature-settings:'palt' 1}

/* ---------- 一覧（/posts・/posts-cat/<slug>） ---------- */
/* 上余白は、見出しラベルの位置が利用者の声・料金と同じ高さになる 60px（現行はヘッダー（70px）の裏から 180px） */
.p-index{width:1280px;max-width:100%;margin:0 auto;padding:60px 30px 60px}
.p-empty{padding:40px 0 100px;text-align:center}

/* カテゴリの切り替え（現行の一覧には無い。カードの札と同じ緑・角丸で作った） */
.p-cats{margin:-30px 0 50px;display:flex;flex-wrap:wrap;justify-content:center;gap:10px}
.p-cats a{position:relative;padding:7px 20px 6px;border:1px solid var(--deep);border-radius:48px;background:#fff;color:var(--deep);font-size:15px;font-weight:600;line-height:1.4;transition:background-color .3s,color .3s}
/* 押せる範囲だけ上下に広げて高さ44px以上にする（見た目は変えない） */
.p-cats a::after{content:'';position:absolute;left:0;right:0;top:50%;height:max(44px,100%);transform:translateY(-50%)}
.p-cats a:hover{background:var(--mint)}
.p-cats a[aria-current=page]{background:var(--deep);color:#fff}

/* 記事カード: 現行は幅 31% のカードを両端揃えで並べる（3列）。最後の行が2枚でも左から詰めて並ぶよう grid で同じ位置にする */
.p-grid{display:grid;grid-template-columns:repeat(3,31%);justify-content:space-between}
.p-grid>.more-item{min-width:0;margin-bottom:60px}
.p-card{display:flex;flex-direction:column;background:#fff;color:#333}
/* サムネイル: 枠の縦横比を記事の画像（多くは 1200×1006）に合わせ、画像は切らずに全体を出す（題名などの文字が入った画像の端が切れないように）。
   比率の違う画像（横長の 1731×909 など）は、上下か左右に背景色の余白が付く。現行は高さ固定（320px）で画像の左右や上下が切れていた */
.p-card__img{position:relative;aspect-ratio:1200/1006;overflow:hidden;background:var(--mint);container-type:inline-size}
.t-main .p-card__img img{position:absolute;left:0;top:0;width:100%;height:100%;max-width:none;object-fit:contain}
/* カテゴリの札。現行は文字の高さを 12px に固定しているため、札に収まらない幅（1024px 前後・375px など）で文字が2行になって札からはみ出す。
   カードが狭いときは一番長いカテゴリ名（17文字）が1行に収まるまで文字を小さくし、それでも収まらなければ札ごと2行に伸ばす */
.p-card__chip{position:relative;display:block;width:fit-content;max-width:calc(100% - 20px);margin:20px 0 0 20px;padding:3px 15px 0;border-radius:48px;background:#fff;color:var(--deep);font-size:16px;font-size:min(16px,calc((100cqi - 52px) / 17));font-weight:600;line-height:22px}
.p-card__body{display:flex;flex-direction:column;align-items:flex-start}
/* 日付: 現行は読み込んでいない Lato 指定（端末の既定書体で表示される）。ほかの文字と同じ書体にする */
.p-card__date{margin:20px 0 10px;color:var(--deep);font-size:14px;font-weight:700;line-height:1}
.t-main .p-card__title{margin-bottom:10px;color:#333;font-size:22px;font-weight:900;line-height:1.4}

/* もっと見る（現行どおり6件ずつ表示。ホバーの変化は現行どおり無し） */
.p-index .more-wrap{margin-top:0}
.p-more{width:30%;padding:15px 30px 17px;border:0;border-radius:48px;background:var(--deep);color:#fff;font-size:20px;font-weight:400;line-height:1;cursor:pointer}

/* ---------- 記事（/posts/<slug>） ---------- */
/* 現行はヘッダー（70px）の裏から上余白 140px。ここのヘッダーは場所を取るので、その分を引いている。
   現行は記事ページ全体の左右に 3px の余白があり、本文の幅が「画面幅−46px」になる（スマホの改行位置を合わせるため同じ幅にする）。
   PC の本文の幅は 720px（現行は 960px で1行が約60字と長く読みにくい） */
.p-article__main{display:block;width:min(760px,100% - 6px);margin:0 auto;padding:70px 20px 0}
.p-article__meta{padding:40px 0 70px;display:flex;flex-wrap:wrap;align-items:center;gap:8px 30px}
.p-article__date{color:#333;font-size:20px;font-weight:400;line-height:1.7}
/* カテゴリ（現行は日付の右に何も入っていない札の枠がある。そこにカテゴリ一覧へのリンクとして出す） */
.p-article__cat{padding:4px 18px 3px;border-radius:24px;background:var(--deep);color:#fff;font-size:14px;font-weight:600;line-height:1.4;transition:opacity .3s}
.p-article__cat:hover{opacity:.7}
.t-main .p-article__title{margin-bottom:30px;color:#333;font-size:32px;font-weight:900;line-height:1.5}

/* 目次（現行の記事には無い。## 見出しが3つ以上の記事だけ本文の前に出す）。
   見た目は STUDIO のリッチテキストに用意されている目次ブロックと同じ（灰色の箱・下線付きのリンク）。先頭に「目次」の見出しを足した */
.p-toc{margin-bottom:30px;padding:24px 24px 8px;border-radius:2px;background:#f5f5f5;color:#616161;font-size:16px;line-height:1.4}
.t-main .p-toc__title{margin-bottom:16px;font-weight:700}
.p-toc li{margin-bottom:16px}
.p-toc a{color:inherit;text-decoration:underline;transition:opacity .3s}
.p-toc a:hover{opacity:.7}

/* 本文（Markdown）。現行の STUDIO リッチテキストと同じ値 */
.p-body{display:flow-root;color:#333;font-size:16px;font-weight:400;line-height:1.4}
.t-main .p-body>p{margin:20px 0;line-height:1.7}
.p-body strong{font-weight:900}
.p-body em{color:#e70000;font-style:normal}
.p-body a{color:#007cff;text-decoration:underline}
.t-main .p-body>h2{margin:40px 0 10px;padding:8px 0 6px;border-top:1px solid #000;border-bottom:1px solid #000;font-size:20px;font-weight:700;line-height:1.4}
.t-main .p-body>h3{margin:40px 0 10px;padding:5px 10px;border-radius:4px;background:#f0f8f3;font-size:18px;font-weight:700;line-height:1.4}
.t-main .p-body>h4{margin:10px 0;font-size:16px;font-weight:600;line-height:1.4;letter-spacing:normal;text-wrap:wrap;font-feature-settings:normal}
.t-main .p-body :is(ul,ol){margin:0 0 0 20px;padding:0}
.t-main .p-body ul{list-style:disc}
.t-main .p-body ol{list-style:decimal}
.t-main .p-body li{margin:10px 0;line-height:1.4}
.t-main .p-body li>p{margin:0}
/* 引用: 現行は斜体（和文は機械的に傾けた字になり読みにくい）。斜体にはしない */
.p-body>blockquote{margin:16px 0;padding:10px 15px;border-left:3px solid rgba(0,0,0,.15);background:#f4f4f4;line-height:1.6}
.t-main .p-body blockquote>p{margin:10px 0}
.p-body>hr{height:1px;margin:10px 0;border:0;border-top:1px solid #ccc}
.t-main .p-body img{display:inline;max-width:100%;height:auto;vertical-align:bottom}
/* 本文の先頭が画像だけの段落（バナー）のときは、現行の画像ブロック（上下の余白なし）と同じく上に詰める */
.t-main .p-body>p:first-child:is(:has(>img:only-child),:has(>a:only-child>img:only-child)){margin-top:0}
/* 表: 現行と同じく内容の幅（セルは幅 100〜240px）。セル内は文字の途中でも折り返す。本文幅を超える表は箱の中で横にスクロールする */
.p-body table{width:auto;margin:10px 0;border:1px solid #f2f2f2;border-collapse:collapse;background:none;color:#1a1a1a;font-family:sans-serif;font-size:14px;line-height:1.4}
.p-body :is(th,td){min-width:100px;max-width:240px;padding:12px;border:1px solid #f2f2f2;font-weight:400;text-align:left;vertical-align:middle}
.p-body th{background:rgba(245,245,245,.5)}
.p-body .embed{margin:20px 0;aspect-ratio:16/9}
.p-body .embed iframe{display:block;width:100%;height:100%;border:0}

/* 関連記事（相談CTA は現行の左右 3px の白い縁を付けず、画面幅いっぱいにする） */
.p-related{width:min(1280px,100% - 6px);margin:0 auto;padding:60px 30px}

@media (max-width:840px){
  .p-index{padding:50px 30px 60px}
  .t-main .p-head__title{font-size:24px}
  .p-index .more-list,.p-related .p-grid{margin-bottom:100px}
  .p-grid{grid-template-columns:repeat(2,48%)}
  .p-grid>.more-item{margin-bottom:50px}
  .p-card__date{font-size:16px}
  .t-main .p-card__title{font-size:20px}
  .t-main .p-article__title{font-size:36px}
}
@media (max-width:540px){
  /* 上余白は利用者の声・料金と同じ 50px（現行はヘッダーが 60px になっても上余白が 100px のまま） */
  .p-index{padding-top:50px}
  .p-head{margin-bottom:60px}
  .t-main .p-head__title{margin-bottom:10px}
  /* カテゴリは折り返すと4行になるので、横にスクロールできる1行にする（右端を薄くして続きがあることを示す） */
  /* 上下の 6px は、横スクロールの枠の中でボタンの押せる範囲（高さ44px）が切れないための余白（表示位置は同じ） */
  .p-cats{margin:-36px -30px 34px;padding:6px 30px;flex-wrap:nowrap;justify-content:flex-start;gap:8px;overflow-x:auto;scrollbar-width:none;-webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 30px),transparent);mask-image:linear-gradient(90deg,#000 calc(100% - 30px),transparent)}
  .p-cats::-webkit-scrollbar{display:none}
  .p-cats a{flex:none;padding:6px 16px 5px;font-size:14px}
  .p-grid{grid-template-columns:100%}
  .p-grid>.more-item{margin-bottom:30px}
  .t-main .p-card__title{font-size:18px}
  /* 現行は幅 30%（390px 幅で 99px）のため「もっと見る」が縦書きのように1文字ずつ折り返す。文字が1行に収まる幅にする */
  .p-more{width:240px}
  .p-article__main{padding-top:60px}
  .p-toc{padding:20px 20px 8px}
  .p-toc li{margin-bottom:12px}
  /* 現行はスマホでも 36px（PC の 32px より大きい）で、34字のタイトルが4行・画面の半分を占める。スマホでは 26px にする */
  .t-main .p-article__title{font-size:26px}
}
@media (prefers-reduced-motion:reduce){
  .p-cats a,.p-article__cat,.p-toc a{transition:none}
}
