:root {
  --bg-0: #f3f1ef;
  --bg-1: #f5f6fd;
  --bg-2: #dce3f1;
  --panel: rgba(252, 250, 247, 0.95);
  --panel-strong: rgba(255, 255, 253, 0.99);
  --line: rgba(24, 54, 83, 0.13);
  --line-strong: rgba(24, 54, 83, 0.24);
  --text: #182634;
  --text-soft: #556170;
  --text-muted: #6b7584;
  --gold: #b48c41;
  --green: #7db328;
  --mint: #2d8572;
  --red: #b56257;
  --navy: #1f4f6c;
  --shadow: 0 28px 70px rgba(31, 45, 64, 0.14);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font-family: "Inter", "Segoe UI", sans-serif;
}

body {
  background:
    radial-gradient(1100px 520px at 8% -4%, rgba(179, 139, 63, 0.20), transparent 62%),
    radial-gradient(940px 480px at 92% 2%, rgba(31, 79, 108, 0.18), transparent 60%),
    radial-gradient(860px 420px at 52% 28%, rgba(220, 227, 244, 0.56), transparent 64%),
    radial-gradient(820px 420px at 14% 84%, rgba(125, 179, 40, 0.12), transparent 58%),
    radial-gradient(760px 360px at 88% 74%, rgba(184, 98, 87, 0.06), transparent 58%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 48%, var(--bg-2) 100%);
  position: relative;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(circle at 18% 26%, rgba(179, 139, 63, 0.18), transparent 0 16%, rgba(179, 139, 63, 0.08) 28%, transparent 54%),
    radial-gradient(circle at 82% 64%, rgba(125, 179, 40, 0.12), transparent 0 14%, rgba(125, 179, 40, 0.05) 26%, transparent 56%),
    radial-gradient(circle at 60% 18%, rgba(220, 227, 244, 0.28), transparent 0 10%, rgba(220, 227, 244, 0.08) 22%, transparent 52%),
    linear-gradient(to right, rgba(31, 79, 108, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(31, 79, 108, 0.035) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 84px 84px, 84px 84px;
  opacity: 0.32;
  mix-blend-mode: soft-light;
  animation: memorial-drift 76s ease-in-out infinite, memorial-grid 132s linear infinite;
}

body::after {
  background:
    radial-gradient(circle at center, transparent 0 46%, rgba(34, 42, 48, 0.13) 100%),
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.22), transparent 32%),
    radial-gradient(circle at 78% 74%, rgba(184, 98, 87, 0.06), transparent 26%),
    repeating-radial-gradient(circle at 20% 26%, rgba(31, 79, 108, 0.05) 0 1px, transparent 1px 5px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 260px 260px;
  opacity: 0.28;
  mix-blend-mode: soft-light;
  animation: memorial-drift 98s ease-in-out infinite reverse, memorial-grid 164s linear infinite reverse;
}

@keyframes memorial-drift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(2%, -1%, 0) scale(1.035);
  }
  100% {
    transform: translate3d(-1.8%, 1%, 0) scale(1.02);
  }
}

@keyframes memorial-grid {
  0% {
    background-position: 0 0, 0 0, 0 0, 0 0;
  }
  50% {
    background-position: 9% -6%, -5% 3%, 14px 0, 0 14px;
  }
  100% {
    background-position: -5% 4%, 3% -3%, 0 0, 0 0;
  }
}

.memorial-page,
.memorial-footer {
  position: relative;
  z-index: 1;
}

.memorial-page {
  width: min(1280px, calc(100% - 40px));
  margin: 22px auto 28px;
  display: grid;
  gap: 22px;
}

.memorial-hero,
.search-panel,
.honorees-section,
.support-panel,
.memorial-footer,
.dialog-card {
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 12% 12%, rgba(179, 139, 63, 0.11), transparent 24%),
    radial-gradient(circle at 88% 18%, rgba(125, 179, 40, 0.08), transparent 26%),
    radial-gradient(circle at 56% 100%, rgba(184, 89, 77, 0.06), transparent 34%),
    linear-gradient(180deg, rgba(251, 248, 241, 0.98), rgba(240, 234, 223, 0.96));
  box-shadow: var(--shadow);
}

.memorial-hero,
.search-panel,
.honorees-section,
.support-panel,
.memorial-footer,
.dialog-card {
  border-radius: var(--radius-lg);
}

.memorial-hero {
  padding: 16px 18px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 14px;
  align-items: start;
  overflow: hidden;
  position: relative;
}

