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

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: clip;
}

body {
  font-family: "Outfit", sans-serif;
  color: #f4efe6;
  background: radial-gradient(900px 480px at 8% -10%, rgba(212, 180, 131, 0.16), transparent 60%), radial-gradient(700px 420px at 100% 0%, rgba(120, 72, 40, 0.28), transparent 55%), #100e0c;
  letter-spacing: 0.01em;
}

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

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

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

.grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: overlay;
  z-index: 8;
}

.site {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(28px, env(safe-area-inset-top)) max(4vw, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(4vw, env(safe-area-inset-left));
}

.alert,
.welcome {
  margin: 0;
  max-width: 36rem;
  overflow-wrap: anywhere;
}

.alert {
  margin-bottom: 6px;
  font-family: "Instrument Serif", serif;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.1;
  color: #d4b483;
}

.welcome {
  margin-bottom: 22px;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: #f4efe6;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #d4b483;
}

h1 {
  margin: 0;
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  font-size: clamp(3.2rem, 7vw, 6.4rem);
  line-height: 0.88;
  letter-spacing: -0.03em;
}

.lede {
  margin: 14px 0 0;
  max-width: 28rem;
  color: #b7aea0;
  font-weight: 300;
  font-size: 1.05rem;
  line-height: 1.5;
}

.count {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.count strong {
  display: block;
  font-family: "Instrument Serif", serif;
  font-size: 2.4rem;
  font-weight: 400;
  line-height: 1;
}

.count span {
  color: #b7aea0;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hint {
  margin: 18px 0 0;
  color: #b7aea0;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (prefers-reduced-motion: no-preference) {
  .alert,
  .welcome,
  .top,
  .hint {
    animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .hint {
    animation-delay: 0.35s;
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 720px) {
  .site {
    padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  .welcome {
    margin-bottom: 16px;
    font-size: 0.95rem;
  }
  h1 {
    font-size: clamp(2.5rem, 14vw, 4.2rem);
  }
  .lede {
    font-size: 0.98rem;
  }
  .top {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
  }
  .count {
    text-align: left;
  }
  .count strong {
    font-size: 2rem;
  }
  .hint {
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    line-height: 1.6;
  }
}
.gallery {
  flex: 1;
  display: flex;
  gap: 12px;
  min-height: 62vh;
}

.panel {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: min(72vh, 760px);
  border-radius: 22px;
  overflow: hidden;
  isolation: isolate;
  outline: none;
  transition: flex 0.75s cubic-bezier(0.22, 1, 0.36, 1), transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}
.panel:focus-visible {
  box-shadow: 0 0 0 2px #100e0c, 0 0 0 4px #d4b483;
}

.panel.is-active {
  flex: 2.8 1 0;
}

.panel__media,
.panel__media img {
  width: 100%;
  height: 100%;
}

.panel__media {
  display: block;
}

.panel__media img {
  object-fit: cover;
  object-position: center 18%;
  transform: scale(1.04);
  transition: transform 1.1s cubic-bezier(0.22, 1, 0.36, 1), filter 0.8s ease;
  filter: saturate(0.94) brightness(0.94);
}

.panel.is-active .panel__media img {
  transform: scale(1);
  filter: none;
}

.panel__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8, 6, 4, 0.72) 0%, rgba(8, 6, 4, 0) 48%);
  pointer-events: none;
}

.panel__meta {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  z-index: 1;
  text-align: left;
}

.panel__index {
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  color: #d4b483;
}

.panel__title {
  font-family: "Instrument Serif", serif;
  font-size: 1.55rem;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.panel.is-active .panel__title {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: no-preference) {
  .panel {
    animation: panel-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--i) * 90ms + 80ms);
  }
}
@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(36px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 860px) {
  .gallery {
    flex-direction: column;
    gap: 10px;
    min-height: 0;
  }
  .panel,
  .panel.is-active {
    flex: none;
    width: 100%;
    height: 200px;
    border-radius: 18px;
  }
  .panel.is-active {
    height: min(72vw, 440px);
  }
  .panel__media img {
    object-position: center 42%;
  }
  .panel__meta {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }
  .panel__title {
    opacity: 1;
    transform: none;
    font-size: 1.35rem;
    white-space: normal;
  }
}
@media (max-width: 380px) {
  .panel,
  .panel.is-active {
    height: 168px;
    border-radius: 14px;
  }
  .panel.is-active {
    height: min(84vw, 360px);
  }
  .panel__title {
    font-size: 1.15rem;
  }
}
.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 22px 4vw 28px;
  background: rgba(8, 7, 6, 0.94);
  backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

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

.lightbox__bar,
.lightbox__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.lightbox__count {
  margin: 0;
  letter-spacing: 0.2em;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: #b7aea0;
}

.lightbox__close,
.lightbox__nav {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(244, 239, 230, 0.14);
  display: grid;
  place-items: center;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.lightbox__close:hover,
.lightbox__nav:hover,
.lightbox__close:focus-visible,
.lightbox__nav:focus-visible {
  background: rgba(244, 239, 230, 0.08);
  border-color: #d4b483;
}

.lightbox__stage {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 0;
}

.lightbox__frame {
  justify-self: center;
  width: fit-content;
  max-width: min(920px, 100%);
  height: min(74vh, 780px);
  border-radius: 18px;
  overflow: hidden;
  background: #070605;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.lightbox__frame img {
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.lightbox.is-open .lightbox__frame img.is-enter {
  animation: frame-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.lightbox__frame img.from-next {
  animation-name: from-next;
}

.lightbox__frame img.from-prev {
  animation-name: from-prev;
}

@keyframes frame-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes from-next {
  from {
    opacity: 0;
    transform: translateX(36px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes from-prev {
  from {
    opacity: 0;
    transform: translateX(-36px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.lightbox__caption {
  margin: 0;
  font-family: "Instrument Serif", serif;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.thumbs {
  display: flex;
  gap: 8px;
}

.thumbs button {
  width: 64px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  opacity: 0.45;
  outline: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.thumbs button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbs button.is-current,
.thumbs button:hover,
.thumbs button:focus-visible {
  opacity: 1;
  transform: translateY(-2px);
}

.thumbs button.is-current {
  box-shadow: 0 0 0 2px #d4b483;
}

@media (max-width: 720px) {
  .lightbox {
    padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
  }
  .lightbox__stage {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .lightbox__nav {
    position: absolute;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    z-index: 2;
    background: rgba(16, 14, 12, 0.72);
  }
  .lightbox__nav--prev {
    left: 8px;
  }
  .lightbox__nav--next {
    right: 8px;
  }
  .lightbox__frame {
    width: 100%;
    height: auto;
    max-height: 100%;
  }
  .lightbox__frame img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(58dvh, 520px);
  }
  .lightbox__foot {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
  }
  .lightbox__caption {
    font-size: 1.7rem;
  }
  .thumbs {
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .thumbs button {
    flex: 0 0 56px;
    width: 56px;
    height: 40px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .lightbox,
  .panel,
  .panel__media img,
  .panel__title,
  .lightbox__close,
  .lightbox__nav,
  .thumbs button {
    transition: none;
  }
  .lightbox__frame img.is-enter {
    animation: none;
  }
}
