* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-gutter: stable;
  --page-max: 1100px;
  --page-pad-x: 0.14vw;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #F1F1F1;
  color: #000000;
  min-height: 100vh;
  overflow-x: clip;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  padding: 0 env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F1F1F1;
  z-index: 10;
}

.header-content {
  width: 100%;
  max-width: var(--page-max);
  margin-left: auto;
  margin-right: auto;
  padding: 0 var(--page-pad-x);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 4vw;
  align-items: center;
}

.brand {
  grid-column: 1;
  justify-self: start;
  width: max-content;
  text-decoration: none;
  color: #000000;
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

nav {
  grid-column: 2;
  display: flex;
  justify-content: flex-end;
}

nav ul {
      list-style: none;
      display: flex;
      gap: 1.2rem;
      }

nav a {
      text-decoration: none;
      color: #000000;
      font-size: 0.8rem;
      letter-spacing: 0.08em;
      position: relative;
      padding-bottom: 4px;
      }

nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background: #000000;
  transition: width 0.25s ease;
}

nav a:hover::after {
  width: 100%;
}

main {
  margin-top: 72px;
  flex: 1;
}

.edition-detail {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 3rem var(--page-pad-x) 5rem;
  width: 100%;
  text-align: left;
}

.edition-back {
  margin-bottom: 1rem;
}

.edition-back a {
  color: #000000;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.edition-back a:hover {
  border-bottom-color: #000000;
}

.page-title {
  font-size: 2.25rem;
  font-weight: bold;
  margin-bottom: 2.5rem;
  line-height: 1.15;
  color: #000000;
}

.boutique-section-title {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.35;
  color: #000000;
  margin: 0 0 0.85rem;
}

.boutique-section-title + .boutique-section-title {
  margin-top: 1.1rem;
}

.boutique-placeholder {
  max-width: none;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #000000;
  margin-top: 1.8rem;
  text-align: left;
}

.boutique-placeholder a {
  color: #0000ee;
  text-decoration: underline;
}

.boutique-placeholder a:visited {
  color: #0000ee;
}

.boutique-placeholder a:hover {
  opacity: 0.7;
}

.edition-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  column-gap: clamp(0.75rem, 2vw, 1.25rem);
  row-gap: 2.5rem;
  align-items: stretch;
}

.edition-cover-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.edition-side-col {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-self: stretch;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.edition-intro {
  flex-shrink: 0;
  padding-right: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #000000;
}

.edition-intro p {
  margin: 0;
}

.edition-intro p + p {
  margin-top: 0.7rem;
}

.edition-cover-frame {
  width: 100%;
  max-width: 572px;
  aspect-ratio: 1 / 1;
  background: transparent;
  overflow: hidden;
}

.edition-cover-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Couverture entière, sans déformation ni recadrage (lettreboxing si besoin) */
.edition-cover-frame.edition-cover-fit-contain img {
  object-fit: contain;
  object-position: left center;
}

.edition-cover-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 1.5rem;
  text-align: center;
  color: #333333;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.5;
}

.edition-meta-box {
  border: none;
  background: #F1F1F1;
  padding: 0 0 0 0.5rem;
  margin-top: auto;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  /* Décalage du bloc « Détails » vers la gauche (valeur en px) */
  --details-shift-left: 144px;
  transform: translateX(calc(-1 * var(--details-shift-left)));
}

.edition-meta-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.edition-meta-list > div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.edition-meta-list dt {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #555555;
}

.edition-meta-list dd {
  font-size: 0.9rem;
  line-height: 1.45;
  color: #000000;
  margin: 0;
}

.edition-meta-bullets {
  list-style: none;
  margin: 0;
  padding: 0;
}

.edition-meta-bullets li {
  font-size: 0.9rem;
  line-height: 1.26;
  color: #000000;
  margin-bottom: 0.315rem;
}

.edition-nowrap {
  white-space: nowrap;
}

.edition-meta-bullets li:last-child {
  margin-bottom: 0;
}

.edition-actions-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.65rem;
  width: 100%;
  box-sizing: border-box;
}

