/* ===========================================
 M OUSTAFA ZOUHIR HLAYBA - PORTFOLIO                     *
 Designed by Moustafa Zouhir (i use arch btw)
 =========================================== */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&family=DM+Mono:wght@400;500&display=swap');

/* -- TOKENS -- */
:root {
  --bg: #ffffff;
  --bg2: #f5f5f5;
  --bg3: #eeeeee;
  --surface: #f0f0f0;
  --border: rgba(0,0,0,0.08);
  --border-light: rgba(0,0,0,0.15);
  --text: #1a1a1a;
  --muted: rgba(26, 26, 26, 0.45);
  --muted2: rgba(26, 26, 26, 0.25);
  --accent: #7c3aed;
  --accent2: #a78bfa;
  --accent-rgb: 124, 58, 237;
  --red: #e05c4b;
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --shadow: 0 20px 60px rgba(0,0,0,0.12);
  --r: 1rem;
  --r2: 1.5rem;
  --max: 1200px;
  --pad: clamp(1.25rem, 5vw, 4rem);
}

[data-theme="dark"] {
  --bg: #1e1e2e;
  --bg2: #181825;
  --bg3: #11111b;
  --surface: #313244;
  --border: rgba(205,214,244,0.10);
  --border-light: rgba(205,214,244,0.18);
  --text: #cdd6f4;
  --muted: rgba(205, 214, 244, 0.50);
  --muted2: rgba(205, 214, 244, 0.30);
  --accent: #cba6f7;
  --accent2: #b4befe;
  --accent-rgb: 203, 166, 247;
  --shadow: 0 20px 60px rgba(0,0,0,0.4);
}

/* -- RESET -- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  cursor: none;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* -- NOISE OVERLAY -- */
.noise {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px;
}

/* -- CUSTOM CURSOR -- */
.cursor {
  position: fixed;
  width: 36px; height: 36px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s, border-color 0.3s, background 0.3s;
  mix-blend-mode: difference;
}
.cursor-dot {
  position: fixed;
  width: 5px; height: 5px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
}
.cursor.cursor-hover {
  width: 56px; height: 56px;
  background: rgba(var(--accent-rgb), 0.08);
}
@media (hover: none) { .cursor, .cursor-dot { display: none; } }

/* -- NAV -- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 900;
  padding: 1.25rem var(--pad);
  transition: background 0.4s, padding 0.4s, border-bottom 0.4s;
}
.nav.nav-scrolled {
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(16px);
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .nav.nav-scrolled {
  background: rgba(30,30,46,0.88);
}
.nav-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.logo {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  color: var(--text);
}
.logo-dot { color: var(--accent); }
.nav-links {
  display: flex;
  list-style: none;
  gap: 2rem;
}
.nav-links a {
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }
.nav-cta {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  color: var(--accent);
  transition: background 0.25s, color 0.25s;
}
.nav-cta:hover { background: var(--accent); color: #ffffff; }

/* -- HERO -- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 7rem var(--pad) 0;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
  linear-gradient(rgba(0,0,0,0.06) 1px, transparent 1px),
  linear-gradient(90deg, rgba(0,0,0,0.06) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 20%, black 40%, transparent 100%);
}
[data-theme="dark"] .hero-grid {
  background-image:
  linear-gradient(rgba(205,214,244,0.06) 1px, transparent 1px),
  linear-gradient(90deg, rgba(205,214,244,0.06) 1px, transparent 1px);
}

.hero-inner {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3rem;
  flex: 1;
  padding-bottom: 3rem;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: fadeDown 0.8s ease both 0.1s;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.badge-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.badge-year {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted2);
}

/* -- BIG DISPLAY TITLE -- */
.hero-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.hero-title-line {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  overflow: hidden;
}
.eyebrow-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
  align-self: center;
}
.hero-name {
  font-family: var(--font-display);
  font-size: clamp(5rem, 14vw, 13rem);
  line-height: 0.88;
  letter-spacing: -0.01em;
  color: var(--text);
  font-weight: 400;
}
.hero-name.stroke {
  -webkit-text-stroke: 1.5px var(--text);
  color: transparent;
}
.scroll-hint {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted2);
  letter-spacing: 0.08em;
  align-self: flex-end;
  margin-bottom:1.2rem;
  margin-left: auto;
}

.ascii-cat {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  line-height: 1.2;
  text-align: center;
  margin: 0.5rem 0 0;
  white-space: pre;
}

