/* Pages Ressources MÉDIANE : feuille commune.
   Chargée après /assets/tailwind.css (polices + reset). Préfixe tm- pour ne rien heurter. */

:root {
  --cream: #FDFBF7;
  --green: #0E3B2F;
  --muted: rgba(14,59,47,.75);
  --soft: rgba(14,59,47,.68);
  --line: rgba(14,59,47,.12);
}

body { background-color: var(--cream); color: var(--green);
       font-family: Inter, sans-serif; -webkit-font-smoothing: antialiased; }

/* ---------- En-tête (classes Tailwind de la home) et menu mobile sans script ---------- */
.tm-btn { display: inline-flex; align-items: center; gap: .5rem; background: var(--green); color: var(--cream);
          font-family: "JetBrains Mono", monospace; font-size: .7rem; letter-spacing: .18em;
          text-transform: uppercase; text-decoration: none; padding: .6rem 1rem; transition: opacity .2s; }
.tm-btn:hover { opacity: .9; }
.tm-btn-lg { padding: .9rem 1.75rem; font-size: .75rem; }
.tm-head a[aria-current] { text-decoration: underline; text-underline-offset: 6px; }
.tm-menu summary { list-style: none; cursor: pointer; width: 2rem; height: 2rem; display: flex; flex-direction: column;
                   justify-content: center; align-items: center; gap: 6px; position: relative; z-index: 60; }
.tm-menu summary::-webkit-details-marker { display: none; }
.tm-menu summary span { display: block; width: 1.5rem; height: 2px; background: var(--green); border-radius: 9999px;
                        transition: transform .2s; }
.tm-menu[open] summary span:first-child { transform: translateY(4px) rotate(45deg); }
.tm-menu[open] summary span:last-child { transform: translateY(-4px) rotate(-45deg); }
.tm-menu-panel { position: fixed; inset: 0; z-index: 50; background: var(--cream); display: flex; flex-direction: column;
                 justify-content: center; align-items: center; gap: 3rem; padding: 5rem 1.5rem 3rem; }
.tm-menu-panel nav { display: flex; flex-direction: column; align-items: center; gap: 1.75rem; }
.tm-menu-panel nav a { font-family: "Instrument Serif", serif; font-size: 1.875rem; line-height: 1.1; color: var(--green); text-decoration: none; }
.tm-menu-ctas { display: flex; flex-direction: column; gap: 1rem; width: 100%; max-width: 24rem; }

/* ---------- Gabarit ---------- */
.tm-wrap { max-width: 56rem; margin: 0 auto; padding: 2rem 1.5rem 5rem; }
.tm-prose { max-width: 42rem; }
.tm-crumbs { font-family: "JetBrains Mono", monospace; font-size: .7rem; letter-spacing: .08em;
             color: var(--soft); margin-bottom: 2.5rem; }
