/* Kadrane — feuille de style publique
   Principe : l'interface s'efface, le dessin occupe la place. */

:root {
  --paper: #ECEFEA;      /* papier brumeux */
  --paper-2: #E2E6E0;
  --ink: #1C2622;        /* encre de forêt */
  --graphite: #5B6762;
  --moss: #2E6A55;       /* seul accent */
  --mist: #CDD4CE;       /* filets */
  --stage: #DADFD9;      /* fond du lecteur BD */

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", P052, Georgia, serif;
  --sans: Seravek, "Gill Sans Nova", "Gill Sans", Ubuntu, Calibri, "DejaVu Sans", "Segoe UI", sans-serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3rem;
  --step-2: 1.75rem;
  --step-3: clamp(2.1rem, 1.4rem + 3vw, 3.4rem);
  --gutter: clamp(1rem, 0.6rem + 1.6vw, 2.25rem);
  --bar: 3rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161E1B;    /* sous-bois */
    --paper-2: #1D2622;
    --ink: #E2E7E0;
    --graphite: #9AA69F;
    --moss: #7DB89F;
    --mist: #2C3833;
    --stage: #0F1513;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: var(--step-0)/1.55 var(--sans);
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--moss); }
:focus-visible { outline: 2px solid var(--moss); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0; }
.visually-hidden, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip:focus { position: fixed; top: .5rem; left: .5rem; z-index: 99; background: var(--paper); padding: .4rem .8rem; }
.draft { font-style: normal; font-size: var(--step--1); color: var(--moss); }

/* ---------- en-tête ---------- */
.masthead {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: .4rem 1.75rem;
  padding: 1.1rem var(--gutter) .9rem;
}
.wordmark {
  font: 400 1.6rem/1 var(--serif); letter-spacing: .01em; text-decoration: none; margin-right: auto;
}
.sections, .langs { display: flex; gap: 1.25rem; font-size: var(--step--1); }
.sections a, .langs a { text-decoration: none; color: var(--graphite); }
.sections a[aria-current], .langs a[aria-current] { color: var(--ink); text-decoration: underline; }
.langs { gap: .7rem; }
@media (max-width: 40rem) {
  .masthead { gap: .5rem 1rem; }
  .wordmark { width: 100%; }
}

/* ---------- accueil ---------- */
.hero { display: block; text-decoration: none; position: relative; }
.hero img { width: 100%; max-height: min(82vh, 60rem); object-fit: cover; object-position: center 30%; }
.hero-caption { display: block; padding: 1rem var(--gutter) 0; max-width: 46rem; }
.hero-title { display: block; font: 400 var(--step-3)/1.05 var(--serif); }
.hero-summary { display: block; margin-top: .5rem; color: var(--graphite); font-family: var(--serif); font-size: var(--step-1); }
.tagline { padding: 0 var(--gutter); color: var(--graphite); font-family: var(--serif); }

.shelf { margin: clamp(2.5rem, 6vw, 4.5rem) 0 0; }
.shelf h2 { padding: 0 var(--gutter); font-size: var(--step-2); margin-bottom: 1rem; }
.shelf h2 a { text-decoration: none; }
.shelf-row {
  display: flex; gap: 1.25rem; overflow-x: auto; padding: 0 var(--gutter) 1rem;
  scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--mist) transparent;
}
.shelf-item { flex: none; width: auto; scroll-snap-align: start; text-decoration: none; }
.shelf-item img, .shelf-item .noimg { height: clamp(12rem, 28vw, 19rem); width: auto; max-width: none; background: var(--paper-2); }
.shelf-item .noimg { display: block; width: 12rem; }
.shelf-title { display: block; margin-top: .55rem; font-family: var(--serif); font-size: var(--step-1); }
.shelf-meta { display: block; font-size: var(--step--1); color: var(--graphite); }

/* ---------- index d'une rubrique ---------- */
.page-title { font-size: var(--step-3); padding: 1.5rem var(--gutter) 1.75rem; }
.index {
  list-style: none; margin: 0; padding: 0 var(--gutter);
  display: grid; gap: 2.5rem var(--gutter); grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
}
.index a { display: block; text-decoration: none; }
.index img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--paper-2); }
.index--comics img { aspect-ratio: 3 / 4; object-position: top; }
.index-text { display: block; margin-top: .7rem; }
.index-title { display: block; font: var(--step-1)/1.2 var(--serif); }
.index-summary { display: block; margin-top: .3rem; color: var(--graphite); max-width: 60ch; }
.index-meta { display: block; margin-top: .3rem; font-size: var(--step--1); color: var(--graphite); }

