/* ==========================================================================
   Selam Éditions — breakpoints (mobile first)
   Phones: the screen is the page, as on an e-reader.
   From 48rem: the page becomes a sheet lying on a grey desk, with a spine
   on its left edge and the thickness of the other pages on its right.
   22.4rem ≈ 359px · 40rem ≈ 640px · 48rem ≈ 768px · 60rem ≈ 960px · 64rem ≈ 1024px
   ========================================================================== */

/* Phones (< 640px): a compact running head that always fits on one line,
   whatever the system font (Iowan Old Style on iPhone is wider than the
   Windows fallback). The wordmark is tighter, the "Menu" word is kept for
   screen readers only, and the burger keeps a 44px tap target. */
@media (max-width: 39.9375rem) {
  .site-header__inner {
    gap: var(--space-3xs);
  }

  .wordmark {
    min-width: 0;
    gap: 0.35em;
    font-size: 1rem;
    letter-spacing: 0.14em;
  }

  .lang-switch {
    flex-shrink: 0;
    letter-spacing: 0.06em;
  }

  .lang-switch a,
  .lang-switch span[aria-current] {
    min-width: 1.75rem;
  }

  .nav-toggle {
    flex-shrink: 0;
    justify-content: center;
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: 0;
    margin-right: calc(-1 * var(--space-2xs));
  }

  .nav-toggle__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .nav-toggle__icon {
    width: 1.35rem;
    height: 0.8rem;
  }
}

/* Very small phones (≤ 359px) */
@media (max-width: 22.4375rem) {
  :root {
    --header-h: 3.25rem;
  }

  .wordmark {
    font-size: 0.95rem;
  }

  .nav-toggle__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

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

@media (min-width: 40rem) {
  .shelf {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .article-list {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xl) var(--space-l);
  }

  .edition {
    grid-template-columns: 1fr auto;
    align-items: start;
    column-gap: var(--space-l);
  }

  .edition > * {
    grid-column: 1;
  }

  .edition .buy {
    grid-column: 2;
    grid-row: 1 / span 3;
    justify-content: flex-end;
    margin-top: 0;
  }
}

/* The book on the desk */
@media (min-width: 48rem) {
  body {
    background: var(--desk);
    padding-block: var(--space-l) var(--space-l);
  }

  html {
    background: var(--desk);
  }

  .book {
    max-width: var(--sheet);
    margin-inline: auto;
    box-shadow:
      /* thickness of the following pages, on the right edge */
      1px 0 0 #fff, 2px 0 0 #d2d2cf, 3px 0 0 #fff, 4px 0 0 #cfcfcc,
      5px 0 0 #fff, 6px 0 0 #c9c9c6,
      /* the sheet lifted off the desk */
      0 30px 60px -30px rgb(0 0 0 / 0.35), 0 2px 6px rgb(0 0 0 / 0.08);
  }

  /* The spine: a fold in the paper along the left edge */
  .book::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 51;
    width: 2.25rem;
    background: linear-gradient(to right, rgb(0 0 0 / 0.13), rgb(0 0 0 / 0.04) 35%, transparent);
    pointer-events: none;
  }

  .site-header__inner {
    padding-inline: var(--gutter);
  }

  .site-nav {
    left: 50%;
    right: auto;
    width: min(var(--sheet), 100%);
    transform: translateX(-50%);
  }

  .site-header.is-open .site-nav {
    animation-name: toc-in-centered;
  }

  @keyframes toc-in-centered {
    from { opacity: 0; transform: translate(-50%, -0.75rem); }
    to { opacity: 1; transform: translate(-50%, 0); }
  }

  .feature__covers {
    width: 17rem;
  }

  /* Full colophon on wide screens: about, Explorer, Informations */
  .site-footer__grid {
    grid-template-columns: 1.4fr 1fr 1fr;
    justify-items: start;
    gap: var(--space-l);
    padding-block: var(--space-2xl) var(--space-l);
    text-align: left;
  }

  .site-footer__grid > nav {
    display: block;
  }

  .site-footer .wordmark {
    font-size: 1.25rem;
  }

  .site-footer__about p {
    margin: var(--space-s) 0 0;
  }

  .site-footer__heading {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    margin-bottom: var(--space-2xs);
    font-family: var(--font-serif);
    font-size: var(--step--1);
    font-weight: 400;
    font-variant-caps: all-small-caps;
    letter-spacing: 0.18em;
    text-transform: lowercase;
    color: var(--faint);
  }

  .site-footer__list {
    display: grid;
    justify-content: start;
  }

  .site-footer__bottom {
    display: grid;
    justify-items: center;
    justify-content: center;
    gap: var(--space-2xs);
    padding-block: var(--space-m) var(--space-l);
  }

  .sempe--tailpiece {
    max-width: 9rem;
    margin-top: var(--space-xl);
  }
}

/* Homepage, phone and desktop: the title page and the runner's strip fill
   the first screen, so the runner's ground line sits on the bottom edge of
   the window. The title-page drawing takes the space that is left (it
   shrinks on short screens). On a screen too short for the text, the page
   simply grows rather than letting the text overlap the runner.
   Height = window - top margin of the sheet - running head - runner strip
   (strip = sheet width x 96/640). */