.hero-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}
.hero-desc {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 40ch;
  line-height: 1.7;
}
.hero-metrics {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-shrink: 0;
}
.metric { text-align: center; }
.metric strong {
  display: block;
  font-family: var(--font-display);
  font-size: 2.5rem;
  line-height: 1;
  color: var(--accent);
}
.metric span {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted2);
}
.metric-divider {
  width: 1px; height: 3rem;
  background: var(--border);
}

/* -- SCROLLING TAG BAR -- */
.hero-tags {
  position: relative;
  display: flex;
  gap: 0;
  overflow: hidden;
  border-top: 1px solid var(--border);
  padding: 0.9rem 0;
  animation: fadeIn 0.8s ease both 1s;
}
.hero-tags::before, .hero-tags::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 80px;
  z-index: 2;
  pointer-events: none;
}
.hero-tags::before { left: 0; background: linear-gradient(to right, var(--bg), transparent); }
.hero-tags::after { right: 0; background: linear-gradient(to left, var(--bg), transparent); }
.hero-tags span {
  display: inline-block;
  padding: 0.3rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  border-right: 1px solid var(--border);
}
.hero-tags span:last-child { border-right: none; }

/* -- SECTIONS -- */
.section {
  padding: clamp(4rem, 8vw, 7rem) var(--pad);
}
.section-inner {
  max-width: var(--max);
  margin: 0 auto;
}
.section-dark {
  background: var(--bg2);
}
.section-accent {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted2);
}
.section-label.light { color: rgba(240,237,232,0.3); }
.label-num { color: var(--accent); }

.section-title {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 8vw, 7rem);
  line-height: 0.9;
  letter-spacing: 0.01em;
  color: var(--text);
  margin-bottom: 3rem;
  font-weight: 400;
}
.section-title.light { color: var(--text); }
.section-title em {
  font-style: italic;
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  color: var(--accent);
}

/* -- ABOUT -- */
.about-layout {
  display: grid;
  grid-template-columns: 0.6fr 1fr;
  gap: 4rem;
  align-items: start;
}
.about-text {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 1.25rem;
}
.about-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--r2);
  margin-top: 0.5rem;
  background: var(--surface);
}
.about-card-icon {
  font-size: 1.2rem;
  color: var(--accent);
  margin-top: 0.1rem;
  flex-shrink: 0;
}
.about-card h3 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted2);
  margin-bottom: 0.35rem;
}
.about-card p { color: var(--muted); font-size: 0.95rem; margin: 0; }

/* -- SKILLS -- */
.skills-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 1rem;
}
.skill-item {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  align-items: center;
  gap: 1.5rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  transition: opacity 0.2s;
}
.skill-item:hover { opacity: 1 !important; }
.skills-wrap:hover .skill-item { opacity: 0.4; }
.skill-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted2);
}
.skill-name {
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.skill-bar {
  width: 120px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}
.skill-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0;
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.skill-item.in-view .skill-bar span {
  width: var(--w, 80%);
}
/* -- SET WIDTHS VIA INLINE STYLES ALREADY IN HTML -- */

/* -- TIMELINE -- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.tl-item {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 2rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
}
.tl-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.tl-marker span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
}
.tl-line {
  flex: 1;
  width: 1px;
  background: var(--border);
}
.tl-tag {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted2);
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.tl-content h3 {
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  margin-top: 0.25rem;
}
.tl-content p { color: var(--muted); font-size: 0.95rem; }

/* -- PROJECTS -- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  overflow: hidden;
  margin-top: 1rem;
}
.project-card {
  background: var(--bg2);
  display: block;
  transition: background 0.25s;
  cursor: pointer;
}
.project-card:not(.no-link):hover {
  background: var(--bg3);
}
.project-card.no-link { cursor: default; }
.project-card-inner { padding: 2rem; height: 100%; }
.project-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.project-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted2);
}
.project-arrow {
  font-size: 1.1rem;
  color: var(--accent);
  transition: transform 0.2s;
}
.project-card:hover .project-arrow { transform: translate(3px, -3px); }
.project-card h3 {
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}
.project-card p { color: var(--muted); font-size: 0.92rem; margin-bottom: 1.25rem; }
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.project-tags span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--muted2);
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* -- SERVICES -- */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 1rem;
}
.service {
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--r2);
  background: var(--surface);
  transition: border-color 0.25s, transform 0.25s;
}
.service:hover {
  border-color: var(--border-light);
  transform: translateY(-4px);
}
.service-icon {
  display: block;
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 1rem;
}
.service h3 {
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.service p { color: var(--muted); font-size: 0.92rem; }

/* -- QUOTES -- */
.quotes-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 1rem;
}
.quote {
  padding: 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--r2);
  background: rgba(0,0,0,0.02);
}
[data-theme="dark"] .quote {
  background: rgba(205,214,244,0.04);
}
.quote p {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 1.25rem;
  font-style: italic;
  font-weight: 300;
}
.quote cite {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-style: normal;
}

