/* =========================================================
   Instagram Section – IG Color Edition + Dark Cover + IG Badge
========================================================= */


/* =========================
   1) Section Fade
========================= */
.ig{
  padding-bottom: 96px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .6s ease, transform .6s ease;
}
.ig.is-visible{
  opacity: 1;
  transform: translateY(0);
}


/* =========================
   2) Grid
========================= */
.ig-row{
  display:grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}



@media (min-width: 768px){

  .ig-personal{
    padding-right: 5%;
    padding-left: 5%;
  }

}


/* =========================
   3) Card Base
========================= */
.ig-row a{
  position:relative;
  display:block;
  aspect-ratio:1/1;
  overflow:hidden;

  background:#fff;
  border-radius: 16px;

  transition: transform .22s ease, box-shadow .22s ease;

  /* ※ここはCSS的にグラデbox-shadowが効かない場合があります
     枠表現は ::after / ::before で完成しているのでそのままでもOK */
  box-shadow:
    -4px 0 0 linear-gradient(
      45deg,
      #833ab4,
      #c13584,
      #e1306c,
      #fd1d1d,
      #fcb045
    ),
    4px 0 0 linear-gradient(
      45deg,
      #833ab4,
      #c13584,
      #e1306c,
      #fd1d1d,
      #fcb045
    ),
    0 8px 18px rgba(0, 0, 0, .35);
}


/* =========================
   4) Image
========================= */
.ig-row img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;

  transform:scale(1.02);
  transition:transform .45s ease, filter .45s ease;
}


/* =========================================================
   ★ 追加：黒カバー（常時）
   - 写真を少し暗くする
   - IGフィードっぽいトーン統一
   - 文字が見やすくなる
========================================================= */
.ig-row a .ig-dark{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.22); /* ← 暗さ調整はここ */
  z-index:1;
  pointer-events:none;
  transition:opacity .3s ease;
}


/* =========================================================
   ★追加：IG Badge（常時表示）
   - これで「Instagramセクション」だと一目で分かる
   - HTML側で <span class="ig-badge">IG</span> を入れる
========================================================= */
.ig-row a .ig-badge{
  position:absolute;
  bottom: 15px;
  right: 15px;

  z-index:4; /* dark(1)より上、枠(3)と同等以上 */

  display:inline-flex;
  align-items:center;
  justify-content:center;

  height:22px;
  padding:0 8px;

  font-size:calc(10px * var(--official-font-scale, 1));
  font-weight:500;
  letter-spacing:.18em;

  color:#ffffff;
  border-radius:999px;

  background: linear-gradient(
    45deg,
    #8943b8,
    #e44379,
    #ff4242,
    #ffbf65
  );
  backdrop-filter: blur(6px);

  box-shadow:
    0 6px 14px rgba(0,0,0,.22),
    0 0 0 1px rgba(225,48,108,.18);

  pointer-events:none;
  opacity:.9;
  transition: opacity .25s ease, transform .25s ease;
}

@media (hover:hover){
  .ig-row a:hover .ig-badge{
    opacity:1;
    transform: translateY(-1px);
  }
}


/* =========================================================
   Instagram Gradient Border（枠）
========================================================= */
.ig-row a::before{
  content:"";
  position:absolute;
  inset:0;

  border-radius:inherit;

  /* ★ コーナー発光グラデーション */
  background:
    /* 左上の光 */
    radial-gradient(
      circle at left top,
      rgba(131,58,180,.65) 0%,     /* purple */
      rgba(225,48,108,.55) 30%,   /* pink */
      rgba(252,176,69,.45) 55%,   /* yellow */
      transparent 70%
    ),

    /* 右下の光 */
    radial-gradient(
      circle at right bottom,
      rgba(131,58,180,.65) 0%,    /* purple */
      rgba(225,48,108,.55) 30%,   /* pink */
      rgba(255, 255, 255, 0.45) 55%,   /* white */
      transparent 70%
    );

  pointer-events:none;
  z-index:3;

  /* 常時うっすら見せる */
  opacity:.45;
  transition:opacity .3s ease;
}


/* =========================
   6) Hover
========================= */
@media (hover:hover){

  .ig-row a:hover{
    transform:translateY(-3px);
    box-shadow:0 16px 30px rgba(0,0,0,.10);
  }

  .ig-row a:hover img{
    transform:scale(1.06);
    filter:saturate(1.06) contrast(1.04);
  }

  /* hover時は少し明るく */
  .ig-row a:hover .ig-dark{
    opacity:.12;
  }

  /* 角発光も少し強め（任意） */
  .ig-row a:hover::before{
    opacity:.75;
  }
}


