:root {
  --bg: #f5efe6;
  --bg-soft: #fbf7f1;
  --surface: rgba(255, 252, 247, 0.9);
  --surface-strong: #fffdf9;
  --line: rgba(58, 71, 85, 0.14);
  --line-strong: rgba(42, 57, 75, 0.22);
  --text: #25313d;
  --muted: #66717d;
  --accent: #2d4358;
  --accent-deep: #1c2f41;
  --gold: #bfa276;
  --danger: #9b4b47;
  --shadow: 0 22px 55px rgba(30, 38, 48, 0.12);
  --shadow-soft: 0 10px 28px rgba(30, 38, 48, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top left, rgba(191, 162, 118, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(45, 67, 88, 0.08), transparent 24%),
    linear-gradient(180deg, #fcf8f2 0%, var(--bg) 48%, #f1ebe1 100%);
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("/memorial/assets/memorial-background.png") center center / cover no-repeat;
  opacity: 0.10;
  pointer-events: none;
  z-index: 0;
}

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

.memorial-page,
.confirmation-page {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 64px;
  position: relative;
  z-index: 1;
}

.memorial-topbar {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px 24px;
  margin: 0 calc(50% - 50vw);
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(58, 71, 85, 0.09);
  box-shadow: 0 4px 14px rgba(30, 38, 48, 0.03);
  backdrop-filter: blur(8px);
}

.brand-placeholder {
  min-height: auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.brand-placeholder span {
  color: var(--muted);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: 0.84rem;
  letter-spacing: 0.08em;
}

.brand-logo {
  padding: 0;
  justify-items: start;
}

.brand-logo img {
  display: block;
  width: auto;
  max-width: 100%;
  height: 56px;
}

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

.topbar-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 4px 22px;
  min-height: 64px;
  transition: color 0.18s ease, transform 0.18s ease;
}

.topbar-item + .topbar-item {
  border-left: 1px solid rgba(58, 71, 85, 0.12);
}

.topbar-item:hover {
  color: var(--accent);
}

.topbar-item:hover .topbar-icon {
  color: var(--accent);
}

.topbar-icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  color: rgba(45, 67, 88, 0.74);
  margin-top: 1px;
  transition: color 0.18s ease;
}

.topbar-icon svg {
  width: 100%;
  height: 100%;
}

.topbar-item strong,
.topbar-item small {
  display: block;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.topbar-item strong {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.topbar-item small {
  margin-top: 3px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.memorial-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(380px, 520px);
  gap: 30px;
  align-items: start;
}

.memorial-hero-banner {
  position: relative;
  margin: 0 calc(50% - 50vw) 30px;
  overflow: hidden;
  box-shadow: none;
  border: 0;
  background: transparent;
}

.memorial-hero-banner img {
  width: 100%;
  height: 360px;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.hero-banner-copy {
  position: absolute;
  top: 26px;
  right: max(24px, calc((100vw - 1240px) / 2 + 24px));
  width: min(460px, calc(100% - 48px));
  padding: 0;
  background: transparent;
  backdrop-filter: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.hero-banner-copy h1 {
  font-size: clamp(2rem, 3vw, 3rem);
  color: #ffffff;
  text-shadow: 0 4px 18px rgba(21, 28, 36, 0.32);
}

.hero-banner-copy .preview-copy {
  margin-top: 12px;
  max-width: 36ch;
  color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 3px 14px rgba(21, 28, 36, 0.28);
}

.hero-banner-copy .eyebrow {
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 3px 12px rgba(21, 28, 36, 0.24);
}

.preview-panel,
.form-panel,
.confirmation-card {
  border: 1px solid var(--line);
  border-radius: 34px;
  box-shadow: var(--shadow);
}

.preview-panel {
  padding: 32px;
  position: sticky;
  top: 24px;
  overflow: hidden;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.preview-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 180px;
  background: linear-gradient(180deg, rgba(191, 162, 118, 0.12), transparent);
  pointer-events: none;
}

.form-panel {
  padding: 26px;
  background: rgba(255, 252, 247, 0.78);
  backdrop-filter: blur(8px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

h1, h2 {
  margin: 0;
  font-weight: 500;
  line-height: 1.08;
}

h1 { font-size: clamp(2.4rem, 4vw, 4.2rem); }
h2 { font-size: clamp(1.8rem, 2.8vw, 2.45rem); }

.preview-copy,
.form-copy,
.field span,
.hint,
.error,
.preview-meta,
.mini-note,
.inline-notes,
.service-footnotes,
.confirmation-card p,
.confirmation-grid dt,
.confirmation-grid dd,
.submit-button,
.secondary-link,
input,
select,
textarea,
button {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.preview-intro,
.form-intro {
  position: relative;
  z-index: 1;
}

.preview-copy,
.form-copy {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.inline-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.inline-notes span {
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(45, 67, 88, 0.1);
  color: var(--accent);
  font-size: 0.9rem;
}

.preview-stage-card {
  margin-top: 12px;
  padding: 16px 18px 14px;
  background: transparent;
  border-radius: 28px;
  border: 1px solid rgba(45, 67, 88, 0.12);
  box-shadow: none;
  position: relative;
  z-index: 1;
}

.preview-stage {
  min-height: 560px;
  display: grid;
  place-items: center;
  position: relative;
  padding: 12px 0 40px;
}

.preview-artboard {
  position: relative;
  width: min(420px, 82%);
  z-index: 2;
  transition: width 0.22s ease, transform 0.22s ease;
}

.preview-artboard.size-60x80 {
  width: min(440px, 86%);
}

.preview-artboard.size-60x40 {
  width: min(360px, 72%);
}

.easel {
  position: absolute;
  inset: auto 50% 26px auto;
  width: min(470px, 90%);
  transform: translateX(50%);
  height: 100%;
  pointer-events: none;
}

.easel-leg,
.easel-bar {
  position: absolute;
  display: block;
  background: linear-gradient(180deg, #dcc395 0%, #b28a57 100%);
  box-shadow: 0 8px 18px rgba(87, 65, 33, 0.18);
}

.easel-leg {
  width: 8px;
  height: 64%;
  bottom: 0;
  border-radius: 999px;
}

.easel-leg-left {
  left: 22%;
  transform: rotate(10deg);
  transform-origin: bottom center;
}

.easel-leg-right {
  right: 22%;
  transform: rotate(-10deg);
  transform-origin: bottom center;
}

.easel-bar {
  left: 50%;
  transform: translateX(-50%);
  border-radius: 999px;
}

.easel-bar-top {
  top: 7%;
  width: 8px;
  height: 38%;
}

.easel-bar-mid {
  top: 33%;
  width: 48%;
  height: 7px;
}

.easel-bar-bottom {
  bottom: 11%;
  width: 34%;
  height: 7px;
}

.preview-print {
  position: relative;
  width: 100%;
  border-radius: 8px;
  padding: 16px;
  background: linear-gradient(180deg, #d8c6a6 0%, #b89364 100%);
  box-shadow:
    0 24px 56px rgba(34, 42, 52, 0.18),
    inset 0 1px 0 rgba(255,255,255,0.24);
}

.preview-print::after {
  content: "";
  position: absolute;
  inset: auto 26px -26px;
  height: 24px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(28, 47, 65, 0.28), transparent 72%);
  filter: blur(14px);
  z-index: -1;
}

.preview-print.is-vertical { aspect-ratio: 3 / 4; }
.preview-print.is-horizontal { aspect-ratio: 4 / 3; }
.preview-print.is-wide { aspect-ratio: 3 / 2; }
.preview-print.is-tall { aspect-ratio: 2 / 3; }

.preview-print img,
.preview-placeholder {
  border: 10px solid rgba(255,255,255,0.92);
  background: linear-gradient(180deg, #e8ebef 0%, #f3f5f7 100%);
}

.preview-print img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.preview-print.has-image img { display: block; }

.preview-placeholder {
  position: absolute;
  inset: 16px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(244, 247, 249, 0.98)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='480'%3E%3Crect width='360' height='480' fill='%23eef2f5'/%3E%3Cpath d='M0 380c90-58 160-86 220-86 47 0 94 15 140 43V480H0Z' fill='%23dde4e8'/%3E%3C/svg%3E") center/cover no-repeat;
}

.preview-placeholder strong {
  font-size: 1.22rem;
  font-weight: 600;
  color: var(--accent-deep);
}

.preview-placeholder span {
  max-width: 22ch;
}

.preview-print.has-image .preview-placeholder { display: none; }

.preview-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 22px;
  color: var(--accent-deep);
  font-size: 0.95rem;
}

.preview-meta strong {
  font-size: 1rem;
}

.mini-notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
  position: relative;
  z-index: 1;
}

.mini-note {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(45, 67, 88, 0.1);
  box-shadow: var(--shadow-soft);
  line-height: 1.45;
}

.mini-note-label {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-grid--compact {
  margin-top: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-grid--single {
  margin-top: 14px;
  grid-template-columns: 1fr;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.field span {
  color: var(--text);
  font-size: 0.95rem;
}

.field--donation > span {
  margin-bottom: 4px;
}

.donation-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.donation-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.donation-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.donation-option-card {
  display: grid;
  gap: 6px;
  min-height: 92px;
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid rgba(45, 67, 88, 0.14);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.donation-option-card strong,
.donation-option-card small {
  display: block;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.donation-option-card strong {
  color: var(--accent-deep);
  font-size: 1rem;
  line-height: 1.35;
}

.donation-option-card small {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.donation-option:hover .donation-option-card {
  border-color: rgba(45, 67, 88, 0.22);
  transform: translateY(-1px);
}

.donation-option input:checked + .donation-option-card {
  border-color: rgba(45, 67, 88, 0.42);
  background: rgba(240, 245, 249, 0.98);
  box-shadow: 0 16px 30px rgba(31, 49, 68, 0.14);
}

.field--donation.is-invalid .donation-option-card {
  border-color: rgba(163, 72, 87, 0.22);
}

.field--donation.is-invalid .donation-option input:checked + .donation-option-card {
  border-color: rgba(163, 72, 87, 0.5);
  background: rgba(255, 246, 247, 0.96);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(45, 67, 88, 0.14);
  border-radius: 18px;
  padding: 12px 15px;
  color: var(--text);
  background: var(--surface-strong);
  font-size: 0.97rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
}

textarea {
  resize: vertical;
  min-height: 112px;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(45, 67, 88, 0.12);
  border-color: rgba(45, 67, 88, 0.28);
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: rgba(163, 72, 87, 0.48);
  background: rgba(255, 246, 247, 0.96);
}

.hint,
.error {
  font-size: 0.85rem;
  line-height: 1.5;
}

.hint { color: var(--muted); }
.error { color: var(--danger); }

.error-summary {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(163, 72, 87, 0.18);
  background: rgba(255, 243, 244, 0.9);
  color: var(--danger);
  font-size: 0.92rem;
  line-height: 1.5;
}

.service-footnotes {
  margin-top: 22px;
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(246, 240, 231, 0.74);
  border: 1px solid rgba(191, 162, 118, 0.22);
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.service-footnotes p {
  margin: 0;
}

.service-footnotes p + p {
  margin-top: 6px;
}

.memorial-footer-note {
  margin: 28px auto 0;
  padding: 0 4px;
  max-width: 920px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.75;
  text-align: center;
}

.memorial-footer-note p {
  margin: 0;
}

.submit-button,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 20px;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.submit-button {
  margin-top: 24px;
  width: 100%;
  border: 0;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 18px 32px rgba(31, 49, 68, 0.22);
  font-size: 0.98rem;
}

.submit-button:hover,
.secondary-link:hover {
  transform: translateY(-1px);
}

.confirmation-card {
  max-width: 760px;
  margin: 48px auto;
  padding: 36px;
  background: rgba(255, 252, 247, 0.9);
}

.confirmation-grid {
  margin: 26px 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.confirmation-grid dt {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.confirmation-grid dd {
  margin: 0;
  font-size: 1rem;
}

.confirmation-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.confirmation-actions .submit-button {
  width: auto;
  margin-top: 0;
}

.secondary-link {
  color: var(--accent);
  border: 1px solid rgba(45, 67, 88, 0.16);
  background: rgba(255,255,255,0.76);
}

@media (max-width: 1080px) {
  .memorial-hero-banner {
    margin: 0 calc(50% - 50vw) 24px;
  }

  .memorial-hero-banner img {
    height: 300px;
  }

  .hero-banner-copy {
    top: 18px;
    right: 18px;
    left: 18px;
    width: auto;
    padding: 18px 20px;
  }

  .memorial-topbar {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 24px;
    padding: 14px 20px 16px;
  }

  .brand-placeholder {
    width: min(320px, 100%);
  }

  .topbar-info {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid rgba(58, 71, 85, 0.08);
    padding-top: 8px;
  }

  .topbar-item:nth-child(3) {
    border-left: 0;
  }

  .topbar-item:nth-child(n + 3) {
    border-top: 1px solid rgba(58, 71, 85, 0.08);
    padding-top: 18px;
  }

  .memorial-layout {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }
}

@media (max-width: 820px) {
  .field-grid,
  .field-grid--compact,
  .donation-options,
  .mini-notes,
  .confirmation-grid {
    grid-template-columns: 1fr;
  }

  .preview-stage {
    min-height: 460px;
  }

  .preview-artboard {
    width: min(360px, 88%);
  }

  .preview-artboard.size-60x80 {
    width: min(360px, 88%);
  }

  .preview-artboard.size-60x40 {
    width: min(310px, 76%);
  }
}

@media (max-width: 580px) {
  .memorial-hero-banner {
    margin: 0 calc(50% - 50vw) 20px;
  }

  .memorial-hero-banner img {
    width: calc(100% + 100px);
    height: 240px;
    margin-left: -100px;
    max-width: none;
    object-position: left center;
  }

  .hero-banner-copy {
    top: 14px;
    right: 14px;
    left: auto;
    width: min(220px, calc(100vw - 150px));
  }

  .hero-banner-copy h1 {
    font-size: 1.75rem;
  }

  .memorial-page,
  .confirmation-page {
    width: min(100%, calc(100% - 20px));
    padding: 0 0 40px;
  }

  .memorial-topbar {
    padding: 14px 16px 18px;
    margin-bottom: 20px;
  }

  .brand-placeholder {
    width: 100%;
    min-height: auto;
    justify-self: center;
  }

  .brand-logo img {
    height: 46px;
  }

  .topbar-info {
    grid-template-columns: 1fr;
    padding-top: 0;
    border-top: 0;
  }

  .topbar-item {
    padding: 14px 2px;
  }

  .topbar-item + .topbar-item,
  .topbar-item:nth-child(n + 3) {
    border-left: 0;
    border-top: 1px solid rgba(58, 71, 85, 0.08);
  }

  .preview-panel,
  .form-panel,
  .confirmation-card {
    border-radius: 26px;
    padding: 20px;
  }

  .preview-panel {
    padding-left: 0;
    padding-right: 0;
  }

  h1 {
    font-size: 2.2rem;
  }

  h2 {
    font-size: 1.8rem;
  }

  .preview-stage-card {
    margin-top: 8px;
    padding: 10px 12px 10px;
  }

  .preview-stage {
    min-height: 370px;
    padding-bottom: 24px;
  }

  .preview-artboard {
    width: min(280px, 92%);
  }

  .preview-artboard.size-60x80 {
    width: min(280px, 92%);
  }

  .preview-artboard.size-60x40 {
    width: min(236px, 82%);
  }

  .preview-placeholder {
    padding: 20px;
  }

  .preview-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .inline-notes {
    flex-direction: column;
    align-items: flex-start;
  }
}
