/* --- Réinitialisation légère --- */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f5f6fa;
  color: #1c1c1e;
}

/* --- Header --- */
.site-header {
  position: relative;
  color: #ffffff;
  padding: 34px 20px 50px;
  text-align: center;
  overflow: hidden;
  /* Bord inférieur incliné au lieu d'un rectangle plat */
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 92%);
  background:
    linear-gradient(90deg, #123312, #21a321, #123312) top / 100% 3px no-repeat,
    radial-gradient(circle at 1px 1px, rgba(33, 163, 33, 0.22) 1px, transparent 0) 0 0 / 24px 24px,
    #14161a;
}

/* Halos verts décoratifs, façon "glow" logiciel/tech, très discrets */
.site-header::before,
.site-header::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(55px);
  pointer-events: none;
  z-index: 0;
}

.site-header::before {
  width: 220px;
  height: 220px;
  top: -100px;
  left: -60px;
  background: rgba(33, 163, 33, 0.35);
}

.site-header::after {
  width: 260px;
  height: 260px;
  bottom: -150px;
  right: -70px;
  background: rgba(33, 163, 33, 0.22);
}

.header-logo,
.tagline {
  position: relative;
  z-index: 1;
}

.header-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 1rem;
  font-weight: 700;
  color: #21a321;
  background-color: rgba(33, 163, 33, 0.12);
  border: 1px solid rgba(33, 163, 33, 0.4);
  border-radius: 8px;
}

.site-header h1 {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.site-header h1 a {
  color: #ffffff;
  text-decoration: none;
}

.brand-accent {
  color: #21a321;
}

.tagline {
  margin: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
  color: #9a9fa6;
}

.tagline::before {
  content: "$ ";
  color: #21a321;
}

/* --- Contenu principal --- */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

/* --- Recherche --- */
#search-section {
  margin-bottom: 20px;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background-color: #ffffff;
  border: 1px solid #d1d1d6;
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.35s ease, transform 0.2s ease;
}

/* Effet de balayage/reflet, déclenché une fois au focus */
.search-wrapper::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(33, 163, 33, 0.28) 45%, transparent 65%);
  background-size: 220% 100%;
  background-position: -160% 0;
  transition: background-position 0.7s ease;
  pointer-events: none;
}

.search-wrapper:focus-within {
  border-color: #21a321;
  /* Légère lueur verte, sans effet néon agressif */
  box-shadow: 0 0 0 3px rgba(33, 163, 33, 0.14), 0 0 14px rgba(33, 163, 33, 0.3);
  transform: translateY(-1px);
}

.search-wrapper:focus-within::before {
  background-position: 160% 0;
}

.search-icon {
  width: 18px;
  height: 18px;
  margin-left: 14px;
  color: #8e8e93;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: color 0.25s ease, transform 0.25s ease;
}

.search-wrapper:focus-within .search-icon {
  color: #21a321;
  transform: scale(1.08);
}

#search-input {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 12px 16px 12px 10px;
  font-size: 1rem;
  border: none;
  outline: none;
  background: transparent;
  color: #1c1c1e;
}

/* --- Catégories --- */
#categories {
  margin-bottom: 24px;
  padding: 4px 0 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-btn {
  background-color: transparent;
  border: 1px solid #e2e2e6;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #8e8e93;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.category-btn:hover {
  color: #21a321;
  border-color: rgba(33, 163, 33, 0.4);
  background-color: rgba(33, 163, 33, 0.06);
}

.category-btn.active {
  background-color: #21a321;
  border-color: #21a321;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(33, 163, 33, 0.28);
}

.category-btn:active {
  transform: scale(0.96);
}

/* --- Grille d'applications --- */
#apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

/* --- Carte d'application --- */
.app-card {
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
  border-radius: 14px;
  padding: 18px;
  text-align: left;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  border: 1px solid #ececef;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.app-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(33, 163, 33, 0.16), 0 2px 6px rgba(0, 0, 0, 0.04);
  border-color: rgba(33, 163, 33, 0.45);
}

.app-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.app-icon {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 12px;
  background-color: #e5e5ea;
  border: 1px solid #ececef;
  flex-shrink: 0;
  transition: border-color 0.25s ease;
}

.app-card:hover .app-icon {
  border-color: rgba(33, 163, 33, 0.4);
}

.app-card-heading {
  min-width: 0;
}

.app-name {
  margin: 0 0 3px 0;
  font-size: 1.02rem;
  font-weight: 600;
  color: #1c1c1e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-card .app-category {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #21a321;
  background-color: rgba(33, 163, 33, 0.1);
  padding: 2px 8px;
  border-radius: 20px;
}

