:root {
  --parchment: #efe4cd;
  --parchment-dark: #e4d5b3;
  --ink: #241a10;
  --ink-soft: #4a3a26;
  --gold-line: rgba(36, 26, 16, .35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: #12100c;
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(255, 255, 255, .03), transparent 40%),
    radial-gradient(ellipse at 80% 90%, rgba(255, 255, 255, .02), transparent 40%);
  font-family: 'EB Garamond', serif;
  color: #e9ded0;
  padding: 0 0 80px;
}

.weapon-icon {
  width: 16px;
  height: 16px;
  color: #241a10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-image: url("../icons/armes.png");
  background-size: 300% 200%; /* 3 colonnes × 2 lignes */
}


/* Ligne 1 */
.icon-0 { background-position: 0% 0%; }
.icon-1 { background-position: 50% 0%; }
.icon-2 { background-position: 100% 0%; }

/* Ligne 2 */
.icon-3 { background-position: 0% 100%; }
.icon-4 { background-position: 50% 100%; }
.icon-5 { background-position: 100% 100%; }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 420px;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  flex: 1;
}

.boot-illustration {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 110px;
  margin-bottom: 10px;
}

.boot-illustration svg {
  width: 100px;
  height: 100px;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-block {
  margin-top: 10px;
}

.info-block .lab {
  display: block;
  margin-bottom: 3px;
  font-weight: bold;
  text-transform: uppercase;
}

.effect-block p,
.condition-block p {
  margin: 0;
}

.modifier {
  font-size: 1.3em;
  font-weight: bold;
}

.card-footer {
  margin-top: auto;
  padding-top: 12px;
  text-align: center;
  font-weight: bold;
  text-transform: uppercase;
}

/* ---------- HEADER ---------- */
.masthead {
  text-align: center;
  padding: 64px 20px 40px;
  border-bottom: 1px solid rgba(233, 222, 208, .15);
  margin-bottom: 40px;
  position: relative;
}

.masthead .eyebrow {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  letter-spacing: .35em;
  text-transform: uppercase;
  font-size: 12px;
  color: #b8a480;
  margin-bottom: 14px;
}

.masthead h1 {
  font-family: 'Cinzel Decorative', 'Cinzel', serif;
  font-weight: 700;
  font-size: clamp(32px, 5vw, 58px);
  margin: 0;
  letter-spacing: .03em;
  background: linear-gradient(180deg, #f3e6c8, #c9a35a 70%, #8a6a30);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .4);
}

.masthead .sub {
  margin-top: 14px;
  font-size: 15px;
  color: #9c8b6d;
  font-style: italic;
}

.masthead .flourish {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 22px;
  color: #b8a480;
}

.masthead .flourish .ln {
  height: 1px;
  width: 70px;
  background: linear-gradient(90deg, transparent, #8a7a58, transparent);
}

/* ---------- TOC / nav ---------- */
.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 1000px;
  margin: 0 auto 50px;
  padding: 0 20px;
}

.nav a {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: .08em;
  text-decoration: none;
  color: #12100c;
  background: var(--chip, #c9a35a);
  padding: 8px 14px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, .25);
  box-shadow: 0 2px 0 rgba(0, 0, 0, .25);
}

/* ---------- SECTION ---------- */
.school {
  max-width: 1400px;
  margin: 0 auto 70px;
  padding: 0 24px;
}

.school-head {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 26px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--acc);
  position: relative;
}

.school-badge {
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--acc-light), var(--acc) 60%, var(--acc-dark) 100%);
  border: 2px solid rgba(0, 0, 0, .4);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .5), inset 0 0 12px rgba(255, 255, 255, .15);
}

.school-badge svg {
  width: 38px;
  height: 38px;
  stroke: #12100c;
  fill: none;
}

.school-titles .kicker {
  font-size: 11px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--acc-light);
  font-family: 'EB Garamond', serif;
  font-style: italic;
}

