المكوّنات · شريط شفّاف فوق صورة
شريط شفّاف فوق صورة
شفّاف على الغلاف ويكتسب خلفية عند تجاوزه
7 تصاميم من هذه العائلة
<div class="ap apim"><div class="ph">
<div class="sb"><span class="tm num"></span>
<span class="r" aria-hidden="true"><span>▲</span><span>◗</span><span class="bt num"></span></span></div>
<header class="bar">
<button class="ic tap" aria-label="رجوع">‹</button>
<span class="ttl" data-ar="العُلا" data-en="AlUla">العُلا</span>
<button class="ic tap" aria-label="مشاركة">↗</button>
</header>
<div class="body">
<div class="cover"><div class="cap"><b data-ar="العُلا" data-en="AlUla">العُلا</b>
<span data-ar="المدينة القديمة · 3 ليالٍ" data-en="Old town · 3 nights">المدينة القديمة · 3 ليالٍ</span></div></div>
<div class="cnt">
<div class="pk"><b class="pr num"></b>
<span data-ar="للشخص · شامل الإقامة" data-en="per person · stay included">للشخص · شامل الإقامة</span></div>
<ul class="ft"></ul>
</div>
</div>
<div class="safe"></div>
</div></div>
/* pt-scoped */
/* appbar-immersive — تطبيق سفر */
.apim{width:100%;height:100%;display:flex;align-items:center;
justify-content:center;padding:6px;font-size:10px;color:var(--pt-text-secondary);
overflow:hidden}
.apim .ph{position:relative;width:198px;height:100%;max-height:224px;display:flex;
flex-direction:column;overflow:hidden;background:var(--pt-bg-base);
border:1px solid var(--pt-border-default);border-radius:20px;
box-shadow:var(--pt-shadow-3)}
/* شريط الحالة — ليس تزيينًا: يثبت أعلى الشاشة فلا يبدأ المحتوى عند الحافّة */
.apim .sb{flex:none;display:flex;align-items:center;justify-content:space-between;
padding:5px 12px 2px;font-size:7px;color:var(--pt-text-muted);
font-variant-numeric:tabular-nums}
.apim .sb .r{display:flex;gap:3px}
.apim .scr{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}
.apim .body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;
-webkit-overflow-scrolling:touch}
.apim .body::-webkit-scrollbar{width:0}
/* المنطقة الآمنة السفلية — شريط الإيماءات يأكل ما تحته */
.apim .safe{flex:none;height:9px;display:grid;place-items:center}
.apim .safe::after{content:'';width:52px;height:3px;border-radius:99px;
background:var(--pt-border-strong)}
.apim h6{margin:0;font-size:10px;color:var(--pt-text-primary);font-weight:600;line-height:1.4}
.apim p{margin:0;font-size:8px;color:var(--pt-text-muted);line-height:1.65}
.apim .num{font-variant-numeric:tabular-nums}
.apim button{font:inherit;cursor:pointer;
transition:background var(--pt-motion-duration-fast) var(--pt-motion-easing-standard),
color var(--pt-motion-duration-fast) var(--pt-motion-easing-standard),
transform var(--pt-motion-duration-fast) var(--pt-motion-easing-standard)}
.apim button:focus-visible, .apim a:focus-visible, .apim input:focus-visible{
outline:2px solid var(--pt-focus-ring);outline-offset:-1px}
/* هدف اللمس: 44 بكسلًا على الشاشات اللمسية، ومساحة نقر ممتدّة على غيرها */
@media(pointer:coarse){.apim .tap{min-width:44px;min-height:44px}
}
.apim .tap{position:relative}
.apim .tap::before{content:'';position:absolute;inset:-6px}
@media(prefers-reduced-motion:reduce){.apim *{transition:none!important;animation:none!important}
}
.apim .ph{background:var(--pt-bg-base)}
.apim .bar{position:absolute;inset-block-start:22px;inset-inline:0;z-index:3;
display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 9px;
background:transparent;
transition:background var(--pt-motion-duration-normal) var(--pt-motion-easing-standard)}
.apim.solid .bar{background:var(--pt-surface);
border-bottom:1px solid var(--pt-border-subtle);box-shadow:var(--pt-shadow-2)}
.apim .ic{width:26px;height:26px;border:0;border-radius:50%;flex:none;font-size:12px;
background:rgba(8,12,26,.42);color:#fff;backdrop-filter:blur(4px);display:grid;
place-items:center}
.apim.solid .ic{background:var(--pt-bg-inset);color:var(--pt-text-secondary);
backdrop-filter:none}
.apim .ttl{font-size:9.5px;font-weight:600;color:#fff;opacity:0;
text-shadow:0 1px 4px rgba(0,0,0,.6);
transition:opacity var(--pt-motion-duration-normal) var(--pt-motion-easing-standard)}
.apim.solid .ttl{color:var(--pt-text-primary);text-shadow:none;opacity:1}
.apim .cover{position:relative;height:104px;
background:linear-gradient(150deg,#8a5a34,#c08b4e 48%,#e5c08a)}
/* حجاب أسفل الغلاف: التباين فوق صورة مجهولة لا يُضمن، والمعيار على أسوأ بكسل */
.apim .cover::after{content:'';position:absolute;inset:0;
background:linear-gradient(0deg,rgba(6,9,20,.72) 0%,rgba(6,9,20,.08) 46%,rgba(6,9,20,.32) 100%)}
.apim .cap{position:absolute;inset-block-end:8px;inset-inline-start:12px;z-index:1;
display:flex;flex-direction:column;color:#fff}
.apim .cap b{font-size:15px;font-weight:700}
.apim .cap span{font-size:8px;opacity:.9}
.apim .cnt{padding:9px 13px}
.apim .pk{display:flex;align-items:baseline;gap:6px;padding-bottom:8px;
border-bottom:1px solid var(--pt-border-subtle)}
.apim .pr{font-size:16px;color:var(--pt-accent);font-weight:700}
.apim .pk span{font-size:7.5px;color:var(--pt-text-muted)}
.apim .ft{list-style:none;margin:8px 0 0;padding:0;display:flex;flex-direction:column;gap:5px}
.apim .ft li{display:flex;gap:6px;font-size:8.5px;color:var(--pt-text-secondary)}
.apim .ft li::before{content:'✓';color:var(--pt-accent)}
/* يعمل داخل إطار معزول — لا يعتمد على شيء خارجه */
/* pt-remount — يعاد التركيب عند تبديل اللغة */
(function () {
var host = document.querySelector('.apim');
if (!host) return;
var snapshot = host.innerHTML;
var timers = [];
var ac = null;
/* الجسم كما كتبه المولِّد. يستقبل بدائل مظلَّلة لـ root وdocument
والمؤقّتات، فينظّف نفسه دون أن يعرف أنه قابل لإعادة التركيب. */
function run(root, document, setTimeout, setInterval) {
var ar = document.documentElement.lang !== 'en';
var n = function (v, d) { return Number(v).toLocaleString('en-US', {
minimumFractionDigits: d || 0, maximumFractionDigits: d || 0 }); };
var money = function (usd, d) {
return ar ? n(usd * 3.75, d) + ' ر.س' : '$' + n(usd, d);
};
var set = function (sel, txt) {
var el = root.querySelector(sel); if (el) el.textContent = txt; return el;
};
/* الساعة بأرقام لاتينية دائمًا — قرار موحّد في المشروع كلّه */
(function clock() {
var t = root.querySelector('.tm');
if (!t) return;
function tick() {
var d = new Date();
t.textContent = String(d.getHours()).padStart(2, '0') + ':' +
String(d.getMinutes()).padStart(2, '0');
setTimeout(tick, 20000);
}
tick();
})();
var bt = root.querySelector('.bt');
if (bt) bt.textContent = '84%';
/* اهتزاز خفيف حيث يوجد — تأكيد لمسيّ لا يعتمد عليه شيء */
var buzz = function (ms) { try { if (navigator.vibrate) navigator.vibrate(ms || 8); } catch (e) {} };
set('.pr', money(640));
var FEATURES = ['إقامة في نُزل تراثي', 'جولة في الحِجر', 'إفطار يومي', 'نقل من المطار'];
root.querySelector('.ft').innerHTML = FEATURES.map(function (f) {
return '<li>' + f + '</li>';
}).join('');
var body = root.querySelector('.body');
body.addEventListener('scroll', function () {
root.classList.toggle('solid', body.scrollTop > 62);
root.querySelector('.ttl').style.opacity = body.scrollTop > 62 ? '1' : '0';
}, { passive: true });
}
function mount() {
ac = new AbortController();
var real = window.document;
/* وسيط يمرّر كل شيء إلى المستند الحقيقي، ويعلّق كل مستمع بإشارة
تُقطع عند إعادة التركيب — فلا يبقى مستمع من نسخة ماتت. */
var doc = new Proxy(real, {
get: function (t, k) {
if (k === 'addEventListener') {
return function (type, fn, opts) {
var o = (opts && typeof opts === 'object') ? Object.assign({}, opts)
: { capture: !!opts };
o.signal = ac.signal;
return t.addEventListener(type, fn, o);
};
}
var v = t[k];
return typeof v === 'function' ? v.bind(t) : v;
}
});
function track(fn) {
return function (f, ms) { var id = fn(f, ms); timers.push(id); return id; };
}
run(host, doc, track(window.setTimeout.bind(window)),
track(window.setInterval.bind(window)));
}
function unmount() {
if (ac) ac.abort();
// المعرّفان يتشاركان فضاءً واحدًا في المتصفّح، فالإلغاء المزدوج آمن
timers.forEach(function (id) { window.clearTimeout(id); window.clearInterval(id); });
timers = [];
host.innerHTML = snapshot;
}
mount();
addEventListener('pt-lang', function () { unmount(); mount(); });
})();
# Immersive Transparent Bar
**Role:** You are an Arabic-first UI designer and front-end engineer. Read the whole
specification before writing a single line, then follow it literally. If two requirements
conflict, favour usability over visual effect.
**Goal:** Immersive Transparent Bar — Transparent over the cover, gaining a surface once it scrolls past
**Why this component matters:** Over imagery, give bar text a scrim or shadow — contrast against an unknown photo cannot be guaranteed, and WCAG applies to the worst pixel, not the average one.
**Direction:** Genuine RTL — not a mirrored Latin layout. Use logical properties
(`margin-inline-start`, `padding-inline`, `inset-inline-start`, `text-align: start`),
never physical ones (`margin-left`, `left`). The layout must flip with `dir` on its own,
with no duplicated rules.
**Typography:** Cairo for Arabic, IBM Plex Sans for Latin. Arabic line-height must be
`0.18` higher than the Latin equivalent — dots, hamzas and maddas need more vertical room.
Arabic font-size runs `1.06×` the Latin size at the same optical weight.
**Numerals:** Western digits in both languages (`1,234.50`). Only the currency changes:
`ر.س` **after** the number in Arabic, `$` **before** it in English. Jordanian dinar
uses **three** decimal places, not two.
**Colors:** Dark mode — background `#0D142B` · surfaces `#211F54` · borders `#545C91` · text `#918FC2`.
Accent `#ADA9E8` must never exceed 8% of the screen area.
**Language:** Bilingual — every string carries both Arabic and English, and the layout
flips with `dir` automatically.
**States:** `default` · `hover` · `focus` · `active` · `disabled` · `loading` · `error`.
Do not design the resting state alone.
**Accessibility:** Contrast ratio at least `4.5:1`, complete keyboard navigation,
visible focus rings, and honour `prefers-reduced-motion`.
**Output:** Clean HTML and CSS in two separate files. No frameworks, no libraries,
no external dependencies.