/* Le site de Sebayt : « Lire » et « Apprendre » : thème clair, papier (decisions.md, 5 déc. 2026). */
@font-face { font-family: "Noto Sans Egyptian Hieroglyphs";
             src: url("assets/polices/NotoSansEgyptianHieroglyphs-Regular.ttf"); }
:root {
  --fond: #FBF7EE; --carte: #FFFDF8; --encre: #2A2620; --gris: #7A7266; --filet: #E4DAC6;
  --accent: #8C3B1F; --doux: #F3EBDA;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 72px; }
body { margin: 0; background: var(--fond); color: var(--encre); font-family: var(--serif); line-height: 1.55; }
button { font: inherit; color: inherit; }
a { color: var(--accent); }

/* en-tête : trois espaces */
.tete { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 24px;
        padding: 10px 24px; background: rgba(251,247,238,.94); backdrop-filter: blur(6px);
        border-bottom: 1px solid var(--filet); }
.marque { font-variant: small-caps; letter-spacing: .25em; font-size: 1.1rem; text-decoration: none; }
.onglets { display: flex; gap: 4px; font-family: var(--sans); font-size: .92rem; }
.onglets a { text-decoration: none; color: var(--gris); padding: 6px 14px; border-radius: 99px; }
.onglets a:hover { color: var(--encre); background: var(--doux); }
.onglets a.actif { color: #fff; background: var(--accent); }

.corps { display: grid; grid-template-columns: 15rem minmax(0, 1fr); }
#sommaire { position: sticky; top: 53px; height: calc(100vh - 53px); overflow-y: auto; padding: 18px 10px 40px;
            border-right: 1px solid var(--filet); font-family: var(--sans); font-size: .88rem; }
#sommaire .groupe-titre { display: flex; width: 100%; align-items: center; justify-content: space-between; margin: 10px 0 4px;
             padding: 6px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer;
             font-family: var(--sans); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gris); font-weight: 600; }
#sommaire .groupe-titre:hover { color: var(--encre); background: var(--doux); }
#sommaire .chevron { font-size: 1rem; line-height: 1; transition: transform .15s; transform: rotate(-90deg); }
#sommaire .groupe.ouvert .chevron { transform: none; }
#sommaire .groupe-liens { display: none; }
#sommaire .groupe.ouvert .groupe-liens { display: block; }
#sommaire a { display: flex; gap: 10px; align-items: center; padding: 5px 10px; border-radius: 8px; text-decoration: none; color: var(--encre); }
#sommaire a:hover { background: var(--doux); }
#sommaire a.actif { background: var(--doux); font-weight: 600; }
#sommaire .num { width: 1.5rem; height: 1.5rem; flex: none; border: 1px solid var(--filet); border-radius: 50%;
                 display: grid; place-items: center; font-size: .7rem; color: var(--gris); }
#vue { padding: 28px clamp(16px, 4vw, 56px) 120px; min-width: 0; }

/* ---------- Lire ---------- */
.maison { max-width: 980px; margin: 0 auto; }
.ouverture { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 36px; align-items: center; margin-bottom: 40px; }
.ouverture img { width: 100%; max-height: 62vh; object-fit: contain; display: block; }
.ouverture .sur { font-family: var(--sans); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gris); }
.ouverture h1 { font-weight: normal; font-variant: small-caps; letter-spacing: .12em; color: var(--accent); font-size: clamp(1.5rem, 2.3vw, 2rem); margin: .2em 0 .6em; }
.ouverture blockquote { margin: 0; font-style: italic; font-size: 1.15rem; }
.ouverture blockquote cite { display: block; font-style: normal; font-size: .85rem; color: var(--accent); margin-top: .4em; }
.ouverture .infos { margin-top: 1.2em; font-family: var(--sans); font-size: .82rem; color: var(--gris); }

.vers { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr) minmax(0, 1fr); gap: 4px 28px;
        padding: 22px 0; border-top: 1px solid var(--filet); }
