:root {
  color-scheme: dark;
  --font-display: "Cormorant Garamond", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-body: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --paper: #121211;
  --paper-soft: #1a1916;
  --surface: #1f1d19;
  --surface-muted: #29251f;
  --ink: #f1eadf;
  --ink-soft: #d2c8b9;
  --ink-muted: #9c9283;
  --line: rgba(244, 233, 216, 0.16);
  --accent: #c1a165;
  --accent-deep: #8fa993;
  --accent-velvet: #a94d43;
  --accent-soft: rgba(193, 161, 101, 0.16);
  --shadow-soft: 0 18px 60px rgba(0, 0, 0, 0.36);
  --shadow-float: 0 28px 90px rgba(0, 0, 0, 0.55);

  --radius-xs: 3px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 14px;

  --space-1: 0.35rem;
  --space-2: 0.7rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.25rem;
  --space-6: 3.25rem;
  --space-7: 4.75rem;
  --space-8: 6.5rem;
  --space-9: 8rem;

  --step--1: clamp(0.86rem, 0.9rem, 0.9rem);
  --step-0: clamp(1rem, 1.04rem, 1.04rem);
  --step-1: clamp(1.14rem, 1.22rem, 1.22rem);
  --step-2: clamp(1.42rem, 1.58rem, 1.58rem);
  --step-3: clamp(1.85rem, 2.1rem, 2.1rem);
  --step-4: clamp(2.35rem, 3rem, 3rem);
  --step-5: clamp(3.1rem, 4.7rem, 4.7rem);

  --content: min(1120px, calc(100% - 2rem));
  --wide: min(1420px, calc(100% - 1.2rem));
  --header-height: 72px;
}

@media (min-width: 760px) {
  :root {
    --content: min(1120px, calc(100% - 4rem));
    --wide: min(1480px, calc(100% - 3rem));
    --step-5: clamp(4.5rem, 6.6rem, 6.6rem);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 1.5rem);
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 34rem),
    var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

body.lightbox-open {
  overflow: hidden;
}

img,
video {
  display: block;
  max-width: 100%;
}

img {
  image-orientation: from-image;
}

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

button {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 999;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-160%);
  transition: transform 180ms ease;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: var(--step-2);
  opacity: 1;
  animation: loader-failsafe 1ms linear 2.4s forwards;
  transition: opacity 520ms ease, visibility 520ms ease;
}

.page-loader.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

body.is-ready .page-loader {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

@keyframes loader-failsafe {
  to {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  justify-content: space-between;
  padding: 0.8rem max(1rem, calc((100% - 1480px) / 2 + 1rem));
  border-bottom: 1px solid transparent;
  color: var(--ink);
  backdrop-filter: blur(18px);
  transition: background-color 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.site-header.is-scrolled {
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  border-color: var(--line);
  box-shadow: 0 10px 28px rgba(31, 27, 20, 0.06);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 48px;
  flex: 0 0 auto;
}

.brand-mark {
  width: 42px;
  height: 42px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.1;
}

.brand strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
}

.brand small {
  color: var(--ink-muted);
  font-size: 0.72rem;
}

.primary-nav {
  display: none;
  align-items: center;
  gap: clamp(0.8rem, 1rem, 1rem);
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.primary-nav a {
  padding: 0.8rem 0.1rem;
  border-bottom: 1px solid transparent;
  transition: color 180ms ease, border-color 180ms ease;
}

.primary-nav a:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.gallery-reveal-band,
.quiet-button,
.lightbox-close,
.lightbox-nav {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  color: var(--ink);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.gallery-reveal-band:hover,
.quiet-button:hover,
.lightbox-close:hover,
.lightbox-nav:hover {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--line));
  transform: translateY(-1px);
}

.hero {
  position: relative;
  min-height: auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  padding: clamp(1.2rem, 3vw, 2.5rem) 1rem clamp(1.4rem, 3.4vw, 2.8rem);
  text-align: center;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: var(--paper-soft);
}

.hero-media::before,
.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.hero-media::before {
  background:
    radial-gradient(circle at 50% 38%, transparent 0, transparent 18%, rgba(20, 18, 14, 0.58) 100%),
    linear-gradient(90deg, rgba(18, 17, 14, 0.84), rgba(18, 17, 14, 0.44) 50%, rgba(18, 17, 14, 0.84)),
    linear-gradient(180deg, rgba(18, 17, 14, 0.18), rgba(18, 17, 14, 0.78));
}

.hero-media::after {
  background: linear-gradient(180deg, transparent 64%, var(--paper) 100%);
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 38%;
  filter: blur(16px) saturate(0.78) contrast(1.04);
  opacity: 0.52;
  transform: scale(1.12);
}

.film-grain {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0.13;
  mix-blend-mode: soft-light;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(180deg, rgba(0, 0, 0, 0.16) 1px, transparent 1px);
  background-size: 3px 3px;
}

.hero-composition {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: var(--space-3);
  align-items: start;
}

.hero-inner {
  position: relative;
  z-index: 2;
  min-width: 0;
  width: 100%;
  max-width: 1080px;
  color: #fff8ec;
  text-shadow: 0 4px 28px rgba(0, 0, 0, 0.34);
}

.hero-inner::before {
  content: none;
}

.hero-portrait {
  position: relative;
  z-index: 1;
  width: 320px;
  max-width: 100%;
  margin: 0 auto;
  justify-self: center;
  padding: 0.65rem;
  border: 1px solid rgba(255, 248, 236, 0.24);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 248, 236, 0.08), rgba(255, 248, 236, 0.025)),
    rgba(18, 17, 14, 0.18);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.36);
}

