/* si-mo.fr — l'étagère de la page Traduction.

   Deux états sur une seule page :
   — l'étagère : 焦, le résumé de carrière à gauche, les couvertures à droite ;
   — le détail d'un livre : 焦 reste, le texte du livre remplace le résumé, la
     grande couverture remplace l'étagère.

   Le passage de l'un à l'autre est conduit par shelf.js (View Transitions : la
   vignette grandit jusqu'à sa place, le texte passe en fondu). Sans script, la
   page bascule quand même, par `:target` — voir la fin de ce fichier. */

.shelf-page {
  --pad: clamp(1rem, 3vw, 3rem);
  --pad-block: clamp(1.5rem, 5vh, 3.5rem);
  --gap: clamp(2rem, 4vw, 4.5rem);
  --aside-w: clamp(17rem, 26vw, 25rem);
  /* Réglés pour un fond clair (papier, depuis le 10 novembre 2026) : un voile
     d'encre très léger, comme une feuille posée sur une autre. */
  --mat: rgba(17, 17, 17, 0.035);
  --mat-hover: rgba(17, 17, 17, 0.065);
  --mat-edge: rgba(17, 17, 17, 0.08);
  --shadow-ink: rgba(17, 17, 17, 0.22);

  display: grid;
  gap: var(--gap);
  padding-inline: var(--pad);
}

/* --- La colonne de gauche --- */

.aside {
  display: flex;
  flex-direction: column;
  padding-block: var(--pad-block) 0;
}

.aside__home {
  margin: 0 0 clamp(1.5rem, 4vh, 3rem);
  font-size: var(--text-meta);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--wall-text-muted);
}

.aside__home a { text-decoration: none; }

.aside__mark { margin: 0 0 clamp(1.5rem, 4vh, 2.5rem); }

/* Le grand caractère, à la place du nom du modèle. Il ne bouge jamais : c'est
   le point fixe autour duquel les deux états s'échangent. */
.aside__ink {
  display: block;
  font-size: clamp(4.5rem, 3rem + 6vw, 8.5rem);
  line-height: 1;
  font-weight: 500;
  color: var(--wall-text);
  view-transition-name: ink-mark;
}

.aside__role {
  display: block;
  margin-top: 0.9rem;
  font-size: var(--text-meta);
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--wall-text-muted);
}

.career,
.book__text { max-width: 30rem; }

.career p,
.book__text p { color: var(--wall-text); }

.aside__foot {
  margin-top: auto;
  padding-block: 2.5rem var(--pad-block);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: var(--text-meta);
  letter-spacing: 0.08em;
  color: var(--wall-text-muted);
}

.aside__foot a { text-decoration: none; border-bottom: 1px solid transparent; }
.aside__foot a:hover,
.aside__foot a:focus-visible { border-color: currentColor; }

/* --- L'étagère --- */

.shelf { padding-block: var(--pad-block); }

.shelf__group + .shelf__group { margin-top: clamp(3rem, 8vh, 5rem); }

.shelf__label {
  margin: 0 0 1.5rem;
  font-size: var(--text-meta);
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--wall-text-muted);
}

.shelf__label span { letter-spacing: 0.12em; text-transform: none; font-style: italic; }
.shelf__label span::before { content: "· "; font-style: normal; }

.shelf__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(1.25rem, 2.5vw, 2rem);
}

@media (min-width: 36rem) {
  .shelf__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.tile {
  display: block;
  text-decoration: none;
  border-radius: 1.1rem;
}

/* Le passe-partout : un même cadre 4:3 pour des couvertures de toutes
   proportions — coffrets en hauteur, albums à l'italienne. La couverture est
   posée dedans à sa taille réelle, jamais recadrée. */
.tile__mat {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  padding: 9%;
  border-radius: 1.1rem;
  background: var(--mat);
  box-shadow: inset 0 0 0 1px var(--mat-edge);
  transition: background-color var(--duration-nav) var(--ease-ink);
}

.tile__img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border-radius: 3px;
  box-shadow: 0 0.9rem 1.8rem var(--shadow-ink);
  transition: scale var(--duration-nav) var(--ease-ink);
}

.tile__title {
  display: block;
  margin-top: 0.9rem;
  font-size: clamp(1.05rem, 1rem + 0.2vw, 1.15rem);
  line-height: 1.3;
  color: var(--wall-text);
}

.tile__meta {
  display: block;
  margin-top: 0.2rem;
  font-size: var(--text-meta);
  letter-spacing: 0.12em;
  color: var(--wall-text-muted);
}

.tile:hover .tile__mat,
.tile:focus-visible .tile__mat { background-color: var(--mat-hover); }

.tile:hover .tile__img,
.tile:focus-visible .tile__img { scale: 1.03; }

/* --- Le détail d'un livre --- */

.book { display: flex; flex-direction: column; }

.book__back {
  margin: 0 0 1.25rem;
  font-size: var(--text-meta);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.book__back a { text-decoration: none; color: var(--wall-text-muted); }
.book__back a:hover,
.book__back a:focus-visible { color: var(--wall-text); }

/* Le titre passe devant le texte de présentation, plus grand que lui. */
.book__title {
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.5rem);
  line-height: 1.15;
  margin-bottom: 0.6rem;
  outline: none;
}

