:root {
  --bg: #eeeae1;
  --paper: #f8f6ef;
  --ink: #11120f;
  --muted: #6c6b64;
  --red-core: #ff2323;
  --red-mid: #ff3636;
  --red-soft: #ff4444;
  --red-light: #ff5555;
  --accent: var(--red-mid);
  --blue: #405cff;
  --line: 2px solid var(--ink);
  --max: 1180px;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Cairo', sans-serif;
  font-weight: 400;
  scroll-behavior: smooth;
}

::selection { background: var(--red-soft); color: #ffffff; }

a { color: inherit; text-decoration: none; }
.wrap { width: min(var(--max), calc(100% - 28px)); margin: auto; position: relative; z-index: 2; }
.mono { font: 400 11px 'IBM Plex Mono', monospace; letter-spacing: .02em; }

/* شريط السكرول المضيء العلوي */
#scrollProgress {
  position: fixed;
  top: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--red-core), var(--red-light), #ffa502);
  width: 0%;
  z-index: 10001;
  transition: width 0.08s linear;
  box-shadow: 0 0 12px rgba(255, 54, 54, 0.8);
}

/* ظهور العناصر  بانسيابية */
.reveal-item {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  will-change: opacity, transform;
}
.reveal-item.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* الهيدر وشريط التنقل العلوي */
.top {
  position: fixed;
  z-index: 50;
  top: 13px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1150px, calc(100% - 22px));
  border: var(--line);
  background: rgba(238, 234, 225, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  box-shadow: 4px 4px var(--ink);
}

.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.brand .brand-svg-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: inline-block;
  transition: transform 0.3s ease;
}
.brand:hover .brand-svg-img { transform: rotate(-10deg) scale(1.1); }

.nav { display: flex; gap: 22px; font-size: 11px; font-weight: 600; }
.nav a { position: relative; padding: 2px 0; }
.nav a::after {
  content: ''; position: absolute; bottom: 0; right: 0; width: 0%; height: 2px; background: var(--ink); transition: width 0.2s ease;
}
.nav a:hover::after { width: 100%; }

