/* ==========================================================
   Fayngo : page d'accueil « l'Atlas »
   Le relief réel du Maroc au crépuscule ; dessous, cinq sections courtes.
   Ce fichier ne concerne que l'accueil (FR et EN) ; les jetons de couleur et de police sont dans css/style.css.
   ========================================================== */

body[data-page="home"] {
  background: var(--c-obsidian);
  color: var(--c-ivory);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.6;
}
body[data-page="home"] h1,
body[data-page="home"] h2,
body[data-page="home"] h3 { font-family: var(--font-display); font-weight: 600; color: inherit; text-wrap: balance; }
body[data-page="home"] h2 { font-size: clamp(2.1rem, 4.4vw, 4rem); line-height: 1.02; letter-spacing: -.02em; margin: 0 0 .45em; }
body[data-page="home"] h3 { font-size: 1.5rem; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .5em; }
body[data-page="home"] { --focus: var(--c-saffron); }

/* ---------- L'Atlas ---------- */
.atlas { position: relative; }
/* L'écran de l'Atlas : l'image, la scène et les étiquettes en fond ; le texte, la fiche (téléphone) et le crédit dans le flux,
   en grille, pour qu'un texte agrandi (200 %) pousse la mise en page au lieu de se chevaucher */
.atlas__stage {
  position: relative; min-height: max(560px, 100svh); overflow: hidden; background: var(--c-obsidian);
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr auto auto; align-items: end;
  padding: calc(var(--header-h) + 20px) max(24px, calc((100vw - 1200px) / 2 + 24px)) 14px;
}
/* Avec la scène 3D, la section s'allonge : le défilement fait voler la caméra pendant que l'écran reste en place */
html.atlas-3d .atlas { height: 230svh; }
/* Sur téléphone, un vol plus court : trois arrêts en une fois et demie la hauteur de l'écran */
@media (max-width: 759px) { html.atlas-3d .atlas { height: 150svh; } }
html.atlas-3d .atlas__stage { position: sticky; top: 0; }
/* Tant que l'écran de l'Atlas est épinglé, la barre du haut reste transparente sur grand écran */
@media (min-width: 1024px) {
  body.atlas-pinned .site-header:not(.is-searching) { background: transparent; }
}
/* La carte (image fixe, scène 3D, étiquettes) : sur grand écran, elle remplit le cadre derrière le texte */
.atlas__map { position: absolute; inset: 0; }
.atlas__still img, .atlas__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.atlas__still img { object-fit: cover; object-position: 50% 50%; }
.atlas__canvas { opacity: 0; transition: opacity .8s ease; cursor: grab; touch-action: pan-y; }
.atlas__canvas:active { cursor: grabbing; }
html.atlas-3d .atlas__canvas { opacity: 1; }

.atlas__labels { position: absolute; inset: 0; pointer-events: none; }
.atlas__labels button, .atlas__labels a {
  position: absolute; left: 0; top: 0; margin: -22px 0 0 4px; padding: 12px 8px; min-height: 44px;
  background: none; border: 0; cursor: pointer; pointer-events: auto;
  font: 500 .875rem/1.2 var(--font-text); white-space: nowrap; color: var(--c-ivory);
  text-shadow: 0 0 6px var(--c-obsidian), 0 0 2px var(--c-obsidian);
}
.atlas__labels button:hover, .atlas__labels a:hover { color: var(--c-saffron); }
.atlas__labels button.is-on { color: var(--c-cyan); font-weight: 600; }

.atlas__copy { position: relative; z-index: 2; grid-row: 2; width: min(760px, 56vw, 100%); margin-bottom: clamp(24px, 5vh, 56px); }
.atlas h1 { font-size: clamp(2.75rem, 6.2vw, 6.25rem); line-height: .98; letter-spacing: -.03em; margin: 0; }
.atlas__lede { margin: 20px 0 0; max-width: 34ch; font-size: 1.1875rem; line-height: 1.5; }
.atlas__actions { margin-top: 30px; display: flex; align-items: center; gap: 36px; flex-wrap: wrap; }
.atlas__portals { margin: 0; display: flex; flex-direction: column; gap: 2px; font-weight: 500; }
.atlas__portals a { display: inline-block; padding-block: 8px; }
.atlas__portals a > span[aria-hidden] { display: inline-block; margin-left: .35em; }
.atlas__portals a > span[aria-hidden] { color: var(--c-saffron); transition: transform .2s var(--ease-out); }
.atlas__portals a:hover > span[aria-hidden] { transform: translateX(4px); }

