/* polices servies par le site (plus de Google Fonts) */
@font-face { font-family: "Inter"; font-weight: 100 900; font-display: swap; src: url(/a/fonts/inter.woff2) format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 100 900; font-display: swap; src: url(/a/fonts/montserrat.woff2) format("woff2"); }

:root {
  --bg: #070a24;
  --bg-raised: #0e1340;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.09);
  --text: #eef0ff;
  --muted: #a3a9d1;
  --accent: #5c7cff;
  --accent-light: #7fd8ff;
  --warn: #ffb547;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.7);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Montserrat", var(--font);
  --topbar: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar) + 16px);
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(92, 124, 255, 0.16), transparent 60%),
    var(--bg);
  background-repeat: no-repeat;
  color: var(--text);
  font: 16px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent-light);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent-light);
  outline-offset: 2px;
}

.container {
  width: min(1160px, 100% - 32px);
  margin-inline: auto;
}

/* En-tête de page */

.hero {
  padding: 64px 0 48px;
  border-bottom: 1px solid var(--bg);
}

/* bannière : l'image est donnée par la page, ex. style="--hero-img: url(/nos-trains/bb60000/assets/banniere.webp)" */
.hero-img {
  padding: 140px 0 56px;
  background:
    linear-gradient(180deg, rgba(7, 10, 36, 0.35) 0%, rgba(7, 10, 36, 0.75) 60%, var(--bg) 100%),
    var(--hero-img) center / cover no-repeat;
}

.hero h1 {
  margin: 0;
  font: 800 clamp(2rem, 5vw, 3.25rem) / 1.1 var(--font-display);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
}

.breadcrumb a {
  color: var(--muted);
}

.breadcrumb a:hover {
  color: var(--text);
}

/* Contenu */

.content {
  display: flex;
  flex-direction: column;
  gap: 48px;
  padding: 48px 0 80px;
}

.block,
.col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.block p,
.block ul,
.block ol,
.block dl,
.block h2,
.block h3 {
  margin: 0;
}

.block h2 {
  font: 700 clamp(1.4rem, 2.6vw, 1.75rem) / 1.25 var(--font-display);
}

.block h3 {
  margin-top: 6px;
  color: var(--accent-light);
  font: 700 1rem / 1.4 var(--font-display);
}

.block ul,
.block ol {
  padding-left: 1.3em;
}

.block li + li {
  margin-top: 6px;
}

.block li::marker {
  color: var(--accent);
}

.panel {
  padding: clamp(20px, 3.5vw, 36px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* grille sur 12 colonnes : chaque colonne indique sa largeur, ex. style="--span:3" */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 32px;
  align-items: start;
}

.col {
  grid-column: span var(--span);
}

@media (max-width: 820px) {
  .grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .col {
    grid-column: auto;
  }
}

figure {
  margin: 0;
}

.media img {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* images agrandies au clic (voir initLightbox dans layout.js) */
.zoom img {
  cursor: zoom-in;
}

/* Tuiles de liens */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: 14px;
}

.tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 600;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
}

.tile:hover {
  background: rgba(92, 124, 255, 0.1);
  border-color: rgba(92, 124, 255, 0.55);
  text-decoration: none;
  transform: translateY(-2px);
}

.tile-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: var(--surface-strong);
  border-radius: 12px;
  font-size: 1.4rem;
  line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

.tile-label {
  flex: 1;
}

.tile-arrow {
  color: var(--muted);
  transition: transform 0.2s, color 0.2s;
}

.tile:hover .tile-arrow,
.card:hover .tile-arrow {
  color: var(--text);
  transform: translateX(3px);
}

/* Cartes (liste des trains, livrées) */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  transition: transform 0.2s, border-color 0.2s;
}

.card-media {
  overflow: hidden;
  flex-shrink: 0;
  aspect-ratio: 1600 / 791;
  background: var(--bg-raised);
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}

