:root {
  --bg-opacity: 0.05;
  --transition-speed: 0.3s;
  --header-height: 5rem;
}

html {
  /* Keep layout stable without reserving a mirrored gutter on the left edge. */
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
}

@supports not (scrollbar-gutter: stable) {
  @media (min-width: 768px) {
    html {
      overflow-y: scroll;
    }
  }
}

html,
body {
  min-height: 100%;
}

body.site-body {
  background-color: #ffffff;
  color: #1a1a1a;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

html.is-scroll-locked,
body.is-scroll-locked {
  overflow: hidden;
}

body.is-scroll-locked {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  top: var(--lock-scroll-top, 0px);
}

.bg-texture {
  position: fixed;
  inset: 0;
  opacity: var(--bg-opacity);
  z-index: -1;
  pointer-events: none;
}

.texture-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.05;
  z-index: -1;
  pointer-events: none;
  mix-blend-mode: multiply;
}

body.has-textures .texture-overlay::before {
  background-image: url('../images/texture.jpg');
}

.site-main {
  flex: 1 0 auto;
  padding-top: clamp(1.5rem, 4vw, 2.5rem);
}

.nav-link {
  position: relative;
  color: #6b7280;
  transition: color var(--transition-speed) ease;
}

.nav-link:hover,
.nav-link.active {
  color: #0b1c2c;
}

.nav-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 1px;
  bottom: -2px;
  left: 0;
  background-color: #0b1c2c;
  transition: width var(--transition-speed) ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

#mobile-menu {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  transition:
    max-height 0.3s ease-in-out,
    opacity 0.3s ease-in-out,
    visibility 0s linear 0.3s;
}

#mobile-menu.open {
  max-height: 350px;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    max-height 0.3s ease-in-out,
    opacity 0.3s ease-in-out;
}

.page-section {
  display: none;
  animation: fadeIn 0.35s ease-in-out;
}

.page-section.active {
  display: block;
}

#contact.page-section.active {
  min-height: max(24rem, calc(100vh - var(--header-height) - 16rem));
}

@supports (height: 100dvh) {
  #contact.page-section.active {
    min-height: max(24rem, calc(100dvh - var(--header-height) - 16rem));
  }
}

@media (min-width: 768px) {
  #contact.page-section.active {
    min-height: calc(100vh - var(--header-height) - 14rem);
  }

  @supports (height: 100dvh) {
    #contact.page-section.active {
      min-height: calc(100dvh - var(--header-height) - 14rem);
    }
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gallery-columns {
  column-gap: 1.5rem;
  columns: 1;
}

@media (min-width: 640px) {
  .gallery-columns {
    columns: 2;
  }
}

@media (min-width: 1024px) {
  .gallery-columns {
    column-count: auto;
    column-width: auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    grid-auto-rows: 8px;
    align-items: start;
  }

  .gallery-columns > .gallery-card {
    display: block;
    margin: 0;
    break-inside: auto;
    -webkit-column-break-inside: auto;
    page-break-inside: auto;
  }

  #lightbox-img {
    display: block;
    width: auto;
    height: auto;
    max-width: min(92vw, 1600px);
    max-height: 85vh;
    object-fit: contain;
  }
}

.gallery-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 1.5rem;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  background: transparent;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.gallery-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.gallery-media {
  display: block;
  overflow: hidden;
  border-radius: 0.125rem;
  background: #f3f4f6;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s ease;
  contain: layout paint style;
}

.gallery-card:hover .gallery-media,
.gallery-card:focus-visible .gallery-media {
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.14);
}

.gallery-image {
  display: block;
  width: 100%;
  height: auto;
  transform: scale(1);
  transition: transform 0.7s ease;
  background: transparent;
}

.gallery-card:hover .gallery-image,
.gallery-card:focus-visible .gallery-image {
  transform: scale(1.03);
}

.gallery-card:focus-visible {
  outline: 2px solid #0b1c2c;
  outline-offset: 4px;
  border-radius: 0.25rem;
}

.gallery-sentinel {
  width: 100%;
  height: 1px;
}

#gallery-status:empty {
  display: none;
}

.gallery-status-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: #6b7280;
}

.loading-spinner {
  width: 1.75rem;
  height: 1.75rem;
  border: 2px solid #cbd5e1;
  border-top-color: #0b1c2c;
  border-radius: 9999px;
  animation: spin 1s linear infinite;
}

#lightbox {
  --lightbox-viewport-width: 100vw;
  --lightbox-viewport-height: 100vh;
  --lightbox-safe-top: max(1rem, calc(env(safe-area-inset-top, 0px) + 1rem));
  --lightbox-safe-right: max(1rem, calc(env(safe-area-inset-right, 0px) + 1rem));
  --lightbox-safe-bottom: max(1rem, calc(env(safe-area-inset-bottom, 0px) + 1rem));
  --lightbox-safe-left: max(1rem, calc(env(safe-area-inset-left, 0px) + 1rem));
  backdrop-filter: blur(5px);
  background-color: rgba(255, 255, 255, 0.95);
  padding:
    var(--lightbox-safe-top)
    var(--lightbox-safe-right)
    var(--lightbox-safe-bottom)
    var(--lightbox-safe-left);
  overflow: hidden;
  overscroll-behavior: contain;
}

#lightbox-close {
  top: var(--lightbox-safe-top);
  right: var(--lightbox-safe-right);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  line-height: 1;
}

#lightbox-stage {
  width: min(100%, 1600px);
  max-width: min(100%, 1600px);
  height: calc(var(--lightbox-viewport-height) - var(--lightbox-safe-top) - var(--lightbox-safe-bottom));
  max-height: calc(var(--lightbox-viewport-height) - var(--lightbox-safe-top) - var(--lightbox-safe-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

#lightbox-img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, calc(var(--lightbox-viewport-width) - var(--lightbox-safe-left) - var(--lightbox-safe-right)));
  max-height: 100%;
  object-fit: contain;
}

@supports (height: 100dvh) {
  #lightbox {
    --lightbox-viewport-height: 100dvh;
  }
}

@supports (width: 100dvw) {
  #lightbox {
    --lightbox-viewport-width: 100dvw;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
