/* Cartes interactives — accueil : le carnet d'explorateur des grandes découvertes. */

/* Le papier du carnet : la carte du monde pixelisée de la v1, fixe derrière la page (y compris sur iPad). */
body.home {
  position: relative;
  background: var(--cream);
}

body.home::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--cream) url("../img/fond-carte-pixel.webp") center / cover no-repeat;
}

html {
  scroll-behavior: smooth;
}

/* ---------------------------------------------------------------- En-tête : une bande courte de carte ancienne */
/* Une seule rangée : rose des vents, nom gravé et devise à gauche, sections à droite ; le bord déchiré ferme la bande.
   Hauteur fixe : l'arrivée des polices ne décale pas la page. */
.hero {
  height: 128px;
  padding-top: 18px;
  overflow: hidden;
  /* Le bord déchiré s'étire au-delà de 1100 px au lieu de se répéter : aucun motif ne revient sur un grand écran */
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 30px) no-repeat, var(--bord-dechire-bas) bottom center / max(1100px, 100%) 36px no-repeat;
  mask: linear-gradient(#000 0 0) top / 100% calc(100% - 30px) no-repeat, var(--bord-dechire-bas) bottom center / max(1100px, 100%) 36px no-repeat;
}

/* Voile un peu plus appuyé que la bande des cartes : la gravure reste miel et la devise garde 4,5:1 sur la partie
   la plus claire de la gravure, que montre le téléphone (mesuré sur le fond réel) */
.hero.banner {
  background-image:
    radial-gradient(135% 120% at 50% 40%, rgba(15, 23, 42, 0.42) 0%, rgba(15, 23, 42, 0.58) 55%, rgba(15, 23, 42, 0.72) 85%),
    url("../img/carte-ancienne.webp");
}

@media (max-width: 760px) {
  .hero.banner {
    background-image:
      radial-gradient(135% 120% at 50% 40%, rgba(15, 23, 42, 0.5) 0%, rgba(15, 23, 42, 0.62) 55%, rgba(15, 23, 42, 0.74) 85%),
      url("../img/carte-ancienne-720.webp");
  }
}

/* Rangée alignée sur la colonne du contenu : la rose des vents tombe à l'aplomb du texte */
.hero__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: var(--column);
  margin: 0 auto;
}

.hero__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.hero__emblem {
  flex: none;
  border-radius: 50%;
}

.hero__emblem img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--gold), 0 3px 10px rgba(0, 0, 0, 0.4);
  transition: transform var(--t-slow) var(--ease);
}

.hero__emblem:hover img {
  transform: rotate(-30deg);
}

.hero__title {
  min-width: 0;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
}

.hero__title h1 {
  color: #fff;
  font-size: clamp(1.6rem, 1.2rem + 1vw, 2.1rem);
  line-height: 1;
  white-space: nowrap;
}

.hero__tagline {
  margin-top: 5px;
  color: #fbe9c0;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-style: italic;
  line-height: 1.2;
}

.hero__links {
  display: flex;
  flex: none;
  gap: 2px;
  margin-right: -14px;
}

.hero__links a {
  padding: 9px 14px;
  border-radius: var(--r-pill);
  color: rgba(255, 255, 255, 0.94);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.hero__links a:hover {
  background: rgba(255, 253, 248, 0.14);
  color: #fff;
}

/* ---------------------------------------------------------------- Bienvenue : le message d'accueil et sa description,
   centrés sur le papier, juste avant les cartes */
.welcome {
  width: min(var(--column), 46rem);
  margin: 0 auto;
  padding-top: clamp(48px, 6vw, 80px);
  text-align: center;
}

.welcome__title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--navy);
  font-size: clamp(2.4rem, 1.6rem + 2.4vw, 3.6rem);
  line-height: 1.05;
}

.welcome__title::after {
  content: "";
  width: 132px;
  height: 12px;
  background: var(--ornament) center / 132px 12px no-repeat;
}

