:root {
  --page-bg: #f3ede3;
  --page-bg-deep: #e6dccd;
  --surface: rgba(255, 251, 245, 0.84);
  --surface-strong: #fffaf3;
  --surface-muted: #f7f0e6;
  --ink: #2f241d;
  --ink-soft: #68574d;
  --ink-faint: #8b7c72;
  --line: rgba(93, 69, 53, 0.14);
  --line-strong: rgba(93, 69, 53, 0.28);
  --accent: #8a5a44;
  --accent-deep: #5c3727;
  --accent-soft: #c5966d;
  --leaf: #70816b;
  --gold: #b48a4c;
  --shadow-soft: 0 18px 40px rgba(67, 43, 29, 0.08);
  --shadow-card: 0 22px 60px rgba(54, 33, 21, 0.12);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --content-width: 1120px;
  --transition: 180ms ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Mulish", sans-serif;
  color: var(--ink);
  line-height: 1.7;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.72), transparent 34%),
    linear-gradient(180deg, #f6f0e7 0%, var(--page-bg) 34%, var(--page-bg-deep) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent 42%),
    radial-gradient(circle at 15% 18%, rgba(196, 150, 109, 0.1), transparent 18%),
    radial-gradient(circle at 85% 12%, rgba(112, 129, 107, 0.1), transparent 16%);
  z-index: -2;
}

a {
  color: var(--accent-deep);
}

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

.page-shell {
  width: min(calc(100% - 32px), var(--content-width));
  margin: -78px auto 0;
  position: relative;
  z-index: 2;
}

.hero {
  position: relative;
  min-height: 88vh;
  display: grid;
  place-items: center;
  padding: 72px 20px 150px;
  background-color: #4b372c;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(38, 23, 16, 0.18) 0%, rgba(39, 23, 16, 0.6) 62%, rgba(39, 23, 16, 0.8) 100%);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(255, 245, 232, 0.16), transparent 28%),
    linear-gradient(120deg, rgba(35, 24, 18, 0.55), rgba(63, 37, 27, 0.32));
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(100%, 840px);
  padding: 42px 34px;
  border: 1px solid rgba(255, 245, 232, 0.28);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 251, 246, 0.12), rgba(255, 251, 246, 0.04));
  backdrop-filter: blur(8px);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.16);
  text-align: center;
}

.hero-kicker {
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.78rem;
  color: rgba(255, 246, 235, 0.82);
}

.hero-content h1 {
  margin: 0;
  font-family: "Old Standard TT", serif;
  font-size: clamp(3.1rem, 6vw, 5.8rem);
  line-height: 0.95;
  color: #fff7ef;
  text-wrap: balance;
}

#dates {
  margin: 18px auto 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border: 1px solid rgba(255, 245, 232, 0.32);
  border-radius: 999px;
  background: rgba(255, 251, 246, 0.09);
  color: rgba(255, 245, 232, 0.9);
  font-size: 1rem;
}

.quote {
  margin: 24px auto 0;
  max-width: 680px;
  font-family: "Old Standard TT", serif;
  font-size: clamp(1.18rem, 2vw, 1.7rem);
  font-style: italic;
  line-height: 1.55;
  color: #fff4e7;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 28px;
  padding: 12px 20px;
  border: 1px solid rgba(255, 245, 232, 0.36);
  border-radius: 999px;
  color: #fff7ef;
  text-decoration: none;
  background: rgba(255, 251, 246, 0.08);
  transition: transform var(--transition), background var(--transition), border-color var(--transition);
}

.hero-cta:hover {
  transform: translateY(-2px);
  background: rgba(255, 251, 246, 0.14);
  border-color: rgba(255, 245, 232, 0.56);
}

.navbar {
  position: sticky;
  top: 16px;
  z-index: 5;
  margin: 0 auto 28px;
  padding: 14px 18px;
  border: 1px solid rgba(255, 250, 243, 0.7);
  border-radius: 999px;
  background: rgba(255, 250, 243, 0.78);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
}

