/* Instagram ウィジェット（フロント） */

.grip-ig-widget {
	width: 100%;
	box-sizing: border-box;
	margin: 0 auto;
}

/* --- アカウント情報 --- */
.grip-ig-head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 14px;
}

.grip-ig-head__avatar {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	object-fit: cover;
	border: 1px solid #eee;
	flex-shrink: 0;
}

.grip-ig-head__avatar--fallback {
	background: linear-gradient(45deg, #f09433, #dc2743, #bc1888);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	border: 0;
}

.grip-ig-head__meta {
	min-width: 0;
}

.grip-ig-head__name {
	font-weight: 700;
	color: #2a2f36;
}

.grip-ig-head__count {
	font-size: 0.85em;
	color: #99a1ab;
}

.grip-ig-head__follow {
	margin-left: auto;
	text-decoration: none;
	color: #fff;
	border-radius: 6px;
	padding: 6px 16px;
	font-size: 0.85em;
	white-space: nowrap;
}

/* --- ギャラリー --- */
.grip-ig-gal {
	display: flex;
	flex-wrap: wrap;
	/* 既定の stretch だと iPhone Safari が aspect-ratio より高さの引き伸ばしを優先し、
	   正方形のはずのセルが縦長に潰れる。flex-start で高さを中身に任せる。 */
	align-items: flex-start;
}

.grip-ig-gal--slider {
	flex-wrap: nowrap;
	overflow-x: auto;
	scroll-behavior: smooth;
	scroll-snap-type: x mandatory;
	padding-bottom: 8px;
	-webkit-overflow-scrolling: touch;
}

.grip-ig-cell {
	position: relative;
	flex-shrink: 0;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: 4px;
	background: #eee;
}

.grip-ig-gal--slider .grip-ig-cell {
	scroll-snap-align: start;
}

.grip-ig-cell.is-clickable {
	cursor: pointer;
}

.grip-ig-cell img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* 動画の目印。右上に 16px の三角を置いていたが小さすぎて気づけなかったので、
   サムネイルの中央に丸い再生ボタンを重ねる。動画配信サービスと同じ見た目。 */
.grip-ig-cell__video {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: rgba(0, 0, 0, .45);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
	/* 三角は視覚的な中心が右にずれるので少しだけ戻す */
	padding-left: 3px;
	box-shadow: 0 1px 6px rgba(0, 0, 0, .35);
	pointer-events: none;
}

/* ライトボックスの動画。画像と同じ収まりにする */
.grip-ig-lb__img video {
	display: block;
	max-width: 100%;
	max-height: 70vh;
	width: auto;
	height: auto;
	background: #000;
}

/* いいね・コメント・動画のアイコン。
   文字（絵文字）だと WordPress の絵文字置換で s.w.org の画像に差し替えられ、
   インライン画像として想定外の位置に流し込まれてしまうため SVG で描く。 */
.grip-ig-icon {
	display: block;
	flex-shrink: 0;
	fill: currentColor;
}

/* アイコンと数値をひとかたまりにして、縦位置を揃える。 */
.grip-ig-count {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	line-height: 1;
	white-space: nowrap;
}

.grip-ig-cell__hover {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .4);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	color: #fff;
	opacity: 0;
	transition: opacity .15s;
}

.grip-ig-cell__counts {
	display: flex;
	gap: 14px;
	font-size: 13px;
	font-weight: 700;
}

/* --- スライダーの送り矢印 --- */
.grip-ig-slider {
	position: relative;
}

.grip-ig-slider__btn {
	position: absolute;
	top: 37%;
	transform: translateY(-50%);
	z-index: 2;
	width: 50px;
	height: 50px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .9);
	box-shadow: 0 1px 6px rgba(0, 0, 0, .2);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.grip-ig-slider__btn.is-prev {
	left: 6px;
}

.grip-ig-slider__btn.is-next {
	right: 6px;
}

.grip-ig-slider__btn span {
	display: inline-block;
	border: solid #333;
	border-width: 0 2px 2px 0;
	padding: 4px;
}

