/* =========================================================
   全記事への入口：深緑の表紙と、明るい紙色の誌面
   5つのカテゴリートップだけに使用
========================================================= */

body main .sf39-archive-entry {
  width: min(1180px, calc(100% - 64px));
  max-width: none;
  margin: 64px auto;
  padding: 0;
}

body main .sf39-archive-entry__link {
  display: grid;
  grid-template-columns: minmax(220px, 30%) minmax(0, 1fr) 112px;
  align-items: stretch;
  min-height: 210px;
  padding: 0;
  color: #173f38;
  text-decoration: none;
  background: #fffdf8;
  border: 1px solid #d6ded3;
  box-shadow: 0 12px 28px rgba(25, 57, 47, 0.06);
  transition:
    transform 0.28s ease,
    box-shadow 0.28s ease,
    border-color 0.28s ease;
}

/* 左側：目次の表紙 */

body main .sf39-archive-entry__cover {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 25px;
  padding: 32px;
  color: #fffdf8;
  background: #173f38;
}

body main .sf39-archive-entry__label {
  width: fit-content;
  padding-bottom: 12px;
  border-bottom: 2px solid #ce8068;
  font: 500 11px/1.4 Arial, sans-serif;
  letter-spacing: 0.24em;
}

body main .sf39-archive-entry__word {
  font: 400 clamp(42px, 5vw, 64px)/1 Georgia, serif;
  letter-spacing: -0.035em;
}

body main .sf39-archive-entry__word > span {
  color: #ce8068;
}

/* 中央：日本語の見出しと短い案内 */

body main .sf39-archive-entry__copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  min-width: 0;
  margin: 30px 0 30px 34px;
  padding: 12px 28px;
  border-left: 1px solid #abb9ab;
}

body main .sf39-archive-entry__copy > strong {
  color: #173f38;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(22px, 2.2vw, 29px);
  font-weight: 600;
  line-height: 1.65;
}

body main .sf39-archive-entry__copy > span {
  color: #617166;
  font-size: 14px;
  line-height: 1.9;
}

/* 右側：正方形の矢印 */

body main .sf39-archive-entry__action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 32px 24px 32px 0;
  padding-left: 20px;
  border-left: 1px solid #abb9ab;
}

body main .sf39-archive-entry__action > span {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  color: #fffdf8;
  background: #173f38;
  font: 400 30px/1 Georgia, serif;
  transition: background-color 0.25s ease;
}

body main .sf39-archive-entry__action small {
  color: #173f38;
  font-size: 11px;
  white-space: nowrap;
}

body main .sf39-archive-entry__link:focus-visible {
  outline: 2px solid #b99961;
  outline-offset: 4px;
}

@media (hover: hover) {
  body main .sf39-archive-entry__link:hover {
    transform: translateY(-3px);
    border-color: #748e7e;
    box-shadow: 0 16px 32px rgba(25, 57, 47, 0.11);
  }

  body main .sf39-archive-entry__link:hover .sf39-archive-entry__action > span {
    background: #a66149;
  }
}

body main .sf39-archive-entry__link:active {
  transform: translateY(1px);
}

@media (max-width: 900px) {
  body main .sf39-archive-entry__link {
    grid-template-columns: 200px minmax(0, 1fr) 90px;
  }

  body main .sf39-archive-entry__cover {
    padding: 25px;
  }

  body main .sf39-archive-entry__copy {
    margin-left: 20px;
    padding-inline: 20px;
  }
}

