/* ギャラリー（style.css に追加で読み込む） */

/* ---------- トップ：分類のタイル ---------- */
.g-group { padding-block: 8px 28px; }
.g-group-title {
  margin: 0 0 14px;
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
}
.g-group-title::before {
  content: "";
  display: inline-block;
  width: .5em;
  height: .5em;
  margin-right: .45em;
  border-radius: 50%;
  background: var(--star);
  vertical-align: .14em;
}
.g-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.g-tiles--wide { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.g-tile {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--night);
  border-radius: var(--radius);
  color: #fff;
  text-decoration: none;
}
.g-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s;
}
.g-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10, 16, 28, .85), rgba(10, 16, 28, 0) 55%);
}
.g-tile-name, .g-tile-count { position: absolute; z-index: 1; left: 14px; }
.g-tile-name { bottom: 30px; font-family: var(--font-round); font-weight: 700; font-size: 1.15rem; }
.g-tile-count { bottom: 10px; color: #dfe6ef; font-size: .8rem; }
.g-tile:hover { color: #fff; }
.g-tile:hover img { transform: scale(1.04); }

/* ---------- 分類ページ：画像の一覧（縦横比を保ったまま段組み） ---------- */
.g-section { padding-bottom: 8px; }
.g-grid { columns: 3 260px; column-gap: 18px; }
.g-item {
  display: inline-block;
  width: 100%;
  margin: 0 0 18px;
  break-inside: avoid;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
}
.g-link { display: block; background: var(--night); }
.g-link img { width: 100%; height: auto; }
.g-item figcaption { padding: 12px 14px 14px; font-size: .9rem; line-height: 1.6; }
.g-title { display: block; font-weight: 700; }
.g-title .tag { margin-left: 6px; vertical-align: 1px; }
.g-date { display: block; margin-top: 2px; color: var(--muted); font-size: .82rem; }
.g-item details { margin-top: 8px; font-size: .82rem; }
.g-item summary { color: var(--sea-dark); cursor: pointer; font-weight: 700; }
.g-item details ul { margin: 6px 0 0; padding-left: 1.1em; color: var(--muted); }
.g-back { text-align: center; }

/* ---------- 拡大表示 ---------- */
.g-viewer {
  width: min(1200px, 96vw);
  max-height: 94vh;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: #0b111d;
  color: var(--night-ink);
}
.g-viewer::backdrop { background: rgba(5, 8, 14, .85); }
.g-viewer-inner { display: flex; flex-direction: column; max-height: 94vh; }
.g-viewer-img { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; padding: 12px; }
.g-viewer-img img { max-width: 100%; max-height: 72vh; width: auto; height: auto; border-radius: 8px; }
.g-viewer-cap { padding: 4px 20px 18px; font-size: .88rem; overflow-y: auto; }
.g-viewer-cap h2 { margin: 0 0 4px; font-size: 1.05rem; color: #fff; }
.g-viewer-cap p { margin: 0; max-width: none; color: var(--night-muted); white-space: pre-line; }
.g-viewer-bar { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 12px 0; }
.g-viewer-bar button, .g-viewer-bar a {
  display: inline-flex;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: .88rem;
  text-decoration: none;
  cursor: pointer;
}
.g-viewer-bar button:hover, .g-viewer-bar a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.g-viewer :focus-visible { outline-color: var(--night-link); }
