@import url(../lower.css);

html {
  box-sizing: border-box;
}

*, *::after, *::before {
  box-sizing: inherit;
}

.mainImg {
  background-image: url(/inc/images/common/bg_head01.jpg);
}

.is-hidden {
  display: none !important;
}


/* ========================================
   L1 タブ
======================================== */
.gallery-tabs-wrap {
  position: relative;
}

/* スクロールヒントはデスクトップでは非表示 */
.gallery-tabs-hint {
  display: none;
}

.gallery-tabs {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid #d0d0d0;
  gap: 0;
  margin-bottom: 0;
}

.gallery-tab {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .6rem 1.1rem;
  border: 1px solid #d0d0d0;
  border-bottom: none;
  background: #fff;
  color: #555;
  font-weight: bold;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  margin-right: 2px;
  margin-bottom: -1px;
  transition: background .15s, color .15s;
  white-space: nowrap;
  font-size: 1rem;
}

.gallery-tab:hover {
  background: #e8f0f8;
  color: #2272ba;
}

/* アクティブタブ：青塗りつぶし */
.gallery-tab.is-active {
  background: #2272ba;
  color: #fff;
  border-color: #2272ba;
  font-weight: bold;
}

/* アイコン切り替え */
.gallery-tab__icon-active { display: none; }
.gallery-tab.is-active .gallery-tab__icon-default { display: none; }
.gallery-tab.is-active .gallery-tab__icon-active { display: block; }

.gallery-tab__icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  vertical-align: middle;
}

.gallery-tab__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media screen and (max-width: 768px) {
  .gallery-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .gallery-tabs::-webkit-scrollbar {
    display: none;
  }
  /* 右端フェード（スクロールできることを示す） */
  .gallery-tabs-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 2px;
    width: 3rem;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, .95));
    pointer-events: none;
  }
  /* スクロールヒントテキスト */
  .gallery-tabs-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin: .3rem 0 0;
    font-size: .85rem;
    color: #888;
  }
  .gallery-tab {
    flex-shrink: 0;
    padding: .5rem .85rem;
    font-size: .95rem;
  }
  .gallery-tab__icon {
    width: 15px;
    height: 15px;
  }
}


/* ========================================
   フィルター（4カラムグリッド式）
======================================== */
.gallery-filter {
  background: #f0f4f8;
  border-top: 2px solid #2272ba;
  border-radius: 0 0 4px 4px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

/* 行グリッド：すべて・グループは1行ずつ縦に積み、リーフは横に並べる */
.gallery-filter__grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  min-height: 56px;
  padding: .3rem 0;
}

/* 共通カラムスタイル */
.gallery-filter__col {
  padding: .6rem .9rem;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* 横仕切り線（左右に余白を設けた擬似要素で描画） */
.gallery-filter__col--all:not(:last-child)::after,
.gallery-filter__col--group:not(:last-child)::after {
  content: '';
  position: absolute;
  right: .9rem;
  left: .9rem;
  bottom: 0;
  height: 1px;
  background: #c4cedd;
}

/* すべて・グループ：1行を占める */
.gallery-filter__col--all,
.gallery-filter__col--group {
  width: 100%;
}

/* グループ */
.gallery-filter__col--group {
  gap: .15rem;
}

/* リーフ（子なし）：横に並べる */
.gallery-filter__col--leaf {
  flex: none;
}

/* L2リーフのラベルはbold */
.gallery-filter__col--leaf .gallery-filter__item {
  font-weight: bold;
}

/* すべて ラベル */
.gallery-filter__all-label {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-weight: bold;
  font-size: .95rem;
  cursor: pointer;
}

/* L2グループラベル */
.gallery-filter__group-label {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .95rem;
  font-weight: bold;
  color: #333;
  cursor: pointer;
}

/* L3サブ行のコンテナ：見出しなしの行は横に並べる */
.gallery-filter__sub-rows {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .9rem;
  margin-top: .35rem;
  padding-left: 1.2em;
}

/* L3サブ行（チェックボックス群）：横並びで折り返す */
.gallery-filter__sub-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .9rem;
}

/* サブラベルありの行：1行を占め、折り返し時も選択肢の頭をそろえる */
.gallery-filter__sub-row--labeled {
  width: 100%;
  padding-left: 4.5em;
}

/* L3サブラベル（ドア、パネルなど）：行の左端に置く */
.gallery-filter__sub-label {
  width: 3.6em;
  flex-shrink: 0;
  margin-left: -4.5em; /* padding-left を打ち消して左端に配置 */
  font-size: .85rem;
  color: #777;
}

/* チェックボックス付きラベル */
.gallery-filter__item {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .95rem;
  color: #333;
  white-space: nowrap;
  cursor: pointer;
}

.gallery-filter__item input,
.gallery-filter__all-label input,
.gallery-filter__group-label input {
  accent-color: #2272ba;
  cursor: pointer;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

@media screen and (max-width: 768px) {
  .gallery-filter__item,
  .gallery-filter__all-label {
    font-size: .92rem;
  }
}


/* ========================================
   コンテンツエリア（グリッド + トレイ）
======================================== */
.gallery-body {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}


/* ========================================
   フォトグリッド
======================================== */
.gallery-grid {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  background: #f5f5f5;
  padding: 10px;
}

@media screen and (max-width: 960px) {
  .gallery-body {
    flex-direction: column;
  }
  .gallery-tray {
    width: 100% !important;
    position: static !important;
  }
  .gallery-tray__list {
    max-height: none !important;
    flex-direction: row !important;
    flex-wrap: wrap;
  }
}

@media screen and (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: .5rem;
  }
}


