/* ============================================================
   CHOUCHOU FILMS — WORKS
   黒背景 × 写真主役のエディトリアルデザイン
   Webフォント不使用（表示速度最優先・日本語システム書体を活用）
   ============================================================ */

:root {
  --bg: #0b0b0c;
  --text: #ece9e3;
  --muted: #8f8a81;
  --line: #232320;
  --gap: clamp(12px, 2.6vw, 34px);
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  --sans: "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic Medium", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: #333 var(--bg); }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.7;
}
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; background: none; border: none; color: inherit; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--text); color: var(--bg); }

/* ---------- 固定ヘッダー（スクロールでコンパクトに縮む） ---------- */
.site-top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11,11,12,.9);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .4s ease;
}
.site-top.is-scrolled { border-bottom-color: var(--line); }

.site-head {
  padding: clamp(24px, 4.5vw, 48px) var(--gap) clamp(6px, 1.2vw, 14px);
  max-width: 1600px;
  margin: 0 auto;
  transition: padding .35s ease;
}
.is-scrolled .site-head { padding-top: 14px; padding-bottom: 2px; }

.brand {
  display: inline-block;
  font-size: 11px;
  letter-spacing: .42em;
  color: var(--muted);
  transition: color .4s, font-size .35s ease;
}
.brand:hover { color: var(--text); }
.is-scrolled .brand { font-size: 9.5px; }

.head-title {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin-top: clamp(20px, 3.5vw, 42px);
  transition: margin .35s ease;
}
.is-scrolled .head-title { margin-top: 6px; }

.title-en {
  font-family: var(--sans);
  font-weight: 200;
  font-size: clamp(38px, 7vw, 76px);
  letter-spacing: .22em;
  line-height: 1;
  transition: font-size .35s ease, letter-spacing .35s ease;
}
.is-scrolled .title-en { font-size: 19px; letter-spacing: .3em; }

.title-jp {
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: .5em;
  color: var(--muted);
  writing-mode: vertical-rl;
  height: 4.6em;
  transform: translateY(4px);
  transition: opacity .25s ease;
}
.is-scrolled .title-jp { opacity: 0; height: 0; overflow: hidden; }

/* ---------- 絞り込みタブ（横スクロール・スマホはスワイプでも切替） ---------- */
.filters {
  max-width: 1600px;
  margin: 0 auto;
  padding: 8px var(--gap) clamp(12px, 1.8vw, 18px);
  display: flex;
  flex-wrap: nowrap;
  gap: 26px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }

.filter {
  flex: 0 0 auto;
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: .18em;
  color: var(--muted);
  padding: 6px 2px;
  position: relative;
  transition: color .4s;
}
.filter::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: 2px;
  height: 1px;
  background: var(--text);
  transition: right .45s cubic-bezier(.22,.61,.36,1);
}
.filter:hover { color: var(--text); }
.filter.is-active { color: var(--text); }
.filter.is-active::after { right: 0; }

/* ---------- ギャラリー（Masonry） ---------- */
main {
  max-width: 1600px;
  margin: 0 auto;
  padding: clamp(18px, 2.5vw, 30px) var(--gap) clamp(60px, 8vw, 110px);
}

/* JS適用前のフォールバック（CSS columns） */
.grid { columns: 2; column-gap: var(--gap); }
@media (min-width: 1024px) { .grid { columns: 3; } }

/* JSが列を組んだあとの本レイアウト */
.grid.is-built {
  columns: auto;
  display: flex;
  gap: var(--gap);
  align-items: flex-start;
}
.grid.is-built .col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.item {
  break-inside: avoid;
  margin-bottom: var(--gap);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .9s ease, transform .9s ease;
}
.grid.is-built .item { margin-bottom: 0; }
.item.in { opacity: 1; transform: none; }
.item.f-hide { display: none; }

.ph {
  position: relative;
  overflow: hidden;
  background: #141415;
  cursor: pointer;
}
.ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s cubic-bezier(.22,.61,.36,1), filter .6s ease;
}