/* La destination mise en avant : à droite par défaut, posée à côté de son point quand la scène 3D tourne */
.atlas__focus {
  position: absolute; z-index: 2; right: max(24px, calc((100vw - 1200px) / 2 + 24px)); top: 38%;
  width: 310px; padding: 18px 20px 14px; background: var(--c-surface-1);
}
html.atlas-3d .atlas__focus { left: 0; top: 0; right: auto; transition: transform .45s var(--ease-out); }
.atlas__name { margin: 0; font: 600 2.125rem/1 var(--font-display); letter-spacing: -.02em; }
.atlas__meta { margin: 10px 0 0; display: flex; gap: 10px; align-items: baseline; font-size: .9375rem; line-height: 1.4; }
.atlas__meta a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(242, 231, 213, .4); }
.atlas__meta a:hover { text-decoration-color: currentColor; }
.atlas__dot { flex: none; width: 9px; height: 9px; background: var(--c-emerald-text); transform: translateY(-1px); }
.atlas__dot--wc { background: var(--c-saffron); border-radius: 50%; }
.atlas__go { margin-top: 10px; display: inline-flex; gap: 8px; align-items: center; min-height: 44px; font-weight: 600; color: var(--c-saffron); }

.atlas__hint { position: absolute; z-index: 2; right: max(24px, calc((100vw - 1200px) / 2 + 24px)); top: calc(var(--header-h) + 20px); margin: 0; text-align: right; font-size: .875rem; }
.atlas__hint:empty { display: none; }
.atlas__credit { position: relative; z-index: 2; grid-row: 3; justify-self: end; margin: 0; max-width: 46ch; text-align: right; font-size: .75rem; line-height: 1.4; color: var(--c-ivory-2); }
.atlas__credit a { text-decoration: underline; }

/* ---------- Le guide : destinations et activités ---------- */
.home-guide, .home-tips { padding-block: clamp(88px, 11vw, 170px); }
.home-guide__inner { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(48px, 7vw, 120px); align-items: start; }
.home-guide p { max-width: 44ch; }
.dest-index { list-style: none; padding: 0; margin: 28px 0 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
.dest-index a { display: flex; flex-direction: column; justify-content: center; min-height: 64px; padding: 8px 0; }
.dest-index__name { font: 500 1.375rem/1.15 var(--font-display); letter-spacing: -.01em; transition: color .2s ease; }
.dest-index__region { font-size: .9375rem; color: var(--c-ivory-2); }
.dest-index a:hover .dest-index__name { color: var(--c-saffron); }
.act-list { list-style: none; padding: 0; margin: 28px 0 20px; display: grid; gap: 8px; }
.act-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; background: var(--c-surface-1); }
.act-row a { display: block; font: 500 1.25rem/1.2 var(--font-display); }
.act-row a:hover { color: var(--c-saffron); }
.act-row span { display: block; margin-top: 4px; font-size: .9375rem; color: var(--c-ivory-2); }
.act-row .fav-btn { position: static; flex: none; background: var(--c-surface-2); color: var(--c-ivory); }
.act-row .fav-btn[aria-pressed="true"] { color: var(--c-saffron); }
.home-guide__more { display: flex; flex-wrap: wrap; column-gap: 28px; }