.app-card .app-description {
  margin: 0 0 14px 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #6e6e73;
  /* Limite la description à 2 lignes pour garder des cartes homogènes */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #f0f0f2;
}

.app-card-cta {
  font-size: 0.78rem;
  font-weight: 600;
  color: #48484a;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  transition: color 0.2s ease;
}

.app-card:hover .app-card-cta {
  color: #21a321;
}

.app-card-arrow {
  width: 16px;
  height: 16px;
  color: #8e8e93;
  transition: color 0.2s ease, transform 0.25s ease;
}

.app-card:hover .app-card-arrow {
  color: #21a321;
  transform: translateX(3px);
}

/* --- Lien retour --- */
.detail-page {
  max-width: 760px;
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  margin-left: -10px;
  padding: 8px 14px 8px 10px;
  border-radius: 8px;
  color: #48484a;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.back-link:hover {
  background-color: rgba(33, 163, 33, 0.08);
  color: #21a321;
}

.back-arrow {
  font-size: 1.35rem;
  line-height: 1;
  color: #21a321;
  transition: transform 0.2s ease;
}

.back-link:hover .back-arrow {
  transform: translateX(-3px);
}

.back-text {
  font-size: 0.88rem;
  font-weight: 600;
}

/* --- Page de détail --- */
#app-detail {
  background-color: #ffffff;
  border-radius: 16px;
  padding: 28px;
  border: 1px solid #ececef;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.app-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid #f0f0f2;
}

.app-icon-large {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 20px;
  background-color: #e5e5ea;
  border: 1px solid #ececef;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.app-header h2 {
  margin: 0 0 6px 0;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #1c1c1e;
}

.app-header .app-category {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #21a321;
  background-color: rgba(33, 163, 33, 0.1);
  padding: 3px 10px;
  border-radius: 20px;
}

#app-detail .app-description {
  margin: 0 0 20px 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #48484a;
}

/* Informations clés présentées en cartes façon fiche technique */
.app-infos {
  list-style: none;
  padding: 0;
  margin: 0 0 24px 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.app-infos li {
  background-color: #f7f8fa;
  border: 1px solid #ececef;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.85rem;
  color: #1c1c1e;
}

.app-infos li strong {
  display: block;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #21a321;
  margin-bottom: 3px;
}

.download-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  background-color: #21a321;
  color: #ffffff;
  border: none;
  padding: 15px 30px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 28px;
  box-shadow: 0 6px 18px rgba(33, 163, 33, 0.35);
  transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

/* Icône de téléchargement intégrée (SVG en CSS, aucun fichier externe) */
.download-btn::before {
  content: "";
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12'/%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3Cpath d='M5 21h14'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

/* Léger effet de balayage lumineux, déclenché uniquement au survol */
.download-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
  pointer-events: none;
}

.download-btn:hover {
  background-color: #1a821a;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(33, 163, 33, 0.42);
}

.download-btn:hover::after {
  left: 130%;
}

.download-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 4px 12px rgba(33, 163, 33, 0.3);
}

.screenshots-heading {
  margin: 0 0 12px 0;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8e8e93;
}

.screenshots {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x proximity;
}

.screenshot {
  height: 180px;
  border-radius: 12px;
  background-color: #e5e5ea;
  border: 1px solid #ececef;
  flex-shrink: 0;
  scroll-snap-align: start;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.screenshot:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* --- Footer --- */
footer {
  text-align: center;
  padding: 20px;
  color: #8e8e93;
  font-size: 0.85rem;
}

/* --- Responsive mobile --- */
@media (max-width: 600px) {
  .site-header {
    padding: 22px 12px 32px;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 95%);
  }

  .site-header::before,
  .site-header::after {
    width: 140px;
    height: 140px;
    filter: blur(35px);
  }

  .logo-mark {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
  }

  .site-header h1 {
    font-size: 1.35rem;
  }

  .tagline {
    font-size: 0.75rem;
  }

  main {
    padding: 12px;
  }

  /* Une seule colonne sur mobile */
  #apps-grid {
    grid-template-columns: 1fr;
  }

  /* Catégories en scroll horizontal plutôt qu'en retour à la ligne */
  #categories {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 8px;
    gap: 10px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .category-btn {
    flex-shrink: 0;
    /* Zone tactile agrandie pour un usage confortable au doigt */
    padding: 11px 16px;
    scroll-snap-align: start;
  }

  /* Page de détail : icône + titre empilés */
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 14px;
  }

  .app-icon-large {
    width: 72px;
    height: 72px;
  }

  #app-detail {
    padding: 18px;
  }

  .app-infos {
    grid-template-columns: 1fr 1fr;
  }

  .download-btn {
    width: 100%;
    justify-content: center;
  }

  .screenshot {
    height: 120px;
  }
}
