/* =========================================================================
   Éditions Hashtag — authors.css
   templates/page-authors.php (index, page 358) + templates/page-author.php
   (the 47 children of 358). Requires base.css; consumes its tokens and
   components only (author tile, book card, section opener, breadcrumbs,
   link-arrow). Scoped by .site-main--authors / .site-main--author.
   Breakpoints: md 760px · lg 1100px (literal, as in base.css).
   ========================================================================= */

/* -------------------------------------------------------------------------
   1. Index — page opener: base .page-head.page-head--split (as the Catalogue)
   ------------------------------------------------------------------------- */

/* -------------------------------------------------------------------------
   2. Index — the 47 portraits (ul.author-grid > li.author-tile, base), in
      alphabetical order of the family name (client decision of 2026-11-21).
      3 columns on phones (16 rows, names at --fs-small, two lines allowed), 4 on tablets, 6 on desktop; uniform B&W (base
      filter), names under a hairline; newspaper column rules on desktop.
      The first author of each letter carries a small ink letter tab on the photo (.author-tile__letter)
      and the anchor #lettre-x; the letter rail (2b) jumps to it.
   ------------------------------------------------------------------------- */
.authors-index { padding-top: var(--s-5); border-top: var(--rule-bold) solid var(--color-line-strong); }
.authors-index__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--s-3); row-gap: var(--s-5); }
.authors-index .author-tile { position: relative; min-width: 0; }
.authors-index .author-tile__name {
  margin-top: 0; padding-top: 6px;
  font-size: var(--fs-small); line-height: 1.2; font-variation-settings: "opsz" 18; overflow-wrap: break-word; text-wrap: wrap; /* greedy: never splits "Jean-Paul" to balance */
}
.authors-index .author-tile__photo { margin-bottom: 0; }
.authors-index .author-tile__img { width: 100%; height: 100%; }
.authors-index .author-tile__link:focus-visible { outline-offset: 4px; }
.author-tile__letter {
  position: absolute; top: 0; left: 0; z-index: var(--z-raised); display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; background: var(--c-ink); color: var(--c-white);
  font: var(--fw-semibold) var(--fs-micro)/1 var(--font-sans); letter-spacing: .02em; pointer-events: none;
  transition: background-color var(--dur-mid);
}
.author-tile:target .author-tile__letter { background: var(--color-accent); } /* the letter just asked for in the rail */
.author-tile--letter { scroll-margin-top: calc(var(--sticky-top) + var(--tap) + var(--s-5)); } /* header + the letter strip */

/* -------------------------------------------------------------------------
   2b. Index — letter rail (nav.az-rail): A–Z, one link per letter that has
       an author. Phones and tablets: a strip pinned under the header, the
       letters in use only, 44px targets, scrolls sideways. Desktop: a narrow
       column beside the grid with the whole alphabet (letters without an
       author are printed light and are not links), pinned while the grid
       scrolls.
   ------------------------------------------------------------------------- */
