@font-face {
  font-family: "Montserrat Local";
  src: url("/assets/fonts/montserrat-latin.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Noto Sans SC Nav";
  src: url("/assets/fonts/noto-sans-sc-nav.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: "Montserrat Local", sans-serif;
  font-synthesis: none;
  --page-padding: 60px;
  --header-height: 164px;
  --gallery-gap: 10px;
}

* {
  box-sizing: border-box;
}

html {
  overflow-y: scroll;
  background: #fff;
}

body {
  min-width: 300px;
  margin: 0;
  color: #111;
  background: #fff;
}

button,
a {
  color: inherit;
}

button {
  font: inherit;
}

.site-shell {
  width: 100%;
  padding: var(--page-padding);
}

.site-header {
  height: var(--header-height);
}

.site-logo {
  height: 54px;
  margin: 0;
  text-align: center;
  font-size: 36px;
  font-weight: 600;
  line-height: 54px;
  letter-spacing: 7.2px;
  white-space: nowrap;
}

.site-logo a {
  text-decoration: none;
}

.site-nav {
  height: 60px;
}

.site-nav ul {
  display: flex;
  width: max-content;
  height: 60px;
  margin: 0 auto;
  padding: 0;
  gap: 30px;
  list-style: none;
}

.site-nav a {
  display: block;
  width: 30px;
  height: 60px;
  color: #9c9c9c;
  font-family: "Noto Sans SC Nav", sans-serif;
  font-size: 30px;
  font-weight: 600;
  line-height: 60px;
  text-align: center;
  text-decoration: none;
}

.site-nav a[aria-current="page"],
.site-nav a:hover,
.site-nav a:focus-visible {
  color: #000;
}

.gallery {
  margin: 0;
  padding: 0;
}

.gallery--justified {
  position: relative;
  width: 100%;
}

.gallery--justified[data-gallery="about"] {
  width: calc(100% + 15px);
}

.gallery-item {
  position: relative;
  display: block;
  overflow: hidden;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}

.gallery-item::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  opacity: 0;
  background: rgba(0, 0, 0, 0.32);
  content: "";
  pointer-events: none;
  transition: opacity 180ms ease;
}

.gallery-caption {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  opacity: 0;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  text-align: center;
  pointer-events: none;
  transition: opacity 180ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .gallery-item:hover::after,
  .gallery-item:focus-visible::after,
  .gallery-item:hover .gallery-caption,
  .gallery-item:focus-visible .gallery-caption {
    opacity: 1;
  }
}

.gallery--justified .gallery-item {
  position: absolute;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
  object-position: var(--focal-x, 50%) var(--focal-y, 50%);
  user-select: none;
  -webkit-user-drag: none;
}

.gallery-item:focus-visible {
  outline: 2px solid #111;
  outline-offset: 3px;
}

.gallery--grid {
  display: grid;
  width: calc(75% - 8.75px);
  margin: 0 auto;
  grid-template-columns: repeat(4, 1fr);
  transform: translateX(5px);
}

.gallery--grid .gallery-item {
  padding: 0 10px 10px 0;
}

.gallery--grid .gallery-item::after,
.gallery--grid .gallery-caption {
  right: 10px;
  bottom: 10px;
}

.gallery--grid .gallery-item img {
  height: auto;
  aspect-ratio: 16 / 9;
}

.site-footer {
  width: 100%;
  margin-top: 50px;
  padding-top: 8px;
}

body[data-page="life"] .site-footer {
  width: calc(75% - 18.75px);
  margin-right: auto;
  margin-left: auto;
}

.social-footer {
  display: flex;
  height: 24px;
  align-items: center;
  justify-content: center;
  margin-top: 0;
  gap: 10px;
}

.social-link {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border: 0;
  color: #1f1f1f;
  text-decoration: none;
}

.social-link--github {
  color: #111;
}

.social-link--linkedin {
  color: #0a66c2;
}

.social-link svg,
.social-link img {
  display: block;
  width: 20px;
  height: 20px;
}

.site-copyright {
  margin-top: 10px;
  color: #7b7b7b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  font-size: 14px;
  font-weight: 200 !important;
  line-height: 1.8;
  letter-spacing: 0.05em;
  text-align: center;
}

.lightbox {
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  width: calc(100% + 15px);
  height: 100%;
  display: none;
  overflow: auto;
  background: #fff;
}

.lightbox[aria-hidden="false"] {
  display: block;
}

.lightbox-logo {
  height: 164px;
  margin: 0;
  padding-top: 60px;
  text-align: center;
  font-family: "Montserrat Local", sans-serif;
  font-size: 36px;
  font-weight: 600;
  line-height: 54px;
  letter-spacing: 7.2px;
}

.lightbox-close {
  position: absolute;
  top: 40px;
  right: 40px;
  width: 52px;
  height: 65px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #666;
  font-size: 18px;
  line-height: 65px;
  cursor: pointer;
}

.lightbox-stage {
  display: flex;
  width: calc(100% - 15px);
  min-height: calc(100vh - 164px);
  align-items: center;
  flex-direction: column;
}

.lightbox-media {
  position: relative;
  width: fit-content;
  max-width: calc(100vw - 120px);
  margin: 0;
}

.lightbox-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 324px);
  opacity: 1;
  object-fit: contain;
  transition:
    width 180ms cubic-bezier(0.22, 1, 0.36, 1),
    height 180ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 150ms cubic-bezier(0.22, 1, 0.36, 1);
}

