/* موقع تيلز: الصفحة الرئيسية والصفحات القانونية وصفحات الروابط (site/lib/share.mjs). */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface2: #f2f2f3;
  --line: #e5e5e7;
  --text: #18191b;
  --text2: #3c3d41;
  --muted: #85868c;
  --accent: #18191b;
  --accent-ink: #ffffff;
  --link: #1d6fe0;
  --verified: #1d9bf0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
  --bar: rgba(255, 255, 255, .86);
  --scrim: rgba(0, 0, 0, .28);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #121214;
    --surface2: #1c1c1f;
    --line: #26262a;
    --text: #f5f5f5;
    --text2: #d4d4d8;
    --muted: #8e8e96;
    --accent: #f5f5f5;
    --accent-ink: #000000;
    --link: #5aa8ff;
    --shadow: none;
    --bar: rgba(10, 10, 12, .86);
    --scrim: rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Arabic", "Segoe UI", "Noto Sans Arabic", Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; }

.wrap { width: 100%; max-width: 600px; margin: 0 auto; padding: 0 20px; flex: 1; }

/* ---- الرأس ---- */
.top { width: 100%; max-width: 600px; margin: 0 auto; padding: 18px 20px 6px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 18px; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; }

/* ---- الصفحة الرئيسية ---- */
.hero { text-align: center; padding: 12vh 0 40px; }
.hero .logo { width: 104px; height: 104px; margin: 0 auto 22px; }
.hero h1 { font-size: 40px; line-height: 1.2; margin: 0; letter-spacing: -.5px; }
.hero .latin { color: var(--muted); font-size: 15px; margin: 4px 0 22px; letter-spacing: .5px; }
.hero p.lead { font-size: 18px; color: var(--text2); margin: 0 auto 30px; max-width: 30em; }

/* زر App Store (شكل الشارة: أسود بحد رمادي). */
.store {
  display: inline-flex; align-items: center; gap: 10px;
  background: #000; color: #fff; border: 1px solid #a6a6a6; border-radius: 12px;
  padding: 8px 18px 8px 16px; min-height: 52px;
}
.store:hover { text-decoration: none; opacity: .9; }
.store svg { width: 24px; height: 24px; flex: none; fill: #fff; }
.store .l { display: flex; flex-direction: column; line-height: 1.15; text-align: start; }
.store .l small { font-size: 11px; opacity: .9; }
.store .l b { font-size: 20px; font-weight: 600; letter-spacing: -.2px; }

/* ---- التذييل ---- */
footer { color: var(--muted); font-size: 14px; text-align: center; padding: 28px 20px 32px; }
footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 22px; margin-bottom: 10px; }
footer nav a { color: var(--text2); }
body.share footer { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }

/* ---- الصفحات القانونية ---- */
.doc { padding: 20px 0 10px; }
.doc h1 { font-size: 30px; line-height: 1.3; margin: 10px 0 4px; }
.doc .date { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.doc h2 { font-size: 20px; margin: 30px 0 8px; }
.doc h3 { font-size: 17px; margin: 20px 0 6px; }
.doc p, .doc li { color: var(--text2); }
.doc p { margin: 0 0 12px; }
.doc ul { margin: 0 0 12px; padding-inline-start: 22px; }
.doc li { margin: 4px 0; }
.doc strong { color: var(--text); }

/* ---- صفحات الروابط ---- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); padding: 18px; margin: 14px 0 16px;
}
.who { display: flex; align-items: center; gap: 12px; }
.av {
  width: 46px; height: 46px; border-radius: 50%; flex: none; object-fit: cover;
  background: var(--surface2); color: var(--text2); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px;
}
.av.big { width: 88px; height: 88px; font-size: 34px; margin: 4px auto 12px; }
.names { min-width: 0; }
.name { display: flex; align-items: center; gap: 5px; font-weight: 700; font-size: 16px; line-height: 1.35; }
.name bdi { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.handle { color: var(--muted); font-size: 14px; line-height: 1.4; }
.badge { width: 18px; height: 18px; flex: none; }
.badge .bg { fill: var(--verified); }
.badge .ck { stroke: #fff; }
.badge.white .bg { fill: var(--text); }
.badge.white .ck { stroke: var(--bg); }
.ctx { color: var(--muted); font-size: 14px; margin: 12px 0 -4px; }
.text { margin: 12px 0 0; font-size: 17px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.more { color: var(--muted); white-space: nowrap; }
.media {
  position: relative; display: block; margin-top: 14px; border-radius: 14px; overflow: hidden;
  background: var(--surface2); aspect-ratio: 1 / 1; max-height: 460px; width: 100%;
}
.media.tall { aspect-ratio: 4 / 5; }
.media img { width: 100%; height: 100%; object-fit: cover; }
.media:hover { text-decoration: none; }
.media .play {
  position: absolute; inset: 0; margin: auto; width: 64px; height: 64px; border-radius: 50%;
  background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center;
}
.media .play svg { width: 26px; height: 26px; fill: #fff; margin-inline-start: 3px; }
.media .count, .media .hint {
  position: absolute; background: rgba(0, 0, 0, .58); color: #fff; font-size: 13px; line-height: 1;
  border-radius: 999px; padding: 7px 11px;
}
.media .count { top: 10px; inset-inline-start: 10px; display: flex; align-items: center; gap: 5px; }
.media .count svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 2; }
.media .hint { bottom: 10px; inset-inline-end: 10px; }
.meta { color: var(--muted); font-size: 14px; margin-top: 12px; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 14px; margin-top: 8px; }
.stats span { display: inline-flex; align-items: center; gap: 5px; }
.stats svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stats b { color: var(--text); font-weight: 600; }
.profile { text-align: center; }
.profile .name { justify-content: center; font-size: 20px; }
.bio { margin: 12px 0 0; color: var(--text2); white-space: pre-wrap; overflow-wrap: anywhere; }
.profile .stats { justify-content: center; margin-top: 14px; }
.lock { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; color: var(--muted); font-size: 15px; }
.lock svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.tagcard { text-align: center; padding: 30px 18px; }
.hash { font-size: 30px; font-weight: 800; overflow-wrap: anywhere; line-height: 1.4; }
.empty { text-align: center; padding: 34px 22px; }
.empty .mark { width: 56px; height: 56px; margin: 0 auto 14px; }
.empty h1 { font-size: 20px; margin: 0 0 6px; }
.empty p { color: var(--muted); margin: 0; }
.actions { display: flex; justify-content: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 22px;
  border-radius: 999px; font-weight: 600; font-size: 16px; color: var(--text); background: var(--surface2);
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }

/* شريط التحميل أسفل صفحات الروابط. */
.bar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 5;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bar); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  display: flex; justify-content: center;
}
.bar a {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; max-width: 420px;
  min-height: 50px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px;
}
.bar a:hover { text-decoration: none; opacity: .92; }
.bar svg { width: 20px; height: 20px; fill: currentColor; }

/* «يُفتح في التطبيق» عند الضغط على الصورة (بدون سكربت: :target). */
.sheet { display: none; }
.sheet:target { display: flex; position: fixed; inset: 0; z-index: 10; align-items: flex-end; justify-content: center; }
.sheet .scrim { position: absolute; inset: 0; background: var(--scrim); }
.sheet .panel {
  position: relative; width: 100%; max-width: 480px; background: var(--surface); border-radius: 22px 22px 0 0;
  padding: 24px 20px calc(20px + env(safe-area-inset-bottom)); text-align: center; display: flex; flex-direction: column; gap: 10px;
}
.sheet .panel img { width: 52px; height: 52px; margin: 0 auto 4px; }
.sheet h2 { font-size: 19px; margin: 0; }
.sheet p { color: var(--muted); margin: 0 0 8px; }
.sheet .btn { width: 100%; }

@media (min-width: 640px) {
  .sheet:target { align-items: center; }
  .sheet .panel { border-radius: 22px; }
}