.vers:target { background: linear-gradient(90deg, var(--doux), transparent 70%); }
.vers .ref { font-family: var(--sans); font-size: .78rem; color: var(--accent); padding-top: .45em; text-decoration: none; }
.vers .fr { font-size: 1.28rem; line-height: 1.45; margin: 0; }
.vers .h { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: flex-end; }
.mot { background: none; border: 0; padding: 3px; border-radius: 8px; cursor: pointer; line-height: 0; }
.mot:hover, .mot:focus-visible { background: var(--doux); outline: none; }
.mot.actif { background: #EBDDBF; }
/* un mot très long se réduit pour tenir dans sa colonne */
.mot { max-width: 100%; }
.mot svg { max-width: 100%; height: auto; }
.hiero text { fill: var(--encre); }
.hiero-missing { fill: none; stroke: var(--accent); stroke-width: 3; stroke-dasharray: 8 6; }
.outils { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-family: var(--sans); }
.outils button { background: none; border: 1px solid var(--filet); border-radius: 99px; padding: 3px 11px; font-size: .78rem;
                 color: var(--gris); cursor: pointer; }
.outils button:hover, .outils button[aria-expanded="true"] { color: var(--encre); background: var(--doux); }
.deplie { grid-column: 2 / 4; margin-top: 10px; font-size: .98rem; }
.deplie .src { font-family: var(--sans); font-size: .72rem; letter-spacing: .06em; color: var(--gris); text-transform: uppercase; }
.deplie blockquote { margin: .15em 0 .8em; padding-left: .8em; border-left: 3px solid var(--filet); }
.deplie .note { margin: 0 0 .6em; }
.mam { width: 100%; border-collapse: collapse; font-size: .95rem; }
.mam td { padding: 6px 8px; border-bottom: 1px solid var(--filet); vertical-align: middle; }
.mam td:first-child { width: 1%; white-space: nowrap; }
.suite { display: flex; justify-content: space-between; margin-top: 40px; font-family: var(--sans); font-size: .9rem; }
.suite a { text-decoration: none; padding: 10px 16px; border: 1px solid var(--filet); border-radius: 12px; background: var(--carte); }

/* ---------- Apprendre ---------- */
.apprendre { max-width: 1100px; margin: 0 auto; }
.apprendre h1 { font-weight: normal; font-variant: small-caps; letter-spacing: .12em; color: var(--accent); font-size: 1.9rem; margin: 0 0 .2em; }
.apprendre .chapeau { color: var(--gris); max-width: 46em; margin: 0 0 1.4em; }
.filtre { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; font-family: var(--sans); }
.filtre input { flex: 1; min-width: 200px; padding: 9px 14px; border: 1px solid var(--filet); border-radius: 99px; background: var(--carte); font: inherit; font-size: .92rem; }
.filtre button { border: 1px solid var(--filet); background: var(--carte); border-radius: 99px; padding: 7px 13px; font-size: .82rem; cursor: pointer; }
.filtre button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
h2.groupe { font-weight: normal; font-variant: small-caps; letter-spacing: .1em; font-size: 1.15rem; margin: 26px 0 12px; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.carte { background: var(--carte); border: 1px solid var(--filet); border-radius: 14px; padding: 14px 10px 12px; cursor: pointer;
         display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; transition: transform .12s, box-shadow .12s; }
.carte:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(60,40,20,.10); }
.carte .dessin { height: 64px; display: flex; align-items: center; }
.carte .lecture { font-style: italic; font-size: 1.15rem; }
.carte .quoi { font-size: .85rem; color: var(--gris); line-height: 1.3; }
.carte .code { font-family: var(--sans); font-size: .68rem; color: var(--gris); }
.carte .nb { font-family: var(--sans); font-size: .68rem; color: var(--accent); }
.mots { width: 100%; border-collapse: collapse; }
.mots td:first-child { width: 1%; white-space: nowrap; }
.mots td:first-child svg { max-width: 260px; height: auto; }
.mots td { padding: 8px 10px; border-bottom: 1px solid var(--filet); vertical-align: middle; }
.mots tr { cursor: pointer; }
.mots tr:hover { background: var(--doux); }
.mots .tr { font-style: italic; font-size: 1.1rem; }
.mots .nb { font-family: var(--sans); font-size: .78rem; color: var(--gris); text-align: right; white-space: nowrap; }

/* ---------- la fiche ---------- */
#fiche { position: fixed; z-index: 50; top: 66px; right: 16px; bottom: 16px; width: min(420px, 92vw); overflow-y: auto;
         background: var(--carte); border-radius: 16px; box-shadow: 0 12px 40px rgba(40,25,10,.25); padding: 22px 22px 30px;
         animation: entre .18s ease-out; }
@keyframes entre { from { transform: translateX(24px); opacity: 0; } }
#f-fermer { position: sticky; top: 0; float: right; border: 0; background: var(--doux); width: 32px; height: 32px; border-radius: 50%; font-size: 1.2rem; cursor: pointer; }
#fiche h3 { font-weight: normal; font-variant: small-caps; letter-spacing: .12em; color: var(--accent); font-size: .95rem; margin: 1.3em 0 .5em; }
#fiche .tr { font-style: italic; font-size: 1.35rem; margin: .3em 0 0; }
#fiche .simple { color: var(--gris); margin: 0 0 .6em; }
#fiche .signe { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--filet); }
#fiche .signe svg { max-width: 56px; height: auto; }
#fiche .petit { font-family: var(--sans); font-size: .75rem; color: var(--gris); }
#fiche .occ { display: block; padding: 7px 0; border-top: 1px solid var(--filet); text-decoration: none; color: var(--encre); }
#fiche .occ b { font-family: var(--sans); font-size: .75rem; color: var(--accent); font-weight: normal; margin-right: .5em; }
#fiche .occ:hover { background: var(--doux); }

