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

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  text-rendering: optimizeLegibility;
}

body,
button,
input,
select,
textarea {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
  margin-bottom: 0;
}

h1,
h2,
h3 {
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.03em;
}

h1 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
}

h2 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
}

h3 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
}

p {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-soft);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

button:disabled {
  cursor: not-allowed;
}

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

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

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius); /* 14px */
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

input,
select {
  height: 48px;
  padding: 0 16px;
}

textarea {
  padding: 12px 16px;
  line-height: 1.6;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--text-muted);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--line-focus); /* #111111 */
  box-shadow: none;
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.5;
  background: var(--surface-muted);
  cursor: not-allowed;
}

input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

input[type="file"] {
  padding: 10px;
  height: auto;
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  border: 0;
  border-radius: var(--pill);
  background: var(--primary);
  color: var(--surface);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

input[type="file"]::file-selector-button:hover {
  background: var(--primary-hover);
}

[dir="rtl"] {
  font-family: var(--font-arabic);
}

::selection {
  background: var(--primary-line);
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: var(--pill);
  background: var(--text-faint);
  background-clip: padding-box;
}

@media (max-width: 767px) {
  h1 {
    font-size: 22px;
  }
  h2 {
    font-size: 18px;
  }
  h3 {
    font-size: 16px;
  }
}

@media (max-width: 640px) {
  input,
  select,
  textarea {
    font-size: 16px;
  }
}

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