.memorial-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 14%, rgba(255, 255, 255, 0.15), transparent 20%),
    radial-gradient(circle at 88% 8%, rgba(243, 229, 182, 0.26), transparent 18%),
    linear-gradient(120deg, transparent 0 62%, rgba(179, 139, 63, 0.06) 76%, transparent 92%);
  opacity: 0.6;
  mix-blend-mode: screen;
}

.hero-copy {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 4px 0;
  max-width: 68ch;
}

.search-eyebrow,
.section-kicker,
.note-label {
  margin: 0;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 12px;
  font-weight: 700;
}

.memorial-hero h1,
.search-panel h2,
.honorees-section h2,
.support-panel h2,
.dialog-copy h3 {
  margin: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.memorial-hero h1 {
  font-size: clamp(23px, 2.9vw, 38px);
  max-width: 14ch;
  font-weight: 700;
}

.hero-text,
.search-panel p,
.support-panel p,
.dialog-copy p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.56;
}

.hero-actions,
.support-links,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-button {
  appearance: none;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  min-height: 42px;
  padding: 10px 17px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.hero-button:hover {
  transform: translateY(-1px);
}

.hero-button.primary {
  color: #11151a;
  background: linear-gradient(180deg, rgba(243, 229, 182, 0.98), rgba(216, 198, 131, 0.94));
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
}

.hero-button.secondary {
  color: var(--navy);
  background: rgba(255, 255, 255, 0.78);
}

.hero-stage {
  display: grid;
  align-content: start;
  justify-items: end;
}

.hero-brand-box {
  width: min(100%, 560px);
  padding: 14px;
  border-radius: calc(var(--radius-lg) - 6px);
  border: 1px solid rgba(23, 61, 90, 0.18);
  background:
    radial-gradient(circle at 14% 10%, rgba(179, 139, 63, 0.14), transparent 28%),
    radial-gradient(circle at 88% 82%, rgba(125, 179, 40, 0.12), transparent 32%),
    linear-gradient(180deg, rgba(255, 253, 248, 0.99), rgba(245, 239, 227, 0.99));
  box-shadow: 0 18px 40px rgba(39, 58, 76, 0.1);
}

.hero-logo-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
  align-items: stretch;
}

.hero-logo-chip {
  min-height: 100px;
  max-height: 100px;
  border-radius: 19px;
  border: 1px solid rgba(23, 61, 90, 0.12);
  background: rgba(255, 255, 255, 0.8);
  display: grid;
  place-items: center;
  padding: 8px 12px;
  overflow: hidden;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.hero-logo-chip:hover,
.hero-logo-chip:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(125, 179, 40, 0.3);
  box-shadow: 0 14px 24px rgba(39, 58, 76, 0.08);
  outline: none;
}

.hero-logo-chip img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 70px;
  object-fit: contain;
  display: block;
}

.search-panel,
.support-panel {
  padding: 20px 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.7fr);
  gap: 16px;
  align-items: end;
}

.search-copy,
.support-panel > div:first-child {
  display: grid;
  gap: 10px;
}

.search-box {
  display: grid;
  gap: 8px;
}

.search-box span {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  font-weight: 700;
}

.search-box input {
  width: 100%;
  min-height: 52px;
  border-radius: 18px;
  border: 1px solid rgba(23, 61, 90, 0.14);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  padding: 0 16px;
  font: inherit;
  font-size: 17px;
}

.search-box input::placeholder {
  color: rgba(230, 231, 225, 0.42);
}

.search-box input:focus {
  outline: 1px solid rgba(220, 203, 141, 0.38);
  border-color: rgba(220, 203, 141, 0.48);
}

.honorees-section {
  padding: 20px;
  display: grid;
  gap: 14px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.memorial-head > div {
  display: grid;
  gap: 8px;
}

.honoree-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  grid-auto-rows: 1fr;
  align-items: stretch;
}

.honoree-card {
  display: flex;
  border: 1px solid rgba(23, 61, 90, 0.14);
  border-radius: 14px;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 10%, rgba(174, 141, 68, 0.08), transparent 26%),
    radial-gradient(circle at 18% 88%, rgba(122, 208, 170, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(255, 252, 247, 0.98), rgba(241, 235, 223, 0.98));
  box-shadow: 0 12px 24px rgba(32, 43, 52, 0.1);
  height: 100%;
  isolation: isolate;
}

.honoree-card-button {
  width: 100%;
  border: 0;
  padding: 0;
  text-align: left;
  color: inherit;
  background: transparent;
  cursor: pointer;
  display: grid;
  grid-template-rows: auto 84px;
  height: 100%;
}