.hero-portrait::before {
  content: "";
  position: absolute;
  inset: -0.8rem;
  z-index: -1;
  border: 1px solid rgba(193, 161, 101, 0.22);
  border-radius: var(--radius-md);
  opacity: 0.8;
}

.hero-portrait img {
  width: 100%;
  height: auto;
  max-height: 430px;
  object-fit: contain;
  object-position: center;
  border-radius: var(--radius-sm);
}

.eyebrow,
.section-kicker,
.media-date {
  margin: 0 0 var(--space-2);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: rgba(255, 248, 236, 0.84);
  margin-bottom: var(--space-3);
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: 0;
}

h1 {
  color: #fff8ec;
  max-width: none;
  font-size: 5rem;
  line-height: 0.94;
  white-space: nowrap;
}

h2 {
  font-size: var(--step-4);
}

h3 {
  font-size: var(--step-2);
  line-height: 1.08;
}

.nickname {
  margin: var(--space-2) 0 0;
  color: rgba(255, 248, 236, 0.86);
  font-family: var(--font-display);
  font-size: 2.45rem;
}

.memorial-dates {
  width: min(820px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: var(--space-4) auto 0;
  overflow: hidden;
  border: 1px solid rgba(255, 248, 236, 0.28);
  border-radius: var(--radius-md);
  background: rgba(255, 248, 236, 0.14);
  backdrop-filter: blur(10px);
}

.memorial-dates div {
  padding: 1rem;
  background: rgba(18, 17, 14, 0.2);
}

.memorial-dates div + div {
  border-top: 1px solid rgba(255, 248, 236, 0.14);
}

.memorial-dates dt {
  color: rgba(255, 248, 236, 0.68);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.memorial-dates dd {
  margin: 0.2rem 0 0;
  color: #fff8ec;
  font-size: 1rem;
}

.section {
  width: var(--content);
  margin: 0 auto;
  padding: var(--space-6) 0;
}

.section-grid {
  display: grid;
  gap: var(--space-5);
  align-items: center;
}

.section-copy {
  max-width: 700px;
}

.section-copy p,
.section-heading p,
.wide-heading p,
.closing-inner p {
  color: var(--ink-soft);
}

.lead {
  margin-top: var(--space-4);
  color: var(--ink);
  font-size: var(--step-1);
}

blockquote {
  margin: var(--space-5) 0;
  padding: var(--space-4) 0 var(--space-4) var(--space-4);
  border-left: 2px solid var(--accent);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1.28;
}

.portrait-panel {
  margin: 0;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 84%, var(--paper));
  box-shadow: var(--shadow-soft);
}

.portrait-panel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
}

.portrait-panel img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

figcaption,
.media-meta,
.site-footer,
.closing-dates {
  color: var(--ink-muted);
  font-size: var(--step--1);
}

