/* erayy.com/zellige: balbal-v2.1-zellige demo (2026-11-08). Fes blue, emerald, terracotta and gold on cream, khatam star strips. */
:root {
  --cream: #fbf6ec;
  --cream-dk: #f1e7d3;
  --card: #fffdf8;
  --fes: #0f3d5c;
  --fes-2: #16557a;
  --emerald: #1e7b5c;
  --emerald-soft: #dcefe6;
  --terra: #c0582e;
  --gold: #d4a23a;
  --ink: #1f2a33;
  --ink-soft: #55636e;
  --line: #e4d6bb;
  --radius: 14px;
  --sans: "Lato", system-ui, -apple-system, "Segoe UI", sans-serif;
  --naskh: "Noto Naskh Arabic", "Noto Kufi Arabic", "Geeza Pro", "Arial", sans-serif;
  --kufi: "Noto Kufi Arabic", "Noto Naskh Arabic", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
}
a { color: var(--fes-2); text-underline-offset: 3px; }
a:hover { color: var(--terra); }
[lang="ar"], [lang="ary"] { font-family: var(--naskh); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; z-index: 9; background: var(--card); padding: 8px 12px; border-radius: 8px; }

/* khatam (8-point star) strip */
.strip {
  height: 44px;
  background-color: var(--fes);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='132' height='44'%3E%3Cg%3E%3Crect x='11' y='11' width='22' height='22' fill='%23d4a23a'/%3E%3Crect x='11' y='11' width='22' height='22' fill='%23d4a23a' transform='rotate(45 22 22)'/%3E%3Ccircle cx='22' cy='22' r='5.5' fill='%23fbf6ec'/%3E%3Ccircle cx='22' cy='22' r='2.4' fill='%23d4a23a'/%3E%3Crect x='55' y='11' width='22' height='22' fill='%23379a78'/%3E%3Crect x='55' y='11' width='22' height='22' fill='%23379a78' transform='rotate(45 66 22)'/%3E%3Ccircle cx='66' cy='22' r='5.5' fill='%23fbf6ec'/%3E%3Ccircle cx='66' cy='22' r='2.4' fill='%23379a78'/%3E%3Crect x='99' y='11' width='22' height='22' fill='%23c0582e'/%3E%3Crect x='99' y='11' width='22' height='22' fill='%23c0582e' transform='rotate(45 110 22)'/%3E%3Ccircle cx='110' cy='22' r='5.5' fill='%23fbf6ec'/%3E%3Ccircle cx='110' cy='22' r='2.4' fill='%23c0582e'/%3E%3Cpath d='M44 18 48 22 44 26 40 22Z M88 18 92 22 88 26 84 22Z M132 18 136 22 132 26 128 22Z M0 18 4 22 0 26 -4 22Z' fill='%23efe3c8'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: center;
}

.top, .hero, main { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.top { display: flex; justify-content: space-between; align-items: center; padding-top: 18px; padding-bottom: 6px; gap: 16px; flex-wrap: wrap; }
.wordmark { font-weight: 900; color: var(--fes); text-decoration: none; letter-spacing: .01em; }
.wordmark span { color: var(--ink-soft); font-weight: 400; }
.top nav { display: flex; gap: 18px; font-size: .95rem; }

.hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-top: 30px; padding-bottom: 26px; }
.badge {
  display: inline-block; margin: 0 0 10px; padding: 3px 12px; border-radius: 999px;
  background: var(--terra); color: #fff; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
h1 { margin: 0; color: var(--fes); font-weight: 900; font-size: clamp(2.1rem, 6.2vw, 3.6rem); line-height: 1.05; letter-spacing: -.01em; overflow-wrap: anywhere; }
.lede { margin: 12px 0 10px; font-size: clamp(1.05rem, 2.4vw, 1.3rem); color: var(--ink-soft); max-width: 36em; }
.lede strong { color: var(--ink); }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.facts span { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 2px 12px; font-size: .88rem; color: var(--ink-soft); }
.hero-ar { margin: 0; font-family: var(--kufi); font-weight: 700; color: var(--terra); font-size: clamp(3.4rem, 11vw, 6.4rem); line-height: 1; flex: none; }

h2 { color: var(--fes); font-weight: 900; font-size: 1.35rem; margin: 0 0 12px; }
h2 em { font-style: normal; color: var(--terra); }

/* consent */
.consent {
  background: var(--card); border: 2px solid var(--gold); border-radius: var(--radius);
  padding: 22px 24px; margin: 6px 0 22px; box-shadow: 0 1px 0 var(--cream-dk);
}
.consent-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; }
.consent p { margin: 0 0 10px; }
.consent ul { margin: 0; padding-left: 20px; }
.consent li { margin: 4px 0; }
.consent-tr p { font-size: .95rem; color: var(--ink-soft); }
.consent-tr p[lang="ar"] { font-size: 1.05rem; line-height: 1.9; }
.agree {
  display: flex; gap: 14px; align-items: flex-start; margin-top: 16px; padding: 14px 16px;
  background: var(--emerald-soft); border-radius: 10px; cursor: pointer; border: 2px solid transparent;
}
.agree:hover { border-color: var(--emerald); }
.agree input { width: 26px; height: 26px; margin: 2px 0 0; accent-color: var(--emerald); flex: none; cursor: pointer; }
.agree strong { display: block; color: var(--emerald); font-size: 1.08rem; }
.agree span { font-size: .95rem; }
body.consented .agree { border-color: var(--emerald); }

