/* =========================================================================
   TERRES DÉSOLÉES — Compagnon de jeu (Fallout 2d20)
   Feuille de style partagée — thème "affiche / papier usé"
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Oswald:wght@400;500;600;700&family=Roboto+Condensed:wght@400;500;700&display=swap');

:root {
  --paper: #e7dfc6;
  --paper-alt: #ded4b3;
  --paper-dark: #d3c7a1;
  --ink: #262117;
  --ink-soft: #4a4331;
  --yellow: #e7b727;
  --yellow-dark: #b98a10;
  --black-bar: #1a1712;
  --border: #bfae7f;
  --red-mj: #7c1f18;
  --red-mj-bg: #ecd6ce;
  --red-mj-border: #8c3126;
  --shadow: rgba(0, 0, 0, 0.35);
  --max-width: 960px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Roboto Condensed', Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at top left, rgba(255, 255, 255, 0.25), transparent 55%),
    radial-gradient(ellipse at bottom right, rgba(0, 0, 0, 0.12), transparent 60%);
  position: relative;
}

/* grain de papier — bruit généré en pur CSS/SVG, aucune ressource externe */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.22;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

h1, h2, h3, h4 {
  font-family: 'Oswald', 'Roboto Condensed', Arial, sans-serif;
  color: var(--ink);
  margin: 0 0 0.6em;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--red-mj);
}

ul, ol {
  padding-left: 1.4em;
}

/* ---------------------------------------------------------------------- */
/* En-tête                                                                 */
/* ---------------------------------------------------------------------- */

.site-header {
  background: var(--black-bar);
  color: var(--paper);
  border-bottom: 4px solid var(--yellow);
  position: sticky;
  top: 0;
  z-index: 500;
}

.header-bar {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.2rem;
}

.site-logo {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  line-height: 1.1;
}

.logo-main {
  font-family: 'Bebas Neue', 'Oswald', sans-serif;
  font-size: 1.7rem;
  letter-spacing: 0.06em;
  color: var(--yellow);
}

.logo-sub {
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #cfc6a8;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Indicateur de mode */
.mode-badge {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  padding: 0.35em 0.7em;
  border-radius: 3px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.mode-badge.badge-joueur {
  background: #33502f;
  color: #d7e8c9;
  border-color: #567a4f;
}

.mode-badge.badge-mj {
  background: var(--red-mj);
  color: #f6dfd8;
  border-color: #b04a3c;
  animation: pulse-mj 2.2s ease-in-out infinite;
}

@keyframes pulse-mj {
  0%, 100% { box-shadow: 0 0 0 0 rgba(140, 43, 35, 0.55); }
  50% { box-shadow: 0 0 0 5px rgba(140, 43, 35, 0); }
}

.btn-mode {
  font-family: 'Oswald', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--yellow);
  color: var(--black-bar);
  border: 1px solid var(--yellow-dark);
  padding: 0.5em 0.9em;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-mode:hover {
  background: var(--yellow-dark);
}

.btn-mode:focus-visible,
.nav-toggle:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 2px;
}

/* Bouton hamburger (mobile) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 38px;
  height: 34px;
  background: transparent;
  border: 1px solid #56503f;
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 20px;
  margin: 0 auto;
  background: var(--yellow);
}

/* ---------------------------------------------------------------------- */
/* Navigation                                                              */
/* ---------------------------------------------------------------------- */

.site-nav {
  background: #211d16;
  border-top: 1px solid #3a3323;
}

.nav-menu {
  max-width: var(--max-width);
  margin: 0 auto;
  list-style: none;
  display: flex;
  padding: 0 1.2rem;
}

.nav-menu > li {
  position: relative;
}

.nav-menu a {
  display: block;
  padding: 0.75em 1em;
  color: #d9d0b2;
  text-decoration: none;
  font-family: 'Oswald', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-menu > li > a:hover,
.nav-menu > li > a.active {
  color: var(--yellow);
  background: rgba(231, 183, 39, 0.08);
}

.nav-menu .has-submenu > .nav-top::after {
  content: " \25BE";
}

/* Élément de menu visible uniquement en mode MJ (ex: "Écran MJ").
   Présent dans le HTML de toutes les pages, mais cet élément lui-même
   n'est jamais sensible : seul son contenu (les pages qu'il pointe) est
   protégé côté serveur. */
.nav-mj-only {
  display: none;
}

body.mode-mj .nav-mj-only {
  display: block;
}

.nav-mj-only > .nav-top {
  color: #d99a8a;
}

.nav-mj-only > .nav-top:hover,
.nav-mj-only > .nav-top.active {
  color: var(--red-mj);
  background: rgba(140, 43, 35, 0.15);
}

.submenu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 200px;
  background: #211d16;
  border: 1px solid #3a3323;
  border-top: 2px solid var(--yellow);
  box-shadow: 0 6px 14px var(--shadow);
  z-index: 50;
}

.has-submenu.open .submenu,
.has-submenu:hover .submenu {
  display: block;
}

.submenu a {
  padding: 0.7em 1.1em;
  font-size: 0.8rem;
  white-space: nowrap;
}

.submenu a:hover,
.submenu a.active {
  color: var(--yellow);
  background: rgba(231, 183, 39, 0.08);
}

/* Navigation mobile */
@media (max-width: 760px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    display: none;
  }

  .site-nav.force-visible,
  body .site-nav {
    display: block;
  }

  .nav-menu {
    display: none;
    flex-direction: column;
    padding: 0.4rem 1rem 1rem;
  }

  .nav-menu.open {
    display: flex;
  }

  .nav-menu > li {
    border-bottom: 1px solid #322c1f;
  }

  .submenu {
    position: static;
    border: none;
    box-shadow: none;
    background: #191610;
    display: none;
  }

  .has-submenu.open .submenu {
    display: block;
  }

  .has-submenu:hover .submenu {
    display: none;
  }

  .has-submenu.open:hover .submenu {
    display: block;
  }
}