@media (min-height: 30rem) {
  .page-home {
    --fit-top: 0rem;
  }

  .page-home .title-page {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--fit-top) - var(--header-h) - 1px - min(8.1rem, 15vw));
    min-height: calc(100dvh - var(--fit-top) - var(--header-h) - 1px - min(8.1rem, 15vw));
    padding-block: clamp(0.75rem, 3vh, 2rem) clamp(0.5rem, 1.5vh, 1rem);
  }

  .page-home .title-page::after {
    display: none; /* no page number on the title page */
  }

  .page-home .title-page__inner {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.35rem, 1.5vh, 1rem);
  }

  .page-home .title-page__text {
    gap: 0.35rem;
  }

  .page-home .title-page__text p,
  .page-home .title-page__text p:first-child {
    font-size: var(--step-0);
    line-height: 1.5;
  }

  /* the drawing may use the whole width; its ground line runs to both
     edges of the page (clipped by the title page) */
  .page-home .title-page {
    overflow: hidden;
  }

  .page-home .title-page .sempe--hero {
    flex: 1 1 0;
    min-height: 3.5rem;
    width: 100%;
    max-width: none;
    margin: 0;
    aspect-ratio: auto;
  }

  .page-home .title-page .sempe--hero svg {
    width: 100%;
    height: 100%;
  }

  /* "Tourner la page ↓" on one line */
  .page-home .title-page .turn-page {
    display: inline-flex;
    gap: 0.4em;
    margin-top: 0;
  }

  .page-home .title-page .sempe--hero {
    min-height: 2.5rem;
  }
}

/* Homepage chapter "Les livres" (three tabs): one screen below the running
   head, whichever tab is open. The bookcase drawing takes the space left. */
@media (min-height: 30rem) {
  .page-home .section--tabs {
    scroll-margin-top: calc(-1 * var(--space-m));
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-h) - 1px);
    min-height: calc(100dvh - var(--header-h) - 1px);
    padding-block: clamp(0.75rem, 2.5vh, 1.75rem) clamp(2.25rem, 5vh, 3rem);
  }

  .page-home .section--tabs > .container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }

  .page-home .section--tabs .section-head {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: clamp(0.5rem, 2vh, 1.25rem);
  }

  .page-home .section--tabs .sempe--chapter {
    flex: 0 0 auto;
    height: clamp(2.75rem, 12vh - 3rem, 9rem);
    min-height: 0;
    width: 100%;
    max-width: 17rem;
    margin: 0;
    aspect-ratio: auto;
  }

  .page-home .section--tabs .sempe--chapter svg {
    width: 100%;
    height: 100%;
  }

  .page-home .section--tabs .section-head h2::after {
    margin-top: 0.6rem;
  }

  .page-home .section--tabs .tabs__list {
    margin-bottom: clamp(0.75rem, 2.5vh, 1.5rem);
  }

  .page-home .section--tabs .turn-page-wrap {
    margin-top: auto; /* at the foot of the screen, whichever tab is open */
    padding-top: clamp(0.5rem, 2vh, 1.25rem);
  }

  .page-home .section--tabs .turn-page {
    display: inline-flex;
    gap: 0.4em;
  }

  /* Tab "Séries": the runner runs just above "Tourner la page" */
  .page-home .section--tabs .tabs.is-ready {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }

  .page-home .section--tabs .tabs__panel:not([hidden]) {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }

  .page-home .section--tabs .tabs__panel > * {
    width: 100%;
  }

  .page-home .section--tabs .sempe--runner {
    margin-top: auto;
    padding-top: clamp(1rem, 4vh, 2.5rem);
  }
}

/* Tab "Les livres": a compact book card — one cover beside the title, the
   summary below, one line per edition (formats and pages stay on the book
   page). The card's parts become grid items (display: contents). */
.tabs .feature {
  grid-template-columns: 6rem 1fr;
  justify-items: stretch;
  align-items: start;
  gap: 0.35rem var(--space-s);
}

.tabs .feature + .feature {
  margin-top: var(--space-l);
  padding-top: var(--space-l);
}

.tabs .feature__covers,
.tabs .feature__covers--pair {
  position: static;
  width: 100%;
  padding: 0;
  grid-row: 1 / span 3;
}

.tabs .feature__covers .cover + .cover {
  display: none;
}

.tabs .feature__body {
  display: contents;
  text-align: left;
}

.tabs .feature__meta,
.tabs .feature__title {
  grid-column: 2;
  align-self: end;
}

.tabs .feature__title {
  align-self: start;
  margin-top: 0;
  font-size: var(--step-2);
}

.tabs .feature__summary,
.tabs .editions {
  grid-column: 1 / -1;
  max-width: none;
  margin-top: 0.35rem;
}

.tabs .feature__more {
  grid-column: 2;
  grid-row: 3;
  margin-top: 0;
}

.tabs .feature__summary {
  font-size: 0.95rem;
  line-height: 1.45;
}

.tabs .editions {
  border-top: var(--hairline);
}

/* one line per edition: "Édition française" on the left, the two buttons
   on the right (the title is the one of the card; "Paru" goes without
   saying when there are buttons) */
