/*
 * ثيمُ الصفحةِ الشخصيّة على الويب — المتغيّراتُ نفسُها التي يرسمُ بها التطبيق.
 *
 * ‏profile.php‏ يكتبُ قيمَ الوضعين في كتلةٍ مستقلّة (‏--pt-l-*‏ و‏--pt-d-*‏)،
 * وهنا يُختارُ منها ما يوافقُ وضعَ القارئ. الأوراقُ قبلَها مبنيّةٌ على لونٍ داكنٍ
 * واحد، و‏theme-light.css‏ المولَّدُ يسبقُها بمحدِّدِ ‏html[data-theme="light"]‏،
 * فكلُّ قاعدةٍ هنا تبدأُ بـ‏html‏ وتحملُ ‏.has-theme‏ لتغلبَ الاثنين بلا
 * ‏!important‏. والنصوصُ تبقى بألوانِ الموقع: الثيمُ لما حولَ الكلام.
 */
html .acf-profile-page.has-theme {
  --pt-page: var(--pt-d-page);
  --pt-surface: var(--pt-d-surface);
  --pt-line: var(--pt-d-line);
  --pt-accent: var(--pt-d-accent);
  --pt-accent2: var(--pt-d-accent2);
  --pt-ink: var(--pt-d-ink);
  --pt-on: var(--pt-d-on-accent);
  --pt-hero1: var(--pt-d-hero1);
  --pt-hero2: var(--pt-d-hero2);
  --pt-hero3: var(--pt-d-hero3);
  /* الأرضُ وما يعلوها، كالتطبيق: في الداكنِ الأرضُ أعمقُ والبطاقاتُ أفتح. */
  --pt-ground: var(--pt-d-page);
  --pt-raised: var(--pt-d-surface);
}

html[data-theme="light"] .acf-profile-page.has-theme {
  --pt-page: var(--pt-l-page);
  --pt-surface: var(--pt-l-surface);
  --pt-line: var(--pt-l-line);
  --pt-accent: var(--pt-l-accent);
  --pt-accent2: var(--pt-l-accent2);
  --pt-ink: var(--pt-l-ink);
  --pt-on: var(--pt-l-on-accent);
  --pt-hero1: var(--pt-l-hero1);
  --pt-hero2: var(--pt-l-hero2);
  --pt-hero3: var(--pt-l-hero3);
  /* وفي الفاتحِ الأرضُ سطحُ الثيمِ الملوَّن، والبطاقاتُ بأرضيّتِه الصافية. */
  --pt-ground: var(--pt-l-surface);
  --pt-raised: var(--pt-l-page);
}

/* الأرضيّة: تدرّجُ الثيمِ من أعلى الصفحةِ يذوبُ في أرضيّتِه. */
html .acf-profile-page.has-theme,
html[data-theme="light"] .acf-profile-page.has-theme {
  background:
    radial-gradient(560px 280px at 92% -70px, color-mix(in srgb, var(--pt-hero2) 34%, transparent), transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--pt-hero2) 30%, var(--pt-ground)) 0, var(--pt-ground) 520px, var(--pt-ground) 100%);
}

/* بطاقةُ الرأس: سطحُ الثيمِ وخطُّه، لا زجاجٌ داكنٌ فوقَ صفحةٍ فاتحة. */
html .acf-profile-page.has-theme .acf-profile-card,
html[data-theme="light"] .acf-profile-page.has-theme .acf-profile-card {
  border-color: var(--pt-line);
  background: var(--pt-raised);
  box-shadow: 0 18px 46px color-mix(in srgb, var(--pt-accent) 12%, transparent);
}

/* حلقةُ الصورةِ بلونَي الثيم. */
html .acf-profile-page.has-theme .acf-profile-avatar,
html[data-theme="light"] .acf-profile-page.has-theme .acf-profile-avatar {
  border-color: var(--pt-accent);
  box-shadow: 0 0 0 3px var(--pt-page), 0 0 0 5px var(--pt-accent2), 0 14px 30px rgba(0,0,0,.18);
}

/* الأزرار: سطحُ الثيم، وخطُّه. أزرارُ حالةِ الصداقةِ تبقى بألوانِ معناها. */
html .acf-profile-page.has-theme .acf-profile-action-btn:not(.is-friend-status-action):not(.is-danger):not(.is-friend-decision),
html[data-theme="light"] .acf-profile-page.has-theme .acf-profile-action-btn:not(.is-friend-status-action):not(.is-danger):not(.is-friend-decision) {
  border-color: var(--pt-line);
  background: color-mix(in srgb, var(--pt-raised) 70%, var(--pt-ground));
}

