:root {
  --scene-ratio: 8033 / 5547;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #e6e6e6;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.stage {
  width: 100%;
  margin: 0;
}

.scene {
  position: relative;
  width: 100%;
  aspect-ratio: var(--scene-ratio);
  overflow: hidden;
}

.navbar {
  position: absolute;
  top: 5.4%;
  left: 4.8%;
  right: 4.8%;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: #fff;
  flex-shrink: 0;
}

.brand-logo {
  width: clamp(44px, 4.5vw, 68px);
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
}

.brand-text {
  font-size: clamp(0.56rem, 0.9vw, 0.84rem);
  line-height: 1.25;
  letter-spacing: 0.24em;
  white-space: nowrap;
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 0.35rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 6;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2.5px;
  background: #fff;
  border-radius: 1.5px;
  transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(10px, 10px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

.menu-close {
  display: none;
}

.menu {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.menu a {
  color: #fff;
  text-decoration: none;
  font-size: clamp(0.74rem, 1.05vw, 1.05rem);
  letter-spacing: 0.08em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
}

.menu a + a::before {
  content: "|";
  margin-right: 0.75rem;
  color: #fff;
  opacity: 0.95;
}

.layer {
  position: absolute;
  display: block;
  user-select: none;
  pointer-events: none;
}

.base {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.top-text {
  top: 15%;
  left: 14%;
  width: 36%;
}

.title-text {
  top: 36.5%;
  left: 55%;
  width: 21%;
}

.home-subtitle {
  top: 44%;
  left: 51.6%;
  width: 24%;
}

.cat-corner {
  position: relative;
  background: #f8b02f;
  padding: clamp(4.8rem, 8vw, 7.2rem) clamp(1rem, 5vw, 3rem)
    clamp(1.8rem, 4vw, 3rem);
}

.cat-corner::before {
  content: "";
  position: absolute;
  top: -20px;
  left: 0;
  width: 100%;
  height: 20px;
  background: radial-gradient(
      ellipse 36px 20px at 36px 20px,
      #f8b02f 99%,
      transparent 100%
    )
    0 0 / 72px 20px repeat-x;
}

.cat-corner-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.8rem, 2vw, 1.6rem);
  max-width: 630px;
  margin: 0 auto;
}

.cat-corner-art {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cat-corner-cats {
  width: min(100%, 310px);
  display: block;
}

.cat-corner-en {
  margin-top: 0.65rem;
  width: min(100%, 200px);
  display: block;
}

.cat-corner-title {
  width: min(100%, 220px);
  display: block;
}

.cat-corner-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.cat-corner-link {
  margin-top: clamp(0.5rem, 1.1vw, 0.9rem);
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #25487c;
  text-decoration: none;
  font-size: clamp(1rem, 1.5vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.cat-corner-link::after {
  content: "▶";
  font-size: 0.9em;
}

.space-illustration {
  position: relative;
  background: #355d99;
  padding: clamp(2.8rem, 6vw, 5rem) clamp(1rem, 5vw, 3rem)
    clamp(3.2rem, 6vw, 5.6rem);
}

.space-illustration::before {
  content: "";
  position: absolute;
  top: -20px;
  left: 0;
  width: 100%;
  height: 20px;
  background: radial-gradient(
      ellipse 36px 20px at 36px 20px,
      #355d99 99%,
      transparent 100%
    )
    0 0 / 72px 20px repeat-x;
}

.space-illustration-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.55rem, 1.4vw, 1rem);
  max-width: 580px;
  margin: 0 auto;
}

.space-illustration-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-top: 0;
}

.space-illustration-title {
  width: min(100%, 260px);
  display: block;
}

.space-illustration-link {
  margin-top: clamp(0.55rem, 1vw, 0.85rem);
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-left: 15px;
}

.space-illustration-link::after {
  content: "▶";
  color: #f8b02f;
  font-size: 0.9em;
}

.space-illustration-cats {
  width: min(100%, 300px);
  display: block;
}

.more-works-anchor {
  height: 1px;
}

@media (max-width: 768px) {
  body.menu-open {
    overflow: hidden;
  }

  .navbar {
    top: 4.6%;
    left: 4.2%;
    right: 4.2%;
    gap: 0.75rem;
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
  }

  .menu-toggle {
    display: flex;
  }

  .brand-logo {
    width: 44px;
  }

  .brand-text {
    font-size: 0.58rem;
    letter-spacing: 0.18em;
  }

  .menu {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 1.6rem;
    background: rgba(248, 176, 47, 0.97);
    backdrop-filter: blur(2px);
    padding: 6.4rem 1.6rem 2rem;
    transform: translateX(-105%);
    transition: transform 0.3s ease;
    pointer-events: none;
    z-index: 25;
  }

  .menu.active {
    transform: translateX(0);
    pointer-events: auto;
  }

  .menu a {
    width: 100%;
    padding: 0.25rem 0;
    font-size: 1.35rem;
    font-weight: 600;
    color: #fff;
    text-shadow: none;
  }

  .menu a + a::before {
    content: "";
    margin-right: 0;
  }

  .menu-close {
    position: absolute;
    top: 1.3rem;
    left: 1.2rem;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #fff;
    background: transparent;
    border-radius: 2px;
    padding: 0;
    cursor: pointer;
  }

  .menu-close span {
    position: absolute;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
  }

  .menu-close span:first-child {
    transform: rotate(45deg);
  }

  .menu-close span:last-child {
    transform: rotate(-45deg);
  }

  .top-text {
    top: 14.5%;
    left: 10%;
    width: 42%;
  }

  .title-text {
    top: 39%;
    left: 46%;
    width: 26%;
  }

  .home-subtitle {
    top: 49.4%;
    left: 45.2%;
    width: 29%;
  }

  .cat-corner {
    padding-top: 4.2rem;
  }

  .cat-corner::before {
    top: -14px;
    height: 14px;
    background: radial-gradient(
        ellipse 24px 14px at 24px 14px,
        #f8b02f 99%,
        transparent 100%
      )
      0 0 / 48px 14px repeat-x;
  }

  .cat-corner-inner {
    flex-direction: column;
    gap: 1rem;
  }

  .cat-corner-cats {
    width: 240px;
  }

  .cat-corner-en {
    width: 150px;
  }

  .cat-corner-title {
    width: 165px;
  }

  .cat-corner-info {
    align-items: center;
  }

  .cat-corner-link {
    margin-top: 0.55rem;
    font-size: 1rem;
    margin-left: 35px;
    margin-bottom: 15px;
    padding-bottom: 15px;
  }

  .space-illustration {
    padding-top: 2rem;
  }

  .space-illustration::before {
    top: -14px;
    height: 14px;
    background: radial-gradient(
        ellipse 24px 14px at 24px 14px,
        #355d99 99%,
        transparent 100%
      )
      0 0 / 48px 14px repeat-x;
  }

  .space-illustration-inner {
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
  }

  .space-illustration-info {
    align-items: center;
    margin-top: 0;
  }

  .space-illustration-title {
    width: 230px;
  }

  .space-illustration-link {
    font-size: 1.25rem;
  }

  .space-illustration-cats {
    width: 240px;
  }
}

/* Cat Corner Dedicated Page */
.cat-corner-scene {
  background: linear-gradient(135deg, #f8b02f 0%, #ffc55c 100%);
  aspect-ratio: auto;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: clamp(6rem, 9vw, 7.2rem) clamp(1rem, 4vw, 2.4rem)
    clamp(2.2rem, 5vw, 4rem);
  min-height: 60vh;
}

.cat-corner-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(2rem, 5vw, 5rem);
  max-width: 900px;
  margin: 0 auto;
}

.cat-corner-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.8rem, 2vw, 1.2rem);
}