.tabs .feature .edition {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.6rem;
  padding-block: 0.55rem;
}

.tabs .feature .edition__facts,
.tabs .feature .edition__title,
.tabs .feature .edition:has(.buy) .edition__status {
  display: none;
}

.tabs .feature .edition__label {
  flex: 1 1 4rem;
  min-width: 0;
  margin: 0;
  line-height: 1.35;
}

.tabs .feature .buy {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  margin: 0 0 0 auto;
  padding: 4px 3px 2px 5px; /* the second pen stroke stays inside */
}

.tabs .feature .buy .button--cta {
  min-height: 2.6rem;
  padding-inline: 0.85em 0.75em;
  font-size: var(--step--1);
}

.tabs .feature__more .link-arrow {
  min-height: 2.25rem;
}

/* Tab "Le catalogue": smaller covers on the shelf */
.tabs .shelf__item .cover {
  max-width: 7rem;
}

/* Phones: the three tabs on one line */
@media (max-width: 47.9375rem) {
  .tabs__tab {
    padding-inline: 0.55em;
    font-size: var(--step--1);
    letter-spacing: 0.08em;
  }

  .tabs__tab[aria-selected="true"]::after {
    left: 0.55em;
    right: 0.55em;
  }
}

@media (min-width: 48rem) {
  .tabs .feature {
    grid-template-columns: 8.5rem 1fr;
    column-gap: var(--space-l);
  }

  .tabs .feature__covers {
    grid-row: 1 / span 5;
  }

  .tabs .feature__summary,
  .tabs .editions {
    grid-column: 2;
  }

  .tabs .feature__more {
    grid-row: auto;
  }

  .tabs .shelf__item .cover {
    max-width: 8.5rem;
  }
}

/* Homepage chapter "Articles" / "Journal": one screen below the running
   head, like the other chapters. The kite drawing takes the space left;
   if the screen is too short, the chapter simply grows. */
@media (min-height: 30rem) {
  .page-home #journal {
    scroll-margin-top: calc(-1 * var(--space-m));
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-h) - 1px);
    min-height: calc(100dvh - var(--header-h) - 1px);
    padding-block: clamp(0.75rem, 2.5vh, 1.75rem) clamp(2.25rem, 5vh, 3rem);
  }

  .page-home #journal > .container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }

  .page-home #journal .section-head {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: clamp(0.5rem, 2vh, 1.25rem);
  }

  .page-home #journal .sempe--chapter {
    flex: 1 1 0;
    min-height: 2.5rem;
    width: 100%;
    max-width: 17rem;
    margin: 0;
    aspect-ratio: auto;
  }

  .page-home #journal .sempe--chapter svg {
    width: 100%;
    height: 100%;
  }

  .page-home #journal .section-head h2::after {
    margin-top: 0.6rem;
  }

  .page-home #journal .article-list {
    gap: var(--space-m);
  }

  .page-home #journal .article-card {
    padding-bottom: var(--space-s);
  }

  .page-home #journal .journal-footer {
    margin-top: clamp(0.5rem, 2vh, 1.25rem);
  }

  .page-home #journal .journal-footer .link-arrow {
    min-height: 2.25rem;
  }

  .page-home #journal .turn-page-wrap {
    margin-top: auto;
    padding-top: clamp(0.25rem, 1.5vh, 1rem);
  }

  .page-home #journal .turn-page {
    display: inline-flex;
    gap: 0.4em;
  }
}

/* Homepage chapter "L'auteur" (menu "À propos"): exactly one screen below
   the running head, like the title page. The Simien drawing takes the space
   that is left; on a screen too short the section simply grows. */
@media (min-height: 30rem) {
  .page-home #a-propos,
  .page-home #about {
    scroll-margin-top: calc(-1 * var(--space-m)); /* + scroll-padding = just under the head */
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-h) - 1px);
    min-height: calc(100dvh - var(--header-h) - 1px);
    padding-block: clamp(0.75rem, 2.5vh, 1.75rem) clamp(2.25rem, 5vh, 3rem);
  }

  .page-home #a-propos > .container,
  .page-home #about > .container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }

  .page-home #a-propos .section-head,
  .page-home #about .section-head {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: clamp(0.75rem, 2.5vh, 1.75rem);
  }

  .page-home #a-propos .sempe--wide,
  .page-home #about .sempe--wide {
    flex: 1 1 0;
    min-height: 2.5rem;
    width: 100%;
    max-width: 34rem;
    margin: 0;
    aspect-ratio: auto;
  }

  .page-home #a-propos .sempe--wide svg,
  .page-home #about .sempe--wide svg {
    width: 100%;
    height: 100%;
  }

  .page-home #a-propos .section-head h2::after,
  .page-home #about .section-head h2::after {
    margin-top: 0.6rem;
  }

  .page-home #a-propos .about__text > * + *,
  .page-home #about .about__text > * + * {
    margin-top: 0.6rem;
  }

  .page-home #a-propos .about__text .lead,
  .page-home #about .about__text .lead {
    font-size: var(--step-0);
    line-height: 1.5;
  }

  .page-home #a-propos .turn-page-wrap,
  .page-home #about .turn-page-wrap {
    margin-top: auto;
    padding-top: clamp(0.5rem, 2vh, 1.5rem);
  }

  .page-home #a-propos .turn-page,
  .page-home #about .turn-page {
    display: inline-flex;
    gap: 0.4em;
  }
}