.lightbox-image--outgoing {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 0;
  display: block;
  opacity: 1;
  object-fit: contain;
  pointer-events: none;
  transition: opacity 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.lightbox-image--outgoing.is-leaving {
  opacity: 0;
}

.lightbox-caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 40px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  opacity: 1;
  text-align: center;
  transition: opacity 130ms cubic-bezier(0.22, 1, 0.36, 1);
}

.lightbox-media.is-switching .lightbox-image,
.lightbox-media.is-switching .lightbox-caption {
  opacity: 0.18;
}

.lightbox-caption[hidden] {
  display: none;
}

.lightbox-controls {
  display: flex;
  margin-top: 20px;
  gap: 8px;
  transform: translateX(7.5px);
}

.lightbox-controls button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #111;
  cursor: pointer;
}

body.lightbox-open {
  overflow: hidden;
}

#backToTop {
  display: none;
  position: fixed;
  z-index: 200;
  right: 24px;
  bottom: 24px;
  width: 36px;
  height: 36px;
  padding: 0 0 3px;
  border: 1px solid rgba(180, 180, 180, 0.7);
  border-radius: 50%;
  opacity: 0;
  background: rgba(255, 255, 255, 0.86);
  color: rgba(0, 0, 0, 0.55);
  font-size: 20px;
  pointer-events: none;
  transition: opacity 0.2s;
  cursor: pointer;
}

#backToTop.visible {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 800px) {
  :root {
    --page-padding: 20px;
    --header-height: 158px;
  }

  .site-logo {
    margin: 0;
    transform: translateY(6px);
  }

  .site-nav {
    margin-top: 4px;
  }

  .site-header {
    height: 158px;
  }

  .gallery--justified {
    width: 100% !important;
    height: auto !important;
  }

  .gallery--justified .gallery-item {
    position: relative;
    top: auto !important;
    left: auto !important;
    width: calc(100% - 4px) !important;
    height: auto !important;
    margin: 0 0 4px;
    aspect-ratio: var(--image-ratio);
    cursor: default;
  }

  .gallery--grid {
    width: calc(100% + 10px);
    margin: 0;
    grid-template-columns: repeat(2, 1fr);
    transform: none;
  }

  .site-footer,
  body[data-page="life"] .site-footer {
    width: 100%;
    margin-top: 37px;
  }

  .site-copyright {
    max-width: 360px;
    margin-right: auto;
    margin-left: auto;
    font-size: 12px;
    line-height: 1.55;
    letter-spacing: 0.01em;
  }

  .site-copyright > div + div {
    margin-top: 4px;
  }

  #backToTop {
    right: auto;
    bottom: 32px;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateX(-50%);
    opacity: 0;
    background: rgba(255, 255, 255, 0.2);
    color: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition-duration: 0.3s;
  }

  .lightbox-logo {
    height: 124px;
    padding-top: 20px;
    font-size: 30px;
  }

  .lightbox-close {
    top: 12px;
    right: 8px;
  }

  .lightbox-image {
    max-height: calc(100vh - 220px);
  }

  .lightbox-media {
    max-width: calc(100vw - 40px);
  }

  .lightbox-caption {
    padding: 9px 16px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox-image,
  .lightbox-image--outgoing,
  .lightbox-caption {
    transition: none;
  }
}