.portrait-panel figcaption {
  padding: 0.85rem 1rem 1rem;
}

.section-heading,
.wide-heading {
  margin-bottom: var(--space-5);
}

.section-heading {
  max-width: 780px;
}

.section-heading--narrow {
  max-width: 680px;
}

.wide-heading {
  display: grid;
  gap: var(--space-3);
  align-items: end;
}

.wide-heading p {
  max-width: 620px;
}

.media-open-button {
  position: absolute;
  inset: 0;
  border: 0;
  background: transparent;
  color: transparent;
  cursor: zoom-in;
}

.gallery-section {
  width: min(1800px, calc(100% - 1rem));
  padding-top: var(--space-4);
  overflow: visible;
}

.memory-sphere {
  position: relative;
  width: min(1800px, 100%);
  height: var(--sphere-view-height, clamp(820px, 74vw, 1320px));
  min-height: 0;
  display: block;
  margin: 0 auto clamp(1.5rem, 4vw, 3.5rem);
  overflow: hidden;
  perspective: 14000px;
  perspective-origin: 50% 50%;
  cursor: grab;
  isolation: isolate;
  touch-action: none;
}

.memory-sphere[hidden] {
  display: none;
}

.memory-sphere__halo {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--sphere-diameter, 980px) * var(--sphere-zoom, 0.72));
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow:
    inset 0 0 90px color-mix(in srgb, var(--accent) 13%, transparent),
    0 38px 130px rgba(0, 0, 0, 0.32);
}

.memory-sphere__stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--sphere-stage-size, min(980px, 92vw));
  max-width: none;
  aspect-ratio: 1;
  cursor: grab;
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
  transform: translate(-50%, -50%) scale(var(--sphere-zoom, 0.72)) rotateZ(var(--sphere-rotate-z, 0deg)) rotateX(var(--sphere-rotate-x, 0deg)) rotateY(var(--sphere-rotate-y, 0deg));
  transition: transform 120ms ease-out;
}

.memory-sphere.is-dragging,
.memory-sphere__stage.is-dragging {
  cursor: grabbing;
}

.memory-sphere__stage.is-dragging {
  transition: none;
}

.sphere-tile {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--tile-width, var(--tile-base, 54px));
  height: var(--tile-height, var(--tile-base, 54px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 248, 236, 0.24);
  border-radius: 3px;
  background: var(--surface-muted);
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.24),
    0 2px 10px rgba(255, 248, 236, 0.06);
  cursor: zoom-in;
  transform:
    translate(-50%, -50%)
    rotateY(var(--rotate-y))
    rotateX(var(--rotate-x))
    translateZ(var(--depth));
  transform-style: preserve-3d;
  pointer-events: auto;
  backface-visibility: visible;
  -webkit-backface-visibility: visible;
  user-select: none;
  -webkit-user-drag: none;
}

.sphere-tile__skin {
  display: grid;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background: var(--surface-muted);
  transform: translateZ(2px);
}

.sphere-tile img,
.sphere-tile__skin img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sphere-tile:hover,
.sphere-tile:focus-visible {
  border-color: rgba(255, 248, 236, 0.72);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.42);
}

.sphere-spy {
  position: absolute;
  left: var(--preview-x, 50%);
  top: var(--preview-y, 50%);
  z-index: 12;
  width: min(340px, calc(100% - 2rem));
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink-soft);
  transform: translate3d(0, 0, 0);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.sphere-spy.is-clickable {
  pointer-events: auto;
}

.sphere-spy[hidden] {
  display: none;
}

.sphere-preview-card {
  position: relative;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 248, 236, 0.34);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.52);
  cursor: zoom-in;
  backdrop-filter: blur(14px);
}

.sphere-preview-card img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
}

.sphere-preview-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.95rem 1rem 0.8rem;
  color: rgba(255, 248, 236, 0.9);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72));
  font-size: 0.82rem;
  line-height: 1.35;
  text-align: left;
}

.gallery-reveal-actions {
  width: min(920px, calc(100% - 2rem));
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 430px));
  justify-content: center;
  gap: clamp(0.9rem, 2vw, 1.4rem);
  margin: clamp(0.7rem, 2vw, 1.5rem) auto var(--space-6);
}

