/* ============================================================
   PREMIUM PORTFOLIO — Dark + Cyan/Electric Design Override
   Ayoub Machkour | 2025
   ============================================================ */

/* ── Color System ─────────────────────────────────────────── */
:root {
  --p-cyan:      #00f5ff;
  --p-cyan-dim:  #00c8d4;
  --p-violet:    #7c3aed;
  --p-gold:      #f59e0b;
  --p-bg:        #050a0f;
  --p-bg2:       #070d14;
  --p-bg3:       #0a1220;
  --p-card:      rgba(10, 20, 35, 0.75);
  --p-border:    rgba(0, 245, 255, 0.12);
  --p-border-h:  rgba(0, 245, 255, 0.45);
  --p-text:      #c8d8e8;
  --p-text-dim:  #7a9ab0;
  --p-glow:      0 0 20px rgba(0, 245, 255, 0.35), 0 0 60px rgba(0, 245, 255, 0.12);
  --p-glow-sm:   0 0 10px rgba(0, 245, 255, 0.4);
  --p-glow-v:    0 0 20px rgba(124, 58, 237, 0.4);
}

/* ── Base ─────────────────────────────────────────────────── */
body {
  background-color: var(--p-bg) !important;
  color: var(--p-text) !important;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--p-bg); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--p-cyan), var(--p-violet));
  border-radius: 10px;
}

/* Text selection */
::selection { background: var(--p-cyan); color: #000; }

/* ── Typography ───────────────────────────────────────────── */
.section-title {
  background: linear-gradient(135deg, var(--p-cyan) 0%, #ffffff 50%, var(--p-violet) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--p-cyan), var(--p-violet));
  border-radius: 2px;
  box-shadow: var(--p-glow-sm);
}

/* ── Navigation ───────────────────────────────────────────── */
.tj-header-area {
  border-bottom: 1px solid var(--p-border) !important;
}

.header-sticky {
  background: rgba(5, 10, 15, 0.85) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid var(--p-border) !important;
  box-shadow: 0 4px 30px rgba(0, 245, 255, 0.06) !important;
}

.header-menu nav ul li a {
  position: relative;
  transition: color 0.3s ease !important;
}

/* Kill the duplicate ::after — the template already has a ::before underline */
.header-menu nav ul li a::after {
  display: none !important;
}

/* Recolor the original ::before underline to cyan */
.tj-header-area .header-menu ul > li > a::before {
  background: var(--p-cyan) !important;
  box-shadow: 0 0 8px rgba(0, 245, 255, 0.6);
}

.header-menu nav ul li a:hover {
  color: var(--p-cyan) !important;
}

/* ── Primary Button ───────────────────────────────────────── */
.tj-btn-primary,
.tj-btn-secondary {
  background: transparent !important;
  border: 1px solid var(--p-cyan) !important;
  color: var(--p-cyan) !important;
  border-radius: 6px !important;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease !important;
  font-weight: 500 !important;
  letter-spacing: 0.5px;
}

.tj-btn-primary::before,
.tj-btn-secondary::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 245, 255, 0.15), transparent);
  transition: left 0.4s ease;
}

.tj-btn-primary:hover::before,
.tj-btn-secondary:hover::before {
  left: 100%;
}

.tj-btn-primary:hover,
.tj-btn-secondary:hover {
  box-shadow: var(--p-glow) !important;
  color: #fff !important;
}

/* ── Hero Section ─────────────────────────────────────────── */
.hero-section {
  position: relative;
  overflow: hidden;
  background: var(--p-bg) !important;
  min-height: 100vh;
}

#hero-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

.hero-section .container {
  position: relative;
  z-index: 2;
}

.hero-section .intro_text {
  z-index: 1 !important;
  opacity: 0.04 !important;
}

/* ── Centered hero layout ─────────────────────────────────── */
.hero-content-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-content-center .hero-content-box {
  max-width: 900px;
  width: 100%;
}

/* ── Big centered name ────────────────────────────────────── */
.hero-title-big {
  font-size: clamp(3.2rem, 9vw, 7.5rem) !important;
  font-weight: 900 !important;
  line-height: 1.05 !important;
  letter-spacing: -1px;
  margin: 0 0 18px 0 !important;
  display: block;
}

/* First name: white */
.hero-firstname {
  display: block;
  color: #ffffff;
  text-shadow: 0 0 60px rgba(255, 255, 255, 0.15);
  letter-spacing: 2px;
}

