/*
 * ユーティリティレイヤー: 自前ユーティリティクラス + グリッド
 *
 * Bootstrap 廃止（Issue #695）に伴い、プロジェクトで実際に使用されている
 * ユーティリティ・グリッドのサブセットを同名・同挙動で定義する。
 * 旧 Bootstrap と同様、コンポーネント側の指定より優先させるため
 * 各宣言に !important を付与する。未使用のクラスは追加しない。
 *
 * ブレークポイント: sm=576px / md=768px / lg=992px / xl=1200px（base.css の規約参照）
 */

/* ── Display ── */

.d-inline-block {
  display: inline-block !important;
}

.d-flex {
  display: flex !important;
}

.d-none {
  display: none !important;
}

/* ── Flex ── */

.flex-row {
  flex-direction: row !important;
}

.flex-column {
  flex-direction: column !important;
}

.flex-wrap {
  flex-wrap: wrap !important;
}

.flex-nowrap {
  flex-wrap: nowrap !important;
}

.flex-grow-1 {
  flex-grow: 1 !important;
}

.justify-content-start {
  justify-content: flex-start !important;
}

.justify-content-end {
  justify-content: flex-end !important;
}

.justify-content-center {
  justify-content: center !important;
}

.justify-content-between {
  justify-content: space-between !important;
}

.justify-content-around {
  justify-content: space-around !important;
}

.align-items-start {
  align-items: flex-start !important;
}

.align-items-center {
  align-items: center !important;
}

.align-items-end {
  align-items: flex-end !important;
}

.gap-2 {
  gap: var(--space-2) !important;
}

.gap-3 {
  gap: var(--space-3) !important;
}

/* ── Margin / Padding ── */

.mt-2 {
  margin-top: var(--space-2) !important;
}

.mt-4 {
  margin-top: var(--space-4) !important;
}

.mt-auto {
  margin-top: auto !important;
}

.mb-0 {
  margin-bottom: 0 !important;
}

.mb-1 {
  margin-bottom: var(--space-1) !important;
}

.mb-2 {
  margin-bottom: var(--space-2) !important;
}

.mb-3 {
  margin-bottom: var(--space-3) !important;
}

.mb-4 {
  margin-bottom: var(--space-4) !important;
}

.ms-0 {
  margin-left: 0 !important;
}

.ms-1 {
  margin-left: var(--space-1) !important;
}

.ms-2 {
  margin-left: var(--space-2) !important;
}

.ms-auto {
  margin-left: auto !important;
}

.me-1 {
  margin-right: var(--space-1) !important;
}

.me-2 {
  margin-right: var(--space-2) !important;
}

.me-3 {
  margin-right: var(--space-3) !important;
}

.mx-auto {
  margin-right: auto !important;
  margin-left: auto !important;
}

.p-0 {
  padding: 0 !important;
}

.pt-2 {
  padding-top: var(--space-2) !important;
}

.pt-4 {
  padding-top: var(--space-4) !important;
}

.pb-1 {
  padding-bottom: var(--space-1) !important;
}

.pb-5 {
  padding-bottom: var(--space-5) !important;
}

.px-1 {
  padding-right: var(--space-1) !important;
  padding-left: var(--space-1) !important;
}

.px-3 {
  padding-right: var(--space-3) !important;
  padding-left: var(--space-3) !important;
}

.py-4 {
  padding-top: var(--space-4) !important;
  padding-bottom: var(--space-4) !important;
}

/* ── Text / Font ── */

.text-start {
  text-align: left !important;
}

.text-center {
  text-align: center !important;
}

.text-end {
  text-align: right !important;
}

.text-nowrap {
  white-space: nowrap !important;
}

.text-decoration-none {
  text-decoration: none !important;
}

.text-decoration-underline {
  text-decoration: underline !important;
}

.text-dark {
  color: var(--color-text-dark) !important;
}

.text-muted {
  color: var(--color-text-muted) !important;
}

.text-secondary {
  color: var(--color-text-muted) !important;
}

.fw-bold {
  font-weight: 700 !important;
}

.fw-semibold {
  font-weight: 600 !important;
}

.fs-2 {
  font-size: calc(1.325rem + 0.9vw) !important;
}

.fs-3 {
  font-size: calc(1.3rem + 0.6vw) !important;
}

