/* ==========================================================================
   STUDIO TYPOGRAPHIE — Fiche outil
   --------------------------------------------------------------------------
   Feuille autonome de la modale ouverte par le bouton INFOS, construite par
   scripts/fiche.js : en-tête, six onglets de chapitre, afficheur animé,
   ceinture entrée/sortie/raccourcis et pied de page.

   À charger APRÈS ../styles/tool-header.css. Les classes internes sont
   préfixées `lf-` : la fiche est injectée dans une page qui possède déjà ses
   propres .glyph ou .specimen. Les jetons de couleur sont figés ici pour que
   la fiche ignore les variantes de --paper / --acid du studio.

   Accent du studio : jaune.
   ========================================================================== */

.lig-modal {
  --lf-paper: #f3f0e8;
  --lf-white: #fbfaf5;
  --lf-ink: #11110f;
  --lf-yellow: #ffd83d;
  --lf-dim: rgba(243, 240, 232, 0.5);
  --lf-mono: ui-monospace, "SF Mono", "Courier New", monospace;
  --lf-sans: "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --lf-accent: var(--lf-yellow);

  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--lf-ink);
  background: rgba(17, 17, 15, 0.62);
  font-family: var(--lf-sans);
  -webkit-font-smoothing: antialiased;
}

.lig-modal.is-open {
  display: flex;
  animation: lf-fade 0.18s ease-out;
}

.lig-modal-card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  width: min(1180px, 100%);
  height: min(720px, calc(100vh - 48px));
  overflow: hidden;
  background: var(--lf-paper);
  border: 2px solid var(--lf-ink);
  box-shadow: 10px 10px 0 var(--lf-ink);
  animation: lf-card-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

.lig-modal-card *,
.lig-modal-card *::before,
.lig-modal-card *::after {
  box-sizing: border-box;
}

.lig-modal-card :where(button) {
  margin: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.lig-modal-card :where(h2, h3, p, b, i, span, div, output, label) {
  margin: 0;
  padding: 0;
}

.lig-modal-card :where(kbd) {
  font-family: var(--lf-mono);
}

.lig-modal-card :where(input[type="range"]) {
  width: 100%;
  height: 14px;
  min-width: 0;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  accent-color: var(--lf-accent);
  appearance: auto;
  -webkit-appearance: auto;
}

.lf-head {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 18px;
  border-bottom: 2px solid var(--lf-ink);
}

.lf-num {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  font: 900 14px/1 var(--lf-mono);
  background: var(--lf-accent);
  border: 2px solid var(--lf-ink);
}

.lf-titles {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.lf-titles h2 {
  font-size: 23px;
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1;
  text-transform: uppercase;
}

.lf-titles p {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
}

.lig-modal-close {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  font: 900 14px/1 var(--lf-mono);
  background: #fff;
  border: 2px solid var(--lf-ink);
  transition: transform 0.12s, box-shadow 0.12s;
}

.lig-modal-close:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--lf-ink);
}

.lf-tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border-bottom: 2px solid var(--lf-ink);
}

.lf-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  padding: 9px 8px;
  border-right: 1px solid var(--lf-ink);
  transition: background 0.12s, color 0.12s;
}

.lf-tab:last-child {
  border-right: 0;
}

.lf-tab-n {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font: 900 9.5px/1 var(--lf-mono);
}

.lf-tab-t {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 10.5px;
  font-weight: 800;
  font-style: italic;
  line-height: 1.15;
  text-transform: none;
}

.lf-tab-arrow {
  flex: none;
  font: 900 9px/1 var(--lf-mono);
  font-style: normal;
}

.lf-tab-arrow::before {
  content: "Aa";
  font-family: Georgia, "Times New Roman", serif;
}

.lf-tab:not([aria-selected="true"]) .lf-tab-arrow {
  opacity: 0.42;
}

.lf-tab[aria-selected="true"] .lf-tab-t {
  animation: lf-sign-font 2.4s ease-in-out infinite;
}

.lf-tab:hover {
  color: var(--lf-ink);
  background: var(--lf-accent);
}

.lf-tab[aria-selected="true"],
.lf-tab[aria-selected="true"]:hover {
  color: var(--lf-paper);
  background: var(--lf-ink);
  box-shadow: inset 0 -4px 0 var(--lf-accent);
}

.lf-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  min-height: 0;
}

.lf-art {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  overflow: hidden;
  padding: 14px;
  background: var(--lf-ink);
  border-right: 2px solid var(--lf-ink);
  background-image: repeating-linear-gradient(0deg, transparent 0 31px, rgba(255, 216, 61, 0.16) 31px 32px);
}

