/* 公式サイト（トップ・6地域ページ）から「お墓のコラム（/column/）」へつなぐ部品
 * tools/apply_column_guide.py が各ページの「よくある質問」の直後に差し込む。
 * どのページの書き方とも混ざらないよう、class はすべて cg- で始める。
 * ページの色は style="--cg-c:…;--cg-deep:…;--cg-soft:…;--cg-btn:…;--cg-bg:…" で渡す（墓地・霊園案内と同じ色）。 */

.cg { --cg-c: #c5a059; --cg-deep: #2b4b65; --cg-soft: #fbf6ec; --cg-btn: #2b4b65; --cg-bg: transparent;
  position: relative; box-sizing: border-box; width: 100%; padding: 8px 0 64px; background: var(--cg-bg); scroll-margin-top: 84px;
  color: #2b3a4a; text-align: left; line-height: 1.7; font-size: 15px; }
.cg *, .cg *::before, .cg *::after { box-sizing: border-box; }
.cg p, .cg h2, .cg h3, .cg ul { margin: 0; }
.cg__in { max-width: 1140px; margin: 0 auto; padding: 0 20px; }

/* 外枠：左に説明、右に記事カード。カードは枠の右端まで流れて「続きがある」ことを見せる */
.cg__box { position: relative; overflow: hidden; display: grid; grid-template-columns: 310px minmax(0, 1fr);
  grid-template-areas: "head rail" "foot rail"; align-items: start; gap: 0 36px; padding: 36px 0 30px 36px; border-radius: 28px;
  background: linear-gradient(180deg, #fff 0%, var(--cg-soft) 100%);
  border: 1px solid color-mix(in srgb, var(--cg-c) 26%, #fff);
  box-shadow: 0 18px 40px -28px color-mix(in srgb, var(--cg-deep) 70%, transparent); }
.cg__box::before { content: ""; position: absolute; left: -46px; bottom: -46px; width: 150px; height: 150px; border-radius: 50%;
  background: color-mix(in srgb, var(--cg-c) 11%, transparent); pointer-events: none; }
.cg__box > * { position: relative; }

.cg__head { grid-area: head; }
.cg__eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 8px !important;
  font-size: 11px; font-weight: 700; letter-spacing: .24em; color: var(--cg-deep); }
.cg__eyebrow::before { content: ""; width: 18px; height: 1.5px; background: currentColor; opacity: .6; }
.cg__eyebrow small { font-size: 11px; letter-spacing: .12em; font-weight: 700; opacity: .8; }
.cg__title { font-family: "Shippori Mincho", "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif; font-weight: 700;
  font-size: clamp(21px, 2.3vw, 27px); line-height: 1.55; letter-spacing: .05em; color: var(--cg-deep); }
.cg__nw { display: inline-block; }
.cg__lead { margin-top: 10px !important; font-size: 14px; line-height: 1.9; color: #4a5866; word-break: auto-phrase; text-wrap: pretty; }
.cg__count { display: flex; align-items: baseline; gap: 6px; margin-top: 14px !important; font-size: 12.5px; font-weight: 700; color: #4a5866; }
.cg__count b { font-family: "Shippori Mincho", "Yu Mincho", "Noto Serif JP", serif; font-size: 34px; line-height: 1; letter-spacing: .02em; color: var(--cg-deep); }

.cg__foot { grid-area: foot; margin-top: 16px; }
.cg__needs-label { font-size: 12px; font-weight: 700; color: #6b7785; letter-spacing: .08em; }
.cg__needs { list-style: none; padding: 0; margin-top: 8px !important; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cg__needs li { margin: 0; padding: 0; }
.cg__needs li::before, .cg__needs li::marker { content: none; }
.cg__need { display: flex; align-items: center; gap: 7px; min-height: 40px; height: 100%; padding: 7px 10px; border-radius: 12px; background: #fff;
  border: 1px solid color-mix(in srgb, var(--cg-c) 30%, #fff); color: #2b3a4a !important; text-decoration: none !important;
  font-size: 12.5px; font-weight: 700; line-height: 1.4; white-space: nowrap; transition: background-color .2s ease, border-color .2s ease; }
.cg__need::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--cg-c); }
.cg__need:hover { background: color-mix(in srgb, var(--cg-c) 10%, #fff); border-color: color-mix(in srgb, var(--cg-c) 55%, #fff); }
/* 明朝の文字は上に寄って見えるので、上の余白を少し多くして見た目の中央にそろえる */
.cg__btn { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; margin-top: 16px; min-height: 54px; padding: 12px 18px 10px;
  border-radius: 999px; background: var(--cg-btn); color: #fff !important; text-decoration: none !important;
  font-size: 15px; font-weight: 700; letter-spacing: .06em; line-height: 1.4;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--cg-btn) 70%, #000); transition: transform .2s ease, box-shadow .2s ease; }
.cg__btn:hover { transform: translateY(2px); box-shadow: 0 2px 0 color-mix(in srgb, var(--cg-btn) 70%, #000); }
.cg__btn .cg__arrow { width: 26px; height: 26px; background-color: #fff; }
.cg__btn .cg__arrow::before { background: var(--cg-btn); }

/* 矢印つきの丸（コラム一覧の「記事を読む」と同じ形） */
.cg__arrow { position: relative; flex: none; display: inline-block; width: 28px; height: 28px; border-radius: 50%; background-color: var(--cg-btn); margin-top: -2px; }
.cg__arrow::before { content: ""; position: absolute; inset: 0; background: #fff;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12h11M12 7l5 5-5 5'/%3E%3C/svg%3E") center / 14px no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12h11M12 7l5 5-5 5'/%3E%3C/svg%3E") center / 14px no-repeat; }

/* 記事カード（横にすべらせて見る） */
.cg__rail { grid-area: rail; align-self: center; min-width: 0; }
.cg__list { list-style: none; display: flex; gap: 16px; margin: 0 !important; padding: 4px 36px 16px 4px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-left: 4px; overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.cg__list::-webkit-scrollbar { display: none; }
.cg__card { flex: 0 0 208px; margin: 0; padding: 0; scroll-snap-align: start; }
.cg__card::before, .cg__card::marker { content: none; }
.cg__link { display: flex; flex-direction: column; height: 100%; overflow: hidden; border-radius: 18px; background: #fff;
  border: 1px solid rgba(30, 50, 70, .07); box-shadow: 0 8px 20px -14px rgba(30, 45, 65, .55);
  color: inherit !important; text-decoration: none !important; transition: transform .25s ease, box-shadow .25s ease; }
.cg__link:hover { transform: translateY(-3px); box-shadow: 0 14px 26px -14px rgba(30, 45, 65, .6); }
.cg__link:focus-visible, .cg__need:focus-visible, .cg__btn:focus-visible, .cg__nav button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--cg-c) 60%, #fff); outline-offset: 3px; }
.cg__photo { position: relative; display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--cg-soft); }
.cg__photo img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.cg__link:hover .cg__photo img { transform: scale(1.05); }
.cg__tag { position: absolute; left: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px; max-width: calc(100% - 20px);
  padding: 4px 10px 3px; border-radius: 999px; background: rgba(255, 255, 255, .93); font-size: 11px; font-weight: 700; line-height: 1.5;
  color: #2b3a4a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cg__tag::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--cg-tag, var(--cg-c)); }
.cg__body { display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 12px 14px 14px; }
.cg__name { font-size: 14.5px; font-weight: 700; line-height: 1.6; color: #2b3a4a; word-break: auto-phrase; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.cg__more { display: flex; align-items: center; justify-content: space-between; margin-top: auto; font-size: 12px; font-weight: 700; color: var(--cg-deep); }
.cg__more .cg__arrow { width: 26px; height: 26px; }

.cg__nav { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-right: 36px; }
.cg__hint { display: none; font-size: 12px; color: #6b7785; }
.cg__nav button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%; cursor: pointer;
  background: #fff; border: 1px solid color-mix(in srgb, var(--cg-c) 40%, #fff); color: var(--cg-deep);
  box-shadow: 0 6px 14px -10px rgba(30, 45, 65, .6); transition: background-color .2s ease, opacity .2s ease; }
.cg__nav button:hover { background: color-mix(in srgb, var(--cg-c) 12%, #fff); }
.cg__nav button:disabled { opacity: .35; cursor: default; background: #fff; }
.cg__nav svg { width: 18px; height: 18px; }

@media (max-width: 1023px) {
  .cg__box { grid-template-columns: 290px minmax(0, 1fr); gap: 0 26px; padding: 30px 0 26px 28px; }
  .cg__card { flex-basis: 196px; }
}
/* スマホ：説明 → 記事カード（指で横にすべらせる）→ 悩みとボタン の順に縦に並べる */
@media (max-width: 767px) {
  .cg { padding: 4px 0 44px; font-size: 14px; }
  .cg__in { padding: 0 16px; }
  .cg__box { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "rail" "foot"; padding: 26px 0 22px; border-radius: 24px; }
  .cg__box::before { width: 110px; height: 110px; left: -40px; bottom: -40px; }
  .cg__head, .cg__foot { padding: 0 20px; }
  .cg__title { font-size: 22px; }
  .cg__count { margin-top: 10px !important; }
  .cg__count b { font-size: 30px; }
  .cg__rail { margin-top: 16px; }
  .cg__list { gap: 12px; padding: 4px 20px 14px; scroll-padding-left: 20px; }
  .cg__card { flex-basis: 64%; max-width: 250px; }
  .cg__name { font-size: 14px; }
  .cg__nav { justify-content: center; padding: 0 20px; }
  .cg__nav button { display: none; }
  .cg__hint { display: inline-flex; align-items: center; gap: 6px; }
  .cg__hint::before { content: "\2194"; font-size: 14px; color: var(--cg-deep); }
  .cg__foot { margin-top: 18px; }
}
/* 幅の狭いスマホ（320〜374px）：悩みのボタンは2行まで折り返してよい */
@media (max-width: 374px) {
  .cg__need { gap: 6px; padding: 7px 8px; font-size: 12px; white-space: normal; }
}
@media (prefers-reduced-motion: reduce) {
  .cg__link, .cg__photo img, .cg__btn, .cg__need { transition: none; }
  .cg__link:hover, .cg__link:hover .cg__photo img, .cg__btn:hover { transform: none; }
}