.card-body,
.card figcaption {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  column-gap: 12px;
  padding: 14px 18px;
  font: 600 15px / 1.4 var(--font-display);
  align-items: center;
}

.card figcaption {
  flex: 1 0 auto;
  flex-direction: column;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-start;
  min-height: 0px;
  gap: 2px;
}

.cards-link .card:hover {
  border-color: rgba(92, 124, 255, 0.55);
  text-decoration: none;
  transform: translateY(-3px);
}

.card:hover .card-media img {
  transform: scale(1.04);
}

.sb {
  color: gray;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
}

/* Fiche technique d'un train */

.specs {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.specs div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
}

.specs div + div {
  border-top: 1px solid var(--border);
}

.specs dt {
  color: var(--muted);
  font-size: 14px;
}

.specs dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

/* Listes de touches (aide à la conduite) */

.block ul.keys {
  display: grid;
  gap: 8px;
  padding: 0;
  list-style: none;
}

.keys li {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.keys li.step {
  color: var(--muted);
  font-style: italic;
}

kbd {
  flex-shrink: 0;
  min-width: 48px;
  padding: 3px 10px;
  background: linear-gradient(#1c2368, #121853);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom-width: 3px;
  border-radius: 8px;
  color: var(--text);
  font: 600 14px / 1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: center;
  white-space: nowrap;
}

/* Encadrés */

.callout {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(127, 216, 255, 0.07);
  border: 1px solid rgba(127, 216, 255, 0.25);
  border-radius: 12px;
}

.callout p {
  margin: 0;
}

.callout.warn {
  background: rgba(255, 181, 71, 0.08);
  border-color: rgba(255, 181, 71, 0.3);
}

.callout.warn::before {
  content: "⚠️";
}

.callout::before {
  content: "📌";
}

/* mention d'un rôle Discord */
.mention {
  padding: 1px 6px;
  background: rgba(255, 181, 71, 0.14);
  border-radius: 6px;
  color: var(--warn);
}

/* Visionneuse d'images */

.lightbox {
  max-width: 94vw;
  max-height: 94vh;
  padding: 0;
  background: none;
  border: 0;
}

.lightbox::backdrop {
  background: rgba(3, 5, 20, 0.88);
  backdrop-filter: blur(4px);
}

.lightbox img {
  max-width: 94vw;
  max-height: 94vh;
  border-radius: 12px;
  cursor: zoom-out;
}

/* Apparition du contenu au chargement */

@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
}

.hero-inner,
.content > * { animation: rise-in 0.6s ease-out backwards; }
.content > :nth-child(1) { animation-delay: 0.08s; }
.content > :nth-child(2) { animation-delay: 0.16s; }
.content > :nth-child(3) { animation-delay: 0.24s; }
.content > :nth-child(n+4) { animation-delay: 0.32s; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Page d'accueil */

.hero-home {
  padding: 120px 0 80px;
  text-align: center;
}

.hero-home .hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-logo {
  width: min(220px, 55vw);
  margin-bottom: 28px;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.5));
}

.lead {
  max-width: 760px;
  margin-top: 20px;
  color: #d5d9f5;
  font-size: 1.075rem;
}

.lead p {
  margin: 0 0 12px;
}

/* --- */

hr {
    border: none;
    border-top: 1px solid #1d2037;
    width: 100%;
}

.tile-aide {
  grid-column: 1 / -1 !important;
  align-self: flex-end !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between;
  width: fit-content !important;
  margin-left: auto !important;
  margin-right: 0 !important;
}

/* Groupe titre + cartes : titre plus proche de son contenu */
.group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.group-title {
  margin: 0;
  font: 700 clamp(1.4rem, 2.6vw, 1.75rem) / 1.25 var(--font-display);
}

/* Menu déroulant */
.accordion {
  gap: 0;
}

.accordion summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.accordion summary::-webkit-details-marker {
  display: none;
}

.accordion summary h2 {
  margin: 0;
}

