/* Guest wishes widget (សារជូនពរ) — relies on the site's :root tokens, with fallbacks */
.wish {
  --wish-paper: var(--paper, #f6f0e1);
  --wish-card: var(--card, #fbf7ec);
  --wish-ink: var(--ink, #22270f);
  --wish-ink-2: var(--ink-2, #414829);
  --wish-ink-3: var(--ink-3, #5c6343);
  --wish-gold: var(--gold-700, #7d5f22);
  --wish-gold-5: var(--gold-500, #b08a45);
  --wish-line: var(--line, rgba(125, 95, 34, 0.42));
  --wish-olive: var(--olive-700, #363e1f);
  --wish-olive-d: var(--olive-800, #262c16);
  --wish-body: var(--f-body, "Noto Serif Khmer", "Cormorant Garamond", serif);
  --wish-disp: var(--f-disp, "Moul", serif);

  box-sizing: border-box;
  width: 100%;
  max-width: 560px;
  margin-inline: auto;
  color: var(--wish-ink);
  font-family: var(--wish-body);
  font-size: 17px;
  line-height: 1.9;
  text-align: start;
}
.wish *,
.wish *::before,
.wish *::after {
  box-sizing: border-box;
}

/* ---------- form ---------- */
.wish__form {
  display: grid;
  gap: 18px;
  padding: clamp(18px, 5vw, 28px);
  background: var(--wish-card);
  border: 1px solid var(--wish-line);
  border-radius: 18px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 10px 28px -18px rgba(38, 44, 22, 0.35);
}
.wish__field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.wish__labelrow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.wish__label {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.9;
  color: var(--wish-ink-2);
}
.wish__count {
  font-size: 15px;
  line-height: 1.9;
  color: var(--wish-ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.wish__count.is-near {
  color: var(--wish-gold);
  font-weight: 600;
}
.wish__input,
.wish__textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  margin: 0;
  padding: 10px 16px;
  font: inherit;
  font-size: 17px;
  line-height: 1.9;
  color: var(--wish-ink);
  background: var(--wish-paper);
  border: 1px solid var(--wish-line);
  border-radius: 12px;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.wish__textarea {
  min-height: calc(17px * 1.9 * 4 + 24px);
  resize: vertical;
  overflow-wrap: anywhere;
}
.wish__input::placeholder,
.wish__textarea::placeholder {
  color: var(--wish-ink-3);
  opacity: 0.85;
}
.wish__input:hover,
.wish__textarea:hover {
  border-color: var(--wish-gold-5);
}
.wish__input:focus,
.wish__textarea:focus {
  outline: none;
}
.wish__input:focus-visible,
.wish__textarea:focus-visible {
  border-color: var(--wish-gold);
  background: #fffdf6;
  box-shadow: 0 0 0 3px rgba(176, 138, 69, 0.35);
}
.wish__input:disabled,
.wish__textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* honeypot — kept out of view and out of the tab order */
.wish__hp {
  position: absolute !important;
  left: -10000px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.wish__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  width: 100%;
  max-width: 340px;
  min-height: 54px;
  padding: 8px 28px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.9;
  color: var(--wish-paper);
  background: var(--wish-olive);
  border: 1px solid var(--wish-olive-d);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 20px -12px rgba(38, 44, 22, 0.7);
  transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.wish__btn:hover:not(:disabled) {
  background: var(--wish-olive-d);
}
.wish__btn:active:not(:disabled) {
  transform: translateY(1px);
}
.wish__btn:focus-visible {
  outline: 2px solid var(--wish-gold-5);
  outline-offset: 3px;
}
.wish__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}
.wish__form[aria-busy="true"] .wish__btn {
  cursor: progress;
}

.wish__status {
  min-height: calc(1.9em);
  margin: 0;
  font-size: 16px;
  line-height: 1.9;
  text-align: center;
  color: var(--wish-ink-2);
}
.wish__status:empty {
  min-height: 0;
  margin-top: -18px; /* collapse the grid gap when idle */
}
.wish__status.is-ok {
  color: var(--wish-olive);
  font-weight: 600;
}
.wish__status.is-error {
  color: #8a2f1c;
}
.wish__status.is-note {
  color: var(--wish-ink-3);
  font-style: normal;
}

/* ---------- list ---------- */
.wish__empty {
  margin: 22px 0 0;
  text-align: center;
  color: var(--wish-ink-3);
  font-size: 16px;
  line-height: 1.9;
}
.wish__list {
  display: grid;
  gap: 14px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}
.wish__list:empty {
  display: none;
}
.wish__item {
  min-width: 0;
  padding: 14px 18px 16px;
  background: rgba(251, 247, 236, 0.82);
  border: 1px solid var(--wish-line);
  border-radius: 16px;
  box-shadow: 0 6px 18px -14px rgba(38, 44, 22, 0.45);
}
.wish__item.is-new {
  animation: wish-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.wish__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
}
.wish__name {
  min-width: 0;
  font-family: var(--wish-disp);
  font-size: 17px;
  font-weight: 400;
  line-height: 2;
  color: var(--wish-gold);
  overflow-wrap: anywhere;
}
.wish__time {
  font-size: 14px;
  line-height: 1.9;
  color: var(--wish-ink-3);
  white-space: nowrap;
}
.wish__msg {
  margin: 4px 0 0;
  font-size: 17px;
  line-height: 1.95;
  color: var(--wish-ink-2);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

@keyframes wish-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wish *,
  .wish *::before,
  .wish *::after {
    animation: none !important;
    transition: none !important;
  }
}