.welcome__lead {
  max-width: 36rem;
  margin: 22px auto 0;
  color: var(--ink);
  font-size: clamp(1.1875rem, 1.05rem + 0.5vw, 1.375rem);
  font-weight: 600;
  line-height: 1.5;
  text-wrap: balance;
}

.welcome__more {
  max-width: 40rem;
  margin: 12px auto 0;
  color: var(--ink-2);
  font-size: 1.0625rem;
  line-height: 1.65;
  text-wrap: pretty;
}

/* ---------------------------------------------------------------- Sections */
.maps,
.how,
.classroom {
  scroll-margin-top: 24px;
  width: var(--column);
  margin: 0 auto;
  padding-top: clamp(72px, 8vw, 112px);
}

/* Les cartes suivent le message d'accueil de près : c'est la suite de la même phrase */
.welcome + .maps {
  padding-top: clamp(48px, 5vw, 72px);
}

.section-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: clamp(32px, 4vw, 48px);
  color: var(--navy);
  font-size: clamp(2rem, 1.5rem + 1.4vw, 2.6rem);
  text-align: center;
}

/* Cartes disponibles : des planches d'atlas. La carte est encadrée d'un filet d'encre et d'un filet doré dans une marge
   de papier, ce qu'elle contient s'écrit en petites capitales comme une légende, et le bouton reste discret : l'action
   principale de la page est plus haut. */
.plates {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.plate {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
}

.plate:not(.plate--soon):hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
}

.plate__art {
  position: relative;
  display: block;
  padding: 14px 14px 0;
}

/* Double filet de planche : encre au bord de la carte, papier, puis or */
.plate__map {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 11;
  object-fit: cover;
  background: var(--sea);
  outline: 1px solid rgba(26, 34, 51, 0.62);
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--gold-deep);
  transition: filter var(--t-med) var(--ease);
}

.plate:not(.plate--soon):hover .plate__map {
  filter: saturate(1.12) brightness(1.03);
}

/* Drapeau collé comme un autocollant, à cheval sur le coin du cadre */
.plate__flag {
  position: absolute;
  left: 6px;
  top: 6px;
  width: 44px;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 0 0 2.5px #fff, 0 4px 10px rgba(26, 34, 51, 0.28);
  transform: rotate(-3deg);
}

.plate__flag--square {
  width: 34px;
}

.plate__badge {
  position: absolute;
  right: 22px;
  top: 22px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  background: var(--navy);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.plate__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  padding: 18px 18px 18px;
}

.plate__body h3 {
  color: var(--navy);
  font-size: 1.5rem;
  line-height: 1.1;
}

.plate__text {
  color: var(--ink-2);
  font-size: 0.9375rem;
  line-height: 1.55;
}

/* Légende de la planche : petites capitales gravées, chiffres en Manrope. Chaque mot porte son point devant lui ;
   le point du premier mot de chaque ligne tombe dans une marge masquée : aucune ligne ne commence ni ne finit par un
   séparateur. */
.plate__features {
  display: flex;
  flex-wrap: wrap;
  margin-left: -16px;
  clip-path: inset(0 0 0 16px);
  color: var(--gold-ink);
  font-family: var(--font-caps);
  font-size: 1.0625rem;
  letter-spacing: 0.03em;
  line-height: 1.45;
}

.plate__features li::before {
  content: "·";
  display: inline-block;
  width: 16px;
  color: var(--gold-deep);
  text-align: center;
}

.plate__features .num {
  font-family: var(--font);
  font-size: 0.8em;
  font-weight: 800;
  letter-spacing: 0;
}

.plate__record {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gold-ink);
  font-size: var(--step--1);
  font-weight: 700;
}

.plate__record .stars {
  font-size: 1rem;
}

.plate .btn {
  margin-top: auto;
}

.plate__open [data-icon] {
  display: inline-flex;
}

.plate__open .icon {
  width: 18px;
  height: 18px;
  transition: transform var(--t-med) var(--ease);
}