/* ---------- La preuve : une fiche réelle et ses statuts ---------- */
.trust { padding-block: clamp(88px, 11vw, 170px); background: var(--c-surface-1); }
.trust__inner { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(48px, 7vw, 120px); align-items: center; }
.trust__lead { max-width: 46ch; font-size: 1.1875rem; }
body[data-page="home"] .proof-legend { margin: 28px 0 24px; border: 0; display: grid; gap: 6px; }
body[data-page="home"] .proof-legend__item { padding: 14px 16px; border: 0; background: var(--c-surface-2); color: var(--c-ivory); font-size: 1rem; }
body[data-page="home"] .proof-legend__item strong { color: var(--c-ivory); }
body[data-page="home"] .proof-legend__ico { background: var(--c-obsidian); box-shadow: none; }
body[data-page="home"] .proof-legend__item--ok .proof-legend__ico { color: var(--c-emerald-text); }
body[data-page="home"] .proof-legend__item--partial .proof-legend__ico { color: var(--c-partial); }
body[data-page="home"] .proof-legend__item--pending .proof-legend__ico { color: var(--c-copper); }
body[data-page="home"] .proof-legend__n { color: var(--c-ivory-2); }
body[data-page="home"] .proof-legend__tag { background: var(--c-obsidian); }
body[data-page="home"] .proof::before { background: var(--c-surface-2); border-radius: 0; }
/* La fiche témoin : une vraie fiche du guide, aux matériaux de l'Atlas (aplat, angles droits, sans ombre ni inclinaison) */
body[data-page="home"] .proof__card { transform: none; color: var(--c-ivory); font-family: var(--font-text); }
body[data-page="home"] .proof__card .card { background: var(--c-surface-2); border-radius: 0; box-shadow: none; }
body[data-page="home"] .proof__card .card:hover { transform: none; box-shadow: none; }
body[data-page="home"] .proof__card .card__media { background: var(--c-obsidian); }
body[data-page="home"] .proof__card .card__badge, body[data-page="home"] .proof__card .card__illus { border-radius: 0; background: rgba(11, 11, 13, .82); color: var(--c-ivory); }
body[data-page="home"] .proof__card h3 { font-family: var(--font-display); font-size: 1.5rem; color: var(--c-ivory); }
body[data-page="home"] .proof__card p, body[data-page="home"] .proof__card .card__meta { color: var(--c-ivory-2); }
body[data-page="home"] .proof__card .card__meta svg { color: var(--c-saffron); }
body[data-page="home"] .proof__card .tag { border-radius: 0; background: var(--c-obsidian); color: var(--c-ivory-2); }
/* La ligne de vérification de la fiche témoin : celle de toutes les fiches (filet, texte ivoire sur la surface), sans la pastille crème de l'ancien style */
body[data-page="home"] .proof__card .verif { margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid var(--c-obsidian); border-radius: 0; background: none; box-shadow: none; color: var(--c-ivory-2) !important; font-size: .875rem; }
body[data-page="home"] .proof__card .verif--ok svg { color: var(--c-emerald-text); }
body[data-page="home"] .proof__card .verif a { color: var(--c-ivory); }
body[data-page="home"] .proof__card .card__links a, body[data-page="home"] .proof__card .card__route { color: var(--c-saffron); }
body[data-page="home"] .proof__card .fav-btn { background: rgba(11, 11, 13, .78); color: var(--c-ivory); }
body[data-page="home"] .proof__caption { color: var(--c-ivory-2); font-size: .9375rem; }

/* ---------- Le planificateur : une photo pleine largeur ---------- */
.planner-cta { position: relative; isolation: isolate; min-height: min(86svh, 760px); display: flex; align-items: flex-end; padding-block: 120px clamp(56px, 8vw, 110px); overflow: hidden; }
.planner-cta > img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.planner-cta::after { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(11, 11, 13, .55); }
.planner-cta__inner p { max-width: 44ch; font-size: 1.1875rem; margin: 0 0 28px; }

/* ---------- Conseils ---------- */
.home-tips__head { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; margin-bottom: 36px; }
.home-tips__head h2 { margin: 0; }
.home-tips__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tip { padding: 28px 26px 22px; background: var(--c-surface-1); display: flex; flex-direction: column; }
.tip p { margin: 0 0 16px; }
.tip .home-link { margin-top: auto; }
body[data-page="home"] .free-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
body[data-page="home"] .free-list strong { color: var(--c-ivory); }
body[data-page="home"] .free-list a { color: var(--c-ivory-2); text-decoration: underline; }

/* ---------- Lettre d'information : un champ de safran ---------- */
.news { background: var(--c-saffron); color: var(--c-obsidian); padding-block: clamp(80px, 10vw, 150px); }
.news__inner { max-width: 760px; }
.news p { max-width: 46ch; }
body[data-page="home"] .newsletter { margin: 28px 0 0; max-width: 560px; justify-content: flex-start; gap: 8px; }
body[data-page="home"] .newsletter input[type="email"] {
  flex: 1 1 240px; min-height: 56px; padding: 0 18px; border: 0; border-radius: 0;
  background: var(--c-ivory); color: var(--c-obsidian); font-size: 1.0625rem;
}
body[data-page="home"] .newsletter input::placeholder { color: var(--c-hint-on-saffron); }
body[data-page="home"] .news { --focus: var(--c-obsidian); }
body[data-page="home"] .newsletter .field-error { padding-left: 0; color: var(--c-error-on-saffron); font-weight: 600; }
body[data-page="home"] .news .consent { margin: 16px 0 0 !important; max-width: 52ch; opacity: 1; font-size: .9375rem; }
body[data-page="home"] .news .consent a { text-decoration: underline; }

