/* ==========================================================================
   الموقع الشخصي — ملف التنسيقات
   ترتيب الملف:
   1) المتغيرات والأساسيات
   2) عناصر مشتركة (الحاوية، الأزرار، العناوين)
   3) الترويسة
   4) الواجهة الرئيسية
   5) النبذة الشخصية
   6) المهارات
   7) وسائل التواصل
   8) التذييل
   9) الحركات
   10) التجاوب
   ========================================================================== */

/* ============================================================
   1) المتغيرات — عدّل الألوان والقياسات من هنا فقط
   ============================================================ */
:root {
  /* الألوان */
  --bg: #f8f7f3;
  --surface: #ffffff;
  --surface-alt: #f1f0ea;
  --ink: #1b2a2c;
  --ink-soft: #43565a;
  --muted: #6d7c7e;
  --accent: #2f6f68;
  --accent-dark: #235751;
  --accent-soft: #dceae6;
  --sand: #e9e0cf;
  --line: #e3e1d9;

  /* الخطوط */
  --font: "Cairo", "Segoe UI", Tahoma, sans-serif;

  /* القياسات */
  --container: 1160px;
  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 28px;
  --header-h: 74px;

  /* الظلال */
  --shadow-sm: 0 2px 8px rgba(27, 42, 44, 0.05);
  --shadow: 0 18px 40px -20px rgba(27, 42, 44, 0.28);
  --shadow-lg: 0 30px 70px -35px rgba(27, 42, 44, 0.35);
}

/* ============================================================
   الأساسيات
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.8;
  color: var(--ink-soft);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

::selection {
  background: var(--accent);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* مساحة للترويسة الثابتة عند التنقل بالروابط */
section[id] {
  scroll-margin-top: calc(var(--header-h) + 16px);
}

/* ============================================================
   2) عناصر مشتركة
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

.section {
  padding-block: clamp(4rem, 9vw, 7rem);
}

.section-alt {
  background: var(--surface-alt);
}

/* عنوان القسم */
.section-head {
  margin-bottom: 2.5rem;
}

.section-head-center {
  max-width: 620px;
  margin-inline: auto;
  text-align: center;
}

.section-label {
  display: inline-block;
  margin-bottom: 0.6rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.section-label::before {
  content: "";
  display: inline-block;
  width: 22px;
  height: 2px;
  margin-inline-end: 0.5rem;
  vertical-align: middle;
  background: var(--accent);
  border-radius: 2px;
}

.section-title {
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
}

.section-sub {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 1.02rem;
}

/* الأزرار */
.btn {
  --btn-bg: var(--accent);
  --btn-fg: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.9rem;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.25s ease, background-color 0.25s ease,
    box-shadow 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.btn-primary {
  box-shadow: 0 12px 26px -14px rgba(47, 111, 104, 0.85);
}

.btn-primary:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 18px 32px -16px rgba(47, 111, 104, 0.9);
}

.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  border-color: var(--line);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

/* ============================================================
   3) الترويسة
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(248, 247, 243, 0.82);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 0.3s ease;
}

@supports (backdrop-filter: blur(1px)) {
  .site-header {
    border-bottom-color: var(--line);
  }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 100%;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  font-size: 1.05rem;
  color: #fff;
  background: var(--accent);
  border-radius: 12px;
  transition: transform 0.3s ease;
}

.logo:hover .logo-mark {
  transform: rotate(-6deg);
}

.logo-text {
  font-size: 1.02rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2.5vw, 2rem);
  overflow-x: auto;
  scrollbar-width: none;
}

.main-nav::-webkit-scrollbar {
  display: none;
}

.main-nav a {
  position: relative;
  padding-block: 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: color 0.25s ease;
}

.main-nav a::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.main-nav a:hover {
  color: var(--accent);
}

.main-nav a:hover::after {
  transform: scaleX(1);
}

/* ============================================================
   4) الواجهة الرئيسية
   ============================================================ */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3.5rem, 8vw, 6.5rem) clamp(4rem, 9vw, 7.5rem);
}

