@font-face {
  font-family: "Homemade Apple";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./fonts/HomemadeApple-Regular.ttf") format("truetype");
}

:root {
  --bg: #000000;
  --text: #e0e0e0;
  --text-muted: #999999;
  --accent: #1a8f85;
  --accent-bright: #2ad4c4;
  --accent-dim: rgba(26, 143, 133, 0.3);
  --grain-opacity: 0.04;
}

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

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  font-family: "Georgia", "Times New Roman", serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-y: auto;
}

/* ── starfield canvas ─────────────────────────── */

#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ── subtle grain overlay ─────────────────────── */

.memorial-bg {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.memorial-bg__layer--grain {
  position: absolute;
  inset: 0;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── main layout ──────────────────────────────── */

.memorial {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  gap: clamp(0.75rem, 2vw, 1.25rem);
  text-align: center;
}

/* ── inverted cross ───────────────────────────── */

.memorial__cross {
  font-size: clamp(2rem, 5vw, 2.75rem);
  color: var(--accent-dim);
  transform: rotate(180deg);
  line-height: 1;
  user-select: none;
  opacity: 0.6;
  margin-bottom: -0.25rem;
}

/* ── portrait ─────────────────────────────────── */

.memorial__portrait {
  margin: 0;
  padding: 0;
}

.memorial__img {
  display: block;
  width: min(260px, 68vw);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 4px;
  filter: grayscale(100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 0 1px rgba(42, 212, 196, 0.08),
    0 24px 48px rgba(0, 0, 0, 0.6);
  transition: filter 0.6s ease;
}

/* ── typography ────────────────────────────────── */

.memorial__text {
  max-width: 32rem;
}

.memorial__name {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 3.5vw, 1.65rem);
  font-weight: 400;
  letter-spacing: 0.04em;
  color: #ffffff;
}

.memorial__line {
  margin: 0 0 0.5rem;
  font-size: clamp(1rem, 2.4vw, 1.125rem);
  color: var(--text-muted);
  font-style: italic;
}

.memorial__sub {
  margin: 0 0 1.25rem;
  font-size: clamp(0.8125rem, 2vw, 0.9375rem);
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ── divider ──────────────────────────────────── */

.memorial__divider {
  width: 100%;
  max-width: 28rem;
  height: 1px;
  background: var(--accent-dim);
  margin: 0 auto 0.75rem;
}

/* ── chevron toggle ───────────────────────────── */

.memorial__more {
  margin: 0 auto;
  max-width: 28rem;
  text-align: left;
}

.memorial__summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: center;
  padding: 0.5rem 0;
}

.memorial__summary::-webkit-details-marker {
  display: none;
}

.memorial__chevron {
  color: var(--accent-bright);
  transition: transform 0.35s ease;
  opacity: 0.8;
}

.memorial__summary:hover .memorial__chevron {
  opacity: 1;
}

details[open] .memorial__chevron {
  transform: rotate(180deg);
}

.memorial__summary:focus {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

.memorial__summary:focus:not(:focus-visible) {
  outline: none;
}

/* ── expandable body ──────────────────────────── */

.memorial__more-body {
  margin-top: 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text-muted);
  text-align: left;
}

.memorial__more-body p {
  margin: 0 0 1rem;
}

.memorial__more-body p:last-child {
  margin-bottom: 0;
}

.memorial__poem {
  text-align: center;
  font-style: italic;
  line-height: 1.8;
}

.memorial__poem p {
  margin: 0 0 1.5rem;
}

.memorial__signature {
  font-family: "Homemade Apple", cursive;
  font-style: normal;
  font-size: 1.35rem;
  color: var(--text-muted);
  margin-top: 2rem;
  opacity: 0.7;
}

/* ── utility ──────────────────────────────────── */

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

@media (prefers-reduced-motion: reduce) {
  #starfield {
    display: none;
  }
}