.plate__open:hover .icon {
  transform: translateX(3px);
}

.plate--soon {
  background: var(--paper-2);
  box-shadow: 0 0 0 1px var(--line);
}

.plate--soon .plate__map {
  filter: grayscale(0.85) sepia(0.25);
  opacity: 0.6;
  box-shadow: 0 0 0 4px var(--paper-2), 0 0 0 5px var(--line-strong);
}

.plate--soon .plate__body h3,
.plate--soon .plate__text,
.plate--soon .plate__features {
  color: var(--ink-3);
}

/* ---------------------------------------------------------------- Comment ça marche : trois timbres sur une route d'explorateur */
.route {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 56px);
}

.route::before {
  content: "";
  position: absolute;
  top: 98px;
  left: 18%;
  right: 18%;
  border-top: 2px dashed var(--gold-deep);
  opacity: 0.7;
}

.route__step {
  position: relative;
  text-align: center;
}

.route__step h3 {
  margin-top: 20px;
  color: var(--navy);
  font-size: 1.75rem;
}

.route__step p {
  max-width: 32ch;
  margin: 8px auto 0;
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.6;
}

/* Timbre : dents découpées, ombre portée sur le conteneur (le masque l'effacerait sinon) */
.stamp {
  width: min(196px, 60vw);
  margin: 0 auto;
  filter: drop-shadow(0 6px 9px rgba(26, 34, 51, 0.2));
  transition: transform var(--t-slow) var(--ease);
}

.stamp--a { transform: rotate(-4deg); }
.stamp--b { transform: rotate(3deg); }
.stamp--c { transform: rotate(-2deg); }

.route__step:hover .stamp {
  transform: rotate(0deg) scale(1.04);
}

.stamp__paper {
  --r: 6px;
  display: block;
  padding: calc(var(--r) * 2.5);
  background: #fffcf3;
  -webkit-mask:
    radial-gradient(var(--r), #0000 98%, #000) round calc(-1.5 * var(--r)) calc(-1.5 * var(--r)) / calc(3 * var(--r)) calc(3 * var(--r)),
    linear-gradient(#000 0 0) no-repeat 50% / calc(100% - 3 * var(--r)) calc(100% - 3 * var(--r));
  mask:
    radial-gradient(var(--r), #0000 98%, #000) round calc(-1.5 * var(--r)) calc(-1.5 * var(--r)) / calc(3 * var(--r)) calc(3 * var(--r)),
    linear-gradient(#000 0 0) no-repeat 50% / calc(100% - 3 * var(--r)) calc(100% - 3 * var(--r));
}

.stamp__paper img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid rgba(26, 34, 51, 0.2);
  background: #e6f1f7;
}

.stamp--a .stamp__paper img {
  object-fit: contain;
  padding: 10px;
}

/* ---------------------------------------------------------------- En classe : une page du carnet d'explorateur */
.classroom {
  width: min(100% - 2 * var(--gutter), 1024px);
}

/* Page lignée tous les 28 px, marge rouge : le papier d'un carnet d'écolier.
   Chaque hauteur est un multiple de la ligne, et la ligne de base du texte se pose sur le trait. */
.notebook {
  --rule: 28px;
  --margin-x: clamp(40px, 4.6vw, 60px);
  position: relative;
  padding: var(--rule) clamp(24px, 4vw, 56px) var(--rule) calc(var(--margin-x) + clamp(24px, 3vw, 40px));
  border-radius: 6px 6px var(--r-lg) var(--r-lg);
  background:
    linear-gradient(90deg, transparent var(--margin-x), rgba(214, 69, 58, 0.4) var(--margin-x) calc(var(--margin-x) + 2px), transparent calc(var(--margin-x) + 2px)),
    repeating-linear-gradient(to bottom, transparent 0 calc(var(--rule) - 1px), rgba(29, 85, 132, 0.16) calc(var(--rule) - 1px) var(--rule)) 0 -6px,
    var(--paper);
  box-shadow: var(--shadow-lift);
  transform: rotate(-0.4deg);
}

/* Le titre occupe deux lignes du carnet ; le décalage pose sa ligne de base sur le trait, quelle que soit la taille */
.notebook__intro h2 {
  position: relative;
  top: calc(20px - 0.28em);
  color: var(--navy);
  font-size: clamp(2rem, 1.6rem + 1vw, 2.5rem);
  line-height: calc(var(--rule) * 2);
}

.notebook__intro p {
  max-width: 72ch;
  color: var(--ink-2);
  font-size: 1.0625rem;
  line-height: var(--rule);
}

/* Quatre usages en deux colonnes, une ligne blanche sous l'introduction : un titre sur une ligne, l'explication sur les suivantes */
.notebook__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--rule) clamp(32px, 5vw, 72px);
  margin: var(--rule) 0 0;
}

.notebook__list dt {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--rule);
  color: var(--navy);
  font-family: var(--font-display);
  font-size: 1.375rem;
  line-height: var(--rule);
}

