.site-header nav [aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--text-link);
  text-decoration-thickness: 2px;
}

.gallery-page .skip-link { z-index: 5; }
.gallery-glass-filters { position: absolute; pointer-events: none; }

.gallery-ready .gallery-header {
  --glass-tint: color-mix(in srgb, var(--background-secondary-default) 23%, transparent);
  --site-menu-icon-color: var(--text-primary);
  position: fixed;
  z-index: 4;
  inset: clamp(11px, 2vw, 25px) clamp(12px, 2.2vw, 32px) auto;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  flex-wrap: nowrap;
  align-items: start;
  pointer-events: none;
}

.gallery-ready .gallery-header > * { pointer-events: auto; }
.gallery-ready .gallery-navigation { position: relative; }

.gallery-ready .gallery-header :is(.brand, nav, .gallery-menu-toggle) {
  border: 1px solid var(--separator-border);
  border-radius: 999px;
  background-color: var(--background-primary-default);
  box-shadow: 0 3px 13px color-mix(in srgb, var(--text-primary) 11%, transparent);
}

@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .gallery-ready .gallery-header :is(.brand, nav, .gallery-menu-toggle) {
    border-color: rgb(255 255 255 / .68);
    background:
      radial-gradient(ellipse at 27% 0%, rgb(255 255 255 / .39), transparent 61%),
      linear-gradient(163deg, rgb(255 255 255 / .24), rgb(255 255 255 / .06) 57%, color-mix(in srgb, var(--background-primary-default) 27%, transparent)),
      var(--glass-tint);
    box-shadow:
      inset 0 1px 1px rgb(255 255 255 / .93),
      inset 0 -1px 2px color-mix(in srgb, var(--text-primary) 12%, transparent),
      0 4px 16px color-mix(in srgb, var(--text-primary) 12%, transparent),
      0 1px 3px color-mix(in srgb, var(--text-primary) 10%, transparent);
    -webkit-backdrop-filter: blur(5px) saturate(1.19) brightness(1.08);
    backdrop-filter: blur(5px) saturate(1.19) brightness(1.08);
  }
}

