:root {
  color-scheme: light;
  --paper: #f7f4ee;
  --ink: #25271f;
  --muted: #5f5d50;
  --slate-blue: #37566f;
  --rule: #aabac7;
  --serif: Georgia, "Times New Roman", serif;
  font-family: system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }

body { margin: 0; }

.page {
  width: min(100% - 6rem, 69rem);
  margin-inline: auto;
  padding-block: clamp(3rem, 7vw, 6rem);
}

.tribute {
  display: grid;
  grid-template-columns: 1fr 0.92fr;
  grid-template-areas:
    "heading portrait"
    "services portrait";
  align-items: center;
  gap: 1.75rem clamp(2rem, 7vw, 7rem);
}

.dedication {
  grid-area: heading;
  align-self: end;
}

.kicker {
  margin: 0 0 1.125rem;
  color: var(--slate-blue);
  font-size: 0.875rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1, h2, p, figure { margin: 0; }

h1 {
  font: 400 clamp(3.4rem, 6.8vw, 6.2rem) / 0.99 var(--serif);
  letter-spacing: -0.045em;
}

.portrait { grid-area: portrait; }

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

.services {
  grid-area: services;
  align-self: start;
}

.service {
  padding-block: 0.95rem 1rem;
  border-top: 1px solid var(--rule);
}

.service:last-of-type { border-bottom: 1px solid var(--rule); }

.service h2 {
  margin-bottom: 0.2rem;
  color: var(--slate-blue);
  font: 400 1.55rem / 1.2 var(--serif);
}

.service h3 {
  margin: 0.75rem 0 0.15rem;
  font-size: 0.95rem;
  font-weight: 650;
}

.service-location { margin-top: 0.6rem; }

.service strong { color: var(--ink); }

time, .service p {
  color: var(--muted);
  line-height: 1.5;
}

time { font-size: 1rem; }

.document-link {
  color: var(--slate-blue);
  text-underline-offset: 0.2em;
}

.document-page {
  max-width: 44rem;
}

.document-page .service {
  border-bottom: 1px solid var(--rule);
}

.memories {
  margin-top: clamp(3rem, 7vw, 6rem);
  padding-top: clamp(2rem, 5vw, 4rem);
  border-top: 1px solid var(--rule);
  text-align: center;
}

.memories h2 {
  margin-bottom: 1.5rem;
  color: var(--slate-blue);
  font: 400 clamp(2rem, 4vw, 3.125rem) / 1.1 var(--serif);
  letter-spacing: -0.025em;
}

.memories figure {
  max-width: 23rem;
  margin-inline: auto;
}

@media (max-width: 46rem) {
  .page {
    width: min(100% - 2.5rem, 32rem);
    padding-block: 2.5rem 3.5rem;
  }

  .tribute {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "heading" "services" "portrait";
    gap: 1.6rem;
  }

  .dedication { text-align: center; }

  .kicker { margin-bottom: 0.65rem; }

  h1 { font-size: clamp(2.65rem, 10.5vw, 4.55rem); }

  .desktop-break { display: none; }

  .portrait { margin-top: 0.25rem; }
}

.gallery-link {
  display: inline-block;
  margin-top: 1.25rem;
  color: var(--slate-blue);
  font-weight: 650;
  line-height: 1.5;
  text-underline-offset: 0.25em;
}

.gallery-link span { margin-left: 0.25em; }

.gallery-page { padding-top: clamp(2rem, 5vw, 4.5rem); }

.gallery-home { margin: 0; }

.gallery-heading {
  margin-block: clamp(2.25rem, 6vw, 4.5rem) 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.gallery-heading h1 {
  font-size: clamp(2.6rem, 6vw, 5rem);
  line-height: 1.04;
}

.gallery-heading p {
  margin-top: 0.65rem;
  color: var(--muted);
  line-height: 1.5;
}

.gallery-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem 1.25rem;
  margin-top: 1.1rem;
}

.gallery-nav {
  display: flex;
  gap: 1.25rem;
}

.gallery-actions .gallery-link { margin-top: 0; }

.gallery-upload {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--rule);
}

.gallery-section + .gallery-section { margin-top: 3rem; }

.gallery-section h2 {
  margin-bottom: 1rem;
  color: var(--slate-blue);
  font: 400 clamp(1.65rem, 3vw, 2.4rem) / 1.1 var(--serif);
}

.photo-grid, .video-grid {
  display: grid;
  gap: clamp(0.6rem, 2vw, 1.25rem);
}

.photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.video-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.photo-grid a { display: block; }

.photo-grid img {
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 35%;
}

.video-grid video {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  background: var(--ink);
}

#photo-viewer {
  max-width: min(95vw, 64rem);
  max-height: 95dvh;
  padding: 0;
  border: 0;
  color: white;
  background: #22231e;
}

#photo-viewer::backdrop { background: rgb(0 0 0 / 85%); }

#photo-viewer form {
  display: flex;
  justify-content: flex-end;
  padding: 0.3rem;
}

#photo-viewer button {
  min-height: 44px;
  padding: 0.5rem 0.8rem;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

#photo-viewer img {
  width: auto;
  max-width: 100%;
  max-height: calc(95dvh - 54px);
  object-fit: contain;
}

@media (max-width: 46rem) {
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .video-grid { grid-template-columns: 1fr; }
}

.gallery-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.65rem;
}

.slideshow-launch {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--slate-blue);
  color: white;
  background: var(--slate-blue);
  font: inherit;
  font-weight: 650;
  line-height: 1.5;
  cursor: pointer;
}

#gallery-slideshow {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: white;
  background: #101419;
}

.slideshow-screen {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  background: #101419;
}

#gallery-slideshow::backdrop { background: #101419; }

.slideshow-stage, .slideshow-photo {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  min-height: 0;
  place-items: center;
}

.slideshow-stage > * {
  grid-area: 1 / 1;
  min-width: 0;
  width: 100%;
  height: 100%;
}

.slideshow-stage > [hidden] { display: none; }

.slideshow-photo img, .slideshow-stage video {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  background: transparent;
}

.slideshow-message {
  display: grid;
  place-items: center;
  padding: 1rem;
  text-align: center;
}

.slideshow-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem 1.25rem;
  padding: 0.6rem 0.85rem max(0.6rem, env(safe-area-inset-bottom));
  background: #1b252f;
}

.slideshow-position {
  color: #d9e4ed;
  font-variant-numeric: tabular-nums;
}

.slideshow-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}

.slideshow-controls button {
  min-height: 44px;
  padding: 0.35rem 0.7rem;
  border: 1px solid #73899b;
  color: white;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.slideshow-controls button:hover { background: #37566f; }
.slideshow-controls button:focus-visible { outline: 2px solid white; outline-offset: 2px; }