.navbar ul {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
}

.navbar a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--accent-deep);
  transition: color var(--transition), background var(--transition), transform var(--transition);
}

.navbar a:hover {
  background: rgba(138, 90, 68, 0.08);
  color: var(--accent);
  transform: translateY(-1px);
}

section {
  margin: 28px 0;
}

.memorial-section,
.card-section,
.comments,
.timeline,
.section {
  position: relative;
  overflow: hidden;
  padding: 30px;
  border: 1px solid rgba(255, 250, 243, 0.72);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 251, 245, 0.96), rgba(249, 241, 231, 0.84));
  box-shadow: var(--shadow-card);
}

.memorial-section::before,
.card-section::before,
.comments::before,
.timeline::before,
.section::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(196, 150, 109, 0.14), transparent 68%);
  pointer-events: none;
}

section h2,
.section-heading {
  position: relative;
  margin: 0 0 22px;
  font-family: "Old Standard TT", serif;
  font-size: clamp(2rem, 3vw, 3rem);
  font-weight: 700;
  color: var(--accent-deep);
  line-height: 1.05;
}

section h2::after,
.section-heading::after {
  content: "";
  display: block;
  width: 84px;
  height: 2px;
  margin-top: 12px;
  background: linear-gradient(90deg, var(--gold), rgba(180, 138, 76, 0.2));
}

.carousel {
  padding: 34px 30px 26px;
}

.carousel-wrapper {
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.carousel-container {
  display: flex;
  gap: 18px;
  padding: 8px 4px 12px;
  overflow: hidden;
  white-space: nowrap;
}

.carousel-container img {
  width: clamp(240px, 28vw, 340px);
  height: clamp(250px, 32vw, 380px);
  border-radius: 22px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 18px 40px rgba(51, 31, 20, 0.18);
  border: 1px solid rgba(255, 250, 243, 0.68);
}

.service-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 26px;
  align-items: start;
}

.service-details {
  display: grid;
  gap: 18px;
}

.service-meta {
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 248, 0.72);
}

.service-meta p {
  margin: 0;
}

#service-date {
  font-family: "Old Standard TT", serif;
  font-size: 1.75rem;
  color: var(--accent-deep);
}

#service-time,
#service-location {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

#service-address {
  color: var(--ink-soft);
}

#service-map {
  min-height: 260px;
  border: 0;
  border-radius: 20px;
  box-shadow: 0 14px 32px rgba(56, 35, 22, 0.12);
}

#service-notes {
  margin: 0;
  padding-left: 20px;
  color: var(--ink-soft);
}

#service-notes li + li {
  margin-top: 8px;
}

.service-form {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 252, 248, 0.78);
}

.service-form iframe {
  display: block;
  border-radius: 18px;
}

.obituary p {
  margin: 0;
  color: var(--ink-soft);
}

.link {
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.obit-image {
  margin: 28px auto 0;
  border-radius: 20px;
  box-shadow: 0 18px 44px rgba(58, 35, 25, 0.16);
  transition: transform var(--transition), opacity var(--transition);
}

.obit-image:hover {
  opacity: 0.92;
  transform: translateY(-2px);
}

.comment-feed {
  display: grid;
  gap: 14px;
}

.comment-feed p {
  margin: 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 252, 248, 0.76);
  box-shadow: 0 10px 26px rgba(66, 42, 28, 0.08);
}

.show-comments-btn,
button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  color: #fff8f0;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 12px 28px rgba(92, 55, 39, 0.22);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.show-comments-btn:hover,
button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(92, 55, 39, 0.26);
}

.timeline-split {
  list-style: none;
  margin: 0;
  padding: 8px 0 0;
  position: relative;
}

.timeline-split::before {
  content: "";
  position: absolute;
  left: 131px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, rgba(112, 129, 107, 0.12), var(--accent-soft), rgba(112, 129, 107, 0.12));
}

.timeline-split li {
  position: relative;
  display: grid;
  grid-template-columns: 110px 42px minmax(0, 1fr);
  align-items: start;
  gap: 0;
  margin-bottom: 18px;
}