/* ---------- galerie ---------- */
.work-head { padding: 1.25rem var(--gutter) 1.75rem; max-width: 52rem; }
.work-head h1 { font-size: var(--step-3); }
.work-head p { color: var(--graphite); font-family: var(--serif); font-size: var(--step-1); margin: .5rem 0 0; }
.wall { columns: 1; column-gap: clamp(.6rem, 1.4vw, 1.25rem); padding: 0 clamp(.6rem, 1.4vw, 1.25rem) 3rem; }
@media (min-width: 34rem) { .wall { columns: 2; } }
@media (min-width: 56rem) { .wall { columns: 3; } }
@media (min-width: 110rem) { .wall { columns: 4; } }
.wall-item { break-inside: avoid; margin: 0 0 clamp(.6rem, 1.4vw, 1.25rem); }
.wall-item a { display: block; cursor: zoom-in; }
.wall-item figcaption { font-size: var(--step--1); color: var(--graphite); padding: .35rem 0 0; }

/* visionneuse */
.lightbox {
  border: 0; padding: 0; margin: 0; max-width: none; max-height: none; width: 100vw; height: 100dvh;
  background: var(--stage); color: var(--ink);
}
.lightbox::backdrop { background: var(--stage); }
.lightbox figure { margin: 0; height: 100%; display: grid; grid-template-rows: 1fr auto; place-items: center; padding: 1rem; }
.lightbox img { max-height: calc(100dvh - 4.5rem); max-width: 100%; width: auto; object-fit: contain; }
.lightbox figcaption { font-family: var(--serif); padding: .5rem 1rem 0; text-align: center; }
.lb-btn {
  position: absolute; background: none; border: 0; color: var(--ink); font: 1.6rem/1 var(--sans);
  padding: 1rem; cursor: pointer; opacity: .6;
}
.lb-btn:hover, .lb-btn:focus-visible { opacity: 1; }
.lb-close { top: 0; right: 0; }
.lb-prev { left: 0; top: 50%; translate: 0 -50%; }
.lb-next { right: 0; top: 50%; translate: 0 -50%; }

/* ---------- lecteur de BD ---------- */
.reader { background: var(--stage); }
.reader-bar {
  position: sticky; top: 0; z-index: 10; height: var(--bar);
  display: flex; align-items: center; gap: 1rem; padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--stage) 88%, transparent); backdrop-filter: blur(8px);
  font-size: var(--step--1); transition: translate .25s ease;
}
.reader-bar.is-hidden { translate: 0 -100%; }
.reader-back { font: var(--step-0)/1.2 var(--serif); text-decoration: none; margin-right: auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-back::before { content: "‹ "; color: var(--graphite); }
.reader-tools { display: flex; gap: 1rem; align-items: center; white-space: nowrap; }
.reader-tools a, .reader-tools button {
  color: var(--graphite); background: none; border: 0; font: inherit; cursor: pointer; padding: .3rem 0; text-decoration: none;
}
.reader-tools a:hover, .reader-tools button:hover { color: var(--ink); }
@media (max-width: 40rem) { .reader-tools [data-action="fit"] { display: none; } }

.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 11; pointer-events: none; }
.progress span { display: block; height: 100%; width: 0; background: var(--moss); transition: width .3s ease; }

