/* styles.css - FINAL Unified Dark Theme & WIDER Card Layout */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- Variables --- */
:root {
  /* Core Theme Colors */
  --bg-gradient-start: #0f172a;
  --bg-gradient-end: #1e293b;
  --primary-text: #e2e8f0;
  --secondary-text: #94a3b8;
  --accent-color: #38bdf8;
  --accent-hover: #0ea5e9;

  /* Card Specifics (Used for Expertise, Project, Article cards) */
  --card-bg: #1f2937; /* Distinct dark slate */
  --card-border: rgba(148, 163, 184, 0.2); /* Visible grayish border */
  --card-border-hover: var(--accent-color); /* Bright accent border on hover */
  --shadow-card: 0 4px 10px rgba(0, 0, 0, 0.2); /* Softer shadow */
  --shadow-card-hover: 0 7px 20px rgba(0, 0, 0, 0.3); /* Refined hover shadow */

  /* Featured Project Card Specifics (on Index page) */
  --featured-card-bg: linear-gradient(
    145deg,
    #293548,
    var(--card-bg)
  ); /* Slightly lighter */
  --featured-card-border: var(--accent-color); /* Starts with accent border */

  /* Buttons & General */
  --button-bg: var(--accent-color);
  --button-text: #0f172a;
  --button-hover: var(--accent-hover);
  --max-width: 1200px;
  --navbar-height: 60px;
  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 10px;
  --transition-speed: 0.25s;
  --transition-easing: ease-out;
}

/* --- Global Reset & Base --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(
      135deg,
      var(--bg-gradient-start),
      var(--bg-gradient-end)
    )
    fixed;
  color: var(--primary-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color var(--transition-speed) var(--transition-easing);
}
a:hover {
  color: var(--accent-hover);
}
img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}
h1,
h2,
h3,
h4 {
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}
h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}
h2 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
}
h3 {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
}
p {
  margin-bottom: 1rem;
  color: var(--secondary-text);
}

/* --- Navbar --- */
.navbar {
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  height: var(--navbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background-color: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  z-index: 1000;
  transition: background-color var(--transition-speed) ease;
}
.nav-brand {
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--primary-text);
}
.nav-links {
  list-style: none;
  display: flex;
  gap: 2.5rem;
}
.nav-links li a {
  color: var(--primary-text);
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  padding: 0.5rem 0;
}
.nav-links li a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--accent-color);
  transition: width var(--transition-speed) var(--transition-easing);
}
.nav-links li a:hover::after,
.nav-links li a.active::after {
  width: 60%;
}
.nav-links li a.active {
  color: var(--accent-color);
}

/* --- Hero Section (Index Page) --- */
#hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 3rem;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: calc(var(--navbar-height) + 5rem) 2rem 5rem;
  min-height: 90vh;
}
.hero-content {
  flex: 1 1 55%;
  max-width: 650px;
}
.hero-name {
  margin-bottom: 0.75rem;
}
.hero-role {
  font-size: 1.75rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
  color: var(--accent-color);
}
.hero-description {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  color: var(--primary-text);
}
.hero-cta {
  margin-top: 1rem;
}
.hero-image {
  flex: 1 1 35%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.hero-image img {
  width: 300px;
  height: 300px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 50px rgba(56, 189, 248, 0.35);
  border: 4px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.5s ease-in-out;
}

/* --- Page Hero (Subpages) --- */
.page-hero {
  padding: calc(var(--navbar-height) + 4rem) 2rem 4rem;
  text-align: center;
  background: linear-gradient(
    145deg,
    var(--bg-gradient-start),
    var(--bg-gradient-end)
  );
  color: #ffffff;
  border-bottom: 1px solid var(--card-border);
}
.page-hero-content {
  max-width: 850px;
  margin: 0 auto;
}
.page-hero-content h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
  font-weight: 700;
}
.page-hero-content p {
  font-size: 1.15rem;
  color: var(--primary-text);
  max-width: 650px;
  margin: 0 auto;
  line-height: 1.7;
}

