/* ============================================================
   EN STUDIO WORKS — Gallery Pages CSS
   ============================================================ */

/* ---------- Reset & Base（style.cssと共通変数を引き継ぐ） ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-bg:        #f7f6f4;
  --c-surface:   #ffffff;
  --c-ink:       #1c1c1a;
  --c-ink-mid:   #4a4a47;
  --c-ink-faint: #8a8a86;
  --c-rule:      rgba(28,28,26,.1);
  --c-tq:        #3d9c99;

  --f-sans:  'Shippori Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  --f-serif: 'Shippori Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
  --f-en:    'Cormorant Garamond', Georgia, serif;

  --wrap:     1080px;
  --pad-x:    clamp(1.25rem, 5vw, 3rem);
  --header-h: 60px;
  --ease:     cubic-bezier(.4,0,.2,1);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--f-sans);
  font-weight: 400;
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  line-height: 1.9;
}

img  { display: block; max-width: 100%; height: auto; }
ul, ol { list-style: none; }
a  { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; touch-action: manipulation; }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--pad-x);
}


/* ============================================================
   HEADER（LPと同一デザイン）
   ============================================================ */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 100;
  background: rgba(247,246,244,.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--c-rule);
  transition: box-shadow .3s var(--ease);
}
.site-header.is-scrolled { box-shadow: 0 2px 16px rgba(0,0,0,.06); }

.header-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--pad-x);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-logo {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  flex-shrink: 0;
}
.logo-en {
  font-family: var(--f-en);
  font-size: clamp(.85rem, 2.2vw, 1rem);
  font-weight: 400;
  letter-spacing: .12em;
  color: var(--c-ink);
  white-space: nowrap;
}
.logo-ja {
  font-family: var(--f-sans);
  font-size: clamp(.55rem, 1.3vw, .62rem);
  font-weight: 400;
  letter-spacing: .1em;
  color: var(--c-ink-faint);
  white-space: nowrap;
}

/* ハンバーガー */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 44px;
  height: 44px;
  padding: 8px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--c-ink);
  transition: transform .28s var(--ease), opacity .28s var(--ease);
  transform-origin: center;
}
.hamburger.is-open span:nth-child(1) { transform: translateY(3.75px) rotate(45deg); }
.hamburger.is-open span:nth-child(2) { transform: translateY(-3.75px) rotate(-45deg); }

/* グローバルナビ */
.global-nav ul {
  display: flex;
  gap: .1rem;
  flex-wrap: nowrap;
}
.global-nav a {
  display: block;
  font-family: var(--f-en);
  font-size: clamp(.72rem, 1.2vw, .82rem);
  font-weight: 400;
  letter-spacing: .1em;
  color: var(--c-ink-mid);
  padding: .4em .65em;
  transition: color .2s var(--ease);
  white-space: nowrap;
}
.global-nav a:hover,
.global-nav a.is-current { color: var(--c-tq); }


/* ============================================================
   PAGE HERO（ジャンルタイトルエリア）
   ============================================================ */
.gallery-hero {
  padding-top: var(--header-h);
  padding-bottom: 0;
  border-bottom: 1px solid var(--c-rule);
}
.gallery-hero-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 3.5rem var(--pad-x) 2.8rem;
}
.gallery-back {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  font-family: var(--f-en);
  font-size: .75rem;
  letter-spacing: .1em;
  color: var(--c-ink-faint);
  margin-bottom: 1.8rem;
  transition: color .2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.gallery-back:hover { color: var(--c-tq); }
.gallery-back svg { width: 14px; height: 14px; }

.gallery-label {
  display: block;
  font-family: var(--f-en);
  font-size: .72rem;
  font-weight: 400;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--c-tq);
  margin-bottom: .7rem;
}
.gallery-title {
  font-family: var(--f-serif);
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: .04em;
  color: var(--c-ink);
}
.gallery-count {
  margin-top: .8rem;
  font-family: var(--f-en);
  font-size: .78rem;
  letter-spacing: .1em;
  color: var(--c-ink-faint);
}


/* ============================================================
   GALLERY GRID
   ============================================================ */
.gallery-section {
  padding: 3rem 0 6rem;
}

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

/* 各写真アイテム — 全て1:1正方形に統一 */
.gallery-item {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: #e8e6e2;
  -webkit-tap-highlight-color: transparent;
  aspect-ratio: 1 / 1; /* 全アイテム正方形 */
}

/* portrait / landscape / wide はグリッド上では正方形に上書き */
.gallery-item--portrait,
.gallery-item--landscape {
  aspect-ratio: 1 / 1;
}
.gallery-item--wide {
  aspect-ratio: 1 / 1;
  grid-column: span 1; /* wideも1セル扱い */
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center; /* 被写体を中央でクロップ */
  display: block;
  transition: transform .55s cubic-bezier(.25,.46,.45,.94);
}
.gallery-item:hover img { transform: scale(1.04); }