.authors-index--az { padding-top: 0; }
.az-rail {
  position: sticky; top: var(--sticky-top); z-index: var(--z-sticky);
  margin-inline: calc(-1 * var(--margin)); margin-bottom: var(--s-5);
  background: var(--c-white); border-bottom: var(--rule-hair) solid var(--c-ink);
}
.az-rail__list { display: flex; padding-inline: calc(var(--margin) - var(--s-3)); overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.az-rail__list::-webkit-scrollbar { display: none; }
.az-rail__item { flex: none; }
.az-rail__item--off { display: none; }
.az-rail__link {
  display: flex; align-items: center; justify-content: center; min-width: 40px; height: var(--tap);
  font: var(--fw-medium) var(--fs-small)/1 var(--font-sans); letter-spacing: .04em; text-decoration: none; color: var(--c-ink);
  transition: color var(--dur-fast), background-color var(--dur-fast);
}
a.az-rail__link:hover { color: var(--color-accent); }
a.az-rail__link:focus-visible { outline-offset: -3px; } /* inside the scroll box, never clipped */
html:has(.az-rail) { scroll-behavior: smooth; } /* the jump to a letter is a short travel (off under reduced motion, base.css) */

@media (min-width: 760px) {
  .authors-index { padding-top: var(--s-6); }
  .authors-index--az { padding-top: 0; }
  .az-rail { margin-bottom: var(--s-6); }
  .authors-index__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--gutter); row-gap: var(--s-7); }
  .authors-index .author-tile__name { padding-top: var(--s-2); font-size: 1.1875rem; line-height: 1.22; font-variation-settings: "opsz" 24; text-wrap: pretty; }
  .authors-index .author-tile__photo { margin-bottom: var(--s-2); }
}
@media (min-width: 1100px) {
  /* the rail becomes the narrow first column, the whole alphabet, pinned under the compact bar */
  .authors-index--az { display: grid; grid-template-columns: var(--tap) minmax(0, 1fr); column-gap: var(--gutter); align-items: start; padding-top: var(--s-6); }
  .az-rail {
    top: calc(var(--sticky-top) + var(--s-4)); margin: 0; max-height: calc(100vh - var(--sticky-top) - 2 * var(--s-4)); overflow-y: auto; scrollbar-width: none;
    border-bottom: 0; border-right: var(--rule-hair) solid var(--color-line);
  }
  .az-rail::-webkit-scrollbar { display: none; }
  .az-rail__list { display: block; padding: 0; overflow: visible; }
  .az-rail__item--off { display: block; }
  .az-rail__link { min-width: 0; width: 100%; height: 25px; padding-right: var(--s-3); font-size: var(--fs-label); }
  .az-rail__item--off .az-rail__link { color: var(--c-grey-9c9); font-weight: var(--fw-regular); }
  a.az-rail__link:hover { background: var(--c-ink); color: var(--c-white); }
  .author-tile--letter { scroll-margin-top: calc(var(--sticky-top) + var(--s-4)); }
  .author-tile__letter { width: 28px; height: 28px; font-size: var(--fs-label); }
  .authors-index__grid { grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: var(--gutter); row-gap: var(--s-7); }
  .authors-index .author-tile::before {
    content: ""; position: absolute; top: 0; bottom: 0; left: calc(-.5 * var(--gutter));
    width: var(--rule-hair); background: var(--color-line-soft);
  }
  .authors-index .author-tile:nth-child(6n + 1)::before { content: none; }
  .authors-index .author-tile__name { font-size: 1.25rem; }
}

/* -------------------------------------------------------------------------
   3. Author page — head
      Phones: portrait (44%) beside the name, like the product head (cover
      44% beside the title); the name sits on the portrait's bottom edge
      (hang line). Landscape photos go full width above the name.
      md+: portrait in columns 1–4 (1–5 landscape), text in 6/7–12.
      The portrait keeps its own ratio and is never wider than its file
      (--natural): never cropped, never upscaled. --portrait-h caps tall
      photos on large screens. Always black and white.
   ------------------------------------------------------------------------- */
.site-main--author .breadcrumbs { padding-top: 0; }
.author-head {
  display: grid; grid-template-columns: minmax(0, 44fr) minmax(0, 56fr); grid-template-rows: auto auto;
  column-gap: var(--s-4); padding-top: var(--s-1);
}
.author-portrait {
  --portrait-h: 9999px;
  grid-column: 1; grid-row: 1 / span 2; display: grid; grid-template-rows: subgrid; margin: 0; min-width: 0;
}
.author-portrait__frame {
  display: block; align-self: end;
  width: min(100%, var(--natural), calc(var(--portrait-h) * var(--ratio))); aspect-ratio: var(--ratio);
  background: var(--color-panel); overflow: hidden;
}
.author-portrait__img { display: block; width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.04); }
.author-portrait__credit {
  margin-top: var(--s-2); max-width: min(100%, var(--natural));
  font-size: var(--fs-meta); line-height: 1.35; color: var(--color-text-muted); overflow-wrap: anywhere; text-wrap: balance;
}
/* 2rem from 390px up; below, the name scales with its column (27.5px at 360, 21.5px at 320) so a glued
   compound such as « Louis-Thomas » stays inside the screen on small phones */
.author-head__name {
  grid-column: 2; grid-row: 1; align-self: end; min-width: 0;
  font-family: var(--font-serif); font-weight: var(--fw-regular); font-size: clamp(1.25rem, calc(15vw - 1.65625rem), 2rem); line-height: 1.02;
  font-variation-settings: "opsz" var(--opsz-display); letter-spacing: -.02em; text-wrap: balance; overflow-wrap: break-word;
}
.author-head__name .hash-mark { font-weight: var(--fw-regular); }
.author-head__bio { grid-column: 1 / -1; grid-row: 3; margin-top: var(--s-6); font-size: var(--fs-lead); line-height: 1.5; }
.author-head__jump { grid-column: 1 / -1; grid-row: 4; justify-self: start; margin-top: var(--s-3); }
.author-head__jump .icon { color: var(--color-accent); }

