:root {
  --black: #050505;
  --black-soft: #090909;
  --panel: rgba(13, 12, 11, 0.84);
  --ivory: #e8e2d8;
  --muted: #a49a8e;
  --dim: #6f6861;
  --red: #842525;
  --red-soft: rgba(132, 37, 37, 0.28);
  --oxide: #52705f;
  --steel: #7f8790;
  --line: rgba(232, 226, 216, 0.14);
  --side: clamp(18px, 5vw, 72px);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 80% 8%, rgba(82, 112, 95, 0.08), transparent 24rem),
    radial-gradient(circle at 8% 18%, rgba(132, 37, 37, 0.11), transparent 22rem),
    var(--black);
  color: var(--ivory);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", Georgia, "Times New Roman", serif;
}

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

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

button {
  border: 0;
}

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

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

.gallery-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.9), rgba(5, 5, 5, 0));
  pointer-events: none;
}

.site-mark,
.header-nav {
  pointer-events: auto;
}

.site-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(232, 226, 216, 0.78);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
}

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

.header-nav {
  display: flex;
  gap: clamp(16px, 3vw, 34px);
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.header-nav a {
  padding: 10px 0;
  border-bottom: 1px solid transparent;
  text-decoration: none;
  transition: border-color 180ms ease, color 180ms ease;
}

.header-nav a:hover,
.header-nav a:focus-visible {
  border-color: var(--red);
  color: var(--ivory);
  outline: none;
}

.hero {
  position: relative;
  display: grid;
  min-height: 92svh;
  padding: 110px var(--side) 72px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  isolation: isolate;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(90deg, rgba(5, 5, 5, 0.9) 0%, rgba(5, 5, 5, 0.58) 48%, rgba(5, 5, 5, 0.78) 100%),
    url("../assets/gallery/chronoa/chronoa-01.jpg");
  background-position: center;
  background-size: cover;
  filter: saturate(0.86) brightness(0.78);
  transform: scale(1.018);
}

.hero::after {
  position: absolute;
  inset: auto var(--side) 34px;
  z-index: -1;
  height: 1px;
  background: var(--line);
  content: "";
}

.hero-content {
  display: grid;
  align-content: end;
  width: min(860px, 100%);
  min-height: calc(92svh - 182px);
}

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

.hero h1,
.section-heading h2,
.archive-top h2,
.future-entry h2,
.modal-caption h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  line-height: 0.96;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.hero h1 {
  max-width: 760px;
  margin: 18px 0 0;
  font-size: clamp(4rem, 11vw, 9rem);
  letter-spacing: 0.08em;
}

.hero-copy {
  width: min(620px, 100%);
  margin: clamp(26px, 4vw, 44px) 0 0;
  color: rgba(232, 226, 216, 0.78);
  font-size: clamp(1rem, 1.45vw, 1.18rem);
  line-height: 2;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  width: min(720px, 100%);
  margin-top: clamp(34px, 5vw, 56px);
  background: var(--line);
  border: 1px solid var(--line);
}

.hero-stats span {
  display: grid;
  min-width: 150px;
  flex: 1;
  gap: 8px;
  padding: 20px 22px;
  background: rgba(5, 5, 5, 0.76);
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-stats strong {
  color: var(--ivory);
  font-size: 1.55rem;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.notice {
  padding: 18px var(--side);
  border-bottom: 1px solid var(--line);
  background: rgba(82, 112, 95, 0.08);
}

.notice p {
  width: min(1020px, 100%);
  margin: 0 auto;
  color: rgba(232, 226, 216, 0.7);
  font-size: 0.86rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
  text-align: center;
}

.lineage,
.archive,
.future-entry {
  padding: clamp(86px, 12vw, 154px) var(--side);
}

.section-heading,
.archive-top {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 36px;
  margin-bottom: clamp(38px, 6vw, 74px);
}

.section-heading h2,
.archive-top h2,
.future-entry h2 {
  margin: 14px 0 0;
  font-size: clamp(2.5rem, 6vw, 5.7rem);
}

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

.lineage-card {
  display: grid;
  align-content: end;
  min-height: clamp(440px, 58vw, 640px);
  padding: 0;
  overflow: hidden;
  background: #050505;
  text-align: left;
}

.lineage-card button {
  position: relative;
  display: grid;
  align-content: end;
  width: 100%;
  height: 100%;
  min-height: inherit;
  padding: 28px;
  overflow: hidden;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.lineage-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(16%) brightness(0.72);
  transform: scale(1.01);
  transition: filter 360ms ease, transform 700ms ease;
}

.lineage-card button::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 5, 5, 0.04), rgba(5, 5, 5, 0.84));
  content: "";
}

