/* ajouts du site au style du wiki (chargé après global.css et layout.css) : retouches, boutons, espace staff, règlement, animations */

:root {
  /* noms utilisés par logs.css, pris dans les couleurs du wiki */
  --line: var(--border);
  --line-strong: rgba(255, 255, 255, 0.18);
  --band: var(--bg-raised);
  --raised: var(--surface-strong);
  --link: var(--accent-light);
  --signal: var(--accent-light);
  --faint: #737aaa;
  --danger: #ff7b80;
  --accent-hover: #4a6cf0;
  --display: var(--font-display);
  --body: var(--font);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --rail: cubic-bezier(0.65, 0, 0.35, 1);
}

[hidden] { display: none !important; }

/* Retouches : fond uni, barre du haut opaque, plus d'animations génériques (remplacées plus bas) */

html, body { background: var(--bg); }
.topbar { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
.hero-inner, .content > * { animation: none; }
.tile:hover, .card:hover, .cards-link .card:hover, .socials a:hover { transform: none; }
.tile:hover .tile-arrow, .card:hover .tile-arrow { transform: none; }
.tile-icon { display: none; }
.hero-logo { filter: none; }
.lightbox::backdrop { backdrop-filter: none; }

/* Boutons : à plat, coins discrets */

.login, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-shrink: 0;
  border-radius: 6px;
  font: 600 14px var(--font);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.login { height: 36px; padding: 0 14px; background: var(--text); border: 1px solid var(--text); color: var(--bg); font-size: 13px; }
.login:hover { background: #d3d7f3; border-color: #d3d7f3; color: var(--bg); text-decoration: none; }
.btn { height: 42px; padding: 0 18px; border-radius: 4px; background: transparent; border: 1px solid rgba(255, 255, 255, 0.2); color: var(--text); font-weight: 500; }
.btn:hover { border-color: rgba(255, 255, 255, 0.45); text-decoration: none; }
.btn-primary { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn-primary:hover { background: #d3d7f3; border-color: #d3d7f3; color: var(--bg); }
.login:active, .btn:active { transform: translateY(1px); }
.btn img { width: 20px; height: 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.actions form { margin: 0; }

@media (max-width: 520px) {
  .brand span { display: none; }
  .login { padding: 0 10px; }
}

/* Règlement */

.rules { max-width: 860px; }
.rules > p { color: #d5d9f5; }
.rule-title { margin: 40px 0 12px !important; }
.rules > .rule-title:first-child { margin-top: 0 !important; }
h3.rule-title { color: var(--accent-light); font-size: 1.15rem; }
.rule { position: relative; margin: 0; padding: 14px 0 14px 108px; border-top: 1px solid var(--border); }
.rule-num { position: absolute; left: 0; top: 16px; color: var(--accent-light); font: 700 13px / 1.4 var(--font-display); white-space: nowrap; }
.rule p { margin: 0; }
.rule .rule-sanction { margin-top: 6px; color: var(--muted); font-size: 0.94rem; }
.rule-list { margin: 8px 0 16px; }
.rule-source { margin-top: 40px !important; color: var(--muted); font-size: 14px; }
@media (max-width: 640px) {
  .rule { padding-left: 0; padding-top: 34px; }
  .rule-num { top: 12px; }
}

/* Espace staff */

.topbar .logout { margin: 0; }
.staff-title { margin: 0; font: 700 clamp(1.8rem, 3.4vw, 2.4rem) / 1.2 var(--font-display); }
.staff-who { margin: 6px 0 40px; color: var(--muted); }
.staff-page { padding-top: 32px; padding-bottom: 24px; }
.staff-page h2 { margin: 0 0 16px; font: 700 clamp(1.4rem, 2.6vw, 1.75rem) / 1.25 var(--font-display); }
.staff-page section + section { margin-top: 48px; }
.tile-label small { display: block; margin-top: 2px; color: var(--muted); font-size: 0.85rem; font-weight: 400; }
.table-wrap { overflow-x: auto; }

/* tableaux du staff : rien du style des tableaux du wiki (bordures blanches, texte centré) */
.staff-page table, .staff-doc table, #app table { width: 100%; max-width: none; margin: 0; border: 0; border-collapse: collapse; }
.staff-page th, .staff-page td, .staff-doc th, .staff-doc td, #app th, #app td { border: 0; border-bottom: 1px solid var(--border); text-align: left; font-size: inherit !important; }
.staff-page th, .staff-doc th { color: var(--muted); font-weight: 500; }
.staff-page td, .staff-page th { padding: 12px 18px 12px 0; white-space: nowrap; }
.staff-doc ul { padding-left: 22px; }
.staff-doc li::marker { color: inherit; }
.staff-doc { padding-top: 8px; }
.staff-doc .hero { padding: 24px 0 8px; border-bottom: 0; }
/* guide et commandes : sections et lignes affichées tout de suite, sans apparition au défilement */
.staff-doc .reveal, .staff-doc .content tbody tr { opacity: 1 !important; transform: none !important; }
.staff-doc .content section.sr-in, .staff-doc .content tbody tr.sr-in { animation: none; }

/* porte de l'espace staff (login, accès refusé) : une colonne de texte, une action */
.door { padding: clamp(56px, 12vh, 128px) 0 96px; }
.door .container > * { max-width: 620px; }
.door h1 { margin: 0 0 20px; font: 700 clamp(2rem, 4.4vw, 2.75rem) / 1.12 var(--font-display); letter-spacing: -0.015em; }
.door-text { margin: 0; font-size: 1.05rem; line-height: 1.6; }
.door-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; margin-top: 30px; }
.btn-discord { display: inline-flex; align-items: center; gap: 11px; height: 46px; padding: 0 20px 0 16px; border-radius: 8px; background: #5865f2; color: #fff;
  font-weight: 600; text-decoration: none; transition: background-color 0.15s; }
.btn-discord:hover { background: #4752c4; color: #fff; text-decoration: none; }
.btn-discord:active { transform: translateY(1px); }
.btn-discord:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.discord-mark { flex: none; width: 22px; height: 22px; }

/* accueil de l'espace staff : un sommaire en lignes, pas de cartes */
.staff-home .staff-title { margin-bottom: 28px; }
.index { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.index li { margin: 0; padding: 0; list-style: none; border-bottom: 1px solid var(--border); }
.index li::before, .index li::marker { content: none; display: none; }
.index-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 18px 4px; color: var(--text); text-decoration: none; }
.index-row:hover { text-decoration: none; }
.index-name { font: 600 1.2rem / 1.3 var(--font-display); transition: color 0.15s; }
.index-go { color: var(--muted); opacity: 0; transform: translateX(-6px); transition: opacity 0.15s, transform 0.2s var(--rail); }
.index-row:hover .index-name, .index-row:focus-visible .index-name { color: var(--accent-light); }
.index-row:hover .index-go, .index-row:focus-visible .index-go { opacity: 1; transform: none; }
.index-row:focus-visible { outline: 2px solid var(--accent-light); outline-offset: -2px; border-radius: 4px; }
@media (max-width: 700px) {
  .index-row { padding: 16px 2px; }
  .index-go { opacity: 1; transform: none; }
}

/* aperçu de l'espace d'un staff par un administrateur */
.viewing { position: sticky; top: var(--topbar, 64px); z-index: 40; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 16px;
  padding: 9px 16px; background: #ffb547; color: #1b1400; font-size: 0.92rem; }
.viewing form { margin: 0; }
.viewing button { height: 28px; padding: 0 12px; border: 1px solid rgba(27, 20, 0, 0.55); border-radius: 5px; background: none; color: inherit; font: 600 0.85rem var(--font); cursor: pointer; }
.viewing button:hover { background: rgba(27, 20, 0, 0.1); }

/* Wiki : moins de boîtes. Coins nets, images légendées comme dans un magazine, sommaires en lignes ------------------ */

body:not(.staff) { --radius: 6px; --radius-sm: 4px; }
/* trains et livrées : l'image, puis son nom dessous, sans cadre ni flèche */
body:not(.staff) .cards { gap: 34px 26px; }
body:not(.staff) .card { overflow: visible; background: none; border: 0; border-radius: 0; }
body:not(.staff) .card-media { border-radius: 4px; background: var(--bg-raised); box-shadow: inset 0 0 0 1px var(--border); }
body:not(.staff) .card-media img { transition: filter 0.2s; }
body:not(.staff) .card:hover .card-media img { transform: none; filter: brightness(1.08); }
body:not(.staff) .card-body, body:not(.staff) .card figcaption { padding: 12px 0 0; font: 600 1.05rem / 1.3 var(--font-display); }
body:not(.staff) .card .tile-arrow { display: none; }
body:not(.staff) .cards-link .card:hover .card-body span:first-child { color: var(--accent-light); }
body:not(.staff) .card figcaption small, body:not(.staff) .card figcaption span + span { color: var(--muted); font: 400 0.9rem var(--font); }
/* liens de navigation (accueil, « Comment conduire ? ») : un sommaire en lignes, comme l'espace staff */
body:not(.staff) .tiles { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--border); }
body:not(.staff) .tile { padding: 17px 4px; background: none; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; font: 600 1.15rem / 1.3 var(--font-display); }
body:not(.staff) .tile::before { content: none; }
body:not(.staff) .tile:hover { background: none; }
body:not(.staff) .tile:hover .tile-label { transform: none; color: var(--accent-light); }
body:not(.staff) .tile .tile-arrow { margin-left: auto; color: var(--muted); opacity: 0; transform: translateX(-6px); transition: opacity 0.15s, transform 0.2s var(--rail); }
body:not(.staff) .tile:hover .tile-arrow, body:not(.staff) .tile:focus-visible .tile-arrow { opacity: 1; transform: none; color: var(--text); }
/* « Comment conduire ? » : un simple lien fléché à droite */
body:not(.staff) .tiles:has(.tile-aide) { border-top: 0; }
body:not(.staff) .tile-aide { padding: 4px 0; border-bottom: 0; color: var(--accent-light); font: 600 1rem var(--font); }
body:not(.staff) .tile-aide .tile-arrow { opacity: 1; transform: none; color: inherit; }
/* fiche technique d'un train : une liste à filets, sans boîte */
body:not(.staff) .specs { overflow: visible; background: none; border: 0; border-radius: 0; border-top: 1px solid var(--border); }
body:not(.staff) .specs div { padding: 10px 0; border-bottom: 1px solid var(--border); }
body:not(.staff) .specs div + div { border-top: 0; }
body:not(.staff) .specs dd { font-variant-numeric: tabular-nums; }
body:not(.staff) .media img { border-radius: 4px; }
@media (max-width: 700px) {
  body:not(.staff) .tile .tile-arrow { opacity: 1; transform: none; }
}

/* Animations ---------------------------------------------------------------- */

/* changement de page : tout le contenu défile de côté, comme un train qui part, et la page suivante arrive en parallèle ;
   le haut de page reste en place ; le sens suit l'ordre du menu (portail.js) */
@view-transition { navigation: auto; }
.topbar { view-transition-name: topbar; }
.hero { view-transition-name: page-hero; }
::view-transition-group(*) { animation-duration: 0.7s; animation-timing-function: var(--rail); }
::view-transition-old(topbar), ::view-transition-new(topbar) { animation: none; }
html:active-view-transition-type(forward)::view-transition-old(root) { animation: slide-to-left 0.7s var(--rail) both; }
html:active-view-transition-type(forward)::view-transition-new(root) { animation: slide-from-right 0.7s var(--rail) both; }
html:active-view-transition-type(backward)::view-transition-old(root) { animation: slide-to-right 0.7s var(--rail) both; }
html:active-view-transition-type(backward)::view-transition-new(root) { animation: slide-from-left 0.7s var(--rail) both; }
/* l'en-tête de page va moins vite que le contenu : effet de profondeur */
html:active-view-transition-type(forward)::view-transition-old(page-hero) { animation: slide-to-left-far 0.7s var(--rail) both; }
html:active-view-transition-type(forward)::view-transition-new(page-hero) { animation: slide-from-right-far 0.7s var(--rail) both; }
html:active-view-transition-type(backward)::view-transition-old(page-hero) { animation: slide-to-right-far 0.7s var(--rail) both; }
html:active-view-transition-type(backward)::view-transition-new(page-hero) { animation: slide-from-left-far 0.7s var(--rail) both; }
@keyframes slide-to-left { to { transform: translateX(-100vw); } }
@keyframes slide-from-right { from { transform: translateX(100vw); } }
@keyframes slide-to-right { to { transform: translateX(100vw); } }
@keyframes slide-from-left { from { transform: translateX(-100vw); } }
@keyframes slide-to-left-far { to { transform: translateX(-45vw); opacity: 0; } }
@keyframes slide-from-right-far { from { transform: translateX(45vw); opacity: 0; } }
@keyframes slide-to-right-far { to { transform: translateX(45vw); opacity: 0; } }
@keyframes slide-from-left-far { from { transform: translateX(-45vw); opacity: 0; } }
/* image agrandie (visionneuse) : elle grandit depuis sa place */
::view-transition-group(zoom) { animation-duration: 0.45s; animation-timing-function: cubic-bezier(0.3, 0.7, 0.1, 1); }
::view-transition-old(zoom), ::view-transition-new(zoom) { height: 100%; object-fit: contain; }

@supports (animation-timeline: view()) {
  /* jauge de lecture : un rail qui se remplit sous le haut de page (pas dans l'espace staff) */
  body:not(.staff) .topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent-light);
    transform: scaleX(0); transform-origin: left; animation: rail-fill linear both; animation-timeline: scroll(root); }
  @keyframes rail-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

  /* bannière : l'image glisse plus lentement que la page, le titre s'efface en montant */
  .hero-img { animation: banner-drift linear both; animation-timeline: scroll(root); animation-range: 0 70vh; }
  @keyframes banner-drift { to { background-position: center 85%; } }
  .hero-img .hero-inner { animation: title-away linear both; animation-timeline: scroll(root); animation-range: 0 55vh; }
  @keyframes title-away { to { transform: translateY(-36px); opacity: 0.35; } }

  /* cartes, tuiles et fiches : elles entrent en gare à mesure qu'on descend, comme des voitures qui s'attellent */
  /* pas dans l'espace staff : le texte y est affiché tel quel */
  body:not(.staff) :is(.card, .tiles .tile, .specs > div, .keys li, .rule, .accordion) { animation: couple-in linear both; animation-timeline: view(); animation-range: entry 5% entry 80%; }
  body:not(.staff) .cards > :nth-child(even) { animation-range: entry 15% entry 90%; }
  @keyframes couple-in {
    from { opacity: 0; transform: translateX(14vw) skewX(-8deg); filter: blur(6px); }
    70% { opacity: 1; transform: translateX(-6px) skewX(1deg); filter: blur(0); }
    to { opacity: 1; transform: none; filter: none; }
  }
  /* images des livrées : léger travelling à l'intérieur du cadre */
  .card-media img { animation: pan-in linear both; animation-timeline: view(); animation-range: cover 0% cover 100%; }
  @keyframes pan-in { from { transform: scale(1.12) translateX(4%); } to { transform: scale(1.12) translateX(-4%); } }
}

/* survol : le contenu des tuiles glisse et la flèche part en avant */
.tile { position: relative; overflow: hidden; }
.tile::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(92, 124, 255, 0.16), transparent 70%);
  transform: translateX(-101%); transition: transform 0.45s var(--rail); }
.tile:hover::before, .tile:focus-visible::before { transform: none; }
.tile-label, .tile-arrow { position: relative; transition: transform 0.35s var(--rail), color 0.2s; }
.tile:hover .tile-label { transform: translateX(6px); }
.tile:hover .tile-arrow { transform: translateX(4px); color: var(--text); }

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


/* accueil de l'espace staff : déconnexion sous le sommaire */
.logout-home { margin: 32px 0 0; }