/* --- Sections Common Styles --- */
#expertise,
.projects-section,
.articles-section,
#about,
#featured-project {
  background-color: var(--bg-gradient-end);
  color: var(--primary-text);
  padding: 5rem 1.5rem;
}

/* --- Expertise Section Cards (Home Page) --- */
#expertise .section-title {
  text-align: center;
  font-size: 2.25rem;
  margin-bottom: 3.5rem;
  color: #ffffff;
}
.expertise-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  max-width: var(--max-width);
  margin: 0 auto 4rem;
}
.expertise-item {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-speed) var(--transition-easing),
    box-shadow var(--transition-speed) var(--transition-easing),
    border-color var(--transition-speed) var(--transition-easing);
}
.expertise-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--card-border-hover);
}
.expertise-item h3 {
  margin-bottom: 1rem;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
}
.expertise-item h3 i {
  color: var(--accent-color);
  font-size: 1.4rem;
  width: 24px;
  text-align: center;
  transition: transform var(--transition-speed) ease;
}
.expertise-item:hover h3 i {
  transform: scale(1.1);
}
.expertise-item p {
  color: var(--secondary-text);
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 0;
}

/* --- Expertise CTA Section (Home Page) --- */
.expertise-cta {
  font-size: 1.1rem;
  color: var(--primary-text);
  line-height: 1.7;
  margin-bottom: 0;
  text-align: justify; /* <<< SET TO JUSTIFY */
  hyphens: auto;
  max-width: 800px;
  margin: 4rem auto 0; /* Centers the block */
  padding: 2.5rem;
}
.expertise-cta h2 {
  font-size: 1.8rem; /* Adjusted from previous */
  margin-bottom: 1.5rem; /* Space after h2 */
  color: #ffffff;
  text-align: center; /* Ensure h2 is centered */
}
.expertise-cta p {
  font-size: 1.05rem;
  color: var(--secondary-text);
  margin-bottom: 2rem; /* Space before button */
  line-height: 1.7;
  max-width: 650px; /* Limit line length */
  margin-left: auto; /* Center paragraph block */
  margin-right: auto;
}
/* CTA Button style is handled by the generic .cta-button rule */

/* --- Featured Project Section (Home Page) --- */
#featured-project {
  padding-top: 0;
  margin-top: -1rem;
}
.featured-title {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 2.5rem;
  color: #ffffff;
}
.featured-project-card {
  background: var(--featured-card-bg);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--featured-card-border);
  box-shadow: var(--shadow-card-hover);
  padding: 2rem 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  align-items: center;
  overflow: hidden;
  transition: box-shadow var(--transition-speed) ease;
  max-width: var(--max-width);
  margin: 0 auto;
}
.featured-project-card:hover {
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4);
}
.featured-project-content {
  flex: 1 1 55%;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.featured-project-content h3 {
  font-size: 1.8rem;
  color: #ffffff;
  margin-bottom: 1rem;
}
.featured-project-description {
  font-size: 1rem;
  color: var(--secondary-text);
  margin-bottom: 1.5rem;
  line-height: 1.7;
  flex-grow: 1;
}
.featured-project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 1rem;
}
.featured-cta {
  padding: 0.8rem 2rem;
  font-size: 0.95rem;
  margin-top: 1rem;
}
.featured-project-visual {
  flex: 1 1 35%;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 250px;
}
.featured-project-visual img {
  border-radius: var(--border-radius-md);
  border: 1px solid var(--card-border);
  max-height: 300px;
  width: auto;
  object-fit: contain;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition-speed) ease;
}
.featured-project-visual img:hover {
  transform: scale(1.03);
}

/* --- Generic CTA Button --- */
.cta-button {
  background-color: var(--button-bg);
  color: var(--button-text) !important;
  padding: 0.9rem 2.2rem;
  border-radius: 50px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--transition-speed) ease,
    transform var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease;
  display: inline-block;
  box-shadow: 0 5px 15px rgba(56, 189, 248, 0.25);
}
.cta-button:hover {
  background-color: var(--button-hover);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(56, 189, 248, 0.35);
}

