/* Accueil Valshaar : la bibliothèque de Valsharen (préfixe vb-, maquette A validée par Cookie le 2026-11-15).
   Couleurs : jetons « objets » des thèmes (--paper, --paper-shade, --ink, --gilt, --wax, --wood, --wood-dark), avec repli calculé. */
.vb {
    --vb-papier: var(--paper, color-mix(in srgb, var(--accent) 12%, light-dark(var(--bg), var(--text))));
    --vb-ombre: var(--paper-shade, color-mix(in srgb, var(--vb-papier) 78%, var(--accent)));
    --vb-encre: var(--ink, light-dark(var(--text), var(--bg)));
    --vb-or: var(--gilt, #d4af37);
    --vb-cire: var(--wax, var(--err, #a23a4e));
    --vb-bois: var(--wood, #5a3b25);
    --vb-bois-fonce: var(--wood-dark, #2a1a10);
    --vb-titre: color-mix(in srgb, var(--vb-encre) 55%, #8a2a10);
    --vb-doux: color-mix(in srgb, var(--vb-encre) 60%, var(--vb-papier));
    --vb-feuille: radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--vb-papier) 70%, #fff), var(--vb-papier) 62%, var(--vb-ombre));
    --ui: 700 12px var(--font-ui, system-ui), sans-serif;
    max-width: 1240px;
}

/* ---------- Titre et progression ---------- */
.vb-tete { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.vb-tete .kicker { margin: 0; }
.vb-tete h1 { margin: 0; font-size: clamp(2.6rem, 6vw, 4rem); color: var(--accent); }
.vb-tete .lead { margin: 0; max-width: 620px; }
.vb-progres { display: flex; align-items: center; gap: 18px; width: max-content; max-width: 100%; margin: 22px auto 0; padding: 12px 18px 12px 12px; border-radius: 14px;
    background: var(--plate, #171029cc); border: 1px solid var(--border); backdrop-filter: blur(6px); }
.vb-progres--visiteur { flex-wrap: wrap; justify-content: center; padding: 12px 18px; }
.vb-niveau { width: 64px; height: 64px; flex: none; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--vb-or) 0 var(--pct), color-mix(in srgb, var(--text) 18%, transparent) var(--pct) 100%); }
.vb-niveau > span { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font: 400 22px var(--font-h1), serif; color: #fbeedd;
    background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--vb-cire) 65%, #fff), var(--vb-cire) 60%, color-mix(in srgb, var(--vb-cire) 55%, #000)); box-shadow: inset 0 0 0 2px #f7e7b055; }
.vb-progres__txt { display: flex; flex-direction: column; gap: 2px; font-size: .92rem; color: var(--text-dim); min-width: 0; }
.vb-progres__txt b { font: 400 1.2rem var(--font-h1), serif; color: var(--accent); }
.vb-progres__txt b small { font: .8rem var(--font-ui, system-ui), sans-serif; color: var(--text-dim); }
.vb-progres__txt strong { color: var(--text); }
.vb-cire { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 8px; flex: none; text-decoration: none; font: 700 14px var(--font-ui, system-ui), sans-serif; color: #fbeedd;
    background: linear-gradient(180deg, color-mix(in srgb, var(--vb-cire) 85%, #fff), var(--vb-cire)); box-shadow: 0 3px 0 color-mix(in srgb, var(--vb-cire) 45%, #000); }
.vb-cire:hover { color: #fff; text-decoration: none; filter: brightness(1.06); }
.vb-lien { color: var(--accent); font-size: .92rem; }

/* ---------- La bibliothèque ---------- */
.vb-meuble { display: grid; grid-template-columns: minmax(0, 1fr); gap: 30px 24px;   /* l'Académie en haut, la Culture complète dessous (Cookie, 2026-12-03) */
    margin-top: 30px; padding: 26px 26px 30px; border-radius: 14px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--vb-bois-fonce) 85%, var(--vb-bois)), color-mix(in srgb, var(--vb-bois-fonce) 80%, #000));
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--vb-or) 22%, transparent), inset 0 0 60px #000a, 0 30px 50px -24px #000; }
.vb-etagere, .vb-cabinet { display: flex; flex-direction: column; min-width: 0; }
.vb-rangee { display: flex; align-items: flex-end; justify-content: safe center; gap: 4px; min-height: 226px; padding: 0 12px; }   /* sans débordement caché : l'infobulle du thème passe au-dessus du livre */
.vb-planche { height: 18px; flex: none; border-radius: 3px; background: linear-gradient(180deg, color-mix(in srgb, var(--vb-bois) 80%, var(--vb-or)) 0, var(--vb-bois) 3px, var(--vb-bois) 55%, var(--vb-bois-fonce) 100%);
    box-shadow: 0 10px 16px -6px #000; }
.vb-espace { width: 10px; flex: none; }
.vb-etiquette { align-self: center; margin-top: -2px; padding: 8px 20px 10px; border-radius: 0 0 10px 10px; text-align: center; text-decoration: none; color: var(--vb-encre); background: var(--vb-feuille);
    box-shadow: 0 10px 16px -10px #000; transition: transform .2s; }
.vb-etiquette:hover { text-decoration: none; transform: translateY(2px); }
.vb-etiquette b { display: block; font: 400 1.4rem var(--font-h1), serif; color: var(--vb-titre); }
.vb-etiquette small { font: .78rem var(--font-body), serif; color: var(--vb-doux); }

/* Un dos de livre : cuir dessiné, ou image (--peau) de Cookie, titre et filets écrits par-dessus */
.vb-dos { --h: 180px; position: relative; flex: 0 0 var(--w, 34px); height: var(--h); display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 22px 0 12px;
    border-radius: 3px 3px 2px 2px; text-decoration: none; color: var(--vb-or); transition: transform .2s;
    background: linear-gradient(90deg, #0007 0%, transparent 18%, #ffffff1c 45%, transparent 70%, #0007 100%), var(--cuir, var(--vb-bois)); box-shadow: 0 2px 0 #0006, inset 0 0 0 1px #0005; }
/* Dos bombé (jetons --dos-* de components.css) : la lumière est un fond posé sur l'image, ::after reste à l'infobulle */
.vb-dos--peau { background: var(--dos-lumiere), var(--peau) center / 100% 100% no-repeat, var(--cuir, var(--vb-bois)); border-radius: var(--dos-rayon); box-shadow: var(--dos-ombre); }
/* Filets dorés : en haut par ::before, en bas par une petite marque (::after est pris par l'infobulle du thème, [data-tip]) */
.vb-dos::before { content: ""; position: absolute; left: 4px; right: 4px; top: 10px; height: 5px; border-block: 1px solid color-mix(in srgb, var(--vb-or) 80%, transparent); }
.vb-dos__filet { position: absolute; left: 4px; right: 4px; bottom: 30px; height: 5px; border-block: 1px solid color-mix(in srgb, var(--vb-or) 80%, transparent); pointer-events: none; }
.vb-dos__tome { font: 400 .62rem var(--font-h1), serif; text-shadow: 0 1px 0 #000a; }
.vb-dos__titre { writing-mode: vertical-rl; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(180deg); margin: 0;   /* nom centré sur le dos (validé par Cookie 15/11) */
    max-height: calc(var(--h) - 80px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font: 400 .64rem var(--font-h1), serif; letter-spacing: .06em; text-shadow: 0 1px 0 #000a; }
.vb-dos--gros .vb-dos__titre { font-size: .72rem; }
.vb-dos__titre--long { white-space: normal; text-align: center; line-height: 1.15; max-height: calc(var(--h) - 64px); }   /* titre long sur deux lignes (deux colonnes en vertical) */
.vb-dos[data-tip]::after { z-index: 30; }
.vb-dos:hover, .vb-dos:focus-visible { z-index: 5;  transform: translateY(-8px); text-decoration: none; color: var(--vb-or); }
.vb-dos:focus-visible { outline: 2px solid var(--vb-or); outline-offset: 2px; }
.vb-dos.is-ferme { opacity: .55; filter: grayscale(.5); }
.vb-signet { position: absolute; top: -2px; right: 6px; width: 10px; height: 46px; background: var(--vb-cire); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%); }

/* Le cahier d'exercices et l'almanach, posés sur l'étagère */
.vb-cahier, .vb-almanach { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; text-align: center;
    color: var(--vb-encre); background: var(--vb-feuille); border-radius: 4px; box-shadow: 0 6px 10px -4px #000; transition: transform .2s; }
.vb-cahier { width: 92px; height: 120px; margin-left: 8px; transform: rotate(-4deg); }
.vb-cahier:hover { transform: rotate(-2deg) translateY(-4px); text-decoration: none; }
.vb-cahier__sceau { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font: 400 16px var(--font-h1), serif; color: #fbeedd;
    background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--vb-cire) 65%, #fff), var(--vb-cire) 60%, color-mix(in srgb, var(--vb-cire) 55%, #000)); }
.vb-cahier b { font: 400 .95rem var(--font-h1), serif; color: var(--vb-titre); }
.vb-cahier small { font: 11px var(--font-ui, system-ui), sans-serif; color: var(--vb-doux); }
.vb-almanach { position: relative; width: 130px; height: 150px; margin-left: 12px; }
.vb-almanach::before { content: ""; position: absolute; top: -8px; left: 20px; right: 20px; height: 10px; border-radius: 3px; background: var(--vb-bois); }
.vb-almanach:hover { transform: translateY(-4px); text-decoration: none; }
.vb-almanach small { font: var(--ui); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--vb-doux); }
.vb-almanach small:last-child { font: 11px var(--font-ui, system-ui), sans-serif; letter-spacing: 0; text-transform: none; }
.vb-almanach b { font: 400 1.2rem var(--font-h1), serif; color: var(--vb-titre); }
.vb-almanach span { font: 400 2.1rem/1 var(--font-h1), serif; color: var(--vb-cire); }

/* Le cabinet du scribe : plateau de bois avec les quatre outils */
.vb-cabinet { grid-column: 1 / -1; }
.vb-plateau { display: flex; justify-content: space-around; align-items: flex-start; gap: 10px; padding: 22px 20px 18px; border-radius: 10px 10px 0 0;
    background: linear-gradient(180deg, var(--vb-bois), color-mix(in srgb, var(--vb-bois) 70%, #000)); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--vb-or) 15%, transparent); }
.vb-outil { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 120px; text-align: center; text-decoration: none; color: color-mix(in srgb, var(--vb-or) 80%, #fff); }
.vb-outil:hover { text-decoration: none; color: #fff; }
.vb-outil__rond { width: 78px; height: 78px; display: grid; place-items: center; border-radius: 50%; color: var(--vb-titre); background: var(--vb-feuille);
    box-shadow: 0 6px 10px -4px #000, inset 0 0 0 3px color-mix(in srgb, var(--vb-or) 60%, var(--vb-papier)); transition: transform .2s; }
.vb-outil__rond svg { width: 34px; height: 34px; }
.vb-outil:hover .vb-outil__rond, .vb-outil:focus-visible .vb-outil__rond { transform: translateY(-4px) rotate(-6deg); }
.vb-outil b { font: 400 1rem var(--font-h1), serif; }
.vb-court { display: none; }

/* ---------- Tablette et téléphone ---------- */
@media (max-width: 1000px) {
    .vb-meuble { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
    .vb-progres { flex-wrap: wrap; justify-content: center; border-radius: 18px; text-align: center; }
    .vb-progres__txt { align-items: center; }
    .vb-meuble { margin-inline: -4px; padding: 16px 8px 10px; gap: 22px; }
    .vb-rangee { min-height: 0; padding: 0 8px; gap: 4px; }
    .vb-etagere .vb-rangee { mask-image: linear-gradient(90deg, #000 86%, transparent); padding-right: 30px; }   /* l'étagère glisse : le bord qui s'efface le montre */
    .vb-dos { height: calc(var(--h) * .74); flex-basis: calc(var(--w, 34px) * .78); padding-top: 18px; }   /* tailles variées gardées, en plus petit */
    .vb-dos__titre { max-height: calc(var(--h) * .74 - 70px); }
    .vb-dos__titre, .vb-dos--gros .vb-dos__titre { font-size: .58rem; }
    .vb-rangee { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }   /* téléphone : l'étagère glisse (infobulle inutile au doigt) */
    .vb-cahier { width: 74px; height: 98px; }
    .vb-almanach { width: 96px; height: 120px; }
    .vb-almanach b { font-size: 1rem; }
    .vb-almanach span { font-size: 1.6rem; }
    .vb-plateau { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 14px 6px; }
    .vb-outil { width: auto; }
    .vb-outil__rond { width: 56px; height: 56px; }
    .vb-outil__rond svg { width: 26px; height: 26px; }
    .vb-long { display: none; }
    .vb-court { display: block; font-size: .85rem !important; }
}

/* ---------- Le même dos sur l'étagère des Leçons (academie/lecons.php, bibliotheque.css .et-tranche), 2026-11-15 ---------- */
.et-tranche > .vb-dos { position: absolute; inset: 0; height: auto; }
.et-tranche > .vb-dos:hover, .et-tranche > .vb-dos:focus-visible { transform: none; }   /* c'est la tranche entière qui se soulève */
.et-tranche--fantome > .vb-dos { opacity: .55; }
@media (max-width: 600px) {
    .et-tranche > .vb-dos { height: auto; }
}
