/* ==========================================================
   BJ 2.0 — シェアモーダル（最小機能 fallback）
   - PC/タブレット: 中央モーダル
   - モバイル: ボトムシート
   - bj20_share_button() を使う任意のページで自動エンキュー
   - Web Share API 対応端末では JS が直接 navigator.share() を呼ぶため、
     このモーダルは fallback 時にのみ表示される。
   ========================================================== */

.bj-share-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.bj-share-modal.is-open {
  display: flex;
}

.bj-share-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 24, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: bj-share-fade 0.2s ease;
}

.bj-share-modal__content {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--color-surface, #fff);
  border-radius: 12px;
  padding: 32px 28px 28px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  animation: bj-share-slide 0.22s ease;
}

@keyframes bj-share-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes bj-share-slide {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bj20-page .bj-share-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  border-radius: 50%;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.bj20-page .bj-share-modal__close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-text);
}

.bj-share-modal__title {
  margin: 0 0 20px;
  font-family: var(--serif-jp);
  font-size: var(--fs-heading-s, 1.125rem);
  font-weight: 500;
  color: var(--color-text);
  letter-spacing: var(--ls-tight);
  text-align: center;
}

.bj-share-modal__link-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 14px;
}

.bj20-page .bj-share-modal__link-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg-sub);
  font-family: var(--sans-jp);
  font-size: var(--fs-note);
  color: var(--color-text-sub);
  letter-spacing: 0;
  -webkit-appearance: none;
  appearance: none;
}

.bj20-page .bj-share-modal__link-input:focus {
  outline: none;
  border-color: var(--color-accent);
}

.bj20-page .bj-share-modal__copy {
  flex: 0 0 auto;
  padding: 10px 18px;
  background: #111B3A;
  color: #F9F8F5;
  border: 1px solid #111B3A;
  border-radius: 6px;
  font-family: var(--sans-jp);
  font-size: var(--fs-note);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
  -webkit-appearance: none;
  appearance: none;
}

.bj20-page .bj-share-modal__copy:hover {
  background: #585F75;
  border-color: #585F75;
}

.bj20-page .bj-share-modal__copy.is-copied {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.bj-share-modal__hint {
  margin: 0;
  font-family: var(--sans-jp);
  font-size: var(--fs-note);
  line-height: 1.6;
  color: var(--color-text-sub);
  text-align: center;
}

/* モバイル: ボトムシート（fallback 時に navigator.share が動かない端末向け） */
@media (max-width: 767px) {
  .bj-share-modal {
    align-items: flex-end;
    padding: 0;
  }

  .bj-share-modal__content {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 28px 20px calc(20px + env(safe-area-inset-bottom));
    animation: bj-share-slide-up 0.25s ease;
  }

  @keyframes bj-share-slide-up {
    from { opacity: 0; transform: translateY(40px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .bj-share-modal__title {
    font-size: 1rem;
    margin-bottom: 18px;
  }
}

body.modal-open {
  overflow: hidden;
}