/* --- Project & Article Cards (Wider Layout Style) --- */
.projects-container,
.articles-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  gap: 3rem;
  /* ** KEY CHANGE for wider cards ** */
  grid-template-columns: repeat(
    auto-fit,
    minmax(480px, 1fr)
  ); /* Aim for ~2 columns */
}

.project-card,
.article-card {
  background-color: var(--card-bg);
  color: var(--primary-text);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-card);
  padding: 0; /* Padding handled by internal wrapper */
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-speed) var(--transition-easing),
    box-shadow var(--transition-speed) var(--transition-easing),
    border-color var(--transition-speed) var(--transition-easing);
  overflow: hidden;
}

.project-card:hover,
.article-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--card-border-hover);
}

/* Wrapper for text content inside the card */
.project-card-content,
.article-card-content {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex-grow: 1;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.card-title {
  font-size: 1.45rem;
  margin: 0;
  color: #ffffff;
  font-weight: 600;
  line-height: 1.3;
}

.github-btn,
.medium-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--secondary-text);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius-md);
  text-decoration: none;
  font-size: 1.1rem;
  transition: background-color var(--transition-speed) ease,
    color var(--transition-speed) ease, transform var(--transition-speed) ease;
  flex-shrink: 0;
}

.github-btn:hover,
.medium-btn:hover {
  background-color: var(--accent-color);
  color: #ffffff;
  transform: scale(1.05);
}

.card-description {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--secondary-text);
  margin: 0;
  flex-grow: 1;
}

.tech-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 1rem;
}

.tech-badge {
  background-color: rgba(56, 189, 248, 0.12);
  color: var(--accent-color);
  font-size: 0.8rem;
  padding: 0.35rem 0.8rem;
  border-radius: 15px;
  font-weight: 500;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

/* Media container styling (Image/Video at bottom) */
.card-video,
.card-image {
  height: 240px;
  overflow: hidden;
  background-color: #111827;
  position: relative;
  margin-top: auto; /* Ensures it's at the bottom */
}

.card-video video,
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s var(--transition-easing), filter 0.4s ease;
  filter: brightness(0.95);
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

.project-card:hover .card-video video,
.project-card:hover .card-image img,
.article-card:hover .card-video video,
.article-card:hover .card-image img {
  transform: scale(1.03);
  filter: brightness(1.05);
}

/* --- About Section --- */
#about .section-container {
  max-width: 900px;
  margin: 0 auto;
  text-align: left;
}
#about h2 {
  font-size: 2rem;
  margin-bottom: 2rem;
  color: #ffffff;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--accent-color);
  display: inline-block;
}
#about p {
  color: var(--secondary-text);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}
.education-list,
.experience-list {
  list-style: none;
  padding-left: 0;
  margin: 1rem 0 2.5rem 0;
}
.education-list li,
.experience-list li {
  margin-bottom: 0.8rem;
  font-size: 1rem;
  color: var(--secondary-text);
  position: relative;
  padding-left: 1.75rem;
}
.experience-list li::before {
  content: '✓';
  color: var(--accent-color);
  font-weight: bold;
  position: absolute;
  left: 0;
  top: 1px;
  font-size: 1.1rem;
}
.education-list li strong a {
  color: var(--primary-text);
  font-weight: 600;
}
.education-list li strong a:hover {
  color: var(--accent-color);
}
.experience {
  margin-bottom: 3rem;
}
.experience h4 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: #ffffff;
}
.experience p em {
  color: var(--accent-color);
  font-style: normal;
  font-weight: 500;
  display: block;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}
.experience p {
  color: var(--secondary-text);
  margin-bottom: 1rem;
}
hr {
  border: none;
  border-top: 1px solid var(--card-border);
  margin: 3.5rem 0;
}

