:root {
  --night: #0e1520;
  --ink: #241c16;
  --parchment: #f6efe0;
  --parchment-deep: #f3e7d0;
  --plaster: #d9c7a4;
  --wax: #8f3d32;
  --beeswax: #e4b15a;
  --beeswax-deep: #c4923e;
  --flame: #fff4c8;
  --star: #d5deee;
  --muted: #5e5348;
  --lectern: #1a140f;
  --line: rgba(228, 177, 90, 0.4);
  --serif: "Cormorant Garamond", "Palatino Linotype", Palatino, serif;
  --display: "Fraunces", "Palatino Linotype", Palatino, serif;
  --ui: "Commissioner", "Avenir Next", "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: #f3ead7;
  font-family: var(--ui);
  font-size: 1rem;
  background:
    radial-gradient(ellipse at 50% -8%, #2a3d62 0%, transparent 46%),
    radial-gradient(ellipse at 80% 120%, rgba(196, 98, 74, 0.16), transparent 42%),
    var(--night);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.38) 100%);
}

.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.starfield {
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--star);
  box-shadow:
    8vw 12vh 0 0 #fff,
    18vw 28vh 0 0 rgba(213, 222, 238, 0.7),
    27vw 8vh 0 0 #fff,
    36vw 42vh 0 0 rgba(255, 244, 200, 0.7),
    44vw 16vh 0 0 #fff,
    52vw 34vh 0 0 rgba(213, 222, 238, 0.55),
    63vw 10vh 0 0 #fff,
    71vw 26vh 0 0 rgba(255, 244, 200, 0.65),
    82vw 14vh 0 0 #fff,
    91vw 38vh 0 0 rgba(213, 222, 238, 0.7),
    14vw 58vh 0 0 rgba(255, 255, 255, 0.45),
    48vw 62vh 0 0 rgba(213, 222, 238, 0.4),
    77vw 54vh 0 0 rgba(255, 255, 255, 0.4),
    6vw 78vh 0 0 rgba(255, 244, 200, 0.35),
    88vw 72vh 0 0 rgba(255, 255, 255, 0.35);
  animation: drift 90s linear infinite;
}

.page {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.2rem 0 3.5rem;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--beeswax);
  color: var(--ink);
  padding: 0.5rem 0.8rem;
  z-index: 5;
}

.skip:focus { top: 1rem; }

.mast { text-align: left; max-width: 40rem; margin-bottom: 2rem; }

.vigil {
  display: flex;
  gap: 1.1rem;
  height: 28px;
  align-items: flex-end;
  margin-bottom: 0.85rem;
}

.vigil i,
.btn-flame,
.flame,
.unlit {
  display: block;
  width: 9px;
  height: 16px;
  border-radius: 50% 50% 42% 42%;
  background: radial-gradient(circle at 50% 78%, var(--flame), #f0a84a 42%, #c4624a 72%, transparent 76%);
  filter: drop-shadow(0 0 6px rgba(240, 168, 74, 0.75));
  animation: flicker 1.6s ease-in-out infinite;
}

.vigil i:nth-child(2) {
  height: 22px;
  animation-delay: -0.45s;
}

.vigil i:nth-child(3) { animation-delay: -0.9s; }

.eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #f0d7a0;
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(4rem, 9vw, 6.6rem);
  line-height: 0.82;
  letter-spacing: -0.03em;
}

h1 span {
  display: block;
  padding-left: 1.4rem;
  color: #f6e2b8;
}

.lede {
  margin: 1rem 0 0;
  max-width: 34rem;
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 1.35;
  color: #e7dcc6;
}

main {
  display: grid;
  grid-template-columns: minmax(270px, 360px) minmax(0, 1fr);
  gap: 1.6rem;
  align-items: start;
}

.lectern {
  position: sticky;
  top: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 236, 200, 0.06), transparent 28%),
    var(--lectern);
  border: 1px solid var(--line);
  padding: 1.35rem 1.25rem 1.2rem;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.32);
}

.lectern h2,
.alcove h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 560;
  font-size: 1.85rem;
  letter-spacing: -0.02em;
}

.lectern-note,
.hint,
.privacy,
.status,
footer p,
.alcove-head p {
  margin: 0.35rem 0 0;
  color: #d9cbb6;
  font-size: 0.92rem;
  line-height: 1.45;
}

.lectern-note { margin-bottom: 1rem; }

.field {
  display: block;
  margin-bottom: 0.85rem;
}

.field span {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f0d7a0;
}

input,
textarea {
  width: 100%;
  border: 0;
  border-bottom: 2px solid var(--beeswax-deep);
  border-radius: 2px 2px 0 0;
  background: var(--parchment);
  color: var(--ink);
  padding: 0.75rem 0.8rem;
  font: 520 1.2rem/1.3 var(--display);
}

textarea {
  resize: vertical;
  min-height: 8.5rem;
  font-family: var(--serif);
  font-size: 1.28rem;
  font-weight: 500;
  line-height: 1.35;
}

::placeholder { color: #6f6254; opacity: 1; }

.hint { text-align: right; letter-spacing: 0.04em; }

button {
  font: 600 0.78rem/1 var(--ui);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

#submit {
  width: 100%;
  margin-top: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border: 0;
  background: var(--beeswax);
  color: #2a1c0e;
  padding: 0.95rem 1rem;
}

#submit:hover { background: #f0c56e; }

#submit:disabled {
  cursor: wait;
  opacity: 0.72;
}

.btn-flame {
  width: 8px;
  height: 13px;
  filter: none;
  animation-duration: 1.1s;
}

.status { min-height: 1.4em; }

.status.is-error { color: #ffc7b8; }
.status.is-wait { color: #f0d7a0; }
.status.is-done { color: #d5e4cc; }

.privacy {
  color: #cbbba4;
  font-size: 0.82rem;
}

.jar {
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid rgba(228, 177, 90, 0.28);
}

.jar h2 { font-size: 1.55rem; }

.jar-total {
  margin: 0.2rem 0 0;
  color: #f0d7a0;
  font-size: 0.92rem;
  line-height: 1.4;
}

.amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.9rem 0 0.85rem;
}

.amounts button {
  border: 1px solid var(--beeswax-deep);
  background: transparent;
  color: #f6e2b8;
  padding: 0.55rem 0.75rem;
  min-width: 3.4rem;
}

.amounts button[aria-pressed="true"] {
  background: var(--beeswax);
  color: #2a1c0e;
  border-color: var(--beeswax);
}

#leave-tip {
  width: 100%;
  border: 1px solid var(--beeswax);
  background: transparent;
  color: #f6e2b8;
  padding: 0.85rem 1rem;
}

#leave-tip:hover:not(:disabled) { background: rgba(228, 177, 90, 0.14); }

#leave-tip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.alcove {
  background:
    linear-gradient(180deg, rgba(255, 248, 235, 0.45), transparent 18%),
    var(--plaster);
  color: var(--ink);
  padding: 1.15rem 1rem 1.25rem;
  border-radius: 4px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 248, 230, 0.55),
    inset 0 0 50px rgba(120, 80, 30, 0.12),
    0 24px 60px rgba(0, 0, 0, 0.35);
}

.alcove-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0 0.35rem 0.85rem;
  border-bottom: 1px solid rgba(70, 46, 24, 0.18);
  margin-bottom: 1rem;
}