.gallery-reveal-band {
  width: 100%;
  min-height: 78px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0.95rem 1.35rem 1.05rem;
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 248, 236, 0.085), rgba(255, 248, 236, 0.025)),
    color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--ink);
  text-align: center;
  box-shadow:
    0 26px 70px rgba(0, 0, 0, 0.42),
    0 8px 24px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 248, 236, 0.08);
}

.gallery-reveal-band span {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3vw, 2.65rem);
  line-height: 0.95;
  text-transform: capitalize;
}

.gallery-reveal-band small {
  color: var(--ink-muted);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gallery-reveal-band:hover {
  background:
    linear-gradient(180deg, rgba(255, 248, 236, 0.12), rgba(255, 248, 236, 0.035)),
    color-mix(in srgb, var(--surface) 93%, transparent);
  box-shadow:
    0 32px 86px rgba(0, 0, 0, 0.5),
    0 10px 28px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 248, 236, 0.11);
}

.gallery-panel[hidden] {
  display: none;
}

.gallery-panel {
  display: grid;
  gap: var(--space-7);
  padding: var(--space-5) 0 var(--space-6);
}

.gallery-subsection {
  width: var(--wide);
  margin-left: 50%;
  transform: translateX(-50%);
}

.gallery-subsection[hidden] {
  display: none;
}

.gallery-subsection h3 {
  margin-bottom: var(--space-4);
  font-size: var(--step-3);
}

.gallery-grid {
  width: var(--wide);
  margin-left: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-flow: dense;
  gap: 0.35rem;
}

.media-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-xs);
  background: var(--surface-muted);
  box-shadow: none;
  transform: translateZ(0);
}

.media-card figure {
  height: 100%;
  margin: 0;
}

.media-frame {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 170px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--surface-muted);
}

.media-card.is-landscape .media-frame,
.media-card:nth-child(5n + 2) .media-frame {
  aspect-ratio: 4 / 3;
}

.media-card.is-wide .media-frame,
.media-card:nth-child(7n + 4) .media-frame {
  aspect-ratio: 16 / 9;
}

.media-frame img,
.media-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 520ms ease, filter 520ms ease, opacity 520ms ease;
}

.media-card:hover .media-frame img,
.media-card:hover .media-frame video {
  transform: scale(1.045);
  filter: saturate(1.02) contrast(1.03);
}

.media-card figcaption {
  display: none;
}

.media-card h3 {
  font-family: var(--font-body);
  font-size: 0.98rem;
  font-weight: 650;
  line-height: 1.28;
}

.media-card p {
  margin: 0.35rem 0 0;
}

.media-fallback {
  display: grid;
  gap: 0.45rem;
  place-items: center;
  padding: var(--space-4);
  color: var(--ink-soft);
  text-align: center;
}

.media-fallback strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 500;
}

.media-fallback a {
  border-bottom: 1px solid var(--accent);
  color: var(--ink);
}

.empty-state {
  width: var(--content);
  margin: 0 auto;
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink-soft);
}

.quiet-button {
  min-height: 46px;
  padding: 0.7rem 1rem;
}

.media-link-button,
.media-download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-top: 0.75rem;
  padding: 0.48rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.88rem;
}

.media-link-button:hover,
.media-download-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.transcript {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
}

.closing-tribute {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(220px, 25svh, 345px);
  overflow: hidden;
  padding: var(--space-4) 1rem;
  text-align: center;
  background:
    linear-gradient(180deg, var(--paper), color-mix(in srgb, var(--accent-deep) 18%, var(--paper))),
    var(--paper);
}

.closing-inner {
  max-width: 760px;
}

.closing-inner h2 {
  margin-bottom: var(--space-4);
}

.closing-inner p {
  font-size: var(--step-1);
}

.site-footer {
  width: 100%;
  margin: 0;
  padding: 1rem;
  border-top: 1px solid var(--line);
  background: #0b0b0a;
  text-align: center;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 11, 10, 0.82);
  backdrop-filter: blur(14px);
}

.lightbox-panel {
  position: relative;
  width: min(1180px, 100%);
  max-height: min(880px, calc(100svh - 2rem));
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 248, 236, 0.2);
  border-radius: var(--radius-md);
  background: #12110f;
  color: #fff8ec;
  box-shadow: var(--shadow-float);
}

