/* Lucas Baba — prototype. Valeurs reprises de la section « Version corrigée » (Figma). */
:root {
  --ink: #111111;
  --muted: #757575;
  --rule: #e5e5e2;
  --bg: #ffffff;
  --paper: #f4f2eb;
  --pen: #1f2645;
  --g: 24px;        /* marge latérale */
  --col: 224px;     /* colonne des intitulés (24 → 248) */
  --sec: 96px;      /* écart entre sections */
  --top: 180px;     /* de l'en-tête au premier contenu */
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg);
  color: var(--ink);
  font: 13px/18px Arimo, "Noto Sans JP", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, ul, figure, table { margin: 0; padding: 0; font: inherit; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
a:hover, .voice-btn:hover, .filters button:hover, .older-btn:hover { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; border-radius: 0; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }
::selection { background: #111; color: #fff; }
img { display: block; max-width: 100%; height: auto; }

.muted { color: var(--muted); }
.ink { color: var(--ink); }
.jp { color: var(--muted); font-family: "Noto Sans JP", Arimo, sans-serif; }
.u { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.m-only { display: none; }
.measure { max-width: 480px; }
.measure-s { max-width: 420px; }
.measure-b { max-width: 440px; }
p + p { margin-top: 12px; }

/* Apparition lente des images */
.js .ph { opacity: 0; transition: opacity 1.4s cubic-bezier(.2, .6, .2, 1); }
.js .ph.in { opacity: 1; }
.js .ghost .ph.in { opacity: .4; transition-duration: .8s; }
.ghost a:hover .ph.in, .ghost a:focus-visible .ph.in { opacity: 1; }

/* ---------- En-tête et pied ---------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 22px var(--g) 14px;
  margin-bottom: -14px;
  background: var(--bg);
}
.nav { display: flex; gap: 24px; }
.nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.menu-btn { display: none; }
.menu[hidden] { display: none; }

main { flex: 1 0 auto; padding: 0 var(--g); }

.site-foot {
  display: grid;
  grid-template-columns: var(--col) 1fr auto;
  align-items: baseline;
  padding: 160px var(--g) 20px;
}
.foot-right { display: flex; gap: 24px; }

/* ---------- Grille des sections ---------- */
.sec { display: grid; grid-template-columns: var(--col) minmax(0, 1fr); margin-top: var(--sec); }
.sec > .label { color: var(--muted); }
.nb-head, .info-top, .nf { margin-top: var(--top); }
/* L'intitulé s'aligne sur le texte de la première ligne quand le contenu commence par un filet. */
.sec:has(> .content > .ilist:first-child) > .label,
.sec:has(> .content > .tbl:first-child) > .label,
.sec:has(> .content > .d-only:first-child) > .label,
.sec:has(> .content > .measure:first-child > .tbl:first-child) > .label { padding-top: 9px; }

/* Liste d'index : un filet au-dessus de chaque ligne, un filet de clôture. */
.ilist { border-bottom: 1px solid var(--rule); }
.ilist li { display: grid; grid-template-columns: 252px 1fr; border-top: 1px solid var(--rule); padding: 8px 0 5px; }
.ilist .m { color: var(--muted); }
.ilist .order { margin-left: 12px; }

/* Tableaux (fiche, crédits) */
.tbl { width: 100%; max-width: 480px; border-collapse: collapse; }
.tbl tr { border-top: 1px solid var(--rule); }
.tbl tr:last-child { border-bottom: 1px solid var(--rule); }
.tbl th, .tbl td { padding: 8px 0 5px; text-align: left; vertical-align: top; font-weight: 400; }
.tbl th { width: 164px; }
.tbl3 td:first-child { width: 164px; }
.tbl3 td.r { text-align: right; width: 70px; }
.more { margin-top: 12px; }

/* ---------- Accueil ---------- */
.vert {
  position: absolute;
  top: 118px;
  right: var(--g);
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 3px;
  line-height: 13px;
  font-family: "Noto Sans JP", sans-serif;
}
.hero-line { display: grid; grid-template-columns: var(--col) minmax(0, 1fr); padding-top: 218px; }
.hero-line .content { grid-column: 2; }
.home-films { margin-top: 156px; }
.home-notebook { margin-top: 60px; }
.home-notebook > .label { padding-top: 0; }
.home-books { margin-top: 72px; }

.cluster { position: relative; height: 256px; max-width: 1168px; }
.cl {
  position: absolute;
  left: calc(var(--x) * 100% / 1168);
  top: calc(var(--y) * 1px);
  width: calc(var(--w) * 100% / 1168);
}
.cl img { width: 100%; height: auto; }
.cl-img p { margin-top: 10px; white-space: nowrap; }
.voice.mini .voice-btn, .voice.mini .voice-dur { white-space: nowrap; }
.cl-quote { line-height: 18px; }
.cluster + .more { margin-top: 22px; }

/* Papier quadrillé, notes manuscrites */
.scan {
  display: block;
  container-type: inline-size;
  aspect-ratio: 1 / 1.414;
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(60, 80, 140, .12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(60, 80, 140, .12) 1px, transparent 1px);
  background-size: 12px 12px;
  background-position: -1px -1px;
  color: var(--pen);
  font-family: "Reenie Beanie", "Bradley Hand", cursive;
  white-space: pre-line;
  overflow: hidden;
}
.scan p { font-size: 7cqw; line-height: 7.3cqw; padding: 7.75cqw; }
.scan.sm p { font-size: 7.1cqw; line-height: 7.1cqw; padding: 8cqw; }
.scan.mini { aspect-ratio: var(--w) / var(--h); }
.scan.mini p { font-size: 11.5cqw; line-height: 11.5cqw; padding: 7cqw; }
.scan.mini.small p { font-size: 11.9cqw; line-height: 11.9cqw; }
a.scan:hover { text-decoration: none; }
.scan.sm { background-size: 9px 9px; }
.scan.mini { background-size: 6px 6px; }
.sec > .label .jp { display: none; }

/* ---------- Films ---------- */
.films-table { margin-top: var(--top); }
.fhead, .frow { display: grid; grid-template-columns: var(--col) minmax(0, 1fr); }
.fh, .frow-in, .shortwork { display: grid; grid-template-columns: 304px minmax(0, 504px) 1fr; }
.fh { padding-bottom: 12px; }
.fh span:nth-child(2) { padding-right: 32px; }
.frow .no { padding-top: 21px; }
.frow-in { border-top: 1px solid var(--rule); padding: 16px 0; }
.frow:last-child .frow-in { border-bottom: 1px solid var(--rule); }
.frow-in:hover { text-decoration: none; }
.frow-in:hover .ftitle { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.still img { height: 117px; width: auto; max-width: none; }
.ftext { padding: 4px 32px 0 0; }
.fsyn { display: block; margin-top: 8px; color: var(--ink); max-width: 470px; }
.fstatus { padding-top: 4px; }

/* ---------- Fiche film ---------- */
.film-top { margin-top: 138px; }
.film-top .label { position: relative; padding-top: 2px; }
.vtitle {
  position: absolute;
  left: 166px;
  top: 0;
  writing-mode: vertical-rl;
  letter-spacing: 2px;
  color: var(--ink);
}
.hero img { width: 100%; max-width: 1040px; height: auto; cursor: zoom-in; }
.hero.scans { display: grid; grid-template-columns: repeat(2, minmax(0, 400px)); gap: 8px; }
.scanrow { display: grid; grid-template-columns: repeat(3, minmax(0, 225px)); gap: 8px; }
.pager { display: flex; justify-content: space-between; margin: 150px 0 0 var(--col); }

/* Rangée d'images : hauteur commune, largeurs naturelles. */
.imgrow { display: flex; gap: 8px; max-width: var(--max); align-items: flex-start; }
.imgrow figure { flex: var(--r) 1 0; min-width: 0; }
.imgrow img { width: 100%; height: auto; cursor: zoom-in; }

/* ---------- Note vocale ---------- */
.voice canvas { display: block; width: 100%; height: 18px; cursor: pointer; }
.voice-ctl { display: flex; justify-content: space-between; margin-top: 6px; }
.voice-btn { color: var(--ink); }
.voice-tr { margin-top: 24px; }
.voice-tr + p { margin-top: 0; }
.voice.mini canvas { height: 14px; }
.voice.mini .voice-btn { display: block; margin-top: 2px; color: var(--muted); text-align: left; }
.voice.mini.playing .voice-btn { color: var(--ink); }
.voice.mini .voice-dur { display: block; }

/* ---------- Carnet ---------- */
.nb-head .filters { display: flex; flex-wrap: wrap; gap: 0 24px; margin-top: 20px; }
.filters button { color: var(--muted); }
.filters button[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.entries { margin-top: 43px; }
.entry { display: grid; grid-template-columns: var(--col) minmax(0, 1fr); scroll-margin-top: 72px; }
.entry > .label { padding-top: 17px; }
.entry > .content { border-top: 1px solid var(--rule); padding: 16px 0 96px; }
.entry-body { margin-top: 23px; }
.entry-media + .entry-text { margin-top: 16px; }
.entry.flash > .content > h3 { text-decoration: underline; text-underline-offset: 2px; }
.older { margin-top: 0; }
.older .content { border-top: 1px solid var(--rule); padding-top: 34px; }

/* ---------- Livres ---------- */
.book { margin-top: 162px; }
.book > .label { padding-top: 17px; }
.book .content { border-top: 1px solid var(--rule); padding-top: 16px; }
.book-in { display: grid; grid-template-columns: 358px minmax(0, 1fr); gap: 26px; }
.cover img { width: 350px; height: auto; cursor: zoom-in; }
.spreads { display: flex; gap: 8px; margin-top: 8px; }
.spreads img { height: 76px; width: auto; cursor: zoom-in; }
.book-media > p { margin-top: 10px; }
.book-text > p + p { margin-top: 24px; }
.book-text > p:nth-child(3), .book-text > p:nth-child(4) { margin-top: 18px; }
.book2 { margin-top: 134px; }
.book2 .content { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 16px 0; }
.book2-in { display: grid; grid-template-columns: 384px minmax(0, 1fr); }
.book2-in p + p { margin-top: 0; }

/* ---------- Info ---------- */
.info-in { display: grid; grid-template-columns: minmax(0, 410px) 1fr 269px; padding-right: 87px; }
.info-text p:nth-child(3) { margin-top: 16px; }
.portrait { grid-column: 3; margin-top: -7px; }
.info-films { margin-top: 135px; }
.info-books, .info-contact { margin-top: 60px; }

/* ---------- Menu mobile ---------- */
.menu { position: fixed; inset: 0; z-index: 50; background: var(--bg); padding: 18px 16px; display: flex; flex-direction: column; }
.menu-head { display: flex; justify-content: space-between; align-items: baseline; }
.menu nav { display: flex; flex-direction: column; margin-top: 80px; }
.menu nav a { padding: 13px 0; border-top: 1px solid var(--rule); }
.menu nav a:last-child { border-bottom: 1px solid var(--rule); }
.menu nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Visionneuse ---------- */
.lb {
  position: fixed; inset: 0; z-index: 60;
  background: var(--bg);
  display: grid; grid-template-rows: auto 1fr auto;
  padding: 22px var(--g) 20px;
  opacity: 0; transition: opacity .35s ease;
}
.lb.open { opacity: 1; }
.lb-top, .lb-bot { display: flex; justify-content: space-between; }
.lb-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 24px 0; }
.lb-stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; transition: opacity .4s ease; }
.lb-prev, .lb-next { position: absolute; top: 0; bottom: 0; width: 50%; }
.lb-prev { left: 0; cursor: w-resize; }
.lb-next { right: 0; cursor: e-resize; }
.lb-nav { display: flex; gap: 24px; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  :root { --g: 16px; --sec: 72px; --top: 74px; }
  .d-only { display: none; }
  .d-inline { display: none; }
  .m-only { display: block; }
  .site-head { padding-top: 18px; }
  .nav { display: none; }
  .menu-btn { display: block; padding: 13px 0 13px 24px; margin: -13px 0; }
  .menu-close { padding: 13px 0 13px 24px; margin: -13px 0; }

  .sec, .hero-line, .fhead, .frow, .entry { grid-template-columns: minmax(0, 1fr); }
  .sec > .label { margin-bottom: 18px; padding-top: 0 !important; }
  .sec > .label .jp { display: inline; }
  .hero-line { padding-top: 164px; }
  .hero-line .content { grid-column: 1; }
  .vert { top: 70px; right: 16px; }

  .ilist li { grid-template-columns: 1fr; padding: 16px 0; }
  .ilist .m { display: block; }
  .home-films { margin-top: 100px; }
  .home-notebook { margin-top: 40px; }
  .home-books { margin-top: 52px; }

  .cluster { height: 210px; }
  .cl { left: calc(var(--mx) * 100% / 358); top: calc(var(--my) * 1px); width: calc(var(--mw) * 100% / 358); }
  .cl.d-only { display: none; }
  .cl-paper .scan.mini { aspect-ratio: var(--mw) / var(--mh); }
  .cluster + .more { margin-top: 12px; }

  .fhead { display: none; }
  .frow .no { display: none; }
  .frow-in, .fh, .shortwork { grid-template-columns: minmax(0, 1fr); }
  .frow-in { gap: 12px; }
  .ftext { padding: 0; }
  .fstatus { padding: 0; }
  .shortwork { gap: 0; }

  .film-top { margin-top: var(--top); }
  .film-top .label { display: flex; flex-direction: column; margin-bottom: 24px; padding-top: 0; }
  .vtitle { position: static; writing-mode: horizontal-tb; letter-spacing: 0; }
  .hero.scans { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero.scans .first { grid-column: 1 / -1; }
  .scanrow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pager { margin: 72px 0 0; }

  .imgrow { flex-wrap: wrap; max-width: none; }
  .imgrow figure { flex: 0 0 calc(50% - 4px); }
  .imgrow figure:first-child:nth-last-child(odd) { flex-basis: 100%; }

  .voice-btn { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; padding: 13px 24px 13px 0; margin: -13px 0; }
  .voice.mini .voice-btn { text-decoration: none; padding: 0; margin: 2px 0 0; }

  .nb-head .filters { gap: 0 16px; }
  .filters button { padding: 13px 0; margin: -13px 0 -13px; }
  .nb-head .filters { margin-top: 30px; }
  .entries { margin-top: 40px; }
  .entry { position: relative; }
  .entry > .label { position: absolute; right: 0; top: 0; padding-top: 17px; }
  .entry > .content { padding-bottom: 72px; }
  .entry > .content > h3 { padding-right: 90px; }

  .book { margin-top: var(--top); }
  .book > .label { padding-top: 0; }
  .book .content { border-top: 0; padding-top: 0; }
  .book-in { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .cover img { width: 100%; }
  .spreads img { height: auto; width: calc((100% - 16px) / 3); }
  .book2 { margin-top: 72px; }
  .book2-in { grid-template-columns: minmax(0, 1fr); gap: 8px; }

  .info-in { grid-template-columns: minmax(0, 1fr); padding-right: 0; }
  .portrait { grid-column: 1; margin-top: 24px; }
  .info-films { margin-top: 72px; }
  .info-books, .info-contact { margin-top: 52px; }

  .site-foot { grid-template-columns: 1fr; padding-top: 72px; }
  .foot-right { justify-content: space-between; }

  .lb { padding: 18px 16px; }
  .lb-stage { padding: 16px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .js .ph, .lb, .lb-stage img { transition: none; }
}
