/* ---- Brand tokens ---- */
:root {
  --red: #e8352e;
  --bg: #f3eee3;
  --fg: #15151a;
  --muted: #4a4740;
  --faint: #6b6760;
  --line: #15151a;
  --error: #a3211a;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15151a;
    --fg: #f3eee3;
    --muted: #b8b2a6;
    --faint: #8e897f;
    --line: #f3eee3;
    --error: #ff7a73;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Readex Pro", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(24px, env(safe-area-inset-top)) 24px max(32px, env(safe-area-inset-bottom));
}

.top {
  width: 100%;
  display: flex;
  justify-content: flex-end;
}
.lang {
  min-height: 44px;
  padding: 0 6px;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.lang:hover {
  color: var(--fg);
}

main {
  flex: 1;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  text-align: center;
}

.logo {
  width: 240px;
  max-width: 70%;
  height: auto;
  display: block;
  color: var(--fg);
}
.logo .accent {
  fill: var(--red);
}
.logo .accent-stroke {
  stroke: var(--red);
}

.tagline {
  margin: 0;
  font-size: 17px;
  line-height: 1.6;
  color: var(--muted);
}

form {
  width: 100%;
}
.field {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1.5px solid var(--line);
}
.field:focus-within {
  border-bottom-width: 2.5px;
  margin-bottom: -1px;
}
input {
  flex: 1;
  min-width: 0;
  height: 52px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 16px;
}
input::placeholder {
  color: var(--faint);
}
/* Arabic: placeholder sits on the right; typed addresses still run left-to-right */
[dir="rtl"] input:placeholder-shown {
  direction: rtl;
  text-align: right;
}

/* Arabic needs a touch more size and line-height to read as well as the Latin */
[lang="ar"] .tagline {
  font-size: 19px;
  line-height: 1.9;
}
[lang="ar"] input,
[lang="ar"] button[type="submit"] {
  font-size: 17px;
}
[lang="ar"] .msg {
  font-size: 15px;
}
[lang="ar"] .done {
  font-size: 18px;
  line-height: 1.8;
}
input:focus {
  outline: none;
}
button[type="submit"] {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 4px;
  border: none;
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease;
}
button[type="submit"]:hover {
  color: var(--red);
}
button[type="submit"]:disabled {
  color: var(--muted);
  cursor: progress;
}

/* Loading: small spinner in the button */
.spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.is-loading .spinner {
  display: block;
}
input:disabled {
  color: var(--muted);
}
button:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 4px;
  border-radius: 2px;
}

.msg {
  min-height: 22px;
  margin: 10px 0 0;
  font-size: 14px;
  text-align: start;
  color: var(--error);
}
.msg:not(:empty) {
  animation: fade-in 0.25s ease both;
}
.shake {
  animation: shake 0.4s ease;
}

/* Success */
.done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.done p {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
}
.check {
  width: 44px;
  height: 44px;
}
.check circle,
.check path {
  fill: none;
  stroke: var(--red);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.check circle {
  stroke-dasharray: 126;
  stroke-dashoffset: 126;
  animation: draw 0.5s ease forwards;
}
.check path {
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: draw 0.3s 0.4s ease forwards;
}
form.leaving {
  animation: leave 0.25s ease forwards;
}

/* Page load: one staggered entrance */
.enter {
  animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.enter-2 {
  animation-delay: 0.12s;
}
.enter-3 {
  animation-delay: 0.24s;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes leave {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes shake {
  20%,
  60% {
    transform: translateX(-6px);
  }
  40%,
  80% {
    transform: translateX(6px);
  }
}
@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
  }
}

footer {
  font-size: 13px;
  color: var(--faint);
}

/* Honeypot: off-screen rather than display:none, which some bots skip */
.hp {
  position: absolute;
  inset-inline-start: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
[hidden] {
  display: none !important;
}
