/* ============================================================
   Home portail (/) — styles propres à la page d'accueil.
   Dépend des tokens d'auto.css et des composants edito de
   landings-shared.css. Le bloc .catalog-card est extrait de
   apprendre/assets/learn.css (130 Ko, trop lourd pour la home).
   ============================================================ */

/* ---------- Hero deux colonnes : texte + avatar terminal ---------- */
.home-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 48px;
  align-items: center;
}
@media (max-width: 880px) {
  .home-hero-grid { grid-template-columns: 1fr; }
  .home-hero-side { display: none; }
}

/* Fenêtre terminal autour de l'avatar : le détail mémorable */
.home-terminal {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(58, 170, 100, 0.12);
}
.home-terminal-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.home-terminal-bar span:nth-child(-n+3) {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.home-terminal-bar span:nth-child(1) { background: #ff5f57; }
.home-terminal-bar span:nth-child(2) { background: #febc2e; }
.home-terminal-bar span:nth-child(3) { background: #28c840; }
.home-terminal-title {
  margin-left: 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.home-terminal-body {
  padding: 22px 18px 18px;
  text-align: center;
}
.home-terminal-body img {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: 2px solid rgba(58, 170, 100, 0.55);
  box-shadow: 0 0 0 6px rgba(58, 170, 100, 0.12);
}
.home-terminal-line {
  margin: 16px 0 0;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.72);
  text-align: left;
}
.home-terminal-line .prompt { color: var(--color-accent); }
.home-terminal-line .ok { color: #28c840; }

/* Stats dynamiques sous le hero */
.home-stats {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-wrap: wrap;
  gap: 18px 44px;
}
.home-stat {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.03em;
}
.home-stat strong {
  display: block;
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--color-accent);
  line-height: 1.2;
}
@media (max-width: 600px) {
  .home-stats {
    display: grid;
    grid-template-columns: repeat(3, auto);
    justify-content: space-between;
    gap: 18px 16px;
  }
  .home-stat strong { font-size: 1.25rem; }
}

/* Preuve externe au hero (GitHub / LinkedIn / dev.to) */
.home-hero-proof {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.home-hero-proof a {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}
.home-hero-proof a:hover {
  border-color: var(--color-accent);
  color: #fff;
}

/* Bandeau « Nouveau » : dernier article publié, alimenté par posts.json */
.home-new-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 6px 14px;
  padding: 12px 24px;
  background: var(--color-accent-light, rgba(50, 158, 90, 0.08));
  border-bottom: 1px solid rgba(50, 158, 90, 0.18);
  text-decoration: none;
}
.home-new-banner:hover .home-new-banner-title { text-decoration: underline; }
.home-new-banner-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent-dark, #267d42);
  white-space: nowrap;
}
.home-new-banner-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--color-ink, #0f1923);
}

/* Ligne de maillage vers les autres cours */
.home-more-courses {
  margin: 24px 0 0;
  font-size: 0.92rem;
  line-height: 1.9;
  color: var(--color-text-muted);
}
.home-more-courses a {
  color: var(--color-accent-dark, #267d42);
  text-decoration: none;
  font-weight: 600;
}
.home-more-courses a:hover { text-decoration: underline; }

/* ---------- Cartes catalogue (extrait de learn.css) ---------- */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 36px;
}
@media (max-width: 700px) {
  .catalog-grid { grid-template-columns: 1fr; }
}
.catalog-card {
  display: block;
  padding: 28px 24px;
  background: #fff;
  border: 1px solid var(--color-card-border);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
  position: relative;
  overflow: hidden;
}
.catalog-card-logo {
  position: absolute;
  bottom: 12px;
  right: 14px;
  width: 44px;
  height: 44px;
  opacity: 0.7;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.catalog-card:hover .catalog-card-logo { opacity: 1; transform: scale(1.06); }
.catalog-card-logo.logo-js { fill: #f7df1e; }
.catalog-card-logo.logo-go { fill: #00add8; }
.catalog-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 8px 24px rgba(15, 25, 35, 0.06);
  transform: translateY(-2px);
  text-decoration: none;
}
.catalog-card:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}
.catalog-card-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #267d42;
  margin-bottom: 12px;
  display: block;
}
.catalog-card-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-ink, #0f1923);
  margin: 0 0 8px;
  line-height: 1.25;
}
.catalog-card-title em {
  font-family: var(--font-edito);
  font-style: italic;
  font-weight: 600;
  color: var(--color-accent);
}
.catalog-card-desc {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.55;
  margin: 0 0 16px;
}
.catalog-card-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}
/* #267d42 et non --color-accent : 5.1:1 sur blanc, AA pour ce petit corps */
.catalog-card-meta strong { color: var(--color-accent-dark, #267d42); font-weight: 600; }
.catalog-card-icon-wrap {
  width: 40px;
  height: 40px;
  background: var(--color-accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  color: #fff;
}
.catalog-card-icon-wrap svg { width: 22px; height: 22px; }

/* ---------- Alignement des sections ----------
   landings-shared centre les titres/ledes dans un bloc de 880 px alors que
   les grilles occupent toute la largeur du section-inner : on aligne tout
   sur le bord gauche du conteneur. */
#main-content .section-title--edito,
#main-content .section-lede {
  max-width: 880px;
  margin-left: 0 !important;
  margin-right: 0;
}
#main-content .section-lede { margin-bottom: 8px; }
#main-content .section--dark .section-title--edito,
#main-content .section--dark .section-lede {
  text-align: left !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* tools-grid (landings-shared) embarque son propre padding de section :
   neutralisé ici car la grille vit déjà dans un section-inner. */
.section-inner .tools-grid {
  padding: 0;
  max-width: none;
  margin-top: 36px;
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 980px) {
  .section-inner .tools-grid { grid-template-columns: 1fr; }
}

/* ---------- Liens de fin de section ---------- */
.home-section-links {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  align-items: center;
}
.home-section-links a {
  font-weight: 600;
  color: var(--color-accent-dark, #267d42);
  text-decoration: none;
}
.home-section-links a:hover { text-decoration: underline; }

/* ---------- Articles récents ---------- */
.home-posts {
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 880px) {
  .home-posts { grid-template-columns: 1fr; }
}
.home-post {
  display: flex;
  flex-direction: column;
  padding: 26px 24px;
  background: #fff;
  border: 1px solid var(--color-card-border);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}
.home-post:hover {
  border-color: var(--color-accent);
  box-shadow: 0 8px 24px rgba(15, 25, 35, 0.06);
  transform: translateY(-2px);
  text-decoration: none;
}
.home-post:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 3px; }
.home-post-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent-dark, #267d42);
  margin-bottom: 10px;
}
.home-post-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--color-ink, #0f1923);
  margin: 0 0 10px;
}
.home-post-excerpt {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--color-text-muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Bibliothèque (section sombre) ---------- */
.home-books {
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 880px) {
  .home-books { grid-template-columns: 1fr; }
}
.home-book {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  padding: 22px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.25s, background 0.25s, transform 0.25s;
}
.home-book:hover {
  border-color: var(--color-accent);
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-2px);
  text-decoration: none;
}
.home-book:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 3px; }
.home-book img {
  width: 64px;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}