.status {
  font-size: 10px; font-weight: 700; background: linear-gradient(135deg, var(--red-mid), var(--red-soft)); color: #ffffff; border: var(--line); padding: 5px 10px; display: flex; align-items: center; gap: 6px;
}
.pulse-dot { width: 6px; height: 6px; border-radius: 50%; background: #ffffff; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* شريط التنقل المخصص للجوال */
.mobile-dock {
  display: none;
  position: fixed;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99;
  background: var(--ink);
  color: #fff;
  border: 2px solid var(--ink);
  box-shadow: 4px 4px var(--red-soft);
  padding: 6px 10px;
  border-radius: 40px;
  width: min(360px, calc(100% - 24px));
}
.mobile-dock nav { display: flex; justify-content: space-around; align-items: center; }
.mobile-dock a {
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 5px 8px;
  border-radius: 20px;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.mobile-dock a:hover, .mobile-dock a:active { background: var(--red-soft); color: #fff; }

/* قسم الهيرو */
.hero {
  min-height: 100vh; padding: 145px 0 60px; position: relative; display: flex; align-items: center;
}
.hero:before {
  content: '01'; position: absolute; left: -35px; bottom: 30px; font: 600 280px/1 'IBM Plex Mono'; color: transparent; -webkit-text-stroke: 1px rgba(17, 18, 15, 0.08); pointer-events: none;
}
.hero-grid { display: grid; grid-template-columns: minmax(0,1fr) 260px; gap: 70px; align-items: end; }
.eyebrow { font-size: 12px; font-weight: 700; border-bottom: var(--line); display: inline-block; padding-bottom: 5px; }
.eyebrow:before { content: '●'; color: var(--red-soft); margin-left: 7px; }

h1 { 
  font-size: clamp(68px, 12vw, 158px); 
  line-height: .92; 
  letter-spacing: -.09em; 
  margin: 25px 0 32px; 
  font-weight: 700; 
  word-break: break-word;
  contain: layout; /* حجز مساحة ومنع تسريب الحركة */
}
h1 span { 
  color: transparent; 
  -webkit-text-stroke: 2px var(--ink); 
  display: inline-block; /* يمنع انكماش وتوسع الحاوية */
}

.hero-copy { font-size: clamp(17px, 2.2vw, 25px); line-height: 1.9; max-width: 780px; font-weight: 400; }
.hero-copy strong { font-weight: 600; background: transparent; border-bottom: 3px solid var(--red-soft); padding: 0 2px; }

.side-note { border-right: var(--line); padding-right: 18px; transform: rotate(-2deg); transition: transform 0.3s ease; }
.side-note:hover { transform: rotate(0deg); }

.side-note .big-svg-img {
  width: 95px;
  height: 95px;
  object-fit: contain;
  margin-bottom: 20px;
  display: block;
}

.side-note p { font-size: 12px; line-height: 2; margin: 0; font-weight: 500; }
.side-note small { display: block; margin-top: 12px; color: var(--muted); }

/* الشريط المتحرك */
.marquee {
  width: 100vw;
  max-width: 100%;
  border-block: var(--line);
  background: linear-gradient(90deg, var(--red-core), var(--red-soft));
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  cursor: default;
}
.marquee span {
  display: inline-block;
  padding: 12px 0;
  animation: run-reverse 22s linear infinite;
  will-change: transform;
}

@keyframes run-reverse {
  0% { transform: translateX(-50%); }
  100% { transform: translateX(0%); }
}

/* تنسيقات الأقسام العامة */
section { padding: 90px 0; }
.section-label { font: 400 11px 'IBM Plex Mono'; margin-bottom: 18px; display: flex; justify-content: space-between; border-bottom: 1px solid rgba(17, 18, 15, 0.3); padding-bottom: 8px; }

.lead { 
  font-size: clamp(28px, 4.8vw, 62px); 
  line-height: 1.35; 
  letter-spacing: -.03em; 
  max-width: 1050px; 
  margin: 0; 
  font-weight: 300; 
  color: var(--ink);
}

.lead em, .lead strong { 
  font-style: normal; 
  font-weight: 700; 
  border-bottom: 3px solid var(--red-soft); 
  padding-bottom: 2px; 
  color: var(--ink);
}

.manifesto { margin-top: 50px; display: grid; grid-template-columns: 1fr 2fr; border-top: var(--line); padding-top: 24px; gap: 30px; }
.manifesto .quote { font-size: 24px; font-weight: 700; line-height: 1.35; }
.manifesto .body { font-size: 15.5px; line-height: 2; max-width: 700px; font-weight: 400; }
.manifesto .body p { margin: 0 0 16px; }

.signature { 
  font-family: 'Cairo', sans-serif;
  font-weight: 600;
  font-size: 13px; 
  margin-top: 25px; 
  display: inline-block; 
  border-bottom: 2px solid var(--red-soft);
  padding-bottom: 4px;
  color: var(--ink);
  letter-spacing: 0;
}

/* قسم تصميم الجرافيك والبورتفوليو */
.design-strip {
  border-top: var(--line);
  padding-top: 40px;
}
.design-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-top: 35px;
  align-items: center;
}
.design-box {
  background: var(--paper);
  border: var(--line);
  padding: 30px;
  box-shadow: 6px 6px var(--ink);
  transition: transform 0.25s ease;
}
.design-box:hover {
  transform: translateY(-4px);
  box-shadow: 8px 8px var(--ink);
}
.design-box h3 { font-size: 26px; margin: 0 0 10px; font-weight: 700; }
.design-box p { font-size: 13.5px; line-height: 1.85; color: var(--muted); margin: 0 0 20px; }
.btn-link {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid var(--ink);
  transition: all 0.2s ease;
}
.btn-link:hover {
  background: var(--red-soft);
  color: #fff;
  border-color: var(--red-soft);
}

/* سجل المشاريع والتطبيقات */
.projects-head { display: flex; justify-content: space-between; align-items: flex-end; border-top: var(--line); padding-top: 18px; gap: 20px; }
.projects-head h2 { font-size: clamp(40px, 7vw, 90px); line-height: .9; letter-spacing: -.07em; margin: 0; font-weight: 700; }
.projects-head p { max-width: 360px; line-height: 1.85; font-size: 13px; margin: 0; }

.project-list { margin-top: 50px; border-top: var(--line); }
.project-row {
  position: relative; display: grid; grid-template-columns: 70px 1fr 290px 30px; gap: 25px; align-items: start; padding: 25px 0; border-bottom: 1px solid rgba(17, 18, 15, 0.3); transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.project-row:hover {
  padding-right: 14px; background: var(--red-soft); color: #ffffff; box-shadow: 8px 0 var(--red-soft), -8px 0 var(--red-soft);
}
.project-row:hover .desc, .project-row:hover .type { color: #ffffff; }
.project-row .num { font: 400 12px 'IBM Plex Mono'; }
.project-row h3 { font-size: clamp(26px, 4vw, 52px); letter-spacing: -.05em; margin: 0; line-height: 1.1; font-weight: 700; }
.project-row .desc { font-size: 13px; line-height: 1.85; color: #4d4d47; font-weight: 400; }
.project-row .type { font: 400 10px/1.7 'IBM Plex Mono'; color: #55554e; }
.project-row .arrow { font-size: 22px; font-weight: 700; transition: transform 0.2s ease; }
.project-row:hover .arrow { transform: translate(-4px, -4px); }

/* تيرمنال وملاحظات "الآن" - الخلفية الداكنة */
.now-zone { background: var(--ink); color: #fff; padding: 80px 0; }
.now-zone .section-label { border-color: rgba(255, 255, 255, 0.2); }
.now-zone .lead { color: #ffffff; font-weight: 300; }
.now-zone .lead em, .now-zone .lead strong { color: #ffffff; border-bottom: 3px solid var(--red-light); }

.console {
  margin-top: 45px; border: 2px solid #fff; background: #171814; box-shadow: 6px 6px var(--red-soft); font-family: 'IBM Plex Mono', monospace; border-radius: 4px; overflow: hidden;
}
.console-bar { border-bottom: 1px solid rgba(255, 255, 255, 0.2); padding: 10px 14px; display: flex; gap: 8px; align-items: center; font-size: 10px; color: #aaa; background: #21221c; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #555; }
.console-body { padding: 22px; font-size: 11.5px; line-height: 2.1; overflow-x: auto; }
.prompt { color: var(--red-light); font-weight: 600; }
.result { color: #ccc; margin-right: 14px; font-weight: 400; opacity: 0; transform: translateY(4px); transition: opacity 0.3s ease, transform 0.3s ease; }
.result.show-line { opacity: 1; transform: translateY(0); }
.cursor { display: inline-block; width: 8px; height: 15px; background: var(--red-light); vertical-align: -2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.now-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid rgba(255, 255, 255, 0.2); margin-top: 30px; }
.now-grid div { padding: 18px; border-left: 1px solid rgba(255, 255, 255, 0.2); }
.now-grid div:last-child { border-left: 0; }
.now-grid b { 
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px; 
  display: block; 
  margin-bottom: 6px; 
  font-weight: 600; 
  color: #ffffff;
  letter-spacing: .05em;
}
.now-grid p { 
  font-family: 'Cairo', sans-serif;
  font-size: 12px; 
  line-height: 1.8; 
  color: #aaa; 
  margin: 0; 
  font-weight: 400;
}

/* خط الزمن والرحلة */
.timeline-wrap { 
  display: grid; 
  grid-template-columns: 220px 1fr; 
  gap: 40px; 
  align-items: start;
}
.timeline-title { font-size: clamp(38px, 6vw, 78px); line-height: 1.25; letter-spacing: -.07em; margin: 0; font-weight: 700; }
.ruler { 
  border-right: 2px solid var(--ink); 
  padding-right: 35px; 
  position: relative;
}
.event { 
  position: relative; 
  padding-bottom: 45px; 
}
.event:before {
  content: ''; 
  position: absolute; 
  right: -42px; 
  top: 4px; 
  width: 12px; 
  height: 12px; 
  background: var(--red-soft); 
  border: 2px solid var(--ink); 
  border-radius: 50%; 
  z-index: 2;
}
.event .year { 
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600; 
  font-size: 11px; 
  color: var(--red-soft);
  margin-bottom: 6px; 
}
.event h3 { 
  font-family: 'Cairo', sans-serif;
  font-size: 22px; 
  margin: 0 0 8px; 
  font-weight: 700; 
  line-height: 1.3;
}
.event p { 
  font-family: 'Cairo', sans-serif;
  font-size: 13.5px; 
  line-height: 1.85; 
  color: var(--muted); 
  max-width: 680px; 
  margin: 0; 
  font-weight: 400; 
}

/* الأرشيف */
.archive { border-top: var(--line); padding-top: 20px; }
.archive-intro { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: flex-end; }
.archive-intro h2 { font-size: clamp(38px, 7vw, 90px); line-height: 1.2; letter-spacing: -.08em; margin: 0; font-weight: 700; }
.archive-intro p { font-size: 15px; line-height: 1.9; margin: 0; font-weight: 400; }
.archive-list { margin-top: 45px; }
.archive-item {
  display: grid; grid-template-columns: 120px 1fr 35px; gap: 20px; padding: 20px 0; border-bottom: var(--line); align-items: center; transition: all 0.2s ease;
}
.archive-item .kind { font: 400 10px 'IBM Plex Mono'; }
.archive-item h3 { font-size: 22px; margin: 0; font-weight: 700; }
.archive-item p { font-size: 12px; color: var(--muted); margin: 4px 0 0; font-weight: 400; }
.archive-item .go { font-size: 20px; font-weight: 700; }
.archive-item:hover { background: #fff; padding-right: 12px; padding-left: 12px; box-shadow: 4px 4px var(--ink); }

/* قسم الشهادات */
.credentials { background: linear-gradient(135deg, var(--red-mid), var(--red-soft)); color: #ffffff; border-block: var(--line); padding: 75px 0; }
.credentials h2 { font-size: clamp(38px, 7vw, 90px); line-height: 1.2; letter-spacing: -.08em; margin: 0; font-weight: 700; }
.credentials-intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 25px; }
.credentials-intro p { max-width: 400px; font-size: 13.5px; line-height: 1.85; margin: 0; font-weight: 400; }

.papers {
  margin-top: 50px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 18px;
  align-items: start;
}.paper {
  background: var(--paper); color: var(--ink); border: var(--line); min-height: 260px; padding: 16px; position: relative; transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1); display: flex; flex-direction: column; justify-content: space-between;
}
.paper:nth-child(1) { transform: rotate(2deg); }
.paper:nth-child(2) { transform: rotate(-2deg) translateY(10px); }
.paper:nth-child(3) { transform: rotate(1deg) translateY(5px); }
.paper:nth-child(4) { transform: rotate(-3deg) translateY(15px); }
.paper:hover { transform: rotate(0deg) translateY(-8px); z-index: 10; box-shadow: 8px 8px var(--ink); }
.paper .seal { font: 600 9px 'IBM Plex Mono'; border-bottom: 1px solid rgba(17, 18, 15, 0.3); padding-bottom: 8px; }
.paper .paper-img {
  width: 100%;
  aspect-ratio: 297 / 210;
  height: auto;
  object-fit: contain;
  border: 1px solid var(--ink);
  border-radius: 2px;
  margin: 10px 0 6px;
  background: #ffffff;
}
.paper h3 { font-size: 16px; line-height: 1.25; margin: 6px 0 4px; font-weight: 700; }
.paper p { font-size: 10.5px; line-height: 1.5; color: var(--muted); margin: 0; font-weight: 400; }

/* الملاحظة الختامية وقسم التواصل */
.final-note { padding: 75px 0; }
.final-note .big { font-size: clamp(32px, 6vw, 72px); line-height: 1.15; letter-spacing: -.06em; max-width: 1000px; margin: 0; font-weight: 700; }
.final-note .big span { 
  color: var(--red-soft); 
  border-bottom: 4px solid var(--red-soft);
  padding-bottom: 2px;
}
.final-note p { max-width: 650px; font-size: 14.5px; line-height: 1.95; margin-top: 24px; font-weight: 400; }

.contact {
  background: var(--ink); color: white; padding: 60px 35px; border: var(--line); box-shadow: 8px 8px var(--red-soft); position: relative; border-radius: 4px;
}
.contact h2 { font-size: clamp(45px, 8.5vw, 115px); line-height: .88; letter-spacing: -.08em; margin: 0 0 24px; font-weight: 700; }
.contact h2 span { color: var(--red-light); }
.contact p { max-width: 600px; color: #bbb; line-height: 1.95; font-size: 14.5px; margin: 0; font-weight: 400; }

.links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 28px; }
.links a {
  background: var(--red-soft); color: #ffffff; padding: 9px 14px; font-weight: 700; font-size: 11px; border: 1px solid var(--red-soft); transition: all 0.2s ease;
}
.links a:hover { transform: translateY(-2px); box-shadow: 3px 3px 0px #fff; }
.links a.alt { background: transparent; color: white; border: 1px solid rgba(255, 255, 255, 0.4); }
.links a.alt:hover { border-color: #fff; background: rgba(255, 255, 255, 0.1); }

footer {
  border-top: var(--line);
  padding: 24px 0 45px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  gap: 15px;
}

/* Responsive Queries */
@media(max-width:900px){ 
  .papers { grid-template-columns: repeat(2, 1fr); } 
  .paper:nth-child(n) { transform: none; } 
}

@media(max-width:800px){
  .top { display: none; }
  .mobile-dock { display: block; }
  .hero { padding-top: 100px; min-height: auto; }
  .hero-grid, .manifesto, .archive-intro, .timeline-wrap, .design-grid, .projects-head { grid-template-columns: 1fr; }
  .side-note { border-right: 0; border-top: var(--line); padding-right: 0; padding-top: 20px; transform: none; }
  .project-row { grid-template-columns: 35px 1fr 25px; gap: 15px; }
  .project-row .desc, .project-row .type { grid-column: 1 / -1; }
  .now-grid { grid-template-columns: 1fr 1fr; }
  .now-grid div:nth-child(2) { border-left: 0; }
  .credentials-intro { display: block; }
  .timeline-wrap { gap: 20px; }
  .ruler { padding-right: 15px; border-right: 2px solid var(--ink); }
  .event:before { right: -21px; width: 9px; height: 9px; }
  .archive-item { grid-template-columns: 75px 1fr 20px; gap: 12px; }
  .contact { padding: 35px 18px; box-shadow: 5px 5px var(--red-soft); }
  .marquee span { font-size: 11.5px; }
  footer {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
}

@media(max-width:500px){
  h1 { font-size: 56px; }
  .now-grid { grid-template-columns: 1fr; }
  .now-grid div { border-left: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.2); }
  .papers { grid-template-columns: 1fr; }
  .archive-item h3 { font-size: 18px; }
}

/* Certificates card text colors */
#certificatesContainer .paper h3 {
    color: #1e293b !important;
}

#certificatesContainer .paper p {
    color: #64748b !important;
}

#certificatesContainer .paper .seal {
    color: #1e293b !important;
}

	.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 11px;
  border: var(--line);
  font-size: 11px;
  font-weight: 700;
  background: var(--paper);
  color: var(--ink);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.language-switch:hover {
  background: var(--ink);
  color: #fff;
}
.mobile-language-switch {
  display: none;
}

@media (max-width: 800px) {
  .mobile-language-switch {
    display: flex;
    position: fixed;
    bottom: 155px;
    left: 18px;
    right: auto;
    z-index: 9998;

    width: 48px;
    height: 48px;
    box-sizing: border-box;

    align-items: center;
    justify-content: center;

    border: var(--line);
    border-radius: 50%;
    background: var(--paper);
    color: var(--ink);

    font-size: 13px;
    font-weight: 700;
    box-shadow: 3px 3px var(--red-soft);
    transition: all 0.2s ease;
  }

  .mobile-language-switch:hover {
    background: var(--ink);
    color: #fff;
  }
}