/* ==========================================================================
   ladle — one stylesheet, one typeface. No radii, no shadows, no gradients.
   One palette everywhere: light blue paper, ink, one double line for the field.
   ========================================================================== */

@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;

  --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 drawing scales with the short side, so it survives a vertical panel */
  --cauldron-size: clamp(0.7rem, 3vmin, 1.8rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  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: question, field, button ---------- */

.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.75rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.question {
  margin: 0;
  font-size: clamp(1.05rem, 4.2vw, 1.3rem);
  line-height: 1.35;
  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.7rem 0.8rem;
  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.6;
  color: var(--ink-dim);
  text-wrap: pretty;
}

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

.pot {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  gap: clamp(0.5rem, 2vh, 1.5rem);
  padding: clamp(1rem, 3vh, 2rem) clamp(1rem, 4vw, 3rem) clamp(1rem, 3vh, 2rem);
  overflow: hidden;
}

.layers {
  position: relative;
  z-index: 1;
  grid-area: 1 / 1;
  width: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
}

.layer {
  grid-area: 1 / 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.6rem, 2vw, 1.4rem);
  text-align: center;
  opacity: 0;
  transition: opacity 1200ms ease;
  pointer-events: none;
}

.layer.is-live { opacity: 1; }

.wish-question {
  margin: 0;
  font-size: clamp(0.72rem, 1.5vw, 1.05rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-wrap: balance;
}

.wish {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 8rem);
  line-height: 1.15;
  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);
}

/* No pointer on the panel: cage still draws a default cursor with no mouse
   attached, so the page declares its own. The form and admin keep theirs. */
.soup-page,
.soup-page * {
  cursor: none;
}

/* ---------- cauldron: the drawing is text, so it stays text ---------- */

.furnace {
  position: relative;
  z-index: 0;
  width: 100%;
  display: grid;
  justify-items: center;
}

.cauldron {
  margin: 0;
  padding-bottom: 0.9em;
  font-family: inherit;
  font-size: var(--cauldron-size);
  line-height: 1.1;
  white-space: pre;
  color: var(--ink);
  user-select: none;
}

/* ---------- steam: parentheses that the page's own text is made of ---------- */

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

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

/* a column of air above the mouth, taller than the drawing itself, so the
   steam has somewhere to go instead of being clipped at the pot's top edge */
.furnace .steam {
  inset: auto 0 74%;
  height: 46vh;
  overflow: visible;
}

.furnace .steam span {
  bottom: 0;
  font-size: var(--cauldron-size);
  animation: drift 9s steps(12, end) infinite;
}

.furnace .steam span:nth-child(1) { left: 52%; animation-duration: 8.5s; animation-delay: 0s; }
.furnace .steam span:nth-child(2) { left: 54%; animation-duration: 10s; animation-delay: 1.4s; }
.furnace .steam span:nth-child(3) { left: 56%; animation-duration: 9s; animation-delay: 2.8s; }
.furnace .steam span:nth-child(4) { left: 58%; animation-duration: 11s; animation-delay: 0.7s; }
.furnace .steam span:nth-child(5) { left: 60%; animation-duration: 8s; animation-delay: 4.1s; }
.furnace .steam span:nth-child(6) { left: 62%; animation-duration: 9.5s; animation-delay: 5.3s; }
.furnace .steam span:nth-child(7) { left: 64%; animation-duration: 10.5s; animation-delay: 6.2s; }
.furnace .steam span:nth-child(8) { left: 66%; animation-duration: 9s; animation-delay: 3.4s; }

.furnace .steam .puff {
  font-size: var(--cauldron-size);
  animation: none;
}

.steam.is-puff .puff { animation: puff 2.2s steps(9, end) both; }

.steam.is-puff .puff:nth-of-type(9) { left: 55%; animation-delay: 0s; }
.steam.is-puff .puff:nth-of-type(10) { left: 58%; animation-delay: 0.1s; }
.steam.is-puff .puff:nth-of-type(11) { left: 61%; animation-delay: 0.2s; }
.steam.is-puff .puff:nth-of-type(12) { left: 64%; animation-delay: 0.05s; }
.steam.is-puff .puff:nth-of-type(13) { left: 67%; animation-delay: 0.28s; }

/* ---------- motion: glyphs stepping upward, nothing scaled or blurred ---------- */

@keyframes drift {
  0% { opacity: 0; transform: translateY(0); }
  15% { opacity: 0.7; }
  70% { opacity: 0.5; }
  100% { opacity: 0; transform: translateY(-36vh); }
}

@keyframes puff {
  0% { opacity: 0; transform: translateY(0); }
  15% { opacity: 0.85; }
  100% { opacity: 0; transform: translateY(-46vh); }
}

/* the little puff on the phone card stays at the bottom edge */
@keyframes wisp {
  0% { opacity: 0; transform: translateY(0); }
  30% { opacity: 0.5; }
  100% { opacity: 0; transform: translateY(-2.2em); }
}

.thanks-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

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

.thanks-page .steam span {
  bottom: -0.6rem;
  font-size: 0.95rem;
  animation: wisp 1.4s steps(8, end) both;
}

.thanks-page .steam span:nth-child(1) { left: 13%; animation-delay: 0.05s; }
.thanks-page .steam span:nth-child(2) { left: 25%; animation-delay: 0.22s; }
.thanks-page .steam span:nth-child(3) { left: 37%; animation-delay: 0.12s; }
.thanks-page .steam span:nth-child(4) { left: 55%; animation-delay: 0.3s; }
.thanks-page .steam span:nth-child(5) { left: 63%; 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; }

@media (prefers-reduced-motion: reduce) {
  .steam { display: none; }
  .layer { transition: none; }
  .furnace .steam span,
  .steam.is-puff .puff { animation: none; }
}

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

/* ---------- admin: one scrollable column, same paper ---------- */

.admin-page {
  place-items: start center;
  padding-top: clamp(1rem, 4vw, 2rem);
  padding-bottom: clamp(1rem, 4vw, 2rem);
}

.admin-stack {
  width: 100%;
  max-width: var(--max);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.submission {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--rule);
}

.submission:first-of-type { border-top: 0; }

.submission-body {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.4;
  overflow-wrap: break-word;
}

.submission form { margin: 0; }

.question-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.question-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--rule);
}

.question-row:first-child { border-top: 0; }
.question-row > span { flex: 1; min-width: 0; overflow-wrap: break-word; }
.question-row form { flex-shrink: 0; margin: 0; }

.question-row button {
  width: auto;
  min-height: 2rem;
  font-size: 0.68rem;
  padding: 0 0.7rem;
}

.question-list + .answer-form {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
}

input[type="password"] {
  display: block;
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 3px double var(--rule);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
}

input[type="password"]:focus {
  border-color: var(--ink);
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

/* ---------- panel mounted on its side ---------- */

/* `/soup?rotate=90` (or 270) turns the whole page, so a landscape panel reads
   upright standing on end. No parameter, no change: phones, desktops and the
   admin see exactly what they always saw. The rotated box is the panel turned
   a quarter, so its width is the viewport's height — anything sized in `vw`
   has to think in `vh`, which is why fit() in soup.js swaps units too. */
/* The box itself is sized and turned in soup.js, in pixels from the live
   viewport; vh/vw here land off-screen when the window is sized late. These
   are the parts that cannot depend on that: the backdrop, and no cursor. */
html.rot90,
html.rot270 {
  overflow: hidden;
  background: var(--page);
  cursor: none;
}