.lineage-card button:hover img,
.lineage-card button:focus-visible img {
  filter: grayscale(0) brightness(0.95);
  transform: scale(1.045);
}

.lineage-card button:focus-visible {
  outline: 1px solid var(--ivory);
  outline-offset: -8px;
}

.lineage-meta {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
}

.lineage-meta strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 2.4vw, 2.35rem);
  font-weight: 400;
  line-height: 1;
  text-transform: uppercase;
}

.lineage-meta span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.7;
}

.archive {
  border-top: 1px solid var(--line);
  background: rgba(9, 9, 9, 0.82);
}

.archive-status {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: clamp(32px, 5vw, 60px);
}

.filter-button {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.62);
  color: rgba(232, 226, 216, 0.72);
  cursor: pointer;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.68rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.filter-button:hover,
.filter-button:focus-visible,
.filter-button.is-active {
  border-color: rgba(132, 37, 37, 0.86);
  background: rgba(132, 37, 37, 0.16);
  color: var(--ivory);
  outline: none;
}

.filter-button.is-disabled {
  color: var(--dim);
  cursor: default;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 156px));
  gap: 10px;
  justify-content: start;
}

.gallery-item {
  min-width: 0;
}

.gallery-button {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #030303;
  cursor: zoom-in;
  text-align: left;
}

.gallery-button img {
  width: 100%;
  height: 100%;
  filter: grayscale(12%) brightness(0.74);
  object-fit: cover;
  object-position: center;
  transition: filter 300ms ease, transform 520ms ease;
}

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

.gallery-button:focus-visible {
  outline: 1px solid var(--ivory);
  outline-offset: 3px;
}

.gallery-caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  gap: 5px;
  padding: 34px 11px 10px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.86));
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.gallery-button:hover .gallery-caption,
.gallery-button:focus-visible .gallery-caption {
  opacity: 1;
  transform: translateY(0);
}

.gallery-caption strong {
  font-family: Georgia, "Times New Roman", serif;
  overflow: hidden;
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.09em;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: uppercase;
}

.gallery-caption span {
  color: var(--muted);
  font-size: 0.62rem;
}

.future-entry {
  display: grid;
  grid-template-columns: minmax(220px, 0.56fr) minmax(280px, 1fr);
  gap: clamp(34px, 8vw, 112px);
  border-top: 1px solid var(--line);
  background:
    linear-gradient(90deg, transparent 49.96%, var(--line) 50%, transparent 50.04%),
    rgba(5, 5, 5, 0.72);
}

.future-entry p {
  align-self: end;
  margin: 0;
  color: rgba(232, 226, 216, 0.72);
  font-size: clamp(1rem, 1.4vw, 1.18rem);
  line-height: 2;
}

.gallery-footer {
  display: grid;
  gap: 22px;
  place-items: center;
  padding: 34px var(--side) 48px;
  border-top: 1px solid var(--line);
}

.observatory-return {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 0 6px;
  border-bottom: 1px solid rgba(232, 226, 216, 0.22);
  color: rgba(232, 226, 216, 0.68);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  transition: border-color 180ms ease, color 180ms ease;
}