.cat-corner-main-image {
  width: clamp(200px, 35vw, 350px);
  display: block;
}

.cat-corner-text-image {
  width: clamp(150px, 25vw, 200px);
  display: block;
}

.cat-corner-right {
  display: flex;
  align-items: center;
  justify-content: center;
}

.cat-corner-title-image {
  width: clamp(180px, 30vw, 300px);
  display: block;
}

.cat-corner-gallery {
  background: #fff;
  padding: clamp(3rem, 10vw, 5.5rem) clamp(1rem, 4vw, 3rem);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(0.6rem, 1.5vw, 1.2rem);
  max-width: 960px;
  margin: 0 auto;
}

.gallery-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  border-radius: 4px;
  cursor: zoom-in;
}

.gallery-grid.collapsed img:nth-child(n + 7) {
  display: none;
}

.gallery-toggle {
  margin: clamp(1.2rem, 2.4vw, 1.8rem) auto 0;
  padding: 0.55rem 1.05rem;
  border: none;
  background: transparent;
  color: #25487c;
  font-size: clamp(1rem, 1.6vw, 1.22rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  display: block;
}

.gallery-toggle::after {
  content: "▶";
  font-size: 0.88em;
  margin-left: 0.5rem;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}

.gallery-lightbox.active {
  display: flex;
}

.gallery-lightbox-image {
  display: block;
  max-width: min(92vw, 920px);
  max-height: 86vh;
  width: auto;
  height: auto;
  border-radius: 6px;
}

.gallery-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: auto;
  height: auto;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

body.lightbox-open {
  overflow: hidden;
}

.cat-corner-third {
  background: #f8b02f;
  padding: clamp(1rem, 2vw, 1.5rem) 1rem clamp(3rem, 6vw, 5rem);
}

.cat-corner-third-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1.4rem, 3vw, 2.4rem);
  margin: 0 auto;
}

.cat-corner-third-image {
  display: block;
}

.image-3,
.image-5 {
  width: clamp(190px, 30vw, 280px);
  align-self: center;
  transform: translateX(-36px);
}

.image-4 {
  width: clamp(210px, 38vw, 310px);
  align-self: center;
  transform: translateX(36px);
}

.image-6 {
  width: clamp(180px, 30vw, 260px);
  align-self: center;
  transform: translateX(36px);
}

@media (max-width: 768px) {
  .cat-corner-scene {
    padding: 5.4rem 1rem 2rem;
    min-height: auto;
  }

  .cat-corner-content {
    flex-direction: column;
    gap: 1.5rem;
  }

  .cat-corner-main-image {
    width: 280px;
  }

  .cat-corner-text-image {
    width: 170px;
  }

  .cat-corner-title-image {
    width: 240px;
  }

  .cat-corner-gallery {
    padding: 2rem 0.75rem 2.4rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .gallery-grid.collapsed img:nth-child(n + 5) {
    display: none;
  }

  .gallery-toggle {
    margin-top: 0.95rem;
    font-size: 1rem;
  }

  .cat-corner-third {
    padding: 0.5rem 1rem 2.4rem;
  }

  .image-3,
  .image-5 {
    width: 210px;
    transform: translateX(-8px);
  }

  .image-4 {
    width: min(78vw, 300px);
    transform: translateX(8px);
  }

  .image-6 {
    width: 200px;
    transform: translateX(8px);
  }
}