/* Phones: a small portrait beside the text */
@media (max-width: 47.9375rem) and (min-height: 30rem) {
  .page-home #a-propos .about,
  .page-home #about .about {
    grid-template-columns: 6.5rem 1fr;
    justify-items: stretch;
    align-items: start;
    gap: var(--space-s);
  }

  .page-home #a-propos .about__portrait,
  .page-home #about .about__portrait {
    width: 100%;
    padding: 0.3rem 0.3rem 1.1rem;
  }

  .page-home #a-propos .about__text p,
  .page-home #about .about__text p {
    font-size: 0.95rem;
    line-height: 1.45;
  }

  .page-home #a-propos .about__text .link-arrow,
  .page-home #about .about__text .link-arrow {
    min-height: 2.5rem;
  }
}

/* Short screens: smaller covers on the catalogue shelf */
@media (max-height: 50rem) {
  .tabs .shelf__item .cover {
    max-width: 6rem;
  }
}

/* Short phones (browser bars shown): the bookcase drawing gives way and the
   summary is a little tighter, so that each tab still fits on one screen */
@media (max-width: 47.9375rem) and (min-height: 30rem) and (max-height: 50rem) {
  .page-home .section--tabs .sempe--chapter {
    display: none;
  }

  .tabs .feature__summary {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3; /* the whole summary is on the book page */
    overflow: hidden;
    font-size: 0.9rem;
    line-height: 1.4;
  }
}

/* Very short phones (iPhone SE with the browser bars): the tab bar names
   the chapter, its title gives way */
@media (max-width: 47.9375rem) and (min-height: 30rem) and (max-height: 37rem) {
  .page-home .section--tabs .section-head {
    display: none;
  }

  .page-home .section--tabs .tabs__list {
    margin-top: 0.25rem;
  }
}

/* Short screens (laptops 1366×768, phones with the browser bars shown):
   a more compact title page */
@media (min-height: 30rem) and (max-height: 50rem) {
  .page-home .title-page__inner > .kicker {
    display: none;
  }

  .page-home .title-page__text p,
  .page-home .title-page__text p:first-child {
    font-size: 0.95rem;
    line-height: 1.45;
  }
}

/* Phones: the button and the "About" link side by side */
@media (max-width: 47.9375rem) and (min-height: 30rem) {
  .page-home .title-page .actions {
    flex-wrap: nowrap;
    gap: var(--space-s);
  }

  .page-home .title-page .actions .button {
    min-height: 2.75rem;
    padding-inline: 0.8em;
    font-size: var(--step--1);
    letter-spacing: 0.08em;
    white-space: nowrap;
  }

  .page-home .title-page .actions .link-arrow {
    font-size: var(--step--1);
    white-space: nowrap;
  }
}

@media (min-width: 48rem) and (min-height: 30rem) {
  .page-home {
    --fit-top: 2rem; /* the sheet sits 2rem below the top of the window */
  }
}

/* Contents shown in the running head from 60rem */
@media (min-width: 60rem) {
  .nav-toggle {
    display: none;
  }

  .site-nav,
  .site-header.is-open .site-nav {
    display: block;
    position: static;
    width: auto;
    overflow: visible;
    background: none;
    border: 0;
    transform: none;
    animation: none;
  }

  .site-nav::before {
    display: none;
  }

  .site-nav__list {
    display: flex;
    gap: var(--space-m);
    max-width: none;
    padding: 0;
  }

  .site-nav__link {
    position: relative;
    padding: var(--space-2xs) 0;
    font-size: var(--step--1);
    font-style: normal;
    font-variant-caps: all-small-caps;
    letter-spacing: 0.14em;
  }

  .site-nav__item:first-child .site-nav__link {
    font-style: normal;
  }

  .site-nav__link::before,
  .site-nav__item:first-child .site-nav__link::before {
    display: none;
  }

  /* An ink line drawn under the link, left to right */
  .site-nav__link::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0.3rem;
    min-width: 0;
    height: 1px;
    border: 0;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 320ms var(--ease);
  }

  .site-nav__link:hover::after,
  .site-nav__link[aria-current]::after {
    transform: scaleX(1);
  }

  .site-nav__link[aria-current] {
    font-style: normal;
  }

  .site-header .lang-switch {
    margin-left: var(--space-s);
    padding-left: var(--space-s);
    border-left: var(--hairline);
  }
}

