/* ---------- Duas & wishes wall ---------- */
.duas-section {
  position: relative;
  padding: clamp(70px, 10vw, 130px) 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(212, 175, 55, 0.12), transparent 55%),
    radial-gradient(ellipse at 85% 100%, rgba(122, 140, 104, 0.14), transparent 55%),
    var(--color-cream);
  overflow: clip;
}
.duas-header { max-width: 640px; margin: 0 auto; }
.duas-title { font-family: var(--font-script); font-weight: 400; font-size: clamp(3rem, 9vw, 4.6rem); line-height: 1.1; color: var(--ink); }
.duas-lead { font-family: var(--font-serif); font-size: clamp(1.08rem, 2.2vw, 1.25rem); color: var(--text-body); max-width: 46ch; margin: 12px auto 0; text-wrap: balance; }

/* Writing card */
.duas-form {
  position: relative;
  max-width: 680px;
  margin: clamp(32px, 5vw, 48px) auto 0;
  padding: clamp(22px, 4vw, 34px);
  border-radius: 22px;
  background: linear-gradient(180deg, #fffdf7, #f8f1e1);
  border: 1px solid rgba(212, 175, 55, 0.45);
  box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.7), 0 0 0 8px rgba(212, 175, 55, 0.22), 0 40px 80px -48px rgba(28, 42, 31, 0.5);
  overflow: hidden;
  box-sizing: border-box;
}
.duas-compose[hidden], .duas-success[hidden] { display: none; }