.book__title:focus-visible { outline: 2px solid var(--wall-text); outline-offset: 4px; }

.book__meta {
  font-size: var(--text-meta);
  letter-spacing: 0.08em;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.book__text .book__meta,
.book__text .book__credit { color: var(--wall-text-muted); }

.book__credit { font-style: italic; }

.book__links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; }

.book__links a {
  text-decoration: none;
  border-bottom: 1px solid var(--wall-rule);
  transition: border-color var(--duration-fast) var(--ease-ink);
}

.book__links a:hover,
.book__links a:focus-visible { border-color: currentColor; }

.book__cover {
  margin: 0 0 2rem;
  order: -1;
  display: grid;
  gap: 1rem;
}

.book__frame {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.book__img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 70vh;
  border-radius: 4px;
  box-shadow: 0 1.5rem 3rem var(--shadow-ink);
}

/* Les autres volumes d'une série, en petit sous la couverture. */
.book__more {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.book__more img {
  display: block;
  width: auto;
  height: clamp(3.5rem, 8vh, 5.5rem);
  border-radius: 2px;
  box-shadow: 0 0.4rem 0.9rem var(--shadow-ink);
}

/* Chaque vignette passe le volume en grand (shelf.js). Celle qui est
   affichée est pleine, les autres un peu effacées. */
.book__thumb {
  display: block;
  border-radius: 3px;
  opacity: 0.55;
  transition: opacity var(--duration-fast) var(--ease-ink);
}

.book__thumb:hover,
.book__thumb:focus-visible,
.book__thumb[aria-current="true"] { opacity: 1; }

.book__thumb[aria-current="true"] img { outline: 2px solid var(--wall-text); outline-offset: 3px; }

/* --- Grand écran : deux colonnes, la gauche immobile --- */

@media (min-width: 60rem) {
  .shelf-page { grid-template-columns: var(--aside-w) minmax(0, 1fr); }

  /* Pas de défilement propre : une barre de défilement apparaîtrait au milieu
     de l'écran, entre le texte et la couverture. Un texte de livre plus haut
     que l'écran fait défiler la page entière ; la couverture, fixée, reste. */
  .aside {
    position: sticky;
    top: 0;
    min-height: 100vh;
    min-height: 100dvh;
  }

  /* La grande couverture occupe la place de l'étagère. Elle est fixée au
     viewport plutôt que rangée dans la colonne de droite : le texte et la
     couverture restent ainsi un seul <article>, lisible tel quel sans style
     ni script. */
  .book__cover {
    position: fixed;
    top: 0;
    bottom: 0;
    right: var(--pad);
    left: calc(var(--pad) + var(--aside-w) + var(--gap));
    margin: 0;
    padding-block: var(--pad-block);
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .book__img { max-height: 100%; }
}

/* --- Les deux états ---

   Avec script, shelf.js pose `data-book` sur .shelf-page et l'attribut
   `hidden` sur les livres fermés. Sans script, c'est `:target` qui décide. */

.shelf-page [hidden] { display: none !important; }

.shelf-page[data-book] .career,
.shelf-page[data-book] .shelf { display: none; }

html:not(.js) .book:not(:target) { display: none; }

html:not(.js) .shelf-page:has(.book:target) .career,
html:not(.js) .shelf-page:has(.book:target) .shelf { display: none; }

/* --- La transition ---

   La couverture ouverte porte `view-transition-name: book-cover` le temps du
   passage (posé par shelf.js) : le navigateur la fait voler de la vignette à
   la grande figure. Tout le reste — résumé, texte du livre, étagère — passe
   en fondu avec les deux colonnes ; le fond ne bouge pas.

   Le fondu est séquencé plutôt que croisé : l'ancien texte s'efface avant que
   le nouveau n'apparaisse. Croisés, les deux textes se superposaient ligne à
   ligne dans la colonne de gauche, illisibles pendant toute la traversée. */

::view-transition-group(book-cover) {
  animation-duration: var(--duration-cover);
  animation-timing-function: var(--ease-ink);
}

/* Le fondu porte sur les deux colonnes, pas sur la racine. La racine
   contient le fond — l'encre, ou le papier — et le fondre faisait apparaître,
   au creux du fondu, la toile blanche du navigateur (signalé par Si Mo le
   14 novembre 2026 sur la page Dessin). Identique avant et après, la racine
   reste désormais en place. */
.shelf-page .aside { view-transition-name: shelf-aside; }
.shelf-page .shelf { view-transition-name: shelf-main; }

::view-transition-group(shelf-aside),
::view-transition-group(shelf-main) { animation: none; }

::view-transition-old(shelf-aside),
::view-transition-old(shelf-main) {
  animation: shelf-fade-out var(--duration-cover) linear both;
}

::view-transition-new(shelf-aside),
::view-transition-new(shelf-main) {
  animation: shelf-fade-in var(--duration-cover) linear both;
}

@keyframes shelf-fade-out {
  0%   { opacity: 1; }
  40%  { opacity: 0; }
  100% { opacity: 0; }
}

@keyframes shelf-fade-in {
  0%   { opacity: 0; }
  40%  { opacity: 0; }
  100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .tile__mat,
  .tile__img,
  .book__thumb,
  .book__links a { transition-duration: 1ms; }

  .tile:hover .tile__img,
  .tile:focus-visible .tile__img { scale: 1; }
}