/* --- Footer --- */
footer {
  background-color: var(--bg-gradient-start);
  color: var(--primary-text);
  text-align: center;
  padding: 3.5rem 1rem;
  margin-top: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.footer-connect ul {
  display: flex;
  justify-content: center;
  gap: 1.75rem;
  list-style: none;
  margin-bottom: 1.5rem;
}
.footer-connect ul li a {
  color: var(--secondary-text);
  font-size: 1.6rem;
  transition: color var(--transition-speed) ease,
    transform var(--transition-speed) ease;
}
.footer-connect ul li a:hover {
  color: var(--accent-color);
  transform: translateY(-3px) scale(1.1);
}
.footer-bottom {
  font-size: 0.9rem;
  color: var(--secondary-text);
}
.footer-bottom a {
  color: var(--secondary-text);
  text-decoration: none;
  margin-left: 0.5rem;
}
.footer-bottom a:hover {
  color: var(--accent-color);
  text-decoration: underline;
}

.card-header .github-stars {
  margin-right: 0.07em; /* réduit l’espace à l’essentiel */
}

.github-star-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.27em; /* étoile & chiffre rapprochés aussi */
  background: rgba(255, 255, 255, 0.08);
  color: #ffd700;
  font-size: 0.97em;
  font-weight: 600;
  padding: 2px 8px 2px 6px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.04);
  transition: background 0.22s;
}

.github-stars {
  margin-left: 0.5em;
  min-width: 48px;
}

.github-star-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  color: #ffd700;
  font-size: 0.97em;
  font-weight: 600;
}

.github-star-badge .fa-star {
  font-size: 1.03em;
  margin-right: 4px;
}

/* --- Responsive Design Adjustments --- */
@media (max-width: 1024px) {
  .projects-container,
  .articles-container {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  }
}

@media (max-width: 900px) {
  .projects-container,
  .articles-container {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  #about .section-container {
    max-width: 95%;
  }
}

@media (max-width: 768px) {
  body {
    line-height: 1.55;
  }
  .navbar {
    padding: 0 1rem;
  }
  .nav-links {
    gap: 1.25rem;
  } /* Consider hiding links */
  #hero {
    padding: calc(var(--navbar-height) + 3rem) 1rem 4rem;
  }
  #hero .hero-image img {
    width: 180px;
    height: 180px;
  }
  .page-hero {
    padding: calc(var(--navbar-height) + 2.5rem) 1rem 2.5rem;
  }
  .page-hero-content h1 {
    font-size: 2rem;
  }
  #expertise,
  .projects-section,
  .articles-section,
  #about,
  #featured-project {
    padding: 4rem 1rem;
  }
  .section-title,
  #about h2,
  .featured-title {
    font-size: 1.8rem;
    margin-bottom: 2.5rem;
  }
  .expertise-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .expertise-item {
    padding: 1.5rem;
  }

  /* Single column already forced by 900px breakpoint */
  .project-card,
  .article-card {
    /* No padding on card */
  }
  .project-card-content,
  .article-card-content {
    padding: 1.5rem;
    gap: 1rem;
  }
  .card-title {
    font-size: 1.25rem;
  }
  .card-description {
    font-size: 0.9rem;
  }
  .card-video,
  .card-image {
    height: 200px;
  }
  .tech-badges {
    gap: 0.4rem;
    margin-top: 0.8rem;
    padding-top: 0;
  }
  .tech-badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.6rem;
  }
  .experience h4 {
    font-size: 1.3rem;
  }
  .experience p em {
    font-size: 1rem;
  }
  hr {
    margin: 2.5rem 0;
  }
  footer {
    padding: 2.5rem 1rem;
  }

  /* Featured Project Responsive */
  .featured-project-card {
    padding: 1.5rem;
    flex-direction: column;
    gap: 1.5rem;
  }
  .featured-project-content h3 {
    font-size: 1.5rem;
  }
  .featured-project-visual {
    order: -1;
    margin-bottom: 1rem;
    width: 100%;
  }
  .featured-project-visual img {
    max-height: 200px;
  }
}

/* End of styles.css */