.duas-field { position: relative; display: block; text-align: left; }
.duas-field > label { display: block; font-family: var(--font-display); font-size: 0.72rem; letter-spacing: 2px; text-transform: uppercase; color: #8a6a24; margin: 0 0 7px 4px; }
.duas-field textarea,
.duas-field input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font: 1.12rem/1.5 var(--font-serif);
  color: #2c3424;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(154, 116, 37, 0.28);
  background: rgba(255, 255, 255, 0.85);
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
  -webkit-appearance: none;
}
.duas-field textarea { resize: none; min-height: 128px; padding-bottom: 32px; overflow: hidden; }
.duas-field textarea::placeholder, .duas-field input::placeholder { color: #a49a84; }
.duas-field textarea:focus,
.duas-field input:focus { border-color: #c9a24a; background: #fff; box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.18); }
.duas-field textarea:dir(rtl), .duas-field input:dir(rtl) { font-family: 'Amiri', var(--font-serif); }
.duas-input-wrap { position: relative; }
.duas-count { position: absolute; right: 14px; bottom: 10px; font: normal 0.78rem var(--font-sans); color: #8f8570; pointer-events: none; }
.duas-count b { font-weight: 500; }
.duas-count.is-near b { color: #a4442f; font-weight: 700; }
.duas-name { margin-bottom: 20px; }

.duas-chips-label { margin: 0 0 9px; font: italic 1rem var(--font-serif); color: #7d7361; text-align: center; }
.duas-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 20px; }
.duas-chip {
  font: 500 0.95rem/1 var(--font-serif);
  min-height: 38px;
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid rgba(154, 116, 37, 0.35);
  background: rgba(255, 255, 255, 0.75);
  color: #6d5320;
  cursor: pointer;
  transition: transform 0.25s var(--ease-lux, ease), background 0.25s, border-color 0.25s, box-shadow 0.25s, color 0.25s;
}
.duas-chip[lang="ar"] { font-family: 'Amiri', serif; font-size: 1.05rem; padding: 7px 15px 9px; }
.duas-chip:hover { transform: translateY(-2px); background: #fff; border-color: #c9a24a; box-shadow: 0 8px 18px -10px rgba(154, 116, 37, 0.6); }
.duas-chip:active { transform: scale(0.96); }
.duas-chip.is-on { background: #f3e6c4; border-color: #b8892f; color: #5a4418; }
.duas-chip:focus-visible, .duas-retry:focus-visible { outline: 2px solid #9a7425; outline-offset: 2px; }

/* Errors */
.duas-err {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 8px 0 0 4px;
  font: 500 0.98rem/1.35 var(--font-serif);
  color: #9c3b27;
  animation: duasErrIn 0.3s var(--ease-lux, ease);
}
.duas-err[hidden] { display: none; }
.duas-err::before {
  content: '!';
  flex: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #9c3b27;
  color: #fff;
  font: 700 0.7rem/17px var(--font-sans);
  text-align: center;
}
.duas-field.is-invalid textarea, .duas-field.is-invalid input { border-color: #c0573f; background: #fffaf7; box-shadow: 0 0 0 3px rgba(192, 87, 63, 0.12); }
.duas-field.is-shake .duas-input-wrap, .duas-field.is-shake input { animation: duasShake 0.4s; }
@keyframes duasShake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes duasErrIn { from { opacity: 0; transform: translateY(-4px); } }

.duas-alert {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 13px;
  background: #fbefe9;
  border: 1px solid rgba(192, 87, 63, 0.35);
  text-align: left;
  animation: duasErrIn 0.35s var(--ease-lux, ease);
}
.duas-alert[hidden] { display: none; }
.duas-alert svg { flex: none; width: 22px; height: 22px; fill: none; stroke: #9c3b27; stroke-width: 1.8; stroke-linecap: round; }
.duas-alert p { flex: 1; margin: 0; font: 500 1rem/1.35 var(--font-serif); color: #7c2f1f; }
.duas-retry {
  flex: none;
  min-height: 38px;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid #9c3b27;
  background: #fff;
  color: #7c2f1f;
  font: 600 0.85rem var(--font-sans);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.duas-retry:hover { background: #9c3b27; color: #fff; }

/* Send */
.duas-row { display: flex; justify-content: center; margin-top: 18px; }
.duas-send { display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 54px; min-width: 250px; }
.duas-send .ico { transition: transform 0.4s var(--ease-lux, ease); }
.duas-send:hover .ico { transform: translate(3px, -3px); }
.duas-send.is-sending, .duas-send:disabled { cursor: progress; opacity: 0.8; }
.duas-send.is-sending .ico { animation: duasFly 0.9s ease-in-out infinite; }
@keyframes duasFly { 50% { transform: translate(6px, -6px); opacity: 0.4; } }
.duas-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Thank-you panel */
.duas-success { padding: clamp(14px, 3vw, 26px) 0; text-align: center; }
.duas-tick { display: block; width: 72px; height: 72px; margin: 0 auto 10px; fill: none; stroke: #b8892f; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.duas-tick circle { stroke-dasharray: 176; stroke-dashoffset: 176; transform: rotate(-90deg); transform-origin: center; }
.duas-tick path { stroke-width: 3.2; stroke-dasharray: 40; stroke-dashoffset: 40; }
.duas-success:not([hidden]) .duas-tick circle { animation: duasDraw 0.8s 0.1s var(--ease-lux, ease) forwards; }
.duas-success:not([hidden]) .duas-tick path { animation: duasDraw 0.45s 0.7s ease-out forwards; }
@keyframes duasDraw { to { stroke-dashoffset: 0; } }
.duas-success-title { margin: 0; font-family: var(--font-script); font-weight: 400; font-size: clamp(2.5rem, 7vw, 3.4rem); line-height: 1.15; color: var(--ink); outline: none; }
.duas-success-text { max-width: 38ch; margin: 8px auto 0; font: 1.16rem/1.45 var(--font-serif); color: #3b4233; text-wrap: balance; }
.duas-success-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 22px; }
.duas-success-actions [hidden] { display: none; }

/* Wall */
.duas-wall-head { text-align: center; margin: clamp(40px, 6vw, 60px) 0 18px; min-height: 1.5em; }
.duas-tally { font-family: var(--font-display); font-size: 0.8rem; letter-spacing: 3px; text-transform: uppercase; color: #8a6a24; }
.duas-wall { columns: 3 270px; column-gap: 20px; max-width: 1080px; margin: 0 auto; }
.duas-wall.is-empty { columns: auto; }
.duas-wall-error { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px; padding: 8px 0 18px; }
.duas-wall-error[hidden] { display: none; }
.duas-wall-error p { margin: 0; font: italic 1.12rem var(--font-serif); color: #7d7361; }

.dua-note {
  position: relative;
  display: inline-block;
  width: 100%;
  box-sizing: border-box;
  break-inside: avoid;
  margin: 0 0 20px;
  padding: 44px 26px 20px;
  border-radius: 18px;
  background: linear-gradient(170deg, #fffefa 0%, #fbf6ea 100%);
  border: 1px solid rgba(201, 162, 74, 0.32);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 22px 40px -30px rgba(28, 42, 31, 0.5);
  text-align: left;
  transition: transform 0.45s var(--ease-lux, ease), box-shadow 0.45s var(--ease-lux, ease), border-color 0.45s;
  animation: duaIn 0.8s var(--ease-lux, cubic-bezier(0.22, 1, 0.36, 1)) backwards;
  animation-delay: var(--delay, 0s);
}
/* Opening quotation mark, set in the paper rather than hanging off it */
.dua-note::before {
  content: '“';
  position: absolute;
  top: 12px;
  left: 22px;
  font: 400 3.4rem/1 var(--font-serif);
  color: #d8bc7a;
  pointer-events: none;
}
.dua-note:nth-child(3n + 2) { background: linear-gradient(170deg, #fdfef9 0%, #f3f5ea 100%); }
@media (hover: hover) {
  .dua-note:hover { transform: translateY(-4px); border-color: rgba(201, 162, 74, 0.6); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 30px 46px -28px rgba(28, 42, 31, 0.55); }
}
.dua-note.is-new { animation: duaArrive 1.1s var(--ease-lux, cubic-bezier(0.22, 1, 0.36, 1)) backwards; }
.dua-note.is-mine { border-color: rgba(184, 137, 47, 0.7); box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.13), 0 22px 40px -30px rgba(28, 42, 31, 0.5); }
.dua-note.is-flash { animation: duaFlash 1.6s var(--ease-lux, ease); }

.dua-text { margin: 0 0 18px; font: 400 1.18rem/1.55 var(--font-serif); color: #2b3125; white-space: pre-line; overflow-wrap: anywhere; text-wrap: pretty; }
.dua-text.is-short { font-size: 1.36rem; line-height: 1.4; }
.dua-text.is-ar { font-family: 'Amiri', var(--font-serif); font-size: 1.38rem; line-height: 1.95; text-align: right; }
.dua-note:has(.dua-text.is-ar)::before { left: auto; right: 22px; transform: scaleX(-1); }

.dua-by { display: flex; align-items: center; gap: 11px; padding-top: 14px; border-top: 1px solid rgba(201, 162, 74, 0.26); }
.dua-mono {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #fbf3dc, #efdfb4);
  border: 1px solid rgba(184, 137, 47, 0.55);
  font: 600 0.95rem/1 var(--font-display);
  color: #76591d;
}
.dua-meta { flex: 1; min-width: 0; }
.dua-who { display: block; font: 600 1.06rem/1.25 var(--font-serif); color: #2b3125; overflow-wrap: anywhere; }
.dua-who.is-ar { font-family: 'Amiri', var(--font-serif); }
.dua-by time { display: block; margin-top: 2px; font: 400 0.76rem/1.2 var(--font-sans); color: #7d7361; }
.dua-mine { flex: none; padding: 4px 9px; border-radius: 999px; background: #f3e6c4; font: 600 0.68rem/1.2 var(--font-sans); letter-spacing: 0.3px; color: #66501c; }
.dua-del { position: absolute; top: 10px; right: 10px; z-index: 1; width: 30px; height: 30px; border-radius: 50%; border: 1px solid #d9a99b; background: #fff; color: #a4442f; cursor: pointer; font-size: 15px; line-height: 1; }

@keyframes duaIn { from { opacity: 0; transform: translateY(18px) scale(0.98); } }
@keyframes duaArrive {
  0% { opacity: 0; transform: translateY(-26px) scale(0.92); }
  60% { opacity: 1; transform: translateY(3px) scale(1.01); }
  100% { opacity: 1; transform: none; }
}
@keyframes duaFlash {
  0%, 100% { box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.13), 0 22px 40px -30px rgba(28, 42, 31, 0.5); }
  35% { box-shadow: 0 0 0 7px rgba(212, 175, 55, 0.45), 0 22px 40px -30px rgba(28, 42, 31, 0.5); }
}

.duas-empty { text-align: center; font: italic 1.2rem var(--font-serif); color: #7d7361; padding: 10px 0 20px; }
.duas-skel { height: 170px; border-radius: 18px; margin: 0 0 20px; break-inside: avoid; background: linear-gradient(100deg, #f4ecda 30%, #fbf6ea 50%, #f4ecda 70%) 0 0 / 300% 100%; animation: duasSkel 1.4s linear infinite; }
@keyframes duasSkel { to { background-position: -150% 0; } }
.duas-more-wrap { text-align: center; margin-top: 10px; }
.duas-more[hidden] { display: none; }

@media (max-width: 640px) {
  .duas-send { width: 100%; }
  .duas-chip { font-size: 0.9rem; padding: 8px 13px; }
  .duas-wall { columns: 1; }
  .duas-alert { flex-wrap: wrap; }
  .duas-alert p { flex-basis: calc(100% - 40px); }
  .duas-retry { margin-left: 33px; }
  .duas-success-actions .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .dua-note, .dua-note.is-new, .dua-note.is-flash, .duas-err, .duas-alert { animation: none; }
  .dua-note, .duas-chip { transition: none; }
  .duas-skel, .duas-send.is-sending .ico { animation: none; }
  .duas-tick circle, .duas-tick path { stroke-dashoffset: 0; animation: none !important; }
}
