:root {
  --black: #050505;
  --black-soft: #090909;
  --ivory: #e8e2d8;
  --muted: #9a9188;
  --red: #7d1f1f;
  --line: rgba(255, 255, 255, 0.12);
  --side: clamp(20px, 5vw, 72px);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--black);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--black);
  color: var(--ivory);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "Times New Roman", serif;
}

body.is-modal-open {
  overflow: hidden;
}

::selection {
  background: var(--red);
  color: var(--ivory);
}

button,
a {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
}

img {
  display: block;
  max-width: 100%;
}

.site-header {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  padding: 0 var(--side);
  background: linear-gradient(180deg, rgba(5, 5, 5, 0.86), transparent);
  pointer-events: none;
  transition: opacity 240ms ease;
}

.site-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.7rem;
  text-decoration: none;
  text-transform: uppercase;
  pointer-events: auto;
}

.site-mark span:first-child {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  color: var(--ivory);
  font-size: 0.9rem;
}

.observation-status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.archive-return {
  color: var(--muted);
  font-size: 0.76rem;
  text-decoration: none;
  pointer-events: auto;
  transition: color 180ms ease;
}

.archive-return:hover,
.archive-return:focus-visible {
  color: var(--ivory);
}

.status-line {
  width: 44px;
  height: 1px;
  background: var(--line);
}

.section-label {
  margin: 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.entrance {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 100px var(--side) 64px;
  border-bottom: 1px solid var(--line);
}

.entrance::before,
.entrance::after {
  position: absolute;
  content: "";
  background: var(--line);
}

.entrance::before {
  top: 0;
  bottom: 0;
  left: var(--side);
  width: 1px;
  box-shadow: calc(100vw - (var(--side) * 2)) 0 0 var(--line);
}

.entrance::after {
  right: var(--side);
  bottom: 64px;
  left: var(--side);
  height: 1px;
}

.entrance-content {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  text-align: center;
}

.entrance h1 {
  margin: 18px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4rem, 12vw, 10rem);
  font-weight: 400;
  line-height: 0.9;
  text-transform: uppercase;
}

.entrance-copy {
  margin: clamp(48px, 8vh, 88px) auto 0;
  color: rgba(232, 226, 216, 0.84);
  font-size: clamp(0.98rem, 1.4vw, 1.12rem);
  line-height: 2.1;
}

.entrance-copy p {
  margin: 0 0 18px;
}

.enter-button {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  margin-top: 34px;
  padding: 13px 0;
  border-bottom: 1px solid var(--ivory);
  background: transparent;
  cursor: pointer;
  transition: gap 200ms ease, color 200ms ease;
}

.enter-button:hover,
.enter-button:focus-visible {
  gap: 28px;
  color: #fff;
}

.entrance-index {
  position: absolute;
  right: var(--side);
  bottom: 28px;
  margin: 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.corridor-stage {
  position: relative;
  height: 900vh;
  background: var(--black-soft);
}

.corridor-sticky {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
}

.corridor-track {
  display: flex;
  align-items: center;
  gap: clamp(72px, 9vw, 150px);
  width: max-content;
  height: 100%;
  padding: 86px max(var(--side), 9vw) 70px;
  will-change: transform;
}

.art-panel {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(240px, 52svh) minmax(240px, 340px);
  gap: clamp(28px, 4vw, 64px);
  align-items: end;
  width: min(860px, 82vw);
  opacity: 0.38;
  filter: grayscale(24%) brightness(0.68);
  transform: scale(0.965);
  transform-origin: center;
  transition: opacity 700ms ease, filter 700ms ease, transform 700ms ease;
}

.art-panel:nth-child(even) {
  grid-template-columns: minmax(240px, 340px) minmax(240px, 52svh);
}

.art-panel:nth-child(even) .art-image-button {
  grid-column: 2;
}

.art-panel:nth-child(even) .art-caption {
  grid-row: 1;
}

.art-panel.is-active {
  opacity: 1;
  filter: grayscale(0) brightness(1);
  transform: scale(1);
}

.art-image-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #030303;
  cursor: zoom-in;
}

.art-image-button::after {
  position: absolute;
  inset: 0;
  content: "";
  border: 1px solid transparent;
  transition: border-color 220ms ease;
}

.art-image-button:hover::after,
.art-image-button:focus-visible::after {
  border-color: rgba(232, 226, 216, 0.48);
}

.art-image-button img {
  width: 100%;
  height: min(66svh, 720px);
  object-fit: cover;
  transition: transform 700ms ease;
}

.art-panel.is-active .art-image-button img {
  transform: scale(1.012);
}

.art-caption {
  padding-bottom: 18px;
}