/* プレースホルダー */
.gallery-item--placeholder {
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eceae6;
}
.gallery-item--placeholder::after {
  content: "+";
  font-family: var(--f-en);
  font-size: 1.8rem;
  font-weight: 300;
  color: #c8c6c2;
}


/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(10,10,8,.96);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease);
  touch-action: none;
}
.lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-img-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 元の縦横比を維持しつつ画面内に収める */
  max-width: min(92vw, 1080px);
  max-height: 88vh;
}
.lightbox-img {
  display: block;
  /* 元アスペクト比を保って最大サイズで表示 */
  max-width: 100%;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 1px;
  user-select: none;
  -webkit-user-drag: none;
  box-shadow: 0 8px 48px rgba(0,0,0,.5);
}

/* 閉じるボタン */
.lightbox-close {
  position: fixed;
  top: 1.2rem;
  right: 1.2rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.7);
  font-size: 1.4rem;
  transition: color .2s var(--ease);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.lightbox-close:hover { color: #fff; }

/* 前後ナビ */
.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.6);
  font-size: 1.6rem;
  transition: color .2s var(--ease);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.lightbox-prev { left: .6rem; }
.lightbox-next { right: .6rem; }
.lightbox-prev:hover,
.lightbox-next:hover { color: #fff; }

/* カウンター */
.lightbox-counter {
  position: fixed;
  bottom: 1.4rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--f-en);
  font-size: .75rem;
  letter-spacing: .12em;
  color: rgba(255,255,255,.4);
}

/* スワイプ中アニメーション */
.lightbox-img.is-swiping {
  transition: transform .15s var(--ease);
}


/* ============================================================
   EMPTY STATE（写真0枚時）
   ============================================================ */
.gallery-empty {
  padding: 6rem var(--pad-x);
  text-align: center;
  max-width: var(--wrap);
  margin: 0 auto;
}
.gallery-empty p {
  font-size: .88rem;
  color: var(--c-ink-faint);
  line-height: 2;
  letter-spacing: .04em;
}


/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  padding: 2.4rem 0;
  background: #141412;
}
.footer-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--pad-x);
  display: flex;
  flex-direction: column;
  gap: .9rem;
  align-items: center;
  text-align: center;
}
.footer-name {
  font-family: var(--f-en);
  font-size: .82rem;
  letter-spacing: .12em;
  color: rgba(255,255,255,.35);
}
.footer-nav {
  display: flex;
  gap: .5rem 1.4rem;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-nav a {
  font-size: .72rem;
  letter-spacing: .1em;
  color: rgba(255,255,255,.25);
  transition: color .2s var(--ease);
}
.footer-nav a:hover { color: rgba(255,255,255,.6); }
.footer-copy {
  font-size: .65rem;
  letter-spacing: .08em;
  color: rgba(255,255,255,.2);
}


/* ============================================================
   RESPONSIVE — タブレット (≤860px)
   ============================================================ */
@media (max-width: 860px) {
  .global-nav { display: none; }
  .hamburger  { display: flex; }

  .global-nav.is-open {
    display: block;
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0; bottom: 0;
    background: rgba(247,246,244,.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 2rem var(--pad-x);
    z-index: 99;
    overflow-y: auto;
  }
  .global-nav.is-open ul { flex-direction: column; gap: 0; }
  .global-nav.is-open a {
    display: flex;
    align-items: center;
    font-size: 1.05rem;
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--c-rule);
    min-height: 48px;
  }

  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
  .gallery-item--wide { grid-column: span 1; }

  .lightbox-prev { left: .3rem; }
  .lightbox-next { right: .3rem; }
}


/* ============================================================
   RESPONSIVE — スマホ (≤560px)
   ============================================================ */
@media (max-width: 560px) {
  :root {
    --pad-x: 1rem;
    --header-h: 56px;
  }

  .gallery-hero-inner { padding: 2.5rem var(--pad-x) 2rem; }
  .gallery-title { font-size: 1.5rem; }
  .gallery-section { padding: 2rem 0 5rem; }

  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
  }
  /* スマホでも正方形・1セル */
  .gallery-item--wide {
    grid-column: span 1;
    aspect-ratio: 1 / 1;
  }

  /* ライトボックスのナビを小さく */
  .lightbox-prev,
  .lightbox-next {
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
  }
  .lightbox-prev { left: 0; }
  .lightbox-next { right: 0; }

  .logo-ja { display: none; }
}


/* ============================================================
   RESPONSIVE — 極小 (≤380px)
   ============================================================ */
@media (max-width: 380px) {
  :root { --pad-x: .85rem; }
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
  .gallery-item--wide { grid-column: span 1; aspect-ratio: 1 / 1; }
}