@media (max-width: 767px) {
  body main .sf39-archive-entry {
    width: calc(100% - 32px);
    margin-block: 40px;
  }

  body main .sf39-archive-entry__link {
    grid-template-columns: minmax(0, 1fr) 84px;
  }

  body main .sf39-archive-entry__cover {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px;
  }

  body main .sf39-archive-entry__word {
    font-size: 38px;
  }

  body main .sf39-archive-entry__label {
    font-size: 9px;
  }

  body main .sf39-archive-entry__copy {
    margin: 0;
    padding: 26px 20px;
    border: 0;
  }

  body main .sf39-archive-entry__copy > strong {
    font-size: 21px;
  }

  body main .sf39-archive-entry__copy > span {
    font-size: 13px;
  }

  body main .sf39-archive-entry__action {
    margin: 24px 16px 24px 0;
    padding-left: 12px;
  }

  body main .sf39-archive-entry__action > span {
    width: 48px;
    height: 48px;
    font-size: 25px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body main .sf39-archive-entry__link,
  body main .sf39-archive-entry__action > span {
    transition: none;
  }
}

/* =========================================================
   全記事への入口から締めまで：背景・間隔・影をなじませる
========================================================= */

body main .sf39-archive-entry {
  margin-bottom: 32px;
}

body main .sf39-archive-entry__link {
  background: #faf5eb;
  box-shadow: 0 4px 12px rgba(25, 57, 47, 0.025);
}

body.category-family-inheritance main .sf39-archive-entry__link,
body.category-end-of-life-planning main .sf39-archive-entry__link {
  background: #f1f5ed;
}

/* 次のセクション側の余白を解除し、入口の下余白だけで管理 */

body main .sf39-archive-entry + :is(.sf39-lr-closing, .mg-closing, .wa-closing, .sf-family-ed__closing, .sf39-eol-closing) {
  margin-top: 0 !important;
}

@media (hover: hover) {
  body main .sf39-archive-entry__link:hover {
    box-shadow: 0 7px 18px rgba(25, 57, 47, 0.065);
  }
}

/* =========================================================
   5カテゴリーの締め：明るい写真と深緑のフッターを区切る
   深緑へのグラデーション装飾を解除し、境目をすっきり見せる。
========================================================= */

body.category-second-life .sf39-lr .sf39-lr-closing::after,
body.category-work-career .sf39-work .wa-closing--journey::after,
body.category-family-inheritance .sf-family-ed__closing.sf39-family-letter::after,
body.category-end-of-life-planning .sf39-eol .sf39-eol-closing::after {
  content: none !important;
  display: none !important;
  background: none !important;
}

/* お金：背景自体にある深緑へのグラデーションをサンド一色へ */

body.category-money-finance .sf39-mg .mg-closing {
  background: #f0e5ce !important;
  padding-block: 64px !important;
}

/* 家族・終活：元の明るいセージ背景 */

body.category-family-inheritance .sf-family-ed__closing.sf39-family-letter {
  background: #e8eee5 !important;
  padding-block: 64px !important;
}

body.category-end-of-life-planning .sf39-eol .sf39-eol-closing {
  background: #e9efe5 !important;
  padding-bottom: 0 !important;
}

/* 色の移行のために追加した本文下の余白を解除 */

body.category-second-life .sf39-lr .sf39-lr-closing-copy {
  padding-block: 64px !important;
}

body.category-work-career .sf39-work .wa-closing--journey .wa-closing-inner {
  padding-block: 52px !important;
}

/* 5カテゴリーとも、締めとフッターの間に白い余白を残さない */

body:is(.category-second-life, .category-money-finance, .category-work-career, .category-family-inheritance, .category-end-of-life-planning) main :is(.sf39-lr-closing, .mg-closing, .wa-closing--journey, .sf-family-ed__closing.sf39-family-letter, .sf39-eol-closing) {
  margin-bottom: 0 !important;
}

body:is(.category-second-life, .category-money-finance, .category-work-career, .category-family-inheritance, .category-end-of-life-planning) .sf-footer {
  margin-top: 0 !important;
  background: #173f38 !important;
  border-top: 0 !important;
}

/* 仕事：最後の写真は顔の上側を見せる位置を維持 */

body .sf39-work .wa-closing--journey .wa-journey-photo img {
  object-position: 70% top !important;
}

/* =========================================================
   スマホ：写真の表示領域を残し、本文の上下余白を整える
========================================================= */

@media (max-width: 767px) {
  body main .sf39-archive-entry {
    margin-bottom: 24px;
  }

  body.category-second-life .sf39-lr .sf39-lr-closing-copy,
  body.category-money-finance .sf39-mg .mg-closing,
  body.category-family-inheritance .sf-family-ed__closing.sf39-family-letter {
    padding-block: 40px !important;
  }

  body.category-work-career .sf39-work .wa-closing--journey .wa-closing-inner {
    padding-block: 34px !important;
  }

  body .sf39-work .wa-closing--journey .wa-journey-photo img {
    object-position: 82% top !important;
  }
}