@media (min-width: 64rem) {
  .title-page {
    padding-top: var(--space-2xl);
  }

  /* Featured book: cover on the left page, text on the right */
  .feature {
    grid-template-columns: 15rem 1fr;
    justify-items: stretch;
    align-items: start;
    gap: var(--space-xl);
  }

  .feature__covers {
    width: 100%;
    position: sticky;
    top: calc(var(--header-h) + var(--space-l));
  }

  .feature__body {
    text-align: left;
  }

  .about {
    grid-template-columns: 13rem 1fr;
    justify-items: stretch;
    align-items: start;
  }

  .about__portrait {
    width: 100%;
  }

  .about__text .kicker,
  .about__text h2 {
    text-align: left;
  }

  /* Book landing page: cover column + text column */
  .book-page {
    grid-template-columns: 14rem 1fr;
    gap: var(--space-l) var(--space-xl);
    padding-top: var(--space-xl);
  }

  .book-page__cover-col {
    display: block;
    grid-row: 1 / span 3;
  }

  .book-page__cover-col .cover {
    position: sticky;
    top: calc(var(--header-h) + var(--space-l));
  }

  .book-page__intro {
    display: block;
    text-align: left;
  }

  .book-page__intro .cover {
    display: none;
  }

  .book-page__summary {
    margin-inline: 0;
  }

  .book-page__other,
  .book-page__back {
    text-align: left;
  }

  .book-page__tabs.is-ready .tabs__list {
    justify-content: flex-start;
  }

}

/* Compact colophon on wide screens, so that "Contact" and the whole footer
   fit together on the last screen of the homepage */
@media (min-width: 48rem) {
  .sempe--tailpiece {
    max-width: 6.5rem;
    margin-top: var(--space-m);
  }

  .site-footer__grid {
    padding-block: var(--space-m) var(--space-s);
  }

  .site-footer__list a,
  .site-footer__list button {
    padding-block: 0.15rem;
  }

  /* "Explorer" repeats the menu of the running head: hidden here too, and
     "Informations" on two columns */
  .site-footer__grid {
    grid-template-columns: 1fr auto;
  }

  .site-footer__about p {
    max-width: 34em;
  }

  .site-footer__list a,
  .site-footer__list button,
  .site-footer__bottom > *,
  .site-footer__bottom a {
    white-space: nowrap;
  }

  .site-footer__grid > nav {
    display: none;
  }

  .site-footer__grid > div:last-child .site-footer__list {
    grid-template-columns: auto auto;
    column-gap: var(--space-m);
  }

  .site-footer__bottom {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0 var(--space-s);
    padding-block: var(--space-xs);
  }

  .site-footer__bottom .back-to-top {
    margin-right: 0;
  }

  .site-footer__bottom > p {
    flex-basis: auto;
  }
}

/* Homepage, last screen: the "Contact" chapter takes the window height minus
   the running head and the footer (measured by main.js as --footer-h), so
   that Contact and the whole footer fill exactly one screen. The coffee
   drawing takes the space that is left; if the screen is too short, the
   chapter simply grows. */
@media (min-height: 30rem) {
  .page-home {
    --fit-bottom: 0rem;
  }

  .page-home #contact {
    scroll-margin-top: calc(-1 * var(--space-m)); /* + scroll-padding = just under the head */
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-h) - 1px - var(--footer-h, 0px) - var(--fit-bottom));
    min-height: calc(100dvh - var(--header-h) - 1px - var(--footer-h, 0px) - var(--fit-bottom));
    padding-block: clamp(0.75rem, 2.5vh, 1.75rem) clamp(2rem, 4.5vh, 2.75rem);
  }

  .page-home #contact::after {
    display: none; /* no page number squeezed against the button */
  }

  .page-home #contact > .container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }

  .page-home #contact .section-head {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: clamp(0.5rem, 2vh, 1.25rem);
  }

  .page-home #contact .sempe--chapter {
    flex: 1 1 0;
    min-height: 2.5rem;
    width: 100%;
    max-width: 17rem;
    margin: 0;
    aspect-ratio: auto;
  }

  .page-home #contact .sempe--chapter svg {
    width: 100%;
    height: 100%;
  }

  .page-home #contact .section-head h2::after {
    margin-top: 0.6rem;
  }

  .page-home #contact .contact-block {
    gap: clamp(0.35rem, 1.2vh, 0.9rem);
  }

  .page-home #contact .contact-block__email {
    margin-top: 0;
    font-size: var(--step-1);
  }

  .page-home #contact .contact-block .section-head__intro {
    font-size: 0.95rem;
    line-height: 1.45;
  }

  .page-home #contact .turn-page-wrap {
    margin-top: auto;
    padding-top: clamp(0.25rem, 1.5vh, 1rem);
  }

  .page-home #contact .turn-page {
    display: inline-flex;
    gap: 0.4em;
  }
}

@media (min-width: 48rem) and (min-height: 30rem) {
  .page-home {
    --fit-bottom: 2rem; /* the desk below the sheet */
  }
}

/* Short screens: the chapter numbers give way (the back-to-title link
   stays: it closes the book) */
@media (min-height: 30rem) and (max-height: 56rem) {
  .page-home #contact .chapter-number,
  .page-home .section--tabs .chapter-number,
  .page-home #journal .chapter-number,
  .page-home #a-propos .chapter-number,
  .page-home #about .chapter-number {
    display: none;
  }
}

/* Phones: smaller lion, legal links and bottom line tighter, smaller text
   in "L'auteur" */