/* landscape photo on phones: full width, name below */
.author-head--landscape { grid-template-columns: minmax(0, 1fr); }
.author-head--landscape .author-portrait { grid-row: 1; display: block; }
.author-head--landscape .author-head__name { grid-column: 1; grid-row: 2; margin-top: var(--s-5); font-size: 2.5rem; }
/* graceful variant without a photo (not in the data today; contract for a new author) */
.author-head--no-photo { grid-template-columns: minmax(0, 1fr); }
.author-head--no-photo .author-head__name { grid-column: 1; font-size: var(--fs-display); line-height: .95; padding-top: var(--s-5); }

@media (min-width: 760px) {
  .author-head, .author-head--landscape {
    grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: auto auto auto 1fr;
    column-gap: var(--gutter); padding-top: var(--s-3); align-items: start;
  }
  .author-portrait, .author-head--landscape .author-portrait { --portrait-h: 640px; grid-column: 1 / span 5; grid-row: 1 / span 4; display: block; }
  .author-portrait__frame { align-self: auto; }
  .author-head__name, .author-head--landscape .author-head__name {
    grid-column: 7 / -1; grid-row: 1; align-self: start; margin-top: 0;
    font-size: clamp(3rem, 1.4rem + 3.4vw, 5.25rem); line-height: .98;
  }
  .author-head__bio { grid-column: 7 / -1; grid-row: 2; margin-top: var(--s-6); }
  .author-head__jump { grid-column: 7 / -1; grid-row: 3; margin-top: var(--s-4); }
  .author-head--landscape .author-portrait { grid-column: 1 / span 6; }
  .author-head--no-photo .author-head__name, .author-head--no-photo .author-head__bio, .author-head--no-photo .author-head__jump { grid-column: 3 / span 8; }
}
@media (min-width: 1100px) {
  .site-main--author .breadcrumbs { padding-top: var(--s-3); }
  .author-head, .author-head--landscape { padding-top: var(--s-5); }
  .author-portrait { --portrait-h: 600px; grid-column: 1 / span 4; }
  .author-head__name, .author-head__bio, .author-head__jump { grid-column: 6 / -1; }
  .author-head__bio { max-width: 30em; font-size: 1.3125rem; }
  .author-head--landscape .author-portrait { grid-column: 1 / span 5; }
  .author-head--landscape .author-head__name, .author-head--landscape .author-head__bio, .author-head--landscape .author-head__jump { grid-column: 7 / -1; }
}

/* small file (--small: narrower than 320px, never upscaled): md+, the text starts at the photo's own width + 2 gutters */
@media (min-width: 760px) {
  .author-head--small { grid-template-columns: min(var(--natural), 40%) minmax(0, 1fr); column-gap: calc(2 * var(--gutter)); }
  .author-head--small .author-portrait { grid-column: 1; }
  .author-head--small :is(.author-head__name, .author-head__bio, .author-head__jump) { grid-column: 2; }
}

/* -------------------------------------------------------------------------
   4. Author page — books: the red italic "Par {Nom}" on the section opener,
      book cards (date DESC, no cap). 2 / 3 / 4 columns; one book = a
      horizontal feature card so a single title never floats in a corner.
      No author line on the cards (the page is the author).
   ------------------------------------------------------------------------- */
.section-head--byline .section-head__title {
  font-family: var(--font-serif); font-style: italic; font-weight: var(--fw-regular); font-size: var(--fs-h3); line-height: 1.2;
  font-variation-settings: "opsz" var(--opsz-heading); letter-spacing: 0; text-transform: none; color: var(--color-accent);
}
@media (min-width: 1100px) {
  .author-books__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .author-books__grid > .book-card:nth-child(4n + 1)::before { content: none; }
}
/* every card here is by this author: the red author line would only repeat the page's own name
   (stored variants such as "Grig" or "Plusieurs autrices" included) */
.author-books .book-card__author { display: none; }
/* one book: base .book-card--feature. Phones: base split (cover 46% | text on the cover's foot).
   md+: on the 12-column page grid, cover in columns 1–4, text in 5–10, the text block's top on the
   cover's top third (rows 1fr / text / 2fr), title at --fs-h2. */
