/* ==========================================================================
   DH Insta Feed - Frontend Styles
   ========================================================================== */

.dh-insta-feed-wrap {
  width: 100%;
  margin: 0 auto;
}

/* 3x3 グリッドギャラリー（PC） / 縦1列表示（スマホ） */
.dh-insta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 768px) {
  .dh-insta-grid {
    grid-template-columns: 1fr;
    gap: 18px;
    max-width: 480px;
    margin: 0 auto;
  }
}

/* サムネイルアイテム */
.dh-insta-item {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 2px;
  cursor: pointer;
  background: #f0f0f0;
}

.dh-insta-thumb {
  position: relative;
  width: 100%;
  height: 100%;
}

.dh-insta-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.dh-insta-item:hover .dh-insta-thumb img {
  transform: scale(1.04);
}

/* サムネイル右上の動画バッジ */
.dh-insta-badge-video {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  pointer-events: none;
}

.dh-insta-badge-video svg {
  width: 14px;
  height: 14px;
}

/* ホバー時のオーバーレイマスク（ホメオバウのブランドシアンカラー） */
.dh-insta-mask {
  position: absolute;
  inset: 0;
  background: rgba(72, 159, 175, 0.65);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3;
}

.dh-insta-item:hover .dh-insta-mask {
  opacity: 1;
}

.dh-insta-stats {
  display: flex;
  gap: 16px;
  align-items: center;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.dh-insta-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dh-insta-icon {
  width: 17px;
  height: 17px;
  display: inline-block;
  fill: currentColor;
}

/* ==========================================================================
   モーダルポップアップ
   ========================================================================== */

.dh-insta-modal {
  position: fixed;
  inset: 0;
  z-index: 99999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  padding: 48px 60px 30px;
  box-sizing: border-box;
}

.dh-insta-modal.is-active {
  opacity: 1;
  visibility: visible;
}

.dh-insta-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
}

/* モーダル全体のラッパー */
.dh-insta-modal-dialog {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1020px;
  display: flex;
  flex-direction: column;
}

/* モーダル表示枠 */
.dh-insta-modal-container {
  position: relative;
  width: 100%;
  max-height: 84vh;
  background: #ffffff;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

/* 閉じるボタン（本家同様、コンテンツ表示エリアの右上直上に配置） */
.dh-insta-modal-close {
  position: absolute;
  top: -38px;
  right: 0;
  z-index: 10;
  background: transparent;
  border: none;
  font-size: 34px;
  line-height: 1;
  color: #ffffff;
  cursor: pointer;
  padding: 2px 4px;
  transition: transform 0.2s ease, opacity 0.2s ease;
  user-select: none;
}

.dh-insta-modal-close:hover {
  opacity: 0.8;
  transform: scale(1.1);
}

/* 前後ナビゲーション矢印ボタン */
.dh-insta-nav-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000002;
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: #ffffff;
  font-size: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  user-select: none;
  backdrop-filter: blur(4px);
}

.dh-insta-nav-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: translateY(-50%) scale(1.08);
}

.dh-insta-prev-btn {
  left: 20px;
}

.dh-insta-next-btn {
  right: 20px;
}

@media (max-width: 768px) {
  .dh-insta-modal {
    padding: 40px 16px 16px;
  }
  .dh-insta-modal-close {
    top: -34px;
    right: 2px;
    font-size: 28px;
  }
  .dh-insta-nav-btn {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }
  .dh-insta-prev-btn {
    left: 8px;
  }
  .dh-insta-next-btn {
    right: 8px;
  }
}

.dh-insta-modal-body {
  display: flex;
  flex-direction: row;
  height: 100%;
  max-height: 84vh;
  overflow: hidden;
}

@media (max-width: 768px) {
  .dh-insta-modal-body {
    flex-direction: column;
    overflow-y: auto;
  }
}

.dh-insta-modal-media {
  position: relative;
  flex: 1.35;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 380px;
  overflow: hidden;
}

.dh-insta-modal-media img {
  max-width: 100%;
  max-height: 84vh;
  object-fit: contain;
  display: block;
}

.dh-insta-modal-media video {
  max-width: 100%;
  max-height: 84vh;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

/* 動画再生ボタン */
.dh-insta-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.85);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  padding: 0;
}

.dh-insta-play-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: translate(-50%, -50%) scale(1.08);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.dh-insta-play-btn svg {
  width: 32px;
  height: 32px;
  margin-left: 4px;
}

.dh-insta-modal-info {
  flex: 1;
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  background: #ffffff;
}

.dh-insta-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 14px;
  margin-bottom: 14px;
}

.dh-insta-modal-author {
  color: #111;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

.dh-insta-modal-meta-top {
  display: flex;
  gap: 12px;
  align-items: center;
}

.dh-insta-modal-counter {
  font-size: 12px;
  color: #888;
  font-weight: 600;
}

.dh-insta-modal-date {
  font-size: 12px;
  color: #888;
}

.dh-insta-modal-caption {
  font-size: 13px;
  line-height: 1.8;
  color: #333333;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-line;
  word-break: break-word;
  padding-right: 8px;
  margin-bottom: 16px;
}

.dh-insta-modal-footer {
  border-top: 1px solid #f0f0f0;
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dh-insta-modal-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: #555;
  font-weight: 600;
}

.dh-insta-modal-view-btn {
  background: #489faf;
  color: #ffffff !important;
  text-decoration: none;
  padding: 8px 18px;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s ease;
}

.dh-insta-modal-view-btn:hover {
  background: #3a8a9a;
}