/* Last name: cyan electric with glow */
.hero-lastname {
  display: block;
  color: var(--p-cyan);
  letter-spacing: 6px;
  text-shadow:
    0 0 20px rgba(0, 245, 255, 0.7),
    0 0 60px rgba(0, 245, 255, 0.3),
    0 0 120px rgba(0, 245, 255, 0.15);
  animation: lastname-glow 3s ease-in-out infinite;
}

@keyframes lastname-glow {
  0%, 100% {
    text-shadow:
      0 0 20px rgba(0, 245, 255, 0.6),
      0 0 60px rgba(0, 245, 255, 0.25),
      0 0 120px rgba(0, 245, 255, 0.1);
  }
  50% {
    text-shadow:
      0 0 30px rgba(0, 245, 255, 0.9),
      0 0 80px rgba(0, 245, 255, 0.4),
      0 0 160px rgba(0, 245, 255, 0.2);
  }
}

/* Hero subtitle */
.hero-subtitle-premium {
  color: var(--p-text-dim) !important;
  font-size: clamp(0.95rem, 2vw, 1.25rem) !important;
  letter-spacing: 3px !important;
  text-transform: uppercase;
  margin: 0 0 32px 0 !important;
  opacity: 0.85;
  font-weight: 300 !important;
}

/* Hero CDI badge */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 245, 255, 0.08);
  border: 1px solid var(--p-border-h);
  border-radius: 30px;
  padding: 6px 16px;
  font-size: 0.78rem;
  color: var(--p-cyan);
  margin-bottom: 20px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  font-weight: 600;
  animation: badge-pulse 2.5s ease-in-out infinite;
}

.hero-badge::before {
  content: '';
  width: 7px; height: 7px;
  background: var(--p-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--p-cyan);
  animation: blink 1.5s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 245, 255, 0.2); }
  50%       { box-shadow: 0 0 0 6px rgba(0, 245, 255, 0); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* hero: ensure full height + proper centering */
.hero-section {
  min-height: 100vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.hero-section .container {
  width: 100%;
}

/* Social icons */
.social-icons li a {
  border: 1px solid var(--p-border) !important;
  color: var(--p-text-dim) !important;
  transition: all 0.3s ease !important;
  border-radius: 50% !important;
}

.social-icons li a:hover {
  border-color: var(--p-cyan) !important;
  color: var(--p-cyan) !important;
  box-shadow: var(--p-glow-sm) !important;
  transform: translateY(-3px) !important;
}

/* ── About Section ────────────────────────────────────────── */
.services-section {
  background: var(--p-bg2) !important;
  border-top: 1px solid var(--p-border);
  border-bottom: 1px solid var(--p-border);
}

/* ── Resume / Experience Cards ────────────────────────────── */
.resume-section {
  background: var(--p-bg) !important;
}

/* Kill the original full-card gradient overlay — too invasive */
.resume-widget .resume-item::before {
  display: none !important;
}

/* Subtle card style */
.resume-widget .resume-item {
  background: rgba(10, 20, 35, 0.6) !important;
  border: 1px solid var(--p-border) !important;
  border-left: 2px solid rgba(0, 245, 255, 0.25) !important;
  border-radius: 10px !important;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.25s ease !important;
  padding: 16px 22px !important;
  margin-bottom: 16px !important;
  margin-right: 0 !important;
}

.resume-widget .resume-item:hover {
  border-color: var(--p-border-h) !important;
  border-left-color: var(--p-cyan) !important;
  box-shadow: -3px 0 16px rgba(0, 245, 255, 0.18), 0 4px 20px rgba(0, 0, 0, 0.4) !important;
  transform: translateX(4px) !important;
  background: rgba(0, 245, 255, 0.04) !important;
}

/* Date chip */
.resume-widget .resume-item .time {
  color: var(--p-cyan) !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.5px !important;
  margin-bottom: 5px !important;
  text-transform: uppercase;
}

.resume-widget .resume-item:hover .time {
  color: var(--p-cyan) !important;
}

/* Title */
.resume-widget .resume-item .resume-title {
  font-size: 1rem !important;
  text-transform: none !important;
  color: #e8f4f8 !important;
  margin-bottom: 4px !important;
  font-weight: 600 !important;
}

/* Institute */
.resume-widget .resume-item .institute {
  font-size: 0.82rem !important;
  color: var(--p-text-dim) !important;
}

/* ── Skills Section — compact stack tags ──────────────────── */
.skills-section {
  background: var(--p-bg2) !important;
  border-top: 1px solid var(--p-border);
  border-bottom: 1px solid var(--p-border);
  padding-top: 60px !important;
  padding-bottom: 60px !important;
}

/* Grid of rows */
.stack-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 32px;
}

/* One category row */
.stack-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Category label */
.stack-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--p-cyan);
  opacity: 0.7;
  min-width: 130px;
  flex-shrink: 0;
}