.lf-arthead {
  display: flex;
  flex: none;
  justify-content: space-between;
  gap: 10px;
  color: var(--lf-accent);
  font: 900 8.5px/1 var(--lf-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.lf-arthead .lf-r {
  color: var(--lf-dim);
}

.lf-live {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  vertical-align: middle;
  background: var(--lf-accent);
  animation: lf-blink 1.2s steps(1) infinite;
}

.lf-stage {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.lf-chap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 15px 16px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.lf-chap::-webkit-scrollbar {
  width: 8px;
}

.lf-chap::-webkit-scrollbar-thumb {
  background: var(--lf-ink);
}

.lf-kicker {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font: 900 9.5px/1 var(--lf-mono);
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.lf-kicker .lf-badge {
  padding: 5px 7px;
  color: var(--lf-accent);
  background: var(--lf-ink);
}

.lf-kicker .lf-mode {
  opacity: 0.5;
}

.lf-chap h3 {
  font-size: 25px;
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 0.97;
  text-transform: uppercase;
}

.lf-chap .lf-intro {
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
}

.lf-bullets {
  display: flex;
  flex-direction: column;
  border-top: 2px solid var(--lf-ink);
}

.lf-bullets div {
  display: flex;
  gap: 9px;
  padding: 9px 0;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  text-wrap: pretty;
  border-bottom: 1px solid rgba(17, 17, 15, 0.22);
}

.lf-bullets span {
  flex: none;
  font: 900 8px/1.7 var(--lf-mono);
}

.lf-tip {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  background: var(--lf-white);
  border: 2px solid var(--lf-ink);
}

.lf-tip b {
  flex: none;
  font: 900 8px/1.5 var(--lf-mono);
  letter-spacing: 0.14em;
}

.lf-tip span {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.lf-nav {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding-top: 6px;
}

.lf-nav .lf-bar {
  flex: 1;
  height: 9px;
  background: #fff;
  border: 1px solid var(--lf-ink);
}

.lf-nav .lf-bar i {
  display: block;
  height: 100%;
  background: var(--lf-accent);
  transition: width 0.28s ease;
}

.lf-nav button {
  padding: 6px 9px;
  font: 900 9.5px/1 var(--lf-mono);
  background: #fff;
  border: 2px solid var(--lf-ink);
}

.lf-nav button.lf-p {
  color: var(--lf-paper);
  background: var(--lf-ink);
}

.lf-belt {
  display: grid;
  grid-template-columns: 210px 210px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 12px 18px;
  background: var(--lf-accent);
  border-top: 2px solid var(--lf-ink);
}

.lf-col {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.lf-u {
  font: 900 9.5px/1 var(--lf-mono);
  letter-spacing: 0.19em;
  text-transform: uppercase;
  opacity: 0.6;
}

.lf-col .lf-v {
  font: 10px/1.4 var(--lf-mono);
  overflow-wrap: anywhere;
}

.lf-nokeys {
  padding: 4px 8px;
  font-size: 10.5px;
  font-weight: 750;
  border: 1px dashed var(--lf-ink);
}

.lf-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  background: var(--lf-ink);
  border-top: 2px solid var(--lf-ink);
}

.lf-led {
  flex: none;
  width: 8px;
  height: 8px;
  background: var(--lf-accent);
  border-radius: 50%;
  animation: lf-blink 1.4s steps(1) infinite;
}

.lf-foot p {
  color: var(--lf-paper);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}

.lf-foot .lf-tag {
  flex: none;
  margin-left: auto;
  color: var(--lf-accent);
  font: 900 9px/1 var(--lf-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ==========================================================================
   Afficheur — spécimen typographique
   ========================================================================== */

.lf-specimen {
  position: relative;
  display: grid;
  flex: 1;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  color: var(--lf-paper);
}

.lf-specimen b {
  font: var(--lf-fw, 500) 60px/1 var(--lf-sans);
  letter-spacing: -0.03em;
  transform: scaleX(var(--lf-fx, 1));
  transition: font-weight 0.2s, transform 0.2s;
}

.lf-specimen b.is-breathe {
  animation: lf-font-breathe 3.2s ease-in-out infinite;
}

.lf-metric {
  position: absolute;
  right: 0;
  left: 0;
  border-top: 1px dashed rgba(255, 216, 61, 0.7);
}

.lf-glyphs {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
  min-height: 0;
  overflow: hidden;
}

.lf-glyphs span {
  display: grid;
  place-items: center;
  color: rgba(243, 240, 232, 0.75);
  font: 500 12px/1 var(--lf-sans);
  border: 1px solid rgba(243, 240, 232, 0.22);
}

.lf-glyphs span.is-hot {
  color: var(--lf-accent);
  background: rgba(255, 216, 61, 0.1);
}

.lf-axisrow {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  color: var(--lf-dim);
  font: 900 8.5px/1 var(--lf-mono);
  letter-spacing: 0.12em;
}

.lf-axisrow input {
  flex: 1;
}

.lf-axisrow output {
  min-width: 34px;
  color: var(--lf-accent);
  text-align: right;
}

.lf-pill {
  position: absolute;
  padding: 4px 7px;
  color: var(--lf-accent);
  font: 900 9px/1 var(--lf-mono);
  border: 2px solid var(--lf-accent);
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes lf-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes lf-card-in {
  from { opacity: 0; transform: translate(-6px, -10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

@keyframes lf-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.18; }
}

@keyframes lf-font-breathe {
  0%, 100% { transform: scaleX(0.9); }
  50% { transform: scaleX(1.06); }
}

@keyframes lf-sign-font {
  0%, 100% { letter-spacing: -0.03em; transform: scaleX(0.96); }
  50% { letter-spacing: 0.03em; transform: scaleX(1.04); }
}

@media (max-width: 1024px) {
  .lig-modal { padding: 14px; }
  .lig-modal-card { height: calc(100vh - 28px); box-shadow: 6px 6px 0 var(--lf-ink); }
  .lf-body { grid-template-columns: minmax(0, 1fr) 300px; }
  .lf-belt { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .lf-belt > .lf-col:last-child { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  .lf-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(180px, 34%) minmax(0, 1fr); }
  .lf-art { border-right: 0; border-bottom: 2px solid var(--lf-ink); }
  .lf-tab-t { display: none; }
  .lf-titles h2 { font-size: 19px; }
  .lf-titles p { font-size: 12px; }
}

@media (max-width: 560px) {
  .lig-modal { padding: 0; }
  .lig-modal-card { width: 100%; height: 100vh; border: 0; box-shadow: none; }
  .lf-belt { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .lig-modal *,
  .lig-modal *::before,
  .lig-modal *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