.home-book-rating {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--color-accent);
  letter-spacing: 0.06em;
}
.home-book-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.98rem;
  color: #fff;
  margin: 6px 0 8px;
  line-height: 1.3;
}
.home-book-punchline {
  font-family: var(--font-edito);
  font-style: italic;
  font-size: 0.88rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.65);
  margin: 0;
}

/* ---------- À propos condensé ---------- */
.home-about {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  max-width: 880px;
  margin: 36px auto 0;
}
@media (max-width: 700px) {
  .home-about { grid-template-columns: 1fr; justify-items: center; }
  .home-about-text { text-align: left; }
}
.home-about-avatar img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid var(--color-accent-light, rgba(50, 158, 90, 0.2));
}
.home-about-text p {
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--color-text);
  margin: 0 0 14px;
}
.home-about-text p strong { color: var(--color-accent-dark, #267d42); }
.home-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 26px;
}
.home-proof a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 7px 14px;
  border: 1px solid var(--color-card-border);
  border-radius: 999px;
  color: var(--color-accent-dark, #267d42);
  background: #fff;
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.home-proof a:hover {
  border-color: var(--color-accent);
  box-shadow: 0 4px 12px rgba(15, 25, 35, 0.06);
}
.home-about-status {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  color: var(--color-accent-dark, #267d42);
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.home-about-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #28c840;
  box-shadow: 0 0 0 3px rgba(40, 200, 64, 0.2);
}

/* ---------- Entrée en scène du hero (CSS only, sobre) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero--edito .hero-eyebrow--edito,
  .hero--edito .hero-title--edito,
  .hero--edito .hero-subtitle--edito,
  .hero--edito .hero-cta,
  .hero--edito .lang-switch,
  .home-hero-side,
  .home-stats {
    animation: home-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .hero--edito .hero-title--edito { animation-delay: 0.06s; }
  .hero--edito .hero-subtitle--edito { animation-delay: 0.12s; }
  .hero--edito .hero-cta { animation-delay: 0.18s; }
  .hero--edito .lang-switch { animation-delay: 0.22s; }
  .home-hero-side { animation-delay: 0.16s; }
  .home-stats { animation-delay: 0.28s; }
}
@keyframes home-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Divers ---------- */
.home-section-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-accent-dark, #267d42);
  color: #fff;
  padding: 10px 18px;
  z-index: 100;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }
