/* ===================================
   Flow Section（葬儀の流れ）
   3つの段階・流れの方向・小要素を明確に
   =================================== */
.flow {
  padding: var(--space-sm) 0 var(--space-lg);
  background-color: var(--color-bg);
}

@media (min-width: 768px) {
  .flow {
    padding: var(--space-sm) 0 var(--space-xl);
  }
}

.flow--quick .container {
  max-width: var(--layout-width-content);
}

.flow-quick__list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}

.flow-quick__item {
  background-color: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: 0 2px 14px rgba(20, 16, 12, 0.05);
}

.flow-quick__step {
  font-family: var(--font-inter);
  font-size: var(--type-body-sm);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--color-main-text);
}

.flow-quick__title {
  margin-top: 6px;
  font-family: var(--font-sans);
  font-size: var(--type-heading-card);
  font-weight: 600;
  line-height: 1.5;
  color: var(--color-text);
}

.flow-quick__text {
  margin-top: 4px;
  font-family: var(--font-sans);
  font-size: var(--type-body-sm);
  line-height: 1.8;
  color: var(--color-text-sub);
}

.flow-quick__button {
  margin-top: 14px;
}

.flow-quick__more {
  margin-top: var(--space-md);
  text-align: center;
}

@media (min-width: 768px) {
  .flow-quick__list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-md);
  }

  .flow-quick__item {
    padding: var(--space-md) clamp(18px, 2vw, 24px);
  }
}

.flow__lead {
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  color: var(--color-text-sub);
  text-align: center;
  line-height: 1.8;
  margin: 0 auto var(--space-lg);
}

.flow__lead strong {
  color: var(--color-main-text);
  font-weight: 600;
}

.flow--detail .flow__lead strong {
  color: var(--color-main);
}

/* 文末「まとめています。」の行頭禁則（折り返しで分割されないように） */
.flow__lead-end {
  white-space: nowrap;
}

@media (min-width: 768px) {
  .flow__lead {
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-lg);
  }
}

.flow__phases {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm) var(--space-lg);
}

@media (min-width: 1024px) {
  .flow__phases {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0;
    align-items: start;
    justify-content: center;
  }
}

/* 時期どうしのつながり（デスクトップのみ） */
.flow__phase-connector {
  display: none;
}

@media (min-width: 1024px) {
  .flow__phase-connector {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 32px;
    align-self: flex-start;
    /* 時期ヘッダー行の中央＝padding-top(24px)＋番号円の中心(16px)＝40px。矢印中心が40pxに来るよう margin-top を指定 */
    margin-top: calc(var(--space-md) + 16px - (18px / 2));
    font-size: var(--font-size-lg);
    font-weight: 500;
    line-height: 1;
    color: var(--color-text-sub);
    opacity: 0.9;
  }
}

/* 1つの時期＝アコーディオン（見出しクリックで開閉） */
.flow__phase {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  background-color: var(--color-bg);
  border: 1px solid rgba(var(--color-border-rgb), 0.8);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

@media (min-width: 1024px) {
  .flow__phase {
    max-width: none;
    margin: 0;
  }
}

/* 時期の見出し（summary＝クリックで開閉） */
.flow__phase-header {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs) 0;
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
  background: rgba(var(--color-main-rgb), 0.07);
  padding: var(--space-sm) var(--space-md);
  margin: 0;
  border-radius: 0;
  list-style: none;
  cursor: pointer;
  transition: background-color var(--transition);
}

.flow__phase-header::-webkit-details-marker {
  display: none;
}

.flow__phase-header:hover {
  background: rgba(var(--color-main-rgb), 0.1);
}

/* 時期番号＝丸型 */
.flow__phase-num {
  order: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-family: var(--font-inter);
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--color-white);
  background: var(--color-main);
  border: none;
  box-shadow: none;
  border-radius: 50%;
  margin-right: var(--space-sm);
  flex-shrink: 0;
}

.flow__phase-title {
  order: 2;
  flex: 1;
  min-width: 0;
}

/* 開閉アイコン（column-list-sort-group summary::after と同様に右端に配置） */
.flow__phase-header::after {
  position: absolute;
  right: var(--space-md);
  content: '';
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin-left: auto;
  background-color: currentColor;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  mask-size: contain;
  mask-position: center;
  mask-repeat: no-repeat;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  -webkit-mask-size: contain;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  transition: transform var(--transition);
}

.flow__phase[open] .flow__phase-header::after {
  transform: rotate(180deg);
}

@media (min-width: 1024px) {
  .flow__phase-header::after {
    opacity: 0.6;
  }
}

@media (min-width: 768px) {
  .flow__phase-header {
    font-size: var(--font-size-base);
    padding: var(--space-md);
  }

  .flow__phase-num {
    width: 32px;
    height: 32px;
    font-size: var(--font-size-sm);
  }
}

/* この時期のステップ一覧 */
/* ステップは常に1列で縦に読めるように */
/* 区切り線は開いたときだけ見えるよう、ヘッダーではなく中身の上に付ける */
.flow__steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--color-border);
}

.flow__step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md);
  position: relative;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  min-height: auto;
  border-bottom: 1px dashed rgba(var(--color-border-rgb), 0.9);
}

.flow__step:last-child {
  border-bottom: none;
}

/* 詳細番号＝リストの連番としてバッジにしない（時期番号との階層をはっきり） */
.flow__step-num {
  flex-shrink: 0;
  min-width: 1.5em;
  margin-top: 0.15em;
  font-family: var(--font-inter);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-sub);
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
}

.flow__step-num::after {
  content: '.';
}

.flow__step-body {
  flex: 1;
  min-width: 0;
}

.flow__step-label {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.5;
}

.flow__step-text {
  margin: 6px 0 0;
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  line-height: 1.8;
  color: var(--color-text-sub);
}

.flow__step-point {
  margin: 8px 0 0;
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: var(--font-size-xs);
  line-height: 1.7;
  color: var(--ink-dark);
  background: var(--structure-tab-muted-bg);
  border: 1px solid rgba(var(--ink-rgb), 0.12);
  border-radius: var(--radius-md);
}

.flow__phase-lead {
  margin: 0;
  padding: var(--space-sm);
  border-top: 1px solid var(--color-border);
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  line-height: 1.8;
  color: var(--color-text-sub);
}

.flow--detail .flow__steps {
  border-top: 1px dashed rgba(var(--ink-rgb), 0.12);
}

.flow__note {
  margin: var(--space-lg) auto 0;
  max-width: 40em;
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  line-height: 1.8;
  color: var(--color-text-sub);
  text-align: center;
}

/* 詳細ページ：説明文を読むために1列で縦積み。アクセントは青緑のみ */
.flow--detail .flow__phases {
  flex-direction: column;
  gap: var(--space-md);
  max-width: 720px;
  margin-inline: auto;
}

.flow--detail .flow__phase {
  border-color: rgba(var(--ink-rgb), 0.16);
}

.flow--detail .flow__phase-lead {
  border-top-color: rgba(var(--ink-rgb), 0.12);
}

.flow--detail .flow__step {
  border-bottom-color: rgba(var(--ink-rgb), 0.12);
}

.flow--detail .flow__phase-connector {
  display: none;
}

@media (min-width: 768px) {
  .flow--detail .flow__step {
    padding: var(--space-md);
  }

  .flow--detail .flow__phase-lead {
    padding: var(--space-md);
  }

  .flow--detail .flow__step-label {
    font-size: var(--font-size-base);
  }
}
