:root {
  color-scheme: light dark;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: var(--sans);
}

body,
button,
a {
  -webkit-tap-highlight-color: transparent;
}

img {
  display: block;
  width: 100%;
  height: auto;
}

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

button {
  color: inherit;
  font: inherit;
}

button,
a {
  touch-action: manipulation;
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 5px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 1rem;
  left: 1rem;
  padding: 0.7rem 1rem;
  background: #fff;
  color: #111;
  transform: translateY(-180%);
  transition: transform 180ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.ambient-control {
  position: fixed;
  z-index: 90;
  right: clamp(1rem, 3vw, 2.2rem);
  bottom: clamp(1rem, 3vw, 2.2rem);
  display: grid;
  width: 3rem;
  height: 3rem;
  padding: 0;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: color-mix(in srgb, currentColor 10%, transparent);
  backdrop-filter: blur(14px);
  cursor: pointer;
}

.ambient-control__bars {
  display: flex;
  height: 0.9rem;
  align-items: center;
  gap: 3px;
}

.ambient-control__bars i {
  display: block;
  width: 1px;
  height: 35%;
  background: currentColor;
}

.ambient-control.is-playing .ambient-control__bars i {
  animation: sound-bar 900ms ease-in-out infinite alternate;
}

.ambient-control.is-playing .ambient-control__bars i:nth-child(2) {
  animation-delay: -430ms;
}

.ambient-control.is-playing .ambient-control__bars i:nth-child(3) {
  animation-delay: -720ms;
}

@keyframes sound-bar {
  to {
    height: 100%;
  }
}

.reveal {
  opacity: 0;
  transform: translateY(2.6rem);
  transition:
    opacity 900ms cubic-bezier(0.2, 0.65, 0.25, 1),
    transform 900ms cubic-bezier(0.2, 0.65, 0.25, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

.gallery-grid {
  display: grid;
}

.gallery-item {
  position: relative;
  margin: 0;
  overflow: hidden;
}

.gallery-item picture,
.gallery-item img {
  height: 100%;
}

.gallery-item img {
  object-fit: cover;
  transition: transform 1.2s cubic-bezier(0.2, 0.65, 0.25, 1);
}

.gallery-item:hover img {
  transform: scale(1.018);
}

.gallery-item figcaption {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  inset: auto 0 0;
  padding: 3rem 1.25rem 1.1rem;
  background: linear-gradient(transparent, rgb(0 0 0 / 58%));
  color: #fff;
}

.gallery-item figcaption span:first-child {
  font-family: var(--serif);
  font-size: 1.05rem;
  letter-spacing: 0.12em;
}

.gallery-item figcaption span:last-child {
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  opacity: 0.7;
}

.link-button[aria-disabled="true"] {
  cursor: default;
  opacity: 0.62;
}

.mobile-reply-link { display: none; }
#rsvp { scroll-margin-top: 1.5rem; }
body[data-variant="minimal"]:not(.mobile-reading) .ambient-control {
  top: max(1rem, env(safe-area-inset-top)); bottom: auto;
}

@media (max-width: 900px) {
  .ambient-control {
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
  }
  body.mobile-reading:not(.rsvp-in-view):not(.reply-editing):not(.arrival-open) .mobile-reply-link {
    position: fixed; z-index: 89; bottom: max(1rem, env(safe-area-inset-bottom));
    left: max(1rem, env(safe-area-inset-left)); right: calc(max(1rem, env(safe-area-inset-right)) + 3.75rem);
    display: flex; min-height: 3rem; padding: .8rem 1.1rem; align-items: center; justify-content: center;
    border: 1px solid var(--reply-accent); background: var(--reply-accent); color: var(--reply-inverse);
    font: 15px/1.4 var(--serif); letter-spacing: .12em; text-decoration: none;
    box-shadow: 0 3px 16px rgb(0 0 0 / 12%);
  }
  body.rsvp-in-view .ambient-control, body.reply-editing .ambient-control { visibility: hidden; pointer-events: none; }
  body[data-variant] > footer { padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
