/* ================================================
   gallery.css — ブラウン管モニタールーム風
   style.css・responsive.cssの後に読み込んでください
   ================================================ */

/* ===== ページ全体 ===== */
body {
  background: #060708;
}

/* ===== ページヘッダー ===== */
.gl-header {
  position: relative;
  padding: 80px 20px 40px;
  text-align: center;
  border-bottom: 1px solid rgba(111, 159, 166, 0.15);
  background: #060708;
}

.gl-header__label {
  font-family: "Space Mono", monospace;
  font-size: 8px;
  letter-spacing: 0.4em;
  color: #6F9FA6;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.gl-header__title {
  font-family: "Zen Old Mincho", serif;
  font-size: 36px;
  font-weight: 400;
  letter-spacing: 0.3em;
  color: #e8e0cc;
  margin-bottom: 6px;
  /* ブラウン管のにじみ感 */
  text-shadow:
    0 0 8px rgba(255, 255, 255, 0.15),
    1px 0 0 rgba(0, 200, 220, 0.08),
    -1px 0 0 rgba(220, 0, 80, 0.08);
}

.gl-header__title-ja {
  font-size: 11px;
  letter-spacing: 0.4em;
  color: #6F9FA6;
}

@keyframes recBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ===== メインエリア ===== */
.gl-main {
  width: 100%;
  max-width: 393px;
  margin: 0 auto;
  padding: 16px 0 60px;
  box-sizing: border-box;
}

/* ===== モニターバー ===== */
.gl-monitor-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  background: #0a0b0d;
  border: 1px solid rgba(111, 159, 166, 0.2);
  border-bottom: none;
}

.gl-monitor-bar--bottom {
  border-top: none;
  border-bottom: 1px solid rgba(111, 159, 166, 0.2);
}

.gl-monitor-bar__label,
.gl-monitor-bar__count,
.gl-monitor-bar__date {
  font-family: "Space Mono", monospace;
  font-size: 7px;
  letter-spacing: 0.12em;
  color: #fafafa;
  text-transform: uppercase;
}

/* ===== グリッド ===== */
.gl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  background: #020203;
  border: 1px solid rgba(111, 159, 166, 0.2);
  border-top: none;
  border-bottom: none;
  padding: 4px;
	width: 100%;      
  box-sizing: border-box;
}

/* ===== 各セル ===== */
.gl-cell {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  background: #020203;
}

.gl-cell__screen {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #020203;
  /* ブラウン管の角丸 */
  border-radius: 2px;
}

/* 画像：彩度を落としてモノクロ寄りに */
.gl-cell__screen img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter:
    saturate(0.35)
    brightness(0.75)
    contrast(1.15)
    sepia(0.1);
  transition: filter 0.5s ease;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* ホバー時：少しだけ明るく */
.gl-cell:hover .gl-cell__screen img {
  filter:
    saturate(0.5)
    brightness(0.88)
    contrast(1.1)
    sepia(0.05);
}

/* --------------------------------------------------
   走査線（細かい横縞）
-------------------------------------------------- */
.gl-scanline {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.18) 2px,
    rgba(0, 0, 0, 0.18) 3px
  );
  pointer-events: none;
  z-index: 3;
}

/* --------------------------------------------------
   動く走査線（ブラウン管の電子ビーム）
-------------------------------------------------- */
.gl-cell__screen::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(255, 255, 255, 0.06),
    transparent
  );
  z-index: 4;
  animation: scanBeam 4s linear infinite;
  pointer-events: none;
}

.gl-cell:nth-child(1) .gl-cell__screen::before { animation-delay: 0s; }
.gl-cell:nth-child(2) .gl-cell__screen::before { animation-delay: -0.7s; }
.gl-cell:nth-child(3) .gl-cell__screen::before { animation-delay: -1.4s; }
.gl-cell:nth-child(4) .gl-cell__screen::before { animation-delay: -2.1s; }
.gl-cell:nth-child(5) .gl-cell__screen::before { animation-delay: -2.8s; }
.gl-cell:nth-child(6) .gl-cell__screen::before { animation-delay: -3.5s; }

