/* IBM Plex Sans Arabic (OFL, see fonts/OFL.txt): one family for both scripts. */
@font-face { font-family: 'Plex Arabic'; font-style: normal; font-display: swap; font-weight: 400; src: url(/fonts/plex-arabic-arabic-400.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Plex Arabic'; font-style: normal; font-display: swap; font-weight: 500; src: url(/fonts/plex-arabic-arabic-500.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Plex Arabic'; font-style: normal; font-display: swap; font-weight: 600; src: url(/fonts/plex-arabic-arabic-600.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Plex Arabic'; font-style: normal; font-display: swap; font-weight: 700; src: url(/fonts/plex-arabic-arabic-700.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: 'Plex Arabic'; font-style: normal; font-display: swap; font-weight: 400; src: url(/fonts/plex-arabic-latin-400.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex Arabic'; font-style: normal; font-display: swap; font-weight: 500; src: url(/fonts/plex-arabic-latin-500.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex Arabic'; font-style: normal; font-display: swap; font-weight: 600; src: url(/fonts/plex-arabic-latin-600.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plex Arabic'; font-style: normal; font-display: swap; font-weight: 700; src: url(/fonts/plex-arabic-latin-700.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Academic navy: white surfaces, slate text, one navy accent. */
:root {
  --page: #f3f5f8;
  --surface: #ffffff;
  --ink: #17202e;
  --ink-2: #3a4658;
  --muted: #667185;
  --line: #d9dee7;
  --line-strong: #b9c1ce;
  --accent: #1f3a63;
  --accent-hover: #172d4d;
  --accent-ink: #ffffff;
  --accent-soft: #edf1f7;
  --danger: #a33a2c;
  --focus: #2f5ea8;
  --radius: 10px;
  --dx: 1;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0b111b;
    --surface: #0f1724;
    --ink: #e6ebf2;
    --ink-2: #c3ccd9;
    --muted: #8e9bb0;
    --line: #243045;
    --line-strong: #34425b;
    --accent: #8fb0e3;
    --accent-hover: #a9c3ec;
    --accent-ink: #0b1526;
    --accent-soft: #16233a;
    --danger: #f0907e;
    --focus: #8fb0e3;
    color-scheme: dark;
  }
}
[dir='rtl'] { --dx: -1; }

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: minmax(0, 1fr); /* long one-line labels must not widen the page */
  background: var(--surface);
  color: var(--ink);
  font-family: 'Plex Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
button, input, textarea { font: inherit; color: inherit; }
button {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[tabindex='-1']:focus { outline: none; }
[hidden] { display: none !important; }

.icon { display: inline-flex; flex: none; }
.icon svg { width: 1.05em; height: 1.05em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- header ---------------------------------------------------------------- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  padding-top: env(safe-area-inset-top, 0px);
}
.top-row {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
}
.brand-short { display: none; }
@media (max-width: 480px) {
  .has-counter .brand-long { display: none; }
  .has-counter .brand-short { display: inline; }
}
.counter { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lang {
  flex: none;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
  transition: border-color .15s, background-color .15s;
}
.lang:active { background: var(--accent-soft); }
.progress { height: 3px; background: var(--line); }
.progress-fill {
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .4s var(--ease);
}
[dir='rtl'] .progress-fill { transform-origin: right; }

/* ---- stage and screen transitions ------------------------------------------------ */

.stage {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 24px;
  overflow: clip; /* hides the outgoing screen where it is taller than the new one */
  overflow-clip-margin: 4px; /* keeps focus rings visible */
}
.screen.leaving { position: absolute; inset: 20px 16px auto; pointer-events: none; }
.screen.entering.fwd { animation: in-fwd .26s var(--ease) both; }
.screen.entering.back { animation: in-back .26s var(--ease) both; }
.screen.leaving { animation: out .16s ease-in both; }
@keyframes in-fwd { from { opacity: 0; transform: translateX(calc(var(--dx) * 20px)); } }
@keyframes in-back { from { opacity: 0; transform: translateX(calc(var(--dx) * -20px)); } }
@keyframes out { to { opacity: 0; } }

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .02em;
}
:lang(ar) .eyebrow { letter-spacing: 0; }
.eyebrow.one-line { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pill {
  display: inline-block;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-weight: 500;
}
.q {
  margin: 0 0 6px;
  font-size: clamp(22px, 1vw + 19px, 26px);
  line-height: 1.5;
  font-weight: 600;
  color: var(--ink);
  text-wrap: pretty;
}
:lang(ar) .q { line-height: 1.7; }
.q.statement { margin-bottom: 18px; }
.hint { margin: 0 0 18px; color: var(--muted); font-size: 17px; text-wrap: pretty; }

/* ---- options: radio rows ---------------------------------------------------------- */

.options { display: grid; gap: 10px; }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: start;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink);
  transition: border-color .12s, background-color .12s, box-shadow .12s;
}
.option:active { background: var(--accent-soft); }
.option .label { flex: 1; }
.radio {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  display: grid;
  place-items: center;
  transition: border-color .12s;
}
.radio::after {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  transform: scale(0);
  transition: transform .15s var(--ease);
}
.option[aria-checked='true'] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.option[aria-checked='true'] .radio { border-color: var(--accent); }
.option[aria-checked='true'] .radio::after { transform: scale(1); }
.key, .keys-hint { display: none; }
.entering .option { animation: rise .3s var(--ease) both; animation-delay: calc(var(--i) * 25ms + 40ms); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* Mouse and keyboard: number hints and hover. Touch never sees them. */
@media (hover: hover) and (pointer: fine) {
  .option:hover { border-color: var(--line-strong); }
  .option[aria-checked='true']:hover { border-color: var(--accent); }
  .key {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 1px solid var(--line);
    border-radius: 5px;
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
  }
  .keys-hint { display: block; margin: 14px 0 0; font-size: 13px; color: var(--muted); }
  .lang:hover { border-color: var(--line-strong); }
  .secondary:hover { background: var(--page); }
  .primary:not(:disabled):hover { background: var(--accent-hover); }
  .letter summary:hover { text-decoration: underline; }
}

.other { margin-top: 10px; }
input[type='text'], textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 14px;
  font-size: 18px; /* 16px or more: iOS does not zoom into the field */
  line-height: 1.6;
  transition: border-color .12s, box-shadow .12s;
}
input[type='text']:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
::placeholder { color: var(--muted); opacity: .8; }
.area { position: relative; }
textarea { display: block; min-height: 140px; resize: vertical; padding-bottom: 30px; }
.count { position: absolute; inset-inline-end: 12px; bottom: 8px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- welcome ------------------------------------------------------------------- */

.welcome .eyebrow { color: var(--accent); }
.title {
  margin: 0 0 14px;
  font-size: clamp(26px, 2.2vw + 19px, 34px);
  line-height: 1.35;
  font-weight: 700;
  color: var(--ink);
  text-wrap: balance;
}
:lang(ar) .title { line-height: 1.6; }
.chips { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 16px; padding: 0; list-style: none; }
.chips li { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; color: var(--muted); }
.chips .icon { color: var(--accent); }
.letter {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}
.letter p { margin: 0 0 12px; color: var(--ink-2); font-size: 18px; line-height: 1.8; }
.letter .greeting { color: var(--ink); font-weight: 600; }
.letter details p:last-child { margin-bottom: 0; }
.letter summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.letter summary::-webkit-details-marker { display: none; }
.letter summary::after { content: '▾'; margin-inline-start: 6px; font-size: 12px; transition: transform .15s; }
.letter details[open] summary { margin-bottom: 6px; }
.letter details[open] summary::after { transform: rotate(180deg); }
.people { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 0; }
.people dt { font-size: 15px; color: var(--muted); }
.people dd { margin: 0; font-weight: 600; font-size: 17px; color: var(--ink); }
.people.center { max-width: 400px; margin: 24px auto 0; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; }
.actions { margin-top: 12px; }
.link {
  border: 0;
  background: none;
  padding: 8px 0;
  min-height: 40px;
  color: var(--muted);
  font-size: 16px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- section intro ------------------------------------------------------------ */

.intro { padding-top: 6vh; }
.intro-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 0 16px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 22px;
  font-weight: 700;
}
.intro .eyebrow { color: var(--accent); }
.intro-title {
  margin: 0 0 8px;
  font-size: clamp(25px, 1.6vw + 20px, 30px);
  line-height: 1.45;
  font-weight: 700;
  text-wrap: balance;
}
:lang(ar) .intro-title { line-height: 1.65; }

/* ---- done --------------------------------------------------------------------- */

.done { text-align: center; padding-top: 8vh; }
.done .title { margin-bottom: 8px; }
.lead { color: var(--ink-2); max-width: 440px; margin: 0 auto; }
.done-mark { display: grid; place-items: center; margin-bottom: 16px; color: var(--accent); }
.done-check svg { width: 64px; height: 64px; stroke-width: 2.4; }
.done-check circle { stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw .6s var(--ease) .05s forwards; }
.done-check path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .35s var(--ease) .5s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---- footer: always-visible actions ------------------------------------------------- */

.bottom {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
}
.bottom-inner { display: flex; gap: 10px; max-width: 608px; margin: 0 auto; }
.primary, .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 54px;
  padding: 0 20px;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 600;
  transition: background-color .12s, opacity .15s, transform .1s;
}
.primary { flex: 1; border: 0; background: var(--accent); color: var(--accent-ink); }
.primary:not(:disabled):active { transform: scale(.98); }
.primary:disabled { opacity: .35; cursor: default; }
.secondary { flex: none; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); }
.secondary:active { background: var(--accent-soft); }
.primary svg, .secondary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
[dir='rtl'] .primary svg, [dir='rtl'] .secondary svg { transform: scaleX(-1); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  max-width: min(92vw, 440px);
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  font-size: 16px;
  transform: translate(-50%, 10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }
.noscript { text-align: center; color: var(--muted); }

/* ---- wider screens: the form sits on a card ------------------------------------------ */

@media (min-width: 720px) {
  body { background: var(--page); }
  .top { border-bottom: 0; }
  .top-row { height: 64px; }
  .brand { font-size: 15px; }
  .stage {
    margin: 32px auto;
    padding: 36px 40px 32px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    align-self: start;
  }
  .screen.leaving { inset: 36px 40px auto; }
  .bottom { background: var(--page); border-top: 0; padding-top: 0; }
  .bottom-inner { max-width: 640px; padding: 0 0 8px; }
  .primary { flex: none; min-width: 180px; margin-inline-start: auto; }
  .q { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}