.art-number {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.art-number::after {
  width: 40px;
  height: 1px;
  content: "";
  background: var(--red);
}

.observation-text {
  margin: 24px 0 0;
  font-size: clamp(1.2rem, 2.2vw, 1.75rem);
  line-height: 1.8;
  white-space: pre-line;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 30px;
  color: var(--muted);
  font-size: 0.74rem;
}

.tags span::before {
  margin-right: 6px;
  color: var(--red);
  content: "/";
}

.corridor-progress {
  position: absolute;
  right: var(--side);
  bottom: 28px;
  left: var(--side);
  height: 1px;
  background: var(--line);
}

.corridor-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--ivory);
  transform-origin: left;
}

.zero-layer {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(300px, 1fr);
  gap: clamp(56px, 12vw, 180px);
  min-height: 140svh;
  padding: clamp(120px, 18vw, 260px) var(--side);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, transparent 49.95%, var(--line) 50%, transparent 50.05%),
    #070707;
}

.zero-layer-heading {
  position: sticky;
  top: 34vh;
  align-self: start;
}

.zero-layer-heading h2 {
  margin: 18px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.8rem, 6vw, 6rem);
  font-weight: 400;
  line-height: 0.95;
  text-transform: uppercase;
}

.zero-layer-heading > p:last-child {
  margin: 0;
  color: var(--muted);
}

.zero-layer-copy {
  display: grid;
  gap: 54px;
  color: rgba(232, 226, 216, 0.72);
  font-size: clamp(1.08rem, 1.7vw, 1.36rem);
  line-height: 2;
}

.zero-layer-copy p {
  margin: 0;
}

.zero-layer-copy .zero-emphasis {
  color: var(--ivory);
  font-size: clamp(1.8rem, 3.4vw, 3.4rem);
}

.zero-layer-copy small {
  margin-top: 44px;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.archive {
  padding: clamp(100px, 13vw, 180px) var(--side);
}

.archive-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: clamp(56px, 8vw, 100px);
}

.archive-heading h2 {
  margin: 16px 0 0;
  font-size: clamp(2.4rem, 5vw, 5rem);
  font-weight: 400;
}

.archive-heading > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.9;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.archive-item {
  min-width: 0;
  background: var(--black);
}

.archive-button {
  display: block;
  width: 100%;
  padding: 0;
  background: transparent;
  text-align: left;
  cursor: zoom-in;
}

.archive-thumb {
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: #030303;
}

.archive-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(22%) brightness(0.72);
  transition: filter 320ms ease, transform 500ms ease;
}

.archive-button:hover img,
.archive-button:focus-visible img {
  filter: grayscale(0) brightness(1);
  transform: scale(1.025);
}

.archive-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
}

.archive-meta strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.72rem;
  font-weight: 400;
  text-transform: uppercase;
}

.archive-meta span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exit {
  display: grid;
  place-items: center;
  min-height: 120svh;
  padding: 120px var(--side);
  border-top: 1px solid var(--line);
  text-align: center;
}

.exit-content {
  width: min(720px, 100%);
}

.exit h2 {
  margin: 18px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4.5rem, 11vw, 9rem);
  font-weight: 400;
  line-height: 0.9;
  text-transform: uppercase;
}

.exit-copy {
  display: grid;
  gap: 34px;
  margin-top: clamp(60px, 10vw, 110px);
  color: rgba(232, 226, 216, 0.76);
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  line-height: 2;
}

.exit-copy p {
  margin: 0;
}

.exit-copy .exit-name {
  color: var(--ivory);
  font-size: clamp(1.35rem, 2.4vw, 2rem);
}

.archive-link {
  display: grid;
  gap: 8px;
  width: min(280px, 100%);
  margin: 64px auto 8px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  transition: border-color 200ms ease, color 200ms ease;
}

.archive-link span:first-child {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.archive-link span:last-child {
  color: var(--ivory);
}

.archive-link:hover,
.archive-link:focus-visible {
  border-color: var(--ivory);
  color: var(--ivory);
}

.exit-actions {
  display: grid;
  gap: 20px;
  justify-items: center;
  margin-top: 32px;
}

.observe-again-button,
.world-return-button {
  padding: 0 0 8px;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.86rem;
  transition: border-color 180ms ease, color 180ms ease, opacity 180ms ease;
}

.observe-again-button {
  color: rgba(232, 226, 216, 0.78);
}

.world-return-button {
  margin-top: 10px;
  color: rgba(232, 226, 216, 0.86);
  font-size: 1rem;
}

.exit-final-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  align-items: center;
  justify-content: center;
}

.exit-final-actions .world-return-button {
  margin-top: 0;
}

