:root {
  color-scheme: light;
  --paper: #f6f3eb;
  --ink: #30352d;
  --muted: #6f7268;
  --line: #d8d8cc;
  --moss: #596c53;
  --font:
    "LXGW WenKai", "霞鹜文楷", "霞鹜楷体", "PingFang SC", "Iowan Old Style",
    Georgia, serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #151814;
  --ink: #e8ebe2;
  --muted: #a2a89b;
  --line: #353a31;
  --moss: #a0b697;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.75 var(--font);
  letter-spacing: 0;
}

body.lightbox-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--moss);
  outline-offset: 5px;
}

.moments-header,
main,
footer {
  width: min(1220px, calc(100% - 96px));
  margin-inline: auto;
}

.moments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 30px 0;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 27px;
  line-height: 1;
}

.wordmark img {
  border-radius: 11px;
}

.wordmark small {
  margin-left: 8px;
  font-size: 15px;
}

nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 13px;
  user-select: none;
}

nav a {
  transition: color 180ms ease;
}

nav a:hover,
nav a[aria-current="page"] {
  color: var(--moss);
}

nav a[aria-current="page"] {
  border-bottom: 1px solid currentColor;
}

.nav-library {
  padding: 7px 15px;
  border: 1px solid #bfc4b4;
  border-radius: 5px;
}

[data-theme="dark"] .nav-library {
  border-color: #596052;
}

.moments-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.52fr);
  align-items: end;
  gap: 8vw;
  min-height: 440px;
  padding: 80px 0 86px;
  border-bottom: 1px solid var(--line);
}

