* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #0a0a0c;
  color: #d8d2c4;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

body {
  background:
    radial-gradient(120% 90% at 50% 0%, #171318 0%, #0a0a0c 55%, #060607 100%);
  overflow-x: hidden;
}

#scene {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px 40px;
}

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

.frame {
  width: min(720px, 100%);
  text-align: center;
  z-index: 3;
}

.kicker {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #8c8577;
}

h1 {
  margin: 8px 0 0;
  font-size: clamp(28px, 6vw, 48px);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #d8d2c4;
}

#stage {
  width: min(720px, 100%);
  margin: 36px 0 auto;
  z-index: 3;
}

.panel {
  background: linear-gradient(180deg, rgba(18, 18, 22, 0.72), rgba(10, 10, 12, 0.82));
  border: 1px solid rgba(200, 162, 74, 0.16);
  border-radius: 14px;
  padding: 28px 26px 24px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

.lead {
  margin: 0 0 18px;
  font-size: 20px;
  color: #d8d2c4;
}

.field {
  display: block;
  margin-bottom: 18px;
}

.label {
  display: block;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8c8577;
  margin-bottom: 8px;
}

input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 17px;
  color: #d8d2c4;
  background: #121216;
  border: 1px solid #3a342c;
  border-radius: 8px;
  outline: none;
}

input[type="text"]:focus {
  border-color: #6b5522;
  box-shadow: 0 0 0 3px rgba(200, 162, 74, 0.18);
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 18px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

button:focus-visible {
  outline: 2px solid #c8a24a;
  outline-offset: 2px;
}

button.primary {
  background: #c8a24a;
  color: #1a1508;
  border-color: #c8a24a;
}

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

button.ghost {
  background: transparent;
  color: #d8d2c4;
  border-color: #3a342c;
}

button.ghost:hover { border-color: #6b5522; }

.note {
  margin: 14px 0 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 12px;
  color: #8c8577;
}

/* Casket */
#casket {
  position: relative;
  width: min(360px, 80%);
  height: 170px;
  margin: 10px auto 28px;
  transition: transform 6s cubic-bezier(0.45, 0, 0.7, 1), opacity 6s ease-in;
}

#casket.lowered {
  transform: translateY(240px) scale(0.96);
  opacity: 0;
}

#casket .box {
  position: absolute;
  inset: 30px 0 0;
  background: linear-gradient(180deg, #3a342c, #2a2622);
  border: 1px solid #4a4238;
  border-radius: 8px;
  box-shadow: 0 22px 40px rgba(0, 0, 0, 0.55);
}

#casket .lid {
  position: absolute;
  top: 0;
  left: -4px;
  right: -4px;
  height: 38px;
  background: linear-gradient(180deg, #554a3c, #3a3228);
  border: 1px solid #554a3c;
  border-radius: 8px;
}

#casket .plate {
  position: absolute;
  left: 50%;
  top: 88px;
  transform: translateX(-50%);
  background: #c8a24a;
  color: #1a1508;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 4px;
  max-width: 80%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eulogy {
  min-height: 4.5em;
  margin: 0 0 20px;
  font-size: 18px;
  line-height: 1.65;
  color: #d8d2c4;
  white-space: pre-wrap;
}

.closing {
  font-size: 16px;
  color: #8c8577;
  margin: 0 0 22px;
}

@media (max-width: 420px) {
  .panel { padding: 22px 18px; }
  .row { flex-direction: column; }
  button { width: 100%; }
}

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

a.link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 18px;
  border-radius: 8px;
  border: 1px solid #3a342c;
  color: #d8d2c4;
}

a.link:hover { border-color: #6b5522; }

a.link:focus-visible {
  outline: 2px solid #c8a24a;
  outline-offset: 2px;
}

.note a {
  color: #c8a24a;
}

footer button#btn-mute {
  margin-top: 14px;
}

#grave {
  width: min(380px, 84%);
  height: 46px;
  margin: -150px auto 120px;
  border-radius: 50% 50% 8px 8px / 70% 70% 8px 8px;
  background:
    radial-gradient(60% 80% at 50% 0%, #2c2219 0%, #17110c 70%, #0c0907 100%);
  box-shadow: inset 0 6px 14px rgba(0, 0, 0, 0.7), 0 10px 30px rgba(0, 0, 0, 0.6);
  transform-origin: 50% 100%;
  transition: transform 160ms ease-out;
}

#grave.beat {
  transform: scale(1.012, 1.06);
}

@media (prefers-reduced-motion: reduce) {
  #grave.beat { transform: none; }
}