.school-titles h2 {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 28px;
  margin: 2px 0 4px;
  color: #f3e6c8;
  letter-spacing: .02em;
}

.school-titles .desc {
  font-size: 14px;
  color: #a99878;
  font-style: italic;
}

.school-count {
  margin-left: auto;
  font-family: 'Cinzel', serif;
  font-size: 12px;
  color: var(--acc-light);
  text-align: right;
  letter-spacing: .05em;
  white-space: nowrap;
}

/* ---------- GRID ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 250px);
  gap: 22px;
  justify-content: center;
}

/* ---------- CARD ---------- */
.card {
  width: 250px;
  min-height: 352px;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(255, 255, 255, .35), transparent 55%),
    linear-gradient(160deg, var(--parchment), var(--parchment-dark));
  border-radius: 9px;
  position: relative;
  padding: 12px 13px 14px;
  color: var(--ink);
  box-shadow:
    0 10px 22px rgba(0, 0, 0, .55),
    0 1px 0 rgba(255, 255, 255, .4) inset;
  border: 1px solid rgba(0, 0, 0, .55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card::before {
  /* inner double frame */
  content: "";
  position: absolute;
  inset: 6px;
  border: 1.5px solid var(--acc-dark);
  border-radius: 5px;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .35) inset;
}

.card::after {
  /* corner texture vignette */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 100%, rgba(0, 0, 0, .16), transparent 60%);
  pointer-events: none;
}

.watermark {
  position: absolute;
  right: -18px;
  bottom: -14px;
  width: 150px;
  height: 150px;
  opacity: .09;
  stroke: var(--acc-dark);
  fill: none;
  stroke-width: 2.4;
  pointer-events: none;
  transform: rotate(-8deg);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 2;
  font-family: 'Cinzel', serif;
}

.card-eco {
  font-size: 8.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  margin-left: auto;
  margin-block-end: 0%;
  color: var(--acc-dark);
  font-family: 'EB Garamond', serif;
  font-style: italic;
}

.lvl-medal {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--acc-light), var(--acc) 55%, var(--acc-dark));
  border: 1px solid rgba(0, 0, 0, .5);
  color: #12100c;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 3px rgba(0, 0, 0, .4);
  flex: none;
}

.card-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 15.5px;
  line-height: 1.18;
  color: var(--ink);
  margin: 9px 0 3px;
  position: relative;
  z-index: 2;
  min-height: 36px;
}

.divider {
  width: 100%;
  height: 8px;

  position: relative;
  z-index: 2;
  line-height: 0;
  overflow: hidden;
}

.divider svg {
  display: block;
  width: 100%;
  height: 8px;
  stroke: var(--acc-dark);
  fill: none;
  opacity: .7;
}

.wound-row {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 2;
}