@media (max-width: 47.9375rem) {
  .sempe--tailpiece {
    max-width: 4rem;
    margin-top: var(--space-xs);
  }

  .site-footer__grid {
    gap: var(--space-xs);
    padding-block: var(--space-xs) var(--space-2xs);
  }

  .site-footer__about p {
    max-width: none;
    line-height: 1.45;
  }

  .site-footer__list a,
  .site-footer__list button {
    padding-block: 0.3rem;
  }

  .site-footer__bottom {
    padding-top: var(--space-2xs);
    font-size: var(--step--2);
  }
}

@media (max-width: 47.9375rem) and (min-height: 30rem) {
  .page-home #a-propos .about,
  .page-home #about .about {
    grid-template-columns: 5.5rem 1fr;
  }

  .page-home #a-propos .about__text p,
  .page-home #about .about__text p {
    font-size: 0.9rem;
    line-height: 1.42;
  }
}

/* About and Contact pages: one screen below the running head, from the
   breadcrumb to the runner. The vignette at the top takes the space left;
   on screens too short for the text, the page simply grows. */
@media (min-height: 30rem) {
  .page-fit {
    --desk-top: 0px;
  }

  .page-fit main {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-h) - 1px - var(--desk-top));
    min-height: calc(100dvh - var(--header-h) - 1px - var(--desk-top));
  }

  .page-fit .breadcrumb {
    flex: 0 0 auto;
    padding-top: clamp(0.5rem, 1.6vh, 1.25rem);
  }

  .page-fit .page-head {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    padding-block: clamp(0.5rem, 2vh, 1.5rem) clamp(0.5rem, 1.6vh, 1.25rem);
  }

  .page-fit .page-head .container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .page-fit .page-head .kicker {
    display: none; /* the breadcrumb already names the page */
  }

  .page-fit .page-head .sempe--vignette {
    flex: 1 1 0;
    min-height: 2.5rem;
    max-height: 11rem;
    width: 100%;
    max-width: 15rem;
    margin: 0 0 clamp(0.4rem, 1.5vh, 1rem);
    aspect-ratio: auto;
  }

  .page-fit .page-head .sempe--vignette svg {
    width: 100%;
    height: 100%;
  }

  .page-fit .page-head__title {
    margin-top: 0;
    font-size: min(var(--step-3), 7vw);
  }

  .page-fit .page-head__title::after {
    margin-top: clamp(0.5rem, 1.5vh, 1rem);
  }

  .page-fit .page-head .lead {
    max-width: 32em;
    margin-top: clamp(0.5rem, 1.5vh, 1rem);
    font-size: var(--step-0);
    line-height: 1.45;
  }

  .page-fit .page-body {
    flex: 0 0 auto;
    padding-block: 0 clamp(2rem, 4.5vh, 3rem); /* room for the folio */
  }

  .page-fit .page-body::after {
    bottom: clamp(0.5rem, 1.5vh, 1rem);
  }

  /* "Retour à l'accueil" closes the page, just above the runner */
  .page-fit .page-back {
    margin-top: clamp(0.25rem, 1.5vh, 1rem);
    padding-top: 0;
    border-top: 0;
  }

  .page-fit .page-back .link-back {
    min-height: 2.5rem;
  }

  .page-fit main > .sempe--strip {
    flex: 0 0 auto;
    height: clamp(2.75rem, 9vh, 5.5rem);
    aspect-ratio: auto;
  }

  .page-fit main > .sempe--strip svg {
    width: 100%;
    height: 100%;
  }

  /* About: the four panels share one place, so the page keeps the height of
     the longest one whichever tab is open (nothing jumps). */
  .page-about .tabs.is-ready {
    display: grid;
  }

  .page-about .tabs.is-ready > * {
    grid-column: 1;
  }

  .page-about .tabs.is-ready .tabs__panel {
    grid-row: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .page-about .tabs.is-ready .tabs__panel[hidden] {
    display: flex !important; /* keeps its place, unseen and unread */
    visibility: hidden;
  }

  .page-about .tabs__list {
    margin-bottom: clamp(0.75rem, 2.5vh, 1.5rem);
  }

  .page-about .prose {
    margin: 0 auto;
  }

  .page-about .tabs__more {
    text-align: center;
  }

  .page-about .contact-block {
    margin-top: clamp(0.5rem, 2vh, 1.25rem);
    gap: clamp(0.5rem, 1.6vh, 1rem);
  }

  .page-about .contact-block__email {
    margin-top: 0;
  }

  /* Contact */
  .page-contact .contact-block > div > * + * {
    margin-top: clamp(0.5rem, 1.6vh, 1rem);
  }

  .page-contact .contact-block__email {
    margin-top: 0;
  }

  .page-contact .page-body .prose {
    margin: clamp(0.75rem, 2.5vh, 1.5rem) auto 0;
    text-align: center;
  }
}

/* The author: the portrait beside the text */
.page-about .about {
  grid-template-columns: auto 1fr;
  align-items: center;
  justify-items: start;
  gap: clamp(1rem, 3vw, 2.5rem);
  max-width: 44rem;
  margin-inline: auto;
}

.page-about .about__portrait {
  width: clamp(5.5rem, 22vw, 12rem);
  padding: 0.4rem 0.4rem 1.4rem;
}