.fs-4 {
  font-size: calc(1.275rem + 0.3vw) !important;
}

.fs-5 {
  font-size: 1.25rem !important;
}

@media (min-width: 1200px) {
  .fs-2 {
    font-size: 2rem !important;
  }

  .fs-3 {
    font-size: 1.75rem !important;
  }

  .fs-4 {
    font-size: 1.5rem !important;
  }
}

.small {
  font-size: 0.875em;
}

/* ── Sizing / Position ── */

.w-100 {
  width: 100% !important;
}

.w-auto {
  width: auto !important;
}

.h-100 {
  height: 100% !important;
}

.position-relative {
  position: relative !important;
}

.z-2 {
  z-index: 2 !important;
}

.z-3 {
  z-index: 3 !important;
}

/* ── Background / Border / Shadow ── */

.bg-white {
  background-color: var(--color-bg-white) !important;
}

.bg-danger {
  background-color: var(--color-danger) !important;
}

.bg-transparent {
  background-color: transparent !important;
}

.border-0 {
  border: 0 !important;
}

.shadow-sm {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.shadow-none {
  box-shadow: none !important;
}

.overflow-x-auto {
  overflow-x: auto !important;
}

/* ── リスト / アスペクト比 / 不可視 ── */

.list-unstyled {
  padding-left: 0;
  list-style: none;
}

.ratio {
  position: relative;
  width: 100%;
}

.ratio::before {
  display: block;
  padding-top: var(--aspect-ratio);
  content: "";
}

.ratio > * {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.ratio-1x1 {
  --aspect-ratio: 100%;
}

.ratio-16x9 {
  --aspect-ratio: 56.25%;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ── レスポンシブ変種 ── */

@media (min-width: 576px) {
  .d-sm-flex {
    display: flex !important;
  }

  .mb-sm-4 {
    margin-bottom: var(--space-4) !important;
  }
}

@media (min-width: 768px) {
  .d-md-flex {
    display: flex !important;
  }

  .d-md-inline {
    display: inline !important;
  }

  .d-md-none {
    display: none !important;
  }

  .flex-md-row {
    flex-direction: row !important;
  }

  .flex-md-nowrap {
    flex-wrap: nowrap !important;
  }

  .py-md-5 {
    padding-top: var(--space-5) !important;
    padding-bottom: var(--space-5) !important;
  }
}

/* ── グリッド ── */

.container,
.container-fluid {
  width: 100%;
  padding-right: 0.75rem;
  padding-left: 0.75rem;
  margin-right: auto;
  margin-left: auto;
}

@media (min-width: 576px) {
  .container {
    max-width: 540px;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 720px;
  }
}

@media (min-width: 992px) {
  .container {
    max-width: 960px;
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }
}

.row {
  --gutter-x: 1.5rem;
  --gutter-y: 0;
  display: flex;
  flex-wrap: wrap;
  margin-top: calc(-1 * var(--gutter-y));
  margin-right: calc(-0.5 * var(--gutter-x));
  margin-left: calc(-0.5 * var(--gutter-x));
}

.row > * {
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  padding-right: calc(var(--gutter-x) * 0.5);
  padding-left: calc(var(--gutter-x) * 0.5);
  margin-top: var(--gutter-y);
}

.g-4 {
  --gutter-x: var(--space-4);
  --gutter-y: var(--space-4);
}

.gy-2 {
  --gutter-y: var(--space-2);
}

.col-12 {
  flex: 0 0 auto;
  width: 100%;
}

@media (min-width: 576px) {
  .col-sm {
    flex: 1 0 0%;
  }

  .col-sm-auto {
    flex: 0 0 auto;
    width: auto;
  }

  .col-sm-4 {
    flex: 0 0 auto;
    width: 33.33333333%;
  }

  .col-sm-12 {
    flex: 0 0 auto;
    width: 100%;
  }
}

@media (min-width: 768px) {
  .col-md-3 {
    flex: 0 0 auto;
    width: 25%;
  }

  .col-md-6 {
    flex: 0 0 auto;
    width: 50%;
  }

  .col-md-auto {
    flex: 0 0 auto;
    width: auto;
  }
}

@media (min-width: 992px) {
  .col-lg-4 {
    flex: 0 0 auto;
    width: 33.33333333%;
  }

  .col-lg-6 {
    flex: 0 0 auto;
    width: 50%;
  }
}