/* Divider line between label and tags */
.stack-row::after {
  display: none;
}

/* Tag pills */
.stack-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stag {
  display: inline-block;
  padding: 4px 13px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--p-text);
  background: rgba(0, 245, 255, 0.06);
  border: 1px solid var(--p-border);
  transition: all 0.25s ease;
  cursor: default;
  letter-spacing: 0.2px;
}

.stag:hover {
  background: rgba(0, 245, 255, 0.13);
  border-color: rgba(0, 245, 255, 0.4);
  color: var(--p-cyan);
  box-shadow: 0 0 10px rgba(0, 245, 255, 0.15);
}

/* Mobile: label on its own line above tags */
@media (max-width: 767px) {
  .stack-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .stack-label {
    min-width: unset;
  }
  .stag i {
    margin-right: 4px;
  }
}

/* ── Portfolio Section ────────────────────────────────────── */
.portfolio-section {
  background: var(--p-bg) !important;
}

/* Filter buttons */
.portfolio-filter .button-group .active-bg {
  background: linear-gradient(135deg, var(--p-cyan), var(--p-violet)) !important;
  border-radius: 6px !important;
}

.portfolio-filter button {
  font-weight: 500 !important;
  letter-spacing: 0.3px;
  transition: color 0.3s ease !important;
}

.portfolio-filter button.active,
.portfolio-filter button:hover {
  color: #000 !important;
}

/* Project cards */
.portfolio-item {
  border-radius: 12px !important;
  overflow: hidden;
  border: 1px solid var(--p-border) !important;
  background: var(--p-card) !important;
  backdrop-filter: blur(10px) !important;
  transition: all 0.4s ease !important;
  position: relative;
}

.portfolio-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0,245,255,0.04), transparent, rgba(124,58,237,0.04));
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 1;
}

.portfolio-item:hover::before {
  opacity: 1;
}

.portfolio-item:hover {
  border-color: var(--p-border-h) !important;
  box-shadow: 0 8px 40px rgba(0, 245, 255, 0.15), 0 0 0 1px rgba(0,245,255,0.1) !important;
  transform: translateY(-6px) !important;
}

.portfolio-item .image-box {
  position: relative;
  overflow: hidden;
  height: 340px;
}

.portfolio-item .image-box img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: top !important;
  transition: transform 0.5s ease, filter 0.5s ease !important;
}

.portfolio-item:hover .image-box img {
  transform: scale(1.05) !important;
  filter: brightness(0.75) !important;
}

.portfolio-item .content-box {
  background: rgba(7, 13, 20, 0.9) !important;
  border-top: 1px solid var(--p-border) !important;
  padding: 18px !important;
}

.portfolio-item .portfolio-title {
  font-size: 0.95rem !important;
  color: #e8f4f8 !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
}

.portfolio-item .content-box p {
  color: var(--p-text-dim) !important;
  font-size: 0.82rem !important;
  line-height: 1.5;
}

/* GitHub badge on project card */
.github-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(5, 10, 15, 0.85);
  border: 1px solid rgba(0, 245, 255, 0.5);
  color: var(--p-cyan) !important;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-decoration: none !important;
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
  pointer-events: all;
}

.github-badge i {
  font-size: 0.85rem;
}

.github-badge:hover {
  background: rgba(0, 245, 255, 0.15);
  box-shadow: 0 0 15px rgba(0, 245, 255, 0.3);
  color: #fff !important;
  transform: scale(1.05);
  text-decoration: none !important;
}

/* ── Popup / Modal ────────────────────────────────────────── */
.popup_content_area {
  background: var(--p-bg3) !important;
  border: 1px solid var(--p-border) !important;
  border-radius: 16px !important;
}

/* Kill the white background */
.popup_modal_content {
  background: var(--p-bg3) !important;
  border-top: 1px solid var(--p-border) !important;
}