.lightbox-stage {
  display: grid;
  place-items: center;
  min-height: 280px;
  overflow: hidden;
  background: #0d0c0b;
}

.lightbox-stage img,
.lightbox-stage video {
  width: 100%;
  max-height: calc(100svh - 2.5rem);
  object-fit: contain;
}

.lightbox-caption {
  padding: var(--space-3) var(--space-4) var(--space-4);
}

.lightbox-caption h2 {
  color: #fff8ec;
  font-size: var(--step-2);
}

.lightbox-caption p {
  margin: 0.45rem 0 0;
  color: rgba(255, 248, 236, 0.72);
}

.lightbox-caption .media-date {
  color: rgba(255, 248, 236, 0.6);
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  z-index: 2;
  border-color: rgba(255, 248, 236, 0.24);
  background: rgba(18, 17, 15, 0.72);
  color: #fff8ec;
}

.lightbox-close {
  top: 0.75rem;
  right: 0.75rem;
  min-height: 42px;
  padding: 0.5rem 0.85rem;
}

.lightbox-nav {
  top: 50%;
  min-width: 50px;
  min-height: 50px;
  transform: translateY(-50%);
}

.lightbox-nav:hover {
  transform: translateY(calc(-50% - 1px));
}

.lightbox-nav--prev {
  left: 0.75rem;
}

.lightbox-nav--next {
  right: 0.75rem;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 700ms ease, transform 700ms ease;
}

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