/* -- CONTACT -- */
.contact-layout {
  display: grid;
  grid-template-columns: 0.5fr 1fr;
  gap: 4rem;
  align-items: start;
}
.contact-title {
  margin-bottom: 0;
}
.contact-desc {
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 2rem;
  max-width: 45ch;
}
.contact-links {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--r2);
  overflow: hidden;
}
.contact-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s, padding-left 0.2s;
  font-size: 1rem;
}
.contact-link:last-child { border-bottom: none; }
.contact-link:hover {
  background: var(--surface);
  padding-left: 2rem;
}
.contact-link.primary span:first-child { color: var(--accent); }
.contact-link-arrow {
  font-size: 1.1rem;
  color: var(--muted2);
  transition: color 0.2s, transform 0.2s;
}
.contact-link:hover .contact-link-arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

/* -- FOOTER -- */
.footer {
  padding: 2rem var(--pad);
  border-top: 1px solid var(--border);
  background: var(--bg2);
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted2);
}
.footer-tagline {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted2);
  opacity: 0.5;
}
.footer-links {
  display: flex;
  gap: 1.5rem;
}
.footer-links a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted2);
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--text); }

/* -- ANIMATIONS & REVEALS -- */
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-fade {
  opacity: 0;
  transition: opacity 0.9s ease;
}
.reveal-line {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-skill {
  opacity: 0;
  transform: translateX(-12px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  transition-delay: calc(var(--d) * 0.1s);
}

.reveal-up.in-view { opacity: 1; transform: translateY(0); }
.reveal-fade.in-view { opacity: 1; }
.reveal-line.in-view { clip-path: inset(0 0 0% 0); }
.reveal-skill.in-view { opacity: 1; transform: translateX(0); }

/* -- HERO ANIMATIONS -- */
.hero .reveal-line {
  animation: slideUp 1s cubic-bezier(0.16, 1, 0.3, 1) both;
  clip-path: none;
  opacity: 0;
  transform: none;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero .reveal-fade {
  animation: fadeIn 0.8s ease both;
}
.delay-1 { animation-delay: 0.25s !important; transition-delay: 0.1s; }
.delay-2 { animation-delay: 0.45s !important; transition-delay: 0.2s; }
.delay-3 { animation-delay: 0.65s !important; transition-delay: 0.3s; }
.delay-4 { animation-delay: 0.8s !important; transition-delay: 0.4s; }
.delay-5 { animation-delay: 1s !important; transition-delay: 0.5s; }

/* -- THEME TOGGLE -- */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  margin-right: 0.75rem;
  transition: border-color 0.2s;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-icon { font-size: 1rem; position: absolute; transition: opacity 0.2s, transform 0.2s; }
.theme-icon-sun { color: var(--text); }
.theme-icon-moon { color: var(--text); opacity: 0; }
[data-theme="dark"] .theme-icon-sun { opacity: 0; }
[data-theme="dark"] .theme-icon-moon { opacity: 1; }
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* -- RESPONSIVE -- */
@media (max-width: 900px) {
  .about-layout,
  .contact-layout { grid-template-columns: 1fr; gap: 2rem; }
  .projects-grid { grid-template-columns: 1fr; }
  .services-grid { grid-template-columns: 1fr 1fr; }
  .quotes-wrap { grid-template-columns: 1fr; }
  .hero-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 660px) {
  .nav-links { display: none; }
  .hero-name { font-size: clamp(4rem, 18vw, 6rem); }
  .services-grid { grid-template-columns: 1fr; }
  .tl-item { grid-template-columns: 3.5rem 1fr; gap: 1rem; }
  .hero-metrics { gap: 1rem; }
  .metric strong { font-size: 2rem; }
  body { cursor: auto; }
}

/* -- SCROLLBAR -- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent2); border-radius: 2px; opacity: 0.5; }

/* -- SELECTION -- */
::selection { background: var(--accent); color: #ffffff; }
[data-theme="dark"] ::selection { background: var(--accent); color: #1e1e2e; }