.edition-action-pave {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  text-decoration: none;
  color: #000000;
  font-size: 0.72rem;
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.55rem 0.45rem;
  border: 1px solid #c8c8c8;
  background: #ffffff;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}

.edition-action-pave:hover {
  border-color: #000000;
  opacity: 0.88;
}

/* Fiches édition (même gabarit que « Dans l’Ombre ») : intro / Détails / pavés */
body.edition-fiche-livre {
  overflow-x: visible;
}

body.edition-fiche-livre .edition-intro,
body.edition-fiche-livre .edition-meta-box {
  text-align: left;
}

body.edition-fiche-livre .edition-meta-box {
  padding-left: 0;
  margin-top: 1rem;
}

/* Grille 2 lignes : (image | texte+Détails) puis (pavés | vide) — Détails calé sur le bas de l’image */
body.edition-fiche-livre .edition-detail-grid--fiche {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  grid-template-rows: auto auto;
  row-gap: 0.55rem;
  align-items: start;
}

body.edition-fiche-livre .edition-fiche-cell-image {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}

body.edition-fiche-livre .edition-fiche-side-band {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-self: start;
  min-width: 0;
  min-height: 0;
  height: auto;
  overflow: visible;
}

body.edition-fiche-livre .edition-fiche-side-band.is-edition-fiche-band-synced {
  height: var(--edition-fiche-image-h);
  min-height: var(--edition-fiche-image-h);
}

body.edition-fiche-livre .edition-fiche-side-band .edition-intro {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: visible;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.edition-fiche-livre .edition-fiche-side-band .edition-meta-box {
  flex-shrink: 0;
  margin-top: auto;
}

body.edition-fiche-livre .edition-fiche-cell-actions {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
}

body.edition-fiche-livre .edition-actions-row--fiche {
  width: 100%;
  max-width: 286px;
  margin-top: 0;
  transform: none;
}

body.edition-fiche-livre .edition-actions-row--single {
  max-width: 137px;
}

body.edition-fiche-livre .edition-actions-row--fiche .edition-action-pave {
  text-transform: capitalize;
  padding: 0.45rem 0.35rem;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}

body.edition-fiche-livre .edition-intro {
  --details-shift-left: 144px;
  transform: translateX(calc(-1 * var(--details-shift-left)));
  width: 140%;
  max-width: none;
  align-self: flex-start;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  html {
    --page-pad-x: 1.75rem;
  }

  .edition-detail {
    padding-right: var(--page-pad-x);
  }

  .edition-detail-grid {
    grid-template-columns: 1fr;
    row-gap: 2.5rem;
    column-gap: 0;
  }

  .edition-cover-frame {
    max-width: 462px;
    margin: 0 auto;
  }

  .edition-meta-box {
    max-width: 100%;
    margin: 0;
    padding: 0;
    transform: none;
    --details-shift-left: 0;
  }

  body.edition-fiche-livre .edition-detail-grid--fiche {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-rows: auto;
    row-gap: 2.5rem;
  }

  body.edition-fiche-livre .edition-fiche-cell-image,
  body.edition-fiche-livre .edition-fiche-cell-actions,
  body.edition-fiche-livre .edition-fiche-side-band {
    grid-column: auto;
    grid-row: auto;
  }

  body.edition-fiche-livre .edition-fiche-cell-image {
    order: 1;
  }

  body.edition-fiche-livre .edition-fiche-cell-actions {
    order: 2;
  }

  body.edition-fiche-livre .edition-fiche-side-band {
    order: 3;
    height: auto !important;
    min-height: 0 !important;
  }

  body.edition-fiche-livre .edition-fiche-side-band .edition-intro {
    flex: none;
    overflow: visible;
  }

  body.edition-fiche-livre .edition-fiche-side-band .edition-meta-box {
    margin-top: 1rem;
  }

  body.edition-fiche-livre .edition-intro {
    transform: none;
    width: 100%;
    max-width: 100%;
    align-self: stretch;
  }

  body.edition-fiche-livre .edition-actions-row--fiche {
    max-width: 231px;
    margin-left: auto;
    margin-right: auto;
  }

  .edition-side-col {
    gap: 1.5rem;
    height: auto;
  }

  .edition-cover-col {
    align-items: center;
    width: 100%;
  }

  .edition-cover-frame.edition-cover-fit-contain img {
    object-position: center center;
  }
}

@media (max-width: 600px) {
  html {
    --page-pad-x: 1.25rem;
  }

  header {
    height: 64px;
  }

  main {
    margin-top: 64px;
  }

  .header-content {
    padding-left: max(var(--page-pad-x), env(safe-area-inset-left, 0px));
    padding-right: max(var(--page-pad-x), env(safe-area-inset-right, 0px));
  }

  .edition-detail {
    padding-top: 1.75rem;
    padding-bottom: max(3rem, env(safe-area-inset-bottom, 0px));
    padding-left: max(var(--page-pad-x), env(safe-area-inset-left, 0px));
    padding-right: max(var(--page-pad-x), env(safe-area-inset-right, 0px));
  }

  .page-title {
    font-size: 1.65rem;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .boutique-section-title {
    font-size: 0.95rem;
    letter-spacing: 0.03em;
    margin-bottom: 0.7rem;
  }

  .boutique-section-title + .boutique-section-title {
    margin-top: 0.9rem;
  }

  .edition-intro {
    font-size: 1rem;
    line-height: 1.55;
    padding-right: 0;
  }

  .edition-meta-bullets li {
    font-size: 1rem;
    line-height: 1.395;
    margin-bottom: 0.45rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .edition-meta-bullets .edition-nowrap {
    white-space: normal;
    overflow-wrap: break-word;
  }

  .edition-meta-list dd {
    font-size: 1rem;
    line-height: 1.55;
  }

  .edition-back a {
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.15rem 0;
  }

  nav ul {
      list-style: none;
      display: flex;
      gap: 1.2rem;
      }

  nav a {
      text-decoration: none;
      color: #000000;
      font-size: 0.8rem;
      letter-spacing: 0.08em;
      position: relative;
      padding-bottom: 4px;
      }

  .edition-cover-frame {
    max-width: min(100%, 420px);
  }

  body.edition-fiche-livre .edition-actions-row--fiche {
    max-width: min(100%, 210px);
  }
}