.timeline-split li::before {
  content: "";
  position: absolute;
  left: 131px;
  top: 18px;
  width: 14px;
  height: 14px;
  border: 3px solid rgba(255, 250, 243, 0.86);
  border-radius: 50%;
  background: var(--gold);
  transform: translateX(-50%);
  box-shadow: 0 0 0 5px rgba(180, 138, 76, 0.12);
}

.timeline-date {
  padding-top: 8px;
  text-align: right;
  font-family: "Old Standard TT", serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent-deep);
}

.timeline-line {
  width: 2px;
  height: 100%;
  margin: 0 auto;
  background: transparent;
}

.timeline-event {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 252, 248, 0.76);
  color: var(--ink-soft);
  box-shadow: 0 10px 24px rgba(67, 43, 29, 0.08);
}

#myFamilyTree {
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.7), transparent 34%),
    linear-gradient(180deg, #fffaf4 0%, #f9efe3 100%);
  overflow: hidden;
}

.loading-message {
  padding: 2rem;
  text-align: center;
  color: var(--ink-faint);
  font-style: italic;
}

svg.hugo .node > rect,
svg.tommy .node > rect {
  fill: #fffaf4;
  stroke: var(--accent-deep);
  stroke-width: 2px !important;
}

svg.hugo .node > text,
svg.tommy .node > text {
  fill: var(--accent-deep);
  font-family: "Old Standard TT", serif;
}

svg.tommy [data-n-id="1"].node > rect {
  fill: var(--accent-deep) !important;
}

svg.tommy [data-n-id="1"].node > text {
  fill: #fff8f0 !important;
}

[data-l-id] path {
  stroke: var(--accent-soft) !important;
}

#myFamilyTree > svg {
  background: transparent;
}

#playlist iframe {
  border-radius: 20px;
  box-shadow: 0 18px 40px rgba(58, 35, 25, 0.14);
}

footer {
  width: min(calc(100% - 32px), var(--content-width));
  margin: 28px auto 36px;
  padding: 18px 24px;
  text-align: center;
  color: var(--ink-soft);
  border-top: 1px solid var(--line-strong);
}

@media (max-width: 980px) {
  .service-layout {
    grid-template-columns: 1fr;
  }

  .page-shell {
    margin-top: -54px;
  }
}

@media (max-width: 768px) {
  .hero {
    min-height: auto;
    padding: 48px 16px 106px;
  }

  .hero-content {
    padding: 32px 22px;
  }

  .page-shell {
    width: min(calc(100% - 20px), var(--content-width));
    margin-top: -44px;
  }

  .navbar {
    overflow-x: auto;
    border-radius: 24px;
  }

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

  .navbar ul {
    width: max-content;
    flex-wrap: nowrap;
    justify-content: flex-start;
  }

  .memorial-section,
  .card-section,
  .comments,
  .timeline,
  .section,
  .carousel {
    padding: 22px 18px;
    border-radius: 24px;
  }

  .carousel-container img {
    width: 220px;
    height: 260px;
  }

  .timeline-split::before {
    left: 88px;
  }

  .timeline-split li {
    grid-template-columns: 68px 40px minmax(0, 1fr);
  }

  .timeline-split li::before {
    left: 88px;
  }

  .timeline-date {
    font-size: 1.08rem;
  }

  #myFamilyTree {
    height: 560px !important;
  }
}

@media (max-width: 520px) {
  .hero-kicker {
    letter-spacing: 0.18em;
  }

  #dates {
    display: block;
    border-radius: 18px;
  }

  .quote {
    font-size: 1.1rem;
  }

  .timeline-split::before,
  .timeline-split li::before {
    left: 72px;
  }

  .timeline-split li {
    grid-template-columns: 52px 36px minmax(0, 1fr);
  }

  .timeline-date {
    font-size: 0.96rem;
  }

  .service-meta {
    padding: 18px;
  }

  #myFamilyTree {
    height: 480px !important;
  }
}