/* demo */
.workspace { display: grid; grid-template-columns: 1fr 1.2fr; gap: 18px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.panel h2 { margin: 0; font-size: 1.15rem; display: flex; align-items: center; gap: 10px; }
.panel h2 span { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--fes); color: #fff; font-size: .9rem; }
.pill { font-size: .8rem; padding: 2px 10px; border-radius: 999px; background: var(--cream-dk); color: var(--ink-soft); white-space: nowrap; }
.voice-prompt { font-weight: 700; margin: 10px 0 2px; color: var(--ink); }
body.recording .voice-prompt { color: var(--terra); }
.try { margin: 0 0 14px; color: var(--ink-soft); font-size: .93rem; }
.try span { font-size: 1.05rem; color: var(--ink); unicode-bidi: isolate; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
button { font: inherit; cursor: pointer; border-radius: 10px; padding: 10px 18px; border: 2px solid transparent; transition: background .15s, border-color .15s, opacity .15s; }
button:disabled { opacity: .45; cursor: not-allowed; }
.primary { background: var(--fes); color: #fff; font-weight: 700; }
.primary:not(:disabled):hover { background: var(--fes-2); }
body.recording #record { background: var(--terra); }
.secondary { background: transparent; color: var(--fes); border-color: var(--fes); font-weight: 700; }
.secondary:not(:disabled):hover { background: var(--cream-dk); }
.danger { background: transparent; color: var(--terra); border-color: var(--terra); }
.danger:not(:disabled):hover, .danger.armed { background: var(--terra); color: #fff; }
.text-button { padding: 4px 10px; background: transparent; color: var(--fes-2); border-color: var(--line); font-size: .88rem; }
.limit { font-size: .83rem; color: var(--ink-soft); margin: 8px 0 12px; }
audio { width: 100%; margin: 4px 0 10px; }
.transcribe { width: 100%; }
#status { min-height: 1.6em; margin: 10px 0 0; font-size: .93rem; color: var(--ink-soft); }
#status.error, #saved-status.error { color: var(--terra); }

.transcript-text {
  min-height: 150px; padding: 14px 16px; border-radius: 10px; background: var(--cream);
  font-family: var(--naskh); font-size: 1.45rem; line-height: 2; text-align: right; overflow-wrap: anywhere;
}
.transcript-text.empty { color: var(--ink-soft); font-family: var(--sans); font-size: 1rem; text-align: left; direction: ltr; }
.transcript-text .w { cursor: pointer; border-radius: 4px; padding: 0 1px; }
.transcript-text.playing .w { opacity: .45; }
.transcript-text.playing .w.said { opacity: 1; }
.transcript-text .w.now { opacity: 1; background: var(--gold); color: var(--ink); }
.hint { font-size: .83rem; color: var(--ink-soft); margin: 8px 0 0; }
.saved { border-top: 1px dashed var(--line); margin-top: 14px; padding-top: 12px; }
.rec-id { margin: 0 0 8px; font-size: .9rem; color: var(--ink-soft); }
.rec-id code { font: 700 .92rem ui-monospace, "SFMono-Regular", Menlo, monospace; color: var(--fes); background: var(--cream-dk); padding: 2px 8px; border-radius: 6px; user-select: all; }
.fix-label { display: block; font-size: .9rem; margin-bottom: 6px; }
textarea {
  width: 100%; font: 1.25rem/1.8 var(--naskh); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); resize: vertical;
}
textarea:focus, button:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.saved-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
#saved-status { min-height: 1.4em; margin: 8px 0 0; font-size: .9rem; color: var(--emerald); }

/* results */
.results, .use { margin-top: 34px; }
.sub { margin: -4px 0 12px; color: var(--ink-soft); font-size: .93rem; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); }
table { border-collapse: collapse; width: 100%; min-width: 760px; font-variant-numeric: tabular-nums; font-size: .95rem; }
th, td { padding: 9px 10px; text-align: center; white-space: nowrap; }
thead th { background: var(--fes); color: #fff; font-weight: 700; }
thead tr.metric th { background: var(--fes-2); font-weight: 400; font-size: .85rem; }
.name { text-align: left; padding-left: 16px; }
tbody th { font-weight: 400; }
tbody tr { border-top: 1px solid var(--cream-dk); }
tbody tr:nth-child(odd):not(.ours) { background: #fbf4e6; }
tr.ours { background: var(--emerald-soft); }
tr.ours:first-child th, tr.ours:first-child td { font-weight: 900; }
tr.sub-row { background: #eef6f1; color: var(--ink-soft); }
tr.sub-row th { padding-left: 28px; }
tbody tr:nth-child(3) { border-top: 2px solid var(--gold); }
.avg, .avg-l { border-left: 3px solid var(--gold); }
.avg-r { border-right: 3px solid var(--gold); }
thead th.avg { border-right: 3px solid var(--gold); }

.use pre { background: var(--fes); color: #fff; padding: 14px 18px; border-radius: 10px; overflow-x: auto; margin: 0 0 12px; }
.use code { font: .95rem/1.6 ui-monospace, "SFMono-Regular", Menlo, monospace; }
.use p { margin: 0 0 10px; }
.feedback { color: var(--ink-soft); }

footer { margin: 40px 0 0; padding: 18px 0 30px; border-top: 1px solid var(--line); font-size: .92rem; color: var(--ink-soft); }
footer p { margin: 0; }

@media (max-width: 860px) {
  .workspace, .consent-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .top, .hero, main { padding-left: 16px; padding-right: 16px; }
  .hero { flex-direction: column-reverse; align-items: flex-start; gap: 10px; padding-top: 18px; }
  .hero-ar { font-size: 3rem; }
  .consent { padding: 18px 16px; }
  .panel { padding: 16px; }
  .actions button { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