@media (min-width: 620px) {
  .memorial-dates {
    grid-template-columns: repeat(3, 1fr);
  }

  .memorial-dates div + div {
    border-top: 0;
    border-left: 1px solid rgba(255, 248, 236, 0.14);
  }

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

@media (min-width: 900px) {
  .primary-nav {
    display: flex;
  }

  .section-grid--text-media {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 0.72fr);
  }

  .section-grid--media-text {
    grid-template-columns: minmax(320px, 0.62fr) minmax(0, 1fr);
  }

  .wide-heading {
    grid-template-columns: minmax(0, 0.95fr) minmax(320px, 0.55fr);
  }

  .gallery-tools {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .gallery-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .gallery-grid .media-card:nth-child(9n + 1),
  .gallery-grid .media-card:nth-child(12n + 8) {
    grid-column: span 2;
    grid-row: span 2;
  }

  .gallery-section {
    width: min(1800px, calc(100% - 3rem));
    padding-top: var(--space-5);
  }

  .gallery-subsection h3 {
    display: none;
  }

  .memory-sphere--mosaic {
    width: min(1700px, 100%);
    height: var(--sphere-view-height, 900px);
    margin-bottom: clamp(1.5rem, 4vw, 3.25rem);
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
    border-radius: var(--radius-md);
    background:
      linear-gradient(180deg, rgba(255, 248, 236, 0.07), rgba(255, 248, 236, 0.018)),
      linear-gradient(90deg, rgba(143, 169, 147, 0.12), transparent 30%, rgba(169, 77, 67, 0.11) 100%),
      var(--paper-soft);
    box-shadow:
      0 36px 110px rgba(0, 0, 0, 0.5),
      inset 0 1px 0 rgba(255, 248, 236, 0.09);
    perspective: 1350px;
    perspective-origin: 50% 42%;
  }

  .memory-sphere--mosaic::before,
  .memory-sphere--mosaic::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
  }

  .memory-sphere--mosaic::before {
    opacity: 0.28;
    background-image:
      linear-gradient(rgba(255, 248, 236, 0.11) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255, 248, 236, 0.09) 1px, transparent 1px);
    background-size: 86px 86px;
    mask-image: linear-gradient(180deg, transparent, #000 16%, #000 84%, transparent);
  }

  .memory-sphere--mosaic::after {
    background:
      linear-gradient(180deg, rgba(18, 17, 14, 0.24), transparent 22%, transparent 72%, rgba(18, 17, 14, 0.42)),
      linear-gradient(90deg, rgba(18, 17, 14, 0.5), transparent 18%, transparent 82%, rgba(18, 17, 14, 0.5));
  }

  .memory-sphere--mosaic .memory-sphere__halo {
    inset: 1.1rem;
    left: auto;
    top: auto;
    width: auto;
    aspect-ratio: auto;
    border-color: color-mix(in srgb, var(--accent) 32%, transparent);
    border-radius: var(--radius-md);
    transform: none;
    box-shadow:
      inset 0 0 0 1px rgba(255, 248, 236, 0.05),
      inset 0 0 90px rgba(193, 161, 101, 0.07);
  }

  .memory-sphere--mosaic .memory-sphere__stage {
    left: 50%;
    top: 50%;
    z-index: 2;
    width: min(var(--sphere-stage-size, 1320px), calc(100% - 4rem));
    height: min(var(--mosaic-stage-height, 720px), calc(100% - 4rem));
    aspect-ratio: auto;
    display: grid;
    grid-template-columns: repeat(var(--mosaic-columns, 12), minmax(0, 1fr));
    grid-auto-rows: var(--mosaic-row-height, 92px);
    grid-auto-flow: dense;
    gap: var(--mosaic-gap, 10px);
    align-content: center;
    cursor: grab;
    transform-style: flat;
    transform:
      translate(-50%, -50%)
      rotateX(var(--mosaic-tilt-x, 0deg))
      rotateY(var(--mosaic-tilt-y, 0deg))
      scale(var(--sphere-zoom, 1));
    transition: transform 170ms ease-out;
  }

  .memory-sphere--mosaic .sphere-tile {
    position: relative;
    left: auto;
    top: auto;
    z-index: 1;
    width: auto;
    height: auto;
    min-height: 0;
    grid-column: span var(--mosaic-col-span, 1);
    grid-row: span var(--mosaic-row-span, 1);
    border-color: rgba(255, 248, 236, 0.2);
    border-radius: var(--radius-xs);
    background: color-mix(in srgb, var(--surface-muted) 82%, var(--paper));
    box-shadow:
      0 15px 26px rgba(0, 0, 0, 0.36),
      0 2px 7px rgba(0, 0, 0, 0.28),
      inset 0 1px 0 rgba(255, 248, 236, 0.1);
    opacity: 0;
    transform:
      translateY(var(--mosaic-shift, 0px))
      rotateX(var(--mosaic-rotate-x, 0deg))
      rotateY(var(--mosaic-rotate-y, 0deg))
      rotateZ(var(--mosaic-rotate-z, 0deg));
    transition:
      transform 260ms ease,
      border-color 260ms ease,
      box-shadow 260ms ease,
      filter 260ms ease;
    animation: mosaicTileSettle 680ms ease forwards;
    animation-delay: var(--mosaic-delay, 0ms);
  }

  .memory-sphere--mosaic .sphere-tile::before,
  .memory-sphere--mosaic .sphere-tile::after {
    content: "";
    position: absolute;
    pointer-events: none;
  }

  .memory-sphere--mosaic .sphere-tile::before {
    inset: 0;
    z-index: 2;
    border-radius: inherit;
    background:
      linear-gradient(135deg, rgba(255, 248, 236, 0.18), transparent 34%),
      linear-gradient(180deg, transparent 58%, rgba(0, 0, 0, 0.28));
    opacity: 0.36;
    mix-blend-mode: soft-light;
  }

  .memory-sphere--mosaic .sphere-tile::after {
    left: 9%;
    right: 9%;
    bottom: -14px;
    height: 18px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.42);
    filter: blur(13px);
  }

  .memory-sphere--mosaic .sphere-tile__skin {
    position: relative;
    transform: translateZ(0);
    background:
      linear-gradient(180deg, rgba(255, 248, 236, 0.07), rgba(255, 248, 236, 0.015)),
      var(--surface-muted);
  }

  .memory-sphere--mosaic .sphere-tile img,
  .memory-sphere--mosaic .sphere-tile__skin img {
    filter: contrast(1.04) saturate(1.02);
    transition: transform 520ms ease, filter 520ms ease;
  }

  .memory-sphere--mosaic .sphere-tile--feature {
    border-color: color-mix(in srgb, var(--accent) 64%, rgba(255, 248, 236, 0.24));
    box-shadow:
      0 24px 52px rgba(0, 0, 0, 0.42),
      0 4px 16px rgba(193, 161, 101, 0.12),
      inset 0 1px 0 rgba(255, 248, 236, 0.13);
  }

  .memory-sphere--mosaic .sphere-tile--video .sphere-tile__skin::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    border-top: 13px solid transparent;
    border-bottom: 13px solid transparent;
    border-left: 19px solid rgba(255, 248, 236, 0.88);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
    transform: translate(-38%, -50%);
  }

  .memory-sphere--mosaic .sphere-tile:hover,
  .memory-sphere--mosaic .sphere-tile:focus-visible {
    z-index: 8;
    border-color: rgba(255, 248, 236, 0.78);
    box-shadow:
      0 34px 76px rgba(0, 0, 0, 0.56),
      0 8px 26px rgba(193, 161, 101, 0.15),
      inset 0 1px 0 rgba(255, 248, 236, 0.18);
    filter: brightness(1.07);
    transform:
      translateY(calc(var(--mosaic-shift, 0px) - 8px))
      rotateX(var(--mosaic-rotate-x, 0deg))
      rotateY(var(--mosaic-rotate-y, 0deg))
      rotateZ(var(--mosaic-rotate-z, 0deg))
      scale(1.035);
  }

  .memory-sphere--mosaic .sphere-tile:hover img,
  .memory-sphere--mosaic .sphere-tile:focus-visible img {
    transform: scale(1.035);
    filter: contrast(1.08) saturate(1.06);
  }

  .memory-sphere--mosaic .sphere-spy {
    z-index: 14;
  }

  .memory-sphere--mosaic .sphere-preview-card {
    border-color: color-mix(in srgb, var(--accent) 48%, rgba(255, 248, 236, 0.26));
    box-shadow:
      0 36px 100px rgba(0, 0, 0, 0.6),
      inset 0 1px 0 rgba(255, 248, 236, 0.12);
  }

  .memory-sphere--mosaic + .gallery-reveal-actions {
    margin-top: 0;
  }

  .gallery-reveal-actions {
    width: min(780px, calc(100% - 2rem));
  }

  .gallery-reveal-band {
    min-height: 72px;
  }

  @keyframes mosaicTileSettle {
    from {
      opacity: 0;
      transform:
        translateY(calc(var(--mosaic-shift, 0px) + 22px))
        rotateX(calc(var(--mosaic-rotate-x, 0deg) - 4deg))
        rotateY(calc(var(--mosaic-rotate-y, 0deg) + 4deg))
        rotateZ(var(--mosaic-rotate-z, 0deg));
    }

    to {
      opacity: 1;
      transform:
        translateY(var(--mosaic-shift, 0px))
        rotateX(var(--mosaic-rotate-x, 0deg))
        rotateY(var(--mosaic-rotate-y, 0deg))
        rotateZ(var(--mosaic-rotate-z, 0deg));
    }
  }
}

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

