:root {
  color-scheme: dark;
  --ink: #f6eddb;
  --muted: #c8b994;
  --dim: #8d7c61;
  --gold: #e3b55b;
  --gold-hot: #ffcf6a;
  --oxblood: #5d171c;
  --umber: #1a0e0a;
  --char: #0c0908;
  --moss: #6d7d47;
  --smoke: rgba(246, 237, 219, 0.12);
  --glass: rgba(18, 10, 7, 0.68);
  --line: rgba(227, 181, 91, 0.28);
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.52);
  --display: "Fraunces", "Cormorant Garamond", "Baskerville", serif;
  --serif: "Source Serif 4", "Cormorant Garamond", "Iowan Old Style", serif;
  --condensed: "IBM Plex Sans Condensed", "Avenir Next Condensed", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--char);
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--serif);
  background:
    linear-gradient(95deg, rgba(12, 9, 8, 0.86) 0%, rgba(18, 10, 7, 0.66) 48%, rgba(12, 9, 8, 0.38) 100%),
    radial-gradient(circle at 18% 12%, rgba(227, 181, 91, 0.22), transparent 29rem),
    url("/assets/covenant-lectern.png") center / cover fixed no-repeat;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    linear-gradient(135deg, transparent 0 47%, rgba(227, 181, 91, 0.16) 47.2% 47.6%, transparent 47.8%),
    radial-gradient(circle at 82% 92%, rgba(93, 23, 28, 0.52), transparent 34rem);
  pointer-events: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0.14;
  mix-blend-mode: soft-light;
  background-image:
    repeating-radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.55) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(100deg, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px 4px);
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0 42px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  animation: rise-in 700ms ease both;
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
  color: var(--ink);
  text-decoration: none;
}

.mark__sigil {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--gold-hot);
  font-family: var(--display);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: rgba(12, 9, 8, 0.72);
  box-shadow: inset 0 0 0 5px rgba(227, 181, 91, 0.07), 0 12px 30px rgba(0, 0, 0, 0.28);
  transform: rotate(-4deg);
}

.mark__text,
.kicker,
.theme-pill,
.counter,
.theme-badge,
.section-heading,
.speed-control span,
.speed-control output,
.action-button,
.play-button,
.text-button,
.journal-label {
  font-family: var(--condensed);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.mark__text {
  font-size: 0.86rem;
}

.theme-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.theme-pill,
.action-button,
.play-button,
.icon-button,
.text-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(19, 12, 9, 0.7);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.theme-pill {
  min-height: 36px;
  padding: 0 13px;
  font-size: 0.72rem;
}

.theme-pill:hover,
.theme-pill:focus-visible,
.theme-pill.is-active {
  border-color: rgba(255, 207, 106, 0.8);
  color: #201006;
  background: var(--gold-hot);
}

.stage {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr);
  align-items: end;
  gap: clamp(28px, 5vw, 72px);
  min-height: clamp(520px, 68vh, 760px);
  padding: clamp(52px, 8vw, 96px) 0 18px;
}

.stage__copy {
  align-self: center;
  max-width: 570px;
  animation: rise-in 820ms 90ms ease both;
}

.kicker {
  margin: 0 0 16px;
  color: var(--gold-hot);
  font-size: clamp(0.72rem, 1vw, 0.84rem);
}

h1 {
  max-width: 12ch;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(4.2rem, 10vw, 8.8rem);
  line-height: 0.83;
  letter-spacing: 0;
  text-wrap: balance;
}

.intro {
  width: min(520px, 100%);
  margin: 26px 0 0;
  color: var(--muted);
  font-size: clamp(1.08rem, 2vw, 1.35rem);
  line-height: 1.48;
}

.lectern {
  position: relative;
  min-height: 430px;
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid var(--line);
  border-left: 8px solid var(--gold);
  background:
    linear-gradient(150deg, rgba(255, 207, 106, 0.16), transparent 24%),
    linear-gradient(180deg, rgba(24, 13, 9, 0.86), rgba(14, 8, 7, 0.74));
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(246, 237, 219, 0.06);
  backdrop-filter: blur(14px);
  animation: reveal-panel 780ms 180ms cubic-bezier(0.2, 0.78, 0.18, 1) both;
}

.lectern::after {
  position: absolute;
  right: clamp(20px, 3vw, 34px);
  bottom: clamp(18px, 3vw, 28px);
  width: 96px;
  height: 96px;
  border: 1px solid rgba(227, 181, 91, 0.24);
  content: "";
  transform: rotate(45deg);
  pointer-events: none;
}

.verse-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: clamp(34px, 6vw, 62px);
}

.theme-badge,
.counter {
  color: var(--gold-hot);
  font-size: 0.72rem;
}

.counter {
  color: var(--dim);
}

.verse {
  margin: 0;
}

.verse p {
  min-height: 6.4em;
  margin: 0;
  font-family: "Cormorant Garamond", var(--serif);
  font-size: clamp(2.05rem, 4.2vw, 4.4rem);
  font-weight: 600;
  line-height: 1.06;
  text-wrap: balance;
}

