/* Shared base: fonts, reset, controls. Colours come only from tokens.css. */

@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2");
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.9;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

[hidden] { display: none !important; }

a { color: var(--primary-dark); }

img, svg { max-width: 100%; }

:focus-visible {
  outline: 3px solid var(--primary-dark);
  outline-offset: 2px;
}

.wrap {
  width: 100%;
  max-width: 40rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

.num { unicode-bidi: isolate; }

.small {
  font-size: 0.875rem;
  line-height: 1.8;
  color: var(--muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.5rem 1.5rem;
  border: 2px solid transparent;
  border-radius: 0.75rem;
  font: inherit;
  font-weight: 700;
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline { background: var(--surface); color: var(--primary-dark); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-tint); }

.btn-danger { background: var(--danger); color: var(--on-primary); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 80%, black); }

.btn-block { width: 100%; }

.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; }

/* Form controls */
label, legend { display: block; font-weight: 700; margin-bottom: 0.25rem; }

legend { padding: 0; }

input[type="text"], input[type="tel"], input[type="password"], input[type="search"],
select, textarea {
  display: block;
  width: 100%;
  min-height: 3rem;
  padding: 0.5rem 0.875rem;
  border: 1.5px solid var(--muted);
  border-radius: 0.75rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  line-height: 1.6;
}

textarea { min-height: 6rem; resize: vertical; }

::placeholder { color: var(--muted); opacity: 1; }

input[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-tint); }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

.field { margin-bottom: 1.25rem; }

.field-error, .form-error {
  margin-top: 0.375rem;
  color: var(--danger);
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1.7;
}

.form-error {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--danger);
  border-radius: 0.75rem;
  background: var(--danger-tint);
}

/* Segmented radio buttons */
.seg-group { display: flex; gap: 0.5rem; }

.seg { position: relative; flex: 1 1 0; margin: 0; font-weight: 400; }

.seg input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.seg span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.25rem 0.5rem;
  border: 1.5px solid var(--muted);
  border-radius: 0.75rem;
  background: var(--surface);
  color: var(--ink);
  text-align: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.seg input:checked + span {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
}

.seg input:focus-visible + span {
  outline: 3px solid var(--primary-dark);
  outline-offset: 2px;
}

/* Honeypot: hidden for people, still present in the markup */
.hp {
  position: absolute;
  inset-inline-start: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