/* Four tabs: two rows of two on phones */
@media (max-width: 39.9375rem) {
  .page-about .tabs.is-ready .tabs__list {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: center;
    border-bottom: 0;
  }

  .page-about .tabs__tab {
    min-height: 2.4rem;
    padding: 0 0.6em;
    border-bottom: var(--hairline);
    font-size: 0.95rem;
    letter-spacing: 0.08em;
  }

  .page-about .tabs__tab[aria-selected="true"]::after {
    left: 0.6em;
    right: 0.6em;
  }

  /* the text runs around the portrait */
  .page-about .about {
    display: block;
  }

  .page-about .about__portrait {
    float: left;
    width: 5.25rem;
    margin: 0.3rem 1rem 0.4rem 0.2rem;
    padding: 0.3rem 0.3rem 1rem;
  }

  .page-fit .prose p {
    font-size: 0.95rem;
    line-height: 1.5;
  }
}

@media (min-width: 48rem) and (min-height: 30rem) {
  .page-fit {
    --desk-top: var(--space-l);
  }
}

/* Short laptop screens: a smaller portrait and no lead line on the About
   page, so that "Retour à l'accueil" stays on screen */
@media (min-width: 40rem) and (min-height: 30rem) and (max-height: 48rem) {
  .page-about .page-head .lead {
    display: none;
  }

  .page-about .about__portrait {
    width: clamp(5.5rem, 22vh, 9rem);
  }
}

/* Short phones: the About page keeps its title, tabs and text; the lead
   line under the title gives way. */
@media (max-width: 39.9375rem) and (min-height: 30rem) and (max-height: 42rem) {
  .page-about .page-head .lead {
    display: none;
  }
}

/* Very short phones: the About page's vignette gives way too */
@media (max-width: 39.9375rem) and (min-height: 30rem) and (max-height: 37rem) {
  .page-about .page-head .sempe--vignette {
    display: none;
  }
}

/* Print: keep content, drop chrome */
@media print {
  .site-header,
  .site-footer,
  .consent-banner,
  .sempe,
  .buy {
    display: none !important;
  }

  body,
  html {
    background: #fff;
    padding: 0;
  }

  .book {
    box-shadow: none;
  }

  .book::before {
    display: none;
  }
}

/* Book page (/b01/, /en/b01/): each tab fits on one screen below the
   running head, from the breadcrumb to the runner. At the foot of each tab:
   "Tous les livres" on the left, the next tab on the right. On phones the
   cover becomes a thumbnail beside the title. On a screen too short for the
   text, the page simply grows. */
.book-page__intro {
  grid-template-columns: auto 1fr;
  justify-items: start;
  align-items: center;
  gap: var(--space-s);
  text-align: left;
}

.book-page__intro .cover {
  width: clamp(2.75rem, 7vh, 4.5rem);
}

.book-page__title {
  margin-top: 0;
  font-size: min(var(--step-3), 7vw);
}

.book-page .imprint {
  display: none; /* the running head already says Selam Éditions */
}

.book-page__tabs .tabs__panel > .tabs__heading + * {
  margin-top: 0;
}

.book-page__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0 var(--space-s);
  margin-top: var(--space-m);
  padding-top: var(--space-2xs);
  border-top: var(--hairline);
}

.book-page__nav .link-arrow {
  margin-left: auto;
}

.book-page__nav a {
  min-height: 2.5rem;
  font-size: var(--step--1);
}

@media (min-width: 48rem) {
  .book-chapters {
    grid-template-rows: repeat(5, auto);
    grid-auto-flow: column;
    column-gap: var(--space-l);
  }
}