.honoree-portrait {
  aspect-ratio: 4 / 4.25;
  background: rgba(23, 61, 90, 0.04);
  border-bottom: 1px solid rgba(23, 61, 90, 0.08);
  overflow: hidden;
  position: relative;
}

.honoree-portrait img,
.dialog-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform-origin: center center;
}

.portrait-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 20%, rgba(174, 141, 68, 0.18), transparent 18%),
    linear-gradient(180deg, rgba(230, 238, 242, 0.94), rgba(212, 223, 226, 0.98));
}

.portrait-fallback span {
  width: 84px;
  height: 84px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--navy);
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(23, 61, 90, 0.1);
}

.portrait-fallback.large {
  min-height: 420px;
}

.portrait-fallback.large span {
  width: 140px;
  height: 140px;
  font-size: 52px;
}

.honoree-copy {
  padding: 12px 12px 13px;
  display: grid;
  gap: 5px;
  min-height: 84px;
  max-height: 84px;
  align-content: start;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.card-kicker {
  margin: 0;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 10px;
  font-weight: 700;
}

.honoree-copy h3 {
  margin: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: clamp(14px, 1.05vw, 17px);
  line-height: 1.18;
  font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1.18em * 2);
}

.empty-state {
  padding: 26px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(23, 61, 90, 0.2);
  background: rgba(255, 255, 255, 0.48);
  text-align: center;
}

.empty-state h3 {
  margin: 0 0 8px;
  font-family: "Playfair Display", "Times New Roman", serif;
  font-size: 28px;
}

.empty-state p {
  margin: 0;
  color: var(--text-soft);
}

.support-links {
  justify-content: flex-end;
  align-items: center;
}

.memorial-footer {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto 28px;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.memorial-footer p,
.memorial-footer small {
  margin: 0;
  color: var(--text-soft);
}

.memorial-footer p {
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

#itemDialog {
  border: 0;
  padding: 0;
  background: transparent;
}

#itemDialog::backdrop {
  background: rgba(3, 5, 8, 0.74);
  backdrop-filter: blur(8px);
}

.dialog-card {
  width: min(940px, calc(100vw - 28px));
  padding: 0;
  overflow: hidden;
}

.memorial-dialog {
  display: grid;
  gap: 0;
}

.dialog-media {
  min-height: 420px;
  background: rgba(14, 22, 29, 0.78);
  overflow: hidden;
}

.dialog-copy {
  padding: 22px 22px 10px;
  display: grid;
  gap: 10px;
  background: linear-gradient(180deg, rgba(14, 22, 29, 0.98), rgba(18, 27, 34, 0.98));
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.dialog-copy p:empty {
  min-height: 1.6em;
}

.dialog-copy h3 {
  font-size: clamp(28px, 4vw, 46px);
  color: #f8f2e6;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}

.dialog-actions {
  padding: 0 22px 22px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(245, 241, 233, 0.96);
  border: 1px solid rgba(23, 61, 90, 0.14);
  color: var(--text);
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 50;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-color: rgba(183, 74, 61, 0.38);
}

@media (max-width: 1180px) {
  .honoree-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .memorial-page,
  .memorial-footer {
    width: min(100%, calc(100% - 28px));
  }

  .memorial-hero,
  .search-panel,
  .support-panel {
    grid-template-columns: 1fr;
  }

  .hero-stage {
    order: -1;
    justify-items: stretch;
  }

  .hero-logo-chip {
    min-height: 88px;
    max-height: 88px;
  }

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

@media (max-width: 700px) {
  .honoree-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .memorial-page {
    width: min(100%, calc(100% - 20px));
    gap: 16px;
    margin-top: 10px;
  }

  .memorial-footer {
    width: min(100%, calc(100% - 20px));
  }

  .memorial-hero,
  .search-panel,
  .honorees-section,
  .support-panel,
  .memorial-footer,
  .dialog-card {
    border-radius: 20px;
  }

  .memorial-hero,
  .search-panel,
  .support-panel,
  .honorees-section {
    padding: 18px;
  }

  .memorial-hero h1 {
    max-width: none;
    font-size: clamp(22px, 8vw, 32px);
  }

  .hero-logo-row {
    grid-template-columns: 1fr;
  }

  .hero-logo-chip {
    min-height: 82px;
    max-height: 82px;
  }

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

}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  .hero-button,
  .toast {
    animation: none !important;
    transition: none !important;
  }
}