/* ---------- Adaptation ---------- */
@media (max-width: 1023px) {
  .home-guide__inner, .trust__inner { grid-template-columns: minmax(0, 1fr); }
  .home-tips__grid { grid-template-columns: minmax(0, 1fr); }
  /* La barre du bas recouvre le pied de l'écran : le texte de l'Atlas remonte d'autant */
  /* 16 px : la zone de toucher du lien « crédits » (44 px) reste au-dessus de la barre, son contour de focus aussi */
  .atlas__stage { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px); }
}
@media (max-width: 759px) {
  /* Téléphone : deux blocs successifs dans le flux de la page, d'abord le titre, le texte et les boutons, puis la carte
     dans son propre cadre (240 à 320 px), puis la fiche et le crédit. Rien ne se superpose ; pas de vol au défilement. */
  html.atlas-3d .atlas { height: auto; }
  .atlas__stage, html.atlas-3d .atlas__stage { position: relative; min-height: 0; align-items: start; grid-template-rows: auto auto auto auto; padding: calc(var(--header-h) + 24px) 16px 24px; }
  .atlas__copy { grid-row: 1; width: auto; margin-bottom: 24px; }
  .atlas__map { position: relative; inset: auto; grid-row: 2; height: clamp(240px, 75vw, 320px); margin: 0 -16px 16px; overflow: hidden; }
  .atlas__credit { grid-row: 4; }
  .atlas h1 { font-size: clamp(2rem, 9.6vw, 2.5rem); line-height: 1.1; letter-spacing: -.02em; }
  .atlas__lede { font-size: 1.0625rem; margin-top: 14px; }
  .atlas__actions { margin-top: 22px; }
  .atlas-btn { width: 100%; }
  /* Les deux entrées restent sur téléphone, sur une ligne compacte sous le bouton */
  .atlas__actions { gap: 4px 20px; }
  .atlas__portals { flex-direction: row; flex-wrap: wrap; column-gap: 20px; font-size: .9375rem; }
  .atlas__portals a { display: inline-block; padding-block: 12px; }
  .atlas__hint { display: none; }
  .atlas__credit { justify-self: stretch; max-width: none; text-align: left; font-size: .75rem; }
  /* La fiche se range en haut de l'écran, compacte */
  .atlas__focus, html.atlas-3d .atlas__focus {
    position: relative; grid-row: 3; align-self: start; margin-bottom: 12px; left: auto; right: auto; top: auto; width: auto; transform: none !important;
    /* Le lien « Voir … » se range à côté du nom, ou passe à la ligne si le texte est agrandi */
    display: flex; flex-wrap: wrap; align-items: center; column-gap: 12px; padding: 12px 14px;
  }
  .atlas__name { font-size: 1.5rem; flex: 1 1 auto; min-width: 0; }
  .atlas__meta { order: 2; flex: 1 1 100%; margin-top: 4px; font-size: .875rem; }
  .atlas__meta + .atlas__meta { display: none; }
  .atlas__go { order: 1; margin: 0; }
  .dest-index { column-gap: 16px; }
  .dest-index a { min-height: 56px; }
  .dest-index__name { font-size: 1.125rem; }
  .dest-index__region { font-size: .8125rem; }
  .home-guide, .home-tips, .trust { padding-block: 72px; }
  body[data-page="home"] .proof { padding: 18px 14px; }
  .planner-cta { min-height: 0; padding-block: 220px 56px; }
  .news .atlas-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .atlas__canvas, html.atlas-3d .atlas__focus, .home-link span, .atlas__portals span { transition: none; }
}

/* Toute la ligne d'activité mène à l'activité ; le favori reste au-dessus */
.act-row a::after { content: ""; position: absolute; inset: 0; }
.act-row:focus-within { outline: 3px solid var(--focus, var(--c-saffron)); outline-offset: 2px; }
.act-row a:focus-visible { outline: none; }
.act-row .fav-btn { position: relative; z-index: 1; }
/* Très grand texte sur petit écran : le nom de l'activité passe à la ligne au lieu d'élargir la rangée */
.act-row > div { min-width: 0; overflow-wrap: anywhere; }
