/* ─── prayall · an omniprayer ────────────────────────
   bright · human · optimistic · godly · futuristic   */

:root {
  --paper: #ece5da;
  --paper-deep: #e3d9cb;
  --ink: #2b2118;
  --ink-soft: #5d4e3f;
  --muted: #98876f;
  --line: rgba(43, 33, 24, 0.14);

  /* the aura */
  --umber: #241209;
  --ember: #a4441a;
  --amber: #e79b3c;
  --halo: #fbe3ae;
  --milk: #fdf6e8;
  --dusk: #8fa6ba;

  --sans: "Space Grotesk", system-ui, sans-serif;
  --serif: "Fraunces", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background:
    radial-gradient(120% 90% at 50% -10%, #f6efe3 0%, var(--paper) 55%, var(--paper-deep) 100%);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

main[hidden] { display: none; }

main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6vh 24px;
  text-align: center;
}

/* ─── the aura ─────────────────────────────────────── */

.aura {
  position: relative;
  width: min(320px, 72vw);
  aspect-ratio: 1 / 1.18;
  border-radius: 44% / 40%;
  overflow: hidden;
  display: grid;
  place-items: center;
  isolation: isolate;
  box-shadow:
    0 30px 90px -20px rgba(164, 68, 26, 0.35),
    0 10px 40px rgba(231, 155, 60, 0.25),
    0 0 140px rgba(251, 227, 174, 0.55);
  animation: breathe 7s ease-in-out infinite;
}

.aura-field {
  position: absolute;
  inset: -12%;
  background:
    radial-gradient(48% 38% at 96% 0%, rgba(160, 182, 200, 0.95) 0%, rgba(143, 166, 186, 0) 62%),
    radial-gradient(58% 48% at 8% 2%, rgba(16, 8, 4, 0.98) 0%, rgba(20, 10, 5, 0) 60%),
    linear-gradient(172deg,
      #2e1509 0%,
      #7c3312 26%,
      var(--ember) 38%,
      var(--amber) 52%,
      var(--halo) 72%,
      var(--milk) 100%);
  filter: blur(10px) saturate(1.1);
  animation: drift 16s ease-in-out infinite alternate;
}

.aura-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0) 55%, rgba(255, 250, 238, 0.35) 100%);
  mix-blend-mode: soft-light;
}

.aura-word {
  position: relative;
  z-index: 2;
  color: #fdf3e0;
  font-weight: 400;
  font-size: 1.55rem;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 18px rgba(36, 18, 9, 0.35);
}

@keyframes drift {
  0%   { transform: translate(0%, 0%) scale(1.04); }
  50%  { transform: translate(-2%, 1.5%) scale(1.08); }
  100% { transform: translate(1.5%, -1.5%) scale(1.05); }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.015); }
}

/* listening state — the aura leans in */
body.listening .aura {
  animation-duration: 2.6s;
  box-shadow:
    0 30px 100px -16px rgba(164, 68, 26, 0.5),
    0 0 180px rgba(251, 227, 174, 0.8);
}
body.listening .aura-field { animation-duration: 5s; }

.aura--small {
  width: min(150px, 40vw);
}

/* the prayer held inside the light — after Turrell:
   the text floats in the luminous field, nothing else */
.aura--prayer {
  width: min(460px, 88vw);
  aspect-ratio: auto;
  min-height: min(340px, 60vw);
  padding: 3.4rem 2.8rem;
  border-radius: 40% / 36%;
}

.aura-prayer {
  position: relative;
  z-index: 2;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.5rem, 5vw, 2.1rem);
  line-height: 1.35;
  color: var(--milk);
  max-width: 20ch;
  overflow-wrap: break-word;
  text-shadow:
    0 0 24px rgba(253, 246, 232, 0.55),
    0 1px 20px rgba(36, 18, 9, 0.4);
}

.aura-prayer--long {
  font-size: clamp(1.1rem, 3.6vw, 1.5rem);
  max-width: 26ch;
}

/* ─── the halo · coverage of the pantheon ──────────── */

.halo {
  --p: 0;
  position: relative;
  border-radius: 40% / 36%;
  padding: 16px;
  isolation: isolate;
}

/* an even band of light around the lozenge: the conic fill,
   masked to a ring so it follows the shape cleanly */
.halo::before,
.halo::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 7px;
  background: conic-gradient(
    var(--amber) 0deg,
    var(--halo) calc(var(--p) * 1turn),
    rgba(43, 33, 24, 0.07) calc(var(--p) * 1turn),
    rgba(43, 33, 24, 0.07) 1turn
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  z-index: -1;
}

.halo::after {
  filter: blur(10px);
  opacity: 0.8;
}

