/* Les quatre portes d'entrée : une exposition de lectures plutôt qu'une grille de tuiles. */
:root {
  --world-ink: #142133;
  --world-paper: #f7f5ef;
}

body.world-index,
body.world-page {
  background: var(--world-paper);
  color: var(--world-ink);
}

body.world-index #main > .inner { max-width: 82rem; }
body.world-index .library-hero {
  position: relative;
  overflow: hidden;
  margin: 3.5rem 0 2.25rem;
  padding: clamp(2rem, 6vw, 5.25rem);
  border: 0;
  border-radius: 2rem;
  background: #151c4b;
  color: #fff;
}
body.world-index .library-hero::before,
body.world-index .library-hero::after {
  position: absolute;
  border-radius: 50%;
  content: '';
}
body.world-index .library-hero::before {
  width: 38rem;
  height: 38rem;
  top: -27rem;
  right: -8rem;
  background: #ff476c;
  box-shadow: -13rem 13rem 0 #21d5c2;
}
body.world-index .library-hero::after {
  width: 12rem;
  height: 12rem;
  right: 20%;
  bottom: -7rem;
  border: 1.2rem solid #ffd93d;
}
body.world-index .library-hero h1,
body.world-index .library-hero h2,
body.world-index .library-hero > p {
  position: relative;
  z-index: 1;
  max-width: 14ch;
  color: #fff !important;
}
body.world-index .library-hero h1 {
  font-family: 'Space Grotesk', sans-serif !important;
  font-size: clamp(3.2rem, 9vw, 8rem);
  font-weight: 700;
  letter-spacing: -0.09em;
  line-height: 0.84;
}
body.world-index .library-hero h2 {
  max-width: 33rem;
  margin-top: 1.8rem;
  font-family: 'DM Sans', sans-serif;
  font-size: clamp(1.05rem, 2vw, 1.38rem);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.45;
}