/* هالة لونية في الخلفية */
.hero-glow {
  position: absolute;
  inset-inline-start: -15%;
  top: -25%;
  width: 60vw;
  height: 60vw;
  max-width: 780px;
  max-height: 780px;
  background: radial-gradient(
    circle at center,
    rgba(47, 111, 104, 0.16),
    rgba(47, 111, 104, 0) 68%
  );
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset-inline-end: -10%;
  bottom: -30%;
  width: 46vw;
  height: 46vw;
  max-width: 560px;
  max-height: 560px;
  background: radial-gradient(
    circle at center,
    rgba(233, 224, 207, 0.85),
    rgba(233, 224, 207, 0) 70%
  );
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: clamp(2.5rem, 6vw, 5rem);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem 0.35rem 0.7rem;
  margin-bottom: 1.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
}

.eyebrow .dot {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(47, 111, 104, 0.45);
  animation: pulse 2.4s ease-out infinite;
}

.hero-title {
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.25;
}

.title-accent {
  display: block;
  color: var(--accent);
}

.hero-text {
  max-width: 52ch;
  margin-top: 1.25rem;
  font-size: clamp(1rem, 1.4vw, 1.1rem);
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 2rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 2.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
}

.hero-meta li {
  font-size: 0.88rem;
  color: var(--muted);
}

.hero-meta strong {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.4;
}

/* البطاقة الشخصية في الواجهة */
.hero-visual {
  display: flex;
  justify-content: center;
}