.observatory-return:hover,
.observatory-return:focus-visible {
  border-color: rgba(132, 37, 37, 0.9);
  color: var(--ivory);
  outline: none;
}

.site-credit {
  margin: 0;
  color: rgba(164, 154, 142, 0.72);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  line-height: 1.6;
  text-align: center;
}

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

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

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

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

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

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

.modal-caption {
  padding-bottom: clamp(16px, 5vh, 56px);
}

.modal-caption h3 {
  margin: 20px 0 0;
  font-size: clamp(1.7rem, 3vw, 3rem);
}

.modal-caption p:last-child {
  margin: 24px 0 0;
  color: var(--muted);
  line-height: 1.9;
}

.modal-close,
.modal-nav {
  position: fixed;
  z-index: 2;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(5, 5, 5, 0.74);
  color: var(--ivory);
  cursor: pointer;
  font-family: Arial, sans-serif;
  transition: border-color 180ms ease, background 180ms ease;
}

.modal-close {
  top: 18px;
  right: 22px;
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
}

.modal-nav {
  top: 50%;
  width: 46px;
  height: 64px;
  font-size: 2.8rem;
  transform: translateY(-50%);
}

.modal-prev {
  left: 18px;
}

.modal-next {
  right: 18px;
}

.modal-close:hover,
.modal-close:focus-visible,
.modal-nav:hover,
.modal-nav:focus-visible {
  border-color: var(--red);
  background: rgba(18, 10, 10, 0.9);
  outline: none;
}

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

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

  .section-heading,
  .archive-top,
  .future-entry {
    align-items: start;
    grid-template-columns: 1fr;
  }

  .future-entry {
    background: rgba(5, 5, 5, 0.72);
  }

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

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

@media (max-width: 620px) {
  .gallery-header {
    height: 60px;
  }

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

  .header-nav {
    gap: 12px;
    font-size: 0.6rem;
    letter-spacing: 0.1em;
  }

  .hero {
    min-height: 84svh;
    padding-top: 86px;
    padding-bottom: 54px;
  }

  .hero-content {
    min-height: calc(84svh - 140px);
  }

  .hero h1 {
    max-width: 100%;
    font-size: clamp(2.45rem, 12.9vw, 3.65rem);
    letter-spacing: 0.025em;
    line-height: 1;
  }

  .section-label {
    font-size: 0.64rem;
    letter-spacing: 0.13em;
  }

  .hero-copy,
  .future-entry p {
    font-size: clamp(0.92rem, 3.85vw, 1.03rem);
    line-height: 1.85;
    overflow-wrap: anywhere;
    word-break: break-all;
  }

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

  .hero-stats span {
    min-width: 0;
    padding: 16px 10px;
    font-size: 0.58rem;
    letter-spacing: 0.11em;
    overflow-wrap: anywhere;
  }

  .hero-stats span:last-child {
    grid-column: 1 / -1;
  }

  .hero-stats strong {
    font-size: 1.28rem;
  }

  .lineage-grid {
    grid-template-columns: 1fr;
  }

  .lineage-card,
  .lineage-card button {
    min-height: 440px;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(94px, 1fr));
    gap: 8px;
  }

  .gallery-caption {
    opacity: 1;
    transform: none;
  }

  .gallery-caption {
    padding: 28px 8px 8px;
  }

  .modal-nav {
    top: auto;
    bottom: 18px;
    width: 42px;
    height: 48px;
    font-size: 2.1rem;
    transform: none;
  }
}

@media (max-width: 420px) {
  :root {
    --side: clamp(16px, 4.5vw, 20px);
  }

  .gallery-header {
    height: 56px;
  }

  .header-nav {
    gap: 10px;
    font-size: 0.58rem;
  }

  .hero h1 {
    font-size: clamp(2.15rem, 11.2vw, 2.9rem);
  }

  .hero-stats span {
    padding: 14px 8px;
  }
}

@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;
  }
}
