:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #f5f5f7;
  --elevated: #ffffff;
  --text: #090909;
  --muted: #636366;
  --border: #d1d1d6;
  --accent: #0066cc;
  --focus: #004a99;
  --success: #248a3d;
  --danger: #d70015;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    17px/1.58 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Arial,
    sans-serif;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 0.13em;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip {
  position: fixed;
  inset-block-start: 10px;
  inset-inline-start: 10px;
  z-index: 10;
  padding: 10px 14px;
  transform: translateY(-160%);
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
}

.skip:focus {
  transform: translateY(0);
}

header {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}

.topbar {
  display: flex;
  width: min(100% - 32px, 920px);
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: auto;
}

.brand {
  color: var(--text);
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
}

nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

nav a,
.language {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 650;
  text-decoration: none;
}

nav a:hover,
.language:hover {
  background: var(--surface);
  color: var(--text);
}

nav a[aria-current="page"] {
  background: var(--surface);
  color: var(--accent);
}

.language {
  margin-inline-start: 6px;
  border-inline-start: 1px solid var(--border);
  border-radius: 0;
  color: var(--accent);
}

main {
  width: min(100% - 40px, 760px);
  margin: 0 auto;
  padding: clamp(48px, 8vw, 88px) 0 72px;
}

.wave {
  display: flex;
  height: 44px;
  align-items: center;
  gap: 6px;
  margin-bottom: 26px;
  color: var(--accent);
}

.wave span {
  display: block;
  width: 5px;
  border-radius: 999px;
  background: currentColor;
}

.wave span:nth-child(1),
.wave span:nth-child(7) {
  height: 10px;
  opacity: 0.45;
}

.wave span:nth-child(2),
.wave span:nth-child(6) {
  height: 22px;
  opacity: 0.62;
}

.wave span:nth-child(3),
.wave span:nth-child(5) {
  height: 34px;
  opacity: 0.8;
}

.wave span:nth-child(4) {
  height: 44px;
}

h1 {
  max-width: 15ch;
  margin: 0;
  font-size: clamp(38px, 8vw, 68px);
  letter-spacing: -0.045em;
  line-height: 1.02;
  text-wrap: balance;
}

.lede {
  max-width: 62ch;
  margin: 24px 0 12px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.5;
  text-wrap: pretty;
}

.updated {
  margin: 0 0 52px;
  color: var(--muted);
  font-size: 14px;
}

section {
  padding: 30px 0;
  border-top: 1px solid var(--border);
}

section:first-of-type {
  border-top: 0;
}

h2 {
  margin: 0 0 14px;
  font-size: 25px;
  letter-spacing: -0.025em;
  line-height: 1.2;
  scroll-margin-top: 24px;
  text-wrap: balance;
}

p {
  margin: 0 0 14px;
}

ul,
ol {
  margin: 12px 0 0;
  padding-inline-start: 24px;
}

li {
  margin: 8px 0;
}

.notice {
  margin: 8px 0 28px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--accent);
  border-radius: 12px;
  background: var(--surface);
}

.notice[data-state="success"] {
  border-inline-start-color: var(--success);
}

.notice[data-state="error"] {
  border-inline-start-color: var(--danger);
}

form {
  display: grid;
  gap: 18px;
  margin-top: 26px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--elevated);
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 170px;
  resize: vertical;
}

.hint {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.check {
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  font-weight: 500;
}

.check input {
  width: 22px;
  min-height: 22px;
  margin: 2px 0 0;
  padding: 0;
}

code {
  overflow-wrap: anywhere;
}

button {
  min-height: 48px;
  justify-self: start;
  padding: 12px 20px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font: 700 16px/1.2 inherit;
  touch-action: manipulation;
}

button:hover {
  filter: brightness(0.9);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.trap {
  position: absolute;
  overflow: hidden;
  inline-size: 1px;
  block-size: 1px;
  clip-path: inset(50%);
  white-space: nowrap;
}

footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

.footer-inner {
  width: min(100% - 40px, 760px);
  margin: auto;
  padding: 28px 0 42px;
}

.copy-ar {
  display: none;
}

html[lang="ar"] .copy-ar {
  display: inline;
}

html[lang="ar"] .copy-en {
  display: none;
}

[hidden] {
  display: none !important;
}

@media (max-width: 680px) {
  .topbar {
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 14px 0;
  }

  nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  nav a,
  .language {
    padding-inline: 10px;
    white-space: nowrap;
  }

  main {
    padding-top: 50px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --elevated: #1c1c1e;
    --text: #f5f5f7;
    --muted: #b0b0b5;
    --border: #3a3a3c;
    --accent: #4aa3ff;
    --focus: #64b5ff;
    --success: #30d158;
    --danger: #ff453a;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
