/* =========================================================
   Gallery page - refined luxury layout
   CSS path: /css/gallery.css
   HTML path: /gallery/index.html
   ========================================================= */

#gallery {
  --gallery-navy: #0c0b3a;
  --gallery-ink: #1d1b22;
  --gallery-muted: #68636d;
  --gallery-gold: #b89656;
  --gallery-bg: #faf8f3;
  --gallery-card: #ffffff;
  --gallery-line: rgba(12, 11, 58, 0.12);
  --gallery-shadow: 0 18px 45px rgba(25, 18, 8, 0.12);
  color: var(--gallery-ink);
}


/* ===== PC・タブレット表示崩れ対策 ===== */
#gallery,
#gallery * {
  box-sizing: border-box;
}

#gallery img {
  max-width: 100%;
}

.gallery-main {
  background:
    radial-gradient(circle at top left, rgba(184,150,86,0.16), transparent 34%),
    linear-gradient(180deg, #fff 0%, var(--gallery-bg) 100%);
}

.gallery-pageHeader {
  background:
    linear-gradient(135deg, rgba(12,11,58,0.95), rgba(38,31,55,0.9)),
    url(../images/course-bg.gif);
}

.gallery-pageHeader .hdg-2 {
  color: #fff;
  letter-spacing: 0.08em;
}

#gallery .gallery-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 440px);
  gap: 36px;
  align-items: center;
  margin: 28px 0 28px;
  padding: 34px;
  border: 1px solid rgba(184, 150, 86, 0.32);
  border-radius: 26px;
  background: linear-gradient(135deg, #fff, #f4efe6);
  box-shadow: var(--gallery-shadow);
  overflow: hidden;
  position: relative;
}

#gallery .gallery-hero::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(184, 150, 86, 0.2);
  border-radius: 20px;
  pointer-events: none;
}

#gallery .gallery-hero__eyebrow,
#gallery .gallery-section__eyebrow {
  margin: 0 0 10px;
  color: var(--gallery-gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

#gallery .gallery-hero h2 {
  margin: 0 0 18px;
  color: var(--gallery-navy);
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.25;
  letter-spacing: 0.04em;
  border: 0;
}

#gallery .gallery-hero p:last-child {
  max-width: 620px;
  margin: 0;
  color: var(--gallery-muted);
  font-size: 15px;
  line-height: 2;
}

#gallery .gallery-hero__image {
  position: relative;
  z-index: 1;
  width: 100%;
  transform: none;
  transform-origin: center;
}

#gallery .gallery-hero__image img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 22px;
  box-shadow: 0 24px 45px rgba(12, 11, 58, 0.22);
}

#gallery .gallery-nav {
  margin: 0 0 42px;
  padding: 20px 22px;
  border-radius: 18px;
  background: rgba(255,255,255,0.82);
  border: 1px solid var(--gallery-line);
  box-shadow: 0 10px 28px rgba(12, 11, 58, 0.06);
}

#gallery .gallery-nav p {
  margin: 0 0 12px;
  color: var(--gallery-navy);
  font-weight: 700;
  letter-spacing: 0.08em;
}

#gallery .gallery-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
}

#gallery .gallery-nav li {
  list-style: none;
}

#gallery .gallery-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 13px;
  color: var(--gallery-navy);
  border: 1px solid rgba(12, 11, 58, 0.16);
  border-radius: 999px;
  background: #fff;
  text-decoration: none;
  transition: transform .25s ease, background-color .25s ease, color .25s ease, border-color .25s ease;
}

#gallery .gallery-nav a:hover {
  transform: translateY(-2px);
  color: #fff;
  border-color: var(--gallery-navy);
  background: var(--gallery-navy);
}

#gallery .gallery-section {
  margin: 0 0 54px;
  scroll-margin-top: 90px;
}

#gallery .gallery-section__head {
  margin: 0 0 20px;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--gallery-line);
  position: relative;
}

#gallery .gallery-section__head::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 84px;
  height: 1px;
  background: var(--gallery-gold);
}

#gallery .gallery-section h2 {
  margin: 0 0 8px;
  padding: 0;
  color: var(--gallery-navy);
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.35;
  letter-spacing: 0.06em;
  border: 0;
}

#gallery .gallery-section__head p:last-child {
  margin: 0;
  color: var(--gallery-muted);
  line-height: 1.8;
}

#gallery .gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

#gallery .gallery-card {
  display: block;
  margin: 0;
  overflow: hidden;
  border-radius: 18px;
  background: var(--gallery-card);
  box-shadow: 0 12px 34px rgba(12, 11, 58, 0.10);
  transition: transform .35s ease, box-shadow .35s ease;
}

#gallery .gallery-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 46px rgba(12, 11, 58, 0.16);
}

#gallery .gallery-card__link {
  display: block;
  color: inherit;
  text-decoration: none;
}

#gallery .gallery-card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #eee;
  transition: transform .6s ease;
}

#gallery .gallery-card:hover img {
  transform: scale(1.045);
}

#gallery .gallery-card figcaption {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--gallery-navy), #211d48);
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.04em;
}

#gallery .gallery-card figcaption span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 表示枚数：PC・タブレットは各ジャンル6点まで */
#gallery .gallery-grid .gallery-card:nth-child(n+7) {
  display: none;
}