@media (max-width: 899px) {
  .site-header {
    align-items: flex-start;
  }

  .gallery-section {
    width: 100%;
    padding-inline: max(0.8rem, env(safe-area-inset-left)) max(0.8rem, env(safe-area-inset-right));
  }

  .memory-sphere {
    display: none;
  }

  .gallery-reveal-actions {
    width: min(430px, calc(100% - 1.5rem));
    grid-template-columns: 1fr;
    gap: 0.85rem;
    margin-top: var(--space-3);
    margin-bottom: var(--space-4);
    perspective: 900px;
  }

  .gallery-reveal-band {
    position: relative;
    min-height: 68px;
    padding: 0.8rem 1rem 0.9rem;
    overflow: visible;
    background: transparent;
    transform: none;
    transform-style: preserve-3d;
    isolation: isolate;
    box-shadow: none;
  }

  .gallery-reveal-band::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    background:
      linear-gradient(180deg, rgba(255, 248, 236, 0.1), rgba(255, 248, 236, 0.025)),
      color-mix(in srgb, var(--surface) 91%, transparent);
    transform: perspective(900px) translateZ(0) scale(1);
    transform-origin: center;
    will-change: transform, box-shadow, filter;
    animation: mobileButtonDepthPulse 2.7s ease-in-out infinite;
    box-shadow:
      0 24px 70px rgba(0, 0, 0, 0.42),
      0 10px 30px rgba(0, 0, 0, 0.34),
      inset 0 1px 0 rgba(255, 248, 236, 0.12);
  }

  #videos-reveal::before,
  #videos-reveal span {
    animation-delay: 0.38s;
  }

  .gallery-reveal-band:hover {
    transform: none;
  }

  .gallery-reveal-band span {
    position: relative;
    z-index: 1;
    display: block;
    font-size: clamp(1.65rem, 8vw, 2.2rem);
    transform: perspective(900px) translateZ(0) scale(1);
    transform-origin: center;
    will-change: transform, filter;
    animation: mobileButtonTextPulse 2.7s ease-in-out infinite;
  }

  .gallery-panel {
    gap: var(--space-5);
    padding: var(--space-4) 0 var(--space-5);
  }

  .gallery-subsection {
    width: min(680px, 100%);
    margin-left: 0;
    transform: none;
  }

  .gallery-subsection h3 {
    display: none;
  }

  .gallery-grid {
    width: 100%;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 0.32rem;
  }

  .media-card {
    border-radius: 4px;
  }

  .media-frame,
  .media-card.is-landscape .media-frame,
  .media-card.is-wide .media-frame,
  .media-card:nth-child(5n + 2) .media-frame,
  .media-card:nth-child(7n + 4) .media-frame {
    min-height: 0;
    aspect-ratio: 1 / 1;
  }

  .media-frame img,
  .media-frame video {
    transition-duration: 220ms;
  }

  .media-card:active .media-frame img,
  .media-card:active .media-frame video {
    transform: scale(0.96);
  }

  @keyframes mobileButtonDepthPulse {
    0%,
    100% {
      transform: perspective(900px) translateZ(0) scale(1);
      filter: brightness(1);
      box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.42),
        0 10px 30px rgba(0, 0, 0, 0.34),
        inset 0 1px 0 rgba(255, 248, 236, 0.12);
    }

    42% {
      transform: perspective(900px) translateZ(36px) scale(1.035);
      filter: brightness(1.08);
      box-shadow:
        0 34px 90px rgba(0, 0, 0, 0.48),
        0 15px 38px rgba(0, 0, 0, 0.38),
        inset 0 1px 0 rgba(255, 248, 236, 0.18);
    }

    58% {
      transform: perspective(900px) translateZ(-10px) scale(0.992);
      filter: brightness(0.98);
      box-shadow:
        0 18px 54px rgba(0, 0, 0, 0.38),
        0 7px 22px rgba(0, 0, 0, 0.32),
        inset 0 1px 0 rgba(255, 248, 236, 0.09);
    }
  }

  @keyframes mobileButtonTextPulse {
    0%,
    100% {
      transform: perspective(900px) translateZ(0) scale(1);
      filter: brightness(1);
    }

    42% {
      transform: perspective(900px) translateZ(24px) scale(1.025);
      filter: brightness(1.08);
    }

    58% {
      transform: perspective(900px) translateZ(-6px) scale(0.994);
      filter: brightness(0.98);
    }
  }

  .hero {
    min-height: auto;
    padding-top: var(--space-5);
    text-align: center;
  }

  .hero-composition {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .hero-portrait {
    order: 0;
    width: min(250px, 58vw);
  }

  .hero-portrait::before {
    inset: -0.55rem;
  }

  .hero-portrait img {
    max-height: min(42svh, 420px);
  }

  .hero-inner {
    justify-self: center;
  }

  .hero-inner::before {
    margin-inline: auto;
  }

  h1 {
    max-width: 100%;
    font-size: clamp(1.85rem, 7.2vw, 3.2rem);
    white-space: nowrap;
  }

  .memorial-dates {
    margin-inline: auto;
  }
}

@media (max-width: 520px) {
  .hero {
    padding-inline: 0.85rem;
  }

  .gallery-section {
    padding-top: var(--space-3);
  }

  .gallery-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.26rem;
  }

  .hero-portrait {
    width: min(220px, 68vw);
  }

  h1 {
    font-size: clamp(1.6rem, 7.05vw, 2.25rem);
  }

  .memorial-dates div {
    padding: 0.85rem;
  }
}

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

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

  .media-card:hover .media-frame img,
  .media-card:hover .media-frame video {
    transform: none;
  }

  .memory-sphere__stage {
    transition: none;
  }
}