body.world-index .tiles {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1.1rem;
  margin: 0 0 5rem;
}
body.world-index .tiles::before {
  grid-column: 1 / -1;
  order: 2;
  margin: 2.7rem 0 0.45rem;
  color: #172451;
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.6rem, 3.2vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.06em;
  content: 'Explorer les autres univers';
}
body.world-index .tiles article {
  order: 3;
  min-height: 14rem;
  margin: 0;
  border: 0;
  border-radius: 1.5rem;
  box-shadow: none;
  isolation: isolate;
  transform: none !important;
}
body.world-index .tiles article .image { opacity: 0.22; transition: transform 450ms cubic-bezier(.2,.8,.2,1), opacity 350ms ease; }
body.world-index .tiles article > .image::before { opacity: 0.12 !important; }
body.world-index .tiles article > a {
  display: flex;
  align-items: flex-end;
  min-height: 14rem;
  padding: 1.3rem;
  text-align: left;
}
body.world-index .tiles article > a .content { text-align: left; }
body.world-index .tiles article > a h2 {
  max-width: 18ch;
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.25rem, 2.1vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: .98;
}
body.world-index .tiles article > a h2::after { display: none; }
body.world-index .tiles article:not(.world-portal) { grid-column: span 3; background: #d94b7c; }
body.world-index .tiles article:not(.world-portal):nth-of-type(3n) { background: #2467d7; }
body.world-index .tiles article:not(.world-portal):nth-of-type(3n + 1) { background: #ea713e; }
body.world-index .tiles article:not(.world-portal):nth-of-type(3n + 2) { background: #158c80; }

body.world-index .tiles .world-portal {
  order: 1;
  min-height: clamp(19rem, 30vw, 27rem);
  overflow: hidden;
}
body.world-index .tiles .world-portal > a { min-height: clamp(19rem, 30vw, 27rem); padding: clamp(1.6rem, 3vw, 2.7rem); }
body.world-index .tiles .world-portal > a::before {
  display: block;
  position: absolute;
  top: 1.6rem;
  left: 1.8rem;
  color: rgba(255,255,255,.84);
  font-family: 'DM Sans', sans-serif;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  content: attr(data-scope);
}
body.world-index .tiles .world-portal > a h2 { max-width: 10ch; font-size: clamp(2rem, 4.2vw, 4.2rem); }
body.world-index .world-portal--libraries { grid-column: span 7; background: #0b7e70; }
body.world-index .world-portal--catalogues { grid-column: span 5; background: #f55b50; }
body.world-index .world-portal--khazar { grid-column: span 5; background: #273985; }
body.world-index .world-portal--languages { grid-column: span 7; background: #e0a800; }
body.world-index .world-portal--languages > a h2 { color: #172451; }
body.world-index .world-portal--languages > a::before { color: #172451; }
body.world-index .world-portal .image { opacity: .4; mix-blend-mode: screen; }
body.world-index .world-portal--languages .image { mix-blend-mode: multiply; opacity: .3; }
body.world-index .tiles article:hover .image,
body.world-index .tiles article:focus-within .image { opacity: .65; transform: scale(1.08) rotate(1deg); }
body.world-index .tiles article:hover { box-shadow: 0 1.25rem 2.8rem rgba(20,33,51,.2); }

body.world-page { --world: #0b7e70; --world-deep: #064a48; --world-pop: #d6ff64; }
body.world-page--catalogues { --world: #f55b50; --world-deep: #ae263d; --world-pop: #ffe175; }
body.world-page--khazar { --world: #273985; --world-deep: #151c4b; --world-pop: #ff6d98; }
body.world-page--languages { --world: #e0a800; --world-deep: #806300; --world-pop: #10cdb8; }
body.world-page .library-editorial {
  overflow: visible;
  max-width: 76rem;
  margin: 2.8rem auto 5rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
body.world-page .library-editorial .library-article-hero {
  overflow: hidden;
  min-height: 29rem;
  padding: clamp(2rem, 7vw, 6.3rem);
  border-radius: 2rem;
  background: var(--world-deep);
}
body.world-page .library-editorial .library-article-hero::before {
  width: 29rem;
  height: 29rem;
  top: -16rem;
  right: -9rem;
  border: 2.1rem solid var(--world-pop);
  box-shadow: none;
}
body.world-page .library-editorial .library-article-hero::after {
  width: 11rem;
  height: 11rem;
  bottom: -5rem;
  left: 20%;
  background: var(--world);
}
body.world-page .library-kicker { color: var(--world-pop) !important; }
body.world-page .library-article-hero h1 {
  max-width: 11ch;
  color: #fff !important;
  font-family: 'Space Grotesk', sans-serif !important;
  font-size: clamp(3rem, 8vw, 7rem);
  font-weight: 700;
  letter-spacing: -0.09em;
  line-height: .85;
}
body.world-page .library-body {
  position: relative;
  width: min(100% - 3rem, 61rem);
  margin: -3rem auto 0;
  padding: clamp(2rem, 5vw, 5rem);
  border-radius: 1.5rem;
  background: rgba(255,255,255,.94);
  box-shadow: 0 1rem 3rem rgba(20,33,51,.12);
}
body.world-page .library-body::before {
  display: block;
  margin-bottom: 2rem;
  color: var(--world);
  font-family: 'Space Grotesk', sans-serif;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  content: 'Lire, chercher, relier';
}
body.world-page .library-body > .library-body__opening { color: var(--world-deep); }
body.world-page .library-body > p:first-of-type::first-letter {
  float: left;
  margin: .08em .12em 0 0;
  color: var(--world);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 4.3em;
  font-weight: 700;
  line-height: .7;
}
body.world-page .library-body h2,
body.world-page .library-body h3 { color: var(--world-deep); font-family: 'Space Grotesk', sans-serif; }
body.world-page .library-body a { color: var(--world-deep); text-decoration-color: var(--world-pop); }
.world-next {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .7rem;
  margin: 3rem 0 0;
  padding-top: 1.4rem;
  border-top: 2px solid var(--world-pop);
}
.world-next__label { grid-column: 1 / -1; margin: 0; color: var(--world-deep); font: 700 .72rem/1 'DM Sans', sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.world-next a { min-height: 7rem; padding: 1rem; border-radius: 1rem; background: var(--world); color: #fff !important; font-family: 'Space Grotesk', sans-serif; font-weight: 700; line-height: 1.05; text-decoration: none; }
.world-next a:nth-of-type(2) { background: var(--world-deep); }
.world-next a:nth-of-type(3) { background: var(--world-pop); color: var(--world-deep) !important; }

@media (max-width: 736px) {
  body.world-index .library-hero { margin: 1.2rem 0 1rem; border-radius: 1.25rem; }
  body.world-index .tiles { display: block; margin-bottom: 3rem; }
  body.world-index .tiles::before { display: block; margin: 2.5rem 0 1rem; }
  body.world-index .tiles article,
  body.world-index .tiles .world-portal { min-height: 15rem; margin: .8rem 0; }
  body.world-index .tiles article > a,
  body.world-index .tiles .world-portal > a { min-height: 15rem; }
  body.world-index .tiles .world-portal > a h2 { font-size: clamp(2rem, 11vw, 3.4rem); }
  body.world-page .library-editorial { margin-top: 1.2rem; }
  body.world-page .library-editorial .library-article-hero { min-height: 21rem; border-radius: 1.25rem; }
  body.world-page .library-body { width: calc(100% - 1.5rem); margin-top: -1.5rem; padding: 1.65rem 1.3rem 2.5rem; border-radius: 1rem; }
  .world-next { grid-template-columns: 1fr; }
  .world-next a { min-height: 4.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  body.world-index .tiles article .image { transition: none; }
}

/* Neutralise les dimensions héritées de l'ancienne grille Flex. */
body.world-index #main .tiles {
  display: grid;
  width: 100%;
  margin: 0 0 5rem;
}
body.world-index #main .tiles article,
body.world-index #main .tiles .world-portal {
  width: auto;
  max-width: none;
  margin: 0;
}
body.world-index #main .tiles .world-portal--libraries { grid-column: span 7; }
body.world-index #main .tiles .world-portal--catalogues { grid-column: span 5; }
body.world-index #main .tiles .world-portal--khazar { grid-column: span 5; }
body.world-index #main .tiles .world-portal--languages { grid-column: span 7; }
body.world-index #main .tiles .world-portal > a h2 {
  width: 100%;
  max-width: 11ch;
  overflow-wrap: anywhere;
  font-size: clamp(1.85rem, 3.35vw, 3.5rem);
}
@media (max-width: 736px) {
  body.world-index #main .tiles { display: block; }
  body.world-index #main .tiles .world-portal { grid-column: auto; }
  body.world-index #main .tiles article { width: 100%; }
}

/* Chaque autre dossier reçoit automatiquement une variation de la même exposition. */
body.world-tone-1 { --world: #0b7e70; --world-deep: #064a48; --world-pop: #d6ff64; }
body.world-tone-2 { --world: #e15464; --world-deep: #8f2140; --world-pop: #ffe175; }
body.world-tone-3 { --world: #3a54ad; --world-deep: #151c4b; --world-pop: #ff9bb6; }
body.world-tone-4 { --world: #d99d00; --world-deep: #705600; --world-pop: #10cdb8; }
body.world-tone-5 { --world: #8b4ab2; --world-deep: #44215e; --world-pop: #ffca63; }
body.world-tone-6 { --world: #d46435; --world-deep: #7c301c; --world-pop: #86e0d0; }

body.world-search .library-search {
  position: relative;
  overflow: hidden;
  max-width: 58rem;
  border: 0;
  border-radius: 2rem;
  background: #151c4b;
  box-shadow: none;
}
body.world-search .library-search::after {
  position: absolute;
  width: 22rem;
  height: 22rem;
  right: -12rem;
  bottom: -13rem;
  border: 2.5rem solid #21d5c2;
  border-radius: 50%;
  content: '';
}
body.world-search .library-search > * { position: relative; z-index: 1; }
body.world-search .library-search h1,
body.world-search .library-search h1 em,
body.world-search .library-search > p,
body.world-search .library-search label { color: #fff !important; }
body.world-search .library-search h1 { font-family: 'Space Grotesk', sans-serif; font-size: clamp(2.5rem, 6vw, 5rem); }
body.world-search .library-search-form button { background: #ff476c; }

body.semantic-page.world-page .semantic-article { border: 0; border-radius: 2rem; background: transparent; box-shadow: none; }
body.semantic-page.world-page .semantic-article__hero { min-height: 27rem; border-radius: 2rem 2rem 0 0; background: var(--world-deep); }
body.semantic-page.world-page .semantic-article__hero::after { background: var(--world); }
body.semantic-page.world-page .semantic-kicker { color: var(--world-pop); }
body.semantic-page.world-page .semantic-article h1 { font-family: 'Space Grotesk', sans-serif; }
body.semantic-page.world-page .semantic-metrics { background: var(--world-pop); }
body.semantic-page.world-page .semantic-metric dt { color: var(--world-deep); }

/* Cette surcharge reprend volontairement la spécificité de la couche éditoriale commune. */
body.world-page:not(.semantic-page) .library-editorial .library-article-hero {
  min-height: 29rem;
  border-radius: 2rem;
  background: var(--world-deep);
}
body.world-page:not(.semantic-page) .library-editorial .library-article-hero h1 {
  color: #fff !important;
  font-family: 'Space Grotesk', sans-serif !important;
  font-size: clamp(3rem, 8vw, 7rem);
  font-weight: 700;
  letter-spacing: -0.09em;
  line-height: .85;
}
body.world-page:not(.semantic-page) .library-editorial .library-body {
  width: min(100% - 3rem, 61rem);
  margin: -3rem auto 0;
  padding: clamp(2rem, 5vw, 5rem);
  border-radius: 1.5rem;
  background: rgba(255,255,255,.94);
}
body.world-page:not(.semantic-page) .library-editorial .library-body > .library-body__opening { color: var(--world-deep); }
@media (max-width: 736px) {
  body.world-page:not(.semantic-page) .library-editorial .library-article-hero { min-height: 21rem; border-radius: 1.25rem; }
  body.world-page:not(.semantic-page) .library-editorial .library-body { width: calc(100% - 1.5rem); margin-top: -1.5rem; padding: 1.65rem 1.3rem 2.5rem; border-radius: 1rem; }
}
