/* ==================================================
   MOBILE IMPROVEMENTS - Portfolio Ismail Moudden
   Date: Janvier 2026
   Description: Améliorations spécifiques pour mobile
================================================== */

/* ==================================================
   PHASE 5: SOCIAL LINKS - Ajuster pour 4 boutons
================================================== */

/* Desktop - 4 boutons en ligne */
.hero__buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.hero__buttons .btn {
  flex: 0 1 auto;
}

/* ==================================================
   PHASE 1: HERO SECTION MOBILE
================================================== */

@media screen and (max-width: 768px) {
  /* Container en colonne */
  .hero__container {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }
  
  /* Photo ronde en haut */
  .hero__img-container {
    display: flex;
    justify-content: center;
    order: -1; /* Met la photo en premier */
    margin-bottom: 1.5rem;
  }
  
  .hero__img {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary);
    box-shadow: 0 10px 30px rgba(58, 134, 255, 0.3);
    transition: transform 0.3s ease;
  }
  
  .hero__img:hover {
    transform: scale(1.05);
  }
  
  /* Contenu centré */
  .hero__content {
    max-width: 100%;
    text-align: center;
    padding: 0 1rem;
    animation: fadeIn 0.8s ease forwards;
  }
  
  /* Titre */
  .hero__content h1 {
    font-size: 1.8rem;
    line-height: 1.3;
    margin-bottom: 1rem;
    text-align: center;
  }
  
  /* Subtitle */
  .hero__subtitle {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    text-align: center;
  }
  
  /* Tagline */
  .hero__tagline {
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
    text-align: center;
  }
  
  /* Description avec mots en gras */
  .hero__description {
    font-size: 0.95rem;
    line-height: 1.7;
    text-align: center;
    padding: 0 0.5rem;
    margin-bottom: 2rem;
  }
  
  .hero__description strong {
    font-weight: 700;
    color: var(--primary);
    position: relative;
  }
  
  /* Effet de highlight sur les mots en gras */
  .hero__description strong::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 8px;
    bottom: 0;
    left: 0;
    background-color: rgba(58, 134, 255, 0.15);
    z-index: -1;
  }
  
  /* Boutons empilés */
  .hero__buttons {
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
  }
  
  .hero__buttons .btn {
    width: 100%;
    max-width: 300px;
    justify-content: center;
    padding: 0.85rem 1.5rem;
    font-size: 0.95rem;
  }
  
  /* Icônes dans les boutons */
  .hero__buttons .btn i {
    margin-right: 0.5rem;
  }
}

/* ==================================================
   PHASE 2: PROJECTS SECTION MOBILE
================================================== */

