/* Robert Saxton — marge à onglets (signature Buuk), table des matières, pages « univers » des livres.
   Chaque livre redéfinit les jetons de couleur de style-custom.css : les composants suivent. */

:root { --rail-w: 76px; --rail: #0a111b; --ink: #fff; }

/* ---------- Marge de gauche : la tranche du livre ---------- */
.margin { position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: var(--rail-w); display: flex; flex-direction: column; align-items: stretch;
	background: var(--rail); border-right: 1px solid var(--line); }
.page { margin-left: var(--rail-w); }
.margin-menu, .menu-mobile { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 5px; background: none; border: 0; cursor: pointer; color: var(--snow); }
.margin-menu { height: 64px; flex: none; }
.margin-menu span, .menu-mobile span { display: block; width: 24px; height: 1.5px; background: currentColor; }
.margin-menu span:nth-child(2), .menu-mobile span:nth-child(2) { width: 16px; margin-right: 8px; }
.margin-menu:hover { color: #fff; }
.margin-mono { font-family: var(--display); font-size: .95rem; letter-spacing: .12em; color: var(--muted); text-decoration: none; text-align: center; padding: .4em 0 1em; border-bottom: 1px solid var(--line); }
.margin-mono:hover { color: #fff; }
.tabs { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 12px 0; min-height: 0; }
.tabs a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; margin-right: -1px;
	color: var(--muted); text-decoration: none; border-radius: 0 var(--r) var(--r) 0; transition: background-color .25s, color .25s, margin-right .25s; }
.tabs a b { font-family: var(--display); font-weight: 600; font-size: .8rem; letter-spacing: .06em; }
.tabs a span { writing-mode: vertical-rl; transform: rotate(180deg); font-variant: small-caps; text-transform: lowercase; letter-spacing: .1em; font-size: .9rem; line-height: 1; white-space: nowrap; }
.tabs a:hover { color: #fff; background: rgba(255, 255, 255, .05); }
/* L'onglet du chapitre en cours dépasse de la tranche, comme un intercalaire. */
.tabs a.on { background: var(--red); color: #fff; margin-right: -12px; box-shadow: 4px 2px 10px -4px rgba(0, 0, 0, .5); }
.margin-top { flex: none; height: 56px; display: flex; align-items: center; justify-content: center; color: var(--muted); text-decoration: none; font-size: 1.2rem; border-top: 1px solid var(--line); }
.margin-top:hover { color: #fff; }
.menu-mobile { display: none; }
@media (max-height: 680px) { .tabs a span { display: none; } }

/* ---------- Table des matières ---------- */
.toc { position: fixed; z-index: 40; inset: 0 0 0 var(--rail-w); background: var(--night-2); overflow-y: auto; }
.toc[hidden] { display: none; }
html.toc-open, html.toc-open body { overflow: hidden; }
.toc-in { position: relative; max-width: 760px; margin: 0 auto; padding: 12vh var(--s3) var(--s5); }
.toc-close { position: absolute; top: var(--s3); right: var(--s3); background: none; border: 0; color: var(--snow); font-size: 2.2rem; line-height: 1; cursor: pointer; }
.toc-h { font-variant: small-caps; text-transform: lowercase; letter-spacing: .14em; color: var(--muted); font-size: var(--fs-2); margin: 0 0 var(--s3); }
.toc-list { list-style: none; margin: 0 0 var(--s4); padding: 0; counter-reset: none; }
.toc-list > li { margin: 0; border-bottom: 1px dotted var(--line); }
.toc-list > li > a { display: grid; grid-template-columns: 3.5rem 1fr; align-items: baseline; padding: .7em 0; color: #fff; text-decoration: none; }
.toc-list > li > a b { font-family: var(--display); color: var(--red); font-size: var(--fs-3); }
.toc-list > li > a span { font-family: var(--display); font-size: var(--fs-5); line-height: 1.2; }
.toc-list > li > a:hover span { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; }
.toc-list ul { list-style: none; margin: -.2em 0 .8em 3.5rem; padding: 0; }
.toc-list ul li { margin: .2em 0; }
.toc-list ul a { color: var(--text); font-size: var(--fs-3); text-decoration: none; }
.toc-list ul a:hover { color: #fff; text-decoration: underline; }

/* ---------- Numéros de chapitre au-dessus des titres ---------- */
.ch { font-family: var(--display); font-weight: 600; font-size: var(--fs-2); letter-spacing: .2em; color: var(--red); margin: 0 0 .4em; }
.ch::after { content: ""; display: inline-block; width: 2.5rem; height: 1px; background: currentColor; vertical-align: middle; margin-left: .8rem; opacity: .7; }

/* Accueil : fiches sans achat, section « où trouver » discrète */
.book h3 a { color: inherit; text-decoration: none; }
.book h3 a:hover { text-decoration: underline; text-underline-offset: 4px; }
.where { padding-top: var(--s4); padding-bottom: var(--s5); border-top: 1px solid var(--line); }
.where-h { font-family: var(--serif); font-size: var(--fs-3); font-weight: 600; font-variant: small-caps; text-transform: lowercase; letter-spacing: .08em; color: var(--ink); margin: 0 0 var(--s1); }
.where p { font-size: var(--fs-2); color: var(--muted); margin: .2em 0; }
.where-t { color: var(--text); font-style: italic; margin-right: .4em; }

/* ---------- Pages « univers » ---------- */
.bk-hero { position: relative; min-height: 92vh; display: flex; flex-direction: column; overflow: hidden; background: #000; }
.bk-bg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bk-hero::before { content: ""; position: absolute; inset: 0; z-index: 1; background: var(--hero-shade); }
.bk-bar { position: relative; z-index: 3; display: flex; align-items: center; gap: var(--s3); padding-top: var(--s3); width: 100%; }
.bk-bar .site-title { font-family: var(--display); font-size: 1.25rem; font-weight: 600; letter-spacing: .08em; color: #fff; text-decoration: none; }
.bk-all { margin-left: auto; font-variant: small-caps; text-transform: lowercase; letter-spacing: .08em; color: rgba(255, 255, 255, .85); text-decoration: none; font-size: var(--fs-3); }
.bk-all:hover { color: #fff; text-decoration: underline; }
.bk-hero .lang { border-color: rgba(255, 255, 255, .3); }
.bk-hero .lang a:not(.on) { color: #fff; }
.bk-hero-grid { position: relative; z-index: 3; flex: 1; display: grid; grid-template-columns: 1.3fr .7fr; align-items: center; gap: var(--s4); padding-top: var(--s4); padding-bottom: 150px; width: 100%; }
.bk-hero .kicker { font-variant: small-caps; text-transform: lowercase; letter-spacing: .14em; font-size: var(--fs-2); color: var(--kicker); margin: 0 0 var(--s2); }
.bk-hero h1 { font-size: clamp(2.6rem, 6vw, 5.2rem); color: #fff; margin: 0 0 var(--s3); line-height: 1.02; text-shadow: 0 2px 30px rgba(0, 0, 0, .5); }
.hook { font-size: var(--fs-5); line-height: 1.4; max-width: 24ch; color: rgba(255, 255, 255, .92); margin: 0 0 var(--s4); }
.bk-cover { perspective: 1400px; display: flex; justify-content: center; }
.book3d.solo { position: relative; left: auto; top: auto; width: 280px; transform: rotateY(-20deg) rotateZ(1deg); }
.book3d.solo:hover { transform: rotateY(-8deg) rotateZ(0deg); }
.bk-hero .treeline { position: absolute; z-index: 2; left: 0; bottom: -1px; width: 100%; height: 120px; }
.bk-hero .treeline path { fill: var(--night); }

.stars { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; fill: #fff; opacity: .75; }
.stars .tw { animation: twinkle 5s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .15; } }

.bk-sec { padding-top: var(--s6); padding-bottom: var(--s2); }
.story { max-width: 40rem; }
.story p { font-size: var(--fs-4); line-height: 1.75; color: var(--text); }
.story p:first-child::first-letter { float: left; font-family: var(--display); font-size: 4.4em; line-height: .82; margin: .06em .12em 0 0; color: var(--red); }

/* Tome 1 : deux époques */
.eras-sec { padding-top: var(--s6); }
.eras { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: var(--s3); max-width: 1400px; margin: var(--s2) auto 0; padding: 0 var(--s3); }
.era { margin: 0; }
.era img { display: block; width: 100%; height: clamp(280px, 38vw, 520px); object-fit: cover; border-radius: var(--r); }
.era.past img { filter: saturate(.6) sepia(.2) brightness(.9); }
.era figcaption { padding-top: var(--s2); }
.era-l { display: block; font-variant: small-caps; text-transform: lowercase; letter-spacing: .12em; font-size: var(--fs-2); color: var(--red); }
.era strong { display: block; font-family: var(--display); font-weight: 600; font-size: var(--fs-5); color: #fff; margin: .2em 0 .3em; }
.era figcaption > span:last-child { display: block; font-size: var(--fs-3); color: var(--text); max-width: 34ch; }
.gate { align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6em; padding: 0 var(--s1); min-height: clamp(280px, 38vw, 520px); }
.gate::before, .gate::after { content: ""; flex: 1; width: 1px; background: linear-gradient(var(--line), var(--red), var(--line)); }
.gate-n { font-family: var(--display); font-weight: 600; font-size: clamp(2.6rem, 5vw, 4.2rem); color: #fff; line-height: 1; }
.gate-l { font-variant: small-caps; text-transform: lowercase; letter-spacing: .1em; font-size: var(--fs-2); color: var(--muted); text-align: center; max-width: 9ch; }

/* Tome 2 : la saison */
.season-sec { margin-top: var(--s6); padding: var(--s5) 0; background: var(--sky-2) var(--texture, none) center / cover; position: relative; }
.season { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--s4); align-items: center; }
.season figure { margin: 0; }
.season img { display: block; width: 100%; border-radius: var(--r); box-shadow: 0 20px 50px -25px rgba(0, 0, 0, .45); }
.season-list { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.season-list li { counter-increment: s; position: relative; padding: var(--s2) 0 var(--s2) 3.2rem; border-bottom: 1px solid var(--line); }
.season-list li::before { content: counter(s, upper-roman); position: absolute; left: 0; top: var(--s2); font-family: var(--display); color: var(--red); font-size: var(--fs-4); }
.season-list strong { display: block; font-family: var(--display); font-weight: 600; font-size: var(--fs-4); color: var(--ink); }
.season-list span { display: block; font-size: var(--fs-3); color: var(--text); }

/* Personnages */
.chars { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s3); margin-top: var(--s2); }
.chars article { position: relative; overflow: hidden; background: var(--sky); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4) var(--s3) var(--s3); }
.chars .initial { position: absolute; right: .1em; top: -.2em; font-family: var(--display); font-weight: 600; font-size: 7.5rem; line-height: 1; color: var(--red); opacity: .14; pointer-events: none; }
.chars h3 { font-family: var(--display); font-weight: 600; font-size: var(--fs-4); margin-top: 0; color: var(--ink); }
.chars p { font-size: var(--fs-3); margin: 0; }

/* Mots */
.words { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s4); margin: var(--s2) 0 0; }
.words dt { font-family: var(--display); font-weight: 600; font-size: var(--fs-6); color: var(--ink); margin-bottom: .2em; }
.words dd { margin: 0; font-size: var(--fs-4); color: var(--text); border-left: 2px solid var(--red); padding-left: var(--s2); }

/* Lecteurs */
.readers { margin-top: var(--s6); padding-top: var(--s5); padding-bottom: var(--s5); background: var(--sky); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* Écouter (tome 1) */
.bk-listen { margin-top: var(--s4); max-width: 40rem; }

/* Le livre */
.bk-details { display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--s4); align-items: start; }
.facts { margin: 0; }
.facts div { display: grid; grid-template-columns: 9rem 1fr; gap: var(--s2); padding: .6em 0; border-bottom: 1px solid var(--line); }
.facts dt { font-variant: small-caps; text-transform: lowercase; letter-spacing: .08em; color: var(--muted); font-size: var(--fs-3); }
.facts dd { margin: 0; color: var(--text); font-size: var(--fs-3); }
.where-book { background: var(--sky); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3); }
.where-book p { margin: .3em 0; }
.others { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--s3); margin: var(--s5) 0 var(--s5); }
.next-book { display: flex; gap: var(--s3); align-items: center; padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: var(--text); transition: border-color .2s, background-color .2s; }
.next-book:hover { border-color: var(--red); background: var(--sky); color: var(--text); }
.next-book img { width: 92px; flex: none; border-radius: 2px; box-shadow: 8px 12px 24px -10px rgba(0, 0, 0, .6); }
.next-book em { display: block; font-style: normal; font-variant: small-caps; text-transform: lowercase; letter-spacing: .1em; font-size: var(--fs-2); color: var(--muted); }
.next-book strong { display: block; font-family: var(--display); font-weight: 600; font-size: var(--fs-4); color: var(--ink); margin: .2em 0 .6em; line-height: 1.25; }
.next-book.soon strong { font-family: var(--serif); font-size: var(--fs-3); font-weight: 400; color: var(--text); }
.next-book .button { font-size: var(--fs-2); }
.mini-soon { width: 92px; height: 138px; flex: none; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 2rem; color: var(--muted); background: var(--night-2); border: 1px solid var(--line); border-radius: 2px; }

/* ---------- Thème du tome 1 : nuit étoilée, braise ---------- */
body.tome-1 {
	--night: #0a0b0f; --night-2: #060709; --sky: #12141a; --sky-2: #181b22; --line: #2b2e37;
	--ice: #d9d2c3; --snow: #efe9dc; --text: #dcd6c9; --muted: #a39d91; --ink: #fff;
	--red: #bf3a24; --red-dark: #9f2e1b; --rail: #07080b; --kicker: #e3b3a6;
	--hero-shade: linear-gradient(90deg, rgba(6, 7, 9, .88) 0%, rgba(6, 7, 9, .55) 50%, rgba(6, 7, 9, .15) 100%), linear-gradient(0deg, rgba(10, 11, 15, 1) 2%, transparent 45%);
}

/* ---------- Thème du tome 2 : neige et aurore (page claire) ---------- */
body.tome-2 {
	--night: #f3f6f7; --night-2: #0d1d21; --sky: #ffffff; --sky-2: #e6eef0; --line: #d2dde0;
	--ice: #17695a; --snow: #eef4f5; --text: #2a3d42; --muted: #5b6f74; --ink: #10262b;
	--red: #1d7a66; --red-dark: #155e4e; --rail: #0d1d21; --kicker: #a7ecd6;
	--hero-shade: linear-gradient(90deg, rgba(8, 20, 26, .82) 0%, rgba(8, 20, 26, .45) 55%, rgba(8, 20, 26, .1) 100%), linear-gradient(0deg, rgba(8, 20, 26, .55), transparent 40%);
	--texture: linear-gradient(rgba(230, 238, 240, .9), rgba(230, 238, 240, .94)), url(../img/bouleau-900.webp);
	background: var(--night); color: var(--text);
}
body.tome-2 html, body.tome-2 { background-color: var(--night); }
body.tome-2 main h2, body.tome-2 main h3 { color: var(--ink); }
body.tome-2 main .button { color: var(--ink); border-color: rgba(16, 38, 43, .6); }
body.tome-2 main .button:hover { background: rgba(16, 38, 43, .06); color: var(--ink); }
body.tome-2 main .button.filled { color: #fff; border-color: var(--red); }
body.tome-2 main .featured-quote blockquote, body.tome-2 main .reviews blockquote { color: var(--ink); }
body.tome-2 main .featured-quote figcaption, body.tome-2 main .reviews figcaption { color: var(--muted); }
body.tome-2 main .todo { color: var(--ice); border-color: rgba(23, 105, 90, .5); }
body.tome-2 .margin, body.tome-2 .toc, body.tome-2 #footer { --line: #22383e; --muted: #9db3b8; --text: #d5e2e4; --ice: #a7ecd6; }
body.tome-2 .toc { background: #0d1d21; }
body.tome-2 #footer { background: #0d1d21; }
body.tome-2 .preview-note { background: #155e4e; }
.aurora { position: absolute; inset: 0; z-index: 1; background: radial-gradient(60% 45% at 70% 25%, rgba(80, 220, 170, .22), transparent 70%), radial-gradient(40% 35% at 85% 15%, rgba(140, 100, 210, .2), transparent 70%); animation: breathe 14s ease-in-out infinite alternate; }
@keyframes breathe { from { opacity: .55; } to { opacity: 1; } }
.snow { position: absolute; inset: -20% 0 0; z-index: 2; pointer-events: none; background-repeat: repeat;
	background-image: radial-gradient(2px 2px at 20px 30px, #fff, transparent), radial-gradient(1.5px 1.5px at 90px 120px, #fff, transparent), radial-gradient(2.5px 2.5px at 160px 60px, rgba(255, 255, 255, .9), transparent), radial-gradient(1.5px 1.5px at 60px 170px, #fff, transparent);
	background-size: 200px 200px; opacity: .55; animation: fall 22s linear infinite; }
.snow.s2 { background-size: 320px 320px; opacity: .35; animation-duration: 36s; filter: blur(1px); }
@keyframes fall { from { transform: translateY(0); } to { transform: translateY(20%); } }

@media (prefers-reduced-motion: reduce) { .stars .tw, .aurora, .snow { animation: none !important; } }

/* ---------- Écrans étroits : la marge devient un bouton ---------- */
@media (max-width: 899px) {
	.margin { display: none; }
	.page { margin-left: 0; }
	.toc { inset: 0; }
	.menu-mobile { display: flex; position: fixed; z-index: 35; top: 44px; right: 14px; width: 46px; height: 46px; border-radius: 50%; background: rgba(8, 12, 18, .75); backdrop-filter: blur(4px); }
	.bk-bar .lang, .bk-all { display: none; }
	.bk-hero { min-height: 0; }
	.bk-hero-grid { grid-template-columns: 1fr; padding-bottom: 110px; }
	.bk-cover { order: -1; }
	.book3d.solo { width: 170px; }
	.hook { font-size: var(--fs-4); }
	.eras { grid-template-columns: 1fr; }
	.gate { min-height: 0; flex-direction: row; padding: var(--s1) 0; }
	.gate::before, .gate::after { height: 1px; width: auto; background: linear-gradient(90deg, var(--line), var(--red), var(--line)); }
	.gate-l { max-width: none; }
	.season, .bk-details { grid-template-columns: 1fr; }
	.facts div { grid-template-columns: 7.5rem 1fr; }
}
.toc-close { color: #fff !important; }
.hook { hyphens: manual; -webkit-hyphens: manual; }
.featured-quote + .featured-quote { margin-top: var(--s4); }