@media (min-height: 30rem) {
  .page-book {
    --desk-top: 0px;
  }

  .page-book main {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-h) - 1px - var(--desk-top));
    min-height: calc(100dvh - var(--header-h) - 1px - var(--desk-top));
  }

  .page-book .breadcrumb {
    flex: 0 0 auto;
    padding-top: clamp(0.4rem, 1.4vh, 1rem);
  }

  .page-book .book-page {
    flex: 1 1 auto;
    grid-template-rows: auto 1fr;
    align-content: stretch;
    gap: clamp(0.5rem, 1.8vh, 1.25rem) var(--space-xl);
    padding-block: clamp(0.4rem, 1.6vh, 1.25rem) clamp(0.25rem, 1vh, 0.75rem);
  }

  .page-book .book-page__tabs.is-ready {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .page-book .tabs.is-ready .tabs__list {
    margin-bottom: clamp(0.5rem, 1.8vh, 1.25rem);
  }

  .page-book .tabs__panel:not([hidden]) {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
  }

  .page-book .book-page__summary,
  .page-book .book-page__buy {
    max-width: none;
    font-size: 0.97rem;
    line-height: 1.5;
  }

  .page-book .book-page__summary > * + * {
    margin-top: clamp(0.35rem, 1.2vh, 0.8rem);
  }

  .page-book .book-page__summary .lead {
    font-size: var(--step-1);
    line-height: 1.3;
  }

  .page-book .book-chapters {
    margin-top: 0.35rem;
  }

  .page-book .book-facts {
    margin-top: clamp(0.5rem, 1.6vh, 1rem);
    padding-block: clamp(0.35rem, 1vh, 0.75rem);
  }

  .page-book .book-page__nav {
    margin-top: auto;
  }

  .page-book .book-page__summary .book-page__nav {
    margin-top: auto;
  }

  .page-book .tabs__panel > :nth-last-child(2) {
    margin-bottom: clamp(0.4rem, 1.4vh, 0.9rem);
  }

  /* the Lalibela drawing takes the space left under the editions */
  .page-book .book-page__buy .sempe--vignette {
    flex: 1 1 0;
    min-height: 0;
    max-height: 9rem;
    margin: clamp(0.5rem, 1.6vh, 1rem) auto 0;
    aspect-ratio: auto;
  }

  .page-book .book-page__buy .sempe--vignette svg {
    width: 100%;
    height: 100%;
  }

  /* one line per edition: label and title on the left, buttons on the right */
  .page-book .edition {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.1rem 0.75rem;
    padding-block: clamp(0.4rem, 1.4vh, 0.85rem);
  }

  .page-book .edition__label {
    grid-column: 1;
    margin: 0;
    line-height: 1.35;
  }

  .page-book .edition__title {
    grid-column: 1;
    font-size: var(--step-0);
  }

  .page-book .edition .buy {
    grid-column: 2;
    grid-row: 1 / span 2;
    flex-wrap: nowrap;
    margin: 0;
    padding: 4px 3px 2px 5px;
  }

  .page-book .edition .buy .button--cta {
    min-height: 2.6rem;
    padding-inline: 0.85em 0.75em;
    font-size: var(--step--1);
  }

  .page-book .edition:has(.buy) .edition__status,
  .page-book .book-page__other {
    display: none; /* the buttons say it is out; the header switches language */
  }

  .page-book main > .sempe--strip {
    flex: 0 0 auto;
    height: clamp(2.25rem, 7vh, 4.5rem);
    aspect-ratio: auto;
  }

  .page-book main > .sempe--strip svg {
    width: 100%;
    height: 100%;
  }
}

@media (min-width: 48rem) and (min-height: 30rem) {
  .page-book {
    --desk-top: var(--space-l);
  }
}

/* Large screens: the cover on the left, sized to the height of the window;
   the title and the three tabs on one line each */
@media (min-width: 64rem) {
  .page-book .book-page {
    grid-template-columns: auto 1fr;
    column-gap: var(--space-l);
  }

  .page-book .book-page__cover-col {
    grid-row: 1 / span 2;
  }

  .page-book .book-page__cover-col .cover {
    width: clamp(7.5rem, 22vh, 12rem);
  }

  .page-book .book-page__title {
    font-size: var(--step-2);
  }

  .page-book .book-page__tabs.is-ready .tabs__list {
    flex-wrap: nowrap;
  }

  .page-book .tabs__tab {
    padding: 0 0.6em;
    font-size: 0.86rem;
    letter-spacing: 0.08em;
  }

  .page-book .tabs__tab:first-child {
    padding-left: 0;
  }

  .page-book .tabs__tab[aria-selected="true"]::after {
    left: 0.6em;
    right: 0.6em;
  }

  .page-book .tabs__tab:first-child[aria-selected="true"]::after {
    left: 0;
  }
}

/* Phones: smaller text in the tabs, the tabs on two lines, no breadcrumb
   (the running head and "Tous les livres" lead back) */
@media (max-width: 47.9375rem) and (min-height: 30rem) {
  .page-book .breadcrumb {
    display: none;
  }

  .page-book .book-page__summary,
  .page-book .book-page__buy {
    font-size: 0.9rem;
    line-height: 1.42;
  }

  .page-book .book-page__summary .lead {
    font-size: 1.05rem;
  }

  .page-book .book-page__byline {
    margin-top: 0.2rem;
  }

  .page-book .tabs__tab {
    min-height: 2.3rem;
    padding: 0 0.55em;
    font-size: 0.86rem;
    letter-spacing: 0.07em;
  }

  .page-book .tabs__tab[aria-selected="true"]::after {
    left: 0.55em;
    right: 0.55em;
  }

  .page-book .book-chapters {
    gap: 0;
  }

  .page-book .edition__title,
  .page-book main > .sempe--strip {
    display: none; /* the label says which edition; no room for the runner */
  }

  .page-book .book-page__summary .lead {
    font-size: 1rem;
  }

  .page-book .book-page__buy .sempe--vignette {
    max-height: 6rem;
  }
}

/* Short laptop screens: the runner gives way under the book page */
@media (min-width: 48rem) and (min-height: 30rem) and (max-height: 45rem) {
  .page-book main > .sempe--strip {
    display: none;
  }

  .page-book .book-page__summary .lead {
    font-size: var(--step-0);
  }
}

/* Very short phones (iPhone SE with the browser bars): the first tab names
   the book, so the title block is kept for screen readers only */
@media (max-width: 47.9375rem) and (min-height: 30rem) and (max-height: 37rem) {
  .page-book .book-page__intro {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .page-book .book-page__summary,
  .page-book .book-page__buy {
    font-size: 0.86rem;
    line-height: 1.38;
  }

  .page-book .book-page__summary .lead {
    font-size: 0.95rem;
  }
}