@media screen and (max-width: 768px) {
  /* Grid 2 colonnes */
  .projects__blog-grid--mobile {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
  }
  
  /* Limiter à 4 projets visibles (2 lignes) */
  .projects__blog-grid--mobile .project-blog__card:nth-child(n+5) {
    display: none;
  }
  
  /* Afficher tous les projets quand "See More" est cliqué */
  .projects__blog-grid--mobile.show-all .project-blog__card {
    display: block !important;
  }
  
  /* Ajuster les cartes pour mobile */
  .projects__blog-grid--mobile .project-blog__card {
    padding: 0.75rem;
  }
  
  .projects__blog-grid--mobile .project-blog__title {
    font-size: 0.9rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
  }
  
  .projects__blog-grid--mobile .project-blog__excerpt {
    font-size: 0.75rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  
  .projects__blog-grid--mobile .project-blog__meta {
    font-size: 0.7rem;
    margin-bottom: 0.5rem;
  }
  
  .projects__blog-grid--mobile .project-blog__image {
    height: 120px;
    margin-bottom: 0.75rem;
  }
  
  .projects__blog-grid--mobile .project-blog__tags {
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
  }
  
  .projects__blog-grid--mobile .project-blog__tag {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
  }
  
  .projects__blog-grid--mobile .project-blog__links {
    flex-direction: column;
    gap: 0.3rem;
  }
  
  .projects__blog-grid--mobile .project-blog__link {
    font-size: 0.75rem;
  }
  
  /* Bouton See More - Style moderne avec glassmorphism */
  .projects__see-more--mobile {
    display: flex;
    justify-content: center;
    margin-top: 2.5rem;
    padding: 0 1rem;
  }
  
  .projects__see-more--mobile .btn {
    width: 100%;
    max-width: 280px;
    padding: 1rem 2rem;
    font-size: 0.95rem;
    font-weight: 600;
    gap: 0.75rem;
    background: linear-gradient(135deg, rgba(58, 134, 255, 0.1) 0%, rgba(78, 149, 255, 0.05) 100%);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(58, 134, 255, 0.3);
    border-radius: 16px;
    color: var(--primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(58, 134, 255, 0.15);
    position: relative;
    overflow: hidden;
  }
  
  /* Effet de brillance au survol */
  .projects__see-more--mobile .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
  }
  
  .projects__see-more--mobile .btn:active::before {
    left: 100%;
  }
  
  .projects__see-more--mobile .btn:active {
    transform: scale(0.97);
    background: linear-gradient(135deg, rgba(58, 134, 255, 0.2) 0%, rgba(78, 149, 255, 0.1) 100%);
    border-color: rgba(58, 134, 255, 0.5);
    box-shadow: 0 2px 10px rgba(58, 134, 255, 0.25);
  }
  
  /* Masquer le bouton si tous les projets sont visibles */
  .projects__see-more--mobile.hidden {
    display: none;
  }
  
  /* Animation du chevron */
  .projects__see-more--mobile .btn i {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .projects__see-more--mobile .btn:active i {
    transform: translateY(4px) scale(1.1);
  }
}

/* Masquer sur desktop */
@media screen and (min-width: 769px) {
  .projects__see-more--mobile {
    display: none;
  }
}

/* ==================================================
   PHASE 3: KNOWLEDGE CARDS MOBILE
================================================== */

@media screen and (max-width: 768px) {
  /* Grid 2 colonnes */
  .knowledge__grid--mobile {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
  }
  
  /* Limiter à 4 cartes visibles (2 lignes) */
  .knowledge__grid--mobile .knowledge__card:nth-child(n+5) {
    display: none;
  }
  
  /* Afficher toutes les cartes quand "See More" est cliqué */
  .knowledge__grid--mobile.show-all .knowledge__card {
    display: block !important;
  }
  
  /* Ajuster la taille des cartes */
  .knowledge__grid--mobile .knowledge__card {
    padding: 1rem;
    font-size: 0.85rem;
  }
  
  .knowledge__grid--mobile .knowledge__title {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    line-height: 1.2;
  }
  
  .knowledge__grid--mobile .knowledge__source {
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
  }
  
  .knowledge__grid--mobile .knowledge__description {
    font-size: 0.75rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  
  .knowledge__grid--mobile .knowledge__tags {
    flex-wrap: wrap;
    gap: 0.3rem;
  }
  
  .knowledge__grid--mobile .knowledge__tag {
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
  }
  
  /* Bouton See More - Style moderne avec glassmorphism */
  .knowledge__see-more--mobile {
    display: flex;
    justify-content: center;
    margin-top: 2.5rem;
    padding: 0 1rem;
  }
  
  .knowledge__see-more--mobile .btn {
    width: 100%;
    max-width: 280px;
    padding: 1rem 2rem;
    font-size: 0.95rem;
    font-weight: 600;
    gap: 0.75rem;
    background: linear-gradient(135deg, rgba(58, 134, 255, 0.1) 0%, rgba(78, 149, 255, 0.05) 100%);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(58, 134, 255, 0.3);
    border-radius: 16px;
    color: var(--primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(58, 134, 255, 0.15);
    position: relative;
    overflow: hidden;
  }
  
  /* Effet de brillance au survol */
  .knowledge__see-more--mobile .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
  }
  
  .knowledge__see-more--mobile .btn:active::before {
    left: 100%;
  }
  
  .knowledge__see-more--mobile .btn:active {
    transform: scale(0.97);
    background: linear-gradient(135deg, rgba(58, 134, 255, 0.2) 0%, rgba(78, 149, 255, 0.1) 100%);
    border-color: rgba(58, 134, 255, 0.5);
    box-shadow: 0 2px 10px rgba(58, 134, 255, 0.25);
  }
  
  /* Masquer le bouton si toutes les cartes sont visibles */
  .knowledge__see-more--mobile.hidden {
    display: none;
  }
  
  /* Animation du chevron */
  .knowledge__see-more--mobile .btn i {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .knowledge__see-more--mobile .btn:active i {
    transform: translateY(4px) scale(1.1);
  }
  
  /* Masquer le bouton See More desktop sur mobile */
  .see-more-container {
    display: none;
  }
}

/* Masquer sur desktop */
@media screen and (min-width: 769px) {
  .knowledge__see-more--mobile {
    display: none;
  }
}

/* ==================================================
   PHASE 4: EDUCATION SECTION MOBILE
================================================== */

@media screen and (max-width: 768px) {
  /* Layout vertical simplifié */
  .education__grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .education__row {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  /* Masquer les lignes de connexion sur mobile */
  .connection-line {
    display: none !important;
  }
  
  /* Cartes pleine largeur */
  .education__card {
    width: 100%;
    max-width: 100%;
    padding: 1.5rem;
  }
  
  .education__card--left,
  .education__card--right,
  .education__card--large {
    width: 100%;
    max-width: 100%;
  }
  
  /* Centrer le contenu */
  .education__content {
    text-align: center;
  }
  
  .education__title {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
  }
  
  .education__period {
    font-size: 0.85rem;
    margin-bottom: 1rem;
  }
  
  .education__description {
    font-size: 0.9rem;
    line-height: 1.6;
    text-align: center;
  }
  
  /* Ajuster les icônes - CORRECTION CENTRAGE */
  .education__icon-container {
    margin: 0 auto 1rem !important;
    width: 100px;
    height: 100px;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
  }
  
  .education__icon {
    width: 70px !important;
    height: 70px !important;
    max-width: 70px !important;
    max-height: 70px !important;
    object-fit: contain !important;
    object-position: center !important;
    display: block !important;
    margin: 0 auto !important;
    padding: 5px;
  }
  
  /* Forcer le centrage de tout le contenu */
  .education__content {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  .education__header {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  /* Détails */
  .education__details {
    text-align: center;
    margin-top: 1rem;
  }
  
  .education__detail {
    justify-content: center;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
  }
  
  /* Awards */
  .education__awards {
    text-align: center;
  }
  
  .education__award {
    margin-bottom: 1.5rem;
  }
  
  .award__title {
    font-size: 1rem;
    margin-bottom: 0.3rem;
  }
  
  .award__organization {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
  }
  
  .award__description {
    font-size: 0.85rem;
    line-height: 1.5;
  }
}

/* ==================================================
   AMÉLIORATIONS GÉNÉRALES MOBILE
================================================== */

@media screen and (max-width: 768px) {
  /* Améliorer la lisibilité globale */
  body {
    font-size: 16px;
    line-height: 1.6;
  }
  
  /* Padding des sections - Plus d'espace en haut pour éviter la navbar */
  .section {
    padding: 5rem 0 3rem 0;
    scroll-margin-top: 80px;
  }
  
  .container {
    padding: 0 1.5rem;
  }
  
  /* Headers de sections */
  .section__title {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 0.5rem;
    margin-top: 1rem;
  }
  
  .section__subtitle {
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: 2rem;
    padding-top: 0.5rem;
  }
  
  /* Améliorer les contrastes */
  strong {
    font-weight: 700;
  }
  
  /* Boutons plus accessibles sur mobile */
  .btn {
    min-height: 44px;
    font-size: 0.95rem;
  }
  
  /* Espacement entre les sections */
  .section + .section {
    margin-top: 1rem;
  }
}

/* ==================================================
   RESPONSIVE POUR TRÈS PETITS ÉCRANS (< 480px)
================================================== */

@media screen and (max-width: 480px) {
  /* Hero */
  .hero__img {
    width: 160px;
    height: 160px;
  }
  
  .hero__content h1 {
    font-size: 1.5rem;
  }
  
  .hero__description {
    font-size: 0.9rem;
  }
  
  /* Projects et Knowledge: Passer en 1 colonne sur très petits écrans */
  .projects__blog-grid--mobile,
  .knowledge__grid--mobile {
    grid-template-columns: 1fr;
  }
  
  /* Limiter à 2 items visibles sur très petits écrans */
  .projects__blog-grid--mobile .project-blog__card:nth-child(n+3),
  .knowledge__grid--mobile .knowledge__card:nth-child(n+3) {
    display: none;
  }
  
  .projects__blog-grid--mobile.show-all .project-blog__card,
  .knowledge__grid--mobile.show-all .knowledge__card {
    display: block !important;
  }
}

/* ==================================================
   DARK MODE ADJUSTMENTS MOBILE
================================================== */

body.dark-mode {
  @media screen and (max-width: 768px) {
    /* Hero */
    .hero__img {
      border-color: var(--primary-light);
      box-shadow: 0 10px 30px rgba(78, 149, 255, 0.4);
    }
    
    .hero__description strong::after {
      background-color: rgba(78, 149, 255, 0.2);
    }
    
    /* Projects & Knowledge cards */
    .project-blog__card,
    .knowledge__card {
      background-color: var(--bg-alt);
      border-color: rgba(255, 255, 255, 0.1);
    }
    
    /* Boutons See More en dark mode */
    .projects__see-more--mobile .btn,
    .knowledge__see-more--mobile .btn {
      background: linear-gradient(135deg, rgba(78, 149, 255, 0.15) 0%, rgba(58, 134, 255, 0.08) 100%);
      border-color: rgba(78, 149, 255, 0.4);
      color: var(--primary-light);
      box-shadow: 0 4px 15px rgba(78, 149, 255, 0.2);
    }
    
    .projects__see-more--mobile .btn:active,
    .knowledge__see-more--mobile .btn:active {
      background: linear-gradient(135deg, rgba(78, 149, 255, 0.25) 0%, rgba(58, 134, 255, 0.15) 100%);
      border-color: rgba(78, 149, 255, 0.6);
    }
    
    /* Boutons */
    .btn--primary {
      background-color: var(--primary);
      color: white;
    }
    
    .btn--outline {
      border-color: var(--primary);
      color: var(--primary);
    }
  }
}

/* ==================================================
   ANIMATIONS MOBILE
================================================== */

@media screen and (max-width: 768px) {
  /* Fade in animation */
  @keyframes fadeInMobile {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .hero__content,
  .hero__img-container {
    animation: fadeInMobile 0.6s ease forwards;
  }
  
  .hero__img-container {
    animation-delay: 0.2s;
  }
  
  /* Stagger animation pour les cartes */
  .project-blog__card,
  .knowledge__card {
    animation: fadeInMobile 0.5s ease forwards;
    opacity: 0;
  }
  
  .project-blog__card:nth-child(1),
  .knowledge__card:nth-child(1) {
    animation-delay: 0.1s;
  }
  
  .project-blog__card:nth-child(2),
  .knowledge__card:nth-child(2) {
    animation-delay: 0.2s;
  }
  
  .project-blog__card:nth-child(3),
  .knowledge__card:nth-child(3) {
    animation-delay: 0.3s;
  }
  
  .project-blog__card:nth-child(4),
  .knowledge__card:nth-child(4) {
    animation-delay: 0.4s;
  }
}