@keyframes scanBeam {
  0%   { top: -3px; }
  100% { top: 100%; }
}

/* --------------------------------------------------
   ビネット（周辺暗化：ブラウン管の四隅が暗い）
-------------------------------------------------- */
.gl-cell__screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 55%,
    rgba(0, 0, 0, 0.55) 100%
  );
  pointer-events: none;
  z-index: 5;
}

/* --------------------------------------------------
   色収差オーバーレイ（RGB ズレ）
   JSのCanvas描画で対応するため薄めに設定
-------------------------------------------------- */
.gl-aberration {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  background: transparent;
  /* JSで mix-blend-mode を制御 */
}

/* --------------------------------------------------
   フリッカー（ブラウン管の明滅）
-------------------------------------------------- */
.gl-cell__screen {
  animation: crtFlicker 8s steps(1) infinite;
}

.gl-cell:nth-child(2) .gl-cell__screen { animation-delay: -1.3s; }
.gl-cell:nth-child(3) .gl-cell__screen { animation-delay: -3.7s; }
.gl-cell:nth-child(4) .gl-cell__screen { animation-delay: -5.1s; }
.gl-cell:nth-child(5) .gl-cell__screen { animation-delay: -2.4s; }
.gl-cell:nth-child(6) .gl-cell__screen { animation-delay: -6.8s; }

@keyframes crtFlicker {
  0%,  2%,  4%,  100% { opacity: 1;    }
  1%,  3%            { opacity: 0.92;  }
  /* 稀に大きく暗くなる */
  48%, 52%           { opacity: 1;    }
  50%                { opacity: 0.82; }
}

/* ===== カメラ情報オーバーレイ ===== */
.gl-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px 7px;
  pointer-events: none;
  z-index: 7;
}

.gl-overlay__cam {
  font-family: "Space Mono", monospace;
  font-size: 7px;
  letter-spacing: 0.15em;
  /* ブラウン管のにじみ感 */
  color: rgba(180, 220, 200, 0.75);
  text-shadow:
    0 0 3px rgba(111, 159, 166, 0.8),
    1px 0 0 rgba(0, 200, 220, 0.3),
    -1px 0 0 rgba(220, 0, 80, 0.2);
}

.gl-overlay__time {
  font-family: "Space Mono", monospace;
  font-size: 6px;
  letter-spacing: 0.08em;
  color: rgba(180, 220, 200, 0.6);
  text-shadow:
    0 0 3px rgba(111, 159, 166, 0.6),
    1px 0 0 rgba(0, 200, 220, 0.2),
    -1px 0 0 rgba(220, 0, 80, 0.15);
  align-self: flex-end;
}

/* ===== ノイズ Canvas ===== */
.gl-noise {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.06;
  mix-blend-mode: screen;
  z-index: 8;
}

/* ===== ホバー時フォーカス枠 ===== */
.gl-cell:hover .gl-overlay::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(111, 159, 166, 0.5);
  pointer-events: none;
  animation: focusPulse 0.8s ease-in-out infinite;
}

@keyframes focusPulse {
  0%, 100% { opacity: 1; border-color: rgba(111, 159, 166, 0.5); }
  50%       { opacity: 0.3; border-color: rgba(111, 159, 166, 0.2); }
}

/* ===== モーダル ===== */
.gl-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  background: rgba(2, 2, 3, 0.0);
}

.gl-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.gl-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(2, 2, 3, 0.94);
}

.gl-modal__content {
  position: relative;
  z-index: 1;
  width: min(92vw, 520px);
  background: #08090b;
  border: 1px solid rgba(111, 159, 166, 0.35);
  transform: scale(0.95);
  transition: transform 0.35s ease;
  overflow: hidden;
  /* ブラウン管風の角丸 */
  border-radius: 4px;
  box-shadow:
    0 0 40px rgba(0, 0, 0, 0.8),
    0 0 1px rgba(111, 159, 166, 0.3) inset;
}

.gl-modal.is-open .gl-modal__content {
  transform: scale(1);
}

