/* «اسأل عِيان» — صفحة السؤال ومدخلها في البحث (ask.js). وحدة مستقلة: حذف هذا الملف وسطره في index.html يكفي. */
.ak-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ak-ic { width: 36px; height: 36px; flex: none; border-radius: 12px; display: grid; place-items: center; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.ak-ic svg { width: 21px; height: 21px; }

.ak-head { display: flex; gap: 14px; align-items: flex-start; margin: 2px 0 16px; }
.ak-mark { width: 52px; height: 52px; flex: none; border-radius: 16px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--plasma, var(--accent)) 80%, var(--accent))); box-shadow: 0 10px 24px -14px var(--accent); }
.ak-mark svg { width: 28px; height: 28px; }
.ak-head h1 { margin: 0 0 2px; font-size: var(--fs-h1, 26px); line-height: 1.3; letter-spacing: -.01em; }
.ak-head p { margin: 0; color: var(--ink-2); font-size: 14.5px; line-height: 1.7; }

.ak-form { position: relative; display: flex; align-items: flex-end; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 8px; box-shadow: var(--shadow); transition: border-color .2s, box-shadow .2s; }
.ak-form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.ak-form textarea { flex: 1; min-width: 0; border: 0; background: transparent; resize: none; outline: none; font-size: 16px; line-height: 1.6; padding: 8px 10px; min-height: 52px; max-height: 140px; color: var(--ink); }
.ak-form textarea, .ak-form textarea:focus { border: 0 !important; box-shadow: none !important; outline: none; background: transparent !important; border-radius: 12px; }
.ak-form textarea::placeholder { color: var(--muted); }
.ak-send { width: 48px; height: 48px; flex: none; border: 0; border-radius: 15px; cursor: pointer; display: grid; place-items: center; background: var(--ink); color: var(--bg); transition: transform .15s; }
.ak-send:active { transform: scale(.94); }
.ak-send svg { width: 22px; height: 22px; }
.ak-send:focus-visible, .ak-ref:focus-visible, .ak-src a:focus-visible, .ak-entry:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

#akOut:not(:empty) { margin-top: 18px; }