/* ---------------------------------------------------------------------- */
/* Contenu de page                                                         */
/* ---------------------------------------------------------------------- */

.page-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.2rem 4rem;
}

.banner-title {
  display: inline-block;
  background: var(--yellow);
  color: var(--black-bar);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.4rem;
  letter-spacing: 0.06em;
  padding: 0.2em 0.9em 0.25em 0.7em;
  clip-path: polygon(0 0, 100% 0, 94% 100%, 0% 100%);
  margin: 0 0 1.2rem;
  box-shadow: 4px 4px 0 var(--black-bar);
}

.lede {
  font-size: 1.05rem;
  color: var(--ink-soft);
}

section {
  margin-bottom: 2.2rem;
}

section h2 {
  font-size: 1.4rem;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 0.3em;
  margin-bottom: 0.8em;
}

section h3 {
  font-size: 1.05rem;
  color: var(--ink-soft);
  border-left: 4px solid var(--yellow);
  padding-left: 0.5em;
  margin-top: 1.4em;
}

.card {
  background: var(--paper-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.2rem 1.4rem;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.12);
}

.card + .card {
  margin-top: 1rem;
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.1s ease;
}

.card-link:hover {
  transform: translateY(-2px);
}

.card-link .card {
  border-left: 6px solid var(--yellow);
}

.card-title {
  font-family: 'Oswald', sans-serif;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-bottom: 0.3em;
  color: var(--ink);
}

.info-box {
  background: #f2ecd6;
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: 1rem 1.2rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------------- */
/* Tableaux                                                                 */
/* ---------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.12);
  margin: 1rem 0 1.6rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 480px;
  background: var(--paper);
}

thead th {
  background: var(--black-bar);
  color: var(--yellow);
  text-transform: uppercase;
  font-family: 'Oswald', sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 0.65em 0.9em;
}

tbody td {
  padding: 0.6em 0.9em;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 0.93rem;
}

tbody tr:nth-child(odd) {
  background: #efe8d1;
}

tbody tr:nth-child(even) {
  background: #e1d6b3;
}

/* Ligne cliquable qui fait défiler vers une autre table de la page
   (ex: table "Type de rencontre" -> table détaillée correspondante). */
tbody tr.row-link {
  cursor: pointer;
}

tbody tr.row-link:hover {
  background: rgba(231, 183, 39, 0.25);
}

td.col-num {
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink-soft);
}

td.col-label {
  font-weight: 700;
}

/* Repère visuel pour un test / mécanisme de jeu cité dans une table
   (ex: "PER + Crochetage difficulté 3"), à l'intérieur d'un texte narratif. */
.mechanic {
  color: var(--yellow-dark);
  font-weight: 600;
  font-style: normal;
}

/* ---------------------------------------------------------------------- */
/* Contenu réservé au MJ                                                   */
/* ---------------------------------------------------------------------- */

.mj-only {
  display: none;
}

body.mode-mj .mj-only {
  display: block;
}

body.mode-mj .mj-only.table-wrap {
  display: block;
}

section.mj-only {
  position: relative;
  background: var(--red-mj-bg);
  border: 2px dashed var(--red-mj-border);
  border-radius: 4px;
  padding: 1.4rem 1.4rem 1.6rem;
}

section.mj-only h2 {
  border-bottom-color: var(--red-mj-border);
  color: var(--red-mj);
}

.mj-stamp {
  display: inline-block;
  background: var(--red-mj);
  color: #f7e3dc;
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3em 0.7em;
  border-radius: 2px;
  transform: rotate(-2deg);
  margin-bottom: 0.8em;
}

section.mj-only .table-wrap {
  border-color: var(--red-mj-border);
}

section.mj-only thead th {
  background: var(--red-mj);
  color: #f7e3dc;
}

.mj-tip {
  background: var(--red-mj-bg);
  border: 1px dashed var(--red-mj-border);
  border-radius: 4px;
  padding: 0.8em 1em;
  font-size: 0.9rem;
  color: var(--red-mj);
  margin: 1em 0;
}