/* شريطُ الألسنة واللسانُ المختار. */
html .acf-profile-page.has-theme .acf-profile-tabs,
html[data-theme="light"] .acf-profile-page.has-theme .acf-profile-tabs {
  border-color: var(--pt-line);
  background: var(--pt-raised);
}

html .acf-profile-page.has-theme .acf-profile-tabs button.is-active,
html[data-theme="light"] .acf-profile-page.has-theme .acf-profile-tabs button.is-active {
  color: var(--pt-on);
  background: linear-gradient(135deg, var(--pt-accent), var(--pt-accent2));
  box-shadow: 0 10px 22px color-mix(in srgb, var(--pt-accent) 22%, transparent);
}

html .acf-profile-page.has-theme .acf-profile-tabs button.is-active .acf-profile-tab-svg,
html[data-theme="light"] .acf-profile-page.has-theme .acf-profile-tabs button.is-active .acf-profile-tab-svg {
  filter: none;
}

/* بطاقاتُ المنشوراتِ في الصفحة: خطُّ الثيم. */
html .acf-profile-page.has-theme .acf-feed-card,
html[data-theme="light"] .acf-profile-page.has-theme .acf-feed-card {
  border-color: var(--pt-line);
  background: var(--pt-raised);
}

/* «لا منشورات بعد»: بلا إطارٍ متقطّع. */
html .acf-profile-page.has-theme .acf-profile-empty,
html[data-theme="light"] .acf-profile-page.has-theme .acf-profile-empty {
  border: 0;
  background: transparent;
}

/* الأرقامُ بلونِ الثيمِ المقروء. */
html .acf-profile-page.has-theme .acf-profile-pill,
html[data-theme="light"] .acf-profile-page.has-theme .acf-profile-pill {
  color: var(--pt-ink);
}

/* ── اختيارُ الثيمِ في إعداداتِ الحساب: بلاطاتٌ بوضعِ القارئ ── */
.acf-theme-tile {
  --t-page: var(--td-page); --t-surface: var(--td-surface); --t-line: var(--td-line);
  --t-accent: var(--td-accent); --t-accent2: var(--td-accent2); --t-ink: var(--td-ink);
  --t-h1: var(--td-h1); --t-h2: var(--td-h2);
  --t-ground: var(--td-page); --t-raised: var(--td-surface);
}
html[data-theme="light"] .acf-theme-tile {
  --t-page: var(--tl-page); --t-surface: var(--tl-surface); --t-line: var(--tl-line);
  --t-accent: var(--tl-accent); --t-accent2: var(--tl-accent2); --t-ink: var(--tl-ink);
  --t-h1: var(--tl-h1); --t-h2: var(--tl-h2);
  --t-ground: var(--tl-surface); --t-raised: var(--tl-page);
}
.acf-theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.acf-theme-tile { display: grid; gap: 6px; justify-items: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.acf-theme-tile input { position: absolute; opacity: 0; pointer-events: none; }
.acf-theme-mini {
  position: relative; display: block; width: 100%; height: 118px; overflow: hidden;
  border-radius: 18px; border: 1.5px solid var(--t-line); background: var(--t-ground);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.acf-theme-tile:active .acf-theme-mini { transform: scale(.97); }
.acf-theme-mini i { position: absolute; display: block; }
.acf-theme-mini .h { inset: 0 0 auto 0; height: 42px; background: linear-gradient(135deg, var(--t-h1), var(--t-h2)); }
.acf-theme-mini .a { top: 24px; inset-inline-start: 10px; width: 34px; height: 34px; border-radius: 12px;
  background: var(--t-raised); border: 2px solid var(--t-ground); box-shadow: 0 0 0 2px var(--t-accent); }
.acf-theme-mini .l { top: 66px; inset-inline-start: 10px; width: 62%; height: 7px; border-radius: 4px; background: var(--t-raised); }
.acf-theme-mini .s { top: 80px; inset-inline: 10px; height: 14px; border-radius: 6px; background: var(--t-raised);
  box-shadow: inset 16px 0 0 -10px var(--t-ink); }
.acf-theme-mini .b { bottom: 8px; inset-inline: 10px; height: 10px; border-radius: 5px; background: var(--t-accent); }
.acf-theme-name { font-size: 12.5px; font-weight: 600; color: var(--muted, #9aa7bd); }
.acf-theme-tile:has(input:checked) .acf-theme-mini { border: 2.5px solid var(--t-accent); box-shadow: 0 8px 20px color-mix(in srgb, var(--t-accent) 24%, transparent); }
.acf-theme-tile:has(input:checked) .acf-theme-name { color: var(--text, #f8fafc); font-weight: 700; }
html[data-theme="light"] .acf-theme-tile:has(input:checked) .acf-theme-name { color: #101214; }
.acf-theme-tile input:focus-visible + .acf-theme-mini { outline: 2px solid var(--t-accent); outline-offset: 2px; }