/* モーダル上部バー */
.gl-modal__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #040506;
  border-bottom: 1px solid rgba(111, 159, 166, 0.15);
}

.gl-modal__cam-id {
  font-family: "Space Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: #6F9FA6;
  text-shadow: 0 0 4px rgba(111, 159, 166, 0.5);
}

.gl-modal__bar-time {
  font-family: "Space Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: rgba(180, 220, 200, 0.4);
}

.gl-modal__close {
  background: none;
  border: none;
  color: rgba(111, 159, 166, 0.6);
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
  transition: color 0.2s ease;
}

.gl-modal__close:hover {
  color: #fafafa;
}

/* モーダル画像エリア */
.gl-modal__img-wrap {
  position: relative;
  overflow: hidden;
  background: #020203;
}

.gl-modal__img {
  width: 100%;
  height: auto;
  display: block;
  
}

/* モーダルにも走査線 */


/* モーダルにもビネット */




/* モーダル下部情報 */
.gl-modal__info {
  padding: 10px 14px 14px;
  border-top: 1px solid rgba(111, 159, 166, 0.12);
}

.gl-modal__title {
  font-family: "Space Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: #6F9FA6;
  margin-bottom: 4px;
  text-shadow: 0 0 4px rgba(111, 159, 166, 0.4);
}

.gl-modal__desc {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(180, 220, 200, 0.4);
}

/* ===== Back to Top・フッター ===== */
.gl-footer {
  width: 393px;
  margin: 0 auto;
  padding: 40px 10px 40px;
  text-align: center;
  border-top: 1px solid rgba(111, 159, 166, 0.1);
}

.gl-back-top {
  display: inline-block;
  padding: 10px 32px;
  font-family: "Space Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.3em;
  color: #2f3440;
  text-decoration: none;
  text-transform: uppercase;
  border: 1px solid #2f3440;
  outline: 1px solid #2f3440;
  outline-offset: 4px;
  position: relative;
  overflow: hidden;
  transition: color 0.4s ease;
  margin-bottom: 24px;
}

.gl-back-top::before {
  content: "";
  position: absolute;
  inset: 0;
  background: #2f3440;
  transform: translateY(100%);
  transition: transform 0.4s ease;
  z-index: 0;
}

.gl-back-top:hover::before { transform: translateY(0); }
.gl-back-top:hover { color: #fafafa; }

.gl-back-top span {
  position: relative;
  z-index: 1;
}

.gl-footer__copy {
  font-family: "Space Mono", monospace;
  font-size: 8px;
  letter-spacing: 0.1em;
  color: rgba(111, 159, 166, 0.35);
  margin-top: 16px;
}

/* ===== レスポンシブ ===== */
@media (min-width: 768px) {
 .gl-main   { width: 700px; max-width: none; padding: 20px 0 80px; }
.gl-footer { width: 700px; max-width: none; }

  .gl-header__status { right: 80px; }
  .gl-status__rec,
  .gl-status__time   { font-size: 9px; }

  .gl-overlay__cam   { font-size: 9px; }
  .gl-overlay__time  { font-size: 8px; }

  .gl-monitor-bar__label,
  .gl-monitor-bar__count,
  .gl-monitor-bar__date { font-size: 8px; }
}

@media (min-width: 1024px) {
  .gl-main   { width: 960px; max-width: none; padding: 24px 0 100px; }
.gl-footer { width: 960px; max-width: none; }

  .gl-header         { padding: 100px 20px 50px; }
  .gl-header__title  { font-size: 48px; }
  .gl-header__status { right: 100px; top: 24px; }
  .gl-status__rec,
  .gl-status__time   { font-size: 11px; }

  .gl-modal__content { width: min(80vw, 720px); }
  .gl-overlay__cam   { font-size: 11px; }
  .gl-overlay__time  { font-size: 9px; }

}

@media (prefers-reduced-motion: reduce) {
  .gl-cell__screen::before,
  .gl-cell__screen,
  .gl-status__rec {
    animation: none;
    opacity: 1;
  }
}