.ak-ans { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r, 18px); padding: 16px 16px 12px; box-shadow: var(--shadow); overflow: hidden; }
.ak-ans::before { content: ''; position: absolute; inset-inline: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--accent), var(--plasma, var(--accent))); }
.ak-ans.ak-none::before { background: var(--muted); opacity: .5; }
.ak-lbl { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ak-lbl h2 { margin: 0; font-size: 16px; font-weight: 800; flex: 1; line-height: 1.4; }
.ak-lbl small { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.ak-txt { font-size: 16.5px; line-height: 1.95; color: var(--ink); }
.ak-txt p { margin: 0 0 8px; }
.ak-txt ul { margin: 4px 0 8px; padding-inline-start: 20px; }
.ak-txt li { margin: 0 0 6px; }
.ak-txt li::marker { color: var(--accent); }
/* المرجع: رقم صغير ظاهرًا، ومساحة لمس أوسع منه */
.ak-ref { position: relative; display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; margin-inline: 2px; border-radius: 7px; vertical-align: 2px;
  font-size: 12px; font-weight: 800; line-height: 1; color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, var(--surface)); text-decoration: none; font-variant-numeric: tabular-nums; }
.ak-ref::after { content: ''; position: absolute; inset: -11px -6px; }
.ak-ref:hover { background: var(--accent); color: var(--accent-ink, #fff); }
.ak-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ak-acts .btn, .ak-rec .btn, .ak-ans .row-btns .btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.ak-acts .btn svg { width: 18px; height: 18px; }
.ak-foot { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.ak-why { margin: 0 0 4px; color: var(--ink-2); font-size: 14.5px; line-height: 1.8; }
.ak-ans .row-btns { margin-top: 10px; }
.ak-rec { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ak-rec .btn { display: inline-flex; align-items: center; gap: 6px; }
.ak-rec .btn svg { width: 18px; height: 18px; }
.ak-rec .btn.on { background: var(--accent-soft) !important; color: var(--accent) !important; border-color: transparent !important; }
.ak-left { text-align: center; color: var(--muted); font-size: 12.5px; margin: 12px 0 0; }

/* المراجع: صفوف بعرض الصفحة، رقم المرجع في دائرة، والصف كله رابط */
.ak-src { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r, 18px); overflow: hidden; }
.ak-ans + .ak-src { margin-top: 12px; }
.ak-src li { border-bottom: 1px solid var(--line); transition: background-color .6s; }
.ak-src li:last-child { border-bottom: 0; }
.ak-src a { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; min-height: 56px; color: var(--ink); text-decoration: none; }
.ak-src a:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.ak-n { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; color: var(--accent); border: 1.5px solid color-mix(in srgb, var(--accent) 45%, var(--line)); margin-top: 2px; font-variant-numeric: tabular-nums; }
.ak-n.ak-dot { width: 10px; height: 10px; border: 0; background: color-mix(in srgb, var(--accent) 55%, var(--line)); margin: 9px 8px 0; }
.ak-st { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ak-st b { font-size: 15px; font-weight: 700; line-height: 1.55; }
.ak-sum { font-size: 13.5px; color: var(--ink-2); line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ak-st small { color: var(--muted); font-size: 12.5px; }
.ak-src li.ak-hl { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.ak-more { margin-top: 12px; }
.ak-more summary { cursor: pointer; list-style: none; padding: 12px 4px; font-weight: 700; font-size: 14.5px; color: var(--ink-2); min-height: 44px; display: flex; align-items: center; gap: 8px; }
.ak-more summary::-webkit-details-marker { display: none; }
.ak-more summary::before { content: '+'; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 800; }
.ak-more[open] summary::before { content: '−'; }
.ak-more summary small { color: var(--muted); font-weight: 600; }

/* البداية: كيف يجيب، في ثلاث خطوات هادئة */
#akStart { margin-top: 6px; }
.ak-how { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; counter-reset: akh; }
.ak-how li { counter-increment: akh; position: relative; padding: 12px 14px; padding-inline-start: 52px; border-radius: 16px; background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px dashed color-mix(in srgb, var(--accent) 28%, var(--line)); font-size: 13.5px; line-height: 1.7; color: var(--ink-2); }
.ak-how li::before { content: counter(akh); position: absolute; inset-inline-start: 14px; top: 13px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.ak-how b { display: block; color: var(--ink); font-size: 14.5px; }
#akStart .chip { text-align: start; line-height: 1.5; padding-block: 8px; }

/* المدخل في صفحة البحث */
.ak-entry { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 60px; margin: 4px 0 14px; border-radius: 18px; color: var(--ink); text-decoration: none;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface) 70%); border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line)); }
.ak-entry > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ak-entry b { font-size: 15px; }
.ak-entry small { color: var(--ink-2); font-size: 13px; line-height: 1.55; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ak-entry > svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.ak-hint { margin-top: 0; }

/* «طيف»: زجاج خفيف وحزمة الطيف على حافة الإجابة */
:root[data-palette="tayf"][data-palette] .ak-ans, :root[data-palette="tayf"][data-palette] .ak-form { background: var(--tf-glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: 22px; box-shadow: var(--e2, none); }
:root[data-palette="tayf"][data-palette] .ak-ans::before { background: var(--tf-spec); }
:root[data-palette="tayf"][data-palette] .ak-ans.ak-none::before { background: var(--line-2); }
:root[data-palette="tayf"][data-palette] .ak-head h1, :root[data-palette="tayf"][data-palette] .ak-lbl h2 { font-family: var(--f-head); }
:root[data-palette="tayf"][data-palette] .ak-mark { background: var(--ring); }
:root[data-palette="tayf"][data-palette] .ak-src { background: var(--tf-glass); border-radius: 22px; }
:root[data-palette="tayf"][data-palette] .ak-entry { background: var(--tf-glass); border-color: var(--line-2); }
@media (prefers-reduced-motion: reduce) { .ak-src li, .ak-send, .ak-form { transition: none; } }
