/**
 * wp-home.css
 * web/themes/custom/wallpaper_ui/css/wp-home.css
 *
 * Grille page d'accueil — 3 niveaux, hauteur commune = 1 unité
 * Unité = 1/3 de la largeur du conteneur (carré parfait)
 */

/* ── Variables locales ─────────────────────────────────────────── */
.wp-home {
  --unit: calc(var(--wp-home-width, 100vw) / 3);
  --gap: 1px;
  --color-stat-bg:    #2D3D2F;
  --color-stat-text:  #e0dbd0;
  --color-meth-bg:    #3D4E3F;
  --color-meth-text:  #e0dbd0;
  --color-proj-bg:    #4a5c4c;
  --color-proj-text:  #e0dbd0;
  --color-bib-bg:     #e8e4dc;
  --color-bib-text:   #2D3D2F;
  --color-part-bg:    #d8d2c6;
  --color-part-text:  #2D3D2F;
  --color-feat-bg:    #1a1a18;
  --color-feat-text:  rgba(255,255,255,.4);
  --serif: var(--wp-font-serif, 'Georgia', serif);
  --trans: .22s ease;
}

/* ── Conteneur ─────────────────────────────────────────────────── */
.wp-home {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  background: #ccc; /* gap color */
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* ── Ligne commune ─────────────────────────────────────────────── */
.wp-home__row {
  display: grid;
  gap: var(--gap);
  background: #ccc;
}

/* N1 — 3 colonnes égales */
.wp-home__row--stats {
  grid-template-columns: repeat(3, 1fr);
}

/* N2 — 1 + 2 */
.wp-home__row--main {
  grid-template-columns: 1fr 2fr;
}

/* N3 — 3 colonnes égales */
.wp-home__row--secondary {
  grid-template-columns: repeat(3, 1fr);
}

/* ── Hauteur : chaque ligne = hauteur d'un carré (1/3 de la largeur) ── */
/* Technique : padding-bottom sur un pseudo-wrapper interne */
.wp-home__stat,
.wp-home__block {
  position: relative;
  overflow: hidden;
}

/* Ratio carré via aspect-ratio */
.wp-home__stat {
  aspect-ratio: 1 / 1;
}

/* N2 : hauteur = 1 unité = même que les carrés
   gauche = carré (1/3), droite = même hauteur mais 2/3 de large */
.wp-home__block--meth {
  aspect-ratio: 1 / 1;
}
.wp-home__block--proj {
  aspect-ratio: 2 / 1;
}

/* N3 : retour aux carrés */
.wp-home__block--bib,
.wp-home__block--part,
.wp-home__block--featured {
  aspect-ratio: 1 / 1;
}

/* ── Statistiques ──────────────────────────────────────────────── */
.wp-home__stat {
  background: var(--color-stat-bg);
  color: var(--color-stat-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
}

.wp-home__stat-label {
  font-size: clamp(8px, 1vw, 11px);
  letter-spacing: .18em;
  text-transform: uppercase;
  opacity: .5;
  font-family: var(--serif);
}

.wp-home__stat-num {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 52px);
  font-weight: 300;
  letter-spacing: -.03em;
  line-height: 1;
  transition: opacity .4s;
}

.wp-home__stat-num.is-loading {
  opacity: .3;
}

.wp-home__stat-sub {
  font-size: clamp(8px, .9vw, 10px);
  opacity: .35;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* ── Blocs liens ───────────────────────────────────────────────── */
.wp-home__block {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(16px, 2.5vw, 36px);
  gap: 6px;
  text-decoration: none;
  transition: opacity var(--trans), transform var(--trans);
}

.wp-home__block:hover {
  opacity: .88;
}

.wp-home__block:hover .wp-home__block-arrow {
  transform: translateX(4px);
}

.wp-home__block--meth {
  background: var(--color-meth-bg);
  color: var(--color-meth-text);
}

.wp-home__block--proj {
  background: var(--color-proj-bg);
  color: var(--color-proj-text);
}

.wp-home__block--bib {
  background: var(--color-bib-bg);
  color: var(--color-bib-text);
}

.wp-home__block--part {
  background: var(--color-part-bg);
  color: var(--color-part-text);
}

/* ── Typographie des blocs ─────────────────────────────────────── */
.wp-home__block-eyebrow {
  font-size: clamp(8px, .9vw, 10px);
  letter-spacing: .18em;
  text-transform: uppercase;
  opacity: .45;
  font-family: var(--serif);
}

.wp-home__block-title {
  font-family: var(--serif);
  font-size: clamp(16px, 2.2vw, 28px);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -.01em;
}

.wp-home__block-desc {
  font-size: clamp(9px, 1vw, 12px);
  opacity: .5;
  line-height: 1.5;
  max-width: 28ch;
  margin-top: 2px;
}

.wp-home__block-arrow {
  font-size: clamp(14px, 1.5vw, 18px);
  margin-top: 8px;
  opacity: .4;
  transition: transform var(--trans);
  display: inline-block;
}

/* ── Bloc image vedette ────────────────────────────────────────── */
.wp-home__block--featured {
  background: var(--color-feat-bg);
  color: var(--color-feat-text);
  cursor: default;
  justify-content: center;
  align-items: center;
}

/* Quand l'image est chargée */
.wp-home__block--featured img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s ease;
}

.wp-home__block--featured:hover img {
  transform: scale(1.03);
}

/* Overlay au survol */
.wp-home__block--featured::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.5) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--trans);
  pointer-events: none;
}

.wp-home__block--featured:hover::after {
  opacity: 1;
}

.wp-home__featured-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.wp-home__featured-placeholder span {
  font-size: clamp(8px, .9vw, 10px);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.wp-home__featured-hint {
  opacity: .35;
  font-size: 9px !important;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .wp-home__row--stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .wp-home__row--main {
    grid-template-columns: 1fr;
  }

  .wp-home__block--meth,
  .wp-home__block--proj {
    aspect-ratio: 2 / 1;
  }

  .wp-home__row--secondary {
    grid-template-columns: 1fr 1fr;
  }

  .wp-home__block--featured {
    grid-column: 1 / -1;
    aspect-ratio: 2 / 1;
  }
}

@media (max-width: 480px) {
  .wp-home__row--stats {
    grid-template-columns: 1fr;
  }

  .wp-home__stat {
    aspect-ratio: 3 / 1;
    flex-direction: row;
    justify-content: space-between;
    padding: 16px 20px;
  }

  .wp-home__stat-num {
    font-size: 32px;
  }
}