.alcove h2 { color: #3a2a1c; }

.alcove-head p {
  margin: 0;
  color: #5c4632;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.15rem 0.9rem;
  align-items: start;
}

.card {
  --tilt: -0.5deg;
  position: relative;
  margin-top: 0.35rem;
  padding: 0.95rem 0.95rem 0.8rem;
  background-color: var(--parchment);
  background-image:
    radial-gradient(rgba(90, 60, 30, 0.055) 0.6px, transparent 0.6px),
    linear-gradient(180deg, #fffaf0, var(--parchment-deep));
  background-size: 4px 4px, auto;
  color: var(--ink);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 10px 18px rgba(70, 42, 16, 0.12);
  cursor: pointer;
  rotate: var(--tilt);
  transition: rotate 0.25s ease, translate 0.25s ease, box-shadow 0.25s ease;
  overflow-wrap: break-word;
}

.card::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 50%;
  width: 9px;
  height: 9px;
  translate: -50% 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f4e7c8, #8d6840 62%, #5c4328);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.card:nth-child(6n + 1) { --tilt: -0.7deg; }
.card:nth-child(6n + 2) { --tilt: 0.55deg; }
.card:nth-child(6n + 3) { --tilt: -0.25deg; }
.card:nth-child(6n + 4) { --tilt: 0.8deg; }
.card:nth-child(6n + 5) { --tilt: -0.45deg; }
.card:nth-child(6n + 6) { --tilt: 0.2deg; }

.card:hover,
.card:focus-visible {
  rotate: 0deg;
  translate: 0 -4px;
  box-shadow: 0 16px 28px rgba(70, 42, 16, 0.18);
}

.card-top {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  margin: 0.45rem 0 0.65rem;
}

.seal {
  flex: none;
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--wax);
  color: #f8efe0;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 650;
  box-shadow:
    inset 0 0 0 2px rgba(255, 236, 210, 0.35),
    0 2px 0 rgba(0, 0, 0, 0.12);
}

.card:nth-child(4n + 2) .seal { background: #a35b2d; }
.card:nth-child(4n + 3) .seal { background: #6e3a4a; }
.card:nth-child(4n + 4) .seal { background: #7a4a32; }

.card h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 620;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.card time,
.sheet time {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--ui);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7a6856;
}

.request {
  margin: 0 0 0.55rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.3;
  color: #5c4632;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.prayer {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.12rem;
  line-height: 1.32;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.read {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8a4b32;
}

.card-pending {
  --tilt: 0deg;
  min-height: 9rem;
  display: grid;
  place-items: center;
  text-align: center;
  cursor: default;
}

.card-pending p {
  margin: 0.4rem 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.25rem;
}

.flame { width: 14px; height: 24px; margin: 0 auto; }

.empty {
  grid-column: 1 / -1;
  min-height: 16rem;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  gap: 0.2rem;
  color: #5c4632;
}

.empty p {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.45rem;
}

.empty p + p {
  font-style: italic;
  font-size: 1.15rem;
}

.unlit {
  width: 12px;
  height: 22px;
  margin-bottom: 0.6rem;
  background: #8d7b62;
  filter: none;
  animation: none;
  opacity: 0.55;
}

.is-new { animation: pin 0.7s ease; }

footer {
  margin-top: 1.8rem;
  max-width: 36rem;
}

footer p {
  color: #cbbba4;
  font-size: 0.82rem;
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  max-width: 40rem;
  width: calc(100vw - 2rem);
}

dialog::backdrop {
  background: rgba(8, 10, 16, 0.68);
}

.sheet {
  position: relative;
  margin: 0;
  padding: 1.6rem 1.5rem 1.4rem;
  background:
    radial-gradient(rgba(90, 60, 30, 0.05) 0.6px, transparent 0.6px),
    linear-gradient(180deg, #fffaf0, #f4e8d2);
  background-size: 4px 4px, auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.sheet-kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8a4b32;
}

.sheet h2 {
  margin: 0.15rem 0 0.45rem;
  padding-right: 4.5rem;
  font-family: var(--display);
  font-weight: 620;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.sheet-request {
  margin: 0;
  max-width: 36rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  line-height: 1.35;
  color: #5c4632;
}

.sheet-rule {
  width: 3.5rem;
  height: 2px;
  margin: 1rem 0;
  background: var(--beeswax-deep);
}

.full-prayer {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2.4vw, 1.55rem);
  line-height: 1.42;
  white-space: pre-wrap;
  hyphens: auto;
}

.sheet time { margin-top: 1.2rem; }

.close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  border: 0;
  background: transparent;
  color: #6e3a32;
  letter-spacing: 0.14em;
  padding: 0.35rem;
}

.close:hover { color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--beeswax);
  outline-offset: 3px;
}

::selection {
  background: #e4b15a;
  color: #2a1c0e;
}

@keyframes flicker {
  0%, 100% { transform: scaleY(1) scaleX(1); opacity: 1; }
  45% { transform: scaleY(1.08) scaleX(0.92); opacity: 0.82; }
  70% { transform: scaleY(0.94) scaleX(1.06); opacity: 1; }
}

@keyframes drift {
  from { translate: 0 0; }
  to { translate: -2vw 1vh; }
}

@keyframes pin {
  from { opacity: 0; translate: 0 -12px; }
  to { opacity: 1; translate: 0 0; }
}

@media (min-width: 861px) {
  .lectern {
    max-height: calc(100vh - 2rem);
    overflow: auto;
    scrollbar-color: #c4923e #1a140f;
  }
}

@media (min-width: 861px) and (max-height: 920px) {
  .page { padding-top: 1.15rem; }
  .mast { margin-bottom: 0.85rem; }
  h1 { font-size: clamp(3.15rem, 6.2vw, 4.5rem); }
  .lede { margin-top: 0.55rem; }
  .lectern {
    position: static;
    max-height: none;
    overflow: visible;
    padding-top: 1rem;
    padding-bottom: 0.95rem;
  }
  textarea {
    height: 5.5rem;
    min-height: 4.5rem;
  }
  #submit { margin-top: 0.55rem; }
}

@media (max-width: 860px) {
  main { grid-template-columns: 1fr; }
  .lectern { position: static; }
  h1 span { padding-left: 0.6rem; }
  .page { width: min(1120px, calc(100% - 1.25rem)); padding-top: 1.4rem; }
  .alcove-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