.portrait-card {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 360px);
  aspect-ratio: 1 / 1.08;
  background: linear-gradient(160deg, #ffffff 0%, #eef4f2 55%, var(--accent-soft) 100%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* حلقة منقّطة زخرفية */
.portrait-ring {
  position: absolute;
  inset: 18px;
  border: 1px dashed rgba(47, 111, 104, 0.35);
  border-radius: calc(var(--radius-lg) - 8px);
}

.portrait-inner {
  display: grid;
  place-items: center;
  width: 55%;
  aspect-ratio: 1;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(47, 111, 104, 0.15), var(--shadow);
  animation: float 6s ease-in-out infinite;
}

.portrait-initial {
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  font-weight: 800;
  color: var(--accent);
}

.floating-tag {
  position: absolute;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(6px);
  animation: float 7s ease-in-out infinite;
}

.tag-top {
  top: 12%;
  inset-inline-start: -6%;
}

.tag-bottom {
  bottom: 12%;
  inset-inline-end: -6%;
  animation-delay: -3s;
}

/* ============================================================
   5) النبذة الشخصية
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: start;
}

.about-grid .section-head {
  margin-bottom: 0;
}

.about-body p + p {
  margin-top: 1rem;
}

.about-body p {
  color: var(--ink-soft);
}

.about-points {
  display: grid;
  gap: 0.7rem;
  margin-top: 1.75rem;
}

.about-points li {
  position: relative;
  padding-inline-start: 1.9rem;
  font-size: 0.97rem;
  color: var(--ink-soft);
}

.about-points li::before {
  content: "✓";
  position: absolute;
  inset-inline-start: 0;
  top: 0.15rem;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 50%;
}

/* ============================================================
   6) المهارات
   ============================================================ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1.25rem;
}

/* أول بطاقتين أعرض، والثلاث الباقية أصغر */
.skill-card:nth-child(-n + 2) {
  grid-column: span 3;
}

.skill-card:nth-child(n + 3) {
  grid-column: span 2;
}

.skill-card {
  position: relative;
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s ease, box-shadow 0.35s ease,
    border-color 0.35s ease;
}

.skill-card:hover {
  transform: translateY(-6px);
  border-color: rgba(47, 111, 104, 0.35);
  box-shadow: var(--shadow);
}

.skill-top {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}

.skill-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 14px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.skill-icon svg {
  width: 22px;
  height: 22px;
}

.skill-card:hover .skill-icon {
  background: var(--accent);
  color: #fff;
}

.skill-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.skill-desc {
  min-height: 2.8em;
  margin-bottom: 1.25rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.skill-bar {
  height: 6px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
}

.skill-fill {
  display: block;
  width: var(--value, 0%);
  height: 100%;
  background: linear-gradient(to left, var(--accent), #5a9e94);
  border-radius: inherit;
  transform-origin: right;
  animation: growBar 1.3s cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.skill-percent {
  display: inline-block;
  margin-top: 0.55rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
}

/* ============================================================
   7) وسائل التواصل
   ============================================================ */
.contact-card {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(2rem, 5vw, 4rem);
  padding: clamp(1.75rem, 5vw, 3.5rem);
  background: linear-gradient(150deg, #ffffff 0%, #f4f6f3 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.contact-head .section-label::before {
  display: none;
}

.contact-head .btn {
  margin-top: 1.75rem;
}

.social-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  min-width: 0;
  align-content: center;
}

.social-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: transform 0.3s ease, border-color 0.3s ease,
    box-shadow 0.3s ease, background-color 0.3s ease;
}

.social-link:hover {
  transform: translateX(-6px);
  border-color: rgba(47, 111, 104, 0.4);
  box-shadow: var(--shadow-sm);
}

.social-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 12px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.social-icon svg {
  width: 20px;
  height: 20px;
}

.social-link:hover .social-icon {
  color: #fff;
  background: var(--accent);
}

.social-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  line-height: 1.5;
}

.social-text strong {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.social-text small {
  overflow: hidden;
  max-width: 100%;
  font-size: 0.8rem;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
  text-align: right;
}

.social-arrow {
  color: var(--muted);
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease;
}

.social-link:hover .social-arrow {
  color: var(--accent);
  opacity: 1;
  transform: translateX(0);
}

/* بطاقات التواصل غير المفعّلة (بانتظار إضافة الرابط) */
.social-link.is-placeholder {
  cursor: default;
  pointer-events: none;
}

.social-link.is-placeholder .social-arrow {
  display: none;
}

/* ============================================================
   8) التذييل
   ============================================================ */
.site-footer {
  padding-block: 1.75rem;
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer-inner a {
  font-weight: 600;
  color: var(--accent);
  transition: color 0.25s ease;
}

.footer-inner a:hover {
  color: var(--accent-dark);
}

/* ============================================================
   9) الحركات
   ============================================================ */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(47, 111, 104, 0.45);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(47, 111, 104, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(47, 111, 104, 0);
  }
}

@keyframes growBar {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ظهور تدريجي لعناصر الواجهة الرئيسية عند التحميل */
.hero-content > * {
  animation: rise 0.85s cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.hero-content > :nth-child(1) { animation-delay: 0.05s; }
.hero-content > :nth-child(2) { animation-delay: 0.15s; }
.hero-content > :nth-child(3) { animation-delay: 0.25s; }
.hero-content > :nth-child(4) { animation-delay: 0.35s; }
.hero-content > :nth-child(5) { animation-delay: 0.45s; }

.hero-visual {
  animation: rise 1s cubic-bezier(0.2, 0.75, 0.25, 1) 0.3s both;
}

/* ظهور العناصر عند التمرير (في المتصفحات الداعمة) */
@supports (animation-timeline: view()) {
  .section-head,
  .about-body,
  .skill-card,
  .contact-card {
    animation: reveal linear both;
    animation-timeline: view();
    animation-range: entry 5% cover 28%;
  }
}

/* احترام تفضيل تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ============================================================
   10) التجاوب
   ============================================================ */
@media (max-width: 960px) {
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-text {
    margin-inline: auto;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-meta {
    justify-content: center;
    text-align: center;
  }

  .eyebrow {
    margin-inline: auto;
  }

  .hero-visual {
    order: -1;
  }

  .portrait-card {
    width: min(100%, 280px);
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .contact-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .skill-card:nth-child(n) {
    grid-column: span 1;
  }

  .skill-desc {
    min-height: 0;
  }
}

@media (max-width: 640px) {
  :root {
    --header-h: 66px;
  }

  .logo-text {
    display: none;
  }

  .main-nav a {
    font-size: 0.88rem;
  }

  .hero-title {
    font-size: clamp(2rem, 9vw, 2.6rem);
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .hero-meta {
    gap: 1.25rem;
    justify-content: space-between;
  }

  .hero-meta strong {
    font-size: 1.25rem;
  }

  .floating-tag {
    font-size: 0.7rem;
    padding: 0.4rem 0.75rem;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }

  .skill-card {
    padding: 1.4rem;
  }

  .social-link:hover {
    transform: none;
  }

  .social-link {
    gap: 0.75rem;
    padding: 0.85rem 0.9rem;
  }

  .social-icon {
    width: 38px;
    height: 38px;
  }

  .social-text small {
    font-size: 0.75rem;
  }

  .social-arrow {
    display: none;
  }

  .footer-inner {
    justify-content: center;
    text-align: center;
  }
}