.halo--complete::before,
.halo--complete::after {
  background: conic-gradient(var(--amber), var(--halo), var(--amber), var(--halo), var(--amber));
  animation: haloBreathe 5s ease-in-out infinite;
}

@keyframes haloBreathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

.coverage {
  margin-top: 1.6rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

/* ─── entry ────────────────────────────────────────── */

.tagline {
  margin-top: 3rem;
  max-width: 38ch;
  font-size: 1.05rem;
  font-weight: 300;
  line-height: 1.65;
  color: var(--ink-soft);
}

.prayer-form {
  margin-top: 2.4rem;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}

.input-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 252, 245, 0.65);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.5rem 0.35rem 1.3rem;
  backdrop-filter: blur(6px);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.input-row:focus-within {
  border-color: rgba(164, 68, 26, 0.4);
  box-shadow: 0 0 40px rgba(251, 227, 174, 0.6);
}

#prayer-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 300;
  color: var(--ink);
  padding: 0.55rem 0;
}

#prayer-input::placeholder { color: var(--muted); }

.mic-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #fdf3e0;
  background: linear-gradient(155deg, var(--ember), var(--amber));
  box-shadow: 0 4px 18px rgba(164, 68, 26, 0.35);
  transition: transform 0.25s, box-shadow 0.25s;
}

.mic-btn:hover { transform: scale(1.07); }

body.listening .mic-btn {
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231, 155, 60, 0.5); }
  50%      { box-shadow: 0 0 0 14px rgba(231, 155, 60, 0); }
}

.transmit-btn {
  font-family: var(--sans);
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  font-weight: 400;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.75rem 2.6rem;
  cursor: pointer;
  transition: all 0.3s;
}

.transmit-btn:hover {
  border-color: rgba(164, 68, 26, 0.5);
  background: rgba(255, 252, 245, 0.7);
  box-shadow: 0 0 40px rgba(251, 227, 174, 0.7);
}

.mic-status {
  min-height: 1.2em;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.entry-foot {
  margin-top: 4.5rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}

.entry-foot .dot { opacity: 0.5; }

/* ─── the rite ─────────────────────────────────────── */

.rite-status {
  margin-top: 2.6rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  min-height: 1.4em;
}

.rite-list {
  margin-top: 1.8rem;
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  text-align: left;
}

.rite-line {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  animation: riteIn 0.6s ease both;
}

@keyframes riteIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.rite-lang {
  flex: 0 0 11.5em;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.rite-text {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 0.98rem;
  color: var(--ink-soft);
}

/* ─── engine ───────────────────────────────────────── */

.engine { padding-top: 8vh; justify-content: flex-start; }

.engine-kicker {
  margin-bottom: 2.2rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.34em;
  color: var(--ember);
}

.petition-since {
  margin-top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.counter-block { margin-top: 3rem; }

.counter {
  font-family: var(--serif);
  font-variant-numeric: tabular-nums;
  font-weight: 300;
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  color: var(--ink);
  text-shadow: 0 0 60px rgba(231, 155, 60, 0.35);
}

.counter-label {
  margin-top: 0.4rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
}

.now-line {
  margin-top: 2.6rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  max-width: 56ch;
  min-height: 2.4em;
}

/* the log — a soft column of passing petitions */
.log {
  margin-top: 2.2rem;
  width: min(560px, 100%);
  height: 168px;
  overflow: hidden;
  position: relative;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 25%, #000 75%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 25%, #000 75%, transparent 100%);
}

.log-line {
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 2;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-line em {
  font-style: normal;
  color: var(--ink-soft);
}

.log-line .gloss {
  color: var(--muted);
  opacity: 0.75;
}

.engine-lines-small {
  margin-top: 2.4rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.prior {
  margin-top: 2rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.engine-actions {
  margin-top: 2.6rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.ghost-btn {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.65rem 1.5rem;
  cursor: pointer;
  transition: all 0.3s;
}

.ghost-btn:hover {
  border-color: rgba(164, 68, 26, 0.5);
  box-shadow: 0 0 30px rgba(251, 227, 174, 0.6);
}

.ghost-btn.active {
  background: linear-gradient(155deg, var(--ember), var(--amber));
  color: #fdf3e0;
  border-color: transparent;
}

.engine-foot {
  margin-top: 4.5rem;
  padding: 2.5rem 0 1.5rem;
  border-top: 1px solid var(--line);
  width: min(560px, 100%);
}

.foot-q {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.foot-a {
  margin-top: 0.7rem;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 40ch;
  margin-left: auto;
  margin-right: auto;
}

.foot-wager {
  margin-top: 2.2rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

@media (max-width: 480px) {
  .tagline { font-size: 0.98rem; }
  .log { height: 140px; }
  .rite-lang { flex-basis: 8.5em; }
}
