:root {
  --page: #070a12;
  --surface: rgba(16, 21, 36, 0.82);
  --surface-solid: #101524;
  --text: #f5f5ff;
  --muted: #969db3;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #7c4dff;
  --accent-2: #26c6ff;
  --radius: 21px;
  --page-width: 680px;
  --banner-height: 190px;
  --avatar-size: 126px;
  --banner-position: 50%;
  color-scheme: dark;
}

html[data-theme="light"] {
  --page: #edf0f8;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-solid: #fff;
  --text: #151827;
  --muted: #656c80;
  --line: rgba(21, 24, 39, 0.1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
/* لا تعرض الهيكل الافتراضي قبل توفر إعدادات الموقع. */
html[data-page-state="loading"] .page-shell,
html[data-page-state="loading"] .page-glow { visibility: hidden; }
html[data-page-state="error"] :is(.banner, .avatar-wrap, .links-list, .socials) { display: none; }
html[data-page-state] :is(.profile, .link-card, .footer) { animation: none; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: radial-gradient(circle at 50% -10%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 32rem), var(--page);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  line-height: 1.6;
  transition: color 200ms ease, background-color 200ms ease;
}
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.page-glow { position: fixed; z-index: -1; width: 20rem; height: 20rem; border-radius: 50%; filter: blur(100px); opacity: .16; pointer-events: none; }
.page-glow--one { top: 18%; right: -10rem; background: var(--accent); }
.page-glow--two { bottom: 3%; left: -10rem; background: var(--accent-2); }
.page-shell { width: min(calc(100% - 28px), var(--page-width)); margin-inline: auto; padding: 24px 0 34px; }

.profile { position: relative; padding-bottom: 10px; text-align: center; animation: enter 600ms ease both; }
.banner { position: relative; height: var(--banner-height); overflow: hidden; background: radial-gradient(circle at 78% 24%, color-mix(in srgb, var(--accent) 72%, transparent), transparent 24%), radial-gradient(circle at 24% 80%, color-mix(in srgb, var(--accent-2) 58%, transparent), transparent 30%), linear-gradient(135deg, #080b1e, #15113b 50%, #07162d); border-radius: calc(var(--radius) + 7px); box-shadow: 0 20px 65px rgba(0, 0, 0, .32), inset 0 0 35px color-mix(in srgb, var(--accent) 11%, transparent); }
.banner::before { position: absolute; inset: 0; z-index: 1; content: ""; opacity: .38; background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px); background-size: 36px 36px; mask-image: linear-gradient(to bottom, #000, transparent); }
.banner img { position: absolute; inset: 0; width: 100%; height: 100%; display: none; object-fit: cover; object-position: center var(--banner-position); }
.banner img.has-image { display: block; }
.banner-shine { position: absolute; z-index: 2; inset: auto 0 0; height: 45%; background: linear-gradient(to top, color-mix(in srgb, var(--page) 68%, transparent), transparent); }

.avatar-wrap { position: relative; z-index: 4; display: inline-flex; width: var(--avatar-size); height: var(--avatar-size); margin-top: calc(var(--avatar-size) / -2); margin-bottom: 13px; }
.avatar { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: cover; background: var(--surface-solid); border-radius: 50%; }
h1 { margin: 0; font-size: clamp(1.8rem, 6vw, 2.35rem); line-height: 1.25; letter-spacing: -.035em; }
.bio { max-width: 35rem; margin: 9px auto 0; color: var(--muted); font-size: 1rem; line-height: 1.8; white-space: pre-line; }
.bio:empty { display: none; }

.links-list { display: grid; gap: 13px; margin-top: 20px; }
.link-card { display: grid; grid-template-columns: 58px 1fr 34px; gap: 14px; align-items: center; min-height: 86px; padding: 13px 15px; overflow: hidden; color: var(--text); text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 35px rgba(0, 0, 0, .14); backdrop-filter: blur(16px); transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease; animation: enter 550ms ease both; }
.link-card--no-image { grid-template-columns: 1fr 34px; }
.link-card:hover { transform: translateY(-3px) scale(1.008); background: color-mix(in srgb, var(--surface-solid) 92%, transparent); border-color: color-mix(in srgb, var(--accent) 62%, transparent); box-shadow: 0 16px 45px color-mix(in srgb, var(--accent) 17%, rgba(0,0,0,.2)); }
.link-card:active { transform: scale(.985); }
.link-card__media { display: grid; width: 58px; height: 58px; overflow: hidden; background: transparent; border-radius: 17px; place-items: center; }
.link-card__media img { width: 100%; height: 100%; object-fit: contain; }
.link-card__copy { min-width: 0; }
.link-card__copy strong, .link-card__copy small { display: block; }
.link-card__copy strong { margin-bottom: 1px; font-size: 1rem; font-weight: 750; }
.link-card__copy small { overflow: hidden; color: var(--muted); font-size: .88rem; text-overflow: ellipsis; white-space: nowrap; }
.link-card__action { display: grid; width: 34px; height: 34px; color: var(--muted); border-radius: 50%; place-items: center; transition: transform 180ms ease, color 180ms ease, background-color 180ms ease; }
.link-card__action svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.link-card:hover .link-card__action { color: var(--accent-2); background: color-mix(in srgb, var(--accent) 15%, transparent); transform: translateX(-3px); }

.footer { padding: 30px 0 0; text-align: center; animation: enter 600ms 220ms ease both; }
.footer-credit { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 5px; margin: 24px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.8; }
.footer-heart { display: block; width: 14px; height: 14px; flex-shrink: 0; }
.socials { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.socials a { display: grid; min-width: 45px; height: 45px; padding: 0 11px; color: var(--muted); text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; place-items: center; font-size: .78rem; font-weight: 800; transition: color 180ms ease, transform 180ms ease, border-color 180ms ease; }
.socials a:hover { color: var(--accent-2); transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.link-card:focus-visible, .socials a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 3px; }
@keyframes enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 520px) {
  .page-shell { width: min(calc(100% - 20px), var(--page-width)); padding-top: 16px; }
  .banner { border-radius: 22px; }
  .link-card { grid-template-columns: 52px 1fr 28px; gap: 11px; min-height: 80px; padding: 12px; border-radius: min(var(--radius), 20px); }
  .link-card__media { width: 52px; height: 52px; border-radius: 15px; }
  .link-card--no-image { grid-template-columns: 1fr 28px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
