/* ==========================================================================
   ladle — one stylesheet, one typeface, no shadows, no radii.
   Phone: a plain card on bluish paper. Pot: ink-blue broth behind ASCII.
   ========================================================================== */

@font-face {
  font-family: 'Plex Mono';
  src: url('/fonts/plex-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* the phone: paper */
  --page: #e9eef3;
  --card: #f7fafc;
  --ink: #122438;
  --ink-dim: #4f6a82;
  --rule: #b3c7d8;
  --accent: #b8402b;

  --mono: 'Plex Mono', ui-monospace, 'DejaVu Sans Mono', Menlo, monospace;
  --max: 31rem;
}

/* the pot: ink blue */
.soup-page {
  color-scheme: dark;
  --page: #0d1624;
  --card: #0d1624;
  --ink: #f2ead9;
  --ink-dim: #9fb6c9;
  --rule: #35566f;
  --accent: #d2543c;
}

* { box-sizing: border-box; }

/* nothing in this house is rounded, raised or glowing */
*,
*::before,
*::after {
  border-radius: 0;
  box-shadow: none;
}

html, body { margin: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--page);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

::selection {
  background: var(--ink);
  color: var(--card);
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover,
a:focus-visible {
  background: var(--ink);
  color: var(--card);
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- phone: one card, three things ---------- */

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(0.9rem, 4vw, 2.25rem);
}

.card {
  width: 100%;
  max-width: var(--max);
  background: var(--card);
  border: 1px solid var(--rule);
  padding: clamp(1rem, 4.6vw, 1.6rem);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.question {
  margin: 0;
  font-size: clamp(1.1rem, 4.4vw, 1.32rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.answer-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin: 0;
}

fieldset { border: 0; padding: 0; margin: 0; }

textarea {
  display: block;
  width: 100%;
  min-height: 9rem;
  resize: vertical;
  padding: 0.8rem 0.9rem;
  border: 3px double var(--rule);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
}

textarea:focus {
  border-color: var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

button {
  display: block;
  width: 100%;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--card);
  font-family: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  line-height: 1;
  padding: 0 1.1rem;
  min-height: 2.9rem;
  cursor: pointer;
}

button:hover { background: var(--card); color: var(--ink); }

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

button:disabled {
  background: var(--card);
  color: var(--ink-dim);
  border-color: var(--rule);
  cursor: default;
}

.fine {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.65;
  color: var(--ink-dim);
  text-wrap: pretty;
}

/* ---------- steam ---------- */

.steam {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.steam span {
  position: absolute;
  bottom: 0;
  color: var(--ink-dim);
  font-size: 1.35rem;
  line-height: 1;
  opacity: 0;
}

/* ---------- pot ---------- */

.soup-page {
  overflow: hidden;
  background:
    radial-gradient(ellipse 72% 58% at 50% 64%, #1b3247 0%, transparent 72%),
    var(--page);
}

.pot {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(1.5rem, 5vw, 4rem);
}

.cauldron {
  position: relative;
  width: min(64rem, 100%);
  max-height: 100%;
  border: 1px solid var(--rule);
  padding: clamp(1.8rem, 5vw, 3.6rem) clamp(1.2rem, 4vw, 3rem);
  display: grid;
  place-items: center;
}

.corner {
  position: absolute;
  color: var(--ink-dim);
  font-size: 1.3rem;
  line-height: 1;
}

.corner.tl { top: -0.52em; left: -0.3em; }
.corner.tr { top: -0.52em; right: -0.3em; }
.corner.bl { bottom: -0.52em; left: -0.3em; }
.corner.br { bottom: -0.52em; right: -0.3em; }

.rim {
  position: absolute;
  top: -1.55em;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  color: var(--ink-dim);
  font-size: clamp(0.72rem, 1.3vw, 0.95rem);
  letter-spacing: 0.4em;
  white-space: nowrap;
}

.layers {
  grid-area: 1 / 1;
  width: 100%;
  display: grid;
  place-items: center;
}

.layer {
  grid-area: 1 / 1;
  width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.6rem, 2vw, 1.6rem);
  text-align: center;
  overflow: hidden;
  opacity: 0;
  filter: blur(10px);
  transition: opacity 1400ms ease, filter 1400ms ease;
  pointer-events: none;
}

.layer.is-live {
  opacity: 1;
  filter: blur(0);
}

.wish-question {
  margin: 0;
  font-size: clamp(0.78rem, 1.6vw, 1.15rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-wrap: balance;
}

.wish {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 8rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: break-word;
  color: var(--ink);
}

.quiet {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.5rem);
  letter-spacing: 0.12em;
  color: var(--ink-dim);
}

/* ---------- motion ---------- */

@keyframes drift {
  0% { opacity: 0; transform: translate3d(0, 0.5rem, 0) scale(0.9); }
  25% { opacity: 0.55; }
  100% { opacity: 0; transform: translate3d(0.7rem, -8rem, 0) scale(1.3); }
}

@keyframes puff {
  0% { opacity: 0; transform: translate3d(0, 0, 0) scale(0.8); }
  15% { opacity: 0.8; }
  100% { opacity: 0; transform: translate3d(1rem, -10rem, 0) scale(1.55); }
}

.soup-page .steam span {
  bottom: -0.5rem;
  color: #6f97b4;
  font-size: 2rem;
  animation: drift 9s steps(18, end) infinite;
}

.soup-page .steam span:nth-child(1) { left: 34%; animation-duration: 8.5s; animation-delay: 0s; }
.soup-page .steam span:nth-child(2) { left: 41%; animation-duration: 9.5s; animation-delay: 1.2s; }
.soup-page .steam span:nth-child(3) { left: 47%; animation-duration: 8s; animation-delay: 2.4s; }
.soup-page .steam span:nth-child(4) { left: 53%; animation-duration: 10s; animation-delay: 0.6s; }
.soup-page .steam span:nth-child(5) { left: 59%; animation-duration: 9s; animation-delay: 3.4s; }
.soup-page .steam span:nth-child(6) { left: 65%; animation-duration: 8.5s; animation-delay: 4.6s; }

.soup-page .steam .puff {
  bottom: -0.5rem;
  font-size: 2.6rem;
  opacity: 0;
  animation: none;
}

.steam.is-puff .puff { animation: puff 2.4s ease-out both; }

.steam.is-puff .puff:nth-of-type(7) { left: 37%; animation-delay: 0s; }
.steam.is-puff .puff:nth-of-type(8) { left: 45%; animation-delay: 0.12s; }
.steam.is-puff .puff:nth-of-type(9) { left: 52%; animation-delay: 0.24s; }
.steam.is-puff .puff:nth-of-type(10) { left: 58%; animation-delay: 0.06s; }
.steam.is-puff .puff:nth-of-type(11) { left: 63%; animation-delay: 0.3s; }

/* one shot of steam, then the confirmation */
.thanks-page .card { position: relative; overflow: hidden; }

.thanks-page .steam span {
  bottom: -1rem;
  color: var(--ink-dim);
  font-size: 1.35rem;
  animation: puff 1.5s ease-out both;
}

.thanks-page .steam span:nth-child(1) { left: 12%; animation-delay: 0.05s; }
.thanks-page .steam span:nth-child(2) { left: 24%; animation-delay: 0.22s; }
.thanks-page .steam span:nth-child(3) { left: 36%; animation-delay: 0.12s; }
.thanks-page .steam span:nth-child(4) { left: 48%; animation-delay: 0.3s; }
.thanks-page .steam span:nth-child(5) { left: 61%; animation-delay: 0.08s; }
.thanks-page .steam span:nth-child(6) { left: 73%; animation-delay: 0.26s; }
.thanks-page .steam span:nth-child(7) { left: 85%; animation-delay: 0.16s; }

.reveal {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  animation: reveal 420ms ease-out 800ms both;
}

@keyframes reveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .steam { display: none; }
  .reveal { animation: none; opacity: 1; }
  .layer { transition: none; filter: none; opacity: 0; }
  .layer.is-live { opacity: 1; }
  .soup-page .steam span,
  .steam.is-puff .puff { animation: none; }
}

@media (prefers-contrast: more) {
  :root {
    --page: #ffffff;
    --card: #ffffff;
    --ink: #000814;
    --ink-dim: #24405a;
    --rule: #24405a;
  }

  .soup-page {
    --page: #000509;
    --card: #000509;
    --ink: #ffffff;
    --ink-dim: #d3e4f0;
    --rule: #6b8ba3;
  }
}