@supports (backdrop-filter: url("#gallery-refraction") blur(3px)) {
  .gallery-ready .gallery-header :is(.brand, nav, .gallery-menu-toggle) {
    backdrop-filter: url("#gallery-refraction") blur(3px) saturate(1.19) brightness(1.08);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .gallery-ready .gallery-header :is(.brand, nav, .gallery-menu-toggle) {
    background: var(--background-primary-default);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

.gallery-ready .gallery-header .brand {
  min-height: 44px;
  padding: 4px 13px 4px 5px;
  white-space: nowrap;
}

.gallery-ready .gallery-header nav { gap: 0; padding-inline: 5px; }
.gallery-ready .gallery-header nav a { padding-inline: 12px; white-space: nowrap; }
.gallery-ready .gallery-header :is(.brand, nav a, .gallery-menu-toggle) { text-shadow: 0 0 5px rgb(255 255 255 / .8); }

@media (max-width: 639px) {
  .gallery-ready .site-menu-ready .gallery-menu-toggle { display: inline-flex; gap: 10px; min-height: 44px; padding-inline: 14px; }

  .gallery-ready .gallery-header .gallery-navigation nav {
    --glass-tint: color-mix(in srgb, var(--background-secondary-default) 49%, transparent);
    position: absolute;
    inset: calc(100% + 7px) 0 auto auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 142px;
    padding: 5px;
    border-radius: var(--radius);
  }
}

.gallery-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.gallery-page button { font-family: var(--body-font); font-size: 1rem; cursor: pointer; }
.gallery-page .button--secondary { background-color: var(--background-primary-default); }
.gallery-page .button--secondary:hover { background-color: var(--button-secondary-background-hover); }
.gallery-page .button--secondary:active { background-color: var(--button-secondary-background-active); }

.gallery-window { background: var(--background-secondary-default); }

.gallery-ready:not(.canvas-ready) .gallery-window { background: var(--background-primary-default); }
.gallery-ready:not(.canvas-ready) .gallery-field { padding-block-start: 78px; }

.gallery-page.canvas-ready {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

.canvas-ready main { flex: 1; min-height: 0; }
.canvas-ready .gallery-hero, .canvas-ready .gallery-window { height: 100%; }

.canvas-ready .gallery-window {
  overflow: clip;
  background: var(--background-primary-default);
  touch-action: pinch-zoom;
  cursor: grab;
}

.canvas-ready .gallery-window.is-dragging,
.canvas-ready .gallery-window.is-dragging a { cursor: grabbing; }
.canvas-ready .gallery-window.is-dragging { user-select: none; }

.gallery-window:focus-visible { outline-offset: -4px; }

.gallery-field {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: clamp(17px, 4vw, 34px) clamp(15px, 4.5vw, 40px);
  max-width: 80rem;
  margin-inline: auto;
  padding: clamp(26px, 5vw, 62px) var(--gutter) clamp(32px, 6vw, 72px);
}

.gallery-card { min-width: 0; }
.gallery-card:nth-child(even) { margin-block-start: clamp(10px, 3.5vw, 22px); }

.gallery-photo {
  display: block;
  border-radius: var(--radius);
  text-decoration: none;
  cursor: zoom-in;
}

.gallery-print {
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  background: var(--background-primary-default);
}

.gallery-print img {
  height: 100%;
  object-fit: cover;
  object-position: var(--photo-position, center);
}

.gallery-card--canopy { --photo-position: 50% 60%; }
.gallery-card--friends { --photo-position: 53% 46%; }
.gallery-card--portrait { --photo-position: 51% 16%; }
.gallery-card--celebration { --photo-position: 50% 85%; }
.gallery-card--courtyard { --photo-position: 56% 55%; }
.gallery-card--together { --photo-position: 39% 50%; }
.gallery-card--meal { --photo-position: 64% 54%; }
.gallery-card--crowd { --photo-position: 50% 62%; }
.gallery-card--gathering { --photo-position: 48% 56%; }

@media (min-width: 640px) and (max-width: 899px) {
  .gallery-field { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gallery-card:nth-child(even) { margin-block-start: 0; }
  .gallery-card:nth-child(3n + 2) { margin-block-start: 34px; }
}

@media (min-width: 900px) {
  .gallery-field { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.canvas-ready .gallery-field {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.canvas-ready .gallery-field .gallery-card {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
}

@media (prefers-reduced-motion: no-preference) and (hover: hover) {
  .gallery-print img { transition: transform 260ms cubic-bezier(.22,.7,.29,1); }
  .gallery-window:not(.is-dragging) .gallery-photo:hover img { transform: scale(1.045); }
}

.gallery-viewer {
  width: min(68rem, calc(100% - 2 * var(--gutter)));
  height: min(50rem, calc(100dvh - 2rem));
  max-height: none;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--separator-border);
  border-radius: var(--radius);
  background: var(--background-primary-default);
  color: var(--text-primary);
}

.gallery-viewer::backdrop { background: color-mix(in srgb, var(--text-primary) 77%, transparent); }
.gallery-page:has(.gallery-viewer[open]) { overflow: hidden; }

.viewer-inner {
  min-height: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(8px, 2vw, 20px);
  padding: clamp(12px, 2vw, 24px);
}

.viewer-top { display: flex; justify-content: end; }
.viewer-bottom {
  display: grid;
  grid-template-columns: 1fr minmax(0, 3fr) 1fr;
  align-items: center;
  gap: 8px;
}
.viewer-bottom > :first-child { justify-self: start; }
.viewer-bottom > :last-child { justify-self: end; }
.viewer-details { text-align: center; line-height: 1.1; }
.viewer-event { font-weight: 600; }
.viewer-count { margin-top: 5px; color: var(--text-secondary); font-size: .95rem; font-variant-numeric: tabular-nums; }
.viewer-bottom button { padding-inline: clamp(9px, 2vw, 17px); }
.viewer-photo { min-height: 0; touch-action: pan-y pinch-zoom; }
.viewer-photo img { width: 100%; height: 100%; object-fit: contain; }