.manor-return-link {
  padding: 0 0 8px;
  border-bottom: 1px solid transparent;
  color: rgba(232, 226, 216, 0.86);
  font-size: 1rem;
  text-decoration: none;
  transition: border-color 180ms ease, color 180ms ease;
}

.observe-again-button:hover,
.observe-again-button:focus-visible,
.world-return-button:hover,
.world-return-button:focus-visible,
.manor-return-link:hover,
.manor-return-link:focus-visible {
  border-color: var(--line);
  color: var(--ivory);
}

.world-return-message {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: var(--side);
  background: rgba(0, 0, 0, 0.94);
  color: rgba(232, 226, 216, 0.84);
  font-size: clamp(1.55rem, 3.2vw, 3rem);
  line-height: 1.8;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translateY(10px);
  transition: opacity 900ms ease, transform 900ms ease;
}

.world-return-message.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.archive-page {
  min-height: 100svh;
  background: #070707;
}

.archive-page-main {
  min-height: 100svh;
}

.archive-standalone {
  padding-top: clamp(140px, 16vw, 210px);
}

.archive-standalone .archive-heading h1 {
  margin: 16px 0 0;
  font-size: clamp(2.4rem, 5vw, 5rem);
  font-weight: 400;
}

.corridor-return-link {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  margin-top: 64px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  transition: gap 180ms ease, color 180ms ease;
}

.corridor-return-link:hover,
.corridor-return-link:focus-visible {
  gap: 26px;
  color: var(--ivory);
}

.site-credit {
  padding: 28px var(--side) 42px;
  border-top: 1px solid var(--line);
  color: rgba(154, 145, 136, 0.72);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  line-height: 1.6;
  text-align: left;
}

.site-credit p {
  width: min(1050px, 100%);
  margin: 0 auto;
}

.image-modal {
  width: 100vw;
  max-width: none;
  height: 100svh;
  max-height: none;
  margin: 0;
  padding: clamp(24px, 5vw, 70px);
  border: 0;
  background: rgba(5, 5, 5, 0.96);
  color: var(--ivory);
  opacity: 0;
  transition: opacity 220ms ease, display 220ms allow-discrete;
}

.image-modal[open] {
  display: grid;
  opacity: 1;
}

.image-modal::backdrop {
  background: rgba(0, 0, 0, 0.86);
}

.modal-close {
  position: fixed;
  z-index: 2;
  top: 20px;
  right: 24px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.84);
  color: var(--ivory);
  font-family: Arial, sans-serif;
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: clamp(30px, 6vw, 90px);
  align-items: end;
  width: min(1280px, 100%);
  height: 100%;
  margin: auto;
}

.modal-image-wrap {
  min-width: 0;
  height: 100%;
}

.modal-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.modal-caption {
  padding-bottom: 4vh;
}

.modal-caption > p:last-child {
  margin: 22px 0 0;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  line-height: 1.8;
  white-space: pre-line;
}

.noscript-message {
  position: fixed;
  right: 20px;
  bottom: 20px;
  left: 20px;
  z-index: 100;
  margin: 0;
  padding: 16px;
  background: var(--red);
  text-align: center;
}

@media (max-width: 760px) {
  .site-header {
    height: 58px;
  }

  .site-mark span:last-child {
    display: none;
  }

  .entrance {
    padding-top: 90px;
  }

  .entrance h1 {
    font-size: clamp(3.4rem, 19vw, 6rem);
  }

  .corridor-stage {
    height: auto !important;
  }

  .corridor-sticky {
    position: relative;
    height: auto;
    overflow: visible;
  }

  .corridor-track {
    display: grid;
    gap: 120px;
    width: 100%;
    height: auto;
    padding: 110px var(--side);
    transform: none !important;
  }

  .art-panel,
  .art-panel:nth-child(even) {
    grid-template-columns: 1fr;
    gap: 28px;
    width: 100%;
  }

  .art-panel:nth-child(even) .art-image-button {
    grid-column: auto;
  }

  .art-panel:nth-child(even) .art-caption {
    grid-row: auto;
  }

  .art-image-button img {
    height: auto;
    max-height: 74svh;
    object-fit: contain;
  }

  .observation-text {
    font-size: 1.15rem;
  }

  .corridor-progress {
    display: none;
  }

  .zero-layer {
    grid-template-columns: 1fr;
    min-height: 0;
    background: #070707;
  }

  .zero-layer-heading {
    position: static;
  }

  .archive-heading {
    align-items: start;
    flex-direction: column;
  }

  .archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .archive-meta {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

  .modal-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 20px;
  }

  .modal-caption {
    padding-bottom: 0;
  }
}

@media (max-width: 430px) {
  .archive-grid {
    grid-template-columns: 1fr;
  }

  .archive-thumb {
    aspect-ratio: 4 / 4.6;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
