/* Base */
:root{color-scheme:light;box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}
html{scroll-padding-top:env(safe-area-inset-top,0px)}
body{margin:0;padding:0;font:14px -apple-system,BlinkMacSystemFont,sans-serif;background:#fff;color:#000}
img{max-width:100%}
[hidden]:not([hidden=until-found i]){display:none!important}

/* Styles du site */
  /* Layout: onglets dessinés à la main en haut, bannière dessinée, puis une page par onglet sur fond vert forêt.
     La page À propos est une pile de blocs texte + photo qui alternent (photo à gauche, puis à droite).
     Le contenu des blocs vit dans content.json, les photos dans img/. Look unique volontaire (pas de thème clair). */
  :root {
    --forest: #4f704b;
    --forest-deep: #3d5a3a;
    --cream: #f0e4cf;
    --paper: #fbf5e6;
    --ink: #232a10;
    --ink-soft: #6a5d3e;
    --olive-1: #525c1c;
    --olive-2: #6b7519;
    --olive-3: #93a51e;
    --lime-1: #cfe063;
    --lime-2: #eaf7a0;
    --lime-3: #f4ffc4;
    --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
    --font-body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    color-scheme: dark;
  }

  * { box-sizing: border-box; }

  html { scroll-behavior: smooth; }

  body {
    background: var(--forest);
    color: var(--paper);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.65;
    min-height: 100vh;
  }

  .wrap {
    width: 100%;
    max-width: 1080px;
    margin-inline: auto;
    padding-inline: 16px;
  }

  :focus-visible {
    outline: 3px solid var(--lime-3);
    outline-offset: 3px;
  }

  /* ---------- En-tête : onglets ---------- */
  /* Onglets et frise restent visibles en haut de l'écran pendant le défilement */
  .sticky-top {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 10;
    background: var(--forest);
    box-shadow: 0 6px 14px rgba(20, 35, 18, 0.28);
  }

  .top { padding-block: 18px 6px; }

  .tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 14px;
    padding: 4px;
  }

  .tab {
    position: relative;
    appearance: none;
    border: 0;
    height: 46px;
    padding-inline: 8px;
    border-radius: 14px;
    font-family: var(--font-body);
    font-size: 0.94rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease;
  }

  /* contour dessiné à la main : deux traits légèrement décalés et ondulés */
  .tab::before,
  .tab::after {
    content: "";
    position: absolute;
    border: 2px solid var(--paper);
    border-radius: 15px;
    pointer-events: none;
  }
  .tab::before { inset: -3px; filter: url(#croquis-a); }
  .tab::after { inset: -1px -2px -2px -1px; filter: url(#croquis-b); opacity: 0.85; }

  .tab:nth-child(1) { background: var(--olive-1); color: #fff; }
  .tab:nth-child(2) { background: var(--olive-2); color: #fff; }
  .tab:nth-child(3) { background: var(--olive-3); color: var(--ink); }
  .tab:nth-child(4) { background: var(--lime-1); color: var(--ink); }
  .tab:nth-child(5) { background: var(--lime-3); color: var(--ink); }

  .tab:hover { transform: translateY(-2px); }
  .tab[aria-selected="true"] { transform: translateY(3px); font-weight: 800; }
  .tab[aria-selected="true"]::before { border-width: 3px; }

  /* ---------- Bannière (change selon le sujet du texte) ---------- */
  .banner {
    position: relative;
    margin-top: 16px;
    height: clamp(60px, 8vw, 104px);
    background: var(--cream);
    border-block: 2px solid var(--paper);
    overflow: hidden;
  }
  .banner img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    opacity: 0;
    transition: opacity 0.7s ease;
  }
  .banner img.on { opacity: 1; }

  /* ---------- Pages ---------- */
  main { padding-block: 48px 80px; }

  .panel[hidden] { display: none; }

  h1, h2, h3 {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    text-wrap: balance;
    margin: 0;
  }

  h1 { font-size: clamp(3rem, 9vw, 5.4rem); line-height: 0.98; letter-spacing: -0.01em; }
  h2 { font-size: clamp(2.3rem, 5.5vw, 3.7rem); line-height: 1; letter-spacing: -0.01em; margin-bottom: 22px; }
  h3 { font-size: 1.6rem; line-height: 1.15; }

  p { margin: 0 0 1em; max-width: 62ch; }

  /* ---------- Blocs de la page À propos ---------- */
  .blocks {
    display: grid;
    gap: clamp(56px, 9vw, 96px);
  }

  .loading { color: var(--lime-2); }

  .block {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
  }

  .block .media { position: relative; min-width: 0; }
  .block .media img { display: block; width: 100%; height: auto; }
  .block .text { min-width: 0; }

  .block h1, .block h2 { margin: 0; }

  .block .subtitle {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.35;
    margin: 6px 0 22px;
    max-width: none;
  }

  .block .text > p {
    max-width: none;
    text-align: justify;
    hyphens: auto;
  }

  .block.intro .media { display: flex; justify-content: center; }

  .block.intro .media img {
    max-width: 280px;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 50%;
    border: 8px solid var(--paper);
  }

  /* Lecture : titre et sous-titre en haut, puis la photo flotte à côté du texte (le texte continue sous la photo) */
  .block.flow { display: block; }
  .block.flow .text { display: flow-root; }
  .block.flow .media { margin: 0 0 20px; }

  .block .links-title {
    font-size: 0.9rem;
    font-weight: 800;
    margin: 1.6em 0 0.4em;
  }
  .block .links { margin: 0; padding-left: 1.2em; font-size: 0.9rem; }
  .block .links li { margin-bottom: 0.3em; overflow-wrap: anywhere; }
  .block .links a { color: var(--lime-3); text-underline-offset: 3px; }

  /* ---------- Mode modification ---------- */
  .pill {
    appearance: none;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 800;
    padding: 10px 18px;
    border-radius: 14px;
    cursor: pointer;
    border: 2px solid var(--paper);
    background: var(--lime-3);
    color: var(--ink);
    transition: transform 0.15s ease;
  }
  .pill:hover:not(:disabled) { transform: translateY(-2px); }
  .pill:disabled { opacity: 0.6; cursor: default; }
  .pill.alt { background: transparent; color: var(--paper); }

  .photo-btn {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    white-space: nowrap;
  }
  .photo-btn:hover:not(:disabled) { transform: translateX(-50%) translateY(-2px); }

  .edit-form { display: grid; gap: 16px; min-width: 0; }

  .field { display: grid; gap: 4px; min-width: 0; }
  .field > span {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--lime-2);
  }
  .field input,
  .field select,
  .field textarea {
    width: 100%;
    font: inherit;
    color: var(--paper);
    background: rgba(10, 25, 10, 0.28);
    border: 1.5px dashed var(--lime-2);
    border-radius: 10px;
    padding: 9px 12px;
  }
  .field textarea { min-height: 9rem; resize: vertical; line-height: 1.55; }
  .field input:focus,
  .field select:focus,
  .field textarea:focus { outline: 3px solid var(--lime-3); outline-offset: 2px; }

  .link-row { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .link-row + .link-row { margin-top: 10px; }
  .edit-form .pill { justify-self: start; }

  .editbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--forest-deep);
    border-top: 2px solid var(--paper);
  }
  .editbar .hint { flex: 1 1 220px; margin: 0; font-size: 0.88rem; color: var(--lime-2); max-width: none; }

  .fab {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 20;
  }

  .toast {
    position: fixed;
    left: 50%;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 30;
    max-width: calc(100% - 32px);
    margin: 0;
    padding: 10px 16px;
    border-radius: 12px;
    background: var(--paper);
    color: var(--ink);
    font-weight: 600;
    font-size: 0.92rem;
    box-shadow: 3px 4px 0 rgba(22, 36, 18, 0.35);
  }

  body.editing main { padding-bottom: 150px; }

    /* ---------- Protocoles ---------- */
  .protocol h3 { font-size: clamp(2rem, 4.5vw, 2.8rem); line-height: 1.05; }
  .proto-sub { font-size: 1.15rem; font-weight: 600; margin: 6px 0 18px; }

  .proto-part { margin-top: 40px; }
  .proto-part > p, .proto-list { max-width: none; }
  .proto-part > p { text-align: justify; hyphens: auto; }
  .proto-h {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(1.7rem, 3.6vw, 2.2rem);
    line-height: 1.1;
    margin: 0 0 12px;
  }
  #p-intro p { max-width: none; margin: 0 0 1em; text-align: justify; hyphens: auto; }
  .proto-list { margin: 0 0 1em; padding-left: 1.2em; }
  .proto-list li { margin-bottom: 0.45em; }
  .proto-hint {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lime-2);
  }

  .proto { display: grid; gap: 20px; margin-top: 28px; }

  .scene-btn {
    display: block;
    position: relative;
    width: min(100%, 620px);
    aspect-ratio: 1 / 1;
    margin-inline: auto;
    padding: 0;
    border: 3px solid var(--paper);
    border-radius: 18px;
    background: var(--forest-deep);
    color: inherit;
    cursor: pointer;
    overflow: hidden;
  }
  .scene-btn:hover { border-color: var(--lime-3); }
  .scene-btn img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.6s ease;
  }
  .scene-btn img[data-on] { opacity: 1; }

  .proto-caption { min-height: 9em; }
  .proto-caption p, .proto-caption div { max-width: none; }
  #proto-text p { margin: 0 0 0.6em; text-align: justify; hyphens: auto; }
  .proto-step {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--lime-2);
    margin-bottom: 4px;
  }
  .proto-title {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    font-size: 1.9rem;
    line-height: 1.1;
    margin-bottom: 8px;
  }

  .proto-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
  .dots { display: flex; gap: 8px; margin-left: 6px; }
  .dots i {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid var(--paper);
  }
  .dots i[data-on] { background: var(--lime-3); border-color: var(--lime-3); }

  .legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 0.95rem; }
  .legend li { display: flex; align-items: baseline; gap: 10px; }
  .swatch {
    flex: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--c);
    border: 2px solid var(--paper);
    transform: translateY(2px);
  }

  @media (prefers-reduced-motion: reduce) {
    .g-ground, .g-cue, .g-tray, .g-block, .g-zones, .g-vial, .worm { transition: none !important; }
    .g-cue rect { animation: none; }
  }

  /* ---------- Bibliographie ---------- */
  .biblio { margin-top: 0; }
  .biblio > p { margin-bottom: 0; }

  .shelf-wrap { margin-top: 18px; padding-top: 24px; overflow-x: auto; }
  .shelf-wrap + .shelf-wrap,
  .reader + .shelf-wrap { margin-top: 36px; }
  .shelf {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    width: max-content;
    min-width: 100%;
    padding: 18px 22px 0;
    background: rgba(20, 32, 18, 0.35);
    border-radius: 14px 14px 0 0;
    border-bottom: 16px solid #8a5b36;
    box-shadow: 0 5px 0 #5e3d22;
  }

  .spine {
    flex: none;
    width: var(--w, 58px);
    height: var(--h, 260px);
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    padding: 16px 6px 12px;
    border: 0;
    border-radius: 4px 4px 0 0;
    background: var(--bg);
    color: var(--fg);
    cursor: pointer;
    box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.35), inset -3px 0 0 rgba(0, 0, 0, 0.18);
    transition: transform 0.25s ease;
  }
  .spine:hover { transform: translateY(-8px); }
  .spine[aria-pressed="true"] { transform: translateY(-16px); outline: 3px solid var(--lime-3); outline-offset: 2px; }
  .spine img { display: block; width: 100%; height: 100%; object-fit: cover; }
  .spine-title {
    writing-mode: vertical-rl;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 600;
    font-size: 1.2rem;
    line-height: 1.1;
    text-align: start;
  }
  .spine-author {
    writing-mode: vertical-rl;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: start;
  }


  /* Revues (ex. « Insectes n°201 ») : rangées à plat en pile, fines, à droite de l'étagère */
  .mag-stack {
    flex: none;
    display: flex;
    flex-direction: column-reverse;
    gap: 3px;
    margin-left: auto;
    padding-left: 18px;
    width: 360px;
  }
  .mag {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    height: 30px;
    padding: 0 14px 0 18px;
    border: 0;
    border-radius: 2px 6px 6px 2px;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: left;
    cursor: pointer;
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.28), inset 0 -3px 0 rgba(0, 0, 0, 0.2), 2px 2px 0 rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
  }
  .mag::before { content: ""; position: absolute; inset: 0 auto 0 6px; width: 3px; background: rgba(0, 0, 0, 0.18); }
  .mag:hover { transform: translateX(10px); }
  .mag[aria-pressed="true"] { transform: translateX(18px); outline: 3px solid var(--lime-3); outline-offset: 2px; }
  .mag-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
  .mag-tag { flex: none; font-size: 0.6rem; opacity: 0.8; }

  .shelf-gap {
    flex: none;
    width: 58px;
    height: 260px;
    display: grid;
    place-items: center;
    border: 1.5px dashed rgba(251, 245, 230, 0.4);
    border-radius: 4px 4px 0 0;
    writing-mode: vertical-rl;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--lime-2);
  }

  .reader { margin-top: 28px; display: grid; gap: 16px; }
  .dots[hidden] { display: none; }
  .reader[hidden] { display: none; }
  .reader-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    place-items: center;
    min-height: 320px;
    padding: 28px 16px;
    background: rgba(25, 45, 24, 0.28);
    border-radius: 18px;
    cursor: pointer;
    overflow: hidden;
  }
  .reader-caption p { max-width: none; margin: 0; }
  .reader-caption .proto-title { margin-bottom: 4px; }

  .face { animation: flip-in 0.45s ease both; max-width: 100%; }
  .face:not(.volume) { width: 100%; display: flex; justify-content: center; }
  @keyframes flip-in { from { opacity: 0; transform: perspective(900px) rotateY(-70deg); } }

  /* Le livre garde toujours le format de la couverture : première, quatrième, ou couverture avec post-it */
  .book {
    position: relative;
    flex: none;
    /* le livre se réduit pour tenir à l'écran sous le bandeau fixe */
    width: min(100%, 360px, calc((100vh - 360px) * var(--ratio, 0.65)));
    min-width: 240px;
    max-width: 100%;
    aspect-ratio: var(--ratio, 0.65);
    container-type: inline-size;
    background: var(--cream);
    box-shadow: 8px 10px 0 rgba(20, 35, 18, 0.45);
    overflow: hidden;
  }
  /* pli de la reliure */
  .book::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4cqw;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0));
    pointer-events: none;
  }
  .cover { display: block; width: 100%; height: 100%; object-fit: cover; }

  .book.back { background: #f6efdd; color: var(--ink); }
  .back-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 8cqw 8cqw 6cqw 9cqw;
    font-size: clamp(10px, 3.9cqw, 15px);
    line-height: 1.45;
  }
  .back-inner p { margin: 0 0 0.9em; max-width: none; text-align: justify; hyphens: auto; }
  .back-inner .pub {
    margin: auto 0 0;
    padding-top: 1em;
    border-top: 1px solid rgba(35, 42, 16, 0.35);
    font-family: var(--font-mono);
    font-size: 0.78em;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-soft);
    text-align: start;
  }

  .volume { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; width: 100%; }

  /* Post-it de bibliothécaire collé sur la couverture */
  .postit {
    position: relative;
    z-index: 2;
    width: min(100%, 400px);
    margin-left: -56px;
    padding: 30px 24px 18px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.07) 0, rgba(0, 0, 0, 0) 26px), #cbe3a9;
    color: #1d2a12;
    font-family: "Patrick Hand", "Nunito Sans", system-ui, sans-serif;
    font-size: 1.12rem;
    line-height: 1.35;
    box-shadow: 5px 7px 0 rgba(20, 35, 18, 0.3);
    transform: rotate(-2deg);
  }
  .postit p { margin: 0 0 0.7em; max-width: none; text-align: left; }
  .postit p.quote {
    margin-left: 0.6em;
    padding-left: 0.8em;
    border-left: 3px solid rgba(29, 42, 18, 0.35);
    font-size: 0.95em;
  }
  @media (max-width: 800px) {
    .postit { margin-left: 0; margin-top: -90px; align-self: flex-end; }
  }

  @media (prefers-reduced-motion: reduce) {
    .face { animation: none; }
    .spine { transition: none; }
    .spine:hover { transform: none; }
  }


  /* ---------- Page modifiable partout ---------- */
  .edit-only { display: none; }
  body.editing .edit-only { display: block; }
  body.editing .view-only { display: none; }

  .edit-card {
    display: grid;
    gap: 14px;
    margin-top: 22px;
    padding: 20px;
    border-radius: 18px;
    background: rgba(25, 45, 24, 0.28);
    min-width: 0;
  }
  .edit-card-title {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--lime-2);
    margin: 0;
  }
  .edit-card .edit-form { min-width: 0; }
  .edit-card-title { grid-column: 1 / -1; }
  .edit-photo { position: relative; width: min(100%, 260px); }
  .edit-photo img { display: block; width: 100%; height: auto; border-radius: 12px; border: 3px solid var(--paper); }
  .edit-photo:not(.has) .photo-btn { position: static; transform: none; }
  .edit-photo:not(.has) .photo-btn:hover:not(:disabled) { transform: translateY(-2px); }
  .item-row { display: grid; gap: 8px; align-items: end; }
  .row-actions { display: flex; flex-wrap: wrap; gap: 10px; }
  .edit-add { margin-top: 18px; }
  .color-row { display: flex; flex-wrap: wrap; gap: 16px; }
  .color-row input[type="color"] { width: 64px; height: 38px; padding: 2px; }
  .check { display: flex; gap: 8px; align-items: center; font-size: 0.9rem; }
  @media (min-width: 760px) {
    .edit-card.with-photo { grid-template-columns: 260px minmax(0, 1fr); gap: 28px; align-items: start; }
  }

  .entry p + p { margin-top: 0.8em; }
  .entry::after { content: ""; display: block; clear: both; }
  .entry-photo {
    float: left;
    width: min(40%, 220px);
    margin: 4px 24px 8px 0;
    border-radius: 12px;
    border: 4px solid var(--paper);
  }
  .contact-photo {
    display: block;
    width: min(100%, 220px);
    margin: 0 0 20px;
    border-radius: 50%;
    border: 6px solid var(--paper);
  }
  .contact-list a { color: var(--lime-3); text-underline-offset: 3px; }

  /* Ma pratique : une page de carnet, avec ses trous verts à gauche */
  .notebook {
    --line: 1.75em;
    position: relative;
    /* le texte est posé sur les lignes du carnet : le haut du texte est un multiple exact de l’interligne */
    padding: var(--line) 26px calc(var(--line) * 0.5) 64px;
    border-radius: 12px 28px 28px 12px;
    background:
      repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--line) - 1px), rgba(82, 111, 75, 0.28) calc(var(--line) - 1px), rgba(82, 111, 75, 0.28) var(--line)),
      #ebe8da;
    color: #3a2a17;
    line-height: var(--line);
    font-size: 1.08rem;
    box-shadow: 5px 7px 0 rgba(20, 35, 18, 0.3);
  }
  .notebook::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 14px;
    bottom: 14px;
    width: 46px;
    background:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='46' height='140'%3E%3Cg fill='%23526f4b'%3E%3Cpath d='M0 6 L38 2 Q44 4 43 12 L41 22 Q38 28 30 28 L0 26Z'/%3E%3Cpath d='M12 40 Q8 42 9 50 Q10 58 16 59 L36 58 Q42 56 41 48 Q40 41 34 40Z'/%3E%3Cpath d='M0 74 L36 72 Q43 74 42 83 L41 92 Q38 97 30 97 L0 96Z'/%3E%3Cpath d='M14 108 Q9 110 10 118 Q11 127 17 128 L36 127 Q41 124 40 116 Q39 109 33 108Z'/%3E%3C/g%3E%3C/svg%3E") repeat-y left top / 46px 140px;
  }
  .notebook p { margin: 0; max-width: none; }
  .notebook .nb-title { font-weight: 800; }
  .notebook p + div > p:first-child { margin-top: 0; }
  .notebook div > p + p { margin-top: var(--line); }
  .notebook .nb-text p { text-align: justify; hyphens: auto; }

  /* ---------- Booster et cartes ---------- */
  .tcg { margin: 8px 0 40px; padding: 24px; background: rgba(25, 45, 24, 0.28); border-radius: 18px; }
  .tcg .proto-h { margin-bottom: 6px; }
  .tcg-sub { margin-top: 36px; }
  .tcg-stage { position: relative; display: grid; place-items: center; height: clamp(400px, 70vw, 560px); margin: 18px 0 14px; }
  .tcg-stage > * { grid-area: 1 / 1; }
  .booster {
    position: relative; appearance: none; border: 0; background: none; padding: 0; cursor: pointer;
    height: 100%; aspect-ratio: 566 / 900;
    filter: drop-shadow(6px 8px 0 rgba(20, 35, 18, 0.35));
    transition: transform 0.25s ease, opacity 0.5s ease;
  }
  .booster:hover { transform: rotate(-2deg) translateY(-5px); }
  .booster img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
  .booster .b-top { clip-path: inset(0 0 90% 0); transform-origin: 0 100%; transition: transform 0.7s cubic-bezier(0.3, 0.6, 0.3, 1), opacity 0.7s ease; }
  .booster .b-body { clip-path: inset(9.2% 0 0 0); }
  .tcg.open .booster { animation: shake 0.55s ease-in-out; pointer-events: none; }
  .tcg.open .b-top { transform: translate(70%, -90%) rotate(38deg); opacity: 0; transition-delay: 0.5s; }
  .tcg.pulled .booster { opacity: 0; transform: translateY(14%) scale(0.92); pointer-events: none; }
  @keyframes shake { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-4deg); } 40% { transform: rotate(4deg); } 60% { transform: rotate(-3deg); } 80% { transform: rotate(3deg); } }

  .tcg-pull { display: grid; justify-items: center; gap: 12px; opacity: 0; transform: translateY(40px) scale(0.8) rotateY(80deg); pointer-events: none; transition: opacity 0.5s ease 0.2s, transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s; }
  .tcg.pulled .tcg-pull { opacity: 1; transform: none; pointer-events: auto; }
  .tcg-item.owned { appearance: none; background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: transform 0.2s ease; }
  .tcg-item.owned:hover { transform: translateY(-4px); }
  .tcg-lightbox { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(15, 28, 14, 0.82); overflow-y: auto; }
  .tcg-lb-box { display: grid; justify-items: center; gap: 14px; max-width: 100%; margin-block: auto; }
  .tcg-lb-box .tcard { width: min(86vw, 440px, calc((100vh - 220px) * 63 / 88)); }
  .tcg-lb-box .tc-cap { text-align: center; max-width: min(90vw, 460px); font-size: 1.08rem; color: var(--paper); }
  .tcg-lb-box .tc-cap strong { font-size: 1.6rem; }
  .tcg-pull .tcard { width: min(82vw, 440px); }
  .tcg-pull .tc-cap { text-align: center; max-width: min(88vw, 460px); font-size: 1.08rem; }
  .tcg-pull .tc-cap strong { font-size: 1.6rem; }
  /* une fois la carte sortie, la zone s'agrandit pour la contenir en entier */
  .tcg.pulled .tcg-stage { height: auto; min-height: clamp(400px, 70vw, 560px); }

  .tcard { position: relative; aspect-ratio: 63 / 88; border-radius: 14px; overflow: hidden; border: 4px solid #5b3a26; background: #f0e4cf; color: #3b2a16; box-shadow: 4px 6px 0 rgba(20, 35, 18, 0.35); }
  .tcard img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .tcard[data-rarity="peu commune"] { border-color: #8aa63c; }
  .tcard[data-rarity="rare"] { border-color: #e6b422; box-shadow: 0 0 0 2px #fff4b0, 4px 6px 0 rgba(20, 35, 18, 0.35), 0 0 22px rgba(255, 224, 110, 0.7); }
  .tc-ph { height: 100%; display: grid; place-content: center; gap: 8px; text-align: center; padding: 12px; background: repeating-linear-gradient(45deg, #f0e4cf 0 12px, #ebdcc0 12px 24px); }
  .tc-ph b { font-family: "Patrick Hand", var(--font-body), sans-serif; font-size: 1.5rem; line-height: 1.1; }
  .tc-ph small { font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.6; }
  .tcard.back { background: #5b3a26; border-color: #f0e4cf; opacity: 0.55; }
  .tcard.back .tc-ph { background: repeating-linear-gradient(45deg, #5b3a26 0 12px, #664330 12px 24px); color: #f0e4cf; }
  .tcard.back .tc-ph b { font-size: 2.4rem; }
  .tc-cap { margin: 0; font-size: 0.95rem; line-height: 1.35; max-width: 270px; }
  .tc-cap strong { display: block; font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 1.25rem; }
  .tc-cap small { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--lime-2); }
  .tc-new { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--lime-3); }

  .tcg-count { margin: 0; font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.06em; color: var(--lime-2); }
  .tcg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 22px 18px; margin-top: 14px; }
  .tcg-item { display: grid; gap: 8px; align-content: start; position: relative; }
  .tcg-item .tc-cap { max-width: none; }
  .tcg-badge { position: absolute; top: -8px; right: -6px; z-index: 2; background: var(--lime-3); color: var(--ink); font-weight: 800; font-size: 0.8rem; border-radius: 999px; padding: 2px 9px; border: 2px solid var(--paper); }
  .tcg-reset { margin-top: 26px; }
  /* Projets : le booster à gauche, la collection à droite, visibles ensemble sur grand écran */
  .tcg-cols { display: block; }
  @media (min-width: 900px) {
    .tcg-cols { display: grid; grid-template-columns: minmax(0, 540px) minmax(0, 1fr); gap: 36px; align-items: start; }
    .tcg-left { position: sticky; top: 215px; }
    .tcg-right .tcg-sub { margin-top: 18px; }
    .tcg-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 16px 12px; }
    .tcg-item .tc-cap { font-size: 0.78rem; line-height: 1.25; }
    .tcg-item .tc-cap strong { font-size: 1rem; }
    .tcg-item .tc-ph b { font-size: 0.95rem; }
    .tcg-item .tc-ph small { display: none; }
    .tcg-item .tcard { border-width: 3px; border-radius: 10px; }
    .tcg-stage { margin-top: 8px; }
    .tcg-pull { width: 100%; }
    .tcg-pull .tcard { width: min(100%, 540px, max(270px, calc((100vh - 400px) * 63 / 88))); }
    .tcg-stage { height: clamp(460px, calc(100vh - 290px), 720px); }
    .tcg.pulled .tcg-stage { min-height: 0; }
    .tcg-pull .tc-cap { max-width: 100%; }
  }
  @media (prefers-reduced-motion: reduce) {
    .tcg.open .booster { animation: none; }
    .tcg-pull, .booster .b-top { transition-duration: 0.01s; transition-delay: 0s; }
  }

  .scene-ph { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; opacity: 0; transition: opacity 0.6s ease; background: repeating-linear-gradient(45deg, #4a6a46 0 14px, #44633f 14px 28px); font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--lime-2); }
  .scene-ph[data-on] { opacity: 1; }
  .proto-photo { float: right; width: min(36%, 300px); margin: 4px 0 14px 28px; border-radius: 12px; border: 4px solid var(--paper); }
  .proto-part::after { content: ""; display: block; clear: both; }
  .protocol + .protocol { margin-top: 72px; padding-top: 40px; border-top: 2px dashed rgba(251, 245, 230, 0.4); }
  .edit-proto-h { margin: 36px 0 0; font-size: 1.6rem; }
  .proto-edit + .proto-edit { margin-top: 48px; padding-top: 8px; border-top: 2px dashed rgba(251, 245, 230, 0.4); }

  /* Intro sur toute la largeur ; animation à gauche, étapes à droite */
  .proto-part > div > p { max-width: none; text-align: justify; hyphens: auto; }
  @media (min-width: 860px) {
    .proto { grid-template-columns: minmax(0, 560px) minmax(0, 1fr); column-gap: 44px; row-gap: 18px; align-items: start; }
    .proto .scene-btn { grid-column: 1; grid-row: 1 / span 2; margin-inline: 0; width: 100%; }
    .proto .proto-caption { grid-column: 2; grid-row: 1; min-height: 0; align-self: end; }
    .proto .proto-actions { grid-column: 2; grid-row: 2; align-self: start; }
    .proto .proto-text { font-size: 1.08rem; line-height: 1.6; }
  }

  /* Protocoles : tous les textes sont ajustés (justifiés), début et fin de ligne alignés */
  .protocoles-intro { margin: 0 0 44px; }
  #protocoles p, #protocoles li { max-width: none; text-align: justify; text-justify: inter-word; hyphens: auto; -webkit-hyphens: auto; }
  #protocoles .proto-hint, #protocoles .proto-step, #protocoles .nb-title, #protocoles .proto-title, #protocoles .tc-cap { text-align: left; hyphens: none; }
  .protocoles-intro p + p { margin-top: 0.9em; }

  .edit-photo .photo-remove { position: absolute; left: 50%; bottom: 62px; transform: translateX(-50%); margin: 0; white-space: nowrap; background: var(--forest-deep); }
  .edit-photo .photo-remove:hover:not(:disabled) { transform: translateX(-50%) translateY(-2px); }

  /* Contact : bandeau foncé en bas de chaque page, et rappel en haut sur grand écran */
  html { scroll-padding-top: 230px; }
  main { padding-bottom: 64px; }
  .site-footer { background: #2a3f27; border-top: 4px solid #1f301d; padding-block: 44px 56px; color: var(--paper); }
  .footer-title { font-size: clamp(1.6rem, 3vw, 2.1rem); margin-bottom: 18px; }
  .footer-credit { margin: 36px 0 0; padding-top: 18px; border-top: 1px solid rgba(251, 245, 230, 0.25); max-width: none; font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--lime-2); }
  .footer-view { display: grid; gap: 18px; justify-items: start; }
  .footer-view p { max-width: 70ch; margin: 0; }
  .footer-view .contact-photo { width: 120px; height: 120px; object-fit: cover; border-radius: 50%; border-width: 4px; margin: 0; }
  .site-footer .contact-list { max-width: none; width: 100%; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 22px 32px; }
  .header-contact { display: none; }
  @media (min-width: 1500px) {
    .header-contact { display: grid; gap: 4px; position: absolute; top: 24px; right: 28px; width: calc((100vw - 1080px) / 2 - 56px); font-size: 0.85rem; line-height: 1.35; text-align: right; justify-items: end; }
    .header-contact[hidden] { display: none; }
    .hc-link { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--lime-2); text-decoration: none; border-bottom: 1px dashed var(--lime-2); }
    .hc-line { margin: 0; max-width: none; overflow-wrap: anywhere; }
    .hc-line span { opacity: 0.75; }
    .hc-line a { color: var(--lime-3); }
  }
  body.editing .site-footer { padding-bottom: 150px; }

  /* ---------- Autres pages ---------- */
  .cols {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .cols h2 { margin-bottom: 8px; }

  .entry {
    padding-block: 18px;
    border-top: 1px solid rgba(251, 245, 230, 0.35);
  }
  .entry:first-of-type { margin-top: 12px; }
  .entry h3 { margin-bottom: 4px; }
  .entry p { margin: 0; color: var(--cream); }
  .meta {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lime-2);
    margin-bottom: 6px;
  }

  .group {
    background: rgba(25, 45, 24, 0.28);
    border-radius: 18px;
    padding: 24px 24px 18px;
  }
  .group h3 { margin-bottom: 12px; }
  .group ul { list-style: none; margin: 0; padding: 0; }
  .group li {
    padding-block: 9px;
    border-top: 1px solid rgba(251, 245, 230, 0.25);
  }

  .todo {
    border-bottom: 2px dashed var(--lime-2);
    color: var(--lime-3);
  }

  .contact-list { margin: 0; display: grid; gap: 18px; max-width: 520px; }
  .contact-list dt {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--lime-2);
  }
  .contact-list dd { margin: 2px 0 0; font-size: 1.15rem; }

  @media (min-width: 640px) {
    .tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
    .tab { font-size: 0.98rem; }
    .cols { grid-template-columns: 1fr 1fr; gap: 56px; }
    .groups { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
    .link-row { grid-template-columns: 1fr 1fr auto; align-items: end; }
  }

  /* Photo et texte alternent : photo à gauche, puis à droite, puis à gauche... */
  @media (min-width: 760px) {
    /* Mode modification : photo d'un côté, formulaire de l'autre */
    .block:not(.flow) { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.35fr); gap: 48px; align-items: center; }
    .block:not(.flow):nth-child(even) { grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr); }
    .block:not(.flow):nth-child(even) .media { order: 2; }
    .block.intro:not(.flow) { grid-template-columns: 280px minmax(0, 1fr); gap: 40px; }

    /* Lecture : photo à gauche, puis à droite, alignée sur le début du texte */
    .block.flow .media { float: left; width: min(38%, 420px); margin: 6px 36px 16px 0; }
    .block.flow:nth-child(even) .media { float: right; margin: 6px 0 16px 36px; }
  }

  @media (max-width: 639px) {
    .groups > * + * { margin-top: 20px; }
  }

  @media (prefers-reduced-motion: reduce) {
    .tab, .pill { transition: none; }
    .tab:hover, .pill:hover:not(:disabled) { transform: none; }
    .photo-btn:hover:not(:disabled) { transform: translateX(-50%); }
    html { scroll-behavior: auto; }
  }