/* chevron : ⌄ fermé, ⌃ ouvert */
.accordion summary::after {
  content: "";
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  margin: -4px 4px 0 0;
  border-right: 2px solid var(--accent-light);
  border-bottom: 2px solid var(--accent-light);
  transform: rotate(45deg);
  transition: transform 0.3s ease, margin 0.3s ease;
}

.accordion[open]:not(.is-closing) summary::after {
  margin-top: 4px;
  transform: rotate(-135deg);
}

.accordion-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 20px;
}

.accordion.panel {
  padding: 18px 20px;
}
/* Tuiles plus fines (page Aide conduite) */
.tiles-slim {
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  gap: 10px;
}

.tiles-slim .tile {
  gap: 10px;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 15px;
}

.tiles-slim .tile-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 1.05rem;
}

.dedi {
  text-align: center;
  color: grey;
  font-size: 15px;
}

table {
  border-collapse: collapse;
  border: 0.1px solid white;
  margin-inline: auto;
  width: 100%;
  max-width: 100%;
  gap: 1px !important;
}

th {
  font-size: 16px !important;
}

th,
td {
  padding: 8px 12px;
  border: 0.1px solid white;
  text-align: center;
  vertical-align: middle;
  font-size: 14px;
}

td.adc .media img {
  width: 130px;
  max-width: 100%;
  margin-inline: auto;
  border: 0;
}

td h1 {
  color: var(--accent);
  font-size: 19px;
}

h1.formation {
  margin: 0;
  margin-bottom: -32px;
  text-decoration: underline;
}

table.risque-ferro {
  width: fit-content;
  max-width: 100%;
  table-layout: auto;
  border: none;
  margin-inline: 0;
}

table.risque-ferro th,
table.risque-ferro td {
  border: none;
  text-align: left;
  padding: 8px 12px 8px 28px;
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
}

h3.formation {
  color: var(--accent);
}

img.formation {
  width: 40%;
}

table.cantonnement,
table.cantonnement th,
table.cantonnement td {
  border: none;
}

table.cantonnement {
  width: 100%;
}

table.cantonnement th {
  width: 45%;
  padding-left: 0;
  text-align: left;
  vertical-align: middle;
  font-weight: 400;
  font-size: 15px !important;
  line-height: 1.5;
  white-space: normal;
}

table.cantonnement th li {
  list-style: disc;
  margin: 10px 0 0 1.3em;
}

table.cantonnement th br {
  display: none;
  &.forced {
    display: initial;
  }
}

table.cantonnement td {
  width: 55%;
  padding-right: 0;
  vertical-align: middle;
  text-align: right;
}

table.cantonnement img.formation {
  width: 100%;
}

table.cantonnement .media img {
  border: 0;
}

ul {
  padding-left: 28px;
  margin: 0;
}

li {
  list-style: disc;
}

li::marker {
  color: var(--accent);
}

table.cantonnement th li {
  margin: 10px 0 0 0;
}

.vert {
  color: green;
}

.rouge {
  color: red;
}

.jaune {
  color: yellow;
}

.TI img {
  border-radius: 0%;
}

table.risque-ferro th::before {
  content: "•";
  color: var(--accent);
  display: inline-block;
  width: 1.3em;
  margin-left: -1.3em;
}

table.risque-ferro th {
  padding-left: 28px;
}

/* Alignement vertical du tableau */
table th,
table td {
  vertical-align: middle;
}

/* Neutralise les marges par défaut des figures */
td.adc figure.media {
  margin: 0;
  padding: 0;
}

/* Aligne les images dans la cellule */
td.adc .media {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Évite les écarts liés à l'affichage des images */
td.adc .media img {
  display: block;
  width: 130px;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

@media (max-width: 820px) {

  table.responsive-table tr {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  table.responsive-table th,
  table.responsive-table td {
    display: block;
    width: 100% !important;
    text-align: left;
  }

  table.responsive-table td {
    order: -1; 
    margin-bottom: 20px;
  }
}

.RST-button {
  color: var(--accent);
  font-weight: bold;
}