/* =========================
   7) Responsive
========================= */
@media (max-width: 767px){
  .ig-row{
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width:640px){
  
  .ig-row{
    margin: 0 auto;
    width: min(96%, 2400px);
    max-width: var(--max);
    grid-template-columns: repeat(2, 1fr);
    gap:12px;

  }
}

/**/
.profile_ig{
  padding-bottom: 96px;
}

/* =========================================================
   Instagram Modal（安定版）
========================================================= */

.ig-modal{
  position: fixed;
  inset: 0;
  z-index: 9999;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition: opacity .22s ease, visibility .22s ease;
}

.ig-modal.is-open{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* overlay */
.ig-overlay{
  position: absolute;
  inset: 0;
  background: rgba(10,18,24,.55);
  backdrop-filter: blur(4px);

  opacity: 0;
  transition: opacity .22s ease;
}

.ig-modal.is-open .ig-overlay{
  opacity: 1;
}

/* panel（中央に固定 + ふわっと） */
.ig-panel{
  position: absolute;
  left: 50%;
  top: 50%;

  width: min(100vw, 760px);
  height: 100vh;

  display: flex;
  flex-direction: column;

  background-color: #00000047;
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 24px 60px rgba(0,0,0,.22);

  overflow: hidden;

  transform: translate(-50%, -48%) scale(.985);
  opacity: 0;

  transition: transform .28s cubic-bezier(.2,.9,.2,1.12), opacity .22s ease;
}

.ig-modal.is-open .ig-panel{
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

/* タイルはrelativeにしておく（念のため） */
.ig-tile{
  position: relative;
  display: block;
  overflow: hidden;
}

/* モデル名 */
.ig-name{
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 3;

  font-size: calc(12px * var(--official-font-scale, 1));
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #fff;

  padding: 5px 12px;
  border-radius: 999px;

  background: linear-gradient(
    45deg,
    rgba(245,133,41,.9),
    rgba(221,42,123,.9),
    rgba(129,52,175,.9),
    rgba(81,91,212,.9)
  );

  backdrop-filter: blur(6px);

  box-shadow: 
    0 6px 18px rgba(0,0,0,.28),
    inset 0 1px 1px rgba(255,255,255,.25);
}

@media (max-width: 767px) {
  .ig-name{
    font-size: calc(9px * var(--official-font-scale, 1));
  }
}

/* close */
.ig-close{
  position: absolute;
  right: 10px;
  top: 10px;

  width: 38px;
  height: 38px;

  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.9);

  cursor: pointer;
  font-size: calc(18px * var(--official-font-scale, 1));
  line-height: 1;

  z-index: 3;
}

/* inner（ここだけスクロールさせるのが肝） */
.ig-inner{
  flex: 1;
  min-height: 0;  /* ★これがないと actions が押し出されて消えがち */
  overflow: auto;

  display: grid;
  place-items: center;

  padding: 56px 10px 12px;
}

/* 画像表示（モーダルの中に収める） */
.ig-inner img{
  width: 90%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* actions（必ず下に出す） */
.ig-actions{
  margin-top:16px;
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 12px;
}

/* open button */
.ig-open,
.ig-profile{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;

  height: 42px;
  padding: 0 16px;

  color: #fff;
  border-radius: 999px;

  background: linear-gradient(
    45deg,
    rgba(245,133,41,.9),
    rgba(221,42,123,.9),
    rgba(129,52,175,.9),
    rgba(81,91,212,.9)
  );

  text-decoration: none;
  font-size: calc(12px * var(--official-font-scale, 1));
  letter-spacing: .08em;
  transition: transform .5s ease;
}


/* =========================
   Mobile
   ========================= */
@media (max-width: 767px){

  .ig-actions{
    margin-top:0;
    width: 100%;
    display: block;
    padding: 0 5%;
    position: static;
  }

  .ig-open,
  .ig-profile{
    display: flex;
    width: 100%;
    height: 32px !important;
    line-height: 32px !important;
    padding: 6px 0 !important;
    font-size: calc(11px * var(--official-font-scale, 1));
    letter-spacing: .06em;
    gap: 0;
  }

  .ig-open + .ig-profile{
    margin-top: 10px;
  }

  /* close */
  .ig-close{
    right: 0;
    top: 50%;
    transform: translateY(-50%);

    border-radius: 0;
  }

  .ig-inner{
    padding: 12px 10px;
  }

  .ig-panel{
    display: inline;
    place-items: center;
    padding: 12px 10px;
    height: auto;
  }

}


/* ▼ Hover */
.ig-open:hover, .ig-profile:hover{
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(0,0,0,.18);
}