.notebook__list dt .icon {
  width: 26px;
  height: 26px;
  padding: 5px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold-ink);
}

.notebook__list dd {
  margin: 0;
  color: var(--ink-2);
  font-size: 1rem;
  line-height: var(--rule);
}

/* ---------------------------------------------------------------- Mouvement d'entrée : une seule fois, déjà visible par défaut */
@media (prefers-reduced-motion: no-preference) {
  .hero__title > * {
    animation: rise 800ms var(--ease) both;
  }
  .hero__title > :nth-child(2) { animation-delay: 90ms; }
}

@keyframes rise {
  from { opacity: 0.001; transform: translateY(12px); }
}

/* ---------------------------------------------------------------- Écrans moyens et téléphones */
@media (max-width: 1080px) {
  .plates {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Une colonne : chaque étape devient une ligne, le timbre à gauche du texte */
@media (max-width: 860px) {
  .route {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .route::before {
    display: none;
  }

  .route__step {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0 clamp(18px, 3vw, 28px);
    align-items: center;
    text-align: left;
  }

  .route__step .stamp {
    grid-row: 1 / span 2;
    width: clamp(108px, 18vw, 140px);
  }

  .route__step h3 {
    align-self: end;
    margin-top: 0;
    font-size: 1.5rem;
  }

  .route__step p {
    align-self: start;
    max-width: none;
    margin: 6px 0 0;
    font-size: 0.9375rem;
  }
}

/* Tablette : liens plus serrés pour tenir sur la rangée */
@media (max-width: 1000px) {
  .hero__links a {
    padding: 8px 10px;
    font-size: 0.875rem;
  }

  .hero__links {
    margin-right: -10px;
  }

  .hero__tagline {
    font-size: 0.9375rem;
  }
}

/* Petite tablette et téléphone : la bande ne garde que la rose des vents, le nom et la devise */
@media (max-width: 760px) {
  .hero__links {
    display: none;
  }
}

/* Téléphone : bande encore plus courte ; on joue dès le premier écran */
@media (max-width: 680px) {
  .hero {
    height: 104px;
    padding-top: 16px;
  }

  .hero__brand {
    gap: 12px;
  }

  .hero__emblem img {
    width: 40px;
    height: 40px;
  }

  .hero__title h1 {
    font-size: 1.5rem;
  }

  .hero__tagline {
    margin-top: 4px;
    font-size: 0.875rem;
  }

  .welcome {
    padding-top: 40px;
  }

  .welcome__more {
    font-size: 1rem;
  }

  .plate__map {
    aspect-ratio: 2 / 1;
  }

  .plates {
    grid-template-columns: 1fr;
  }

  .notebook {
    --margin-x: 34px;
    padding: var(--rule) 20px var(--rule) 52px;
    transform: none;
  }

  .notebook__list {
    grid-template-columns: 1fr;
  }
}