.stage { position: relative; display: grid; place-items: center; min-height: calc(100dvh - var(--bar) - 3.5rem); }
.sheet { margin: 0; padding: .5rem; }
.sheet img {
  max-height: calc(100dvh - var(--bar) - 4.5rem); width: auto; max-width: 100%;
  object-fit: contain; margin: 0 auto; user-select: none; -webkit-user-drag: none;
}
@media (max-width: 40rem) { .sheet { padding: 0; } .sheet img { max-height: calc(100dvh - var(--bar) - 3.5rem); } }
.fit-width .sheet img { max-height: none; width: min(100%, 72rem); }
.sheet figcaption { text-align: center; font-family: var(--serif); padding-top: .5rem; }
.zone { position: absolute; top: 0; bottom: 0; width: 38%; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.zone--prev { left: 0; cursor: w-resize; }
.zone--next { right: 0; width: 62%; cursor: e-resize; }

.pager {
  display: flex; justify-content: center; align-items: center; gap: .25rem; height: 3.5rem;
  font-size: var(--step-0);
}
.pager a, .pager span[aria-disabled] {
  min-width: 2.75rem; height: 2.75rem; display: grid; place-items: center; text-decoration: none;
  color: var(--ink); border-radius: 50%;
}
.pager a:hover { background: var(--paper-2); color: var(--moss); }
.pager span[aria-disabled] { color: var(--mist); }
.pager-jump { display: flex; align-items: center; gap: .4rem; margin: 0 .75rem; color: var(--graphite); font-size: var(--step--1); }
.pager-jump select {
  font: var(--step-0) var(--sans); color: var(--ink); background: transparent;
  border: 1px solid var(--mist); border-radius: .3rem; padding: .2rem .3rem;
}
.reader-help { text-align: center; font-size: .78rem; color: var(--graphite); margin: 0 0 1.5rem; }
@media (hover: none) { .reader-help { display: none; } }

.strip { max-width: 60rem; margin: 0 auto; padding: .5rem 0 4rem; }
.strip-page { margin: 0 0 .5rem; }
.strip-page img { width: 100%; }
.strip-page figcaption { text-align: center; font-family: var(--serif); padding: .4rem 1rem 1rem; }
.strip-end { text-align: center; font: var(--step-2) var(--serif); color: var(--graphite); margin: 3rem 0; }

/* plein écran */
:fullscreen .reader-bar, :fullscreen .pager, :fullscreen .reader-help { display: none; }

/* ---------- nouvelles ---------- */
.story {
  font: 1.18rem/1.7 var(--serif); hanging-punctuation: first;
  max-width: 36rem; margin: 0 auto; padding: 1rem var(--gutter) 4rem;
  hyphens: auto; -webkit-hyphens: auto;
}
.story h1 { font-size: var(--step-3); margin: 1.5rem 0 .5rem; text-wrap: balance; }
.story h2 { font-size: var(--step-2); margin: 2.5rem 0 .75rem; }
.story h3 { font-size: var(--step-1); margin: 2rem 0 .5rem; font-style: italic; }
.story p { margin: 0; text-wrap: pretty; }
.story p + p { text-indent: 1.4em; }
.story blockquote { margin: 1.5rem 0; padding-left: 1.2rem; border-left: 2px solid var(--mist); font-style: italic; }
.story-meta { font: var(--step--1) var(--sans); color: var(--graphite); margin: 0 0 1rem !important; }
.story .notice { font: var(--step--1) var(--sans); color: var(--moss); margin: 0 0 1rem; }
.illus { margin: 2.25rem 0; }
.illus img { margin: 0 auto; }
.illus figcaption { font: italic var(--step--1)/1.4 var(--serif); color: var(--graphite); text-align: center; padding-top: .6rem; }
.illus--wide { width: min(100vw - 2 * var(--gutter), 64rem); margin-left: 50%; translate: -50% 0; }
.illus--wide img { width: 100%; }
.story-cover { margin-top: 0; }
hr.scene { border: 0; margin: 2rem 0; text-align: center; }
hr.scene::after { content: "⁂"; color: var(--graphite); }
.story-end { text-align: center; color: var(--graphite); margin-top: 3rem !important; text-indent: 0 !important; }
.missing-img { color: var(--moss); font: var(--step--1) var(--sans); }
.story .footnotes { font-size: var(--step--1); margin-top: 3rem; border-top: 1px solid var(--mist); }

/* ---------- lecteur de nouvelles par chapitres ---------- */
.chapter-reader .reader-bar {
  background: color-mix(in srgb, var(--paper) 88%, transparent);
}
.chapter-reader .stage {
  align-items: start;
  min-height: auto;
  padding-bottom: 2rem;
}
.pager-info {
  margin: 0 .75rem;
  color: var(--graphite);
  font-size: var(--step--1);
}

/* ---------- divers ---------- */
.colophon { padding: 3rem var(--gutter) 2rem; font-size: var(--step--1); color: var(--graphite); }
.lost { padding: 4rem var(--gutter); max-width: 40rem; }
.lost h1 { font-size: var(--step-3); }
.root .lang-choice { min-height: 100dvh; display: grid; place-content: center; text-align: center; gap: 1.5rem; }
.root .wordmark { font-size: var(--step-3); margin: 0; }
.root ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; font-family: var(--serif); font-size: var(--step-1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .masthead, .reader-bar, .pager, .reader-help, .colophon, .progress { display: none; }
}