.moments-intro > div,
.intro-note,
.year-heading {
  opacity: 0;
  animation: settle-in 620ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.intro-note {
  animation-delay: 90ms;
}

.year-heading {
  animation-delay: 150ms;
}

.eyebrow {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 11px;
}

h1 {
  margin: 0;
  font-family: "Iowan Old Style", Georgia, var(--font);
  font-size: clamp(62px, 9.2vw, 132px);
  font-weight: 400;
  line-height: 0.82;
  letter-spacing: 0;
}

.intro-note {
  max-width: 18em;
  margin: 0 0 7px;
  color: var(--ink);
  font-size: 22px;
}

.year-archive {
  padding: 80px 0 140px;
}

.year-heading {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: baseline;
  padding-bottom: 44px;
}

.year-heading p,
.year-heading span {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

.year-heading h2 {
  margin: 0;
  font-family: "Iowan Old Style", Georgia, serif;
  font-size: clamp(60px, 8vw, 112px);
  font-weight: 400;
  line-height: 0.8;
  letter-spacing: 0;
}

.gallery-wall {
  position: relative;
  height: clamp(600px, 65vw, 790px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background-color: #efeee7;
  background-image: radial-gradient(#cfcfc2 0.8px, transparent 0.8px);
  background-size: 22px 22px;
}

[data-theme="dark"] .gallery-wall {
  background-color: #22271f;
  background-image: radial-gradient(#495043 0.8px, transparent 0.8px);
}

.moment {
  position: absolute;
  margin: 0;
  padding: 8px 8px 0;
  border: 1px solid #e5e5dc;
  border-radius: 12px;
  background: #fffefa;
  box-shadow:
    0 4px 8px #30352d14,
    0 16px 38px #30352d17;
  transform: rotate(var(--tilt));
  transition:
    transform 400ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 350ms ease,
    box-shadow 350ms ease;
}

[data-theme="dark"] .moment {
  border-color: #555b50;
  background: #393f37;
  box-shadow:
    0 4px 8px #0004,
    0 16px 38px #0005;
}

.moment-sky {
  --tilt: -4deg;
  z-index: 1;
  top: 7%;
  left: 5%;
  width: 47%;
}

.moment-sunset {
  --tilt: 5deg;
  z-index: 2;
  top: 17%;
  right: 5%;
  width: 42%;
}

.moment-video {
  --tilt: -2deg;
  z-index: 3;
  top: 51%;
  left: 28%;
  width: 48%;
}

@media (hover: hover) {
  .gallery-wall:has(.moment:hover) .moment:not(:hover) {
    filter: blur(5px) saturate(0.8) brightness(0.72);
  }

  .moment:hover {
    z-index: 4;
    transform: translateY(-10px) rotate(0) scale(1.04);
    box-shadow:
      0 16px 28px #30352d26,
      0 32px 55px #30352d22;
  }
}

.gallery-wall:has(.media-button:focus-visible) .moment:not(:focus-within) {
  filter: blur(5px) saturate(0.8) brightness(0.72);
}

.moment:has(.media-button:focus-visible) {
  z-index: 4;
  transform: translateY(-10px) rotate(0) scale(1.04);
}

.media-button {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: #e6e8df;
  color: #fff;
  cursor:
    url("/images/moment-cursor.svg") 4 3,
    pointer;
  text-align: left;
}

[data-theme="dark"] .media-button {
  background: #272d25;
}

.media-button::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  background:
    radial-gradient(
      circle 170px at var(--glow-x, 50%) var(--glow-y, 50%),
      #fffbea99,
      #ffe0e144 48%,
      transparent 78%
    ),
    conic-gradient(
      from 30deg at var(--glow-x, 50%) var(--glow-y, 50%),
      #ffc9d866,
      #fff2ce66,
      #d2f0e566,
      #d8ddff66,
      #ffc9d866
    );
  mask-image: radial-gradient(
    circle 185px at var(--glow-x, 50%) var(--glow-y, 50%),
    #000,
    transparent 75%
  );
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
  content: "";
  transition: opacity 220ms ease;
}

.media-button:focus-visible::after {
  opacity: 1;
}

[data-theme="dark"] .media-button:focus-visible::after {
  opacity: 0.35;
}

@media (hover: hover) {
  .media-button:hover::after {
    opacity: 1;
  }

  [data-theme="dark"] .media-button:hover::after {
    opacity: 0.35;
  }
}

.media-button img {
  display: block;
  width: 100%;
  height: auto;
}

.media-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}

.video-button.is-previewing .media-preview {
  opacity: 1;
}

.view-cue,
.play-cue {
  position: absolute;
  z-index: 2;
  right: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 11px;
  border: 1px solid #ffffff80;
  border-radius: 40px;
  background: rgba(26, 30, 25, 0.6);
  color: #fff;
  font:
    10px/1.5 "Avenir Next",
    "Helvetica Neue",
    sans-serif;
  letter-spacing: 0.04em;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.play-cue {
  opacity: 1;
  transform: translateY(0);
}

.play-symbol {
  font-size: 8px;
}

.media-button:is(:hover, :focus-visible) .view-cue {
  opacity: 1;
  transform: translateY(0);
}

figcaption {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 4px 10px;
  color: var(--ink);
  font-size: 11px;
  line-height: 1.4;
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 25px 0 35px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: rgba(20, 22, 19, 0.96);
  color: #f7f5ee;
}

.lightbox::backdrop {
  background: rgba(20, 22, 19, 0.72);
}

.lightbox-stage {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  padding: 56px 64px 76px;
}

.lightbox-image,
.lightbox-video {
  display: none;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.26);
}

.lightbox[data-media-type="image"] .lightbox-image,
.lightbox[data-media-type="video"] .lightbox-video {
  display: block;
}

.lightbox-close {
  position: absolute;
  top: 22px;
  right: 28px;
  z-index: 1;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font: 300 24px/1 sans-serif;
}

.lightbox-caption {
  position: absolute;
  right: 64px;
  bottom: 22px;
  left: 64px;
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  text-align: center;
}

@keyframes settle-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .moments-header,
  main,
  footer {
    width: calc(100% - 40px);
  }

  .moments-header {
    padding: 20px 0;
  }

  .wordmark {
    gap: 8px;
    font-size: 23px;
  }

  .wordmark img {
    width: 34px;
    height: 34px;
  }

  .wordmark small,
  .nav-home {
    display: none;
  }

  nav {
    gap: 12px;
    font-size: 12px;
  }

  .moments-intro {
    grid-template-columns: 1fr;
    gap: 44px;
    min-height: 0;
    padding: 74px 0 64px;
  }

  h1 {
    font-size: clamp(56px, 21vw, 82px);
    line-height: 0.86;
  }

  .intro-note {
    justify-self: end;
  }

  .year-archive {
    padding: 62px 0 90px;
  }

  .year-heading {
    grid-template-columns: 42px 1fr;
    padding-bottom: 34px;
  }

  .year-heading span {
    display: none;
  }

  .gallery-wall {
    height: auto;
    padding: 26px 14px 34px;
  }

  .moment,
  .moment-sunset,
  .moment-video {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    width: 94%;
    margin: 0;
  }

  .moment-sunset {
    width: 87%;
    margin-top: 12px;
    margin-left: auto;
  }

  .moment-video {
    width: 91%;
    margin-top: 12px;
    margin-left: 3%;
  }

  .view-cue {
    display: none;
  }

  .lightbox-stage {
    padding: 60px 14px 76px;
  }

  .lightbox-close {
    top: 14px;
    right: 16px;
  }

  .lightbox-caption {
    right: 20px;
    bottom: 20px;
    left: 20px;
  }

  footer span:last-child {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .moments-intro > div,
  .intro-note,
  .year-heading {
    opacity: 1;
    animation: none;
  }

  .moment,
  .media-preview,
  .media-button::after,
  .view-cue,
  .play-cue {
    transition: none;
  }

  .media-button::after {
    display: none;
  }
}
