/* Mister Saudi — public feedback form
   Palette is taken straight from the logo PDF (CMYK → sRGB). */
:root {
  --qirmizi: #a72c31;   /* brand crimson */
  --henna: #7a1f24;     /* pressed / deep text on cream */
  --cream: #e5d1a2;     /* brand cream */
  --rice: #fbf5e8;      /* page sheet */
  --qahwa: #2e1f1a;     /* body text */
  --muted: #6f5a4b;
  --line: #e2d2b0;
  --tint: #f6e9e2;      /* crimson at ~8% on rice */
  --ok: #3d6b4f;

  --display: "Reem Kufi", "Almarai", system-ui, sans-serif;
  --text: "Almarai", system-ui, "Segoe UI", Tahoma, sans-serif;
  --focus: 0 0 0 3px var(--rice), 0 0 0 5px var(--qirmizi);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--rice);
  color: var(--qahwa);
  font: 400 17px/1.75 var(--text);
  display: flex;
  flex-direction: column;
}

img, svg { display: block; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- hero */
.hero {
  background: var(--qirmizi);
  color: var(--cream);
  text-align: center;
  padding: max(40px, env(safe-area-inset-top)) 20px 30px;
}
.hero-logo {
  width: min(196px, 52vw);
  height: auto;
  margin: 0 auto 26px;
}
.hero-title {
  font: 600 clamp(27px, 7.4vw, 40px) / 1.35 var(--display);
  margin: 0 auto 8px;
  max-width: 16em;
  text-wrap: balance;
}
.hero-lede {
  margin: 0 auto;
  max-width: 30em;
  color: #f1e3c3;
  font-size: 16px;
  text-wrap: pretty;
}

/* The woven hem: a Sadu-style band of stepped diamonds, drawn on the same
   pixel grid idea as the star inside the logo mark. */
.hem {
  height: 22px;
  background-color: var(--qirmizi);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 11' shape-rendering='crispEdges'%3E%3Cg fill='%23E5D1A2'%3E%3Crect y='0' width='12' height='1'/%3E%3Crect x='5' y='2' width='2' height='1'/%3E%3Crect x='3' y='3' width='6' height='1'/%3E%3Crect x='1' y='4' width='4' height='3'/%3E%3Crect x='7' y='4' width='4' height='3'/%3E%3Crect x='5' y='4' width='2' height='1'/%3E%3Crect x='5' y='6' width='2' height='1'/%3E%3Crect x='3' y='7' width='6' height='1'/%3E%3Crect x='5' y='8' width='2' height='1'/%3E%3Crect y='10' width='12' height='1'/%3E%3Crect x='0' y='5' width='0.5' height='1'/%3E%3Crect x='11.5' y='5' width='0.5' height='1'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 24px 22px;
  background-repeat: repeat-x;
  background-position: center;
  image-rendering: pixelated;
  border-bottom: 6px solid var(--henna);
}

/* ---------------------------------------------------------------- sheet */
.sheet {
  flex: 1;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 30px 18px 40px;
}

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

.q { margin: 0 0 30px; }
.q-title {
  display: block;
  padding: 0;
  margin: 0 0 12px;
  font-weight: 800;
  font-size: 18px;
  line-height: 1.5;
  color: var(--qahwa);
}
.opt {
  font-weight: 400;
  font-size: 14px;
  color: var(--muted);
  margin-inline-start: 6px;
}
.q-hint { margin: -6px 0 14px; color: var(--muted); font-size: 15px; }

/* visually hidden native inputs, still focusable */
.kind input,
.chip input,
.seg input,
.star input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

/* kind tiles */
.kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kind { position: relative; cursor: pointer; }
.kind-face {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 118px;
  padding: 20px 16px 16px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fffdf7;
  transition: background-color .18s, border-color .18s, color .18s;
}
.kind-face b { font: 700 24px/1.3 var(--display); }
.kind-face small { font-size: 14px; line-height: 1.5; color: var(--muted); transition: color .18s; }
.kind-star {
  position: absolute;
  inset-inline-end: 14px;
  top: 14px;
  width: 22px;
  height: 21px;
  fill: var(--line);
  transition: fill .18s, transform .3s;
}
.kind:hover .kind-face { border-color: #cfb98a; }
.kind input:checked + .kind-face {
  background: var(--qirmizi);
  border-color: var(--qirmizi);
  color: var(--cream);
}
.kind input:checked + .kind-face small { color: #f1e3c3; }
.kind input:checked + .kind-face .kind-star { fill: var(--cream); transform: rotate(45deg); }
.kind input:focus-visible + .kind-face { box-shadow: var(--focus); }

.rest { animation: unfold .35s ease-out both; }
@keyframes unfold { from { opacity: 0; transform: translateY(8px); } }

/* category chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; cursor: pointer; }
.chip span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 16px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fffdf7;
  font-size: 16px;
  line-height: 1.4;
  transition: background-color .15s, border-color .15s, color .15s;
}
.chip:hover span { border-color: #cfb98a; }
.chip input:checked + span {
  border-color: var(--qirmizi);
  background: var(--tint);
  color: var(--henna);
  font-weight: 700;
}
.chip input:focus-visible + span { box-shadow: var(--focus); }

/* visit type segmented control */
.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fffdf7;
  padding: 4px;
  gap: 4px;
}
.seg label { position: relative; cursor: pointer; }
.seg span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 9px;
  font-size: 16px;
  transition: background-color .15s, color .15s;
}
.seg input:checked + span { background: var(--qahwa); color: var(--rice); font-weight: 700; }
.seg input:focus-visible + span { box-shadow: var(--focus); }

/* text inputs */
textarea,
.field input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fffdf7;
  padding: 12px 14px;
  font-size: 17px;
  line-height: 1.7;
  transition: border-color .15s;
}
textarea { resize: vertical; min-height: 140px; }
textarea::placeholder,
.field input::placeholder { color: #a8957f; }
textarea:hover,
.field input:hover { border-color: #cfb98a; }
textarea:focus,
.field input:focus { outline: none; border-color: var(--qirmizi); box-shadow: 0 0 0 3px rgba(167, 44, 49, .14); }
[aria-invalid="true"] { border-color: var(--qirmizi) !important; }

.field-foot { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-top: 6px; }
.count { margin-inline-start: auto; direction: ltr; unicode-bidi: isolate; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.field-error { margin: 6px 0 0; color: var(--qirmizi); font-size: 14px; font-weight: 700; }
.field-foot .field-error { margin: 0; }

.fields { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 15px; font-weight: 700; }
.field input[dir="ltr"] { text-align: right; }
.field input[dir="ltr"]:focus,
.field input[dir="ltr"]:not(:placeholder-shown) { text-align: left; }

/* star rating — the logo's own eight-petal star */
.stars { display: flex; gap: 6px; direction: rtl; }
.star { position: relative; cursor: pointer; padding: 4px; border-radius: 10px; }
.star svg {
  width: 42px;
  height: 40px;
  fill: var(--line);
  transition: fill .15s, transform .2s;
}
.star.on svg { fill: var(--qirmizi); }
.star:hover svg { transform: scale(1.08); }
.star input:focus-visible ~ svg { outline: 3px solid var(--qirmizi); outline-offset: 3px; border-radius: 4px; }
.star-label { margin: 4px 0 0; min-height: 1.75em; font-size: 15px; font-weight: 700; color: var(--henna); }

/* honeypot */
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

#turnstile:not(:empty) { margin: 0 0 18px; }

.form-error {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--tint);
  color: var(--henna);
  font-weight: 700;
  font-size: 15px;
  border-inline-start: 4px solid var(--qirmizi);
}

.send {
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 14px;
  background: var(--qirmizi);
  color: var(--cream);
  font: 700 19px/1 var(--text);
  cursor: pointer;
  transition: background-color .15s, transform .1s;
}
.send:hover { background: var(--henna); }
.send:active { transform: translateY(1px); }
.send:focus-visible { outline: none; box-shadow: var(--focus); }
.send[disabled] { opacity: .75; cursor: progress; }

.fine { margin: 12px 0 0; text-align: center; font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- done */
.done { text-align: center; padding: 18px 0 10px; outline: none; }
.done-star {
  width: 74px;
  height: 71px;
  margin: 0 auto 18px;
  fill: var(--qirmizi);
  animation: settle .7s cubic-bezier(.2, .8, .2, 1.2) both;
}
@keyframes settle { from { transform: rotate(-135deg) scale(.4); opacity: 0; } }
.done h2 { font: 600 32px/1.35 var(--display); margin: 0 0 6px; color: var(--henna); }
.done-text { margin: 0 auto 22px; max-width: 26em; }
.ref-box {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: 0 auto 12px;
  max-width: 320px;
  padding: 16px;
  border: 2px dashed var(--cream);
  border-radius: 16px;
  background: #fffdf7;
}
.ref-box span { font-size: 14px; color: var(--muted); }
.ref-box strong { font: 700 28px/1.2 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .06em; color: var(--qahwa); }
.ref-copy {
  margin-top: 4px;
  border: 0;
  background: none;
  color: var(--qirmizi);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
}
.ref-copy:focus-visible { outline: none; box-shadow: var(--focus); }
.done-hint { margin: 0 0 26px; font-size: 14px; color: var(--muted); }
.again {
  min-height: 50px;
  padding: 0 22px;
  border: 1.5px solid var(--qahwa);
  border-radius: 12px;
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}
.again:hover { background: var(--qahwa); color: var(--rice); }
.again:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------------------------------------------------------------- footer */
.foot {
  text-align: center;
  padding: 22px 16px max(26px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}
.foot p { margin: 0 0 2px; font-family: var(--display); font-size: 16px; color: var(--henna); }
.foot a { color: inherit; text-underline-offset: 3px; }

@media (min-width: 700px) {
  .hero { padding: 56px 24px 40px; }
  .hero-logo { width: 220px; }
  .sheet { padding-top: 44px; }
  .fields { grid-template-columns: 1fr 1fr; }
  .fields .field:first-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