.joueur-notice {
  display: block;
  background: #f2ecd6;
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: 1rem 1.2rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
  text-align: center;
}

body.mode-mj .joueur-notice {
  display: none;
}

/* ---------------------------------------------------------------------- */
/* Page de connexion MJ (Login.aspx)                                       */
/* ---------------------------------------------------------------------- */

.login-wrap {
  max-width: 400px;
  margin: 1rem auto 0;
}

.login-card p {
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.login-card .modal-input {
  margin-bottom: 0.6rem;
}

.modal-input {
  width: 100%;
  padding: 0.6em 0.7em;
  font-size: 1rem;
  font-family: 'Roboto Condensed', sans-serif;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fbf7ea;
  margin-top: 0.4rem;
}

.modal-error {
  color: var(--red-mj);
  font-size: 0.85rem;
  margin: 0.5em 0 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.2rem;
}

.btn-primary,
.btn-secondary {
  font-family: 'Oswald', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.55em 1.1em;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid var(--border);
}

.btn-primary {
  background: var(--yellow);
  color: var(--black-bar);
  border-color: var(--yellow-dark);
}

.btn-primary:hover {
  background: var(--yellow-dark);
}

.btn-secondary {
  background: transparent;
  color: var(--ink-soft);
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.06);
}

/* ---------------------------------------------------------------------- */
/* Pied de page                                                            */
/* ---------------------------------------------------------------------- */

.site-footer {
  background: var(--black-bar);
  color: #a99f80;
  text-align: center;
  padding: 1.4rem 1rem;
  font-size: 0.78rem;
  border-top: 4px solid var(--yellow);
}

.site-footer p {
  margin: 0;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

.footer-support {
  margin: 0.9rem 0 0;
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.support-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: 'Oswald', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.4em 0.9em;
  border-radius: 3px;
  border: 1px solid #4a4331;
  color: #d9d0b2;
}

.support-link:hover {
  border-color: var(--yellow);
  color: var(--yellow);
}

/* ---------------------------------------------------------------------- */
/* Page Objets — barre de filtres, tableau triable, points de rareté       */
/* ---------------------------------------------------------------------- */

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.8rem;
}

.filters-bar .filter-input {
  padding: 0.5em 0.7em;
  font-size: 0.88rem;
  font-family: 'Roboto Condensed', sans-serif;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fbf7ea;
  color: var(--ink);
}

.filters-bar input[type="search"].filter-input {
  flex: 1 1 220px;
  min-width: 180px;
}

.filters-bar select.filter-input {
  flex: 0 1 auto;
}

.filters-bar .btn-secondary {
  border: 1px solid var(--border);
  padding: 0.5em 0.9em;
}

.objets-count {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0 0 0.8rem;
}

/* En-têtes de colonnes triables */
#objets-table thead th[data-sort] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

#objets-table thead th[data-sort]::after {
  content: "\2195";
  display: inline-block;
  margin-left: 0.4em;
  opacity: 0.5;
  font-size: 0.85em;
}

#objets-table thead th[data-sort].sort-asc::after {
  content: "\2191";
  opacity: 1;
}

#objets-table thead th[data-sort].sort-desc::after {
  content: "\2193";
  opacity: 1;
}

.rarity-dots {
  letter-spacing: 1px;
  color: var(--yellow-dark);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Ligne masquée par les filtres */
#objets-table tbody tr[hidden] {
  display: none;
}

@media (max-width: 600px) {
  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filters-bar .filter-input,
  .filters-bar .btn-secondary {
    width: 100%;
  }
}

/* ---------------------------------------------------------------------- */
/* Page Aptitudes — puces S.P.E.C.I.A.L., tableau triable                  */
/* ---------------------------------------------------------------------- */

#aptitudes-table thead th[data-sort] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

#aptitudes-table thead th[data-sort]::after {
  content: "\2195";
  display: inline-block;
  margin-left: 0.4em;
  opacity: 0.5;
  font-size: 0.85em;
}

#aptitudes-table thead th[data-sort].sort-asc::after {
  content: "\2191";
  opacity: 1;
}

#aptitudes-table thead th[data-sort].sort-desc::after {
  content: "\2193";
  opacity: 1;
}

/* Ligne masquée par les filtres */
#aptitudes-table tbody tr[hidden] {
  display: none;
}

td.col-desc {
  max-width: 480px;
  white-space: normal;
  font-size: 0.89rem;
  color: var(--ink-soft);
}

.special-chip {
  display: inline-block;
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  padding: 0.15em 0.5em;
  border-radius: 3px;
  background: var(--yellow);
  color: var(--black-bar);
  white-space: nowrap;
  margin: 0 0.3em 0.25em 0;
}

.prereq-note {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-style: italic;
}

.source-badge {
  display: inline-block;
  font-family: 'Oswald', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.15em 0.5em;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--ink-soft);
  white-space: nowrap;
}