.wound-label {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.wound-name {
  font-family: 'EB Garamond', serif;
  font-weight: 600;
  font-style: italic;
  font-size: 12px;
  color: var(--ink);
}

.pips {
  display: flex;
  gap: 2.5px;
  margin-left: auto;
}

.pip {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  transform: rotate(45deg);
  border: 1px solid rgba(0, 0, 0, .4);
  background: transparent;
}

.pip.on {
  background: var(--wcolor, #7a1620);
}

.card-body {
  flex: 1;
  position: relative;
  z-index: 2;
  font-size: 11.3px;
  line-height: 1.42;
  color: var(--ink);
}

.card-body p {
  margin: 0 0 6px;
}

.card-body .lab {
  font-weight: 600;
  font-style: italic;
  color: var(--ink-soft);
}

.cond {
  font-size: 10px;
  font-style: italic;
  color: var(--ink-soft);
  border-left: 2px solid var(--acc);
  padding-left: 6px;
  flex: auto;
  margin-top: auto;
}

.bonus-strip {
  margin-bottom: 8px;
  font-size: 11px;
  line-height: 1.3;
  font-style: italic;
  font-weight: bold;
  color: var(--ink-soft);
  position: relative;
  z-index: 2;
  display: flex;
  gap: 6px;
  align-items: baseline;
}

.bonus-strip b {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  flex: none;
}

.no-bonus {
  height: 6px;
}

/* Category color themes */
.cat-estoc {
  --acc: #3f6491;
  --acc-light: #a9c4e0;
  --acc-dark: #1f3350;
  --chip: #a9c4e0;
}

.cat-taille {
  --acc: #8f2733;
  --acc-light: #d99a6a;
  --acc-dark: #5c1620;
  --chip: #d99a6a;
}

.cat-lourdes {
  --acc: #6b5f52;
  --acc-light: #c99a6b;
  --acc-dark: #332c26;
  --chip: #c99a6b;
}

.cat-bouclier {
  --acc: #4f6f92;
  --acc-light: #cfa46a;
  --acc-dark: #2c4460;
  --chip: #cfa46a;
}

.cat-deux {
  --acc: #6a4a78;
  --acc-light: #8fbf9c;
  --acc-dark: #3a2242;
  --chip: #8fbf9c;
}

.cat-hast {
  --acc: #3f5c48;
  --acc-light: #c9ab6a;
  --acc-dark: #1e2f24;
  --chip: #c9ab6a;
}

.cat-dagues {
  --acc: #5a1c26;
  --acc-light: #b98b5a;
  --acc-dark: #17100c;
  --chip: #b98b5a;
}

.cat-pugilat {
  --acc: #8a5a38;
  --acc-light: #e0c290;
  --acc-dark: #4a3018;
  --chip: #e0c290;
}

footer {
  text-align: center;
  color: #7c6c50;
  font-size: 12px;
  font-style: italic;
  margin-top: 40px;
}

@media print {
  body {
    background: #fff;
    color: #000;
    padding: 0;
  }

  .masthead,
  .nav,
  footer {
    display: none;
  }

  .school {
    page-break-inside: auto;
    max-width: none;
    margin: 0 auto 14px;
    padding: 0 8mm;
  }

  .school-head {
    page-break-after: avoid;
  }

  .grid {
    grid-template-columns: repeat(3, 63mm);
    gap: 5mm;
    justify-content: center;
  }

  .card {
    width: 63mm;
    min-height: 88mm;
    box-shadow: none;
    break-inside: avoid;
  }

  @page {
    margin: 10mm;
  }
}

/* =========================================================
   IMPRESSION DES CARTES
   ========================================================= */

@page {
  size: A4 portrait;
  margin: 8mm;
}

@media print {

/* =========================================================
   IMPRESSION A4
   ========================================================= */

@page {
  size: A4 portrait;
  margin: 8mm;
}

@media print {

  html,
  body {
    width: 210mm;
    margin: 0;
    padding: 0;
    background: white !important;
  }

  /* Éléments de l'interface à ne pas imprimer */
  .masthead,
  .nav,
  footer,
  .school-head,
  #printCards {
    display: none !important;
  }

  #content {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  /*
   * Chaque école contient une grille.
   * On supprime les espacements prévus pour l'affichage écran.
   */
  .school {
    width: 100%;
    max-width: none;
    margin: 0 !important;
    padding: 0 !important;
  }

  /*
   * 3 cartes de 63 mm
   * + 2 espaces de 4 mm
   * = 197 mm
   *
   * Avec une page A4 de 210 mm et 8 mm de marge :
   * largeur disponible = 194 mm
   *
   * Donc on réduit légèrement l'espace.
   */
  .grid {
    display: grid !important;

    grid-template-columns: repeat(3, 60mm) !important;
    grid-auto-rows: 85mm;

    column-gap: 4mm !important;
    row-gap: 4mm !important;

    justify-content: center;

    width: 100%;
    margin: 0;
    padding: 0;
  }

  /*
   * Format physique de la carte
   */
  .card {
    width: 60mm !important;
    height: 85mm !important;
    min-height: 85mm !important;

    margin: 0 !important;
    padding: 3mm 3.2mm 3.5mm;

    border-radius: 2mm;

    box-shadow: none;

    break-inside: avoid;
    page-break-inside: avoid;

    overflow: hidden;
  }

  /*
   * On garde les couleurs et les dégradés à l'impression.
   */
  .card {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /*
   * Image de la botte
   */
  .boot-illustration {
    height: 25mm;
    margin-bottom: 2mm;
  }

  .boot-illustration img {
    max-width: 100%;
    max-height: 25mm;
    object-fit: contain;
  }

  /*
   * Texte de la carte
   */
  .card-title {
    font-size: 11pt;
    min-height: 10mm;
  }

  .card-body {
    font-size: 8.5pt;
    line-height: 1.35;
  }

  .wound-label {
    font-size: 7pt;
  }

  .wound-name {
    font-size: 9pt;
  }

  .card-eco {
    font-size: 6.5pt;
  }

  .cond {
    font-size: 7.5pt;
  }

  .bonus-strip {
    font-size: 8pt;
  }

  /*
   * Évite qu'un élément interne soit coupé
   */
  .card-top,
  .boot-illustration,
  .wound-row,
  .divider,
  .card-body {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /*
   * Une nouvelle école peut commencer sur une nouvelle page
   * si nécessaire.
   */
  .school + .school {
    break-before: auto;
    page-break-before: auto;
  }
}}

.print-button {
  display: block;
  margin: 20px auto;
  padding: 10px 18px;

  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: .08em;

  cursor: pointer;

  color: #12100c;
  background: #c9a35a;

  border: 1px solid rgba(0,0,0,.4);
  border-radius: 3px;

  box-shadow: 0 2px 4px rgba(0,0,0,.4);
}


.print-modal {
  position: fixed;
  inset: 0;

  display: none;
  align-items: center;
  justify-content: center;

  background: rgba(0,0,0,.75);

  z-index: 9999;
}

.print-modal.open {
  display: flex;
}


.print-panel {
  width: min(500px, calc(100% - 30px));

  padding: 25px;

  background:
    radial-gradient(
      ellipse at 30% 0%,
      rgba(255,255,255,.35),
      transparent 55%
    ),
    linear-gradient(
      160deg,
      var(--parchment),
      var(--parchment-dark)
    );

  color: var(--ink);

  border: 1px solid rgba(0,0,0,.55);
  border-radius: 8px;

  box-shadow: 0 15px 50px rgba(0,0,0,.7);
}


.print-panel h2 {
  margin-top: 0;

  font-family: 'Cinzel', serif;
}


#schoolChoices {
  display: grid;
  gap: 8px;

  margin: 20px 0;
}


.school-choice {
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 10px;

  cursor: pointer;

  border: 1px solid rgba(0,0,0,.2);
  background: rgba(255,255,255,.15);
}


.school-choice input {
  width: 18px;
  height: 18px;
}


.school-choice span {
  font-family: 'Cinzel', serif;
}


.school-choice small {
  display: block;

  margin-top: 2px;

  font-family: 'EB Garamond', serif;
  font-size: 11px;
  opacity: .7;
}


.print-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}


.print-actions button {
  padding: 8px 12px;
  cursor: pointer;
}

@page {
  size: A4 portrait;
  margin: 8mm;
}

#printArea {
  display: none;
}

@media print {

  body > * {
    display: none !important;
  }

  #printArea {
    display: block !important;
  }

  .print-grid {
    display: grid;

    grid-template-columns: repeat(3, 60mm);

    gap: 4mm;

    justify-content: center;
  }

  #printArea .card {
    width: 60mm !important;
    height: 85mm !important;
    min-height: 85mm !important;

    margin: 0 !important;

    box-shadow: none;

    break-inside: avoid;
    page-break-inside: avoid;

    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  #printArea .boot-illustration {
    height: 25mm;
  }

  #printArea .boot-illustration img {
    max-height: 25mm;
    object-fit: contain;
  }
}