.verse footer {
  margin-top: 28px;
  color: var(--gold-hot);
  font-family: var(--display);
  font-size: clamp(1.24rem, 2vw, 1.8rem);
  font-weight: 800;
}

.verse.is-changing {
  animation: scripture-turn 420ms ease both;
}

.progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 4px;
  background: rgba(246, 237, 219, 0.08);
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--oxblood), var(--gold-hot));
}

.command-band,
.lower-grid {
  border-top: 1px solid rgba(227, 181, 91, 0.25);
  background: rgba(11, 8, 7, 0.54);
  backdrop-filter: blur(12px);
  animation: rise-in 760ms 320ms ease both;
}

.command-band {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr) auto;
  align-items: center;
  gap: 22px;
  padding: 18px;
}

.transport,
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  font-size: 2rem;
  line-height: 1;
}

.play-button,
.action-button {
  min-height: 44px;
  padding: 0 18px;
  font-size: 0.75rem;
}

.icon-button:hover,
.play-button:hover,
.action-button:hover,
.text-button:hover {
  border-color: rgba(255, 207, 106, 0.8);
  color: #211006;
  background: var(--gold-hot);
  transform: translateY(-2px);
}

.speed-control {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.speed-control span,
.speed-control output {
  font-size: 0.74rem;
}

.speed-control input {
  width: 100%;
  accent-color: var(--gold-hot);
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.22fr);
  gap: 1px;
  margin-top: 18px;
  border: 1px solid rgba(227, 181, 91, 0.22);
}

.playlist,
.reflection {
  min-height: 320px;
  padding: clamp(18px, 3vw, 28px);
  background: rgba(12, 8, 7, 0.5);
}

.reflection {
  background:
    linear-gradient(120deg, rgba(109, 125, 71, 0.2), transparent 38%),
    rgba(12, 8, 7, 0.5);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  color: var(--gold-hot);
  font-size: 0.74rem;
}

.section-heading p {
  margin: 0;
}

.section-heading span {
  color: var(--dim);
}

.text-button {
  min-height: 32px;
  padding: 0 11px;
  color: var(--muted);
  font-size: 0.68rem;
}

.saved-list {
  display: grid;
  gap: 10px;
}

.saved-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(246, 237, 219, 0.1);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.035);
}

.saved-item button {
  border: 0;
  color: inherit;
  text-align: left;
  background: transparent;
}

.saved-ref {
  display: block;
  margin-bottom: 6px;
  color: var(--gold-hot);
  font-family: var(--display);
  font-weight: 800;
}

.saved-line {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.remove-save {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(246, 237, 219, 0.14);
  color: var(--dim);
  background: transparent;
}

.empty {
  margin: 0;
  color: var(--dim);
  font-size: 1rem;
  line-height: 1.45;
}

.prompt {
  min-height: 3.2em;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.45;
}

.journal-label {
  display: block;
  margin-bottom: 8px;
  color: var(--gold-hot);
  font-size: 0.7rem;
}

textarea {
  width: 100%;
  min-height: 160px;
  resize: vertical;
  border: 1px solid rgba(227, 181, 91, 0.3);
  border-radius: 0;
  outline: 0;
  padding: 16px;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.45;
  background: rgba(6, 5, 4, 0.44);
}

textarea:focus {
  border-color: var(--gold-hot);
  box-shadow: 0 0 0 3px rgba(227, 181, 91, 0.14);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 48px));
  padding: 13px 16px;
  border: 1px solid rgba(255, 207, 106, 0.55);
  color: var(--char);
  font-family: var(--condensed);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--gold-hot);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.36);
  transform: translateY(22px);
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes reveal-panel {
  from {
    opacity: 0;
    transform: translateY(24px) rotate(0.8deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0);
  }
}

@keyframes scripture-turn {
  0% {
    opacity: 0;
    transform: translateY(12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

@media (max-width: 920px) {
  body {
    background-position: 58% center;
  }

  .masthead,
  .stage,
  .command-band,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .masthead {
    align-items: flex-start;
  }

  .theme-nav {
    justify-content: flex-start;
  }

  .stage {
    min-height: auto;
    padding-top: 48px;
  }

  h1 {
    max-width: 10.5ch;
  }

  .lectern {
    min-height: 390px;
  }

  .command-band {
    align-items: stretch;
  }

  .transport,
  .actions {
    justify-content: space-between;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .masthead {
    gap: 18px;
  }

  .mark__text {
    max-width: 13ch;
    line-height: 1.05;
  }

  .theme-pill {
    min-height: 34px;
    padding: 0 10px;
  }

  .stage {
    gap: 24px;
    padding-top: 36px;
  }

  h1 {
    font-size: clamp(3.5rem, 18vw, 5.6rem);
  }

  .intro {
    font-size: 1.04rem;
  }

  .lectern {
    min-height: 370px;
    padding: 24px 20px 30px;
    border-left-width: 4px;
  }

  .verse-meta {
    margin-bottom: 32px;
  }

  .verse p {
    min-height: 7.8em;
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .command-band,
  .playlist,
  .reflection {
    padding: 14px;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .action-button {
    padding: 0 8px;
  }
}