.multi-badge {
  position: absolute;
  top: clamp(10px, 1.6vw, 16px);
  right: clamp(10px, 1.6vw, 16px);
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  letter-spacing: .08em;
  color: rgba(236,233,227,.92);
  background: rgba(10,10,11,.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  padding: 4px 9px 4px 7px;
  border-radius: 20px;
  pointer-events: none;
}

/* ホバー / タップ時の情報表示 */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: clamp(14px, 2vw, 22px);
  background: linear-gradient(to top, rgba(5,5,6,.62) 0%, rgba(5,5,6,.18) 42%, transparent 65%);
  opacity: 0;
  transition: opacity .55s ease;
  pointer-events: none;
}
.ov-cat {
  font-family: var(--serif);
  font-size: clamp(13px, 1.4vw, 15px);
  letter-spacing: .26em;
  text-shadow: 0 1px 8px rgba(0,0,0,.5);
}
.ov-date {
  font-size: 10.5px;
  letter-spacing: .22em;
  color: rgba(236,233,227,.72);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

@media (hover: hover) {
  .ph:hover img { transform: scale(1.035); filter: brightness(.68); }
  .ph:hover .overlay { opacity: 1; }
}
/* タッチ端末：1タップ目で情報表示 */
.item.show-info img { filter: brightness(.68); }
.item.show-info .overlay { opacity: 1; }

/* ---------- 空のとき ---------- */
.coming-soon {
  text-align: center;
  padding: 18vh 20px;
  font-weight: 200;
  font-size: clamp(20px, 4vw, 30px);
  letter-spacing: .5em;
  color: var(--muted);
}

/* ---------- フッター ---------- */
.site-foot {
  border-top: 1px solid var(--line);
  padding: 34px var(--gap) 44px;
  text-align: center;
}
.site-foot a {
  font-size: 10.5px;
  letter-spacing: .34em;
  color: var(--muted);
  transition: color .4s;
}
.site-foot a:hover { color: var(--text); }

/* ---------- ライトボックス（作品グループの複数写真を閲覧） ---------- */
.lightbox[hidden] { display: none; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6,6,7,.975);
  display: flex;
  flex-direction: column;
  animation: lb-in .3s ease;
}
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }

/* スマホでの背景スクロール暴発を防ぐ */
body.lb-open {
  position: fixed;
  left: 0; right: 0;
  overflow: hidden;
  width: 100%;
}

.lb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(14px, 3vw, 26px) 8px;
  flex: 0 0 auto;
}
.lb-info {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  font-family: var(--serif);
}
.lb-title {
  font-size: 13px;
  letter-spacing: .14em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-counter {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.lb-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.lb-track {
  display: flex;
  height: 100%;
  transition: transform .38s cubic-bezier(.22,.61,.36,1);
}
.lb-slide {
  flex: 0 0 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(10px, 3vw, 40px);
  overflow: auto;                 /* ピンチズーム後にはみ出た分を操作可能に */
  touch-action: pan-x pan-y pinch-zoom;
}
.lb-slide img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 20px 80px rgba(0,0,0,.55);
  margin: auto;
  touch-action: pinch-zoom;       /* スマホ標準のピンチズームを許可 */
}

.lb-caption {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 16px 6px;
  font-family: var(--serif);
  font-size: 12.5px;
  letter-spacing: .24em;
}
.lb-sep { width: 22px; height: 1px; background: var(--muted); }
#lbDate {
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: .2em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* サムネイル行（写真が2枚以上のときだけ表示） */
.lb-thumbs[hidden] { display: none; }
.lb-thumbs {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 4px clamp(14px, 3vw, 26px) clamp(14px, 2.5vw, 20px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.lb-thumbs::-webkit-scrollbar { display: none; }
.lb-thumb {
  flex: 0 0 auto;
  width: 52px; height: 52px;
  border-radius: 5px;
  overflow: hidden;
  padding: 0;
  opacity: .4;
  transition: opacity .25s, outline-color .25s;
  outline: 1.5px solid transparent;
  outline-offset: 1px;
}
.lb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lb-thumb.is-active { opacity: 1; outline-color: var(--text); }
.lb-thumb:hover { opacity: .75; }

.lb-close, .lb-prev, .lb-next {
  color: rgba(236,233,227,.6);
  transition: color .3s;
  z-index: 2;
  line-height: 1;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { color: var(--text); }
.lb-close {
  flex: 0 0 auto;
  font-size: 18px;
  padding: 10px;
  min-width: 44px; min-height: 44px;   /* タップしやすい面積を確保 */
  display: flex; align-items: center; justify-content: center;
}
.lb-prev, .lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 36px;
  font-weight: 100;
  padding: 16px 14px;
}
.lb-prev { left: 2px; }
.lb-next { right: 2px; }

@media (hover: none) {
  .lb-prev, .lb-next { display: none; } /* スマホはスワイプで操作 */
  .lb-thumb { width: 46px; height: 46px; }
}

/* ---------- アクセシビリティ / 動きを減らす設定 ---------- */
:focus-visible { outline: 1px solid var(--text); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .item { opacity: 1; transform: none; }
}