/* ========================================
   フォトアイテム
======================================== */
.gallery-item {
  position: relative;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.gallery-item.is-filtered-out {
  display: none;
}

/* 選択中のハイライト（画像周囲に枠線） */
.gallery-item.is-selected .gallery-item__thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 3px solid #2272ba;
  pointer-events: none;
}

.gallery-item__thumb {
  position: relative;
  overflow: hidden;
  cursor: url('/inc/images/common/img_cursor-gallery.png'), pointer;
}

.gallery-item__thumb img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  transition: transform .2s;
}

.gallery-item__thumb:hover img {
  transform: scale(1.03);
}

/* 「タップで拡大」バッジ（画像右上に密着） */
.gallery-item__overlay {
  position: absolute;
  top: 10px;
  right: 10px;
  pointer-events: none;
}

.gallery-item__zoom {
  display: inline-block;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: .65rem;
  padding: .2rem .45rem;
  border-radius: 0;
  white-space: nowrap;
}

.gallery-item__title {
  margin: .4rem 0 .4rem;
  font-size: 1rem;
  color: #333;
  line-height: 1.4;
  font-weight: bold;
}

/* 「印刷に追加する」チェックボックス */
.gallery-item__check {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .6rem;
  background: #ebebeb;
  cursor: pointer;
  font-size: .9rem;
  color: #555;
  user-select: none;
  border-radius: 4px;
  margin-top: auto;
}

.gallery-item__check:hover {
  background: #e0e0e0;
}

.gallery-item__checkbox {
  accent-color: #2272ba;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
}

.gallery-item.is-selected .gallery-item__check {
  background: #ddeaf7;
  color: #2272ba;
}

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: #999;
}


/* ========================================
   選択中の写真トレイ（縦向きサイドバー）
======================================== */
.gallery-tray {
  width: 210px;
  flex-shrink: 0;
  border-radius: 4px;
  background: #f0f4f8;
  position: sticky;
  top: 10px;
  overflow: hidden;
}

.gallery-tray__header {
  padding: .55rem .85rem;
  font-size: .95rem;
  color: #333;
  margin: 0;
}

#trayCountNum {
  color: #2272ba;
}

.gallery-tray__list {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.gallery-tray__empty {
  font-size: .9rem;
  color: #aaa;
  text-align: center;
  padding: 1rem 0;
  margin: 0;
}

.tray-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .75rem;
}

.tray-item__img-wrap {
  position: relative;
  flex-shrink: 0;
}

.tray-item__remove {
  position: absolute;
  top: -6px;
  left: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e74c3c;
  color: #fff;
  border: none;
  font-size: .65rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.tray-item__remove:hover {
  background: #c0392b;
}

.tray-item img {
  width: 72px;
  height: 54px;
  object-fit: cover;
  display: block;
}

.tray-item__name {
  font-size: .88rem;
  color: #333;
  line-height: 1.4;
  word-break: break-all;
}

.gallery-tray__footer {
  padding: .75rem;
}

.gallery-tray__print {
  width: 100%;
  padding: .7rem .5rem;
  background: #2272ba;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  transition: background .2s;
}

.gallery-tray__print:hover {
  background: #1a5a9a;
}


/* ========================================
   ライトボックス
======================================== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .88);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__content {
  max-width: 90vw;
  max-height: 90vh;
  text-align: center;
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  width: auto;
}

.lightbox__img {
  max-width: 90vw;
  width: auto;
  max-height: 80vh;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.lightbox__caption {
  color: #eee;
  margin-top: .8rem;
  font-size: 1rem;
  text-align: left;
  width: 100%;
  max-width: 100%;
  word-break: break-word;
}

.lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
}

.lightbox__prev,
.lightbox__next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  padding: 1rem .8rem;
  cursor: pointer;
  transition: background .2s;
}

.lightbox__prev { left: 1rem; }
.lightbox__next { right: 1rem; }

.lightbox__prev:hover,
.lightbox__next:hover {
  background: rgba(255,255,255,.3);
}

@media screen and (max-width: 768px) {
  .lightbox__prev { left: 0; }
  .lightbox__next { right: 0; }
}


/* ========================================
   印刷用エリア（通常は非表示）
======================================== */
.print-area {
  display: none;
}


/* ========================================
   印刷スタイル
======================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 1cm;
  }

  #globalNavi,
  #naviToggle,
  header,
  #main,
  .mainImg,
  .breadCrumb,
  .gallery-tabs,
  .gallery-filter,
  .gallery-body,
  .lightbox,
  footer,
  #pageTop,
  #pageTopSp {
    display: none !important;
  }

  .print-area {
    display: block !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }

  body,
  #container {
    padding: 0 !important;
    margin: 0 !important;
  }

  .print-area__page {
    width: 100%;
    height: 273mm;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
  }

  .print-area__page:not(:last-child) {
    break-after: page;
    page-break-after: always;
  }

  .print-area__grid {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    gap: .5cm;
  }

  .print-area--1 .print-area__grid {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
  }

  .print-area--2 .print-area__grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  .print-area--4 .print-area__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  .print-area__item {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-area__img {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
  }

  .print-area__img img {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
  }

  .print-area__title-name {
    flex: none;
    font-size: 9pt;
    font-weight: bold;
    margin: 3px 0 0;
    line-height: 1.3;
    color: #000;
    overflow-wrap: anywhere;
  }

  .print-area__caption {
    flex: none;
    font-size: 8pt;
    margin: 2px 0 0;
    line-height: 1.3;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
  }

  .print-area__title {
    flex: none;
    font-size: 12pt;
    font-weight: bold;
    margin: 0 0 .3cm;
    padding-bottom: .2cm;
    border-bottom: 1pt solid #333;
    overflow-wrap: anywhere;
  }
}