.popup_modal_content .title {
  background: linear-gradient(135deg, var(--p-cyan), #ffffff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: clamp(1.3rem, 3vw, 2rem) !important;
}

/* Body text */
.popup_modal_content .desc,
.popup_modal_content .desc p,
.popup_modal_content .desc li {
  color: var(--p-text) !important;
  font-size: 0.92rem !important;
  line-height: 1.7 !important;
}

.popup_modal_content .desc strong,
.popup_modal_content .desc b {
  color: #e8f4f8 !important;
}

.popup_modal_content .desc ul {
  padding-left: 1.2rem;
  margin-bottom: 0.8rem;
}

.popup_modal_content .desc li {
  margin-bottom: 4px;
}

.popup_modal_content .desc code {
  background: rgba(0, 245, 255, 0.08);
  color: var(--p-cyan);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

.popup_modal_content a {
  color: var(--p-cyan) !important;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.popup_modal_content a:hover {
  text-shadow: var(--p-glow-sm);
}

/* Close button */
.popup_content_area .mfp-close {
  color: var(--p-cyan) !important;
  opacity: 0.7;
}
.popup_content_area .mfp-close:hover {
  opacity: 1;
  text-shadow: var(--p-glow-sm);
}

/* Popup image */
.popup_modal_img {
  border-bottom: 1px solid var(--p-border) !important;
}
.popup_modal_img img {
  border-radius: 12px 12px 0 0 !important;
  width: 100%;
  height: auto;
}

/* ── Preloader ────────────────────────────────────────────── */
.preloader svg path,
.preloader svg polyline,
.preloader svg line {
  stroke: var(--p-cyan) !important;
}

/* ── Scroll Progress ──────────────────────────────────────── */
.progress-wrap svg path {
  stroke: var(--p-cyan) !important;
}

.progress-wrap {
  border: 2px solid rgba(0, 245, 255, 0.2) !important;
  box-shadow: var(--p-glow-sm) !important;
}

.progress-wrap::after {
  color: var(--p-cyan) !important;
}

/* ── Footer ───────────────────────────────────────────────── */
.footer-section {
  background: var(--p-bg2) !important;
  border-top: 1px solid var(--p-border) !important;
}

/* ── Language Section ─────────────────────────────────────── */
.language-item,
.fun-fact-item {
  background: var(--p-card) !important;
  border: 1px solid var(--p-border) !important;
  border-radius: 10px !important;
  backdrop-filter: blur(10px) !important;
  transition: all 0.3s ease !important;
}

.language-item:hover,
.fun-fact-item:hover {
  border-color: var(--p-border-h) !important;
  box-shadow: var(--p-glow-sm) !important;
  transform: translateY(-4px) !important;
}

/* ── Glowing Accent Dividers ──────────────────────────────── */
.section-header {
  position: relative;
}

/* ── Mobile Adjustments ───────────────────────────────────── */
@media (max-width: 768px) {
  #hero-canvas {
    opacity: 0.5;
  }

  .hero-name-gradient {
    font-size: clamp(2rem, 8vw, 3.5rem) !important;
  }

  .hero-badge {
    font-size: 0.68rem;
    padding: 5px 12px;
  }
}

/* ── Portfolio mobile: fix Isotope overlap + always-visible overlay ── */
@media (max-width: 767px) {
  /* Override Isotope's inline absolute positioning — stack cards normally */
  .portfolio-box {
    height: auto !important;
  }
  .portfolio-box .portfolio-item {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    margin-bottom: 20px !important;
    /* No display:block !important — Isotope needs to set display:none to filter */
  }
  /* Content-box: stays as absolute overlay on the image,
     always visible on mobile (no hover needed) */
  .portfolio-box .portfolio-item .content-box {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    border-radius: 0 0 12px 12px !important;
  }
}

/* ── Contact CTA section ──────────────────────────────────── */
.text-section {
  background-color: var(--p-bg) !important;
  border-top: 1px solid var(--p-border);
}
.text-section .section-title {
  color: var(--p-cyan) !important;
  -webkit-text-fill-color: var(--p-cyan) !important;
  text-shadow: var(--p-glow);
}
.text-section .chat-mail .link {
  color: var(--p-text) !important;
}
.text-section .chat-mail .link:hover {
  color: var(--p-cyan) !important;
}

/* ── Subtle grain texture on body ─────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  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)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.018;
  pointer-events: none;
  z-index: 9999;
}
