:root {
  --gallery-bg: #ffffff;
  --gallery-bg-deep: #ffffff;
  --gallery-ink: #4a2d20;
  --gallery-brown: #61381f;
  --gallery-white: #ffffff;
  --gallery-line: rgba(74, 45, 32, 0.24);
  --gallery-max: 1280px;
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body.gallery-page {
  min-height: 100vh;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: var(--gallery-ink);
  background: var(--gallery-bg);
}

body.gallery-page::before,
body.gallery-page::after {
  content: none;
  display: none;
}

a {
  color: inherit;
}

.gallery-wrap {
  width: min(var(--gallery-max), 95%);
  margin: 0 auto;
}

.gallery-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #ffffff;
  border-bottom: 1px solid rgba(97, 56, 31, 0.12);
  backdrop-filter: blur(6px);
}

.header-row {
  min-height: 90px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.gallery-logo {
  flex: 0 0 auto;
  text-decoration: none;
  display: inline-flex;
  flex-direction: column;
  line-height: 1.1;
}

.gallery-logo strong {
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  letter-spacing: 0.09em;
  font-weight: 700;
}

.gallery-logo small {
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  font-weight: 500;
  opacity: 0.86;
}

.gallery-nav {
  flex: 1;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 34px;
}

.gallery-nav a {
  text-decoration: none;
  font-size: 0.98rem;
  letter-spacing: 0.16em;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  padding-bottom: 3px;
  transition: border-color 0.2s ease;
}

.gallery-nav a:hover,
.gallery-nav a:focus-visible {
  border-bottom-color: var(--gallery-ink);
}

.header-menu {
  flex: 0 0 auto;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.22em;
}

.gallery-main {
  padding: 124px 0 70px;
}

.gallery-title-block {
  margin: 0 auto;
  padding: 22px 20px;
  border: 1px solid rgba(74, 45, 32, 0.18);
  background: #ffffff;
  color: var(--gallery-ink);
  text-align: center;
}

.gallery-title-block h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: 0.2em;
  font-weight: 700;
}

.gallery-filters {
  margin-top: 34px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 24px;
}

.gallery-filters a {
  text-decoration: none;
  font-size: 1rem;
  letter-spacing: 0.14em;
  opacity: 0.86;
}

.gallery-filters a.is-active {
  font-weight: 700;
  opacity: 1;
}

.gallery-grid {
  margin-top: 34px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.gallery-grid.is-empty {
  display: block;
}

.gallery-empty {
  margin: 0;
  padding: 42px 20px;
  border: 1px solid rgba(74, 45, 32, 0.18);
  color: rgba(74, 45, 32, 0.8);
  text-align: center;
}

.gallery-item {
  margin: 0;
  border: 1px solid rgba(74, 45, 32, 0.12);
  background: #ffffff;
}

.gallery-item.is-clickable {
  cursor: zoom-in;
}

.gallery-item.is-clickable:focus-visible {
  outline: 2px solid rgba(74, 45, 32, 0.55);
  outline-offset: 2px;
}

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

.gallery-item.is-clickable:hover img,
.gallery-item.is-clickable:focus-visible img {
  transform: scale(1.02);
}

body.gallery-lightbox-open {
  overflow: hidden;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
  background: rgba(11, 9, 7, 0.9);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.gallery-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.gallery-lightbox-dialog {
  width: min(1200px, 100%);
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-lightbox-image {
  width: auto;
  max-width: 100%;
  max-height: 90vh;
  height: auto;
  display: block;
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: #ffffff;
}

.gallery-lightbox-close {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 1;
  border: 0;
  background: transparent;
  color: #ffffff;
  font-size: 2.4rem;
  line-height: 1;
  cursor: pointer;
}

.gallery-lightbox-close:hover,
.gallery-lightbox-close:focus-visible {
  opacity: 0.82;
}

@media (max-width: 1040px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 800px) {
  .header-row {
    min-height: 76px;
    gap: 12px;
  }

  .gallery-nav {
    display: none;
  }
}

@media (max-width: 640px) {
  .gallery-main {
    padding-top: 94px;
  }

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

  .gallery-title-block {
    padding: 16px 12px;
  }

  .gallery-filters {
    margin-top: 20px;
    gap: 10px 16px;
  }

  .gallery-lightbox {
    padding: 2.5vh 3vw;
  }

  .gallery-lightbox-image {
    max-height: 84vh;
  }
}
