@font-face {
  font-family: "Noto Sans JP";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/noto-sans-jp-400.woff2") format("woff2");
}

@font-face {
  font-family: "Noto Sans JP";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/noto-sans-jp-700.woff2") format("woff2");
}

:root {
  --accent: #4b7697;
  --accent-red: #f23a3c;
  --ink: #333333;
  /* Matches the exact top color of bg-extended.jpg's gradient fill, so on
     very narrow/short viewports where even the extended image doesn't
     reach the top of the screen, the plain body fallback color continues
     the gradient's own starting tone instead of showing as a second,
     visibly different band above it. */
  --paper: #dccfba;
  --gap-pc: 20px;
  --gap-sp: 14px;
}

* { box-sizing: border-box; }

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

body {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: var(--ink);
  background-color: var(--paper);
  /* bg-extended.jpg is bg.jpg with extra (tiled, seam-free) texture added
     above the artwork so a single fixed, bottom-anchored layer stays tall
     enough to cover any viewport at 100% width without a visible seam. */
  background-image: url("../images/bg-extended.jpg");
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: 100% auto;
  background-attachment: fixed;
  min-height: 100vh;
}

@supports (-webkit-touch-callout: none) {
  /* iOS Safari renders fixed backgrounds unreliably; fall back to normal
     scrolling so the bottom-anchored position still applies. */
  body {
    background-attachment: scroll;
  }
}

a { color: inherit; }

/* ---------- Header ---------- */

.site-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 16px 8px;
  text-align: center;
}

.logo-link {
  display: inline-block;
}

.logo {
  display: block;
  width: auto;
  height: clamp(68px, 9.5vw, 116px);
  max-width: 80vw;
  object-fit: contain;
}

.site-subtitle {
  margin: 10px 0 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--ink);
  opacity: 0.75;
}

.site-nav {
  text-align: center;
  padding: 4px 16px 24px;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.site-nav a {
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
}

.site-nav a:hover {
  color: var(--accent);
}

.nav-sep {
  margin: 0 10px;
  opacity: 0.5;
}

/* ---------- Gallery grid ---------- */

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--gap-pc) 60px;
}

/* Below 1200px there's no outer margin around main for the fixed
   background to show through, so its own side padding IS the only gutter.
   At the old fixed 14px/10px that gutter was too narrow to reveal more
   than a stray-looking scrap of the artwork; scaling it with viewport
   width instead gives enough room for a recognizable slice, the same way
   the wide desktop margin does. */
@media (max-width: 1199.98px) {
  main {
    padding-left: clamp(24px, 7vw, 72px);
    padding-right: clamp(24px, 7vw, 72px);
  }
}

.gallery {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--gap-pc);
}

@media (max-width: 1199.98px) {
  .gallery {
    grid-template-columns: repeat(4, 1fr);
  }
}

.gallery-item {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.06);
  cursor: pointer;
  padding: 0;
  border: none;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.3s ease;
}

.gallery-item img.is-loaded {
  opacity: 1;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.sentinel {
  height: 1px;
}

.empty-message {
  text-align: center;
  padding: 60px 20px;
  font-size: 14px;
  opacity: 0.7;
}

@media (max-width: 767px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--gap-sp);
  }
  main {
    padding: 0 var(--gap-sp) 40px;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  text-align: center;
  padding: 24px 16px 40px;
  font-size: 11px;
  opacity: 0.7;
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.92);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] {
  display: none;
}

.lb-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 70px;
}

#lb-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.35s ease, transform 0.35s ease;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

#lb-image.is-visible {
  opacity: 1;
  transform: scale(1);
}

.lb-close,
.lb-prev,
.lb-next {
  position: absolute;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 14px;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.lb-close:hover,
.lb-prev:hover,
.lb-next:hover {
  opacity: 1;
}

.lb-close {
  top: 8px;
  right: 8px;
  font-size: 34px;
  z-index: 2;
}

.lb-prev {
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
}

.lb-next {
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 22px;
}

.lb-counter {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  color: #fff;
  font-size: 12px;
  opacity: 0.8;
  letter-spacing: 0.1em;
  margin: 0;
}

@media (max-width: 767px) {
  .lb-stage {
    padding: 40px 16px;
  }
  .lb-prev { left: 0; }
  .lb-next { right: 0; }
}
