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

:root {
  --bg: #faf9f7;
  --bg-alt: #f3f1ec;
  --text: #2a2a2a;
  --text-muted: #6e6e6e;
  --accent: #8b7355;
  --border: #e4e0d8;
  --max-width: 720px;
  --space: clamp(1rem, 3vw, 2rem);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  max-width: 100%;
}

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

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--text);
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space);
  padding: 0.5rem 1rem;
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: var(--space);
}

/* Hero */

.hero {
  padding: var(--space);
  padding-top: calc(var(--space) * 1.5);
  border-bottom: 1px solid var(--border);
  overflow-x: clip;
  max-width: 100%;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  justify-content: center;
  margin-bottom: calc(var(--space) * 2);
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav a {
  color: var(--text-muted);
  text-decoration: none;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--accent);
}

.nav a.is-active {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.nav--compact {
  gap: 0.85rem 1.1rem;
}

.hero__content {
  max-width: min(640px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--space) * 1.75);
  width: 100%;
  min-width: 0;
  text-align: center;
}

.portrait {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

.portrait img {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 2px;
  filter: grayscale(15%);
}

.hero__label {
  font-size: 0.8125rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.hero h1,
.hero__name {
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: 0.75rem;
}

.hero__name {
  white-space: nowrap;
  max-width: 100%;
}

.hero__dates {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.15rem 0.4rem;
  font-size: 1.125rem;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.hero__dash {
  margin: 0 0.4em;
  opacity: 0.5;
}

.hero__epitaph {
  font-style: italic;
  color: var(--text-muted);
  max-width: 36ch;
  margin-inline: auto;
}

.tribute-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 0.85rem;
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.tribute-stats__item {
  white-space: nowrap;
}

.hero__text {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Sections */

.section {
  padding: calc(var(--space) * 3) var(--space);
}

.section--alt {
  background: var(--bg-alt);
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  min-width: 0;
  overflow-wrap: break-word;
}

.container--wide {
  width: 100%;
  max-width: min(960px, 100%);
  min-width: 0;
}

.prose {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

main {
  overflow-x: clip;
  max-width: 100%;
}

h2 {
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.section__hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: -1rem;
  margin-bottom: 1.5rem;
}

.section__hint code {
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
  background: var(--bg-alt);
  padding: 0.1em 0.4em;
  border-radius: 2px;
}

.section__subtitle {
  margin-top: -1.1rem;
  margin-bottom: 2rem;
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 42ch;
}

.section--alt .section__hint code {
  background: var(--bg);
}

.prose p + p {
  margin-top: 1.25rem;
}

/* Timeline */

.timeline {
  list-style: none;
  border-left: 1px solid var(--border);
  padding-left: 1.5rem;
}

.timeline li {
  position: relative;
  padding-bottom: 1.75rem;
}

.timeline li:last-child {
  padding-bottom: 0;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -1.5rem;
  top: 0.55rem;
  width: 7px;
  height: 7px;
  margin-left: -3px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline__year {
  display: block;
  font-size: 0.875rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

/* Gallery carousel */

.gallery-carousel {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.gallery-carousel__viewport {
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  background: var(--bg-alt);
}

.gallery {
  --gallery-gap: 0.75rem;
  --gallery-per-view: 3;
  display: flex;
  gap: var(--gallery-gap);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.125rem;
}

.gallery::-webkit-scrollbar {
  display: none;
}

.gallery__item {
  flex: 0 0 calc((100% - (var(--gallery-gap) * (var(--gallery-per-view) - 1))) / var(--gallery-per-view));
  scroll-snap-align: start;
  overflow: hidden;
  cursor: zoom-in;
  margin: 0;
  border-radius: 2px;
  background: var(--bg);
}

.gallery__item img {
  width: 100%;
  height: 100%;
  min-height: 220px;
  max-height: 360px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--bg-alt);
  transition: transform 0.35s ease;
}

@media (max-width: 899px) {
  .gallery {
    --gallery-per-view: 2;
  }
}

@media (max-width: 539px) {
  .gallery {
    --gallery-per-view: 1;
  }
}

.gallery__hint {
  margin-top: -1rem;
}

.gallery__item:hover img {
  transform: scale(1.01);
}

.gallery-carousel__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.gallery-carousel__btn {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  color: var(--accent);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.gallery-carousel__btn:hover,
.gallery-carousel__btn:focus-visible {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.gallery-carousel__counter {
  margin: 0;
  min-width: 4.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

/* Visit / map */

.visit h3,
.visit__subtitle {
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 1rem;
}

.visit ul {
  margin-left: 1.1rem;
}

.visit li + li {
  margin-top: 0.85rem;
}

.visit__hours {
  margin-top: 1.25rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.map {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  background: var(--bg-alt);
  aspect-ratio: 4 / 3;
  min-height: 220px;
}

.map iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 220px;
  border: 0;
}

.visit__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.visit__btn {
  display: inline-block;
  padding: 0.65rem 1rem;
  border-radius: 2px;
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
}

.visit__btn:hover {
  color: var(--bg);
  opacity: 0.9;
}

.visit__btn--ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.visit__btn--ghost:hover {
  color: var(--text);
}

.visit-disclosure {
  margin-top: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg);
  max-width: 100%;
  scroll-margin-top: 3.5rem;
}

.visit-disclosure + .visit-disclosure {
  margin-top: 0.65rem;
}

.visit-disclosure__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  font-size: 0.9375rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.visit-disclosure__summary::-webkit-details-marker {
  display: none;
}

.visit-disclosure__summary::after {
  content: "▾";
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
  color: var(--accent);
  transition: transform 0.2s ease;
}

.visit-disclosure:not([open]) .visit-disclosure__summary::after {
  transform: rotate(-90deg);
}

.visit-disclosure__content {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
  min-width: 0;
  overflow-x: clip;
  overflow-wrap: anywhere;
}

.section--alt .visit-disclosure {
  background: var(--bg);
}

.visit-disclosure__content .donation__card {
  background: var(--bg-alt);
}

.visit-disclosure__content > :first-child {
  margin-top: 1rem;
}

/* Candle */

.candle-intro {
  margin-bottom: 1.5rem;
}

.candle__list {
  list-style: none;
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.candle__empty,
.candle__local-note {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.candle-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 2px;
}

.candle-item__visual {
  position: relative;
  width: 2.5rem;
  height: 4.5rem;
  flex-shrink: 0;
}

.candle-stick {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 1.1rem;
  height: 3rem;
  transform: translateX(-50%);
  border-radius: 2px 2px 1px 1px;
  background: linear-gradient(90deg, #e8dfd2 0%, #f7f1e8 45%, #d9cdbd 100%);
}

.candle-flame {
  position: absolute;
  left: 50%;
  top: 0.15rem;
  width: 1.2rem;
  height: 1.6rem;
  transform: translateX(-50%);
}

.candle-flame__glow,
.candle-flame__core {
  position: absolute;
  inset: 0;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}

.candle-flame__glow {
  background: radial-gradient(circle, rgba(255, 196, 84, 0.55) 0%, rgba(255, 196, 84, 0) 72%);
  filter: blur(1px);
  animation: flame-glow 2.4s ease-in-out infinite;
}

.candle-flame__core {
  inset: 0.2rem 0.25rem 0.35rem;
  background: linear-gradient(180deg, #fff4c7 0%, #ffb347 55%, #e86b1f 100%);
  animation: flame-flicker 1.8s ease-in-out infinite;
}

.candle-item__name {
  font-size: 1rem;
  color: var(--text);
}

.candle-item__timer {
  margin-top: 0.2rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.candle__form {
  display: grid;
  gap: 1rem;
}

.candle__field {
  display: grid;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.candle__field input,
.candle__field select {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.candle__submit {
  justify-self: start;
  padding: 0.7rem 1.2rem;
  border: 0;
  border-radius: 2px;
  background: var(--accent);
  color: var(--bg);
  font: inherit;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.candle__submit:hover,
.candle__submit:focus-visible {
  opacity: 0.92;
}

.candle__submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

.candle__status {
  min-height: 1.4rem;
  margin-top: 0.85rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.candle__status.is-error {
  color: #8a4a3a;
}

/* Donation */

.donation__card {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 2px;
}

.donation__subtitle {
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
}

.donation__methods {
  list-style: none;
  display: grid;
  gap: 1rem;
  margin: 1rem 0 0;
}

.donation__methods li {
  line-height: 1.55;
}

.donation__phone {
  display: inline-block;
  margin-top: 0.2rem;
  font-size: 1.125rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--accent);
}

.donation__phone:hover {
  color: var(--text);
}

.donation__wallet {
  display: block;
  margin-top: 0.35rem;
  padding: 0.55rem 0.65rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--text);
  word-break: break-all;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.donation__note {
  margin-top: 1rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.donation__examples {
  margin-left: 0;
  list-style: none;
  display: grid;
  gap: 0.65rem;
}

.donation__examples code {
  display: block;
  padding: 0.65rem 0.75rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
  color: var(--text);
  word-break: break-word;
}

@keyframes flame-flicker {
  0%,
  100% {
    transform: scale(1) rotate(-2deg);
    opacity: 1;
  }
  35% {
    transform: scale(1.06, 0.94) rotate(2deg);
    opacity: 0.92;
  }
  70% {
    transform: scale(0.96, 1.05) rotate(-1deg);
    opacity: 0.98;
  }
}

@keyframes flame-glow {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@media (min-width: 640px) {
  .candle__form {
    grid-template-columns: 1fr 10rem auto;
    align-items: end;
  }
}

/* Memory hub */

.memory-hub {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .memory-hub {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .memory-card--wide {
    grid-column: 1 / -1;
  }
}

.memory-card {
  padding: 1.25rem 1.35rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  min-width: 0;
}

.section--alt .memory-card {
  background: var(--bg);
}

.memory-card__title {
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.memory-card__lead {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
  line-height: 1.55;
}

.legacy-list {
  list-style: none;
  display: grid;
  gap: 1rem;
  margin-bottom: 1.35rem;
}

.legacy-item {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.legacy-item__mark {
  flex-shrink: 0;
  font-size: 1.1rem;
  line-height: 1.4;
}

.legacy-item strong {
  display: block;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.legacy-item p {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.memory-days {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.memory-days__title {
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.memory-days__list {
  list-style: none;
  display: grid;
  gap: 0.55rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.flowers__list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
  min-height: 1.5rem;
}

.flowers__item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8125rem;
}

.flowers__icon {
  line-height: 1;
}

.flowers__empty,
.guestbook__empty {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.flowers__form,
.guestbook__form {
  display: grid;
  gap: 0.85rem;
}

.flowers__field,
.guestbook__field {
  display: grid;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.flowers__field input,
.guestbook__field input,
.guestbook__field textarea {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg-alt);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.flowers__submit,
.guestbook__submit {
  justify-self: start;
  padding: 0.7rem 1.2rem;
  border: 0;
  border-radius: 2px;
  background: var(--accent);
  color: var(--bg);
  font: inherit;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.flowers__submit:hover,
.guestbook__submit:hover,
.flowers__submit:focus-visible,
.guestbook__submit:focus-visible {
  opacity: 0.92;
}

.guestbook-intro {
  margin-top: -0.75rem;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

.guestbook-intro p + p {
  margin-top: 0.85rem;
}

.guestbook__consent {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  grid-column: 1 / -1;
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.5;
  cursor: pointer;
}

.guestbook__consent input {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.2rem;
  accent-color: var(--accent);
}

.guestbook__honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.guestbook__status,
.share__status {
  min-height: 1.35rem;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.guestbook__list {
  list-style: none;
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
  max-height: 22rem;
  overflow-y: auto;
}

.guestbook__entry {
  padding: 0.9rem 1rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 2px;
}

.guestbook__text {
  font-style: italic;
  line-height: 1.6;
}

.guestbook__meta {
  margin-top: 0.55rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: normal;
}

.share__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.share__btn {
  display: inline-block;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg-alt);
  color: var(--accent);
  font: inherit;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
}

.share__btn--primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.share__btn--ghost {
  background: transparent;
}

.share__btn:hover,
.share__btn:focus-visible {
  opacity: 0.9;
}

.memory-card--candle .candle__list {
  max-height: 14rem;
  overflow-y: auto;
}

.memory-card--candle .candle-item {
  background: var(--bg-alt);
}

.memory-card--quotes .memories {
  gap: 1rem;
}

@media (min-width: 640px) {
  .guestbook__form {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .guestbook__field:last-of-type {
    grid-column: 1 / -1;
  }

  .guestbook__submit {
    grid-column: 1 / -1;
  }
}

/* Memories */

.memories {
  list-style: none;
  display: grid;
  gap: 1.5rem;
}

.memories blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1.25rem;
}

.memories blockquote p {
  font-style: italic;
  color: var(--text);
}

.memories footer {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: normal;
}

/* Footer */

.footer {
  padding: calc(var(--space) * 2) var(--space);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer__candle {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  opacity: 0.7;
}

.footer__purpose {
  max-width: 42ch;
  margin: 0.75rem auto 0;
  font-size: 0.75rem;
  line-height: 1.55;
  color: color-mix(in srgb, var(--text-muted) 82%, transparent);
}

.footer__credit {
  max-width: 34ch;
  margin: 1rem auto 0;
  font-size: 0.8125rem;
  font-style: italic;
  line-height: 1.6;
  color: var(--text-muted);
}

.footer__top {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-muted);
}

.footer__top:hover {
  color: var(--accent);
}

/* Lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space);
  background: rgba(20, 20, 20, 0.92);
  cursor: zoom-out;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: min(90vw, 900px);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 2px;
}

.lightbox__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
}

.lightbox__btn:hover,
.lightbox__btn:focus-visible {
  background: rgba(255, 255, 255, 0.22);
}

.lightbox__btn--prev {
  left: 1rem;
}

.lightbox__btn--next {
  right: 1rem;
}

/* Mobile */

@media (max-width: 767px) {
  html {
    scroll-padding-top: 3rem;
  }

  .hero {
    padding-top: var(--space);
    padding-left: max(var(--space), var(--safe-left));
    padding-right: max(var(--space), var(--safe-right));
  }

  .nav {
    position: sticky;
    top: 0;
    z-index: 40;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
    max-width: 100%;
    margin: 0 0 calc(var(--space) * 1.25);
    padding: 0.55rem 0;
    background: rgba(250, 249, 247, 0.95);
    border-bottom: 1px solid var(--border);
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav a {
    flex: 0 0 auto;
    padding: 0.5rem 0.7rem;
    font-size: 0.6875rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
  }

  .section {
    padding: calc(var(--space) * 2) max(var(--space), var(--safe-left))
      calc(var(--space) * 2) max(var(--space), var(--safe-right));
  }

  .hero h1,
  .hero__name {
    font-size: clamp(0.9rem, 4.2vw, 2rem);
    line-height: 1.2;
  }

  .hero__dates {
    flex-direction: column;
    font-size: 0.975rem;
    line-height: 1.45;
  }

  .hero__dash {
    display: none;
  }

  .hero__epitaph {
    max-width: none;
    font-size: 1rem;
    line-height: 1.65;
  }

  .portrait,
  .portrait img {
    max-width: min(320px, 100%);
  }

  .visit-disclosure__summary {
    font-size: 0.8125rem;
    padding: 0.8rem 0.85rem;
    gap: 0.65rem;
  }

  .visit-disclosure__content {
    padding: 0 0.85rem 0.85rem;
  }

  #gallery.section {
    padding-left: max(0.75rem, var(--safe-left));
    padding-right: max(0.75rem, var(--safe-right));
  }

  .gallery__item img {
    min-height: 0;
    max-height: none;
    aspect-ratio: 3 / 4;
  }

  .gallery-carousel__btn {
    width: 3rem;
    height: 3rem;
  }

  .visit__actions {
    flex-direction: column;
  }

  .visit__btn {
    display: block;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.8rem 1rem;
    text-align: center;
  }

  .visit ul,
  .visit--remember ul {
    margin-left: 0.85rem;
    padding-right: 0.15rem;
  }

  .timeline {
    padding-left: 1.1rem;
  }

  .timeline li::before {
    left: -1.1rem;
  }

  .memories blockquote {
    padding-left: 1rem;
  }

  .donation__card {
    padding: 1rem;
  }

  .donation__examples code {
    font-size: 0.75rem;
    padding: 0.55rem 0.65rem;
  }

  .candle__field input,
  .candle__field select {
    min-height: 2.75rem;
    font-size: 16px;
  }

  .candle__submit {
    width: 100%;
    min-height: 2.75rem;
    justify-self: stretch;
  }

  .memory-card--candle .candle__form {
    grid-template-columns: 1fr;
  }

  .flowers__submit,
  .guestbook__submit,
  .share__btn {
    width: 100%;
    min-height: 2.75rem;
    text-align: center;
  }

  .share__actions {
    flex-direction: column;
  }

  .guestbook__form {
    grid-template-columns: 1fr;
  }

  .footer {
    padding-bottom: calc(var(--space) * 2 + var(--safe-bottom));
    padding-left: max(var(--space), var(--safe-left));
    padding-right: max(var(--space), var(--safe-right));
  }

  .footer__purpose,
  .footer__credit {
    max-width: none;
    padding: 0 0.25rem;
  }

  .lightbox {
    padding: max(0.75rem, var(--safe-left)) max(0.75rem, var(--safe-right))
      max(1rem, var(--safe-bottom));
  }

  .lightbox__btn {
    top: auto;
    bottom: max(1rem, var(--safe-bottom));
    transform: none;
    width: 3rem;
    height: 3rem;
  }

  .lightbox__btn--prev {
    left: max(0.75rem, var(--safe-left));
  }

  .lightbox__btn--next {
    right: max(0.75rem, var(--safe-right));
  }

  .lightbox img {
    max-height: calc(100vh - 7rem - var(--safe-bottom));
  }
}

@media (max-width: 380px) {
  .nav a {
    padding: 0.45rem 0.55rem;
    font-size: 0.625rem;
  }
}

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

  .gallery__item img {
    transition: none;
  }

  .lightbox {
    transition: none;
  }

  .candle-flame__glow,
  .candle-flame__core {
    animation: none;
  }
}