/* --- ライトボックス --- */
.grip-ig-lb {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .75);
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.grip-ig-lb__box {
	background: #fff;
	border-radius: 10px;
	overflow: hidden;
	max-width: 760px;
	width: 100%;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
}

.grip-ig-lb__bar {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	border-bottom: 1px solid #eef1f5;
}

.grip-ig-lb__name {
	font-weight: 700;
	color: #2a2f36;
	font-size: 14px;
}

.grip-ig-lb__close {
	margin-left: auto;
	border: 0;
	background: transparent;
	font-size: 22px;
	color: #99a1ab;
	cursor: pointer;
	line-height: 1;
}

.grip-ig-lb__img {
	position: relative;
	background: #000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.grip-ig-lb__img img {
	max-width: 100%;
	max-height: 60vh;
	object-fit: contain;
}

/* 複数枚投稿の送り。中身を差し替える器を 1 枚挟んでおき、
   矢印とカウンタは器の外 (= 親) に置く。入れ替えても消えないようにするため。 */
.grip-ig-lb__stage {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
}

.grip-ig-lb__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .9);
	box-shadow: 0 1px 6px rgba(0, 0, 0, .25);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.grip-ig-lb__nav--prev {
	left: 10px;
}

.grip-ig-lb__nav--next {
	right: 10px;
}

/* 矢印は CSS だけで作る（画像を増やさない） */
.grip-ig-lb__nav > span {
	display: inline-block;
	width: 0;
	height: 0;
	border: solid #333;
	border-width: 0 2px 2px 0;
	padding: 4px;
}

.grip-ig-lb__nav--prev > span {
	transform: rotate(135deg);
	margin-left: -2px;
}

.grip-ig-lb__nav--next > span {
	transform: rotate(-45deg);
	margin-right: -2px;
}

.grip-ig-lb__counter {
	position: absolute;
	bottom: 10px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 2;
	background: rgba(0, 0, 0, .6);
	color: #fff;
	border-radius: 12px;
	padding: 2px 10px;
	font-size: 12px;
	line-height: 1.6;
	pointer-events: none;
}

/* 複数枚投稿の印。Instagram 本体と同じく右上に置く */
.grip-ig-cell__carousel {
	position: absolute;
	top: 6px;
	right: 6px;
	color: #fff;
	line-height: 0;
	filter: drop-shadow(0 0 2px rgba(0, 0, 0, .65));
	pointer-events: none;
}

.grip-ig-lb__info {
	padding: 14px 18px;
	overflow-y: auto;
}

.grip-ig-lb__counts {
	display: flex;
	gap: 18px;
	font-size: 14px;
	font-weight: 700;
	color: #2a2f36;
	margin-bottom: 10px;
}

.grip-ig-lb__comments {
	color: #66707a;
	font-weight: 500;
}

.grip-ig-lb__caption {
	font-size: 13px;
	color: #3a4149;
	line-height: 1.7;
	white-space: pre-wrap;
}

.grip-ig-lb__link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 12px;
	font-size: 12px;
	color: #c13584;
	text-decoration: none;
	font-weight: 700;
}

/* mp4 が返らない動画。再生できないので Instagram へ送る。
   静止画のまま黙って出すと「動画なのに動かない」になるため、
   再生ボタンと行き先を明示する。 */
.grip-ig-lb__offsite {
	position: relative;
	display: block;
	max-width: 100%;
	text-decoration: none;
}

.grip-ig-lb__offsite img {
	display: block;
	max-width: 100%;
	max-height: 60vh;
	object-fit: contain;
}

.grip-ig-lb__offsite-play {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: rgba(0, 0, 0, .55);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
	/* 三角は視覚的な中心が右にずれるので少しだけ戻す */
	padding-left: 4px;
}

.grip-ig-lb__offsite-note {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, .6);
	color: #fff;
	font-size: 12px;
	text-align: center;
	padding: 7px 10px;
}