.tm-wrap .tm-crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.tm-wrap .tm-crumbs li { margin: 0; padding: 0; }
.tm-wrap .tm-crumbs li + li::before { content: "/"; margin-right: .4rem; opacity: .6; }
.tm-wrap .tm-crumbs a { color: var(--soft); text-decoration: none; }
.tm-wrap .tm-crumbs a:hover { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Typographie ---------- */
h1 { font-family: "Instrument Serif", serif; font-size: clamp(2.5rem, 6vw, 3.75rem); line-height: 1.05;
     margin-bottom: 1.5rem; text-wrap: balance; }
h2 { font-family: "Instrument Serif", serif; font-size: clamp(1.75rem, 4vw, 2.25rem); line-height: 1.15;
     margin: 4rem 0 1rem; scroll-margin-top: 1.5rem; text-wrap: balance; }
h3 { font-family: "Instrument Serif", serif; font-size: 1.5rem; margin: 2.5rem 0 .25rem; }
p { line-height: 1.75; margin-bottom: 1rem; }
.tm-lead { font-size: 1.25rem; line-height: 1.6; }
.tm-kicker { font-family: "JetBrains Mono", monospace; font-size: .7rem; letter-spacing: .18em;
             text-transform: uppercase; color: var(--soft); }
.tm-meta { font-family: "JetBrains Mono", monospace; font-size: .7rem; letter-spacing: .1em;
           color: var(--soft); margin-bottom: 2.5rem; }
.tm-meta a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.tm-axis-intro { font-style: italic; color: var(--muted); margin-bottom: 1.5rem; }
.tm-wrap a { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.tm-wrap a:hover { text-decoration-thickness: 2px; }

/* Listes : le reset Tailwind retire puces et numéros, on les rétablit */
.tm-wrap ul, .tm-wrap ol { line-height: 1.75; margin: 0 0 1rem; padding-left: 1.5rem; }
.tm-wrap ul { list-style: disc; }
.tm-wrap ul li::marker { color: var(--soft); }
.tm-wrap li { margin-bottom: .6rem; padding-left: .25rem; }
.tm-wrap ol.tm-steps { list-style: none; counter-reset: tm-step; padding-left: 0; }
.tm-wrap ol.tm-steps > li { counter-increment: tm-step; position: relative; padding-left: 2.75rem; margin-bottom: 1rem; }
.tm-wrap ol.tm-steps > li::before { content: counter(tm-step); position: absolute; left: 0; top: .1rem;
                           width: 1.9rem; height: 1.9rem; border: 1px solid var(--green); border-radius: 50%;
                           font-family: "JetBrains Mono", monospace; font-size: .75rem;
                           display: flex; align-items: center; justify-content: center; }

/* Sommaire */
.tm-toc { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 1.25rem 0; margin: 0 0 1rem; }
.tm-toc-title { font-family: "JetBrains Mono", monospace; font-size: .7rem; letter-spacing: .18em;
                text-transform: uppercase; color: var(--soft); margin-bottom: .75rem; }
.tm-wrap .tm-toc ol { list-style: none; margin: 0; padding: 0; columns: 2 16rem; column-gap: 2rem; }
.tm-wrap .tm-toc ol > li { padding-left: 0; margin-bottom: .4rem; break-inside: avoid;
                           font-size: .925rem; line-height: 1.5; }
.tm-wrap .tm-toc a { text-decoration: none; }
.tm-wrap .tm-toc a:hover { text-decoration: underline; }

/* ---------- Listes de définitions (niveaux, FAQ) ---------- */
dl.tm-levels { margin: 0 0 1rem; }
dl.tm-levels > div { border-top: 1px solid var(--line); padding: 1rem 0;
                     display: grid; grid-template-columns: 13rem 1fr; gap: 1.5rem; }
dl.tm-levels > div:last-child { border-bottom: 1px solid var(--line); }
dl.tm-levels dt { font-weight: 600; }
dl.tm-levels dd { margin: 0; line-height: 1.7; }

/* ---------- Tableaux ---------- */
table.tm-grid { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: .95rem; }
table.tm-grid th, table.tm-grid td { text-align: left; padding: .8rem 1rem .8rem 0;
                                     border-bottom: 1px solid var(--line); vertical-align: top; }
table.tm-grid thead th { font-family: "JetBrains Mono", monospace; font-size: .7rem; letter-spacing: .12em;
                         text-transform: uppercase; color: var(--soft); font-weight: 400;
                         border-bottom: 1px solid rgba(14,59,47,.35); }
table.tm-grid tbody tr:hover { background: rgba(14,59,47,.025); }
.tm-range { display: block; font-family: "JetBrains Mono", monospace; font-size: .7rem;
            letter-spacing: .1em; color: var(--soft); font-weight: 400; margin-top: .15rem; }

/* ---------- Blocs ---------- */
.tm-note { border-left: 2px solid rgba(14,59,47,.3); padding: .25rem 0 .25rem 1.25rem;
           color: var(--muted); margin: 2rem 0; }
.tm-note p:last-child { margin-bottom: 0; }
figure.tm-fig { margin: 2.5rem 0; }
figure.tm-fig svg { width: 100%; max-width: 26rem; height: auto; display: block; margin: 0 auto; }
figcaption { font-size: .85rem; color: var(--soft); text-align: center; margin-top: 1rem; }

.tm-cta { margin-top: 4rem; padding: 2rem; border: 1px solid var(--line); background: rgba(14,59,47,.03);
          display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.tm-cta p { margin: 0; line-height: 1.6; }
.tm-cta-title { font-family: "Instrument Serif", serif; font-size: 1.5rem; line-height: 1.2; margin-bottom: .35rem !important; }
.tm-wrap .tm-cta a.tm-btn { color: var(--cream); text-decoration: none; flex-shrink: 0; }

.tm-sources { margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--line);
              font-size: .9rem; color: var(--muted); }

/* ---------- Page d'ensemble : cartes ---------- */
.tm-section-intro { color: var(--muted); margin-bottom: 1.5rem; }
.tm-wrap ul.tm-cards { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid;
                       grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1rem; }
.tm-wrap ul.tm-cards li.tm-card { position: relative; margin: 0; padding: 1.5rem; display: flex; flex-direction: column;
                                  border: 1px solid var(--line); background: #fff; transition: border-color .2s, transform .2s; }
.tm-wrap ul.tm-cards li.tm-card:hover { border-color: rgba(14,59,47,.45); transform: translateY(-2px); }
.tm-wrap ul.tm-cards li.tm-card:focus-within { outline: 2px solid var(--green); outline-offset: 2px; }
.tm-card h3 { margin: .6rem 0 .75rem; line-height: 1.2; }
.tm-wrap .tm-card h3 a { color: inherit; text-decoration: none; }
.tm-card h3 a::after { content: ""; position: absolute; inset: 0; }
.tm-card-desc { font-size: .95rem; line-height: 1.6; flex-grow: 1; margin-bottom: 1.25rem; }
.tm-card-cta { font-family: "JetBrains Mono", monospace; font-size: .7rem; letter-spacing: .12em;
               text-transform: uppercase; color: var(--green); margin: 0; }
.tm-card-cta span { display: inline-block; transition: transform .2s; }
.tm-card:hover .tm-card-cta span { transform: translateX(4px); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
           clip: rect(0,0,0,0); white-space: nowrap; border-width: 0; }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  dl.tm-levels > div { grid-template-columns: 1fr; gap: .35rem; }
  .tm-cta { flex-direction: column; align-items: flex-start; padding: 1.5rem; }
  /* Tableaux empilés : une carte par ligne, l'en-tête de colonne repris en étiquette */
  table.tm-grid thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  table.tm-grid, table.tm-grid tbody, table.tm-grid tr, table.tm-grid td { display: block; width: 100%; }
  table.tm-grid tr { border-top: 1px solid rgba(14,59,47,.35); padding: .9rem 0 .4rem; }
  table.tm-grid tr:last-child { border-bottom: 1px solid var(--line); }
  table.tm-grid td { border: 0; padding: .2rem 0 .6rem; }
  table.tm-grid td:first-child { font-size: 1.05rem; padding-bottom: .5rem; }
  table.tm-grid td[data-label]::before { content: attr(data-label); display: block;
       font-family: "JetBrains Mono", monospace; font-size: .62rem; letter-spacing: .12em;
       text-transform: uppercase; color: var(--soft); margin-bottom: .15rem; }
}