#gallery .article_footer {
  margin-top: 62px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(12, 11, 58, 0.08);
}

@media screen and (max-width: 1100px) {
  #gallery .gallery-hero {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
    gap: 28px;
    padding: 28px;
  }

  #gallery .gallery-hero h2 {
    font-size: clamp(26px, 3.4vw, 38px);
  }

  #gallery .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
}

@media screen and (max-width: 900px) {
  #gallery .gallery-hero {
    grid-template-columns: 1fr;
  }

  #gallery .gallery-hero__image {
    max-width: 360px;
    margin: 0 auto;
  }
}

@media screen and (max-width: 767px) {
  #gallery .gallery-hero {
    grid-template-columns: 1fr;
    padding: 26px 20px;
    gap: 22px;
    border-radius: 20px;
  }

  #gallery .gallery-hero::before {
    inset: 10px;
    border-radius: 16px;
  }

  #gallery .gallery-hero__image {
    max-width: 340px;
    margin: 0 auto;
    transform: none;
  }

  #gallery .gallery-nav {
    padding: 16px;
    overflow-x: hidden;
  }

  #gallery .gallery-nav ul {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  #gallery .gallery-nav a {
    white-space: nowrap;
  }

  #gallery .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  /* スマホは各ジャンル3点まで */
  #gallery .gallery-grid .gallery-card:nth-child(n+4) {
    display: none;
  }

  #gallery .gallery-card {
    border-radius: 14px;
  }

  #gallery .gallery-card figcaption {
    min-height: 40px;
    padding: 9px 8px;
    font-size: 11px;
    justify-content: center;
    text-align: center;
  }
}

@media screen and (max-width: 380px) {
  #gallery .gallery-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  #gallery .gallery-card figcaption {
    font-size: 10px;
  }
}


/* ===== 画像タップ時の拡大表示：スマホ・タブレットでも画面からはみ出さない ===== */
html.gallery-lightbox-open,
html.gallery-lightbox-open body {
  overflow: hidden;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(8, 7, 24, 0.88);
  backdrop-filter: blur(6px);
}

.gallery-lightbox.is-open {
  display: flex;
}

.gallery-lightbox__inner {
  width: min(1120px, 96vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.gallery-lightbox__image {
  display: block;
  width: auto;
  height: auto;
  max-width: 96vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.gallery-lightbox__caption {
  max-width: min(900px, 92vw);
  margin: 0;
  color: #fff;
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
  letter-spacing: 0.04em;
}

.gallery-lightbox__close {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255,255,255,0.45);
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

@media screen and (max-width: 767px) {
  .gallery-lightbox {
    padding: 12px;
  }

  .gallery-lightbox__inner {
    width: 100%;
    max-height: 88vh;
  }

  .gallery-lightbox__image {
    max-width: 94vw;
    max-height: 74vh;
    border-radius: 10px;
  }

  .gallery-lightbox__caption {
    font-size: 12px;
  }
}


/* ===== パンくずリストの区切りを「TOP ＞ ギャラリー」に統一 ===== */
#breadcrumb ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
}

#breadcrumb li {
  display: flex;
  align-items: center;
}

#breadcrumb li + li::before,
#breadcrumb li + li:before {
  content: "＞" !important;
  display: inline-block;
  margin: 0 0.5em;
  color: #8a7a62;
  font-weight: 400;
}


/* ===== パンくずリスト文字化け対策 =====
   区切り記号はHTMLの &gt; を使用し、既存テーマやアイコンフォントの疑似要素を無効化します。 */
#breadcrumb li::before,
#breadcrumb li::after,
#breadcrumb a::before,
#breadcrumb a::after,
#breadcrumb span::before,
#breadcrumb span::after {
  content: none !important;
  display: none !important;
}

#breadcrumb .breadcrumb-separator {
  display: inline-flex !important;
  align-items: center;
  margin: 0 0.65em;
  color: #8a7a62;
  font-weight: 400;
  line-height: 1;
}

#breadcrumb li + li::before,
#breadcrumb li + li:before {
  content: none !important;
  display: none !important;
}


/* ===== ヒーロー部分：タイトル → 画像 → 文章の縦並びに変更 =====
   以前の横並び調整は使わず、このブロックでヒーロー内だけ縦並びにします。 */
#gallery .gallery-hero.gallery-hero--stacked {
  display: block;
  padding: 34px;
}

#gallery .gallery-hero.gallery-hero--stacked .gallery-hero__text {
  position: relative;
  z-index: 1;
  max-width: 100%;
}

#gallery .gallery-hero.gallery-hero--stacked h2 {
  margin-bottom: 22px;
}

#gallery .gallery-hero.gallery-hero--stacked .gallery-hero__image {
  width: min(100%, 520px);
  max-width: 100%;
  margin: 0 auto 24px;
  transform: none;
}

#gallery .gallery-hero.gallery-hero--stacked .gallery-hero__image img {
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;
  border-radius: 22px;
}

#gallery .gallery-hero.gallery-hero--stacked p:last-child {
  max-width: 100%;
}

@media screen and (max-width: 767px) {
  #gallery .gallery-hero.gallery-hero--stacked {
    padding: 26px 20px;
  }

  #gallery .gallery-hero.gallery-hero--stacked .gallery-hero__image {
    width: 100%;
    margin-bottom: 20px;
  }
}