/* ---------- accueil, dédicace, textes en prose ---------- */
.glyphe { font-family: "Noto Sans Egyptian Hieroglyphs"; font-size: .95rem; }
.accueil { max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 48px; align-items: center; min-height: calc(100vh - 160px); }
.couv img { width: 100%; max-height: 78vh; object-fit: contain; display: block; }
.titre-livre { font-weight: normal; font-variant: small-caps; letter-spacing: .18em; font-size: clamp(1.6rem, 2.5vw, 2.3rem); line-height: 1.25; margin: 0; }
.titre-hiero { margin: 22px 0 18px; }
.auteur { font-style: italic; margin: 0 0 22px; color: var(--encre); }
.presentation .chapeau { color: var(--gris); margin: 0 0 26px; max-width: 34em; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; font-family: var(--sans); }
.bouton { text-decoration: none; padding: 10px 18px; border-radius: 99px; border: 1px solid var(--filet); background: var(--carte); color: var(--encre); font-size: .92rem; }
.bouton:hover { background: var(--doux); }
.bouton.plein { background: var(--accent); border-color: var(--accent); color: #fff; }
.dedicace { max-width: 760px; margin: 12vh auto 0; text-align: center; font-style: italic; font-size: 1.4rem; }
.dedicace-hiero { margin-top: 2em; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 18px 26px; }
.dedicace-hiero svg { max-width: 100%; height: auto; }
.prose { max-width: 42em; margin: 0 auto; font-size: 1.1rem; }
.prose h1 { font-weight: normal; font-variant: small-caps; letter-spacing: .12em; color: var(--accent); font-size: 1.9rem; margin: 0 0 1em; }
.prose h2 { font-weight: normal; font-variant: small-caps; letter-spacing: .1em; font-size: 1.2rem; margin: 1.8em 0 .6em; }
.prose p { margin: 0 0 1em; text-align: justify; hyphens: auto; }
.prose .signature { text-align: right; font-style: italic; }
.mentions p { font-size: .98rem; color: var(--gris); text-align: left; }
@media (max-width: 860px) {
  .accueil { grid-template-columns: 1fr; gap: 22px; min-height: 0; }
  .couv img { max-height: 52vh; }
  .titre-livre { font-size: 1.8rem; }
  .dedicace { margin-top: 6vh; font-size: 1.2rem; }
}

/* ---------- tablette, téléphone ---------- */
@media (max-width: 980px) {
  .ouverture { grid-template-columns: 1fr; gap: 18px; }
  .vers { grid-template-columns: 3.4rem minmax(0, 1fr); }
  .vers .h { grid-column: 2; margin-top: 8px; }
  .outils, .deplie { grid-column: 2; }
}
/* tablette (iPad en portrait) et téléphone : les tableaux de mots deviennent de petites fiches */
@media (max-width: 1023px) {
  .grille { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .mam, .mam tbody { display: block; }
  .mam tr { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); grid-template-areas: "h tr" "h an";
            gap: 2px 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--filet); }
  .mam td { border: 0; padding: 0; overflow-wrap: anywhere; }
  .mam td:nth-child(1) { grid-area: h; width: auto; }
  .mam td:nth-child(1) svg { max-width: 100%; height: auto; }
  .mam td:nth-child(2) { grid-area: tr; }
  .mam td:nth-child(3) { grid-area: an; font-size: .92rem; }
  .deplie { overflow-wrap: anywhere; }
  .mots, .mots tbody { display: block; }
  .mots tr { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) auto; grid-template-areas: "h tr nb" "h an an";
             gap: 2px 12px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--filet); }
  .mots td { border: 0; padding: 0; }
  .mots td:nth-child(1) { grid-area: h; width: auto; }
  .mots td:nth-child(1) svg { max-width: 100%; height: auto; }
  .mots td:nth-child(2) { grid-area: tr; }
  .mots td:nth-child(3) { grid-area: an; font-size: .95rem; }
  .mots td:nth-child(4) { grid-area: nb; }
}
@media (max-width: 767px) {
  .mots tr, .mam tr { grid-template-columns: 5.5rem minmax(0, 1fr) auto; }
  .mam tr { grid-template-columns: 5.5rem minmax(0, 1fr); }
  .corps { grid-template-columns: 1fr; }
  #sommaire { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--filet);
              display: flex; overflow-x: auto; gap: 4px; padding: 8px 10px; }
  /* téléphone : une seule bande qui défile, tous les liens visibles, sans titres de groupes */
  #sommaire .groupe, #sommaire .groupe .groupe-liens, #sommaire .groupe.ouvert .groupe-liens { display: contents; }
  #sommaire .groupe-titre { display: none; }
  #sommaire a { flex: none; }
  #sommaire a .libelle { display: none; }
  #sommaire a.actif .libelle { display: inline; }
  .tete { padding: 8px 12px; gap: 10px; }
  .marque { font-size: .9rem; letter-spacing: .14em; }
  .onglets a { padding: 5px 10px; font-size: .84rem; }
  .vers { grid-template-columns: 1fr; padding: 18px 0; }
  .vers .ref { padding: 0; }
  .vers .h, .outils, .deplie { grid-column: 1; }
  .vers .fr { font-size: 1.15rem; }
  .grille { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
  /* les mots : chaque ligne devient une petite fiche (hiéroglyphes à gauche, lecture et nombre en haut, sens dessous) */
  #fiche { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 75vh; border-radius: 18px 18px 0 0; animation: monte .2s ease-out; }
  @keyframes monte { from { transform: translateY(30px); opacity: 0; } }
}