/* phones: a title longer than 40 characters (book-card--long-title, author-books.php) takes the default
   card size in the 54% text column, so it reads as a title and not a column of single words (QA #74) */
@media (max-width: 759.98px) {
  .author-books .book-card--long-title .book-card__title { font-size: var(--fs-card-m); line-height: 1.16; font-variation-settings: "opsz" 28; }
}
@media (min-width: 760px) {
  .author-books__grid--single .book-card--feature .book-card__link {
    grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: 1fr auto auto auto 2fr; column-gap: var(--gutter);
  }
  .author-books__grid--single .book-card--feature .cover-frame { grid-column: 1 / span 4; grid-row: 1 / -1; }
  .author-books__grid--single .book-card--feature :is(.book-card__meta, .book-card__title, .book-card__price) { grid-column: 5 / span 6; padding-left: var(--s-4); }
  .author-books__grid--single .book-card--feature .book-card__title { margin-top: var(--s-3); font-size: var(--fs-h2); line-height: 1.04; font-variation-settings: "opsz" var(--opsz-heading); letter-spacing: -.01em; }
  .author-books__grid--single .book-card--feature .book-card__price { padding-top: var(--s-5); }
}

/* -------------------------------------------------------------------------
   5. Author page — pager: previous / index / next (index order, wraps)
      Ruled like the genre bar: 4px ink rule on top, ink hairlines between
      cells; the index cell echoes the home shelf's "58 Catalogue" tile.
   ------------------------------------------------------------------------- */
.author-pager { margin-top: var(--section-space); }
.author-pager__list {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: var(--rule-bold) solid var(--color-line-strong); border-bottom: var(--rule-hair) solid var(--color-line-strong);
}
.author-pager__item { min-width: 0; }
.author-pager__item--prev { order: 1; }
.author-pager__item--next { order: 2; border-left: var(--rule-hair) solid var(--color-line-strong); }
.author-pager__item--index { order: 3; grid-column: 1 / -1; border-top: var(--rule-hair) solid var(--color-line-strong); }
.author-pager__link {
  display: flex; align-items: center; gap: var(--s-3); height: 100%; min-height: 88px; padding: var(--s-3) var(--s-3) var(--s-3) 0;
  text-decoration: none; color: var(--color-text); transition: color var(--dur-fast), background-color var(--dur-fast);
}
.author-pager__item--next .author-pager__link { flex-direction: row-reverse; text-align: right; padding: var(--s-3) 0 var(--s-3) var(--s-3); }
.author-pager__thumb { flex: none; width: 44px; aspect-ratio: 2 / 3; overflow: hidden; background: var(--color-panel); }
.author-pager__img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.04); }
.author-pager__text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.author-pager__label { font: var(--fw-medium) var(--fs-micro)/1.2 var(--font-sans); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--color-text-muted); }
.author-pager__name { font: var(--fw-regular) 1.1875rem/1.15 var(--font-serif); font-variation-settings: "opsz" 24; overflow-wrap: break-word; text-wrap: balance; }
.author-pager__item--index .author-pager__link { justify-content: center; gap: var(--s-3); min-height: 64px; padding: var(--s-3) 0; }
.author-pager__count { font: var(--fw-semibold) 1.75rem/.9 var(--font-sans); font-variant-numeric: tabular-nums lining-nums; color: var(--color-accent); }
.author-pager__item--index .author-pager__label { font-size: var(--fs-small); color: var(--color-text); letter-spacing: .14em; }
.author-pager__link:hover .author-pager__name { color: var(--color-accent); }
.author-pager__link:hover .author-pager__label { color: var(--color-accent); }
.author-pager__link:focus-visible { outline-offset: -2px; }
@media (min-width: 760px) {
  .author-pager__list { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .author-pager__item--prev { order: 1; }
  .author-pager__item--index { order: 2; grid-column: auto; border-top: 0; border-left: var(--rule-hair) solid var(--color-line-strong); }
  .author-pager__item--next { order: 3; }
  .author-pager__link { min-height: 112px; gap: var(--s-4); padding-right: var(--s-5); }
  .author-pager__item--next .author-pager__link { padding-left: var(--s-5); }
  .author-pager__item--index .author-pager__link { flex-direction: column; gap: var(--s-2); padding: var(--s-4) var(--s-7); }
  .author-pager__thumb { width: 56px; }
  .author-pager__name { font-size: 1.5rem; }
  .author-pager__count { font-size: 2.5rem; }
}
