@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/fraunces.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: 'Cairo';
  src: url('/fonts/cairo.woff2') format('woff2');
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --bg: #eef2f6;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-soft: #475569;
  --ink-faint: #94a3b8;
  --line: #e2e8f0;
  --field: #f8fafc;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --error: #dc2626;
  --ok: #059669;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: 'Fraunces', 'Cairo', Georgia, serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  -webkit-font-smoothing: antialiased;
}

.card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px 26px 20px;
  box-shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.18);
}

.lang {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-block-end: 8px;
}

.lang button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-faint);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  min-width: 32px;
}

.lang button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.namemark {
  display: block;
  margin: auto;
  max-width: 210px;
  height: auto;
}

header {
  text-align: center;
}

header h1 {
  margin: 0;
  font-size: 22px;
}

.intro {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  border-top: 1px solid var(--ink-faint);
  padding-top: 10px;
}

.context {
  margin: 10px 0 0;
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 5px 9px;
}

form {
  margin-block-start: 18px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

input,
textarea {
  font: inherit;
  font-weight: 400;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
  resize: vertical;
}

textarea {
  height: 80px;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.actions {
  display: flex;
  gap: 10px;
  margin-block-start: 4px;
}

.actions button {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
}

button[type='submit'] {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: 0;
}

button[type='submit']:disabled {
  opacity: 0.65;
  cursor: progress;
}

button.secondary {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

button.secondary:hover {
  background: var(--field);
}

.btn-icon {
  width: 17px;
  height: 17px;
  flex: none;
}

[dir='rtl'] .btn-icon {
  transform: scaleX(-1);
}

.hp {
  position: absolute;
  inset-inline-start: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Centered popup - the submit result, shown over a dim backdrop. */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.55);
}

.overlay[hidden] {
  display: none;
}

.popup {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border-radius: 14px;
  padding: 28px 26px 22px;
  text-align: center;
  box-shadow: 0 20px 50px -16px rgba(15, 23, 42, 0.45);
  animation: msgIn 0.3s ease-out both;
}

.popup:focus {
  outline: none;
}

.popup-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 10px;
}

.popup .icon-ok,
.popup .icon-err {
  display: none;
}

.popup.success .icon-ok,
.popup.error .icon-err {
  display: block;
}

.icon-ok circle {
  fill: var(--ok);
  opacity: 0.12;
}

.icon-ok path {
  fill: none;
  stroke: var(--ok);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 34;
  stroke-dashoffset: 34;
  animation: drawCheck 0.45s 0.15s ease-out forwards;
}

.icon-err circle {
  fill: var(--error);
  opacity: 0.12;
}

.icon-err path {
  fill: none;
  stroke: var(--error);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.popup h2 {
  margin: 0;
  font-size: 20px;
  color: var(--ok);
}

.popup p {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.popup .dismiss {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  margin-block-start: 18px;
  padding: 9px 22px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink-soft);
  cursor: pointer;
}

.popup .dismiss:hover {
  background: var(--accent-soft);
}

.popup.success .dismiss {
  display: none;
}

footer {
  margin-block-start: 18px;
  padding-block-start: 14px;
  border-block-start: 1px solid var(--line);
  text-align: center;
  font-size: 12px;
}

footer a {
  color: var(--ink-faint);
  text-decoration: none;
}

@media (max-width: 380px) {
  .card {
    padding: 20px 18px 16px;
  }
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes drawCheck {
  to {
    stroke-dashoffset: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .popup,
  .icon-ok path {
    animation: none;
  }
  .icon-ok path {
    stroke-dashoffset: 0;
  }
}
